@depict-ai/ui 2.1.12 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +870 -608
- package/ES10/index.d.ts +3 -2
- package/ES10/index.js +871 -609
- package/latest/index.cjs +842 -596
- package/latest/index.d.ts +3 -2
- package/latest/index.js +843 -597
- package/locales/ES10/index.cjs +25 -12
- package/locales/ES10/index.d.ts +1 -0
- package/locales/ES10/index.js +25 -12
- package/locales/latest/index.cjs +25 -12
- package/locales/latest/index.d.ts +1 -0
- package/locales/latest/index.js +25 -12
- package/locales/require.js +1152 -0
- package/package.json +2 -2
- package/server/ES10/index.cjs +746 -518
- package/server/ES10/index.d.ts +3 -2
- package/server/ES10/index.js +747 -519
- package/server/latest/index.cjs +732 -520
- package/server/latest/index.d.ts +3 -2
- package/server/latest/index.js +733 -521
package/server/latest/index.cjs
CHANGED
|
@@ -19,7 +19,7 @@ $parcel$export(module.exports, "ListingProvider", () => $84798aaa863a4909$export
|
|
|
19
19
|
$parcel$export(module.exports, "useListing", () => $84798aaa863a4909$export$8d0c4fdbb05a2f2e);
|
|
20
20
|
$parcel$export(module.exports, "ShopifyContainedImage", () => $a33065cfed827fc0$export$e4b984597b71e989);
|
|
21
21
|
$parcel$export(module.exports, "SlidableItems", () => $a0e53f99354809d9$export$6649caad96ef8870);
|
|
22
|
-
$parcel$export(module.exports, "
|
|
22
|
+
$parcel$export(module.exports, "make_accurate_width_accessor", () => $f13855d1b951b24a$export$ebdc3711f7e02ccd);
|
|
23
23
|
$parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
|
|
24
24
|
$parcel$export(module.exports, "RecommendationGrid", () => $1f8dbf7e28b3eff2$export$9756467d34d91cdb);
|
|
25
25
|
$parcel$export(module.exports, "ShopifyResponsiveImg", () => $19950faaac026e09$export$6e5611bc7e57e477);
|
|
@@ -70,7 +70,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
70
70
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
71
71
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
72
72
|
/*! Depict.ai search and product listing SDK */
|
|
73
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.
|
|
73
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.13";
|
|
74
74
|
const $1ab22f2cd39b3061$var$fallback_operator = "in";
|
|
75
75
|
const $1ab22f2cd39b3061$var$fallback_token = "";
|
|
76
76
|
const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
|
|
@@ -486,24 +486,30 @@ function $a0e53f99354809d9$export$6649caad96ef8870({
|
|
|
486
486
|
|
|
487
487
|
/** @jsxImportSource solid-js */
|
|
488
488
|
|
|
489
|
-
function $
|
|
490
|
-
const [
|
|
489
|
+
function $f13855d1b951b24a$export$ebdc3711f7e02ccd(what_to_watch) {
|
|
490
|
+
const [width, setWidth] = $5vyXB$solidjs.createSignal();
|
|
491
491
|
const resizeObserver = new ResizeObserver($5vyXB$depictaiutilishared.catchify(records => {
|
|
492
492
|
for (let j = 0; j < records.length; j++) {
|
|
493
493
|
const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
|
|
494
|
-
|
|
494
|
+
setWidth(width);
|
|
495
495
|
}
|
|
496
496
|
}));
|
|
497
497
|
// 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.
|
|
498
498
|
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
499
499
|
const disconnect = (0, $5vyXB$depictaiutilishared.observer).onexists(what_to_watch, ({
|
|
500
500
|
element: element
|
|
501
|
-
}) => requestAnimationFrame($5vyXB$depictaiutilishared.catchify(() =>
|
|
501
|
+
}) => requestAnimationFrame($5vyXB$depictaiutilishared.catchify(() => {
|
|
502
|
+
const current_size = what_to_watch.getBoundingClientRect().width;
|
|
503
|
+
if (current_size)
|
|
504
|
+
// 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.
|
|
505
|
+
setWidth(current_size);
|
|
506
|
+
resizeObserver.observe(element);
|
|
507
|
+
})));
|
|
502
508
|
$5vyXB$solidjs.onCleanup(() => {
|
|
503
509
|
resizeObserver.disconnect();
|
|
504
510
|
disconnect();
|
|
505
511
|
});
|
|
506
|
-
return
|
|
512
|
+
return width;
|
|
507
513
|
}
|
|
508
514
|
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
509
515
|
const cols_at_size = [];
|
|
@@ -1260,12 +1266,12 @@ function $d659702496cb72ea$export$a71e92cfbb498adc(props) {
|
|
|
1260
1266
|
}
|
|
1261
1267
|
const $c77c68e559a1506c$var$_tmpl$ = '<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"></path>';
|
|
1262
1268
|
function $c77c68e559a1506c$export$3b621d86b1566b2(props = {}) {
|
|
1263
|
-
return $5vyXB$solidjsweb.ssrElement("svg", $5vyXB$solidjsweb.mergeProps(
|
|
1269
|
+
return $5vyXB$solidjsweb.ssrElement("svg", $5vyXB$solidjsweb.mergeProps({
|
|
1264
1270
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1265
1271
|
width: "21.064",
|
|
1266
1272
|
height: "21.047",
|
|
1267
1273
|
viewBox: "0 0 21.064 21.064"
|
|
1268
|
-
}), () => $5vyXB$solidjsweb.ssr($c77c68e559a1506c$var$_tmpl$), true);
|
|
1274
|
+
}, props), () => $5vyXB$solidjsweb.ssr($c77c68e559a1506c$var$_tmpl$), true);
|
|
1269
1275
|
}
|
|
1270
1276
|
|
|
1271
1277
|
/**
|
|
@@ -1479,7 +1485,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
|
|
|
1479
1485
|
const $1c63082b2da848ad$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
1480
1486
|
$1c63082b2da848ad$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--$-->", "<!--/--></label>"];
|
|
1481
1487
|
const $1c63082b2da848ad$export$48513f6b9f8ce62d = props => {
|
|
1482
|
-
// 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
|
|
1488
|
+
/* 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
|
|
1483
1489
|
const count = $5vyXB$solidjs.createMemo(() => props.count_);
|
|
1484
1490
|
const label = $5vyXB$solidjs.createMemo(() => props.label_);
|
|
1485
1491
|
const checked = $5vyXB$solidjs.createMemo(() => props.checked_);
|
|
@@ -1511,6 +1517,59 @@ function $0fe1e7efdf4200d6$export$ca21a16d65b3dd8({
|
|
|
1511
1517
|
}) {
|
|
1512
1518
|
return $5vyXB$solidjsweb.ssr($0fe1e7efdf4200d6$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `expand-filter ${get_show_extras() ? "expanded" : ""}`, $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $cc43b6428000c4bf$export$f21ab0717a89c77f), {})), get_show_extras() ? $5vyXB$solidjsweb.escape(i18n_.view_less_()) : $5vyXB$solidjsweb.escape(i18n_.view_more_()));
|
|
1513
1519
|
}
|
|
1520
|
+
const $d023ed916c84e75d$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
1521
|
+
$d023ed916c84e75d$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
1522
|
+
function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
|
|
1523
|
+
whole_text_to_display_: whole_text_to_display_memo,
|
|
1524
|
+
searching_for_value_: searching_for_value_memo,
|
|
1525
|
+
class_: class_
|
|
1526
|
+
}) {
|
|
1527
|
+
const [get_has_highlighted, set_has_highlighted] = $5vyXB$solidjs.createSignal(false);
|
|
1528
|
+
const text_itself = $5vyXB$solidjs.createMemo(() => $5vyXB$solidjs.batch(() => {
|
|
1529
|
+
set_has_highlighted(false);
|
|
1530
|
+
const searching_for_value = searching_for_value_memo();
|
|
1531
|
+
const whole_text_to_display_ = whole_text_to_display_memo();
|
|
1532
|
+
let for_black = "";
|
|
1533
|
+
let pushed_grey = false;
|
|
1534
|
+
const search_q = searching_for_value;
|
|
1535
|
+
if (!search_q) return whole_text_to_display_;
|
|
1536
|
+
const output = [];
|
|
1537
|
+
const searching_for = search_q.toLowerCase();
|
|
1538
|
+
const push_black = () => {
|
|
1539
|
+
if (for_black) {
|
|
1540
|
+
set_has_highlighted(true);
|
|
1541
|
+
output.push($5vyXB$solidjsweb.ssr($d023ed916c84e75d$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(for_black))); // "black"
|
|
1542
|
+
for_black = "";
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
for (let i = 0; i < whole_text_to_display_.length;) {
|
|
1546
|
+
let is_whole_word = true;
|
|
1547
|
+
let searching_for_but_with_texts_casing = "";
|
|
1548
|
+
const i_at_start = i;
|
|
1549
|
+
for (let j = 0; j < searching_for.length; i++, j++) {
|
|
1550
|
+
const letter_in_suggestion = whole_text_to_display_[i];
|
|
1551
|
+
if (letter_in_suggestion?.toLowerCase() !== searching_for[j]) {
|
|
1552
|
+
is_whole_word = false;
|
|
1553
|
+
i = i_at_start;
|
|
1554
|
+
break;
|
|
1555
|
+
}
|
|
1556
|
+
searching_for_but_with_texts_casing += letter_in_suggestion;
|
|
1557
|
+
}
|
|
1558
|
+
if (is_whole_word) {
|
|
1559
|
+
push_black();
|
|
1560
|
+
output.push(searching_for_but_with_texts_casing);
|
|
1561
|
+
pushed_grey = true;
|
|
1562
|
+
} else for_black += whole_text_to_display_[i++];
|
|
1563
|
+
}
|
|
1564
|
+
push_black();
|
|
1565
|
+
if (!pushed_grey) {
|
|
1566
|
+
set_has_highlighted(false);
|
|
1567
|
+
return whole_text_to_display_;
|
|
1568
|
+
}
|
|
1569
|
+
return output;
|
|
1570
|
+
}));
|
|
1571
|
+
return $5vyXB$solidjsweb.ssr($d023ed916c84e75d$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `${$5vyXB$solidjsweb.escape(class_, true) || ""} ${get_has_highlighted() ? "has-match" : ""}`, $5vyXB$solidjsweb.ssrAttribute("title", $5vyXB$solidjsweb.escape(whole_text_to_display_memo(), true), false), $5vyXB$solidjsweb.escape(text_itself()));
|
|
1572
|
+
}
|
|
1514
1573
|
const $d94869c80e337a3d$var$_tmpl$ = ["<form", ' class="checkboxes"><!--$-->', "<!--/--><!--$-->", "<!--/--></form>"];
|
|
1515
1574
|
const $d94869c80e337a3d$var$max_visible_without_collapsing = 15;
|
|
1516
1575
|
const $d94869c80e337a3d$var$show_non_collapsible_when_collapsed = 4;
|
|
@@ -1518,7 +1577,8 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
|
|
|
1518
1577
|
filter_: filter_,
|
|
1519
1578
|
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
1520
1579
|
i18n_: i18n_,
|
|
1521
|
-
view_more_button_below_group_: [, set_view_more_button_below_group_]
|
|
1580
|
+
view_more_button_below_group_: [, set_view_more_button_below_group_],
|
|
1581
|
+
filter_query_: filter_query_
|
|
1522
1582
|
}) {
|
|
1523
1583
|
const existing_filter = $5vyXB$solidjs.createMemo(() => {
|
|
1524
1584
|
const {
|
|
@@ -1546,12 +1606,18 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
|
|
|
1546
1606
|
const value = $daa394359b026187$export$325f75597868c4f0(checkbox().value_);
|
|
1547
1607
|
return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
|
|
1548
1608
|
});
|
|
1609
|
+
const value = $5vyXB$solidjs.createMemo(() => checkbox().value_);
|
|
1549
1610
|
return $5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
|
|
1550
1611
|
get value_() {
|
|
1551
|
-
return
|
|
1612
|
+
return value();
|
|
1552
1613
|
},
|
|
1553
1614
|
get label_() {
|
|
1554
|
-
return
|
|
1615
|
+
return $5vyXB$solidjsweb.createComponent((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
1616
|
+
get whole_text_to_display_() {
|
|
1617
|
+
return $5vyXB$solidjs.createMemo(() => checkbox().name_ || value());
|
|
1618
|
+
},
|
|
1619
|
+
searching_for_value_: () => filter_query_?.()
|
|
1620
|
+
});
|
|
1555
1621
|
},
|
|
1556
1622
|
get count_() {
|
|
1557
1623
|
return checkbox().count_;
|
|
@@ -1613,7 +1679,8 @@ const $c1dc1554c1b94233$var$_tmpl$ = ["<form", ' class="radios">', "</form>"],
|
|
|
1613
1679
|
$c1dc1554c1b94233$var$_tmpl$3 = ["<label", ' class="', '"', '><div class="left"><input type="radio"', "", '><span class="custom-indicator"></span><!--$-->', "<!--/--></div><!--$-->", "<!--/--></label>"];
|
|
1614
1680
|
function $c1dc1554c1b94233$export$430444115f70a734({
|
|
1615
1681
|
selected_filters_: selected_filters_,
|
|
1616
|
-
filter_: filter_
|
|
1682
|
+
filter_: filter_,
|
|
1683
|
+
filter_query_: filter_query_
|
|
1617
1684
|
}) {
|
|
1618
1685
|
const radio_name = $5vyXB$depictaiutilishared.make_random_classname();
|
|
1619
1686
|
const existing_filter = $5vyXB$solidjs.createMemo(() => {
|
|
@@ -1633,17 +1700,21 @@ function $c1dc1554c1b94233$export$430444115f70a734({
|
|
|
1633
1700
|
children: (value, index) => {
|
|
1634
1701
|
const random_selector = $5vyXB$depictaiutilishared.make_random_classname();
|
|
1635
1702
|
const count = $5vyXB$solidjs.createMemo(() => filter_().meta.counts?.[index]);
|
|
1703
|
+
const label = $5vyXB$solidjs.createMemo(() => {
|
|
1704
|
+
const name = filter_().meta?.names?.[index];
|
|
1705
|
+
if (name) return name;
|
|
1706
|
+
const v = value();
|
|
1707
|
+
return Array.isArray(v) ? v.join(" - ") : v + "";
|
|
1708
|
+
});
|
|
1636
1709
|
return $5vyXB$solidjsweb.ssr($c1dc1554c1b94233$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey(), `input-row ${count() === 0 ? "count-0" : ""}`, $5vyXB$solidjsweb.ssrAttribute("for", $5vyXB$solidjsweb.escape(random_selector, true), false), $5vyXB$solidjsweb.ssrAttribute("id", $5vyXB$solidjsweb.escape(random_selector, true), false) + $5vyXB$solidjsweb.ssrAttribute("name", $5vyXB$solidjsweb.escape(radio_name, true), false), $5vyXB$solidjsweb.ssrAttribute("checked", $5vyXB$solidjs.createMemo(() => {
|
|
1637
1710
|
const v = value();
|
|
1638
1711
|
const data = existing_filter()?.data;
|
|
1639
1712
|
if ($daa394359b026187$export$325f75597868c4f0(data) === $daa394359b026187$export$325f75597868c4f0(v)) return true;
|
|
1640
1713
|
return Array.isArray(data) && data.every((item, index) => item === v[index]);
|
|
1641
|
-
})(), true), $5vyXB$solidjsweb.escape($5vyXB$
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
return Array.isArray(v) ? v.join(" - ") : v;
|
|
1646
|
-
})()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
1714
|
+
})(), true), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
1715
|
+
whole_text_to_display_: label,
|
|
1716
|
+
searching_for_value_: () => filter_query_?.()
|
|
1717
|
+
})), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
1647
1718
|
get when() {
|
|
1648
1719
|
return count() != undefined;
|
|
1649
1720
|
},
|
|
@@ -1660,7 +1731,8 @@ const $0b7222ba8a8bb72f$var$_tmpl$ = ["<div", ' class="', '"><div class="input-g
|
|
|
1660
1731
|
function $0b7222ba8a8bb72f$export$e0d834a0ad870cda({
|
|
1661
1732
|
filter_: filter_,
|
|
1662
1733
|
selected_filters_: selected_filters_,
|
|
1663
|
-
i18n_: i18n_
|
|
1734
|
+
i18n_: i18n_,
|
|
1735
|
+
filter_query_: filter_query_
|
|
1664
1736
|
}) {
|
|
1665
1737
|
// 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
|
|
1666
1738
|
// 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
|
|
@@ -1879,168 +1951,428 @@ function $7567511a7c3e4bd7$export$e5c2828934226505({
|
|
|
1879
1951
|
});
|
|
1880
1952
|
return outer_div;
|
|
1881
1953
|
}
|
|
1882
|
-
const $
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
function $3bdc00a1353c1150$export$a32086fa6616eafd({
|
|
1889
|
-
filter_: filter_,
|
|
1890
|
-
selected_filters_: selected_filters_,
|
|
1891
|
-
i18n_: i18n_,
|
|
1892
|
-
view_more_button_below_group_: view_more_button_below_group_,
|
|
1893
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_
|
|
1954
|
+
const $5ea5a82e398f6f44$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
1955
|
+
const $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters = 30;
|
|
1956
|
+
function $5ea5a82e398f6f44$export$e1a98a189fd2c0e7({
|
|
1957
|
+
content_result_: content_result_,
|
|
1958
|
+
key_: key_,
|
|
1959
|
+
cut_when_possible_: cut_when_possible_
|
|
1894
1960
|
}) {
|
|
1895
|
-
|
|
1896
|
-
const
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
}) => checking_field === field && checking_op === op);
|
|
1905
|
-
});
|
|
1906
|
-
const show_extras = $5vyXB$solidjs.createSignal(false);
|
|
1907
|
-
const trigger_sync_ = $3bdc00a1353c1150$var$batching_filter_state_syncer({
|
|
1908
|
-
filter_: filter_,
|
|
1909
|
-
existing_filter_: existing_filter,
|
|
1910
|
-
selected_filters_: selected_filters_,
|
|
1911
|
-
get category_structure_() {
|
|
1912
|
-
return structured_categories();
|
|
1913
|
-
}
|
|
1914
|
-
});
|
|
1915
|
-
const structured_categories = $5vyXB$solidjs.createMemo(() => {
|
|
1916
|
-
const execute_when_structure_finished = [];
|
|
1917
|
-
const {
|
|
1918
|
-
values: values,
|
|
1919
|
-
names: names,
|
|
1920
|
-
counts: counts
|
|
1921
|
-
} = filter_().meta;
|
|
1922
|
-
const data_structure = {};
|
|
1923
|
-
for (let i = 0; i < values.length; i++) {
|
|
1924
|
-
const value = values[i];
|
|
1925
|
-
let pointer = data_structure;
|
|
1926
|
-
let parent_ = {};
|
|
1927
|
-
let created_an_object = false;
|
|
1928
|
-
for (let j = 0; j < value.length; j++) {
|
|
1929
|
-
const this_categories_name = value[j];
|
|
1930
|
-
const obj = pointer[this_categories_name] ||= (() => {
|
|
1931
|
-
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;
|
|
1932
|
-
const created_obj = {
|
|
1933
|
-
name_: names[i],
|
|
1934
|
-
count_: counts?.[i],
|
|
1935
|
-
parent_: parent_,
|
|
1936
|
-
is_expanded_: $3bdc00a1353c1150$var$make_expanded_signal({
|
|
1937
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
1938
|
-
filter_value_: value_as_string
|
|
1939
|
-
}),
|
|
1940
|
-
value_: value_as_string,
|
|
1941
|
-
children_: {}
|
|
1942
|
-
};
|
|
1943
|
-
const {
|
|
1944
|
-
signal_: signal_,
|
|
1945
|
-
on_structure_complete_: on_structure_complete_
|
|
1946
|
-
} = $3bdc00a1353c1150$var$create_updating_signal({
|
|
1947
|
-
self_: created_obj,
|
|
1948
|
-
existing_filter_: $5vyXB$solidjs.untrack(existing_filter),
|
|
1949
|
-
trigger_sync_: trigger_sync_
|
|
1950
|
-
});
|
|
1951
|
-
execute_when_structure_finished.push(on_structure_complete_);
|
|
1952
|
-
created_obj.is_checked_ = signal_;
|
|
1953
|
-
parent_ = created_obj;
|
|
1954
|
-
created_an_object = true;
|
|
1955
|
-
return created_obj;
|
|
1956
|
-
})();
|
|
1957
|
-
pointer = obj.children_;
|
|
1958
|
-
parent_ = obj;
|
|
1959
|
-
}
|
|
1960
|
-
if (!created_an_object && "value_" in parent_) {
|
|
1961
|
-
// 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
|
|
1962
|
-
// [
|
|
1963
|
-
// ["Öl", "IPA"],
|
|
1964
|
-
// ["Öl", "Pale Ale"],
|
|
1965
|
-
// ["Öl", "Ale"],
|
|
1966
|
-
// ["Öl", "Mörk Lager"],
|
|
1967
|
-
// ["Öl", "Suröl"],
|
|
1968
|
-
// ["Öl", "Veteöl"],
|
|
1969
|
-
// ["Öl", "Stout och Porter"],
|
|
1970
|
-
// ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
|
|
1971
|
-
// ["Öl", "Ljus Lager"],
|
|
1972
|
-
// ];
|
|
1973
|
-
// In this case we want to just correct the name and value of the already created object, which will be in parent_
|
|
1974
|
-
parent_.value_ = value.map(v => v + "");
|
|
1975
|
-
parent_.name_ = names[i];
|
|
1976
|
-
parent_.count_ = counts[i];
|
|
1977
|
-
parent_.is_expanded_ = $3bdc00a1353c1150$var$make_expanded_signal({
|
|
1978
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
1979
|
-
filter_value_: parent_.value_
|
|
1980
|
-
});
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
|
|
1984
|
-
$3bdc00a1353c1150$var$expand_until_choice(data_structure);
|
|
1985
|
-
$5vyXB$depictaiutilishared.dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
|
|
1986
|
-
return data_structure;
|
|
1987
|
-
});
|
|
1988
|
-
const some_top_level_are_hidden = $5vyXB$solidjs.createMemo(() => Object.keys(structured_categories()).length > $3bdc00a1353c1150$var$max_visible_without_collapsing);
|
|
1989
|
-
const {
|
|
1990
|
-
expand: expand,
|
|
1991
|
-
collapse: collapse,
|
|
1992
|
-
ExpandingContainer: ExpandingContainer
|
|
1993
|
-
} = $4b455f60dadde8b8$export$5bad61ecde080b1f({
|
|
1994
|
-
duration: 200
|
|
1995
|
-
});
|
|
1996
|
-
const expanding_container_els = $5vyXB$solidjsweb.createComponent(ExpandingContainer, {
|
|
1961
|
+
const matched_tokens = $5vyXB$solidjs.createMemo(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
1962
|
+
const full_value = $5vyXB$solidjs.createMemo(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
1963
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
1964
|
+
get when() {
|
|
1965
|
+
return matched_tokens()?.length;
|
|
1966
|
+
},
|
|
1967
|
+
get fallback() {
|
|
1968
|
+
return full_value();
|
|
1969
|
+
},
|
|
1997
1970
|
get children() {
|
|
1998
|
-
return
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
1971
|
+
return (() => {
|
|
1972
|
+
const segmented_cut_text = $5vyXB$solidjs.createMemo(() => {
|
|
1973
|
+
const segmented_text = $5ea5a82e398f6f44$export$1b00d74faf266c56(full_value(), matched_tokens());
|
|
1974
|
+
if (cut_when_possible_) $5ea5a82e398f6f44$var$cut_text(segmented_text);
|
|
1975
|
+
return segmented_text;
|
|
1976
|
+
});
|
|
1977
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
1978
|
+
get each() {
|
|
1979
|
+
return segmented_cut_text();
|
|
1980
|
+
},
|
|
1981
|
+
children: item => {
|
|
1982
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
1983
|
+
get when() {
|
|
1984
|
+
return item().highlighted_;
|
|
1985
|
+
},
|
|
1986
|
+
get fallback() {
|
|
1987
|
+
return item().text_;
|
|
1988
|
+
},
|
|
1989
|
+
get children() {
|
|
1990
|
+
return $5vyXB$solidjsweb.ssr($5ea5a82e398f6f44$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(item().text_));
|
|
1991
|
+
}
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
})();
|
|
2006
1996
|
}
|
|
2007
1997
|
});
|
|
2008
|
-
$5vyXB$solidjs.createRenderEffect(() => {
|
|
2009
|
-
view_more_button_below_group_[1](some_top_level_are_hidden() ? $5vyXB$solidjsweb.createComponent((0, $0fe1e7efdf4200d6$export$ca21a16d65b3dd8), {
|
|
2010
|
-
show_extras_: show_extras,
|
|
2011
|
-
i18n_: i18n_
|
|
2012
|
-
}) : []);
|
|
2013
|
-
});
|
|
2014
|
-
$5vyXB$solidjs.createEffect($5vyXB$depictaiutilishared.catchify(async () => {
|
|
2015
|
-
if (!some_top_level_are_hidden()) {
|
|
2016
|
-
await collapse();
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
|
-
if (show_extras[0]()) await expand();else await collapse();
|
|
2020
|
-
}));
|
|
2021
|
-
return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `checkboxes hierarchical ${Object.values(structured_categories()).some(category => Object.keys(category.children_).length) ? "any-expandable" : ""}`, $5vyXB$solidjsweb.escape($3bdc00a1353c1150$var$render_stuff($5vyXB$solidjs.createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $3bdc00a1353c1150$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_)), $5vyXB$solidjsweb.escape(expanding_container_els));
|
|
2022
1998
|
}
|
|
2023
|
-
function $
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
1999
|
+
function $5ea5a82e398f6f44$var$cut_text(segmented_text) {
|
|
2000
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
2001
|
+
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
2002
|
+
if (!segmented_text || !highlighted_segments?.length) return;
|
|
2003
|
+
// We have one or more highlighted segments
|
|
2004
|
+
if (highlighted_segments.length === 1) {
|
|
2005
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
2006
|
+
$5ea5a82e398f6f44$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
2007
|
+
return;
|
|
2008
|
+
}
|
|
2009
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
2010
|
+
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
|
|
2011
|
+
);
|
|
2012
|
+
|
|
2013
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
2014
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
2015
|
+
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);
|
|
2016
|
+
$5ea5a82e398f6f44$var$cut_start(index_of_first_segment, segmented_text);
|
|
2017
|
+
// update indexes since we might have removed segments
|
|
2018
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
2019
|
+
let number_of_characters_between_segments = 0;
|
|
2020
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
2021
|
+
const segment = segmented_text[i];
|
|
2022
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
2023
|
+
}
|
|
2024
|
+
if (number_of_characters_between_segments < $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters)
|
|
2025
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
2026
|
+
return;
|
|
2027
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
2028
|
+
const [split_start_segment, split_start_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
2029
|
+
const [split_end_segment, split_end_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
2030
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
2031
|
+
// identical split point, or split end before split start, can't do anything
|
|
2032
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
2033
|
+
const dots_segment = {
|
|
2034
|
+
text_: " … ",
|
|
2035
|
+
highlighted_: false
|
|
2036
|
+
};
|
|
2037
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
2038
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
2039
|
+
const text = segment.text_;
|
|
2040
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
2041
|
+
...segment,
|
|
2042
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
2043
|
+
}, dots_segment, {
|
|
2044
|
+
...segment,
|
|
2045
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
2046
|
+
}];else if (i == split_start_segment) {
|
|
2047
|
+
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
|
|
2048
|
+
return segment;
|
|
2049
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
2050
|
+
...segment,
|
|
2051
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
2052
|
+
}];
|
|
2053
|
+
return []; // remove all segments inbetween
|
|
2054
|
+
});
|
|
2055
|
+
|
|
2056
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
2057
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text);
|
|
2058
|
+
}
|
|
2059
|
+
function $5ea5a82e398f6f44$var$heal_holes(segmented_text) {
|
|
2060
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
2061
|
+
const segments_to_delete = new Set();
|
|
2062
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
2063
|
+
const segment = segmented_text[i];
|
|
2064
|
+
let previous_segment;
|
|
2065
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
2066
|
+
previous_segment = segmented_text[j];
|
|
2067
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
2068
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
2069
|
+
}
|
|
2070
|
+
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
2071
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
2072
|
+
segments_to_delete.add(segment);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
for (const segment of segments_to_delete) {
|
|
2076
|
+
const index = segmented_text.indexOf(segment);
|
|
2077
|
+
segmented_text.splice(index, 1);
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
function $5ea5a82e398f6f44$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
2081
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
2082
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
2083
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
2084
|
+
while (desperate_split_attempts.length) {
|
|
2085
|
+
const split_point_between_words = [];
|
|
2086
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
2087
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
2088
|
+
let is_first_character = true;
|
|
2089
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
2090
|
+
const segment = segmented_text[i];
|
|
2091
|
+
const text = segment.text_;
|
|
2092
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
2093
|
+
const character = text[j];
|
|
2094
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
2095
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
2096
|
+
split_point_between_words.push([i, j]);
|
|
2097
|
+
if (split_point_between_words.length > 3)
|
|
2098
|
+
// We can't find a split point, so we'll just split between words
|
|
2099
|
+
// 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
|
|
2100
|
+
return split_point_between_words[1];
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return [];
|
|
2106
|
+
}
|
|
2107
|
+
function $5ea5a82e398f6f44$var$cut_start(cut_left_of_index, segmented_text) {
|
|
2108
|
+
// Cut the start of the text to bring the first matching token
|
|
2109
|
+
let is_first_character = false;
|
|
2110
|
+
let words_encountered = 0;
|
|
2111
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
2112
|
+
const segment = segmented_text[i];
|
|
2113
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
2114
|
+
const text = segment.text_;
|
|
2115
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
2116
|
+
const character = text[j];
|
|
2117
|
+
const is_space = character == " ";
|
|
2118
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
2119
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
2120
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
2121
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
2122
|
+
segmented_text.splice(0, i);
|
|
2123
|
+
if (character === "," || is_space)
|
|
2124
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
2125
|
+
segmented_text.unshift({
|
|
2126
|
+
text_: "… ",
|
|
2127
|
+
highlighted_: false
|
|
2128
|
+
});
|
|
2129
|
+
break outmost_loop;
|
|
2130
|
+
}
|
|
2131
|
+
if (is_first_character) is_first_character = false;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
function $5ea5a82e398f6f44$export$1b00d74faf266c56(text, matched_strings, loose = false) {
|
|
2138
|
+
const output = [];
|
|
2139
|
+
if (!text) return; // shouldn't happen but whatever
|
|
2140
|
+
for (let i = 0; i < text.length; i++) {
|
|
2141
|
+
const found_strings = [];
|
|
2142
|
+
if (!i || text[i - 1] == " " || loose)
|
|
2143
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
2144
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
2145
|
+
const matched_string = matched_strings[j];
|
|
2146
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
2147
|
+
if (matched_string.length < 2 && !loose) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
2148
|
+
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
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
const last_index_in_output = output.length - 1;
|
|
2152
|
+
if (!found_strings.length) {
|
|
2153
|
+
const character = text[i];
|
|
2154
|
+
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
2155
|
+
// 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
|
|
2156
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
2157
|
+
highlighted_: false,
|
|
2158
|
+
text_: character
|
|
2159
|
+
});
|
|
2160
|
+
} else {
|
|
2161
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
2162
|
+
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
2163
|
+
highlighted_: true,
|
|
2164
|
+
text_: longest_found_string
|
|
2165
|
+
});
|
|
2166
|
+
i += longest_found_string.length - 1;
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
return output;
|
|
2170
|
+
}
|
|
2171
|
+
const $f6efb1605fcb9f39$var$_tmpl$ = ["<span", ' class="', '">', "</span>"],
|
|
2172
|
+
$f6efb1605fcb9f39$var$_tmpl$2 = ["<span", ' class="highlighted-part">', "</span>"];
|
|
2173
|
+
function $f6efb1605fcb9f39$export$8e79c28529dbfa90(props) {
|
|
2174
|
+
const segmented_text = $5vyXB$solidjs.createMemo(() => {
|
|
2175
|
+
const {
|
|
2176
|
+
to_highlight_: to_highlight_,
|
|
2177
|
+
text_: text_
|
|
2178
|
+
} = props;
|
|
2179
|
+
return $5ea5a82e398f6f44$export$1b00d74faf266c56(text_, to_highlight_ ? [to_highlight_] : [], true);
|
|
2180
|
+
});
|
|
2181
|
+
const has_highlights = $5vyXB$solidjs.createMemo(() => segmented_text().some(segment => segment.highlighted_));
|
|
2182
|
+
return $5vyXB$solidjsweb.ssr($f6efb1605fcb9f39$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey() + $5vyXB$solidjsweb.ssrAttribute("title", $5vyXB$solidjsweb.escape(props.text_, true), false), has_highlights() ? "has-match" : "", $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
2183
|
+
get each() {
|
|
2184
|
+
return segmented_text();
|
|
2185
|
+
},
|
|
2186
|
+
children: item => {
|
|
2187
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
2188
|
+
get when() {
|
|
2189
|
+
return item().highlighted_;
|
|
2190
|
+
},
|
|
2191
|
+
get fallback() {
|
|
2192
|
+
return item().text_;
|
|
2193
|
+
},
|
|
2194
|
+
get children() {
|
|
2195
|
+
return $5vyXB$solidjsweb.ssr($f6efb1605fcb9f39$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(item().text_));
|
|
2196
|
+
}
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
})));
|
|
2200
|
+
}
|
|
2201
|
+
const $3bdc00a1353c1150$var$_tmpl$ = ["<form", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></form>"],
|
|
2202
|
+
$3bdc00a1353c1150$var$_tmpl$2 = ["<div", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
2203
|
+
$3bdc00a1353c1150$var$_tmpl$3 = ["<details", "></details>"],
|
|
2204
|
+
$3bdc00a1353c1150$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="', '">', "</span><!--$-->", "<!--/--></div></summary>"];
|
|
2205
|
+
const $3bdc00a1353c1150$var$max_visible_without_collapsing = 15;
|
|
2206
|
+
const $3bdc00a1353c1150$var$show_non_collapsible_when_collapsed = 4;
|
|
2207
|
+
function $3bdc00a1353c1150$export$a32086fa6616eafd({
|
|
2208
|
+
filter_: filter_,
|
|
2209
|
+
selected_filters_: selected_filters_,
|
|
2210
|
+
i18n_: i18n_,
|
|
2211
|
+
view_more_button_below_group_: view_more_button_below_group_,
|
|
2212
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2213
|
+
filter_query_: filter_query_
|
|
2214
|
+
}) {
|
|
2215
|
+
let form;
|
|
2216
|
+
const existing_filter = $5vyXB$solidjs.createMemo(() => {
|
|
2217
|
+
const {
|
|
2218
|
+
field: field,
|
|
2219
|
+
op: op
|
|
2220
|
+
} = filter_();
|
|
2221
|
+
return selected_filters_[0]().find(({
|
|
2222
|
+
field: checking_field,
|
|
2223
|
+
op: checking_op
|
|
2224
|
+
}) => checking_field === field && checking_op === op);
|
|
2225
|
+
});
|
|
2226
|
+
const show_extras = $5vyXB$solidjs.createSignal(false);
|
|
2227
|
+
const is_being_searched_ = $5vyXB$solidjs.createMemo(() => !!filter_query_?.()); // If the user is searching in the filter
|
|
2228
|
+
const trigger_sync_ = $3bdc00a1353c1150$var$batching_filter_state_syncer({
|
|
2229
|
+
filter_: filter_,
|
|
2230
|
+
existing_filter_: existing_filter,
|
|
2231
|
+
selected_filters_: selected_filters_,
|
|
2232
|
+
get category_structure_() {
|
|
2233
|
+
return structured_categories();
|
|
2234
|
+
}
|
|
2235
|
+
});
|
|
2236
|
+
const structured_categories = $5vyXB$solidjs.createMemo(() => {
|
|
2237
|
+
const execute_when_structure_finished = [];
|
|
2238
|
+
const {
|
|
2239
|
+
values: values,
|
|
2240
|
+
names: names,
|
|
2241
|
+
counts: counts
|
|
2242
|
+
} = filter_().meta;
|
|
2243
|
+
const data_structure = {};
|
|
2244
|
+
for (let i = 0; i < values.length; i++) {
|
|
2245
|
+
const value = values[i];
|
|
2246
|
+
let pointer = data_structure;
|
|
2247
|
+
let parent_ = {};
|
|
2248
|
+
let created_an_object = false;
|
|
2249
|
+
for (let j = 0; j < value.length; j++) {
|
|
2250
|
+
const this_categories_name = value[j];
|
|
2251
|
+
const obj = pointer[this_categories_name] ||= (() => {
|
|
2252
|
+
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;
|
|
2253
|
+
const created_obj = {
|
|
2254
|
+
name_: names[i],
|
|
2255
|
+
count_: counts?.[i],
|
|
2256
|
+
parent_: parent_,
|
|
2257
|
+
is_expanded_: $3bdc00a1353c1150$var$make_expanded_signal({
|
|
2258
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2259
|
+
filter_value_: value_as_string,
|
|
2260
|
+
is_being_searched_: is_being_searched_
|
|
2261
|
+
}),
|
|
2262
|
+
value_: value_as_string,
|
|
2263
|
+
children_: {}
|
|
2264
|
+
};
|
|
2265
|
+
const {
|
|
2266
|
+
signal_: signal_,
|
|
2267
|
+
on_structure_complete_: on_structure_complete_
|
|
2268
|
+
} = $3bdc00a1353c1150$var$create_updating_signal({
|
|
2269
|
+
self_: created_obj,
|
|
2270
|
+
existing_filter_: $5vyXB$solidjs.untrack(existing_filter),
|
|
2271
|
+
trigger_sync_: trigger_sync_
|
|
2272
|
+
});
|
|
2273
|
+
execute_when_structure_finished.push(on_structure_complete_);
|
|
2274
|
+
created_obj.is_checked_ = signal_;
|
|
2275
|
+
parent_ = created_obj;
|
|
2276
|
+
created_an_object = true;
|
|
2277
|
+
return created_obj;
|
|
2278
|
+
})();
|
|
2279
|
+
pointer = obj.children_;
|
|
2280
|
+
parent_ = obj;
|
|
2281
|
+
}
|
|
2282
|
+
if (!created_an_object && "value_" in parent_) {
|
|
2283
|
+
// 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
|
|
2284
|
+
// [
|
|
2285
|
+
// ["Öl", "IPA"],
|
|
2286
|
+
// ["Öl", "Pale Ale"],
|
|
2287
|
+
// ["Öl", "Ale"],
|
|
2288
|
+
// ["Öl", "Mörk Lager"],
|
|
2289
|
+
// ["Öl", "Suröl"],
|
|
2290
|
+
// ["Öl", "Veteöl"],
|
|
2291
|
+
// ["Öl", "Stout och Porter"],
|
|
2292
|
+
// ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
|
|
2293
|
+
// ["Öl", "Ljus Lager"],
|
|
2294
|
+
// ];
|
|
2295
|
+
// In this case we want to just correct the name and value of the already created object, which will be in parent_
|
|
2296
|
+
parent_.value_ = value.map(v => v + "");
|
|
2297
|
+
parent_.name_ = names[i];
|
|
2298
|
+
parent_.count_ = counts[i];
|
|
2299
|
+
parent_.is_expanded_ = $3bdc00a1353c1150$var$make_expanded_signal({
|
|
2300
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2301
|
+
filter_value_: parent_.value_,
|
|
2302
|
+
is_being_searched_: is_being_searched_
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
|
|
2307
|
+
$3bdc00a1353c1150$var$expand_until_choice(data_structure);
|
|
2308
|
+
$5vyXB$depictaiutilishared.dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
|
|
2309
|
+
return data_structure;
|
|
2310
|
+
});
|
|
2311
|
+
const some_top_level_are_hidden = $5vyXB$solidjs.createMemo(() => Object.keys(structured_categories()).length > $3bdc00a1353c1150$var$max_visible_without_collapsing);
|
|
2312
|
+
const {
|
|
2313
|
+
expand: expand,
|
|
2314
|
+
collapse: collapse,
|
|
2315
|
+
ExpandingContainer: ExpandingContainer
|
|
2316
|
+
} = $4b455f60dadde8b8$export$5bad61ecde080b1f({
|
|
2317
|
+
duration: 200
|
|
2318
|
+
});
|
|
2319
|
+
const expanding_container_els = $5vyXB$solidjsweb.createComponent(ExpandingContainer, {
|
|
2320
|
+
get children() {
|
|
2321
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
2322
|
+
get when() {
|
|
2323
|
+
return some_top_level_are_hidden();
|
|
2324
|
+
},
|
|
2325
|
+
get children() {
|
|
2326
|
+
return $3bdc00a1353c1150$var$render_stuff($5vyXB$solidjs.createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($3bdc00a1353c1150$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_, filter_query_);
|
|
2327
|
+
}
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
});
|
|
2331
|
+
$5vyXB$solidjs.createRenderEffect(() => {
|
|
2332
|
+
view_more_button_below_group_[1](some_top_level_are_hidden() ? $5vyXB$solidjsweb.createComponent((0, $0fe1e7efdf4200d6$export$ca21a16d65b3dd8), {
|
|
2333
|
+
show_extras_: show_extras,
|
|
2334
|
+
i18n_: i18n_
|
|
2335
|
+
}) : []);
|
|
2336
|
+
});
|
|
2337
|
+
$5vyXB$solidjs.createEffect($5vyXB$depictaiutilishared.catchify(async () => {
|
|
2338
|
+
if (!some_top_level_are_hidden()) {
|
|
2339
|
+
await collapse();
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
if (show_extras[0]()) await expand();else await collapse();
|
|
2343
|
+
}));
|
|
2344
|
+
return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `checkboxes hierarchical ${Object.values(structured_categories()).some(category => Object.keys(category.children_).length) ? "any-expandable" : ""}`, $5vyXB$solidjsweb.escape($3bdc00a1353c1150$var$render_stuff($5vyXB$solidjs.createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $3bdc00a1353c1150$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_, filter_query_)), $5vyXB$solidjsweb.escape(expanding_container_els));
|
|
2345
|
+
}
|
|
2346
|
+
function $3bdc00a1353c1150$var$render_stuff(data, existing_filter, i18n_, filter_query_) {
|
|
2347
|
+
const keys = $5vyXB$solidjs.createMemo(() => Object.keys(data()));
|
|
2348
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.For), {
|
|
2349
|
+
get each() {
|
|
2350
|
+
return keys();
|
|
2351
|
+
},
|
|
2352
|
+
children: key => $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
2353
|
+
get when() {
|
|
2354
|
+
return $5vyXB$solidjs.createMemo(() => !!data()[key])();
|
|
2355
|
+
},
|
|
2356
|
+
get children() {
|
|
2357
|
+
return (() => {
|
|
2358
|
+
// for some reason the for thing doesn't dispose of us if the key no longer exists?? so I'm doing it with show instead
|
|
2359
|
+
const value = $5vyXB$solidjs.createMemo(() => data()[key]); // still sometimes get undefined here even though we have <Show>
|
|
2360
|
+
const has_expandable = $5vyXB$solidjs.createMemo(() => !!Object.keys(value()?.children_ || {}).length);
|
|
2361
|
+
const value_as_string = $5vyXB$solidjs.createMemo(() => JSON.stringify(value()?.value_));
|
|
2362
|
+
const label_text = $5vyXB$solidjs.createMemo(() => value()?.name_ || value_as_string());
|
|
2363
|
+
return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `checkbox-details ${has_expandable() ? "expandable" : ""}`, $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
|
|
2039
2364
|
get value_() {
|
|
2040
|
-
return
|
|
2365
|
+
return value_as_string();
|
|
2041
2366
|
},
|
|
2042
2367
|
get label_() {
|
|
2043
|
-
return
|
|
2368
|
+
return $5vyXB$solidjsweb.createComponent((0, $f6efb1605fcb9f39$export$8e79c28529dbfa90), {
|
|
2369
|
+
get text_() {
|
|
2370
|
+
return label_text();
|
|
2371
|
+
},
|
|
2372
|
+
get to_highlight_() {
|
|
2373
|
+
return filter_query_?.();
|
|
2374
|
+
}
|
|
2375
|
+
});
|
|
2044
2376
|
},
|
|
2045
2377
|
get count_() {
|
|
2046
2378
|
return has_expandable() ? undefined : value()?.count_;
|
|
@@ -2109,7 +2441,7 @@ function $3bdc00a1353c1150$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
2109
2441
|
return is_open();
|
|
2110
2442
|
},
|
|
2111
2443
|
get children() {
|
|
2112
|
-
return $3bdc00a1353c1150$var$render_stuff($5vyXB$solidjs.createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
|
|
2444
|
+
return $3bdc00a1353c1150$var$render_stuff($5vyXB$solidjs.createMemo(() => value()?.children_ || {}), existing_filter, i18n_, filter_query_);
|
|
2113
2445
|
}
|
|
2114
2446
|
});
|
|
2115
2447
|
})();
|
|
@@ -2217,7 +2549,8 @@ function $3bdc00a1353c1150$var$create_updating_signal({
|
|
|
2217
2549
|
}
|
|
2218
2550
|
function $3bdc00a1353c1150$var$make_expanded_signal({
|
|
2219
2551
|
expanded_hierarchical_filters_: [read_expanded_hierarchical_filters, write_expanded_hierarchical_filters],
|
|
2220
|
-
filter_value_: filter_value_
|
|
2552
|
+
filter_value_: filter_value_,
|
|
2553
|
+
is_being_searched_: is_being_searched_
|
|
2221
2554
|
}) {
|
|
2222
2555
|
const index_in_expanded_filters = $5vyXB$solidjs.createMemo(() => read_expanded_hierarchical_filters().findIndex(({
|
|
2223
2556
|
value_: value_
|
|
@@ -2256,7 +2589,9 @@ function $3bdc00a1353c1150$var$make_expanded_signal({
|
|
|
2256
2589
|
defer: true
|
|
2257
2590
|
}));
|
|
2258
2591
|
return {
|
|
2259
|
-
ui_should_show_expanded_: $5vyXB$solidjs.createMemo(
|
|
2592
|
+
ui_should_show_expanded_: $5vyXB$solidjs.createMemo(
|
|
2593
|
+
// When user is searching through filters, expand everything they haven't collapsed, so they can see the results
|
|
2594
|
+
() => user_choice_signal[0]() ?? (is_being_searched_() || get_low_precedence_expanded())),
|
|
2260
2595
|
set_low_precedence_expanded_: set_low_precedence_expanded,
|
|
2261
2596
|
set_user_expanded_: set_user_choice_expanded
|
|
2262
2597
|
};
|
|
@@ -2284,7 +2619,9 @@ const $0ef1681699140f1a$var$gap_px = 5;
|
|
|
2284
2619
|
const $0ef1681699140f1a$var$max_columns = 3;
|
|
2285
2620
|
const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
2286
2621
|
filter_: filter_,
|
|
2287
|
-
selected_filters_: [get_selected_filters, set_selected_filters]
|
|
2622
|
+
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
2623
|
+
filter_query_: filter_query_,
|
|
2624
|
+
details_element_width_: details_element_width_
|
|
2288
2625
|
}) => {
|
|
2289
2626
|
const existing_filter = $5vyXB$solidjs.createMemo(() => {
|
|
2290
2627
|
const {
|
|
@@ -2312,18 +2649,18 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
|
2312
2649
|
const container_width_accessor = $5vyXB$solidjs.createMemo(() => {
|
|
2313
2650
|
const element = container();
|
|
2314
2651
|
if (!element) return;
|
|
2315
|
-
return $
|
|
2652
|
+
return $f13855d1b951b24a$export$ebdc3711f7e02ccd(element);
|
|
2316
2653
|
});
|
|
2317
2654
|
const [shadow_children, set_shadow_children] = $5vyXB$solidjs.createSignal(new Set(), {
|
|
2318
2655
|
equals: false
|
|
2319
2656
|
});
|
|
2320
2657
|
const shadow_grid = $5vyXB$solidjsweb.ssr($0ef1681699140f1a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape([...shadow_children()])); // for getting the smallest possible sizes of all the items
|
|
2321
2658
|
$5vyXB$solidjs.createEffect(() => {
|
|
2322
|
-
const container_width = container_width_accessor()?.();
|
|
2323
|
-
if (container_width
|
|
2659
|
+
const container_width = container_width_accessor()?.() || details_element_width_();
|
|
2660
|
+
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
|
|
2324
2661
|
$0ef1681699140f1a$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
|
|
2325
2662
|
});
|
|
2326
|
-
return [
|
|
2663
|
+
return [$5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), {
|
|
2327
2664
|
get cols_at_size() {
|
|
2328
2665
|
return cols_at_size();
|
|
2329
2666
|
},
|
|
@@ -2345,27 +2682,33 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
|
2345
2682
|
const current_value = $daa394359b026187$export$325f75597868c4f0(value().value_);
|
|
2346
2683
|
return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === current_value);
|
|
2347
2684
|
});
|
|
2348
|
-
const MakeButton = attributes =>
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2685
|
+
const MakeButton = attributes => {
|
|
2686
|
+
const label = $5vyXB$solidjs.createMemo(() => value().name_ || value().value_ + "");
|
|
2687
|
+
return $5vyXB$solidjsweb.ssrElement("button", $5vyXB$solidjsweb.mergeProps(attributes, {
|
|
2688
|
+
get disabled() {
|
|
2689
|
+
return value().count_ === 0 && !is_selected();
|
|
2690
|
+
},
|
|
2691
|
+
get classList() {
|
|
2692
|
+
return {
|
|
2693
|
+
minor: !is_selected(),
|
|
2694
|
+
major: is_selected(),
|
|
2695
|
+
"major-minor-transition": true
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2698
|
+
}), () => ["<!--$-->", $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
2699
|
+
whole_text_to_display_: label,
|
|
2700
|
+
searching_for_value_: () => filter_query_?.()
|
|
2701
|
+
})), "<!--/-->", "<!--$-->", $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
2702
|
+
get when() {
|
|
2703
|
+
return value().count_ != undefined;
|
|
2704
|
+
},
|
|
2705
|
+
get children() {
|
|
2706
|
+
return $5vyXB$solidjsweb.ssr($0ef1681699140f1a$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(value().count_));
|
|
2707
|
+
}
|
|
2708
|
+
})), "<!--/-->"], true);
|
|
2709
|
+
};
|
|
2367
2710
|
const invisible_size_button = $5vyXB$solidjsweb.createComponent(MakeButton, {});
|
|
2368
|
-
const smallest_possible_size = $
|
|
2711
|
+
const smallest_possible_size = $f13855d1b951b24a$export$ebdc3711f7e02ccd(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
2369
2712
|
const sizes_value = $5vyXB$solidjs.untrack(sizes_set);
|
|
2370
2713
|
const shadow_children_value = $5vyXB$solidjs.untrack(shadow_children);
|
|
2371
2714
|
sizes_value.add(smallest_possible_size);
|
|
@@ -2385,7 +2728,7 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
|
2385
2728
|
}
|
|
2386
2729
|
});
|
|
2387
2730
|
}
|
|
2388
|
-
})];
|
|
2731
|
+
}), shadow_grid];
|
|
2389
2732
|
};
|
|
2390
2733
|
/**
|
|
2391
2734
|
* Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
|
|
@@ -2451,7 +2794,8 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
|
|
|
2451
2794
|
filter_: filter_,
|
|
2452
2795
|
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
2453
2796
|
i18n_: i18n_,
|
|
2454
|
-
view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
|
|
2797
|
+
view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_],
|
|
2798
|
+
filter_query_: filter_query_
|
|
2455
2799
|
}) {
|
|
2456
2800
|
// same as in CheckboxFilter, maybe we should make this DRY at some point
|
|
2457
2801
|
const existing_filter = $5vyXB$solidjs.createMemo(() => {
|
|
@@ -2485,12 +2829,17 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
|
|
|
2485
2829
|
const value = $daa394359b026187$export$325f75597868c4f0(checkbox().value_);
|
|
2486
2830
|
return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
|
|
2487
2831
|
});
|
|
2832
|
+
const value = $5vyXB$solidjs.createMemo(() => checkbox().value_);
|
|
2833
|
+
const label_text = $5vyXB$solidjs.createMemo(() => checkbox().name_ || value() + "");
|
|
2488
2834
|
const input_row = $5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
|
|
2489
2835
|
get value_() {
|
|
2490
|
-
return
|
|
2836
|
+
return value();
|
|
2491
2837
|
},
|
|
2492
2838
|
get label_() {
|
|
2493
|
-
return
|
|
2839
|
+
return $5vyXB$solidjsweb.createComponent((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
2840
|
+
whole_text_to_display_: label_text,
|
|
2841
|
+
searching_for_value_: () => filter_query_?.()
|
|
2842
|
+
});
|
|
2494
2843
|
},
|
|
2495
2844
|
get count_() {
|
|
2496
2845
|
return checkbox().count_;
|
|
@@ -2741,10 +3090,143 @@ function $061ff5b4c3d36171$export$89c6019e4baa40b1(props) {
|
|
|
2741
3090
|
}
|
|
2742
3091
|
});
|
|
2743
3092
|
}
|
|
3093
|
+
const $87d7574e1d89d69b$var$_tmpl$ = '<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"></path>';
|
|
3094
|
+
function $87d7574e1d89d69b$export$82eafebb825fc23f(props = {}) {
|
|
3095
|
+
return $5vyXB$solidjsweb.ssrElement("svg", $5vyXB$solidjsweb.mergeProps({
|
|
3096
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3097
|
+
width: "20",
|
|
3098
|
+
height: "22",
|
|
3099
|
+
viewBox: "0 0 20 22"
|
|
3100
|
+
}, props), () => $5vyXB$solidjsweb.ssr($87d7574e1d89d69b$var$_tmpl$), true);
|
|
3101
|
+
}
|
|
3102
|
+
const $47d8681015b71901$var$_tmpl$ = ["<div", ' class="search-in-filters"><input type="text" class="query"', "><!--$-->", '<!--/--><button style="', '" class="clear">', "</button></div>"];
|
|
3103
|
+
const $47d8681015b71901$var$min_items_to_enable_filter_searching = 10; // For checkbox hierarchical we 2x this
|
|
3104
|
+
function $47d8681015b71901$export$4b2c5292ffe0c5dd(filter_array_, section, i18n_) {
|
|
3105
|
+
const [filter_query_, set_filter_query_] = $5vyXB$solidjs.createSignal();
|
|
3106
|
+
// Check if we have enough items to enable searching
|
|
3107
|
+
const enable_searchability = $5vyXB$solidjs.createMemo(() => {
|
|
3108
|
+
let count = 0;
|
|
3109
|
+
for (const filter of filter_array_()) {
|
|
3110
|
+
const type = filter.meta?.type;
|
|
3111
|
+
if (type === "range") continue;
|
|
3112
|
+
const length = filter.meta.values.length;
|
|
3113
|
+
count += type === "checkbox-color" ? length / 2 : type === "checkbox-grid" ? length / 3 : length; // For checkbox-color we have two columns, checkbox-grid three, so we can show search later
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
return count >= $47d8681015b71901$var$min_items_to_enable_filter_searching;
|
|
3117
|
+
});
|
|
3118
|
+
const SearchThisFilterGroup_ = () => {
|
|
3119
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
3120
|
+
get when() {
|
|
3121
|
+
return enable_searchability();
|
|
3122
|
+
},
|
|
3123
|
+
get children() {
|
|
3124
|
+
return $5vyXB$solidjsweb.ssr($47d8681015b71901$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("value", $5vyXB$solidjsweb.escape(filter_query_(), true) || "", false) + $5vyXB$solidjsweb.ssrAttribute("placeholder", $5vyXB$solidjsweb.escape(i18n_.search_a_filter_()(section), true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $87d7574e1d89d69b$export$82eafebb825fc23f), {
|
|
3125
|
+
width: "16",
|
|
3126
|
+
height: "17.6",
|
|
3127
|
+
"class": "search-icon"
|
|
3128
|
+
})), "display:" + (filter_query_() ? "" : "none"), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {
|
|
3129
|
+
width: "12",
|
|
3130
|
+
height: "12"
|
|
3131
|
+
})));
|
|
3132
|
+
}
|
|
3133
|
+
});
|
|
3134
|
+
};
|
|
3135
|
+
const searched_filter_array_ = $5vyXB$solidjs.createMemo(() => {
|
|
3136
|
+
const query = filter_query_();
|
|
3137
|
+
if (!enable_searchability() || !query) return filter_array_();
|
|
3138
|
+
const lowercase_query = query.toLowerCase();
|
|
3139
|
+
const check_string_match = to_check => {
|
|
3140
|
+
to_check = to_check.toLowerCase();
|
|
3141
|
+
return to_check.includes(lowercase_query) || lowercase_query.includes(to_check);
|
|
3142
|
+
};
|
|
3143
|
+
return filter_array_().map(filter => {
|
|
3144
|
+
const type = filter.meta?.type;
|
|
3145
|
+
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
|
|
3146
|
+
const meta = filter.meta;
|
|
3147
|
+
const {
|
|
3148
|
+
values: values,
|
|
3149
|
+
names: names,
|
|
3150
|
+
counts: counts
|
|
3151
|
+
} = meta;
|
|
3152
|
+
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
|
|
3153
|
+
const is_hierarchical_checkbox = type === "checkbox-hierarchical";
|
|
3154
|
+
// Which index of counts, values and names should be kept
|
|
3155
|
+
const filtered_indexes = values.map((item, index) => {
|
|
3156
|
+
const item_from_names = names?.[index];
|
|
3157
|
+
if (item_from_names && !is_hierarchical_checkbox)
|
|
3158
|
+
// 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
|
|
3159
|
+
item = item_from_names;
|
|
3160
|
+
if (typeof item === "number") return true;
|
|
3161
|
+
if (is_hierarchical_checkbox && names)
|
|
3162
|
+
// Special case for hierarchical checkboxes where we need to check if any of the names in the path match the query
|
|
3163
|
+
item = item.map((_, index) => names[$47d8681015b71901$var$find_str_arr_in_str_arr_arr("findIndex", values, item.slice(0, index + 1))]);
|
|
3164
|
+
if (Array.isArray(item)) return item.some(item => check_string_match(item + "")); // If any of the items in the array match, keep it
|
|
3165
|
+
return check_string_match(item);
|
|
3166
|
+
});
|
|
3167
|
+
const new_values = values.filter((_, i) => filtered_indexes[i]);
|
|
3168
|
+
if (!new_values.length) return false; // false = please delete this filter, see below
|
|
3169
|
+
const new_filter_object = {
|
|
3170
|
+
...filter,
|
|
3171
|
+
meta: {
|
|
3172
|
+
...meta,
|
|
3173
|
+
counts: counts?.filter((_, i) => filtered_indexes[i]),
|
|
3174
|
+
...(names ? {
|
|
3175
|
+
names: meta.names?.filter((_, i) => filtered_indexes[i])
|
|
3176
|
+
} : {}),
|
|
3177
|
+
values: new_values
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
if (is_hierarchical_checkbox) {
|
|
3181
|
+
// For hierarchical checkbox we need to fill the holes created by filtering, for example if there is
|
|
3182
|
+
// ["Clothes"]
|
|
3183
|
+
// ["Clothes", "Blazers"]
|
|
3184
|
+
// And the user searched for "blazers" we need to add back ["Clothes"] so CheckboxHierarchicalFilter doesn't get confused
|
|
3185
|
+
// 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
|
|
3186
|
+
// So we do it here instead
|
|
3187
|
+
const new_meta = new_filter_object.meta;
|
|
3188
|
+
const new_values = new_meta.values;
|
|
3189
|
+
for (const value of new_values) {
|
|
3190
|
+
if (!Array.isArray(value)) continue; // Shouldn't happen
|
|
3191
|
+
if (value.length < 2) continue; // No parent
|
|
3192
|
+
const parent = value.slice(0, -1);
|
|
3193
|
+
// Check if parent exists
|
|
3194
|
+
if ($47d8681015b71901$var$find_str_arr_in_str_arr_arr("some", new_values, parent)) continue; // Parent exists
|
|
3195
|
+
// Otherwise, put it back
|
|
3196
|
+
const index_to_restore = $47d8681015b71901$var$find_str_arr_in_str_arr_arr("findIndex", values, parent);
|
|
3197
|
+
if (index_to_restore < 0) {
|
|
3198
|
+
$5vyXB$depictaiutilishared.dwarn("Can't restore", parent, "to", new_values);
|
|
3199
|
+
continue;
|
|
3200
|
+
}
|
|
3201
|
+
const current_index_of_us = new_values.findIndex(item => item === value);
|
|
3202
|
+
new_values.splice(current_index_of_us, 0, values[index_to_restore]);
|
|
3203
|
+
const count_to_restore = counts?.[index_to_restore];
|
|
3204
|
+
if (count_to_restore) new_meta.counts?.splice(current_index_of_us, 0, count_to_restore);
|
|
3205
|
+
const name_to_restore = names?.[index_to_restore];
|
|
3206
|
+
if (name_to_restore) new_meta.names?.splice(current_index_of_us, 0, name_to_restore);
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
return new_filter_object;
|
|
3210
|
+
}).filter(filter => filter); // Delete filters that don't have a value anymore
|
|
3211
|
+
});
|
|
3212
|
+
|
|
3213
|
+
return {
|
|
3214
|
+
SearchThisFilterGroup_: SearchThisFilterGroup_,
|
|
3215
|
+
searched_filter_array_: searched_filter_array_,
|
|
3216
|
+
filter_query_: filter_query_
|
|
3217
|
+
};
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Finds/whatevers what's effectively one hierarchical filter item in an array of hierarchical filter items
|
|
3221
|
+
* Functions similar to this happen loads in create_modified_filters, but they have additional checks so not touching them RN
|
|
3222
|
+
*/
|
|
3223
|
+
function $47d8681015b71901$var$find_str_arr_in_str_arr_arr(operation, haystack, needle) {
|
|
3224
|
+
return haystack[operation](value => value.length === needle.length && value.every((item, index) => item === needle[index]));
|
|
3225
|
+
}
|
|
2744
3226
|
const $aff9a96d30ed3563$var$_tmpl$ = ["<div", ' class="filter-collapsible">', "</div>"],
|
|
2745
3227
|
$aff9a96d30ed3563$var$_tmpl$2 = ["<button", ' class="clear-group"><!--$-->', "<!--/--><span>", "</span></button>"],
|
|
2746
3228
|
$aff9a96d30ed3563$var$_tmpl$3 = ["<div", ' class="view-more-clear"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
2747
|
-
$aff9a96d30ed3563$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><div class="filter-part"
|
|
3229
|
+
$aff9a96d30ed3563$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><div class="filter-part"><!--$-->', "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--></div>"],
|
|
2748
3230
|
$aff9a96d30ed3563$var$_tmpl$5 = ["<details", ' class="filter-collapsible"', "></details>"],
|
|
2749
3231
|
$aff9a96d30ed3563$var$_tmpl$6 = ["<summary", ' class="filter-group-summary"><div class="summary"><span>', '</span><div class="selected-w-sign"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div></summary>"],
|
|
2750
3232
|
$aff9a96d30ed3563$var$_tmpl$7 = ["<div", ' class="ungrouped">', "</div>"],
|
|
@@ -2795,6 +3277,11 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
|
|
|
2795
3277
|
const filter_array_ = $5vyXB$solidjs.createMemo(() => {
|
|
2796
3278
|
return Object.values(togglable_filters_grouped_by_collapsible())[get_section_index()];
|
|
2797
3279
|
});
|
|
3280
|
+
const {
|
|
3281
|
+
SearchThisFilterGroup_: SearchThisFilterGroup_,
|
|
3282
|
+
searched_filter_array_: searched_filter_array_,
|
|
3283
|
+
filter_query_: filter_query_
|
|
3284
|
+
} = $47d8681015b71901$export$4b2c5292ffe0c5dd(filter_array_, section_, props.i18n_);
|
|
2798
3285
|
const is_open = $8c939a05b87fbbbc$export$ab34afce88557c0e({
|
|
2799
3286
|
get expanded_filters_() {
|
|
2800
3287
|
return props.expanded_filters_;
|
|
@@ -2807,6 +3294,8 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
|
|
|
2807
3294
|
// this is absolutely not accurate which is why we have the .filter below, it's just the easiest way to get the typing of the map correct
|
|
2808
3295
|
filter_from_api]).filter(([selected_filter]) => selected_filter)));
|
|
2809
3296
|
const a_filter_is_selected = $5vyXB$solidjs.createMemo(() => selected_filters_in_group().size);
|
|
3297
|
+
const [get_details_width, set_get_details_width] = $5vyXB$solidjs.createSignal();
|
|
3298
|
+
const details_element_width_ = $5vyXB$solidjs.createMemo(() => get_details_width?.()?.());
|
|
2810
3299
|
return $5vyXB$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
|
|
2811
3300
|
is_open_: is_open,
|
|
2812
3301
|
get details_() {
|
|
@@ -2835,9 +3324,9 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
|
|
|
2835
3324
|
})));
|
|
2836
3325
|
},
|
|
2837
3326
|
get children() {
|
|
2838
|
-
return $5vyXB$solidjsweb.ssr($aff9a96d30ed3563$var$_tmpl$4, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
3327
|
+
return $5vyXB$solidjsweb.ssr($aff9a96d30ed3563$var$_tmpl$4, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent(SearchThisFilterGroup_, {})), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
2839
3328
|
get each() {
|
|
2840
|
-
return
|
|
3329
|
+
return searched_filter_array_();
|
|
2841
3330
|
},
|
|
2842
3331
|
children: filter => $5vyXB$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
2843
3332
|
severity_: "error",
|
|
@@ -2859,7 +3348,9 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
|
|
|
2859
3348
|
get i18n_() {
|
|
2860
3349
|
return props.i18n_;
|
|
2861
3350
|
},
|
|
2862
|
-
view_more_button_below_group_: view_more_button_below_group
|
|
3351
|
+
view_more_button_below_group_: view_more_button_below_group,
|
|
3352
|
+
filter_query_: filter_query_,
|
|
3353
|
+
details_element_width_: details_element_width_
|
|
2863
3354
|
});
|
|
2864
3355
|
}
|
|
2865
3356
|
})
|
|
@@ -6632,14 +7123,6 @@ const $3df11fc61432d1fd$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/sv
|
|
|
6632
7123
|
function $3df11fc61432d1fd$export$1c641004b5485fed() {
|
|
6633
7124
|
return $5vyXB$solidjsweb.ssr($3df11fc61432d1fd$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey());
|
|
6634
7125
|
}
|
|
6635
|
-
const $87d7574e1d89d69b$var$_tmpl$ = '<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"></path>';
|
|
6636
|
-
function $87d7574e1d89d69b$export$82eafebb825fc23f(props = {}) {
|
|
6637
|
-
return $5vyXB$solidjsweb.ssrElement("svg", $5vyXB$solidjsweb.mergeProps(props, {
|
|
6638
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6639
|
-
width: "20",
|
|
6640
|
-
height: "22"
|
|
6641
|
-
}), () => $5vyXB$solidjsweb.ssr($87d7574e1d89d69b$var$_tmpl$), true);
|
|
6642
|
-
}
|
|
6643
7126
|
const $66b8b9a9613c141d$var$_tmpl$ = ["<button", ' class="back" type="button"', ">", "</button>"],
|
|
6644
7127
|
$66b8b9a9613c141d$var$_tmpl$2 = ["<div", ' class="search-field"><!--$-->', '<!--/--><div class="field"><input class="', '" tabindex="0"', '><button type="button" class="clear"', ' style="', '">', '</button></div><button class="submit major" type="button"', ">", "</button></div>"];
|
|
6645
7128
|
function $66b8b9a9613c141d$export$b94867ecbd698f21({
|
|
@@ -7088,89 +7571,36 @@ function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
|
7088
7571
|
const has_entries = $5vyXB$solidjs.createMemo(() => previous_searches_().length >= 1);
|
|
7089
7572
|
currently_showing_suggestions_[1](value => {
|
|
7090
7573
|
value[0] = $5vyXB$solidjs.createMemo(() => previous_searches_().map(result => ({
|
|
7091
|
-
type: (0, $3ec9e21d6b6debdd$export$3cf9497e790da491),
|
|
7092
|
-
title: result,
|
|
7093
|
-
suggestions_result_id: "history"
|
|
7094
|
-
})));
|
|
7095
|
-
return value;
|
|
7096
|
-
});
|
|
7097
|
-
$5vyXB$solidjs.onCleanup(() => currently_showing_suggestions_[1](value => {
|
|
7098
|
-
delete value[0];
|
|
7099
|
-
return value;
|
|
7100
|
-
}));
|
|
7101
|
-
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
7102
|
-
get when() {
|
|
7103
|
-
return has_entries();
|
|
7104
|
-
},
|
|
7105
|
-
get children() {
|
|
7106
|
-
return $5vyXB$solidjsweb.ssr($9a268bf73b31a717$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(text_()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
7107
|
-
get each() {
|
|
7108
|
-
return previous_searches_();
|
|
7109
|
-
},
|
|
7110
|
-
children: (item, index) => {
|
|
7111
|
-
const href = $496cde876b53ce1e$export$91c3b6774e8be0f5({
|
|
7112
|
-
param_: search_query_param_name_,
|
|
7113
|
-
value_: item,
|
|
7114
|
-
url_transformer_: url_transformer_
|
|
7115
|
-
});
|
|
7116
|
-
return $5vyXB$solidjsweb.ssr($9a268bf73b31a717$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `${`item` || ""} ${$5vyXB$solidjs.createMemo(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(href(), true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {})), $5vyXB$solidjsweb.ssrAttribute("title", $5vyXB$solidjsweb.escape(item(), true), false), $5vyXB$solidjsweb.escape(item()), $5vyXB$solidjsweb.ssrAttribute("title", $5vyXB$solidjsweb.escape(i18n_.previous_searches_delete_entry_from_history_(), true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {})));
|
|
7117
|
-
}
|
|
7118
|
-
})));
|
|
7119
|
-
}
|
|
7120
|
-
});
|
|
7121
|
-
}
|
|
7122
|
-
const $d023ed916c84e75d$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
7123
|
-
$d023ed916c84e75d$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
7124
|
-
function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
|
|
7125
|
-
whole_text_to_display_: whole_text_to_display_memo,
|
|
7126
|
-
searching_for_value_: searching_for_value_memo,
|
|
7127
|
-
class_: class_
|
|
7128
|
-
}) {
|
|
7129
|
-
const [get_has_highlighted, set_has_highlighted] = $5vyXB$solidjs.createSignal(false);
|
|
7130
|
-
const text_itself = $5vyXB$solidjs.createMemo(() => $5vyXB$solidjs.batch(() => {
|
|
7131
|
-
set_has_highlighted(false);
|
|
7132
|
-
const searching_for_value = searching_for_value_memo();
|
|
7133
|
-
const whole_text_to_display_ = whole_text_to_display_memo();
|
|
7134
|
-
let for_black = "";
|
|
7135
|
-
let pushed_grey = false;
|
|
7136
|
-
const search_q = searching_for_value;
|
|
7137
|
-
if (!search_q) return whole_text_to_display_;
|
|
7138
|
-
const output = [];
|
|
7139
|
-
const searching_for = search_q.toLowerCase();
|
|
7140
|
-
const push_black = () => {
|
|
7141
|
-
if (for_black) {
|
|
7142
|
-
set_has_highlighted(true);
|
|
7143
|
-
output.push($5vyXB$solidjsweb.ssr($d023ed916c84e75d$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(for_black))); // "black"
|
|
7144
|
-
for_black = "";
|
|
7145
|
-
}
|
|
7146
|
-
};
|
|
7147
|
-
for (let i = 0; i < whole_text_to_display_.length;) {
|
|
7148
|
-
let is_whole_word = true;
|
|
7149
|
-
let searching_for_but_with_texts_casing = "";
|
|
7150
|
-
const i_at_start = i;
|
|
7151
|
-
for (let j = 0; j < searching_for.length; i++, j++) {
|
|
7152
|
-
const letter_in_suggestion = whole_text_to_display_[i];
|
|
7153
|
-
if (letter_in_suggestion?.toLowerCase() !== searching_for[j]) {
|
|
7154
|
-
is_whole_word = false;
|
|
7155
|
-
i = i_at_start;
|
|
7156
|
-
break;
|
|
7574
|
+
type: (0, $3ec9e21d6b6debdd$export$3cf9497e790da491),
|
|
7575
|
+
title: result,
|
|
7576
|
+
suggestions_result_id: "history"
|
|
7577
|
+
})));
|
|
7578
|
+
return value;
|
|
7579
|
+
});
|
|
7580
|
+
$5vyXB$solidjs.onCleanup(() => currently_showing_suggestions_[1](value => {
|
|
7581
|
+
delete value[0];
|
|
7582
|
+
return value;
|
|
7583
|
+
}));
|
|
7584
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
7585
|
+
get when() {
|
|
7586
|
+
return has_entries();
|
|
7587
|
+
},
|
|
7588
|
+
get children() {
|
|
7589
|
+
return $5vyXB$solidjsweb.ssr($9a268bf73b31a717$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(text_()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
7590
|
+
get each() {
|
|
7591
|
+
return previous_searches_();
|
|
7592
|
+
},
|
|
7593
|
+
children: (item, index) => {
|
|
7594
|
+
const href = $496cde876b53ce1e$export$91c3b6774e8be0f5({
|
|
7595
|
+
param_: search_query_param_name_,
|
|
7596
|
+
value_: item,
|
|
7597
|
+
url_transformer_: url_transformer_
|
|
7598
|
+
});
|
|
7599
|
+
return $5vyXB$solidjsweb.ssr($9a268bf73b31a717$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `${`item` || ""} ${$5vyXB$solidjs.createMemo(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(href(), true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {})), $5vyXB$solidjsweb.ssrAttribute("title", $5vyXB$solidjsweb.escape(item(), true), false), $5vyXB$solidjsweb.escape(item()), $5vyXB$solidjsweb.ssrAttribute("title", $5vyXB$solidjsweb.escape(i18n_.previous_searches_delete_entry_from_history_(), true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {})));
|
|
7157
7600
|
}
|
|
7158
|
-
|
|
7159
|
-
}
|
|
7160
|
-
if (is_whole_word) {
|
|
7161
|
-
push_black();
|
|
7162
|
-
output.push(searching_for_but_with_texts_casing);
|
|
7163
|
-
pushed_grey = true;
|
|
7164
|
-
} else for_black += whole_text_to_display_[i++];
|
|
7165
|
-
}
|
|
7166
|
-
push_black();
|
|
7167
|
-
if (!pushed_grey) {
|
|
7168
|
-
set_has_highlighted(false);
|
|
7169
|
-
return whole_text_to_display_;
|
|
7601
|
+
})));
|
|
7170
7602
|
}
|
|
7171
|
-
|
|
7172
|
-
}));
|
|
7173
|
-
return $5vyXB$solidjsweb.ssr($d023ed916c84e75d$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `${$5vyXB$solidjsweb.escape(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, $5vyXB$solidjsweb.ssrAttribute("title", $5vyXB$solidjsweb.escape(whole_text_to_display_memo(), true), false), $5vyXB$solidjsweb.escape(text_itself()));
|
|
7603
|
+
});
|
|
7174
7604
|
}
|
|
7175
7605
|
const $c0125412b4ea0c93$var$_tmpl$ = '<path d="M56 26.455a13.71 13.71 0 0 0-9.578 3.967A13.71 13.71 0 0 0 42.455 40v176a13.71 13.71 0 0 0 3.967 9.578A13.71 13.71 0 0 0 56 229.545h144A13.71 13.71 0 0 0 213.545 216V88a2.456 2.456 0 0 1 0-.002c.001-1.452-.597-2.895-1.623-3.922l-55.998-55.998a5.61 5.61 0 0 0-3.922-1.623 2.456 2.456 0 0 1-.002 0zm0 11.09h88A2.456 2.456 0 0 1 146.455 40v48c0 2.903 2.642 5.545 5.545 5.545h48A2.456 2.456 0 0 1 202.455 96v120a2.456 2.456 0 0 1-2.455 2.455H56A2.456 2.456 0 0 1 53.545 216V40A2.456 2.456 0 0 1 56 37.545zm103.061 11.498a2.456 2.456 0 0 1 2.676.531l28.689 28.689a2.456 2.456 0 0 1-1.736 4.191H160A2.456 2.456 0 0 1 157.545 80V51.311a2.456 2.456 0 0 1 1.516-2.268zM96 130.455c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545zm0 32c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545z"></path>';
|
|
7176
7606
|
function $c0125412b4ea0c93$export$605674723bcc715c(props = {}) {
|
|
@@ -7209,8 +7639,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7209
7639
|
type: type,
|
|
7210
7640
|
title: title
|
|
7211
7641
|
}) => type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
7212
|
-
)
|
|
7213
|
-
|
|
7642
|
+
) // + limit to three query suggestions, API sends more sometimes
|
|
7643
|
+
.slice(0, 3));
|
|
7214
7644
|
const not_queries_memo = $5vyXB$solidjs.createMemo(() => {
|
|
7215
7645
|
// For the section that shows categories and content results
|
|
7216
7646
|
// We want to limit to 3 items, and we want to show the categories first
|
|
@@ -8005,224 +8435,6 @@ function $2005eec80e40088f$export$41b4894022a3580f({
|
|
|
8005
8435
|
})));
|
|
8006
8436
|
return style_props_;
|
|
8007
8437
|
}
|
|
8008
|
-
const $5ea5a82e398f6f44$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
8009
|
-
const $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters = 30;
|
|
8010
|
-
function $5ea5a82e398f6f44$export$e1a98a189fd2c0e7({
|
|
8011
|
-
content_result_: content_result_,
|
|
8012
|
-
key_: key_,
|
|
8013
|
-
cut_when_possible_: cut_when_possible_
|
|
8014
|
-
}) {
|
|
8015
|
-
const matched_tokens = $5vyXB$solidjs.createMemo(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
8016
|
-
const full_value = $5vyXB$solidjs.createMemo(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
8017
|
-
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
8018
|
-
get when() {
|
|
8019
|
-
return matched_tokens()?.length;
|
|
8020
|
-
},
|
|
8021
|
-
get fallback() {
|
|
8022
|
-
return full_value();
|
|
8023
|
-
},
|
|
8024
|
-
get children() {
|
|
8025
|
-
return (() => {
|
|
8026
|
-
const segmented_cut_text = $5vyXB$solidjs.createMemo(() => {
|
|
8027
|
-
const segmented_text = $5ea5a82e398f6f44$var$segment_text(full_value(), matched_tokens());
|
|
8028
|
-
if (cut_when_possible_) $5ea5a82e398f6f44$var$cut_text(segmented_text);
|
|
8029
|
-
return segmented_text;
|
|
8030
|
-
});
|
|
8031
|
-
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
8032
|
-
get each() {
|
|
8033
|
-
return segmented_cut_text();
|
|
8034
|
-
},
|
|
8035
|
-
children: item => {
|
|
8036
|
-
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
8037
|
-
get when() {
|
|
8038
|
-
return item().highlighted_;
|
|
8039
|
-
},
|
|
8040
|
-
get fallback() {
|
|
8041
|
-
return item().text_;
|
|
8042
|
-
},
|
|
8043
|
-
get children() {
|
|
8044
|
-
return $5vyXB$solidjsweb.ssr($5ea5a82e398f6f44$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(item().text_));
|
|
8045
|
-
}
|
|
8046
|
-
});
|
|
8047
|
-
}
|
|
8048
|
-
});
|
|
8049
|
-
})();
|
|
8050
|
-
}
|
|
8051
|
-
});
|
|
8052
|
-
}
|
|
8053
|
-
function $5ea5a82e398f6f44$var$cut_text(segmented_text) {
|
|
8054
|
-
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
8055
|
-
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
8056
|
-
if (!segmented_text || !highlighted_segments?.length) return;
|
|
8057
|
-
// We have one or more highlighted segments
|
|
8058
|
-
if (highlighted_segments.length === 1) {
|
|
8059
|
-
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
8060
|
-
$5ea5a82e398f6f44$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
8061
|
-
return;
|
|
8062
|
-
}
|
|
8063
|
-
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
8064
|
-
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
|
|
8065
|
-
);
|
|
8066
|
-
|
|
8067
|
-
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
8068
|
-
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
8069
|
-
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);
|
|
8070
|
-
$5ea5a82e398f6f44$var$cut_start(index_of_first_segment, segmented_text);
|
|
8071
|
-
// update indexes since we might have removed segments
|
|
8072
|
-
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
8073
|
-
let number_of_characters_between_segments = 0;
|
|
8074
|
-
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
8075
|
-
const segment = segmented_text[i];
|
|
8076
|
-
number_of_characters_between_segments += segment.text_.length;
|
|
8077
|
-
}
|
|
8078
|
-
if (number_of_characters_between_segments < $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters)
|
|
8079
|
-
// don't cut if there are less than 30 characters between the two segments
|
|
8080
|
-
return;
|
|
8081
|
-
// We have more than 50 characters between the two segments, cut between them
|
|
8082
|
-
const [split_start_segment, split_start_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
8083
|
-
const [split_end_segment, split_end_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
8084
|
-
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
8085
|
-
// identical split point, or split end before split start, can't do anything
|
|
8086
|
-
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
8087
|
-
const dots_segment = {
|
|
8088
|
-
text_: " … ",
|
|
8089
|
-
highlighted_: false
|
|
8090
|
-
};
|
|
8091
|
-
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
8092
|
-
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
8093
|
-
const text = segment.text_;
|
|
8094
|
-
if (i == split_end_segment && i == split_start_segment) return [{
|
|
8095
|
-
...segment,
|
|
8096
|
-
text_: text.slice(0, split_start_character).trimEnd()
|
|
8097
|
-
}, dots_segment, {
|
|
8098
|
-
...segment,
|
|
8099
|
-
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8100
|
-
}];else if (i == split_start_segment) {
|
|
8101
|
-
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
|
|
8102
|
-
return segment;
|
|
8103
|
-
} else if (i == split_end_segment) return [dots_segment, {
|
|
8104
|
-
...segment,
|
|
8105
|
-
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8106
|
-
}];
|
|
8107
|
-
return []; // remove all segments inbetween
|
|
8108
|
-
});
|
|
8109
|
-
|
|
8110
|
-
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
8111
|
-
$5ea5a82e398f6f44$var$heal_holes(segmented_text);
|
|
8112
|
-
}
|
|
8113
|
-
function $5ea5a82e398f6f44$var$heal_holes(segmented_text) {
|
|
8114
|
-
// try to heal "holes" created in the segments so there are only alternating segments
|
|
8115
|
-
const segments_to_delete = new Set();
|
|
8116
|
-
for (let i = 0; i < segmented_text.length; i++) {
|
|
8117
|
-
const segment = segmented_text[i];
|
|
8118
|
-
let previous_segment;
|
|
8119
|
-
for (let j = i - 1; j >= 0; j--) {
|
|
8120
|
-
previous_segment = segmented_text[j];
|
|
8121
|
-
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
8122
|
-
if (!segments_to_delete.has(previous_segment)) break;
|
|
8123
|
-
}
|
|
8124
|
-
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
8125
|
-
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
8126
|
-
segments_to_delete.add(segment);
|
|
8127
|
-
}
|
|
8128
|
-
}
|
|
8129
|
-
for (const segment of segments_to_delete) {
|
|
8130
|
-
const index = segmented_text.indexOf(segment);
|
|
8131
|
-
segmented_text.splice(index, 1);
|
|
8132
|
-
}
|
|
8133
|
-
}
|
|
8134
|
-
function $5ea5a82e398f6f44$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
8135
|
-
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
8136
|
-
const step = should_loop_backwards ? -1 : 1;
|
|
8137
|
-
const desperate_split_attempts = [":", ";", ","];
|
|
8138
|
-
while (desperate_split_attempts.length) {
|
|
8139
|
-
const split_point_between_words = [];
|
|
8140
|
-
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
8141
|
-
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
8142
|
-
let is_first_character = true;
|
|
8143
|
-
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
8144
|
-
const segment = segmented_text[i];
|
|
8145
|
-
const text = segment.text_;
|
|
8146
|
-
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
8147
|
-
const character = text[j];
|
|
8148
|
-
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
8149
|
-
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
8150
|
-
split_point_between_words.push([i, j]);
|
|
8151
|
-
if (split_point_between_words.length > 3)
|
|
8152
|
-
// We can't find a split point, so we'll just split between words
|
|
8153
|
-
// 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
|
|
8154
|
-
return split_point_between_words[1];
|
|
8155
|
-
}
|
|
8156
|
-
}
|
|
8157
|
-
}
|
|
8158
|
-
}
|
|
8159
|
-
return [];
|
|
8160
|
-
}
|
|
8161
|
-
function $5ea5a82e398f6f44$var$cut_start(cut_left_of_index, segmented_text) {
|
|
8162
|
-
// Cut the start of the text to bring the first matching token
|
|
8163
|
-
let is_first_character = false;
|
|
8164
|
-
let words_encountered = 0;
|
|
8165
|
-
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
8166
|
-
const segment = segmented_text[i];
|
|
8167
|
-
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
8168
|
-
const text = segment.text_;
|
|
8169
|
-
for (let j = text.length - 1; j >= 0; j--) {
|
|
8170
|
-
const character = text[j];
|
|
8171
|
-
const is_space = character == " ";
|
|
8172
|
-
if (!is_first_character && is_space) words_encountered++;
|
|
8173
|
-
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
8174
|
-
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
8175
|
-
segment.text_ = text.slice(j + 1).trimStart();
|
|
8176
|
-
segmented_text.splice(0, i);
|
|
8177
|
-
if (character === "," || is_space)
|
|
8178
|
-
// if we cut at a comma or psace, we add a … at the beginning
|
|
8179
|
-
segmented_text.unshift({
|
|
8180
|
-
text_: "… ",
|
|
8181
|
-
highlighted_: false
|
|
8182
|
-
});
|
|
8183
|
-
break outmost_loop;
|
|
8184
|
-
}
|
|
8185
|
-
if (is_first_character) is_first_character = false;
|
|
8186
|
-
}
|
|
8187
|
-
}
|
|
8188
|
-
$5ea5a82e398f6f44$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
8189
|
-
}
|
|
8190
|
-
|
|
8191
|
-
function $5ea5a82e398f6f44$var$segment_text(text, matched_strings) {
|
|
8192
|
-
// segment text where the matched strings are highlighted sections
|
|
8193
|
-
const output = [];
|
|
8194
|
-
if (!text) return; // shouldn't happen but whatever
|
|
8195
|
-
for (let i = 0; i < text.length; i++) {
|
|
8196
|
-
const found_strings = [];
|
|
8197
|
-
if (!i || text[i - 1] == " ")
|
|
8198
|
-
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
8199
|
-
for (let j = 0; j < matched_strings.length; j++) {
|
|
8200
|
-
const matched_string = matched_strings[j];
|
|
8201
|
-
const part_in_text = text.slice(i, i + matched_string.length);
|
|
8202
|
-
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
8203
|
-
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
|
|
8204
|
-
}
|
|
8205
|
-
|
|
8206
|
-
const last_index_in_output = output.length - 1;
|
|
8207
|
-
if (!found_strings.length) {
|
|
8208
|
-
const character = text[i];
|
|
8209
|
-
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
8210
|
-
// 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
|
|
8211
|
-
output[last_index_in_output].text_ += character;else output.push({
|
|
8212
|
-
highlighted_: false,
|
|
8213
|
-
text_: character
|
|
8214
|
-
});
|
|
8215
|
-
} else {
|
|
8216
|
-
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
8217
|
-
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
8218
|
-
highlighted_: true,
|
|
8219
|
-
text_: longest_found_string
|
|
8220
|
-
});
|
|
8221
|
-
i += longest_found_string.length - 1;
|
|
8222
|
-
}
|
|
8223
|
-
}
|
|
8224
|
-
return output;
|
|
8225
|
-
}
|
|
8226
8438
|
const $76227de40be817e5$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
|
|
8227
8439
|
$76227de40be817e5$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div>"];
|
|
8228
8440
|
function $76227de40be817e5$export$f631859cab12b342({
|