@depict-ai/ui 2.1.11 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +880 -612
- package/ES10/index.d.ts +4 -3
- package/ES10/index.js +881 -613
- package/latest/index.cjs +849 -599
- package/latest/index.d.ts +4 -3
- package/latest/index.js +850 -600
- 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 +3 -3
- package/server/ES10/index.cjs +749 -522
- package/server/ES10/index.d.ts +4 -3
- package/server/ES10/index.js +750 -523
- package/server/latest/index.cjs +734 -523
- package/server/latest/index.d.ts +4 -3
- package/server/latest/index.js +735 -524
package/server/ES10/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ $parcel$export(module.exports, "ListingProvider", () => $d067f3a30f047b41$export
|
|
|
25
25
|
$parcel$export(module.exports, "useListing", () => $d067f3a30f047b41$export$8d0c4fdbb05a2f2e);
|
|
26
26
|
$parcel$export(module.exports, "ShopifyContainedImage", () => $28535bb7671c63d1$export$e4b984597b71e989);
|
|
27
27
|
$parcel$export(module.exports, "SlidableItems", () => $ad8ec7729fffeb9c$export$6649caad96ef8870);
|
|
28
|
-
$parcel$export(module.exports, "
|
|
28
|
+
$parcel$export(module.exports, "make_accurate_width_accessor", () => $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd);
|
|
29
29
|
$parcel$export(module.exports, "RecommendationSlider", () => $2badc30d7c6610e1$export$9574e176201e5e8d);
|
|
30
30
|
$parcel$export(module.exports, "RecommendationGrid", () => $41227f10ad680afd$export$9756467d34d91cdb);
|
|
31
31
|
$parcel$export(module.exports, "ShopifyResponsiveImg", () => $858fdcf73148519f$export$6e5611bc7e57e477);
|
|
@@ -76,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
76
76
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
77
77
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
78
78
|
/*! Depict.ai search and product listing SDK */
|
|
79
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.
|
|
79
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.13";
|
|
80
80
|
const $a68b73fd7ba0853f$var$fallback_operator = "in";
|
|
81
81
|
const $a68b73fd7ba0853f$var$fallback_token = "";
|
|
82
82
|
const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
|
|
@@ -506,13 +506,13 @@ function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
|
|
|
506
506
|
|
|
507
507
|
/** @jsxImportSource solid-js */
|
|
508
508
|
|
|
509
|
-
function $
|
|
510
|
-
const [
|
|
509
|
+
function $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(what_to_watch) {
|
|
510
|
+
const [width, setWidth] = $3hooq$solidjs.createSignal();
|
|
511
511
|
const resizeObserver = new ResizeObserver($3hooq$depictaiutilishared.catchify(records => {
|
|
512
512
|
for (let j = 0; j < records.length; j++) {
|
|
513
513
|
var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
|
|
514
514
|
const width = (_records$j$borderBoxS = (_records$j$borderBoxS2 = records[j].borderBoxSize) === null || _records$j$borderBoxS2 === void 0 ? void 0 : (_records$j$borderBoxS3 = _records$j$borderBoxS2[0]) === null || _records$j$borderBoxS3 === void 0 ? void 0 : _records$j$borderBoxS3.inlineSize) !== null && _records$j$borderBoxS !== void 0 ? _records$j$borderBoxS : what_to_watch.getBoundingClientRect().width;
|
|
515
|
-
|
|
515
|
+
setWidth(width);
|
|
516
516
|
}
|
|
517
517
|
}));
|
|
518
518
|
// 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.
|
|
@@ -521,13 +521,19 @@ function $13671aa5e984acd9$export$9f191182275e9ef(what_to_watch) {
|
|
|
521
521
|
let {
|
|
522
522
|
element: element
|
|
523
523
|
} = _ref;
|
|
524
|
-
return requestAnimationFrame($3hooq$depictaiutilishared.catchify(() =>
|
|
524
|
+
return requestAnimationFrame($3hooq$depictaiutilishared.catchify(() => {
|
|
525
|
+
const current_size = what_to_watch.getBoundingClientRect().width;
|
|
526
|
+
if (current_size)
|
|
527
|
+
// 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.
|
|
528
|
+
setWidth(current_size);
|
|
529
|
+
resizeObserver.observe(element);
|
|
530
|
+
}));
|
|
525
531
|
});
|
|
526
532
|
$3hooq$solidjs.onCleanup(() => {
|
|
527
533
|
resizeObserver.disconnect();
|
|
528
534
|
disconnect();
|
|
529
535
|
});
|
|
530
|
-
return
|
|
536
|
+
return width;
|
|
531
537
|
}
|
|
532
538
|
const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
|
|
533
539
|
const cols_at_size = [];
|
|
@@ -828,11 +834,11 @@ class $95e4006e1dcb5b72$export$aa14a9f43128f61f extends $95e4006e1dcb5b72$export
|
|
|
828
834
|
});
|
|
829
835
|
}
|
|
830
836
|
}
|
|
831
|
-
const $1b3cf201cdd38687$var$_tmpl$ = ["<div", ' class="', '"
|
|
837
|
+
const $1b3cf201cdd38687$var$_tmpl$ = ["<div", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"];
|
|
832
838
|
function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
|
|
833
839
|
return $3hooq$solidjs.ErrorBoundary({
|
|
834
840
|
fallback(err, retry) {
|
|
835
|
-
var _props$
|
|
841
|
+
var _props$class_list_, _props$on_error_;
|
|
836
842
|
const {
|
|
837
843
|
message_: message_,
|
|
838
844
|
severity_: severity_
|
|
@@ -842,8 +848,7 @@ function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
|
|
|
842
848
|
console.error(err.cause);
|
|
843
849
|
message = "".concat(message, ": ").concat(err.message);
|
|
844
850
|
} else $3hooq$depictaiutilishared.report([err, message_], severity_);
|
|
845
|
-
(_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0
|
|
846
|
-
return $3hooq$solidjsweb.ssr($1b3cf201cdd38687$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrClassList(Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || [])), $3hooq$solidjsweb.escape(message));
|
|
851
|
+
return $3hooq$solidjsweb.ssr($1b3cf201cdd38687$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrClassList(Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || [])), $3hooq$solidjsweb.escape(message), $3hooq$solidjsweb.escape((_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 ? void 0 : _props$on_error_.call(props, retry)));
|
|
847
852
|
},
|
|
848
853
|
get children() {
|
|
849
854
|
return props.children;
|
|
@@ -1325,12 +1330,12 @@ function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
|
|
|
1325
1330
|
const $083b2336093176cf$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>';
|
|
1326
1331
|
function $083b2336093176cf$export$3b621d86b1566b2() {
|
|
1327
1332
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1328
|
-
return $3hooq$solidjsweb.ssrElement("svg", $3hooq$solidjsweb.mergeProps(
|
|
1333
|
+
return $3hooq$solidjsweb.ssrElement("svg", $3hooq$solidjsweb.mergeProps({
|
|
1329
1334
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1330
1335
|
width: "21.064",
|
|
1331
1336
|
height: "21.047",
|
|
1332
1337
|
viewBox: "0 0 21.064 21.064"
|
|
1333
|
-
}), () => $3hooq$solidjsweb.ssr($083b2336093176cf$var$_tmpl$), true);
|
|
1338
|
+
}, props), () => $3hooq$solidjsweb.ssr($083b2336093176cf$var$_tmpl$), true);
|
|
1334
1339
|
}
|
|
1335
1340
|
|
|
1336
1341
|
/**
|
|
@@ -1558,7 +1563,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
|
|
|
1558
1563
|
const $902a0ca2b52f3898$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
1559
1564
|
$902a0ca2b52f3898$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--$-->", "<!--/--></label>"];
|
|
1560
1565
|
const $902a0ca2b52f3898$export$48513f6b9f8ce62d = props => {
|
|
1561
|
-
// 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
|
|
1566
|
+
/* 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
|
|
1562
1567
|
const count = $3hooq$solidjs.createMemo(() => props.count_);
|
|
1563
1568
|
const label = $3hooq$solidjs.createMemo(() => props.label_);
|
|
1564
1569
|
const checked = $3hooq$solidjs.createMemo(() => props.checked_);
|
|
@@ -1591,6 +1596,60 @@ function $b0477e4d832f090e$export$ca21a16d65b3dd8(_ref) {
|
|
|
1591
1596
|
} = _ref;
|
|
1592
1597
|
return $3hooq$solidjsweb.ssr($b0477e4d832f090e$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "expand-filter ".concat(get_show_extras() ? "expanded" : ""), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a904ccf883f60231$export$f21ab0717a89c77f), {})), get_show_extras() ? $3hooq$solidjsweb.escape(i18n_.view_less_()) : $3hooq$solidjsweb.escape(i18n_.view_more_()));
|
|
1593
1598
|
}
|
|
1599
|
+
const $23c3f390dee33ff8$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
1600
|
+
$23c3f390dee33ff8$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
1601
|
+
function $23c3f390dee33ff8$export$ba17c5b7e6dda39f(_ref) {
|
|
1602
|
+
let {
|
|
1603
|
+
whole_text_to_display_: whole_text_to_display_memo,
|
|
1604
|
+
searching_for_value_: searching_for_value_memo,
|
|
1605
|
+
class_: class_
|
|
1606
|
+
} = _ref;
|
|
1607
|
+
const [get_has_highlighted, set_has_highlighted] = $3hooq$solidjs.createSignal(false);
|
|
1608
|
+
const text_itself = $3hooq$solidjs.createMemo(() => $3hooq$solidjs.batch(() => {
|
|
1609
|
+
set_has_highlighted(false);
|
|
1610
|
+
const searching_for_value = searching_for_value_memo();
|
|
1611
|
+
const whole_text_to_display_ = whole_text_to_display_memo();
|
|
1612
|
+
let for_black = "";
|
|
1613
|
+
let pushed_grey = false;
|
|
1614
|
+
const search_q = searching_for_value;
|
|
1615
|
+
if (!search_q) return whole_text_to_display_;
|
|
1616
|
+
const output = [];
|
|
1617
|
+
const searching_for = search_q.toLowerCase();
|
|
1618
|
+
const push_black = () => {
|
|
1619
|
+
if (for_black) {
|
|
1620
|
+
set_has_highlighted(true);
|
|
1621
|
+
output.push($3hooq$solidjsweb.ssr($23c3f390dee33ff8$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(for_black))); // "black"
|
|
1622
|
+
for_black = "";
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
for (let i = 0; i < whole_text_to_display_.length;) {
|
|
1626
|
+
let is_whole_word = true;
|
|
1627
|
+
let searching_for_but_with_texts_casing = "";
|
|
1628
|
+
const i_at_start = i;
|
|
1629
|
+
for (let j = 0; j < searching_for.length; i++, j++) {
|
|
1630
|
+
const letter_in_suggestion = whole_text_to_display_[i];
|
|
1631
|
+
if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
|
|
1632
|
+
is_whole_word = false;
|
|
1633
|
+
i = i_at_start;
|
|
1634
|
+
break;
|
|
1635
|
+
}
|
|
1636
|
+
searching_for_but_with_texts_casing += letter_in_suggestion;
|
|
1637
|
+
}
|
|
1638
|
+
if (is_whole_word) {
|
|
1639
|
+
push_black();
|
|
1640
|
+
output.push(searching_for_but_with_texts_casing);
|
|
1641
|
+
pushed_grey = true;
|
|
1642
|
+
} else for_black += whole_text_to_display_[i++];
|
|
1643
|
+
}
|
|
1644
|
+
push_black();
|
|
1645
|
+
if (!pushed_grey) {
|
|
1646
|
+
set_has_highlighted(false);
|
|
1647
|
+
return whole_text_to_display_;
|
|
1648
|
+
}
|
|
1649
|
+
return output;
|
|
1650
|
+
}));
|
|
1651
|
+
return $3hooq$solidjsweb.ssr($23c3f390dee33ff8$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), "".concat($3hooq$solidjsweb.escape(class_, true) || "", " ").concat(get_has_highlighted() ? "has-match" : ""), $3hooq$solidjsweb.ssrAttribute("title", $3hooq$solidjsweb.escape(whole_text_to_display_memo(), true), false), $3hooq$solidjsweb.escape(text_itself()));
|
|
1652
|
+
}
|
|
1594
1653
|
const $9b54b9c5381716eb$var$_tmpl$ = ["<form", ' class="checkboxes"><!--$-->', "<!--/--><!--$-->", "<!--/--></form>"];
|
|
1595
1654
|
const $9b54b9c5381716eb$var$max_visible_without_collapsing = 15;
|
|
1596
1655
|
const $9b54b9c5381716eb$var$show_non_collapsible_when_collapsed = 4;
|
|
@@ -1599,7 +1658,8 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
|
|
|
1599
1658
|
filter_: filter_,
|
|
1600
1659
|
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
1601
1660
|
i18n_: i18n_,
|
|
1602
|
-
view_more_button_below_group_: [, set_view_more_button_below_group_]
|
|
1661
|
+
view_more_button_below_group_: [, set_view_more_button_below_group_],
|
|
1662
|
+
filter_query_: filter_query_
|
|
1603
1663
|
} = _ref;
|
|
1604
1664
|
const existing_filter = $3hooq$solidjs.createMemo(() => {
|
|
1605
1665
|
const {
|
|
@@ -1634,12 +1694,18 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
|
|
|
1634
1694
|
const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
|
|
1635
1695
|
return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
|
|
1636
1696
|
});
|
|
1697
|
+
const value = $3hooq$solidjs.createMemo(() => checkbox().value_);
|
|
1637
1698
|
return $3hooq$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
|
|
1638
1699
|
get value_() {
|
|
1639
|
-
return
|
|
1700
|
+
return value();
|
|
1640
1701
|
},
|
|
1641
1702
|
get label_() {
|
|
1642
|
-
return
|
|
1703
|
+
return $3hooq$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
|
|
1704
|
+
get whole_text_to_display_() {
|
|
1705
|
+
return $3hooq$solidjs.createMemo(() => checkbox().name_ || value());
|
|
1706
|
+
},
|
|
1707
|
+
searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
|
|
1708
|
+
});
|
|
1643
1709
|
},
|
|
1644
1710
|
get count_() {
|
|
1645
1711
|
return checkbox().count_;
|
|
@@ -1702,7 +1768,8 @@ const $d9239dad9a9d899b$var$_tmpl$ = ["<form", ' class="radios">', "</form>"],
|
|
|
1702
1768
|
function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
|
|
1703
1769
|
let {
|
|
1704
1770
|
selected_filters_: selected_filters_,
|
|
1705
|
-
filter_: filter_
|
|
1771
|
+
filter_: filter_,
|
|
1772
|
+
filter_query_: filter_query_
|
|
1706
1773
|
} = _ref;
|
|
1707
1774
|
const radio_name = $3hooq$depictaiutilishared.make_random_classname();
|
|
1708
1775
|
const existing_filter = $3hooq$solidjs.createMemo(() => {
|
|
@@ -1728,19 +1795,23 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
|
|
|
1728
1795
|
var _counts;
|
|
1729
1796
|
return (_counts = filter_().meta.counts) === null || _counts === void 0 ? void 0 : _counts[index];
|
|
1730
1797
|
});
|
|
1798
|
+
const label = $3hooq$solidjs.createMemo(() => {
|
|
1799
|
+
var _filter_$meta, _filter_$meta$names;
|
|
1800
|
+
const name = (_filter_$meta = filter_().meta) === null || _filter_$meta === void 0 ? void 0 : (_filter_$meta$names = _filter_$meta.names) === null || _filter_$meta$names === void 0 ? void 0 : _filter_$meta$names[index];
|
|
1801
|
+
if (name) return name;
|
|
1802
|
+
const v = value();
|
|
1803
|
+
return Array.isArray(v) ? v.join(" - ") : v + "";
|
|
1804
|
+
});
|
|
1731
1805
|
return $3hooq$solidjsweb.ssr($d9239dad9a9d899b$var$_tmpl$3, $3hooq$solidjsweb.ssrHydrationKey(), "input-row ".concat(count() === 0 ? "count-0" : ""), $3hooq$solidjsweb.ssrAttribute("for", $3hooq$solidjsweb.escape(random_selector, true), false), $3hooq$solidjsweb.ssrAttribute("id", $3hooq$solidjsweb.escape(random_selector, true), false) + $3hooq$solidjsweb.ssrAttribute("name", $3hooq$solidjsweb.escape(radio_name, true), false), $3hooq$solidjsweb.ssrAttribute("checked", $3hooq$solidjs.createMemo(() => {
|
|
1732
1806
|
var _existing_filter;
|
|
1733
1807
|
const v = value();
|
|
1734
1808
|
const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
|
|
1735
1809
|
if ($e2d74bb03cc5252e$export$325f75597868c4f0(data) === $e2d74bb03cc5252e$export$325f75597868c4f0(v)) return true;
|
|
1736
1810
|
return Array.isArray(data) && data.every((item, index) => item === v[index]);
|
|
1737
|
-
})(), true), $3hooq$solidjsweb.escape($3hooq$
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
const v = value();
|
|
1742
|
-
return Array.isArray(v) ? v.join(" - ") : v;
|
|
1743
|
-
})()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
1811
|
+
})(), true), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
|
|
1812
|
+
whole_text_to_display_: label,
|
|
1813
|
+
searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
|
|
1814
|
+
})), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
1744
1815
|
get when() {
|
|
1745
1816
|
return count() != undefined;
|
|
1746
1817
|
},
|
|
@@ -1758,7 +1829,8 @@ function $0257c760a99bfacb$export$e0d834a0ad870cda(_ref) {
|
|
|
1758
1829
|
let {
|
|
1759
1830
|
filter_: filter_,
|
|
1760
1831
|
selected_filters_: selected_filters_,
|
|
1761
|
-
i18n_: i18n_
|
|
1832
|
+
i18n_: i18n_,
|
|
1833
|
+
filter_query_: filter_query_
|
|
1762
1834
|
} = _ref;
|
|
1763
1835
|
// 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
|
|
1764
1836
|
// 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
|
|
@@ -1989,158 +2061,422 @@ function $ac040bdfeed58ee4$export$e5c2828934226505(_ref) {
|
|
|
1989
2061
|
});
|
|
1990
2062
|
return outer_div;
|
|
1991
2063
|
}
|
|
1992
|
-
const $
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
$9c1d49181fb3002a$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="', '">', "</span><!--$-->", "<!--/--></div></summary>"];
|
|
1996
|
-
const $9c1d49181fb3002a$var$max_visible_without_collapsing = 15;
|
|
1997
|
-
const $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed = 4;
|
|
1998
|
-
function $9c1d49181fb3002a$export$a32086fa6616eafd(_ref) {
|
|
2064
|
+
const $99472afa7112c427$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
2065
|
+
const $99472afa7112c427$var$dont_cut_in_between_less_than_characters = 30;
|
|
2066
|
+
function $99472afa7112c427$export$e1a98a189fd2c0e7(_ref) {
|
|
1999
2067
|
let {
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
view_more_button_below_group_: view_more_button_below_group_,
|
|
2004
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_
|
|
2068
|
+
content_result_: content_result_,
|
|
2069
|
+
key_: key_,
|
|
2070
|
+
cut_when_possible_: cut_when_possible_
|
|
2005
2071
|
} = _ref;
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
field: field,
|
|
2010
|
-
op: op
|
|
2011
|
-
} = filter_();
|
|
2012
|
-
return selected_filters_[0]().find(_ref2 => {
|
|
2013
|
-
let {
|
|
2014
|
-
field: checking_field,
|
|
2015
|
-
op: checking_op
|
|
2016
|
-
} = _ref2;
|
|
2017
|
-
return checking_field === field && checking_op === op;
|
|
2018
|
-
});
|
|
2019
|
-
});
|
|
2020
|
-
const show_extras = $3hooq$solidjs.createSignal(false);
|
|
2021
|
-
const trigger_sync_ = $9c1d49181fb3002a$var$batching_filter_state_syncer({
|
|
2022
|
-
filter_: filter_,
|
|
2023
|
-
existing_filter_: existing_filter,
|
|
2024
|
-
selected_filters_: selected_filters_,
|
|
2025
|
-
get category_structure_() {
|
|
2026
|
-
return structured_categories();
|
|
2027
|
-
}
|
|
2028
|
-
});
|
|
2029
|
-
const structured_categories = $3hooq$solidjs.createMemo(() => {
|
|
2030
|
-
const execute_when_structure_finished = [];
|
|
2031
|
-
const {
|
|
2032
|
-
values: values,
|
|
2033
|
-
names: names,
|
|
2034
|
-
counts: counts
|
|
2035
|
-
} = filter_().meta;
|
|
2036
|
-
const data_structure = {};
|
|
2037
|
-
for (let i = 0; i < values.length; i++) {
|
|
2038
|
-
const value = values[i];
|
|
2039
|
-
let pointer = data_structure;
|
|
2040
|
-
let parent_ = {};
|
|
2041
|
-
let created_an_object = false;
|
|
2042
|
-
for (let j = 0; j < value.length; j++) {
|
|
2043
|
-
var _pointer;
|
|
2044
|
-
const this_categories_name = value[j];
|
|
2045
|
-
const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
|
|
2046
|
-
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;
|
|
2047
|
-
const created_obj = {
|
|
2048
|
-
name_: names[i],
|
|
2049
|
-
count_: counts === null || counts === void 0 ? void 0 : counts[i],
|
|
2050
|
-
parent_: parent_,
|
|
2051
|
-
is_expanded_: $9c1d49181fb3002a$var$make_expanded_signal({
|
|
2052
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2053
|
-
filter_value_: value_as_string
|
|
2054
|
-
}),
|
|
2055
|
-
value_: value_as_string,
|
|
2056
|
-
children_: {}
|
|
2057
|
-
};
|
|
2058
|
-
const {
|
|
2059
|
-
signal_: signal_,
|
|
2060
|
-
on_structure_complete_: on_structure_complete_
|
|
2061
|
-
} = $9c1d49181fb3002a$var$create_updating_signal({
|
|
2062
|
-
self_: created_obj,
|
|
2063
|
-
existing_filter_: $3hooq$solidjs.untrack(existing_filter),
|
|
2064
|
-
trigger_sync_: trigger_sync_
|
|
2065
|
-
});
|
|
2066
|
-
execute_when_structure_finished.push(on_structure_complete_);
|
|
2067
|
-
created_obj.is_checked_ = signal_;
|
|
2068
|
-
parent_ = created_obj;
|
|
2069
|
-
created_an_object = true;
|
|
2070
|
-
return created_obj;
|
|
2071
|
-
})());
|
|
2072
|
-
pointer = obj.children_;
|
|
2073
|
-
parent_ = obj;
|
|
2074
|
-
}
|
|
2075
|
-
if (!created_an_object && "value_" in parent_) {
|
|
2076
|
-
// 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
|
|
2077
|
-
// [
|
|
2078
|
-
// ["Öl", "IPA"],
|
|
2079
|
-
// ["Öl", "Pale Ale"],
|
|
2080
|
-
// ["Öl", "Ale"],
|
|
2081
|
-
// ["Öl", "Mörk Lager"],
|
|
2082
|
-
// ["Öl", "Suröl"],
|
|
2083
|
-
// ["Öl", "Veteöl"],
|
|
2084
|
-
// ["Öl", "Stout och Porter"],
|
|
2085
|
-
// ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
|
|
2086
|
-
// ["Öl", "Ljus Lager"],
|
|
2087
|
-
// ];
|
|
2088
|
-
// In this case we want to just correct the name and value of the already created object, which will be in parent_
|
|
2089
|
-
parent_.value_ = value.map(v => v + "");
|
|
2090
|
-
parent_.name_ = names[i];
|
|
2091
|
-
parent_.count_ = counts[i];
|
|
2092
|
-
parent_.is_expanded_ = $9c1d49181fb3002a$var$make_expanded_signal({
|
|
2093
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2094
|
-
filter_value_: parent_.value_
|
|
2095
|
-
});
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
|
|
2099
|
-
$9c1d49181fb3002a$var$expand_until_choice(data_structure);
|
|
2100
|
-
$3hooq$depictaiutilishared.dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
|
|
2101
|
-
return data_structure;
|
|
2072
|
+
const matched_tokens = $3hooq$solidjs.createMemo(() => {
|
|
2073
|
+
var _content_result_$high, _content_result_$high2;
|
|
2074
|
+
return (_content_result_$high = content_result_().highlights) === null || _content_result_$high === void 0 ? void 0 : (_content_result_$high2 = _content_result_$high.find(highlight => highlight.field == key_)) === null || _content_result_$high2 === void 0 ? void 0 : _content_result_$high2.matched_tokens;
|
|
2102
2075
|
});
|
|
2103
|
-
const
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
collapse: collapse,
|
|
2107
|
-
ExpandingContainer: ExpandingContainer
|
|
2108
|
-
} = $d6d51b09cb2116a6$export$5bad61ecde080b1f({
|
|
2109
|
-
duration: 200
|
|
2076
|
+
const full_value = $3hooq$solidjs.createMemo(() => {
|
|
2077
|
+
var _content_result_$key_;
|
|
2078
|
+
return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
|
|
2110
2079
|
});
|
|
2111
|
-
|
|
2080
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
2081
|
+
get when() {
|
|
2082
|
+
var _matched_tokens;
|
|
2083
|
+
return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
|
|
2084
|
+
},
|
|
2085
|
+
get fallback() {
|
|
2086
|
+
return full_value();
|
|
2087
|
+
},
|
|
2112
2088
|
get children() {
|
|
2113
|
-
return
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2089
|
+
return (() => {
|
|
2090
|
+
const segmented_cut_text = $3hooq$solidjs.createMemo(() => {
|
|
2091
|
+
const segmented_text = $99472afa7112c427$export$1b00d74faf266c56(full_value(), matched_tokens());
|
|
2092
|
+
if (cut_when_possible_) $99472afa7112c427$var$cut_text(segmented_text);
|
|
2093
|
+
return segmented_text;
|
|
2094
|
+
});
|
|
2095
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
2096
|
+
get each() {
|
|
2097
|
+
return segmented_cut_text();
|
|
2098
|
+
},
|
|
2099
|
+
children: item => {
|
|
2100
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
2101
|
+
get when() {
|
|
2102
|
+
return item().highlighted_;
|
|
2103
|
+
},
|
|
2104
|
+
get fallback() {
|
|
2105
|
+
return item().text_;
|
|
2106
|
+
},
|
|
2107
|
+
get children() {
|
|
2108
|
+
return $3hooq$solidjsweb.ssr($99472afa7112c427$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(item().text_));
|
|
2109
|
+
}
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
})();
|
|
2121
2114
|
}
|
|
2122
2115
|
});
|
|
2123
|
-
$3hooq$solidjs.createRenderEffect(() => {
|
|
2124
|
-
view_more_button_below_group_[1](some_top_level_are_hidden() ? $3hooq$solidjsweb.createComponent((0, $b0477e4d832f090e$export$ca21a16d65b3dd8), {
|
|
2125
|
-
show_extras_: show_extras,
|
|
2126
|
-
i18n_: i18n_
|
|
2127
|
-
}) : []);
|
|
2128
|
-
});
|
|
2129
|
-
$3hooq$solidjs.createEffect($3hooq$depictaiutilishared.catchify(async () => {
|
|
2130
|
-
if (!some_top_level_are_hidden()) {
|
|
2131
|
-
await collapse();
|
|
2132
|
-
return;
|
|
2133
|
-
}
|
|
2134
|
-
if (show_extras[0]()) await expand();else await collapse();
|
|
2135
|
-
}));
|
|
2136
|
-
return $3hooq$solidjsweb.ssr($9c1d49181fb3002a$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "checkboxes hierarchical ".concat(Object.values(structured_categories()).some(category => Object.keys(category.children_).length) ? "any-expandable" : ""), $3hooq$solidjsweb.escape($9c1d49181fb3002a$var$render_stuff($3hooq$solidjs.createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_)), $3hooq$solidjsweb.escape(expanding_container_els));
|
|
2137
2116
|
}
|
|
2138
|
-
function $
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2117
|
+
function $99472afa7112c427$var$cut_text(segmented_text) {
|
|
2118
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
2119
|
+
const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
|
|
2120
|
+
if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
|
|
2121
|
+
// We have one or more highlighted segments
|
|
2122
|
+
if (highlighted_segments.length === 1) {
|
|
2123
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
2124
|
+
$99472afa7112c427$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
2125
|
+
return;
|
|
2126
|
+
}
|
|
2127
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
2128
|
+
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
|
|
2129
|
+
);
|
|
2130
|
+
|
|
2131
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
2132
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
2133
|
+
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);
|
|
2134
|
+
$99472afa7112c427$var$cut_start(index_of_first_segment, segmented_text);
|
|
2135
|
+
// update indexes since we might have removed segments
|
|
2136
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
2137
|
+
let number_of_characters_between_segments = 0;
|
|
2138
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
2139
|
+
const segment = segmented_text[i];
|
|
2140
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
2141
|
+
}
|
|
2142
|
+
if (number_of_characters_between_segments < $99472afa7112c427$var$dont_cut_in_between_less_than_characters)
|
|
2143
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
2144
|
+
return;
|
|
2145
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
2146
|
+
const [split_start_segment, split_start_character] = $99472afa7112c427$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
2147
|
+
const [split_end_segment, split_end_character] = $99472afa7112c427$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
2148
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
2149
|
+
// identical split point, or split end before split start, can't do anything
|
|
2150
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
2151
|
+
const dots_segment = {
|
|
2152
|
+
text_: " … ",
|
|
2153
|
+
highlighted_: false
|
|
2154
|
+
};
|
|
2155
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
2156
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
2157
|
+
const text = segment.text_;
|
|
2158
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
2159
|
+
...segment,
|
|
2160
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
2161
|
+
}, dots_segment, {
|
|
2162
|
+
...segment,
|
|
2163
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
2164
|
+
}];else if (i == split_start_segment) {
|
|
2165
|
+
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
|
|
2166
|
+
return segment;
|
|
2167
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
2168
|
+
...segment,
|
|
2169
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
2170
|
+
}];
|
|
2171
|
+
return []; // remove all segments inbetween
|
|
2172
|
+
});
|
|
2173
|
+
|
|
2174
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
2175
|
+
$99472afa7112c427$var$heal_holes(segmented_text);
|
|
2176
|
+
}
|
|
2177
|
+
function $99472afa7112c427$var$heal_holes(segmented_text) {
|
|
2178
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
2179
|
+
const segments_to_delete = new Set();
|
|
2180
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
2181
|
+
var _previous_segment, _previous_segment2;
|
|
2182
|
+
const segment = segmented_text[i];
|
|
2183
|
+
let previous_segment;
|
|
2184
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
2185
|
+
previous_segment = segmented_text[j];
|
|
2186
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
2187
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
2188
|
+
}
|
|
2189
|
+
if ((_previous_segment = previous_segment) !== null && _previous_segment !== void 0 && _previous_segment.highlighted_ && segment.highlighted_ || ((_previous_segment2 = previous_segment) === null || _previous_segment2 === void 0 ? void 0 : _previous_segment2.highlighted_) === false && segment.highlighted_ === false) {
|
|
2190
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
2191
|
+
segments_to_delete.add(segment);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
for (const segment of segments_to_delete) {
|
|
2195
|
+
const index = segmented_text.indexOf(segment);
|
|
2196
|
+
segmented_text.splice(index, 1);
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
function $99472afa7112c427$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
|
|
2200
|
+
let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
2201
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
2202
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
2203
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
2204
|
+
while (desperate_split_attempts.length) {
|
|
2205
|
+
const split_point_between_words = [];
|
|
2206
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
2207
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
2208
|
+
let is_first_character = true;
|
|
2209
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
2210
|
+
const segment = segmented_text[i];
|
|
2211
|
+
const text = segment.text_;
|
|
2212
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
2213
|
+
const character = text[j];
|
|
2214
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
2215
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
2216
|
+
split_point_between_words.push([i, j]);
|
|
2217
|
+
if (split_point_between_words.length > 3)
|
|
2218
|
+
// We can't find a split point, so we'll just split between words
|
|
2219
|
+
// 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
|
|
2220
|
+
return split_point_between_words[1];
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
return [];
|
|
2226
|
+
}
|
|
2227
|
+
function $99472afa7112c427$var$cut_start(cut_left_of_index, segmented_text) {
|
|
2228
|
+
// Cut the start of the text to bring the first matching token
|
|
2229
|
+
let is_first_character = false;
|
|
2230
|
+
let words_encountered = 0;
|
|
2231
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
2232
|
+
const segment = segmented_text[i];
|
|
2233
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
2234
|
+
const text = segment.text_;
|
|
2235
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
2236
|
+
const character = text[j];
|
|
2237
|
+
const is_space = character == " ";
|
|
2238
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
2239
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
2240
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
2241
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
2242
|
+
segmented_text.splice(0, i);
|
|
2243
|
+
if (character === "," || is_space)
|
|
2244
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
2245
|
+
segmented_text.unshift({
|
|
2246
|
+
text_: "… ",
|
|
2247
|
+
highlighted_: false
|
|
2248
|
+
});
|
|
2249
|
+
break outmost_loop;
|
|
2250
|
+
}
|
|
2251
|
+
if (is_first_character) is_first_character = false;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
$99472afa7112c427$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
function $99472afa7112c427$export$1b00d74faf266c56(text, matched_strings) {
|
|
2258
|
+
let loose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2259
|
+
const output = [];
|
|
2260
|
+
if (!text) return; // shouldn't happen but whatever
|
|
2261
|
+
for (let i = 0; i < text.length; i++) {
|
|
2262
|
+
const found_strings = [];
|
|
2263
|
+
if (!i || text[i - 1] == " " || loose)
|
|
2264
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
2265
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
2266
|
+
const matched_string = matched_strings[j];
|
|
2267
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
2268
|
+
if (matched_string.length < 2 && !loose) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
2269
|
+
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
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
const last_index_in_output = output.length - 1;
|
|
2273
|
+
if (!found_strings.length) {
|
|
2274
|
+
var _output$last_index_in;
|
|
2275
|
+
const character = text[i];
|
|
2276
|
+
if (((_output$last_index_in = output[last_index_in_output]) === null || _output$last_index_in === void 0 ? void 0 : _output$last_index_in.highlighted_) === false || output.length && /\s/.test(character))
|
|
2277
|
+
// 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
|
|
2278
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
2279
|
+
highlighted_: false,
|
|
2280
|
+
text_: character
|
|
2281
|
+
});
|
|
2282
|
+
} else {
|
|
2283
|
+
var _output$last_index_in2;
|
|
2284
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
2285
|
+
if ((_output$last_index_in2 = output[last_index_in_output]) !== null && _output$last_index_in2 !== void 0 && _output$last_index_in2.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
2286
|
+
highlighted_: true,
|
|
2287
|
+
text_: longest_found_string
|
|
2288
|
+
});
|
|
2289
|
+
i += longest_found_string.length - 1;
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
return output;
|
|
2293
|
+
}
|
|
2294
|
+
const $dc5db6bf7093867a$var$_tmpl$ = ["<span", ' class="', '">', "</span>"],
|
|
2295
|
+
$dc5db6bf7093867a$var$_tmpl$2 = ["<span", ' class="highlighted-part">', "</span>"];
|
|
2296
|
+
function $dc5db6bf7093867a$export$8e79c28529dbfa90(props) {
|
|
2297
|
+
const segmented_text = $3hooq$solidjs.createMemo(() => {
|
|
2298
|
+
const {
|
|
2299
|
+
to_highlight_: to_highlight_,
|
|
2300
|
+
text_: text_
|
|
2301
|
+
} = props;
|
|
2302
|
+
return $99472afa7112c427$export$1b00d74faf266c56(text_, to_highlight_ ? [to_highlight_] : [], true);
|
|
2303
|
+
});
|
|
2304
|
+
const has_highlights = $3hooq$solidjs.createMemo(() => segmented_text().some(segment => segment.highlighted_));
|
|
2305
|
+
return $3hooq$solidjsweb.ssr($dc5db6bf7093867a$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey() + $3hooq$solidjsweb.ssrAttribute("title", $3hooq$solidjsweb.escape(props.text_, true), false), has_highlights() ? "has-match" : "", $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
2306
|
+
get each() {
|
|
2307
|
+
return segmented_text();
|
|
2308
|
+
},
|
|
2309
|
+
children: item => {
|
|
2310
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
2311
|
+
get when() {
|
|
2312
|
+
return item().highlighted_;
|
|
2313
|
+
},
|
|
2314
|
+
get fallback() {
|
|
2315
|
+
return item().text_;
|
|
2316
|
+
},
|
|
2317
|
+
get children() {
|
|
2318
|
+
return $3hooq$solidjsweb.ssr($dc5db6bf7093867a$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(item().text_));
|
|
2319
|
+
}
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
})));
|
|
2323
|
+
}
|
|
2324
|
+
const $9c1d49181fb3002a$var$_tmpl$ = ["<form", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></form>"],
|
|
2325
|
+
$9c1d49181fb3002a$var$_tmpl$2 = ["<div", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
2326
|
+
$9c1d49181fb3002a$var$_tmpl$3 = ["<details", "></details>"],
|
|
2327
|
+
$9c1d49181fb3002a$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="', '">', "</span><!--$-->", "<!--/--></div></summary>"];
|
|
2328
|
+
const $9c1d49181fb3002a$var$max_visible_without_collapsing = 15;
|
|
2329
|
+
const $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed = 4;
|
|
2330
|
+
function $9c1d49181fb3002a$export$a32086fa6616eafd(_ref) {
|
|
2331
|
+
let {
|
|
2332
|
+
filter_: filter_,
|
|
2333
|
+
selected_filters_: selected_filters_,
|
|
2334
|
+
i18n_: i18n_,
|
|
2335
|
+
view_more_button_below_group_: view_more_button_below_group_,
|
|
2336
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2337
|
+
filter_query_: filter_query_
|
|
2338
|
+
} = _ref;
|
|
2339
|
+
let form;
|
|
2340
|
+
const existing_filter = $3hooq$solidjs.createMemo(() => {
|
|
2341
|
+
const {
|
|
2342
|
+
field: field,
|
|
2343
|
+
op: op
|
|
2344
|
+
} = filter_();
|
|
2345
|
+
return selected_filters_[0]().find(_ref2 => {
|
|
2346
|
+
let {
|
|
2347
|
+
field: checking_field,
|
|
2348
|
+
op: checking_op
|
|
2349
|
+
} = _ref2;
|
|
2350
|
+
return checking_field === field && checking_op === op;
|
|
2351
|
+
});
|
|
2352
|
+
});
|
|
2353
|
+
const show_extras = $3hooq$solidjs.createSignal(false);
|
|
2354
|
+
const is_being_searched_ = $3hooq$solidjs.createMemo(() => !!(filter_query_ !== null && filter_query_ !== void 0 && filter_query_())); // If the user is searching in the filter
|
|
2355
|
+
const trigger_sync_ = $9c1d49181fb3002a$var$batching_filter_state_syncer({
|
|
2356
|
+
filter_: filter_,
|
|
2357
|
+
existing_filter_: existing_filter,
|
|
2358
|
+
selected_filters_: selected_filters_,
|
|
2359
|
+
get category_structure_() {
|
|
2360
|
+
return structured_categories();
|
|
2361
|
+
}
|
|
2362
|
+
});
|
|
2363
|
+
const structured_categories = $3hooq$solidjs.createMemo(() => {
|
|
2364
|
+
const execute_when_structure_finished = [];
|
|
2365
|
+
const {
|
|
2366
|
+
values: values,
|
|
2367
|
+
names: names,
|
|
2368
|
+
counts: counts
|
|
2369
|
+
} = filter_().meta;
|
|
2370
|
+
const data_structure = {};
|
|
2371
|
+
for (let i = 0; i < values.length; i++) {
|
|
2372
|
+
const value = values[i];
|
|
2373
|
+
let pointer = data_structure;
|
|
2374
|
+
let parent_ = {};
|
|
2375
|
+
let created_an_object = false;
|
|
2376
|
+
for (let j = 0; j < value.length; j++) {
|
|
2377
|
+
var _pointer;
|
|
2378
|
+
const this_categories_name = value[j];
|
|
2379
|
+
const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
|
|
2380
|
+
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;
|
|
2381
|
+
const created_obj = {
|
|
2382
|
+
name_: names[i],
|
|
2383
|
+
count_: counts === null || counts === void 0 ? void 0 : counts[i],
|
|
2384
|
+
parent_: parent_,
|
|
2385
|
+
is_expanded_: $9c1d49181fb3002a$var$make_expanded_signal({
|
|
2386
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2387
|
+
filter_value_: value_as_string,
|
|
2388
|
+
is_being_searched_: is_being_searched_
|
|
2389
|
+
}),
|
|
2390
|
+
value_: value_as_string,
|
|
2391
|
+
children_: {}
|
|
2392
|
+
};
|
|
2393
|
+
const {
|
|
2394
|
+
signal_: signal_,
|
|
2395
|
+
on_structure_complete_: on_structure_complete_
|
|
2396
|
+
} = $9c1d49181fb3002a$var$create_updating_signal({
|
|
2397
|
+
self_: created_obj,
|
|
2398
|
+
existing_filter_: $3hooq$solidjs.untrack(existing_filter),
|
|
2399
|
+
trigger_sync_: trigger_sync_
|
|
2400
|
+
});
|
|
2401
|
+
execute_when_structure_finished.push(on_structure_complete_);
|
|
2402
|
+
created_obj.is_checked_ = signal_;
|
|
2403
|
+
parent_ = created_obj;
|
|
2404
|
+
created_an_object = true;
|
|
2405
|
+
return created_obj;
|
|
2406
|
+
})());
|
|
2407
|
+
pointer = obj.children_;
|
|
2408
|
+
parent_ = obj;
|
|
2409
|
+
}
|
|
2410
|
+
if (!created_an_object && "value_" in parent_) {
|
|
2411
|
+
// 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
|
|
2412
|
+
// [
|
|
2413
|
+
// ["Öl", "IPA"],
|
|
2414
|
+
// ["Öl", "Pale Ale"],
|
|
2415
|
+
// ["Öl", "Ale"],
|
|
2416
|
+
// ["Öl", "Mörk Lager"],
|
|
2417
|
+
// ["Öl", "Suröl"],
|
|
2418
|
+
// ["Öl", "Veteöl"],
|
|
2419
|
+
// ["Öl", "Stout och Porter"],
|
|
2420
|
+
// ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
|
|
2421
|
+
// ["Öl", "Ljus Lager"],
|
|
2422
|
+
// ];
|
|
2423
|
+
// In this case we want to just correct the name and value of the already created object, which will be in parent_
|
|
2424
|
+
parent_.value_ = value.map(v => v + "");
|
|
2425
|
+
parent_.name_ = names[i];
|
|
2426
|
+
parent_.count_ = counts[i];
|
|
2427
|
+
parent_.is_expanded_ = $9c1d49181fb3002a$var$make_expanded_signal({
|
|
2428
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2429
|
+
filter_value_: parent_.value_,
|
|
2430
|
+
is_being_searched_: is_being_searched_
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
|
|
2435
|
+
$9c1d49181fb3002a$var$expand_until_choice(data_structure);
|
|
2436
|
+
$3hooq$depictaiutilishared.dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
|
|
2437
|
+
return data_structure;
|
|
2438
|
+
});
|
|
2439
|
+
const some_top_level_are_hidden = $3hooq$solidjs.createMemo(() => Object.keys(structured_categories()).length > $9c1d49181fb3002a$var$max_visible_without_collapsing);
|
|
2440
|
+
const {
|
|
2441
|
+
expand: expand,
|
|
2442
|
+
collapse: collapse,
|
|
2443
|
+
ExpandingContainer: ExpandingContainer
|
|
2444
|
+
} = $d6d51b09cb2116a6$export$5bad61ecde080b1f({
|
|
2445
|
+
duration: 200
|
|
2446
|
+
});
|
|
2447
|
+
const expanding_container_els = $3hooq$solidjsweb.createComponent(ExpandingContainer, {
|
|
2448
|
+
get children() {
|
|
2449
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
2450
|
+
get when() {
|
|
2451
|
+
return some_top_level_are_hidden();
|
|
2452
|
+
},
|
|
2453
|
+
get children() {
|
|
2454
|
+
return $9c1d49181fb3002a$var$render_stuff($3hooq$solidjs.createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($9c1d49181fb3002a$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_, filter_query_);
|
|
2455
|
+
}
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
});
|
|
2459
|
+
$3hooq$solidjs.createRenderEffect(() => {
|
|
2460
|
+
view_more_button_below_group_[1](some_top_level_are_hidden() ? $3hooq$solidjsweb.createComponent((0, $b0477e4d832f090e$export$ca21a16d65b3dd8), {
|
|
2461
|
+
show_extras_: show_extras,
|
|
2462
|
+
i18n_: i18n_
|
|
2463
|
+
}) : []);
|
|
2464
|
+
});
|
|
2465
|
+
$3hooq$solidjs.createEffect($3hooq$depictaiutilishared.catchify(async () => {
|
|
2466
|
+
if (!some_top_level_are_hidden()) {
|
|
2467
|
+
await collapse();
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
if (show_extras[0]()) await expand();else await collapse();
|
|
2471
|
+
}));
|
|
2472
|
+
return $3hooq$solidjsweb.ssr($9c1d49181fb3002a$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "checkboxes hierarchical ".concat(Object.values(structured_categories()).some(category => Object.keys(category.children_).length) ? "any-expandable" : ""), $3hooq$solidjsweb.escape($9c1d49181fb3002a$var$render_stuff($3hooq$solidjs.createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_, filter_query_)), $3hooq$solidjsweb.escape(expanding_container_els));
|
|
2473
|
+
}
|
|
2474
|
+
function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_, filter_query_) {
|
|
2475
|
+
const keys = $3hooq$solidjs.createMemo(() => Object.keys(data()));
|
|
2476
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.For), {
|
|
2477
|
+
get each() {
|
|
2478
|
+
return keys();
|
|
2479
|
+
},
|
|
2144
2480
|
children: key => $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
2145
2481
|
get when() {
|
|
2146
2482
|
return $3hooq$solidjs.createMemo(() => !!data()[key])();
|
|
@@ -2153,14 +2489,27 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
2153
2489
|
var _value;
|
|
2154
2490
|
return !!Object.keys(((_value = value()) === null || _value === void 0 ? void 0 : _value.children_) || {}).length;
|
|
2155
2491
|
});
|
|
2492
|
+
const value_as_string = $3hooq$solidjs.createMemo(() => {
|
|
2493
|
+
var _value2;
|
|
2494
|
+
return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
|
|
2495
|
+
});
|
|
2496
|
+
const label_text = $3hooq$solidjs.createMemo(() => {
|
|
2497
|
+
var _value3;
|
|
2498
|
+
return ((_value3 = value()) === null || _value3 === void 0 ? void 0 : _value3.name_) || value_as_string();
|
|
2499
|
+
});
|
|
2156
2500
|
return $3hooq$solidjsweb.ssr($9c1d49181fb3002a$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), "checkbox-details ".concat(has_expandable() ? "expandable" : ""), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
|
|
2157
2501
|
get value_() {
|
|
2158
|
-
|
|
2159
|
-
return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
|
|
2502
|
+
return value_as_string();
|
|
2160
2503
|
},
|
|
2161
2504
|
get label_() {
|
|
2162
|
-
|
|
2163
|
-
|
|
2505
|
+
return $3hooq$solidjsweb.createComponent((0, $dc5db6bf7093867a$export$8e79c28529dbfa90), {
|
|
2506
|
+
get text_() {
|
|
2507
|
+
return label_text();
|
|
2508
|
+
},
|
|
2509
|
+
get to_highlight_() {
|
|
2510
|
+
return filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_();
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2164
2513
|
},
|
|
2165
2514
|
get count_() {
|
|
2166
2515
|
var _value4;
|
|
@@ -2244,7 +2593,7 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
2244
2593
|
return $9c1d49181fb3002a$var$render_stuff($3hooq$solidjs.createMemo(() => {
|
|
2245
2594
|
var _value13;
|
|
2246
2595
|
return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
|
|
2247
|
-
}), existing_filter, i18n_);
|
|
2596
|
+
}), existing_filter, i18n_, filter_query_);
|
|
2248
2597
|
}
|
|
2249
2598
|
});
|
|
2250
2599
|
})();
|
|
@@ -2359,7 +2708,8 @@ function $9c1d49181fb3002a$var$make_expanded_signal(_ref5) {
|
|
|
2359
2708
|
var _untrack$untrack;
|
|
2360
2709
|
let {
|
|
2361
2710
|
expanded_hierarchical_filters_: [read_expanded_hierarchical_filters, write_expanded_hierarchical_filters],
|
|
2362
|
-
filter_value_: filter_value_
|
|
2711
|
+
filter_value_: filter_value_,
|
|
2712
|
+
is_being_searched_: is_being_searched_
|
|
2363
2713
|
} = _ref5;
|
|
2364
2714
|
const index_in_expanded_filters = $3hooq$solidjs.createMemo(() => read_expanded_hierarchical_filters().findIndex(_ref6 => {
|
|
2365
2715
|
let {
|
|
@@ -2402,9 +2752,11 @@ function $9c1d49181fb3002a$var$make_expanded_signal(_ref5) {
|
|
|
2402
2752
|
defer: true
|
|
2403
2753
|
}));
|
|
2404
2754
|
return {
|
|
2405
|
-
ui_should_show_expanded_: $3hooq$solidjs.createMemo(
|
|
2755
|
+
ui_should_show_expanded_: $3hooq$solidjs.createMemo(
|
|
2756
|
+
// When user is searching through filters, expand everything they haven't collapsed, so they can see the results
|
|
2757
|
+
() => {
|
|
2406
2758
|
var _user_choice_signal$;
|
|
2407
|
-
return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : get_low_precedence_expanded();
|
|
2759
|
+
return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : is_being_searched_() || get_low_precedence_expanded();
|
|
2408
2760
|
}),
|
|
2409
2761
|
set_low_precedence_expanded_: set_low_precedence_expanded,
|
|
2410
2762
|
set_user_expanded_: set_user_choice_expanded
|
|
@@ -2434,7 +2786,9 @@ const $cd0e5524f9476f9b$var$max_columns = 3;
|
|
|
2434
2786
|
const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
2435
2787
|
let {
|
|
2436
2788
|
filter_: filter_,
|
|
2437
|
-
selected_filters_: [get_selected_filters, set_selected_filters]
|
|
2789
|
+
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
2790
|
+
filter_query_: filter_query_,
|
|
2791
|
+
details_element_width_: details_element_width_
|
|
2438
2792
|
} = _ref;
|
|
2439
2793
|
const existing_filter = $3hooq$solidjs.createMemo(() => {
|
|
2440
2794
|
const {
|
|
@@ -2468,7 +2822,7 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
|
2468
2822
|
const container_width_accessor = $3hooq$solidjs.createMemo(() => {
|
|
2469
2823
|
const element = container();
|
|
2470
2824
|
if (!element) return;
|
|
2471
|
-
return $
|
|
2825
|
+
return $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(element);
|
|
2472
2826
|
});
|
|
2473
2827
|
const [shadow_children, set_shadow_children] = $3hooq$solidjs.createSignal(new Set(), {
|
|
2474
2828
|
equals: false
|
|
@@ -2476,11 +2830,11 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
|
2476
2830
|
const shadow_grid = $3hooq$solidjsweb.ssr($cd0e5524f9476f9b$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape([...shadow_children()])); // for getting the smallest possible sizes of all the items
|
|
2477
2831
|
$3hooq$solidjs.createEffect(() => {
|
|
2478
2832
|
var _container_width_acce;
|
|
2479
|
-
const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
|
|
2480
|
-
if (container_width
|
|
2833
|
+
const container_width = ((_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce()) || details_element_width_();
|
|
2834
|
+
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
|
|
2481
2835
|
$cd0e5524f9476f9b$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
|
|
2482
2836
|
});
|
|
2483
|
-
return [
|
|
2837
|
+
return [$3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
|
|
2484
2838
|
get cols_at_size() {
|
|
2485
2839
|
return cols_at_size();
|
|
2486
2840
|
},
|
|
@@ -2503,27 +2857,33 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
|
2503
2857
|
const current_value = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
|
|
2504
2858
|
return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === current_value));
|
|
2505
2859
|
});
|
|
2506
|
-
const MakeButton = attributes =>
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2860
|
+
const MakeButton = attributes => {
|
|
2861
|
+
const label = $3hooq$solidjs.createMemo(() => value().name_ || value().value_ + "");
|
|
2862
|
+
return $3hooq$solidjsweb.ssrElement("button", $3hooq$solidjsweb.mergeProps(attributes, {
|
|
2863
|
+
get disabled() {
|
|
2864
|
+
return value().count_ === 0 && !is_selected();
|
|
2865
|
+
},
|
|
2866
|
+
get classList() {
|
|
2867
|
+
return {
|
|
2868
|
+
minor: !is_selected(),
|
|
2869
|
+
major: is_selected(),
|
|
2870
|
+
"major-minor-transition": true
|
|
2871
|
+
};
|
|
2872
|
+
}
|
|
2873
|
+
}), () => ["<!--$-->", $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
|
|
2874
|
+
whole_text_to_display_: label,
|
|
2875
|
+
searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
|
|
2876
|
+
})), "<!--/-->", "<!--$-->", $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
2877
|
+
get when() {
|
|
2878
|
+
return value().count_ != undefined;
|
|
2879
|
+
},
|
|
2880
|
+
get children() {
|
|
2881
|
+
return $3hooq$solidjsweb.ssr($cd0e5524f9476f9b$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(value().count_));
|
|
2882
|
+
}
|
|
2883
|
+
})), "<!--/-->"], true);
|
|
2884
|
+
};
|
|
2525
2885
|
const invisible_size_button = $3hooq$solidjsweb.createComponent(MakeButton, {});
|
|
2526
|
-
const smallest_possible_size = $
|
|
2886
|
+
const smallest_possible_size = $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
2527
2887
|
const sizes_value = $3hooq$solidjs.untrack(sizes_set);
|
|
2528
2888
|
const shadow_children_value = $3hooq$solidjs.untrack(shadow_children);
|
|
2529
2889
|
sizes_value.add(smallest_possible_size);
|
|
@@ -2543,7 +2903,7 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
|
2543
2903
|
}
|
|
2544
2904
|
});
|
|
2545
2905
|
}
|
|
2546
|
-
})];
|
|
2906
|
+
}), shadow_grid];
|
|
2547
2907
|
};
|
|
2548
2908
|
/**
|
|
2549
2909
|
* Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
|
|
@@ -2611,7 +2971,8 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
|
|
|
2611
2971
|
filter_: filter_,
|
|
2612
2972
|
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
2613
2973
|
i18n_: i18n_,
|
|
2614
|
-
view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
|
|
2974
|
+
view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_],
|
|
2975
|
+
filter_query_: filter_query_
|
|
2615
2976
|
} = _ref;
|
|
2616
2977
|
// same as in CheckboxFilter, maybe we should make this DRY at some point
|
|
2617
2978
|
const existing_filter = $3hooq$solidjs.createMemo(() => {
|
|
@@ -2656,12 +3017,17 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
|
|
|
2656
3017
|
const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
|
|
2657
3018
|
return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
|
|
2658
3019
|
});
|
|
3020
|
+
const value = $3hooq$solidjs.createMemo(() => checkbox().value_);
|
|
3021
|
+
const label_text = $3hooq$solidjs.createMemo(() => checkbox().name_ || value() + "");
|
|
2659
3022
|
const input_row = $3hooq$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
|
|
2660
3023
|
get value_() {
|
|
2661
|
-
return
|
|
3024
|
+
return value();
|
|
2662
3025
|
},
|
|
2663
3026
|
get label_() {
|
|
2664
|
-
return
|
|
3027
|
+
return $3hooq$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
|
|
3028
|
+
whole_text_to_display_: label_text,
|
|
3029
|
+
searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
|
|
3030
|
+
});
|
|
2665
3031
|
},
|
|
2666
3032
|
get count_() {
|
|
2667
3033
|
return checkbox().count_;
|
|
@@ -2919,10 +3285,152 @@ function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
|
|
|
2919
3285
|
}
|
|
2920
3286
|
});
|
|
2921
3287
|
}
|
|
3288
|
+
const $5b88b077e48a4451$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>';
|
|
3289
|
+
function $5b88b077e48a4451$export$82eafebb825fc23f() {
|
|
3290
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3291
|
+
return $3hooq$solidjsweb.ssrElement("svg", $3hooq$solidjsweb.mergeProps({
|
|
3292
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3293
|
+
width: "20",
|
|
3294
|
+
height: "22",
|
|
3295
|
+
viewBox: "0 0 20 22"
|
|
3296
|
+
}, props), () => $3hooq$solidjsweb.ssr($5b88b077e48a4451$var$_tmpl$), true);
|
|
3297
|
+
}
|
|
3298
|
+
const $8e7ac26c00243687$var$_tmpl$ = ["<div", ' class="search-in-filters"><input type="text" class="query"', "><!--$-->", '<!--/--><button style="', '" class="clear">', "</button></div>"];
|
|
3299
|
+
const $8e7ac26c00243687$var$min_items_to_enable_filter_searching = 10; // For checkbox hierarchical we 2x this
|
|
3300
|
+
function $8e7ac26c00243687$export$4b2c5292ffe0c5dd(filter_array_, section, i18n_) {
|
|
3301
|
+
const [filter_query_, set_filter_query_] = $3hooq$solidjs.createSignal();
|
|
3302
|
+
// Check if we have enough items to enable searching
|
|
3303
|
+
const enable_searchability = $3hooq$solidjs.createMemo(() => {
|
|
3304
|
+
let count = 0;
|
|
3305
|
+
for (const filter of filter_array_()) {
|
|
3306
|
+
var _filter$meta;
|
|
3307
|
+
const type = (_filter$meta = filter.meta) === null || _filter$meta === void 0 ? void 0 : _filter$meta.type;
|
|
3308
|
+
if (type === "range") continue;
|
|
3309
|
+
const length = filter.meta.values.length;
|
|
3310
|
+
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
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
return count >= $8e7ac26c00243687$var$min_items_to_enable_filter_searching;
|
|
3314
|
+
});
|
|
3315
|
+
const SearchThisFilterGroup_ = () => {
|
|
3316
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
3317
|
+
get when() {
|
|
3318
|
+
return enable_searchability();
|
|
3319
|
+
},
|
|
3320
|
+
get children() {
|
|
3321
|
+
return $3hooq$solidjsweb.ssr($8e7ac26c00243687$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrAttribute("value", $3hooq$solidjsweb.escape(filter_query_(), true) || "", false) + $3hooq$solidjsweb.ssrAttribute("placeholder", $3hooq$solidjsweb.escape(i18n_.search_a_filter_()(section), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $5b88b077e48a4451$export$82eafebb825fc23f), {
|
|
3322
|
+
width: "16",
|
|
3323
|
+
height: "17.6",
|
|
3324
|
+
"class": "search-icon"
|
|
3325
|
+
})), "display:" + (filter_query_() ? "" : "none"), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {
|
|
3326
|
+
width: "12",
|
|
3327
|
+
height: "12"
|
|
3328
|
+
})));
|
|
3329
|
+
}
|
|
3330
|
+
});
|
|
3331
|
+
};
|
|
3332
|
+
const searched_filter_array_ = $3hooq$solidjs.createMemo(() => {
|
|
3333
|
+
const query = filter_query_();
|
|
3334
|
+
if (!enable_searchability() || !query) return filter_array_();
|
|
3335
|
+
const lowercase_query = query.toLowerCase();
|
|
3336
|
+
const check_string_match = to_check => {
|
|
3337
|
+
to_check = to_check.toLowerCase();
|
|
3338
|
+
return to_check.includes(lowercase_query) || lowercase_query.includes(to_check);
|
|
3339
|
+
};
|
|
3340
|
+
return filter_array_().map(filter => {
|
|
3341
|
+
var _filter$meta2, _meta$names;
|
|
3342
|
+
const type = (_filter$meta2 = filter.meta) === null || _filter$meta2 === void 0 ? void 0 : _filter$meta2.type;
|
|
3343
|
+
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
|
|
3344
|
+
const meta = filter.meta;
|
|
3345
|
+
const {
|
|
3346
|
+
values: values,
|
|
3347
|
+
names: names,
|
|
3348
|
+
counts: counts
|
|
3349
|
+
} = meta;
|
|
3350
|
+
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
|
|
3351
|
+
const is_hierarchical_checkbox = type === "checkbox-hierarchical";
|
|
3352
|
+
// Which index of counts, values and names should be kept
|
|
3353
|
+
const filtered_indexes = values.map((item, index) => {
|
|
3354
|
+
const item_from_names = names === null || names === void 0 ? void 0 : names[index];
|
|
3355
|
+
if (item_from_names && !is_hierarchical_checkbox)
|
|
3356
|
+
// 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
|
|
3357
|
+
item = item_from_names;
|
|
3358
|
+
if (typeof item === "number") return true;
|
|
3359
|
+
if (is_hierarchical_checkbox && names)
|
|
3360
|
+
// Special case for hierarchical checkboxes where we need to check if any of the names in the path match the query
|
|
3361
|
+
item = item.map((_, index) => names[$8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("findIndex", values, item.slice(0, index + 1))]);
|
|
3362
|
+
if (Array.isArray(item)) return item.some(item => check_string_match(item + "")); // If any of the items in the array match, keep it
|
|
3363
|
+
return check_string_match(item);
|
|
3364
|
+
});
|
|
3365
|
+
const new_values = values.filter((_, i) => filtered_indexes[i]);
|
|
3366
|
+
if (!new_values.length) return false; // false = please delete this filter, see below
|
|
3367
|
+
const new_filter_object = {
|
|
3368
|
+
...filter,
|
|
3369
|
+
meta: {
|
|
3370
|
+
...meta,
|
|
3371
|
+
counts: counts === null || counts === void 0 ? void 0 : counts.filter((_, i) => filtered_indexes[i]),
|
|
3372
|
+
...(names ? {
|
|
3373
|
+
names: (_meta$names = meta.names) === null || _meta$names === void 0 ? void 0 : _meta$names.filter((_, i) => filtered_indexes[i])
|
|
3374
|
+
} : {}),
|
|
3375
|
+
values: new_values
|
|
3376
|
+
}
|
|
3377
|
+
};
|
|
3378
|
+
if (is_hierarchical_checkbox) {
|
|
3379
|
+
// For hierarchical checkbox we need to fill the holes created by filtering, for example if there is
|
|
3380
|
+
// ["Clothes"]
|
|
3381
|
+
// ["Clothes", "Blazers"]
|
|
3382
|
+
// And the user searched for "blazers" we need to add back ["Clothes"] so CheckboxHierarchicalFilter doesn't get confused
|
|
3383
|
+
// 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
|
|
3384
|
+
// So we do it here instead
|
|
3385
|
+
const new_meta = new_filter_object.meta;
|
|
3386
|
+
const new_values = new_meta.values;
|
|
3387
|
+
for (const value of new_values) {
|
|
3388
|
+
if (!Array.isArray(value)) continue; // Shouldn't happen
|
|
3389
|
+
if (value.length < 2) continue; // No parent
|
|
3390
|
+
const parent = value.slice(0, -1);
|
|
3391
|
+
// Check if parent exists
|
|
3392
|
+
if ($8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("some", new_values, parent)) continue; // Parent exists
|
|
3393
|
+
// Otherwise, put it back
|
|
3394
|
+
const index_to_restore = $8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("findIndex", values, parent);
|
|
3395
|
+
if (index_to_restore < 0) {
|
|
3396
|
+
$3hooq$depictaiutilishared.dwarn("Can't restore", parent, "to", new_values);
|
|
3397
|
+
continue;
|
|
3398
|
+
}
|
|
3399
|
+
const current_index_of_us = new_values.findIndex(item => item === value);
|
|
3400
|
+
new_values.splice(current_index_of_us, 0, values[index_to_restore]);
|
|
3401
|
+
const count_to_restore = counts === null || counts === void 0 ? void 0 : counts[index_to_restore];
|
|
3402
|
+
if (count_to_restore) {
|
|
3403
|
+
var _new_meta$counts;
|
|
3404
|
+
(_new_meta$counts = new_meta.counts) === null || _new_meta$counts === void 0 || _new_meta$counts.splice(current_index_of_us, 0, count_to_restore);
|
|
3405
|
+
}
|
|
3406
|
+
const name_to_restore = names === null || names === void 0 ? void 0 : names[index_to_restore];
|
|
3407
|
+
if (name_to_restore) {
|
|
3408
|
+
var _new_meta$names;
|
|
3409
|
+
(_new_meta$names = new_meta.names) === null || _new_meta$names === void 0 || _new_meta$names.splice(current_index_of_us, 0, name_to_restore);
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
return new_filter_object;
|
|
3414
|
+
}).filter(filter => filter); // Delete filters that don't have a value anymore
|
|
3415
|
+
});
|
|
3416
|
+
|
|
3417
|
+
return {
|
|
3418
|
+
SearchThisFilterGroup_: SearchThisFilterGroup_,
|
|
3419
|
+
searched_filter_array_: searched_filter_array_,
|
|
3420
|
+
filter_query_: filter_query_
|
|
3421
|
+
};
|
|
3422
|
+
}
|
|
3423
|
+
/**
|
|
3424
|
+
* Finds/whatevers what's effectively one hierarchical filter item in an array of hierarchical filter items
|
|
3425
|
+
* Functions similar to this happen loads in create_modified_filters, but they have additional checks so not touching them RN
|
|
3426
|
+
*/
|
|
3427
|
+
function $8e7ac26c00243687$var$find_str_arr_in_str_arr_arr(operation, haystack, needle) {
|
|
3428
|
+
return haystack[operation](value => value.length === needle.length && value.every((item, index) => item === needle[index]));
|
|
3429
|
+
}
|
|
2922
3430
|
const $164d474fea221d77$var$_tmpl$ = ["<div", ' class="filter-collapsible">', "</div>"],
|
|
2923
3431
|
$164d474fea221d77$var$_tmpl$2 = ["<button", ' class="clear-group"><!--$-->', "<!--/--><span>", "</span></button>"],
|
|
2924
3432
|
$164d474fea221d77$var$_tmpl$3 = ["<div", ' class="view-more-clear"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
2925
|
-
$164d474fea221d77$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><div class="filter-part"
|
|
3433
|
+
$164d474fea221d77$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><div class="filter-part"><!--$-->', "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--></div>"],
|
|
2926
3434
|
$164d474fea221d77$var$_tmpl$5 = ["<details", ' class="filter-collapsible"', "></details>"],
|
|
2927
3435
|
$164d474fea221d77$var$_tmpl$6 = ["<summary", ' class="filter-group-summary"><div class="summary"><span>', '</span><div class="selected-w-sign"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div></summary>"],
|
|
2928
3436
|
$164d474fea221d77$var$_tmpl$7 = ["<div", ' class="ungrouped">', "</div>"],
|
|
@@ -2979,6 +3487,11 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
|
|
|
2979
3487
|
const filter_array_ = $3hooq$solidjs.createMemo(() => {
|
|
2980
3488
|
return Object.values(togglable_filters_grouped_by_collapsible())[get_section_index()];
|
|
2981
3489
|
});
|
|
3490
|
+
const {
|
|
3491
|
+
SearchThisFilterGroup_: SearchThisFilterGroup_,
|
|
3492
|
+
searched_filter_array_: searched_filter_array_,
|
|
3493
|
+
filter_query_: filter_query_
|
|
3494
|
+
} = $8e7ac26c00243687$export$4b2c5292ffe0c5dd(filter_array_, section_, props.i18n_);
|
|
2982
3495
|
const is_open = $4c1dcf1a9c604a68$export$ab34afce88557c0e({
|
|
2983
3496
|
get expanded_filters_() {
|
|
2984
3497
|
return props.expanded_filters_;
|
|
@@ -2994,6 +3507,11 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
|
|
|
2994
3507
|
return selected_filter;
|
|
2995
3508
|
})));
|
|
2996
3509
|
const a_filter_is_selected = $3hooq$solidjs.createMemo(() => selected_filters_in_group().size);
|
|
3510
|
+
const [get_details_width, set_get_details_width] = $3hooq$solidjs.createSignal();
|
|
3511
|
+
const details_element_width_ = $3hooq$solidjs.createMemo(() => {
|
|
3512
|
+
var _get_details_width;
|
|
3513
|
+
return get_details_width === null || get_details_width === void 0 ? void 0 : (_get_details_width = get_details_width()) === null || _get_details_width === void 0 ? void 0 : _get_details_width();
|
|
3514
|
+
});
|
|
2997
3515
|
return $3hooq$solidjsweb.createComponent((0, $4cfe8400ed3f92c4$export$6c6d7a51fa9aa15d), {
|
|
2998
3516
|
is_open_: is_open,
|
|
2999
3517
|
get details_() {
|
|
@@ -3022,9 +3540,9 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
|
|
|
3022
3540
|
})));
|
|
3023
3541
|
},
|
|
3024
3542
|
get children() {
|
|
3025
|
-
return $3hooq$solidjsweb.ssr($164d474fea221d77$var$_tmpl$4, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
3543
|
+
return $3hooq$solidjsweb.ssr($164d474fea221d77$var$_tmpl$4, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent(SearchThisFilterGroup_, {})), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
3026
3544
|
get each() {
|
|
3027
|
-
return
|
|
3545
|
+
return searched_filter_array_();
|
|
3028
3546
|
},
|
|
3029
3547
|
children: filter => $3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
|
|
3030
3548
|
severity_: "error",
|
|
@@ -3047,7 +3565,9 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
|
|
|
3047
3565
|
get i18n_() {
|
|
3048
3566
|
return props.i18n_;
|
|
3049
3567
|
},
|
|
3050
|
-
view_more_button_below_group_: view_more_button_below_group
|
|
3568
|
+
view_more_button_below_group_: view_more_button_below_group,
|
|
3569
|
+
filter_query_: filter_query_,
|
|
3570
|
+
details_element_width_: details_element_width_
|
|
3051
3571
|
});
|
|
3052
3572
|
}
|
|
3053
3573
|
})
|
|
@@ -7196,15 +7716,6 @@ const $dd98275d380b2cfd$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/sv
|
|
|
7196
7716
|
function $dd98275d380b2cfd$export$1c641004b5485fed() {
|
|
7197
7717
|
return $3hooq$solidjsweb.ssr($dd98275d380b2cfd$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey());
|
|
7198
7718
|
}
|
|
7199
|
-
const $5b88b077e48a4451$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>';
|
|
7200
|
-
function $5b88b077e48a4451$export$82eafebb825fc23f() {
|
|
7201
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7202
|
-
return $3hooq$solidjsweb.ssrElement("svg", $3hooq$solidjsweb.mergeProps(props, {
|
|
7203
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7204
|
-
width: "20",
|
|
7205
|
-
height: "22"
|
|
7206
|
-
}), () => $3hooq$solidjsweb.ssr($5b88b077e48a4451$var$_tmpl$), true);
|
|
7207
|
-
}
|
|
7208
7719
|
const $29e5dbeb69da7a36$var$_tmpl$ = ["<button", ' class="back" type="button"', ">", "</button>"],
|
|
7209
7720
|
$29e5dbeb69da7a36$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>"];
|
|
7210
7721
|
function $29e5dbeb69da7a36$export$b94867ecbd698f21(_ref) {
|
|
@@ -7696,78 +8207,24 @@ function $4edbc04f5c5a1843$export$a146ac6fa8346a25(_ref) {
|
|
|
7696
8207
|
return has_entries();
|
|
7697
8208
|
},
|
|
7698
8209
|
get children() {
|
|
7699
|
-
return $3hooq$solidjsweb.ssr($4edbc04f5c5a1843$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(text_()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
7700
|
-
get each() {
|
|
7701
|
-
return previous_searches_();
|
|
7702
|
-
},
|
|
7703
|
-
children: (item, index) => {
|
|
7704
|
-
const href = $77fe1b91e837c071$export$91c3b6774e8be0f5({
|
|
7705
|
-
param_: search_query_param_name_,
|
|
7706
|
-
value_: item,
|
|
7707
|
-
url_transformer_: url_transformer_
|
|
7708
|
-
});
|
|
7709
|
-
return $3hooq$solidjsweb.ssr($4edbc04f5c5a1843$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), "".concat("item", " ").concat($3hooq$solidjs.createMemo(() => {
|
|
7710
|
-
var _read_selected_index_, _read_selected_index_2;
|
|
7711
|
-
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === 0 && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
7712
|
-
})() ? "selected" : ""), $3hooq$solidjsweb.ssrAttribute("href", $3hooq$solidjsweb.escape(href(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $8767e7eba5066d2b$export$5d2caaa6b530761c), {})), $3hooq$solidjsweb.ssrAttribute("title", $3hooq$solidjsweb.escape(item(), true), false), $3hooq$solidjsweb.escape(item()), $3hooq$solidjsweb.ssrAttribute("title", $3hooq$solidjsweb.escape(i18n_.previous_searches_delete_entry_from_history_(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {})));
|
|
7713
|
-
}
|
|
7714
|
-
})));
|
|
7715
|
-
}
|
|
7716
|
-
});
|
|
7717
|
-
}
|
|
7718
|
-
const $23c3f390dee33ff8$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
7719
|
-
$23c3f390dee33ff8$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
7720
|
-
function $23c3f390dee33ff8$export$ba17c5b7e6dda39f(_ref) {
|
|
7721
|
-
let {
|
|
7722
|
-
whole_text_to_display_: whole_text_to_display_memo,
|
|
7723
|
-
searching_for_value_: searching_for_value_memo,
|
|
7724
|
-
class_: class_
|
|
7725
|
-
} = _ref;
|
|
7726
|
-
const [get_has_highlighted, set_has_highlighted] = $3hooq$solidjs.createSignal(false);
|
|
7727
|
-
const text_itself = $3hooq$solidjs.createMemo(() => $3hooq$solidjs.batch(() => {
|
|
7728
|
-
set_has_highlighted(false);
|
|
7729
|
-
const searching_for_value = searching_for_value_memo();
|
|
7730
|
-
const whole_text_to_display_ = whole_text_to_display_memo();
|
|
7731
|
-
let for_black = "";
|
|
7732
|
-
let pushed_grey = false;
|
|
7733
|
-
const search_q = searching_for_value;
|
|
7734
|
-
if (!search_q) return whole_text_to_display_;
|
|
7735
|
-
const output = [];
|
|
7736
|
-
const searching_for = search_q.toLowerCase();
|
|
7737
|
-
const push_black = () => {
|
|
7738
|
-
if (for_black) {
|
|
7739
|
-
set_has_highlighted(true);
|
|
7740
|
-
output.push($3hooq$solidjsweb.ssr($23c3f390dee33ff8$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(for_black))); // "black"
|
|
7741
|
-
for_black = "";
|
|
7742
|
-
}
|
|
7743
|
-
};
|
|
7744
|
-
for (let i = 0; i < whole_text_to_display_.length;) {
|
|
7745
|
-
let is_whole_word = true;
|
|
7746
|
-
let searching_for_but_with_texts_casing = "";
|
|
7747
|
-
const i_at_start = i;
|
|
7748
|
-
for (let j = 0; j < searching_for.length; i++, j++) {
|
|
7749
|
-
const letter_in_suggestion = whole_text_to_display_[i];
|
|
7750
|
-
if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
|
|
7751
|
-
is_whole_word = false;
|
|
7752
|
-
i = i_at_start;
|
|
7753
|
-
break;
|
|
8210
|
+
return $3hooq$solidjsweb.ssr($4edbc04f5c5a1843$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(text_()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
8211
|
+
get each() {
|
|
8212
|
+
return previous_searches_();
|
|
8213
|
+
},
|
|
8214
|
+
children: (item, index) => {
|
|
8215
|
+
const href = $77fe1b91e837c071$export$91c3b6774e8be0f5({
|
|
8216
|
+
param_: search_query_param_name_,
|
|
8217
|
+
value_: item,
|
|
8218
|
+
url_transformer_: url_transformer_
|
|
8219
|
+
});
|
|
8220
|
+
return $3hooq$solidjsweb.ssr($4edbc04f5c5a1843$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), "".concat("item", " ").concat($3hooq$solidjs.createMemo(() => {
|
|
8221
|
+
var _read_selected_index_, _read_selected_index_2;
|
|
8222
|
+
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === 0 && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
8223
|
+
})() ? "selected" : ""), $3hooq$solidjsweb.ssrAttribute("href", $3hooq$solidjsweb.escape(href(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $8767e7eba5066d2b$export$5d2caaa6b530761c), {})), $3hooq$solidjsweb.ssrAttribute("title", $3hooq$solidjsweb.escape(item(), true), false), $3hooq$solidjsweb.escape(item()), $3hooq$solidjsweb.ssrAttribute("title", $3hooq$solidjsweb.escape(i18n_.previous_searches_delete_entry_from_history_(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {})));
|
|
7754
8224
|
}
|
|
7755
|
-
|
|
7756
|
-
}
|
|
7757
|
-
if (is_whole_word) {
|
|
7758
|
-
push_black();
|
|
7759
|
-
output.push(searching_for_but_with_texts_casing);
|
|
7760
|
-
pushed_grey = true;
|
|
7761
|
-
} else for_black += whole_text_to_display_[i++];
|
|
7762
|
-
}
|
|
7763
|
-
push_black();
|
|
7764
|
-
if (!pushed_grey) {
|
|
7765
|
-
set_has_highlighted(false);
|
|
7766
|
-
return whole_text_to_display_;
|
|
8225
|
+
})));
|
|
7767
8226
|
}
|
|
7768
|
-
|
|
7769
|
-
}));
|
|
7770
|
-
return $3hooq$solidjsweb.ssr($23c3f390dee33ff8$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), "".concat($3hooq$solidjsweb.escape(class_, true) || "", " ").concat(get_has_highlighted() ? "has-history-match" : ""), $3hooq$solidjsweb.ssrAttribute("title", $3hooq$solidjsweb.escape(whole_text_to_display_memo(), true), false), $3hooq$solidjsweb.escape(text_itself()));
|
|
8227
|
+
});
|
|
7771
8228
|
}
|
|
7772
8229
|
const $3cf7b4db1e203c93$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>';
|
|
7773
8230
|
function $3cf7b4db1e203c93$export$605674723bcc715c() {
|
|
@@ -7811,8 +8268,8 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
7811
8268
|
} = _ref2;
|
|
7812
8269
|
return type === (0, $ce079d50d380ee11$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title);
|
|
7813
8270
|
} // don't show the ones we already show from the history
|
|
7814
|
-
)
|
|
7815
|
-
|
|
8271
|
+
) // + limit to three query suggestions, API sends more sometimes
|
|
8272
|
+
.slice(0, 3));
|
|
7816
8273
|
const not_queries_memo = $3hooq$solidjs.createMemo(() => {
|
|
7817
8274
|
// For the section that shows categories and content results
|
|
7818
8275
|
// We want to limit to 3 items, and we want to show the categories first
|
|
@@ -8653,236 +9110,6 @@ function $996102a9349df6d7$export$41b4894022a3580f() {
|
|
|
8653
9110
|
})));
|
|
8654
9111
|
return style_props_;
|
|
8655
9112
|
}
|
|
8656
|
-
const $99472afa7112c427$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
8657
|
-
const $99472afa7112c427$var$dont_cut_in_between_less_than_characters = 30;
|
|
8658
|
-
function $99472afa7112c427$export$e1a98a189fd2c0e7(_ref) {
|
|
8659
|
-
let {
|
|
8660
|
-
content_result_: content_result_,
|
|
8661
|
-
key_: key_,
|
|
8662
|
-
cut_when_possible_: cut_when_possible_
|
|
8663
|
-
} = _ref;
|
|
8664
|
-
const matched_tokens = $3hooq$solidjs.createMemo(() => {
|
|
8665
|
-
var _content_result_$high, _content_result_$high2;
|
|
8666
|
-
return (_content_result_$high = content_result_().highlights) === null || _content_result_$high === void 0 ? void 0 : (_content_result_$high2 = _content_result_$high.find(highlight => highlight.field == key_)) === null || _content_result_$high2 === void 0 ? void 0 : _content_result_$high2.matched_tokens;
|
|
8667
|
-
});
|
|
8668
|
-
const full_value = $3hooq$solidjs.createMemo(() => {
|
|
8669
|
-
var _content_result_$key_;
|
|
8670
|
-
return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
|
|
8671
|
-
});
|
|
8672
|
-
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
8673
|
-
get when() {
|
|
8674
|
-
var _matched_tokens;
|
|
8675
|
-
return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
|
|
8676
|
-
},
|
|
8677
|
-
get fallback() {
|
|
8678
|
-
return full_value();
|
|
8679
|
-
},
|
|
8680
|
-
get children() {
|
|
8681
|
-
return (() => {
|
|
8682
|
-
const segmented_cut_text = $3hooq$solidjs.createMemo(() => {
|
|
8683
|
-
const segmented_text = $99472afa7112c427$var$segment_text(full_value(), matched_tokens());
|
|
8684
|
-
if (cut_when_possible_) $99472afa7112c427$var$cut_text(segmented_text);
|
|
8685
|
-
return segmented_text;
|
|
8686
|
-
});
|
|
8687
|
-
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
8688
|
-
get each() {
|
|
8689
|
-
return segmented_cut_text();
|
|
8690
|
-
},
|
|
8691
|
-
children: item => {
|
|
8692
|
-
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
8693
|
-
get when() {
|
|
8694
|
-
return item().highlighted_;
|
|
8695
|
-
},
|
|
8696
|
-
get fallback() {
|
|
8697
|
-
return item().text_;
|
|
8698
|
-
},
|
|
8699
|
-
get children() {
|
|
8700
|
-
return $3hooq$solidjsweb.ssr($99472afa7112c427$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(item().text_));
|
|
8701
|
-
}
|
|
8702
|
-
});
|
|
8703
|
-
}
|
|
8704
|
-
});
|
|
8705
|
-
})();
|
|
8706
|
-
}
|
|
8707
|
-
});
|
|
8708
|
-
}
|
|
8709
|
-
function $99472afa7112c427$var$cut_text(segmented_text) {
|
|
8710
|
-
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
8711
|
-
const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
|
|
8712
|
-
if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
|
|
8713
|
-
// We have one or more highlighted segments
|
|
8714
|
-
if (highlighted_segments.length === 1) {
|
|
8715
|
-
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
8716
|
-
$99472afa7112c427$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
8717
|
-
return;
|
|
8718
|
-
}
|
|
8719
|
-
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
8720
|
-
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
|
|
8721
|
-
);
|
|
8722
|
-
|
|
8723
|
-
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
8724
|
-
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
8725
|
-
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);
|
|
8726
|
-
$99472afa7112c427$var$cut_start(index_of_first_segment, segmented_text);
|
|
8727
|
-
// update indexes since we might have removed segments
|
|
8728
|
-
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
8729
|
-
let number_of_characters_between_segments = 0;
|
|
8730
|
-
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
8731
|
-
const segment = segmented_text[i];
|
|
8732
|
-
number_of_characters_between_segments += segment.text_.length;
|
|
8733
|
-
}
|
|
8734
|
-
if (number_of_characters_between_segments < $99472afa7112c427$var$dont_cut_in_between_less_than_characters)
|
|
8735
|
-
// don't cut if there are less than 30 characters between the two segments
|
|
8736
|
-
return;
|
|
8737
|
-
// We have more than 50 characters between the two segments, cut between them
|
|
8738
|
-
const [split_start_segment, split_start_character] = $99472afa7112c427$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
8739
|
-
const [split_end_segment, split_end_character] = $99472afa7112c427$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
8740
|
-
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
8741
|
-
// identical split point, or split end before split start, can't do anything
|
|
8742
|
-
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
8743
|
-
const dots_segment = {
|
|
8744
|
-
text_: " … ",
|
|
8745
|
-
highlighted_: false
|
|
8746
|
-
};
|
|
8747
|
-
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
8748
|
-
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
8749
|
-
const text = segment.text_;
|
|
8750
|
-
if (i == split_end_segment && i == split_start_segment) return [{
|
|
8751
|
-
...segment,
|
|
8752
|
-
text_: text.slice(0, split_start_character).trimEnd()
|
|
8753
|
-
}, dots_segment, {
|
|
8754
|
-
...segment,
|
|
8755
|
-
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8756
|
-
}];else if (i == split_start_segment) {
|
|
8757
|
-
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
|
|
8758
|
-
return segment;
|
|
8759
|
-
} else if (i == split_end_segment) return [dots_segment, {
|
|
8760
|
-
...segment,
|
|
8761
|
-
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8762
|
-
}];
|
|
8763
|
-
return []; // remove all segments inbetween
|
|
8764
|
-
});
|
|
8765
|
-
|
|
8766
|
-
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
8767
|
-
$99472afa7112c427$var$heal_holes(segmented_text);
|
|
8768
|
-
}
|
|
8769
|
-
function $99472afa7112c427$var$heal_holes(segmented_text) {
|
|
8770
|
-
// try to heal "holes" created in the segments so there are only alternating segments
|
|
8771
|
-
const segments_to_delete = new Set();
|
|
8772
|
-
for (let i = 0; i < segmented_text.length; i++) {
|
|
8773
|
-
var _previous_segment, _previous_segment2;
|
|
8774
|
-
const segment = segmented_text[i];
|
|
8775
|
-
let previous_segment;
|
|
8776
|
-
for (let j = i - 1; j >= 0; j--) {
|
|
8777
|
-
previous_segment = segmented_text[j];
|
|
8778
|
-
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
8779
|
-
if (!segments_to_delete.has(previous_segment)) break;
|
|
8780
|
-
}
|
|
8781
|
-
if ((_previous_segment = previous_segment) !== null && _previous_segment !== void 0 && _previous_segment.highlighted_ && segment.highlighted_ || ((_previous_segment2 = previous_segment) === null || _previous_segment2 === void 0 ? void 0 : _previous_segment2.highlighted_) === false && segment.highlighted_ === false) {
|
|
8782
|
-
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
8783
|
-
segments_to_delete.add(segment);
|
|
8784
|
-
}
|
|
8785
|
-
}
|
|
8786
|
-
for (const segment of segments_to_delete) {
|
|
8787
|
-
const index = segmented_text.indexOf(segment);
|
|
8788
|
-
segmented_text.splice(index, 1);
|
|
8789
|
-
}
|
|
8790
|
-
}
|
|
8791
|
-
function $99472afa7112c427$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
|
|
8792
|
-
let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
8793
|
-
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
8794
|
-
const step = should_loop_backwards ? -1 : 1;
|
|
8795
|
-
const desperate_split_attempts = [":", ";", ","];
|
|
8796
|
-
while (desperate_split_attempts.length) {
|
|
8797
|
-
const split_point_between_words = [];
|
|
8798
|
-
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
8799
|
-
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
8800
|
-
let is_first_character = true;
|
|
8801
|
-
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
8802
|
-
const segment = segmented_text[i];
|
|
8803
|
-
const text = segment.text_;
|
|
8804
|
-
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
8805
|
-
const character = text[j];
|
|
8806
|
-
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
8807
|
-
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
8808
|
-
split_point_between_words.push([i, j]);
|
|
8809
|
-
if (split_point_between_words.length > 3)
|
|
8810
|
-
// We can't find a split point, so we'll just split between words
|
|
8811
|
-
// 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
|
|
8812
|
-
return split_point_between_words[1];
|
|
8813
|
-
}
|
|
8814
|
-
}
|
|
8815
|
-
}
|
|
8816
|
-
}
|
|
8817
|
-
return [];
|
|
8818
|
-
}
|
|
8819
|
-
function $99472afa7112c427$var$cut_start(cut_left_of_index, segmented_text) {
|
|
8820
|
-
// Cut the start of the text to bring the first matching token
|
|
8821
|
-
let is_first_character = false;
|
|
8822
|
-
let words_encountered = 0;
|
|
8823
|
-
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
8824
|
-
const segment = segmented_text[i];
|
|
8825
|
-
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
8826
|
-
const text = segment.text_;
|
|
8827
|
-
for (let j = text.length - 1; j >= 0; j--) {
|
|
8828
|
-
const character = text[j];
|
|
8829
|
-
const is_space = character == " ";
|
|
8830
|
-
if (!is_first_character && is_space) words_encountered++;
|
|
8831
|
-
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
8832
|
-
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
8833
|
-
segment.text_ = text.slice(j + 1).trimStart();
|
|
8834
|
-
segmented_text.splice(0, i);
|
|
8835
|
-
if (character === "," || is_space)
|
|
8836
|
-
// if we cut at a comma or psace, we add a … at the beginning
|
|
8837
|
-
segmented_text.unshift({
|
|
8838
|
-
text_: "… ",
|
|
8839
|
-
highlighted_: false
|
|
8840
|
-
});
|
|
8841
|
-
break outmost_loop;
|
|
8842
|
-
}
|
|
8843
|
-
if (is_first_character) is_first_character = false;
|
|
8844
|
-
}
|
|
8845
|
-
}
|
|
8846
|
-
$99472afa7112c427$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
8847
|
-
}
|
|
8848
|
-
|
|
8849
|
-
function $99472afa7112c427$var$segment_text(text, matched_strings) {
|
|
8850
|
-
// segment text where the matched strings are highlighted sections
|
|
8851
|
-
const output = [];
|
|
8852
|
-
if (!text) return; // shouldn't happen but whatever
|
|
8853
|
-
for (let i = 0; i < text.length; i++) {
|
|
8854
|
-
const found_strings = [];
|
|
8855
|
-
if (!i || text[i - 1] == " ")
|
|
8856
|
-
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
8857
|
-
for (let j = 0; j < matched_strings.length; j++) {
|
|
8858
|
-
const matched_string = matched_strings[j];
|
|
8859
|
-
const part_in_text = text.slice(i, i + matched_string.length);
|
|
8860
|
-
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
8861
|
-
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
|
|
8862
|
-
}
|
|
8863
|
-
|
|
8864
|
-
const last_index_in_output = output.length - 1;
|
|
8865
|
-
if (!found_strings.length) {
|
|
8866
|
-
var _output$last_index_in;
|
|
8867
|
-
const character = text[i];
|
|
8868
|
-
if (((_output$last_index_in = output[last_index_in_output]) === null || _output$last_index_in === void 0 ? void 0 : _output$last_index_in.highlighted_) === false || output.length && /\s/.test(character))
|
|
8869
|
-
// 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
|
|
8870
|
-
output[last_index_in_output].text_ += character;else output.push({
|
|
8871
|
-
highlighted_: false,
|
|
8872
|
-
text_: character
|
|
8873
|
-
});
|
|
8874
|
-
} else {
|
|
8875
|
-
var _output$last_index_in2;
|
|
8876
|
-
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
8877
|
-
if ((_output$last_index_in2 = output[last_index_in_output]) !== null && _output$last_index_in2 !== void 0 && _output$last_index_in2.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
8878
|
-
highlighted_: true,
|
|
8879
|
-
text_: longest_found_string
|
|
8880
|
-
});
|
|
8881
|
-
i += longest_found_string.length - 1;
|
|
8882
|
-
}
|
|
8883
|
-
}
|
|
8884
|
-
return output;
|
|
8885
|
-
}
|
|
8886
9113
|
const $f1fc9ea3e7632eba$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
|
|
8887
9114
|
$f1fc9ea3e7632eba$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div>"];
|
|
8888
9115
|
function $f1fc9ea3e7632eba$export$f631859cab12b342(_ref) {
|