@depict-ai/ui 0.0.7 → 0.0.9

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/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
- var $iBTHO$solidjsweb = require("solid-js/web");
2
1
  var $iBTHO$depictaiutilishared = require("@depict-ai/utilishared");
2
+ var $iBTHO$solidjsweb = require("solid-js/web");
3
3
  var $iBTHO$solidjs = require("solid-js");
4
4
 
5
5
  function $parcel$export(e, n, v, s) {
@@ -51,6 +51,9 @@ $parcel$export(module.exports, "DepictSearch", () => $fd2d5ef67fc09716$export$ac
51
51
  $parcel$export(module.exports, "SearchPage", () => $fd2d5ef67fc09716$export$f2dc7e4e4aa11abb);
52
52
  $parcel$export(module.exports, "SearchField", () => $fd2d5ef67fc09716$export$b94867ecbd698f21);
53
53
  $parcel$export(module.exports, "get_search_query_updating_blocked_signal", () => $fd2d5ef67fc09716$export$bde3eb976dfded9);
54
+ $parcel$export(module.exports, "add_to_version_info", () => $770e2bea06889bf6$export$2cefb7e61fcbae00);
55
+ $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
56
+ /*! Depict.ai search and product listing SDK */
54
57
 
55
58
 
56
59
 
@@ -165,6 +168,17 @@ const $93e94e7b0aa8ca88$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
165
168
 
166
169
 
167
170
 
171
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "0.0.9";
172
+
173
+
174
+ /**
175
+ * Adds things to the object we send to backend as a header to report the package versions used
176
+ */ const $770e2bea06889bf6$export$89a2f5e6eb5005b6 = {};
177
+ function $770e2bea06889bf6$export$2cefb7e61fcbae00(stuff_to_add) {
178
+ Object.assign($770e2bea06889bf6$export$89a2f5e6eb5005b6, stuff_to_add);
179
+ }
180
+
181
+
168
182
  const $e1d6c0f3d89d531c$var$v2_base_url = (0, $iBTHO$depictaiutilishared.base_url) + "/v2/";
169
183
  const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v2_base_url + "search/";
170
184
  const $e1d6c0f3d89d531c$var$add_ids_to_request = (input_req)=>{
@@ -200,9 +214,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
200
214
  const results = await (0, $iBTHO$depictaiutilishared.fetch_retry)(url, {
201
215
  headers: {
202
216
  "Content-Type": "text/plain",
203
- ...process.env.DEBUG === "true" ? {
204
- "X-DEBUG": "true"
205
- } : {}
217
+ ...$e1d6c0f3d89d531c$var$get_version_headers()
206
218
  }
207
219
  });
208
220
  attempt_to_return_api_response: {
@@ -233,7 +245,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
233
245
  try {
234
246
  const search_results = await (0, $iBTHO$depictaiutilishared.fetch_retry)(endpoint1, {
235
247
  headers: {
236
- "Content-Type": "text/plain"
248
+ "Content-Type": "text/plain",
249
+ ...$e1d6c0f3d89d531c$var$get_version_headers()
237
250
  },
238
251
  method: "POST",
239
252
  body: body
@@ -248,7 +261,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
248
261
  resolve_in_progress(result);
249
262
  setTimeout((0, $iBTHO$depictaiutilishared.catchify)(()=>{
250
263
  if (this.#supports_finalization_registry) cache_obj.finalization_registry_.register(result, body); // delete key from cache when value (WeakRefs) are collected
251
- else // delete things from cache after 5 minutes so it doesn't get too heavy
264
+ else // delete things from cache after 5 minutes, so it doesn't get too heavy
252
265
  setTimeout((0, $iBTHO$depictaiutilishared.catchify)(()=>delete cache_obj.cache_[body]), 300000);
253
266
  }), 30000 // cache values for at least 30 seconds
254
267
  );
@@ -285,6 +298,15 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
285
298
  }));
286
299
  }
287
300
  }
301
+ function $e1d6c0f3d89d531c$var$get_version_headers() {
302
+ return {
303
+ Versions: JSON.stringify({
304
+ ...(0, $770e2bea06889bf6$export$89a2f5e6eb5005b6),
305
+ "@depict-ai/utilishared": (0, $iBTHO$depictaiutilishared.version),
306
+ "@depict-ai/ui": (0, $b757f75811f3261f$export$83d89fbfd8236492)
307
+ })
308
+ };
309
+ }
288
310
 
289
311
 
290
312
 
@@ -525,7 +547,7 @@ async function $7b4bc889571cc67b$var$download_categories(tenant, market) {
525
547
 
526
548
 
527
549
 
528
- const $6f604560873e4f69$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="instant-card"><div class="img_part"></div><div class="right_part"><div class="title_brand"><span class="title"></span></div></div></div>`, 10);
550
+ const $6f604560873e4f69$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="title"></span></div></div></div>`, 10);
529
551
  function $6f604560873e4f69$export$ee1733d9a8495996() {
530
552
  return (()=>{
531
553
  const _el$ = $6f604560873e4f69$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild;
@@ -584,17 +606,21 @@ function $fd463ff0edb29915$export$b3ad617e9036868(modal_body_style, input_field,
584
606
  } : {}
585
607
  }));
586
608
  };
587
- const ro = new ResizeObserver((0, $iBTHO$depictaiutilishared.catchify)((records)=>{
588
- records.forEach(({ contentRect: { width: width } })=>{
589
- if (width_transformer) width = width_transformer(width);
590
- modal_body_style[1]((old_value)=>({
591
- ...old_value,
592
- width: `${width}px`
593
- }));
594
- });
595
- align_position();
596
- }));
597
- ro.observe(input_field);
609
+ let ro;
610
+ if (one_axies_only !== "top") {
611
+ ro = new ResizeObserver((0, $iBTHO$depictaiutilishared.catchify)((records)=>{
612
+ records.forEach(({ contentRect: { width: width } })=>{
613
+ if (width_transformer) width = width_transformer(width);
614
+ modal_body_style[1]((old_value)=>({
615
+ ...old_value,
616
+ "max-width": "unset",
617
+ width: `${width}px`
618
+ }));
619
+ });
620
+ align_position();
621
+ }));
622
+ ro.observe(input_field);
623
+ }
598
624
  window.addEventListener("resize", align_position);
599
625
  window.addEventListener("orientationchange", align_position);
600
626
  // "resize" doesn't fire sometimes when it should, also it doesn't when showing/hiding scrollbars which disabling scrolling does
@@ -604,7 +630,7 @@ function $fd463ff0edb29915$export$b3ad617e9036868(modal_body_style, input_field,
604
630
  resize_resize_observer.observe(document.documentElement);
605
631
  (0, $iBTHO$depictaiutilishared.observer).wait_for_element("body").then(resize_resize_observer.observe.bind(resize_resize_observer));
606
632
  (0, $iBTHO$solidjs.onCleanup)((0, $iBTHO$depictaiutilishared.catchify)(()=>{
607
- ro.disconnect();
633
+ ro?.disconnect();
608
634
  resize_resize_observer.disconnect();
609
635
  window.removeEventListener("resize", align_position);
610
636
  window.removeEventListener("orientationchange", align_position);
@@ -1821,6 +1847,8 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
1821
1847
 
1822
1848
 
1823
1849
 
1850
+
1851
+
1824
1852
  function $6e22b5314fb52f4c$export$e183a13865960371(params_to_default_value) {
1825
1853
  const signals = {};
1826
1854
  const entries = Object.entries(params_to_default_value);
@@ -1875,6 +1903,8 @@ function $26a56f6b44703084$export$9862539c89138352(get_default_values) {
1875
1903
 
1876
1904
 
1877
1905
 
1906
+
1907
+
1878
1908
  const $6b384adf40a5f4d7$var$get_available_range = (available_filters_, search_for_field)=>{
1879
1909
  const maybe_meta = (0, $iBTHO$solidjs.untrack)(available_filters_)?.find(({ op: op , field: field })=>field === search_for_field && op === "inrange")?.meta;
1880
1910
  if (maybe_meta?.min != undefined && maybe_meta?.max != undefined) return [
@@ -2597,9 +2627,10 @@ function $a69e505a12a77874$export$6c6d7a51fa9aa15d(props) {
2597
2627
  duration: duration_ ?? 250,
2598
2628
  delay: delay_ ?? 0
2599
2629
  });
2600
- const toggle = ()=>props.is_open_[1](!(0, $iBTHO$solidjs.untrack)(()=>props.is_open_ /* reactive getter */ [0]()));
2601
2630
  const [is_in_dom, set_is_in_dom] = (0, $iBTHO$solidjs.createSignal)(document.documentElement.contains(details_));
2602
- const is_open_memo = (0, $iBTHO$solidjs.createMemo)(()=>props.is_open_[0]()); // we want this extra layer for if the props.is_open_ function changes itself but not the value of the signal. If we re-run below effect it flickers sometimes for some reason
2631
+ // we want this extra layer for if the props.is_open_ function changes itself but not the value of the signal. If we re-run below effect it flickers sometimes for some reason
2632
+ const is_open_memo = (0, $iBTHO$solidjs.createMemo)(()=>props.is_open_[0]());
2633
+ const toggle = ()=>props.is_open_[1](!(0, $iBTHO$solidjs.untrack)(is_open_memo));
2603
2634
  (0, $iBTHO$solidjsweb.insert)(details_, [
2604
2635
  summary_,
2605
2636
  (0, $iBTHO$solidjsweb.createComponent)(ExpandingContainer, {
@@ -2620,8 +2651,15 @@ function $a69e505a12a77874$export$6c6d7a51fa9aa15d(props) {
2620
2651
  const do_duration = dont_animate_if_instant_open_ && fresh_component ? $a69e505a12a77874$var$has_new_animate ? 0 : 1 /* if the zero duration is 1 modern chrome will paint a frame with unexpanded and then one with expanded which doesn't look nice, if you have 0 on older browsers they won't play the animation at all (i.e. iOS 12.5.5) */ : duration_;
2621
2652
  await expand(0, do_duration);
2622
2653
  } else {
2654
+ const closeModal = (0, $iBTHO$depictaiutilishared.catchify)(()=>{
2655
+ /*
2656
+ TODO: we currently should not enable the following line, since it causes the following bug:
2657
+ https://linear.app/depictai/issue/FRO-413/on-estoreno-the-browser-crashes-when-expandingcollapsing-filtre-on
2658
+ It seems to be a chrome issue and a bug has been reported to them:
2659
+ https://bugs.chromium.org/p/chromium/issues/detail?id=1404121#c2 */ // details_.open = false;
2660
+ });
2623
2661
  const animation = await collapse();
2624
- animation.addEventListener("finish", (0, $iBTHO$depictaiutilishared.catchify)(()=>details_.open = false)); // close it after the animation has finished
2662
+ animation.addEventListener("finish", closeModal);
2625
2663
  }
2626
2664
  }));
2627
2665
  details_.addEventListener("toggle", (0, $iBTHO$depictaiutilishared.catchify)(()=>{
@@ -3044,7 +3082,7 @@ async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_
3044
3082
 
3045
3083
 
3046
3084
 
3047
- const $b3cf6ca8dc0e9998$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="count"></span>`, 2), $b3cf6ca8dc0e9998$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<label class="input_row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text"></span></div></label>`, 9);
3085
+ const $b3cf6ca8dc0e9998$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="count"></span>`, 2), $b3cf6ca8dc0e9998$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text"></span></div></label>`, 9);
3048
3086
  const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = (props)=>{
3049
3087
  const id = (0, $iBTHO$depictaiutilishared.make_random_classname)();
3050
3088
  return /* We can't use actual margin because ExpandingContainer gets messed up */ (()=>{
@@ -3087,7 +3125,7 @@ const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = (props)=>{
3087
3125
 
3088
3126
 
3089
3127
 
3090
- const $0fe1e7efdf4200d6$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button type="button" class="expand_filter"><span></span></button>`, 4);
3128
+ const $0fe1e7efdf4200d6$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button type="button" class="expand-filter"><span></span></button>`, 4);
3091
3129
  function $0fe1e7efdf4200d6$export$ca21a16d65b3dd8({ show_extras_: [get_show_extras, set_show_extras] , i18n_: i18n_ }) {
3092
3130
  return (()=>{
3093
3131
  const _el$ = $0fe1e7efdf4200d6$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild;
@@ -3221,7 +3259,7 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({ filter_: filter_ , selected
3221
3259
 
3222
3260
 
3223
3261
 
3224
- const $c1dc1554c1b94233$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<form class="radios"></form>`, 2), $c1dc1554c1b94233$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="count"></span>`, 2), $c1dc1554c1b94233$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<label class="input_row"><div class="left"><input type="radio"><span class="custom-indicator"></span></div></label>`, 7);
3262
+ const $c1dc1554c1b94233$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<form class="radios"></form>`, 2), $c1dc1554c1b94233$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="count"></span>`, 2), $c1dc1554c1b94233$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<label class="input-row"><div class="left"><input type="radio"><span class="custom-indicator"></span></div></label>`, 7);
3225
3263
  function $c1dc1554c1b94233$export$430444115f70a734({ selected_filters_: selected_filters_ , filter_: filter_ }) {
3226
3264
  const radio_name = (0, $iBTHO$depictaiutilishared.make_random_classname)();
3227
3265
  const existing_filter = (0, $iBTHO$solidjs.createMemo)(()=>{
@@ -3300,7 +3338,7 @@ function $c1dc1554c1b94233$export$430444115f70a734({ selected_filters_: selected
3300
3338
 
3301
3339
 
3302
3340
 
3303
- const $0b7222ba8a8bb72f$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="range"><div class="input_group"><div class="field"><input type="number"></div><div class="separator">-</div><div class="field"><input type="number"></div></div><div class="value_text"><span class="min"></span><span class="max"></span></div></div>`, 18), $0b7222ba8a8bb72f$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="slider"><div class="progress"></div></div>`, 4), $0b7222ba8a8bb72f$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="range_group"><input type="range" step="any"><input type="range" step="any"></div>`, 4);
3341
+ const $0b7222ba8a8bb72f$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="range"><div class="input-group"><div class="field"><input type="number"></div><div class="separator">-</div><div class="field"><input type="number"></div></div><div class="value-text"><span class="min"></span><span class="max"></span></div></div>`, 18), $0b7222ba8a8bb72f$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="slider"><div class="progress"></div></div>`, 4), $0b7222ba8a8bb72f$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="range-group"><input type="range" step="any"><input type="range" step="any"></div>`, 4);
3304
3342
  function $0b7222ba8a8bb72f$export$e0d834a0ad870cda({ filter_: filter_ , selected_filters_: selected_filters_ , i18n_: i18n_ }) {
3305
3343
  const current_range = (0, $iBTHO$solidjs.createSignal)((0, $iBTHO$solidjs.untrack)(()=>filter_().data));
3306
3344
  const selected_filter = (0, $iBTHO$solidjs.createMemo)(()=>selected_filters_[0]().find(({ field: checking_field , op: checking_op })=>checking_field === filter_().field && checking_op === filter_().op));
@@ -3628,7 +3666,7 @@ function $7567511a7c3e4bd7$export$e5c2828934226505({ expanded_: expanded_ , i18n
3628
3666
 
3629
3667
 
3630
3668
 
3631
- const $3bdc00a1353c1150$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<form class="checkboxes hierarchical"></form>`, 2), $3bdc00a1353c1150$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="checkbox_details"></div>`, 2), $3bdc00a1353c1150$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details></details>`, 2), $3bdc00a1353c1150$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<summary class="category_parent"><div class="summary"><span class="count"></span></div></summary>`, 6);
3669
+ const $3bdc00a1353c1150$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<form class="checkboxes hierarchical"></form>`, 2), $3bdc00a1353c1150$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="checkbox-details"></div>`, 2), $3bdc00a1353c1150$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details></details>`, 2), $3bdc00a1353c1150$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<summary class="category-parent"><div class="summary"><span class="count"></span></div></summary>`, 6);
3632
3670
  const $3bdc00a1353c1150$var$max_visible_without_collapsing = 7;
3633
3671
  const $3bdc00a1353c1150$var$show_non_collapsible_when_collapsed = 4;
3634
3672
  function $3bdc00a1353c1150$export$a32086fa6616eafd({ filter_: filter_ , selected_filters_: selected_filters_ , i18n_: i18n_ , view_more_button_below_group_: view_more_button_below_group_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ }) {
@@ -3748,7 +3786,7 @@ function $3bdc00a1353c1150$export$a32086fa6616eafd({ filter_: filter_ , selected
3748
3786
  typeof _ref$ === "function" ? (0, $iBTHO$solidjsweb.use)(_ref$, _el$) : form = _el$;
3749
3787
  (0, $iBTHO$solidjsweb.insert)(_el$, ()=>$3bdc00a1353c1150$var$render_stuff((0, $iBTHO$solidjs.createMemo)(()=>some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $3bdc00a1353c1150$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_), null);
3750
3788
  (0, $iBTHO$solidjsweb.insert)(_el$, expanding_container_els, null);
3751
- (0, $iBTHO$solidjsweb.effect)(()=>_el$.classList.toggle("any_expandable", !!Object.values(structured_categories()).some((category)=>Object.keys(category.children_).length)));
3789
+ (0, $iBTHO$solidjsweb.effect)(()=>_el$.classList.toggle("any-expandable", !!Object.values(structured_categories()).some((category)=>Object.keys(category.children_).length)));
3752
3790
  return _el$;
3753
3791
  })();
3754
3792
  }
@@ -3804,7 +3842,7 @@ function $3bdc00a1353c1150$var$render_stuff(data, existing_filter, i18n_) {
3804
3842
  }
3805
3843
  return are_checked;
3806
3844
  });
3807
- (0, $iBTHO$solidjs.createEffect)(()=>input.classList[any_kids_checked() ? "add" : "remove"]("fake_checked"));
3845
+ (0, $iBTHO$solidjs.createEffect)(()=>input.classList[any_kids_checked() ? "add" : "remove"]("fake-checked"));
3808
3846
  }
3809
3847
  }), null);
3810
3848
  (0, $iBTHO$solidjsweb.insert)(_el$2, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
@@ -4388,7 +4426,7 @@ function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
4388
4426
 
4389
4427
 
4390
4428
 
4391
- const $aff9a96d30ed3563$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filter_collapsible"></div>`, 2), $aff9a96d30ed3563$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="clear_group"><span></span></button>`, 4), $aff9a96d30ed3563$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="view_more_clear"></div>`, 2), $aff9a96d30ed3563$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filter_collapsible_body"><div class="filter_part"></div></div>`, 4), $aff9a96d30ed3563$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details class="filter_collapsible"></details>`, 2), $aff9a96d30ed3563$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<summary class="filter_group_summary"><div class="summary"><span></span><div class="selected_w_sign"></div></div></summary>`, 8), $aff9a96d30ed3563$var$_tmpl$7 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="ungrouped"></div>`, 2), $aff9a96d30ed3563$var$_tmpl$8 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="clear_all_filters major"></button>`, 2);
4429
+ const $aff9a96d30ed3563$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filter-collapsible"></div>`, 2), $aff9a96d30ed3563$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="clear-group"><span></span></button>`, 4), $aff9a96d30ed3563$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="view-more-clear"></div>`, 2), $aff9a96d30ed3563$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filter-collapsible-body"><div class="filter-part"></div></div>`, 4), $aff9a96d30ed3563$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details class="filter-collapsible"></details>`, 2), $aff9a96d30ed3563$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<summary class="filter-group-summary"><div class="summary"><span></span><div class="selected-w-sign"></div></div></summary>`, 8), $aff9a96d30ed3563$var$_tmpl$7 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="ungrouped"></div>`, 2), $aff9a96d30ed3563$var$_tmpl$8 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="clear-all-filters major"></button>`, 2);
4392
4430
  function $aff9a96d30ed3563$export$3f1a388cc0d8fed7(props) {
4393
4431
  // Split like this to make placeholder wrapping more visible & this component is exported and used in MobileModal
4394
4432
  return (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
@@ -4617,7 +4655,7 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
4617
4655
 
4618
4656
 
4619
4657
 
4620
- const $be89be42ce9ea60f$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sorting-attributes"></div>`, 2), $be89be42ce9ea60f$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sorting-direction"></div>`, 2), $be89be42ce9ea60f$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div><div class="input_row"><input type="radio"><span class="custom-indicator"></span></div></div>`, 7), $be89be42ce9ea60f$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div><label class="input_row"><input type="radio"><span class="custom-indicator"></span></label></div>`, 7);
4658
+ const $be89be42ce9ea60f$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sorting-attributes"></div>`, 2), $be89be42ce9ea60f$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sorting-direction"></div>`, 2), $be89be42ce9ea60f$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span></div></div>`, 7), $be89be42ce9ea60f$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div><label class="input-row"><input type="radio"><span class="custom-indicator"></span></label></div>`, 7);
4621
4659
  function $be89be42ce9ea60f$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_: current_sorting_ }) {
4622
4660
  const title_radio_name = (0, $iBTHO$depictaiutilishared.make_random_classname)();
4623
4661
  const order_radio_name = (0, $iBTHO$depictaiutilishared.make_random_classname)();
@@ -4724,8 +4762,8 @@ function $be89be42ce9ea60f$export$1f1775a58da589b5({ available_sortings_: availa
4724
4762
 
4725
4763
 
4726
4764
 
4727
- const $1872ceb56ede7a52$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="clear minor"></button>`, 2), $1872ceb56ede7a52$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"></button><div class="filter_sort_modal"><div class="body"></div><div class="bottom-row"><button class="show-results major"></button></div></div></div>`, 14), $1872ceb56ede7a52$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details class="sorting"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<summary class="sort_filter_summary"><div class="summary"><div class="left_els"><span></span></div></div></summary>`, 8), $1872ceb56ede7a52$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="body"></div>`, 2), $1872ceb56ede7a52$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details class="filters"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$7 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<b></b>`, 2);
4728
- const $1872ceb56ede7a52$var$no_go_selector = ".range .range_group";
4765
+ const $1872ceb56ede7a52$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="clear minor"></button>`, 2), $1872ceb56ede7a52$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"></button><div class="filter-sort-modal"><div class="body"></div><div class="bottom-row"><button class="show-results major"></button></div></div></div>`, 14), $1872ceb56ede7a52$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details class="sorting"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<summary class="sort-filter-summary"><div class="summary"><div class="left-els"><span></span></div></div></summary>`, 8), $1872ceb56ede7a52$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="body"></div>`, 2), $1872ceb56ede7a52$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<details class="filters"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$7 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<b></b>`, 2);
4766
+ const $1872ceb56ede7a52$var$no_go_selector = ".range .range-group";
4729
4767
  function $1872ceb56ede7a52$export$9bf11afa910f536e({ args_for_sorting_: args_for_sorting_ , args_for_filtering_: args_for_filtering_ , search_filters_open_: [get_search_filters_open, set_search_filters_open] , search_sorting_open_: [get_search_sorting_open, set_search_sorting_open] , dismiss_modal_: dismiss_modal_ , register_closing_animation_: register_closing_animation_ , formatted_number_of_results_: formatted_number_of_results_ , i18n_: i18n_ }) {
4730
4768
  (0, $ca1176b694a6ee2e$export$fe334901e8bebd57)();
4731
4769
  let modal;
@@ -4995,7 +5033,7 @@ function $1872ceb56ede7a52$export$9bf11afa910f536e({ args_for_sorting_: args_for
4995
5033
 
4996
5034
 
4997
5035
 
4998
- const $f8f64d05c525825b$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filters"><div class="body"></div></div>`, 4), $f8f64d05c525825b$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sorting"><div class="body"></div></div>`, 4), $f8f64d05c525825b$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sort-and-filter-buttons"><div class="outer"><div class="inner"></div></div></div>`, 6), $f8f64d05c525825b$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="num_filters"></span>`, 2), $f8f64d05c525825b$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="open-filters-button-container"><button class="filter toggle-button major-minor-transition" type="button"><span></span></button></div>`, 6), $f8f64d05c525825b$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="toggle-button for-sorting major-minor-transition"><span></span></button>`, 4);
5036
+ const $f8f64d05c525825b$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filters"><div class="body"></div></div>`, 4), $f8f64d05c525825b$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sorting"><div class="body"></div></div>`, 4), $f8f64d05c525825b$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="sort-and-filter-buttons"><div class="outer"><div class="inner"></div></div></div>`, 6), $f8f64d05c525825b$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="num-filters"></span>`, 2), $f8f64d05c525825b$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="open-filters-button-container"><button class="filter toggle-button major-minor-transition" type="button"><span></span></button></div>`, 6), $f8f64d05c525825b$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="toggle-button for-sorting major-minor-transition"><span></span></button>`, 4);
4999
5037
  function $f8f64d05c525825b$export$d7841e452f2e59a8({ current_sorting_: current_sorting_ , set_extra_els_in_results_container_: set_extra_els_in_results_container_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , set_sort_or_filter_open_: set_sort_or_filter_open_ , i18n_: i18n_ , available_sortings_: available_sortings_ , available_filters_: available_filters_ , expanded_filters_: expanded_filters_ , middle_elements_: middle_elements_ , input_modal_open_: input_modal_open_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_ , set_sort_and_filter_element_: set_sort_and_filter_element_ , formatted_number_of_results_: formatted_number_of_results_ , filter_button_width_: filter_button_width_ , sort_button_width_: sort_button_width_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , get_extra_filters_button_: get_extra_filters_button_ , get_extra_sorting_button_: get_extra_sorting_button_ }) {
5000
5038
  return (0, $edafe91daf3091d7$export$b69d0d92862de18b)({
5001
5039
  severity_: "error",
@@ -5227,7 +5265,7 @@ function $f8f64d05c525825b$var$OpenSortingButton({ i18n_: i18n_ , current_sortin
5227
5265
 
5228
5266
 
5229
5267
 
5230
- const $2fb324fbcc7b4a7b$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="floating_buttons"><button class="filter"><div></div></button><button class="sort"><div></div></button><button class="up"><div></div></button></div>`, 14);
5268
+ const $2fb324fbcc7b4a7b$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="floating-buttons"><button class="filter"><div></div></button><button class="sort"><div></div></button><button class="up"><div></div></button></div>`, 14);
5231
5269
  function $2fb324fbcc7b4a7b$export$b23abd26de154ede(props) {
5232
5270
  const [is_small, set_is_small] = (0, $iBTHO$solidjs.createSignal)(true);
5233
5271
  (0, $iBTHO$solidjs.onCleanup)((0, $iBTHO$depictaiutilishared.javascript_media_query)("(max-width:651px)", ({ matches: matches })=>set_is_small(matches)).remove);
@@ -5342,7 +5380,7 @@ function $2fb324fbcc7b4a7b$var$ActualFloatingButtons({ search_filters_open_: [ge
5342
5380
  (0, $iBTHO$solidjsweb.insert)(_el$7, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$depictaiutilishared.ArrowUp), {}));
5343
5381
  (0, $iBTHO$solidjsweb.effect)((_p$)=>{
5344
5382
  const _v$ = !!(is_scrolling_upwards() && modal_is_closed() && !regular_buttons_are_in_view() && !get_is_showing_toast()), _v$2 = i18n_.filter_text_(), _v$3 = i18n_.sorting_text_(), _v$4 = i18n_.scroll_to_top_();
5345
- _v$ !== _p$._v$ && _el$.classList.toggle("show_them", _p$._v$ = _v$);
5383
+ _v$ !== _p$._v$ && _el$.classList.toggle("show-them", _p$._v$ = _v$);
5346
5384
  _v$2 !== _p$._v$2 && (0, $iBTHO$solidjsweb.setAttribute)(_el$2, "aria-label", _p$._v$2 = _v$2);
5347
5385
  _v$3 !== _p$._v$3 && (0, $iBTHO$solidjsweb.setAttribute)(_el$4, "aria-label", _p$._v$3 = _v$3);
5348
5386
  _v$4 !== _p$._v$4 && (0, $iBTHO$solidjsweb.setAttribute)(_el$6, "aria-label", _p$._v$4 = _v$4);
@@ -5743,6 +5781,14 @@ function $8cd545330f2674dc$export$210f130a61ac1e8d(fn) {
5743
5781
 
5744
5782
 
5745
5783
 
5784
+ let $0b6e2070a98de347$export$44dad306455dddf;
5785
+ (function(DEPICT_ID) {
5786
+ DEPICT_ID["SEARCH_MODAL"] = "depict-search-modal";
5787
+ DEPICT_ID["SEARCH_PAGE"] = "depict-search-page";
5788
+ DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
5789
+ })($0b6e2070a98de347$export$44dad306455dddf || ($0b6e2070a98de347$export$44dad306455dddf = {}));
5790
+
5791
+
5746
5792
  const $840d88a04b2d22a7$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="product-count"> </div>`, 2), $840d88a04b2d22a7$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div></div>`, 2), $840d88a04b2d22a7$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $840d88a04b2d22a7$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
5747
5793
  function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , page_replacer_: page_replacer_ , query_id_: query_id_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , on_category_link_click_: on_category_link_click_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , rr_options_: rr_options_ , get_product_id_: get_product_id_ }) {
5748
5794
  return (0, $iBTHO$solidjs.createRoot)((dispose)=>{
@@ -5937,7 +5983,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
5937
5983
  get_breadcrumb_accessor_?.(crumb_data_);
5938
5984
  get_quicklinks_accessor_?.(quicklinks_data_);
5939
5985
  return [
5940
- document.createComment("Depict.ai frontend integrated category page"),
5986
+ document.createComment("Category page based on Depict SDK"),
5941
5987
  (()=>{
5942
5988
  const _el$5 = $840d88a04b2d22a7$var$_tmpl$4.cloneNode(true), _el$6 = _el$5.firstChild;
5943
5989
  (0, $iBTHO$solidjsweb.insert)(_el$6, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
@@ -6043,6 +6089,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
6043
6089
  });
6044
6090
  }
6045
6091
  }), null);
6092
+ (0, $iBTHO$solidjsweb.effect)(()=>(0, $iBTHO$solidjsweb.setAttribute)(_el$5, "id", (0, $0b6e2070a98de347$export$44dad306455dddf).PLP_CATEGORY));
6046
6093
  return _el$5;
6047
6094
  })()
6048
6095
  ];
@@ -6087,6 +6134,7 @@ function $d84fe647b84b5dc5$var$proxy_push_state(function_name, thing) {
6087
6134
  }
6088
6135
 
6089
6136
 
6137
+
6090
6138
  const $7cb9c8285dbd453e$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp category"></div>`, 2);
6091
6139
  class $7cb9c8285dbd453e$export$3a8840c5b2ecf003 {
6092
6140
  #locale_signal = (0, $iBTHO$solidjs.createSignal)();
@@ -6107,7 +6155,11 @@ class $7cb9c8285dbd453e$export$3a8840c5b2ecf003 {
6107
6155
  }
6108
6156
  get #external_area_div() {
6109
6157
  // creates a new node every time this is accessed, doing like this for DRY purposes
6110
- return $7cb9c8285dbd453e$var$_tmpl$.cloneNode(true);
6158
+ return (()=>{
6159
+ const _el$ = $7cb9c8285dbd453e$var$_tmpl$.cloneNode(true);
6160
+ (0, $iBTHO$solidjsweb.effect)(()=>(0, $iBTHO$solidjsweb.setAttribute)(_el$, "id", (0, $0b6e2070a98de347$export$44dad306455dddf).PLP_CATEGORY));
6161
+ return _el$;
6162
+ })();
6111
6163
  }
6112
6164
  get locale_() {
6113
6165
  // allow reactive access
@@ -6237,113 +6289,42 @@ class $7cb9c8285dbd453e$export$3a8840c5b2ecf003 {
6237
6289
 
6238
6290
 
6239
6291
 
6240
- function $b34ce0b89e6db4e1$export$e026af0c7b64ea5f({ selected_filters_: selected_filters_ , search_query_: [get_search_query] , current_sorting_: current_sorting_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , local_filter_cache_: local_filter_cache_ }) {
6241
- const [get_selected_filters, set_selected_filters] = selected_filters_;
6242
- const clear_filters_next_submit_ = (0, $iBTHO$solidjs.createSignal)(false); // we store this here (and not in history.state) (maybe there's a better place) because it's a very temporary thing. I.e. as soon as anything breaks the "flow of intent" to make a new search we want this reset
6243
- const [get_clear_filters_next_submit, set_clear_filters_next_submit] = clear_filters_next_submit_;
6244
- const clear_filters = ()=>set_clear_filters_next_submit(true);
6245
- (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$solidjs.on)(get_selected_filters, ()=>{
6246
- // if the selected filters update, clear the clearing signal
6247
- set_clear_filters_next_submit(false);
6248
- }, {
6249
- defer: true
6250
- }));
6251
- (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$solidjs.on)(get_search_query, (0, $iBTHO$depictaiutilishared.catchify)(()=>{
6252
- // when a query was submitted, clear filters if clear was pressed before
6253
- if ((0, $iBTHO$solidjs.untrack)(get_clear_filters_next_submit)) {
6254
- set_clear_filters_next_submit(false);
6255
- set_selected_filters([]);
6256
- // also collapse expanded filters in hierarchical filter tree again
6257
- expanded_hierarchical_filters_[1]([]);
6258
- // also clear sorting
6259
- current_sorting_[1](undefined);
6260
- (0, $47e2cc552c02110c$export$8895d39404bd2bb1)({
6261
- user_triggered_: true,
6262
- selected_filters_: selected_filters_,
6263
- i18n_: i18n_,
6264
- also_clear_sorting_: true,
6265
- current_sorting_: current_sorting_,
6266
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6267
- local_filter_cache_: local_filter_cache_
6268
- });
6269
- }
6270
- }), {
6271
- defer: true
6272
- }));
6273
- return clear_filters;
6274
- }
6275
-
6276
-
6277
-
6278
-
6279
-
6280
6292
 
6281
- function $2b7a005a65221045$export$84bba84a7b837187(search_query) {
6282
- const ls = localStorage;
6283
- const key = "depict_searches";
6284
- const previous_searches = (0, $iBTHO$solidjs.createSignal)(JSON.parse(ls[key] || "[]"));
6285
- const [read_previous_searches, write_previous_searches] = previous_searches;
6286
- const [read_search_query] = search_query;
6287
- (0, $iBTHO$solidjs.createEffect)((0, $iBTHO$depictaiutilishared.catchify)(()=>{
6288
- const json_encoded = JSON.stringify(read_previous_searches());
6289
- if (ls[key] !== json_encoded) ls[key] = json_encoded;
6290
- }));
6291
- (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$depictaiutilishared.catchify)(()=>{
6292
- const searches = (0, $iBTHO$solidjs.untrack)((0, $iBTHO$depictaiutilishared.catchify)(()=>read_previous_searches()));
6293
- const current_query = read_search_query();
6294
- if (!current_query) // don't save no query in history
6295
- return;
6296
- const new_value = [
6297
- ...searches.filter((value)=>value !== current_query),
6298
- current_query
6299
- ].slice(-30); // keep max 30 values (one could be deleted later because it's the search query), if value we add already exists remove it first
6300
- write_previous_searches(new_value);
6301
- }));
6302
- return previous_searches;
6303
- }
6304
6293
 
6305
6294
 
6306
6295
 
6307
6296
 
6308
- function $f328bd45f8ede33c$export$e16630ecb9644a1c({ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ , search_param_name_: search_param_name_ , search_field_value_: [read_field_value, write_field_value] , search_query_: [read_search_query] , url_transformer_: url_transformer_ , on_submit_: on_submit_ = (0, $c8c0cecd8d3d832a$export$26df08e242fe83a3) , after_submit_: after_submit_ }) {
6309
- const new_search_query = (0, $iBTHO$solidjs.untrack)(read_field_value);
6310
- const previous_query = (0, $iBTHO$solidjs.untrack)(read_search_query);
6311
- if (previous_query === new_search_query && new URLSearchParams(location.search).has(search_param_name_)) {
6312
- // don't push a history entry / re-search if someone submits a search again
6313
- // do close the modal though
6314
- on_submit_with_unchanged_value_?.();
6315
- return;
6316
- }
6317
- write_field_value(previous_query); // restore the value to the previous query since this one goes to the new history entry
6318
- on_submit_(search_param_name_, new_search_query, url_transformer_);
6319
- write_field_value(new_search_query);
6320
- scrollTo(0, 0);
6321
- after_submit_?.();
6322
- }
6323
6297
 
6324
6298
 
6325
6299
 
6326
6300
 
6327
- function $b7d0212db218bf0b$export$2542ffb77b620b02(params_to_default_value) {
6328
- const signals = {};
6329
- const entries = Object.entries(params_to_default_value);
6330
- for (const [param, default_value] of entries)signals[param] = (0, $iBTHO$solidjs.createSignal)(default_value ?? "");
6331
- const [exit_iterable, exitable_iterable] = (0, $iBTHO$depictaiutilishared.make_asyncIterable_exiter)((0, $iBTHO$depictaiutilishared.href_change_ipns));
6332
- (0, $iBTHO$solidjs.onCleanup)((0, $iBTHO$depictaiutilishared.catchify)(exit_iterable));
6333
- (0, $iBTHO$depictaiutilishared.catchify)(async ()=>{
6334
- for await (const href of exitable_iterable){
6335
- const { searchParams: searchParams } = new URL(href);
6336
- for (const [param, default_value] of entries){
6337
- const [_get, set] = signals[param];
6338
- if (searchParams.has(param)) {
6339
- const new_val = searchParams.get(param) ?? default_value ?? "";
6340
- set(new_val);
6341
- } else set(default_value ?? "");
6301
+ const $dae23104ba8bb78c$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="parent-title"></span>`, 2), $dae23104ba8bb78c$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="category-suggestion"><span class="title"></span></a>`, 4);
6302
+ function $dae23104ba8bb78c$export$d757d54550ebfb3d({ category_suggestion_: category_suggestion_ , on_navigation_: on_navigation_ }) {
6303
+ return (()=>{
6304
+ const _el$ = $dae23104ba8bb78c$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild;
6305
+ (0, $iBTHO$solidjsweb.addEventListener)(_el$, "click", (0, $iBTHO$depictaiutilishared.catchify)((e)=>{
6306
+ if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
6307
+ return;
6308
+ return on_navigation_?.(category_suggestion_().page_url);
6309
+ }), true);
6310
+ (0, $iBTHO$solidjsweb.insert)(_el$2, ()=>category_suggestion_().title);
6311
+ (0, $iBTHO$solidjsweb.insert)(_el$, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
6312
+ get when () {
6313
+ return typeof category_suggestion_().parent_title === "string";
6314
+ },
6315
+ get children () {
6316
+ const _el$3 = $dae23104ba8bb78c$var$_tmpl$.cloneNode(true);
6317
+ (0, $iBTHO$solidjsweb.insert)(_el$3, ()=>category_suggestion_().parent_title);
6318
+ return _el$3;
6342
6319
  }
6343
- }
6320
+ }), null);
6321
+ (0, $iBTHO$solidjsweb.effect)(()=>(0, $iBTHO$solidjsweb.setAttribute)(_el$, "href", category_suggestion_().page_url));
6322
+ return _el$;
6344
6323
  })();
6345
- return signals;
6346
6324
  }
6325
+ (0, $iBTHO$solidjsweb.delegateEvents)([
6326
+ "click"
6327
+ ]);
6347
6328
 
6348
6329
 
6349
6330
 
@@ -6357,20 +6338,7 @@ function $b7d0212db218bf0b$export$2542ffb77b620b02(params_to_default_value) {
6357
6338
 
6358
6339
 
6359
6340
 
6360
-
6361
-
6362
-
6363
-
6364
-
6365
-
6366
-
6367
-
6368
-
6369
-
6370
-
6371
-
6372
-
6373
- const $2f8c7dc07090fca9$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="back" type="button"></button>`, 2), $2f8c7dc07090fca9$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="query_input"><div class="field"><input class="query" tabindex="0"><button type="button" class="clear"></button></div><button class="submit major" type="button"></button></div>`, 9);
6341
+ const $2f8c7dc07090fca9$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="back" type="button"></button>`, 2), $2f8c7dc07090fca9$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="query-input"><div class="field"><input class="query" tabindex="0"><button type="button" class="clear"></button></div><button class="submit major" type="button"></button></div>`, 9);
6374
6342
  function $2f8c7dc07090fca9$export$ff21851bb5d30e15({ search_field_value_: search_field_value_ , input_field_ref_: input_field_ref_ , field_element_ref_: field_element_ref_ , submit_query_: submit_query_ , override_on_enter_: override_on_enter_ , clear_filters_: clear_filters_ , disabled_: disabled_ = false , on_back_: on_back_ , i18n_: i18n_ }) {
6375
6343
  let input_field;
6376
6344
  (0, $iBTHO$solidjs.createEffect)((0, $iBTHO$depictaiutilishared.catchify)(async ()=>{
@@ -6400,7 +6368,6 @@ function $2f8c7dc07090fca9$export$ff21851bb5d30e15({ search_field_value_: search
6400
6368
  once: true
6401
6369
  });
6402
6370
  }
6403
- (0, $iBTHO$depictaiutilishared.dlog)("select", e);
6404
6371
  }));
6405
6372
  (0, $iBTHO$solidjsweb.addEventListener)(_el$4, "input", (0, $iBTHO$depictaiutilishared.catchify)(()=>{
6406
6373
  const { value: value } = input_field;
@@ -6469,63 +6436,403 @@ function $2f8c7dc07090fca9$export$ff21851bb5d30e15({ search_field_value_: search
6469
6436
 
6470
6437
 
6471
6438
 
6472
- const $6ae556e536054e87$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="instant-results"></div>`, 2);
6473
- function $6ae556e536054e87$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ }) {
6474
- const max_cards = 4;
6475
- const [read_current_instant_query, write_current_instant_query] = (0, $iBTHO$solidjs.createSignal)("");
6476
- let timeout;
6477
- (0, $iBTHO$solidjs.createComputed)(()=>{
6478
- const value = get_search_field_value();
6479
- if (timeout == null) // don't wait if it's the first request
6480
- write_current_instant_query(value);
6481
- clearTimeout(timeout);
6482
- timeout = setTimeout((0, $iBTHO$depictaiutilishared.catchify)(()=>write_current_instant_query(value)), 250);
6483
- });
6484
- const [search_results] = (0, $iBTHO$solidjs.createResource)((0, $iBTHO$solidjs.createMemo)(()=>({
6485
- tenant: tenant_(),
6486
- market: market_(),
6487
- query: read_current_instant_query()
6488
- })), (0, $iBTHO$depictaiutilishared.catchify)((variable_data)=>{
6489
- return depict_api_.query({
6490
- // here it is (unfortunately) important that the keys in the object are in the same order as in SearchPage.tsx, because when JSON-encoding them to compare for caching the strings will be different otherwise
6491
- limit: (0, $iBTHO$solidjs.untrack)(has_sort_or_filters_) ? max_cards : min_products_to_fetch_,
6492
- // if there's no sorting or filters we can fetch min_products_to_fetch_ many since then the cached request can be re-used by the search page, otherwise, no reason to waste bytes
6493
- ...variable_data
6439
+ const $fb29c6201c369e39$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="cards"></div>`, 2), $fb29c6201c369e39$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="search-recs"><h3 class="search-recs-title"></h3></div>`, 4), $fb29c6201c369e39$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="show-more major" type="button"></button>`, 2);
6440
+ const $fb29c6201c369e39$export$1c8c715550dc689d = 2;
6441
+ function $fb29c6201c369e39$export$7de92c4c2205ebf3({ depict_api_: depict_api_ , i18n_: i18n_ , tenant_object_: tenant_object_ , search_query_base_: search_query_base_ , rr_options_: rr_options_ , showing_recommendation_rows_: showing_recommendation_rows_ , view_more_button_: view_more_button_ = true , layout_options_: layout_options_ }) {
6442
+ const [is_showing_something, set_is_showing_something] = (0, $iBTHO$solidjs.createSignal)(false);
6443
+ const cards = $fb29c6201c369e39$var$_tmpl$.cloneNode(true);
6444
+ const on_next_render = [];
6445
+ const main_element = (()=>{
6446
+ const _el$2 = $fb29c6201c369e39$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
6447
+ (0, $iBTHO$solidjsweb.insert)(_el$3, ()=>i18n_.search_recs_title_());
6448
+ (0, $iBTHO$solidjsweb.insert)(_el$2, cards, null);
6449
+ return _el$2;
6450
+ })();
6451
+ const [get_showing_recommendation_rows] = showing_recommendation_rows_;
6452
+ const rows_object = view_more_button_ ? $fb29c6201c369e39$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
6453
+ const cleanup_old_cards = [];
6454
+ (0, $iBTHO$depictaiutilishared.Layout)({
6455
+ container_element: cards,
6456
+ layout: "grid",
6457
+ rows: rows_object,
6458
+ ...layout_options_
6459
+ }).catch((e)=>(0, $iBTHO$depictaiutilishared.report)([
6460
+ e,
6461
+ "Layout failed"
6462
+ ], "error"));
6463
+ // copied from RecommendationGrid
6464
+ // convoluted lazy loading that
6465
+ // when the elements are in the DOM starts IntersectionObserver on whole grid
6466
+ // when grid intersects starts Lazyfier
6467
+ // this is because Lazyfier is fucking stupid
6468
+ (0, $iBTHO$depictaiutilishared.observer).wait_for_element(cards).then((0, $iBTHO$depictaiutilishared.catchify)((element)=>{
6469
+ let start_lazy_loading;
6470
+ const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
6471
+ const lf = new (0, $iBTHO$depictaiutilishared.Lazyfier)({
6472
+ only_load_intersecting: true,
6473
+ wait_for_dominsertion: lazy_loading_promise,
6474
+ ignore_data_urls: true,
6475
+ lazyfinder: {
6476
+ unload () {}
6477
+ }
6494
6478
  });
6495
- }));
6496
- set_num_results_accessor_(()=>(0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
6497
- search_results_: search_results,
6498
- i18n_: i18n_
6499
- }));
6500
- const rendering_options = (0, $iBTHO$solidjs.createMemo)(()=>{
6501
- search_results();
6502
- return {};
6503
- });
6504
- const sliced_displays = (0, $iBTHO$solidjs.createMemo)(()=>search_results()?.displays?.slice(0, max_cards));
6505
- let placeholder;
6506
- const container = (()=>{
6507
- const _el$ = $6ae556e536054e87$var$_tmpl$.cloneNode(true);
6508
- (0, $iBTHO$solidjsweb.insert)(_el$, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
6509
- get when () {
6510
- return sliced_displays()?.length;
6511
- },
6512
- get fallback () {
6513
- return (0, $iBTHO$solidjs.createMemo)(()=>{
6514
- if (Array.isArray(search_results()?.displays)) // remove placeholders if we have a response but no results
6515
- return undefined;
6516
- return new Array(max_cards).fill(1).map(()=>(placeholder ||= render_instant_card_placeholder_()).cloneNode(true));
6517
- })();
6518
- },
6519
- get children () {
6520
- return (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Index), {
6521
- get each () {
6522
- return sliced_displays();
6523
- },
6524
- children: (d, i)=>$6ae556e536054e87$var$track_elements(d, i, render_instant_card_(d, i, rendering_options, i18n_), tenant_, market_)
6525
- });
6479
+ lf.start_observing_for_new_children_(element);
6480
+ const i_o = new IntersectionObserver((0, $iBTHO$depictaiutilishared.catchify)((records)=>{
6481
+ for (const record of records)if (record.intersectionRatio > 0) {
6482
+ start_lazy_loading();
6483
+ i_o.disconnect();
6484
+ return;
6526
6485
  }
6527
6486
  }));
6528
- return _el$;
6487
+ i_o.observe(cards);
6488
+ }));
6489
+ const deparallelized_recs_fetcher = (0, $iBTHO$depictaiutilishared.deparallelize_no_drop)((0, $iBTHO$depictaiutilishared.catchify)(async (base_query)=>{
6490
+ const recs_promise = depict_api_.get_recommended(base_query).then((r)=>r.displays);
6491
+ // create owner to run product cards with an Owner, so they know when they've gotten removed
6492
+ const [owner_for_cards, dispose_our_cards] = (0, $iBTHO$solidjs.createRoot)((dispose)=>[
6493
+ (0, $iBTHO$solidjs.getOwner)(),
6494
+ dispose
6495
+ ]);
6496
+ const rendering_result = await (await (0, $iBTHO$depictaiutilishared.make_placeholder_rr)({
6497
+ // render the max amount of elements that there could be, to make sure scroll restoration works (placeholders can't be shorter than actual content)
6498
+ num_items: (0, $aec24316ed262dc0$export$6c9030e511152266) + (0, $iBTHO$solidjs.untrack)(get_showing_recommendation_rows) * Math.max(...layout_options_.cols_at_size.map(([per_column])=>per_column))
6499
+ }))(tenant_object_, {
6500
+ type: "search_recs",
6501
+ recs: recs_promise,
6502
+ ...rr_options_,
6503
+ ...typeof rr_options_.template === "function" ? {
6504
+ template: (...args)=>(0, $iBTHO$solidjs.runWithOwner)(owner_for_cards, ()=>// give template the possibility to know when it gets removed from the DOM by using solid-js onCleanup
6505
+ rr_options_.template(...args))
6506
+ } : {}
6507
+ });
6508
+ const { elements: elements , should_stay_inserted: should_stay_inserted } = rendering_result;
6509
+ let dead = false;
6510
+ while(on_next_render.length)on_next_render.pop()();
6511
+ on_next_render.push(()=>dead = true);
6512
+ if (!elements) {
6513
+ set_is_showing_something(false);
6514
+ return;
6515
+ }
6516
+ cards.replaceChildren(...elements);
6517
+ // Dispose the old cards just after the cards have been removed from the DOM
6518
+ cleanup_old_cards.forEach((cleanup_function)=>cleanup_function());
6519
+ cleanup_old_cards.push(dispose_our_cards); // push after calling, so that we don't instantly demolish ourselves lol
6520
+ set_is_showing_something(true);
6521
+ should_stay_inserted?.then((should)=>{
6522
+ if (!should && !dead /* just in case */ ) set_is_showing_something(false);
6523
+ });
6524
+ }));
6525
+ (0, $iBTHO$solidjs.createRenderEffect)(()=>deparallelized_recs_fetcher(search_query_base_()));
6526
+ (0, $iBTHO$solidjs.onCleanup)(()=>cleanup_old_cards.forEach((fn)=>fn())); // if everything gets cleaned up without new cards replacing the old ones, clean up the last cards
6527
+ return (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
6528
+ get when () {
6529
+ return is_showing_something();
6530
+ },
6531
+ children: main_element
6532
+ });
6533
+ }
6534
+ function $fb29c6201c369e39$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
6535
+ const ipns = (0, $iBTHO$depictaiutilishared.async_iterable_ipns)();
6536
+ const rows = {
6537
+ ipns: ipns,
6538
+ start_rows: (0, $iBTHO$solidjs.untrack)(get_showing_recommendation_rows) ?? $fb29c6201c369e39$export$1c8c715550dc689d,
6539
+ rows_per_click: 3,
6540
+ button: (()=>{
6541
+ const _el$4 = $fb29c6201c369e39$var$_tmpl$3.cloneNode(true);
6542
+ (0, $iBTHO$solidjsweb.insert)(_el$4, ()=>i18n_.view_more_());
6543
+ return _el$4;
6544
+ })()
6545
+ };
6546
+ (0, $iBTHO$depictaiutilishared.catchify)(async ()=>{
6547
+ for await (const number of ipns)set_showing_recommendation_rows(number);
6548
+ })();
6549
+ (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$solidjs.on)(get_showing_recommendation_rows, (new_rows = $fb29c6201c369e39$export$1c8c715550dc689d)=>{
6550
+ if (ipns.latest_call_value !== new_rows && ipns.state !== new_rows) ipns(new_rows);
6551
+ }, {
6552
+ defer: true
6553
+ }));
6554
+ return rows;
6555
+ }
6556
+
6557
+
6558
+
6559
+
6560
+
6561
+
6562
+ function $b34ce0b89e6db4e1$export$e026af0c7b64ea5f({ selected_filters_: selected_filters_ , search_query_: [get_search_query] , current_sorting_: current_sorting_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , local_filter_cache_: local_filter_cache_ }) {
6563
+ const [get_selected_filters, set_selected_filters] = selected_filters_;
6564
+ const clear_filters_next_submit_ = (0, $iBTHO$solidjs.createSignal)(false); // we store this here (and not in history.state) (maybe there's a better place) because it's a very temporary thing. I.e. as soon as anything breaks the "flow of intent" to make a new search we want this reset
6565
+ const [get_clear_filters_next_submit, set_clear_filters_next_submit] = clear_filters_next_submit_;
6566
+ const clear_filters = ()=>set_clear_filters_next_submit(true);
6567
+ (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$solidjs.on)(get_selected_filters, ()=>{
6568
+ // if the selected filters update, clear the clearing signal
6569
+ set_clear_filters_next_submit(false);
6570
+ }, {
6571
+ defer: true
6572
+ }));
6573
+ (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$solidjs.on)(get_search_query, (0, $iBTHO$depictaiutilishared.catchify)(()=>{
6574
+ // when a query was submitted, clear filters if clear was pressed before
6575
+ if ((0, $iBTHO$solidjs.untrack)(get_clear_filters_next_submit)) {
6576
+ set_clear_filters_next_submit(false);
6577
+ set_selected_filters([]);
6578
+ // also collapse expanded filters in hierarchical filter tree again
6579
+ expanded_hierarchical_filters_[1]([]);
6580
+ // also clear sorting
6581
+ current_sorting_[1](undefined);
6582
+ (0, $47e2cc552c02110c$export$8895d39404bd2bb1)({
6583
+ user_triggered_: true,
6584
+ selected_filters_: selected_filters_,
6585
+ i18n_: i18n_,
6586
+ also_clear_sorting_: true,
6587
+ current_sorting_: current_sorting_,
6588
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6589
+ local_filter_cache_: local_filter_cache_
6590
+ });
6591
+ }
6592
+ }), {
6593
+ defer: true
6594
+ }));
6595
+ return clear_filters;
6596
+ }
6597
+
6598
+
6599
+
6600
+
6601
+
6602
+ function $2b7a005a65221045$export$84bba84a7b837187(search_query) {
6603
+ const ls = localStorage;
6604
+ const key = "depict_searches";
6605
+ const previous_searches = (0, $iBTHO$solidjs.createSignal)(JSON.parse(ls[key] || "[]"));
6606
+ const [read_previous_searches, write_previous_searches] = previous_searches;
6607
+ const [read_search_query] = search_query;
6608
+ (0, $iBTHO$solidjs.createEffect)((0, $iBTHO$depictaiutilishared.catchify)(()=>{
6609
+ const json_encoded = JSON.stringify(read_previous_searches());
6610
+ if (ls[key] !== json_encoded) ls[key] = json_encoded;
6611
+ }));
6612
+ (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$depictaiutilishared.catchify)(()=>{
6613
+ const searches = (0, $iBTHO$solidjs.untrack)((0, $iBTHO$depictaiutilishared.catchify)(()=>read_previous_searches()));
6614
+ const current_query = read_search_query();
6615
+ if (!current_query) // don't save no query in history
6616
+ return;
6617
+ const new_value = [
6618
+ ...searches.filter((value)=>value !== current_query),
6619
+ current_query
6620
+ ].slice(-30); // keep max 30 values (one could be deleted later because it's the search query), if value we add already exists remove it first
6621
+ write_previous_searches(new_value);
6622
+ }));
6623
+ return previous_searches;
6624
+ }
6625
+
6626
+
6627
+
6628
+
6629
+ function $f328bd45f8ede33c$export$e16630ecb9644a1c({ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ , search_param_name_: search_param_name_ , search_field_value_: [read_field_value, write_field_value] , search_query_: [read_search_query] , url_transformer_: url_transformer_ , on_submit_: on_submit_ = (0, $c8c0cecd8d3d832a$export$26df08e242fe83a3) , after_submit_: after_submit_ }) {
6630
+ const new_search_query = (0, $iBTHO$solidjs.untrack)(read_field_value);
6631
+ const previous_query = (0, $iBTHO$solidjs.untrack)(read_search_query);
6632
+ if (previous_query === new_search_query && new URLSearchParams(location.search).has(search_param_name_)) {
6633
+ // don't push a history entry / re-search if someone submits a search again
6634
+ // do close the modal though
6635
+ on_submit_with_unchanged_value_?.();
6636
+ return;
6637
+ }
6638
+ write_field_value(previous_query); // restore the value to the previous query since this one goes to the new history entry
6639
+ on_submit_(search_param_name_, new_search_query, url_transformer_);
6640
+ write_field_value(new_search_query);
6641
+ scrollTo(0, 0);
6642
+ after_submit_?.();
6643
+ }
6644
+
6645
+
6646
+
6647
+
6648
+ function $b7d0212db218bf0b$export$2542ffb77b620b02(params_to_default_value) {
6649
+ const signals = {};
6650
+ const entries = Object.entries(params_to_default_value);
6651
+ for (const [param, default_value] of entries)signals[param] = (0, $iBTHO$solidjs.createSignal)(default_value ?? "");
6652
+ const [exit_iterable, exitable_iterable] = (0, $iBTHO$depictaiutilishared.make_asyncIterable_exiter)((0, $iBTHO$depictaiutilishared.href_change_ipns));
6653
+ (0, $iBTHO$solidjs.onCleanup)((0, $iBTHO$depictaiutilishared.catchify)(exit_iterable));
6654
+ (0, $iBTHO$depictaiutilishared.catchify)(async ()=>{
6655
+ for await (const href of exitable_iterable){
6656
+ const { searchParams: searchParams } = new URL(href);
6657
+ for (const [param, default_value] of entries){
6658
+ const [_get, set] = signals[param];
6659
+ if (searchParams.has(param)) {
6660
+ const new_val = searchParams.get(param) ?? default_value ?? "";
6661
+ set(new_val);
6662
+ } else set(default_value ?? "");
6663
+ }
6664
+ }
6665
+ })();
6666
+ return signals;
6667
+ }
6668
+
6669
+
6670
+
6671
+
6672
+
6673
+
6674
+
6675
+
6676
+
6677
+
6678
+
6679
+
6680
+
6681
+
6682
+
6683
+
6684
+
6685
+
6686
+
6687
+
6688
+
6689
+
6690
+
6691
+
6692
+
6693
+
6694
+
6695
+
6696
+
6697
+
6698
+ const $6ae613870d3380fc$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="orig price"></span>`, 2), $6ae613870d3380fc$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span></div><div class="price-container"><span class="price"></span></div></div></a>`, 16), $6ae613870d3380fc$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="tagline"></div>`, 2);
6699
+ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n })=>{
6700
+ // Support for Spendrups displays, should probably be in the Spendrups script
6701
+ const display = (0, $iBTHO$solidjs.createMemo)(()=>{
6702
+ const display = display_or_variant_container();
6703
+ if (display.page_url) return display;
6704
+ if (!display?.variants?.length) return;
6705
+ return display.variants.filter((v)=>v.product_id == display.product_id)[0];
6706
+ });
6707
+ const image_url = (0, $iBTHO$solidjs.createMemo)(()=>display().image_url);
6708
+ const contained_image = (0, $iBTHO$solidjs.createMemo)(()=>(0, $iBTHO$depictaiutilishared.ContainedImage)({
6709
+ aspect_ratio: 1,
6710
+ alt: "",
6711
+ // @ts-ignore
6712
+ "data-src": image_url(),
6713
+ srcset_opts: {
6714
+ set_dataset: true
6715
+ },
6716
+ init_with_placeholder: true
6717
+ }));
6718
+ const is_sale = (0, $iBTHO$solidjs.createMemo)(()=>display().sale_price !== display().original_price);
6719
+ const returnVal = (()=>{
6720
+ const _el$ = $6ae613870d3380fc$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
6721
+ (0, $iBTHO$solidjsweb.insert)(_el$2, contained_image);
6722
+ (0, $iBTHO$solidjsweb.insert)(_el$5, ()=>display().brand);
6723
+ (0, $iBTHO$solidjsweb.insert)(_el$6, ()=>display().title);
6724
+ (0, $iBTHO$solidjsweb.insert)(_el$4, (()=>{
6725
+ const _c$ = (0, $iBTHO$solidjsweb.memo)(()=>!!(display().sub_heading_1 || display().sub_heading_2));
6726
+ return ()=>_c$() && (()=>{
6727
+ const _el$10 = $6ae613870d3380fc$var$_tmpl$3.cloneNode(true);
6728
+ (0, $iBTHO$solidjsweb.insert)(_el$10, ()=>[
6729
+ display().sub_heading_1,
6730
+ display().sub_heading_2
6731
+ ].filter((v)=>v).join(" | "));
6732
+ return _el$10;
6733
+ })();
6734
+ })(), null);
6735
+ (0, $iBTHO$solidjsweb.insert)(_el$7, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
6736
+ get when () {
6737
+ return is_sale();
6738
+ },
6739
+ get children () {
6740
+ const _el$8 = $6ae613870d3380fc$var$_tmpl$.cloneNode(true);
6741
+ (0, $iBTHO$solidjsweb.insert)(_el$8, ()=>i18n.price_formatting_().pre_, null);
6742
+ (0, $iBTHO$solidjsweb.insert)(_el$8, ()=>(0, $d659702496cb72ea$export$469c7af753d08925)({
6743
+ price_: (0, $iBTHO$solidjs.createMemo)(()=>display().original_price),
6744
+ price_formatting_: i18n.price_formatting_
6745
+ }), null);
6746
+ (0, $iBTHO$solidjsweb.insert)(_el$8, ()=>i18n.price_formatting_().post_, null);
6747
+ return _el$8;
6748
+ }
6749
+ }), _el$9);
6750
+ (0, $iBTHO$solidjsweb.insert)(_el$9, ()=>i18n.price_formatting_().pre_, null);
6751
+ (0, $iBTHO$solidjsweb.insert)(_el$9, ()=>(0, $d659702496cb72ea$export$469c7af753d08925)({
6752
+ price_: (0, $iBTHO$solidjs.createMemo)(()=>display().sale_price),
6753
+ price_formatting_: i18n.price_formatting_
6754
+ }), null);
6755
+ (0, $iBTHO$solidjsweb.insert)(_el$9, ()=>i18n.price_formatting_().post_, null);
6756
+ (0, $iBTHO$solidjsweb.effect)((_p$)=>{
6757
+ const _v$ = display().page_url, _v$2 = !!is_sale();
6758
+ _v$ !== _p$._v$ && (0, $iBTHO$solidjsweb.setAttribute)(_el$, "href", _p$._v$ = _v$);
6759
+ _v$2 !== _p$._v$2 && _el$9.classList.toggle("sales-price", _p$._v$2 = _v$2);
6760
+ return _p$;
6761
+ }, {
6762
+ _v$: undefined,
6763
+ _v$2: undefined
6764
+ });
6765
+ return _el$;
6766
+ })();
6767
+ // This solves a JSX type issue where the return value does not match with the explicit JSX.Element type for some reason
6768
+ return returnVal;
6769
+ };
6770
+
6771
+
6772
+ const $6ae556e536054e87$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="instant-results"></div>`, 2);
6773
+ function $6ae556e536054e87$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ }) {
6774
+ const max_cards = 4;
6775
+ const [read_current_instant_query, write_current_instant_query] = (0, $iBTHO$solidjs.createSignal)("");
6776
+ let timeout;
6777
+ (0, $iBTHO$solidjs.createComputed)(()=>{
6778
+ const value = get_search_field_value();
6779
+ if (timeout == null) // don't wait if it's the first request
6780
+ write_current_instant_query(value);
6781
+ clearTimeout(timeout);
6782
+ timeout = setTimeout((0, $iBTHO$depictaiutilishared.catchify)(()=>write_current_instant_query(value)), 250);
6783
+ });
6784
+ const [search_results] = (0, $iBTHO$solidjs.createResource)((0, $iBTHO$solidjs.createMemo)(()=>({
6785
+ tenant: tenant_(),
6786
+ market: market_(),
6787
+ query: read_current_instant_query()
6788
+ })), (0, $iBTHO$depictaiutilishared.catchify)((variable_data)=>{
6789
+ return depict_api_.query({
6790
+ // here it is (unfortunately) important that the keys in the object are in the same order as in SearchPage.tsx, because when JSON-encoding them to compare for caching the strings will be different otherwise
6791
+ limit: (0, $iBTHO$solidjs.untrack)(has_sort_or_filters_) ? max_cards : min_products_to_fetch_,
6792
+ // if there's no sorting or filters we can fetch min_products_to_fetch_ many since then the cached request can be re-used by the search page, otherwise, no reason to waste bytes
6793
+ ...variable_data
6794
+ });
6795
+ }));
6796
+ set_num_results_accessor_(()=>(0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
6797
+ search_results_: search_results,
6798
+ i18n_: i18n_
6799
+ }));
6800
+ const sliced_displays = (0, $iBTHO$solidjs.createMemo)(()=>search_results()?.displays?.slice(0, max_cards));
6801
+ let placeholder;
6802
+ const container = (()=>{
6803
+ const _el$ = $6ae556e536054e87$var$_tmpl$.cloneNode(true);
6804
+ (0, $iBTHO$solidjsweb.insert)(_el$, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
6805
+ get when () {
6806
+ return sliced_displays()?.length;
6807
+ },
6808
+ get fallback () {
6809
+ return (0, $iBTHO$solidjs.createMemo)(()=>{
6810
+ if (Array.isArray(search_results()?.displays)) // remove placeholders if we have a response but no results
6811
+ return undefined;
6812
+ return new Array(max_cards).fill(1).map(()=>(placeholder ||= render_instant_card_placeholder_()).cloneNode(true));
6813
+ })();
6814
+ },
6815
+ get children () {
6816
+ return (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Index), {
6817
+ get each () {
6818
+ return sliced_displays();
6819
+ },
6820
+ children: (d, i)=>$6ae556e536054e87$var$track_elements(d, i, // Custom instant card requires a re-render on every display update
6821
+ render_instant_card_ ? (0, $iBTHO$solidjs.createMemo)(()=>render_instant_card_(d(), {
6822
+ index: i,
6823
+ i18n: i18n_,
6824
+ merchant: tenant_(),
6825
+ market: market_()
6826
+ })) : (0, $6ae613870d3380fc$export$b05c0ae390cf3e06)(d, {
6827
+ index: i,
6828
+ i18n: i18n_,
6829
+ merchant: tenant_(),
6830
+ market: market_()
6831
+ }), tenant_, market_)
6832
+ });
6833
+ }
6834
+ }));
6835
+ return _el$;
6529
6836
  })();
6530
6837
  new (0, $iBTHO$depictaiutilishared.Lazyfier)({
6531
6838
  container: container,
@@ -6644,7 +6951,7 @@ function $7b98f0cf558884f7$export$50b90be27d8502d9(el, [get_style_props, set_sty
6644
6951
 
6645
6952
 
6646
6953
 
6647
- function $496cde876b53ce1e$export$91c3b6774e8be0f5({ param_: param_ , value_: value_ , url_transformer_: url_transformer_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , set_search_field_value_: set_search_field_value_ , get_search_query_: get_search_query_ , after_submit_: after_submit_ }) {
6954
+ function $496cde876b53ce1e$export$91c3b6774e8be0f5({ param_: param_ , value_: value_ , url_transformer_: url_transformer_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , set_search_field_value_: set_search_field_value_ , get_search_query_: get_search_query_ , after_submit_: after_submit_ , on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ }) {
6648
6955
  const [read_link, write_link] = (0, $iBTHO$solidjs.createSignal)();
6649
6956
  const [exit_iterable, exitable_iterable] = (0, $iBTHO$depictaiutilishared.make_asyncIterable_exiter)((0, $iBTHO$depictaiutilishared.href_change_ipns));
6650
6957
  (0, $iBTHO$solidjs.onCleanup)(exit_iterable);
@@ -6661,8 +6968,11 @@ function $496cde876b53ce1e$export$91c3b6774e8be0f5({ param_: param_ , value_: va
6661
6968
  if (e.button || e.metaKey || e.ctrlKey) // not button 0 or cmd/ctrl click
6662
6969
  return;
6663
6970
  e.preventDefault();
6664
- if (new URLSearchParams(location.search).get(param_) === value_) // don't do anything if we're already searching for this
6665
- return;
6971
+ if (new URLSearchParams(location.search).get(param_) === value_) {
6972
+ // don't do anything if we're already searching for this
6973
+ on_submit_with_unchanged_value_?.();
6974
+ return;
6975
+ }
6666
6976
  set_search_field_value_((0, $iBTHO$solidjs.untrack)(get_search_query_)); // fill in old query in previous history entry before making new one, like we do in submit_query
6667
6977
  if (typeof alternative_query_submitter_for_spas_ === "function") alternative_query_submitter_for_spas_(param_, value_, url_transformer_);
6668
6978
  else {
@@ -6681,7 +6991,7 @@ function $496cde876b53ce1e$export$91c3b6774e8be0f5({ param_: param_ , value_: va
6681
6991
 
6682
6992
 
6683
6993
  const $9a268bf73b31a717$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="previous-searches"><h2 class="text"></h2><div class="list"></div></div>`, 6), $9a268bf73b31a717$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="item"><div class="left"><span></span></div><button class="delete"></button></a>`, 8);
6684
- function $9a268bf73b31a717$export$a146ac6fa8346a25({ text_: text_ , previous_searches_: previous_searches_ , search_query_param_name_: search_query_param_name_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_unfiltered_previous_searches_: set_unfiltered_previous_searches_ , search_field_value_: search_field_value_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , i18n_: i18n_ , get_search_query_: get_search_query_ , after_submit_: after_submit_ }) {
6994
+ function $9a268bf73b31a717$export$a146ac6fa8346a25({ text_: text_ , previous_searches_: previous_searches_ , search_query_param_name_: search_query_param_name_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_unfiltered_previous_searches_: set_unfiltered_previous_searches_ , search_field_value_: search_field_value_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , i18n_: i18n_ , get_search_query_: get_search_query_ , after_submit_: after_submit_ , on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ }) {
6685
6995
  const has_entries = (0, $iBTHO$solidjs.createMemo)(()=>previous_searches_().length >= 1);
6686
6996
  currently_showing_suggestions_[1]((value)=>{
6687
6997
  value[0] = (0, $iBTHO$solidjs.createMemo)(()=>previous_searches_().map((result)=>({
@@ -6714,7 +7024,8 @@ function $9a268bf73b31a717$export$a146ac6fa8346a25({ text_: text_ , previous_sea
6714
7024
  alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
6715
7025
  set_search_field_value_: search_field_value_[1],
6716
7026
  get_search_query_: get_search_query_,
6717
- after_submit_: after_submit_
7027
+ after_submit_: after_submit_,
7028
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
6718
7029
  }));
6719
7030
  return (()=>{
6720
7031
  const _el$4 = $9a268bf73b31a717$var$_tmpl$2.cloneNode(true), _el$5 = _el$4.firstChild, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling;
@@ -6842,8 +7153,8 @@ function $d023ed916c84e75d$export$ba17c5b7e6dda39f({ whole_text_to_display_: who
6842
7153
  }
6843
7154
 
6844
7155
 
6845
- const $6b65ba8af12c5a26$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="suggestion"></a>`, 2), $6b65ba8af12c5a26$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="search-icon"></div>`, 2), $6b65ba8af12c5a26$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="type"></span>`, 2), $6b65ba8af12c5a26$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div><span class="value"></span></div>`, 4), $6b65ba8af12c5a26$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<h2 class="text"></h2>`, 2), $6b65ba8af12c5a26$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="suggestion_container query"></div>`, 2), $6b65ba8af12c5a26$var$_tmpl$7 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="suggestion_container page"></div>`, 2), $6b65ba8af12c5a26$var$_tmpl$8 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="suggestions"></div>`, 2);
6846
- function $6b65ba8af12c5a26$export$e872e2339fb04a7f({ suggestion_memo_: suggestion_memo_ , search_field_value_: search_field_value_ , search_page_url_param_name_: search_page_url_param_name_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , filtered_previous_searches_: filtered_previous_searches_ , currently_showing_suggestions_: currently_showing_suggestions_ , on_previous_searches_page_: on_previous_searches_page_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , searching_for_value_: searching_for_value_ , get_search_query_: get_search_query_ , after_submit_: after_submit_ }) {
7156
+ const $6b65ba8af12c5a26$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="suggestion"></a>`, 2), $6b65ba8af12c5a26$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="search-icon"></div>`, 2), $6b65ba8af12c5a26$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="type"></span>`, 2), $6b65ba8af12c5a26$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div><span class="value"></span></div>`, 4), $6b65ba8af12c5a26$var$_tmpl$5 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<h2 class="text"></h2>`, 2), $6b65ba8af12c5a26$var$_tmpl$6 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="suggestion-container query"></div>`, 2), $6b65ba8af12c5a26$var$_tmpl$7 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="suggestion-container page"></div>`, 2), $6b65ba8af12c5a26$var$_tmpl$8 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="suggestions"></div>`, 2);
7157
+ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({ suggestion_memo_: suggestion_memo_ , search_field_value_: search_field_value_ , search_page_url_param_name_: search_page_url_param_name_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , filtered_previous_searches_: filtered_previous_searches_ , currently_showing_suggestions_: currently_showing_suggestions_ , on_previous_searches_page_: on_previous_searches_page_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , searching_for_value_: searching_for_value_ , get_search_query_: get_search_query_ , after_submit_: after_submit_ , navigate_page_to_href_: navigate_page_to_href_ , on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ }) {
6847
7158
  const queries_memo = (0, $iBTHO$solidjs.createMemo)(()=>suggestion_memo_().filter(({ type: type , title: title })=>type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
6848
7159
  ));
6849
7160
  const not_queries_memo = (0, $iBTHO$solidjs.createMemo)(()=>suggestion_memo_().filter(({ type: type })=>type !== (0, $3ec9e21d6b6debdd$export$3cf9497e790da491)));
@@ -6856,7 +7167,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({ suggestion_memo_: suggestio
6856
7167
  alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
6857
7168
  get_search_query_: get_search_query_,
6858
7169
  set_search_field_value_: search_field_value_[1],
6859
- after_submit_: after_submit_
7170
+ after_submit_: after_submit_,
7171
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
6860
7172
  }) : undefined);
6861
7173
  const [href, set_href] = (0, $iBTHO$solidjs.createSignal)();
6862
7174
  (0, $iBTHO$solidjs.createComputed)(()=>{
@@ -6869,6 +7181,14 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({ suggestion_memo_: suggestio
6869
7181
  (0, $iBTHO$solidjsweb.use)((element)=>element.addEventListener("click", (0, $iBTHO$depictaiutilishared.catchify)((ev)=>{
6870
7182
  // Viskan's Oscar Jacobson site requires us to add the event listener normally here. They do too much when this element is clicked. We work around it by blocking the event and just dispatching it non-bubbling on this element.
6871
7183
  if (is_query()) return param_change_obj().on_click_handler_(ev);
7184
+ else if (navigate_page_to_href_) {
7185
+ // single page navigate to category suggestions if enabled
7186
+ // object should have a href where we want to go
7187
+ if (ev.button || ev.metaKey || ev.ctrlKey) // not button 0 or cmd/ctrl click
7188
+ return;
7189
+ ev.preventDefault();
7190
+ navigate_page_to_href_(input_obj().page_url);
7191
+ }
6872
7192
  })), _el$);
6873
7193
  (0, $iBTHO$solidjsweb.addEventListener)(_el$, "mouseleave", (0, $iBTHO$depictaiutilishared.catchify)(()=>write_selected_index_(undefined)));
6874
7194
  (0, $iBTHO$solidjsweb.addEventListener)(_el$, "mouseenter", (0, $iBTHO$depictaiutilishared.catchify)(()=>write_selected_index_([
@@ -7043,6 +7363,9 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({ suggestion_memo_: suggestio
7043
7363
 
7044
7364
 
7045
7365
 
7366
+
7367
+
7368
+ const $6a374b16bfe947d0$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a target="_blank"></a>`, 2);
7046
7369
  function $6a374b16bfe947d0$export$217899a935ef803b({ selected_index_: [read_selected_index, write_selected_index] , currently_showing_suggestions_: [read_currently_showing_suggestions] , ...rest_of_props }) {
7047
7370
  const last_suggestion_index_ = (0, $iBTHO$solidjs.createMemo)(()=>{
7048
7371
  const currently_showing_suggestions = read_currently_showing_suggestions();
@@ -7097,7 +7420,7 @@ function $6a374b16bfe947d0$export$217899a935ef803b({ selected_index_: [read_sele
7097
7420
  write_selected_fake_index_: write_selected_fake_index_
7098
7421
  });
7099
7422
  }
7100
- function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({ element_: element_ , search_field_value_: [get_search_field_value, set_search_field_value] , updating_blocked_: [read_updating_blocked, write_updating_blocked] , last_suggestion_index_: last_suggestion_index_ , read_selected_fake_index_: read_selected_fake_index_ , write_selected_fake_index_: write_selected_fake_index_ , set_override_on_enter_fn_: set_override_on_enter_fn_ }) {
7423
+ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({ element_: element_ , search_field_value_: [get_search_field_value, set_search_field_value] , updating_blocked_: [read_updating_blocked, write_updating_blocked] , last_suggestion_index_: last_suggestion_index_ , read_selected_fake_index_: read_selected_fake_index_ , write_selected_fake_index_: write_selected_fake_index_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , navigate_page_to_href_: navigate_page_to_href_ , url_transformer_: url_transformer_ , search_query_param_name_: search_query_param_name_ }) {
7101
7424
  let previous_value;
7102
7425
  (0, $iBTHO$solidjs.createEffect)(()=>{
7103
7426
  const sfv = get_search_field_value();
@@ -7119,21 +7442,37 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({ element_
7119
7442
  calls++;
7120
7443
  });
7121
7444
  };
7122
- // update text field value if needed
7123
- if (selected_entry?.type == "query") {
7124
- block_updating_for_one_change();
7125
- set_search_field_value(selected_entry.title);
7126
- } else if (selected_entry?.type == "category") {
7127
- set_override_on_enter_fn_(()=>{
7128
- location.href = selected_entry.page_url;
7129
- return true;
7130
- });
7445
+ const override_on_enter_for_this_entry = (new_fn)=>{
7446
+ set_override_on_enter_fn_(new_fn);
7447
+ // Only override while this item has been selected with the keyboard
7131
7448
  (0, $iBTHO$solidjs.createComputed)((run)=>{
7132
7449
  if (!run) read_selected_fake_index_();
7133
7450
  else set_override_on_enter_fn_(()=>false);
7134
7451
  return run + 1;
7135
7452
  }, 0);
7136
- } else {
7453
+ };
7454
+ // update text field value if needed
7455
+ if (selected_entry?.type == "query") {
7456
+ const { title: title } = selected_entry;
7457
+ block_updating_for_one_change();
7458
+ set_search_field_value(title);
7459
+ override_on_enter_for_this_entry((e)=>{
7460
+ // Open search query in new tab on cmd+enter
7461
+ const url = new URL(location);
7462
+ url_transformer_?.(url);
7463
+ url.searchParams.set(search_query_param_name_, title);
7464
+ return $6a374b16bfe947d0$var$open_link_on_cmd_pressed(e, url.href);
7465
+ });
7466
+ } else if (selected_entry?.type == "category") override_on_enter_for_this_entry((e)=>{
7467
+ const { page_url: page_url } = selected_entry;
7468
+ if (!$6a374b16bfe947d0$var$open_link_on_cmd_pressed(e, page_url)) {
7469
+ // Above fn will return true if it opened a new tab, and we won't make these checks anymore
7470
+ if (navigate_page_to_href_) navigate_page_to_href_(page_url);
7471
+ else location.href = page_url;
7472
+ }
7473
+ return true;
7474
+ });
7475
+ else if (!selected_entry) {
7137
7476
  block_updating_for_one_change();
7138
7477
  set_search_field_value(previous_value);
7139
7478
  }
@@ -7145,10 +7484,25 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({ element_
7145
7484
  (0, $iBTHO$solidjs.onCleanup)((0, $iBTHO$depictaiutilishared.catchify)(()=>el.removeEventListener("keyup", handler)));
7146
7485
  });
7147
7486
  }
7487
+ function $6a374b16bfe947d0$var$open_link_on_cmd_pressed(e, href) {
7488
+ if (e.metaKey || e.ctrlKey) {
7489
+ // Open link in a new tab with cmd/ctrl + enter.
7490
+ const link = (()=>{
7491
+ const _el$ = $6a374b16bfe947d0$var$_tmpl$.cloneNode(true);
7492
+ (0, $iBTHO$solidjsweb.setAttribute)(_el$, "href", href);
7493
+ return _el$;
7494
+ })();
7495
+ document.body.append(link);
7496
+ link.click();
7497
+ link.remove();
7498
+ return true;
7499
+ }
7500
+ return false;
7501
+ }
7148
7502
 
7149
7503
 
7150
7504
  const $3ec9e21d6b6debdd$export$3cf9497e790da491 = "query";
7151
- function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({ search_field_value_: search_field_value_ , search_query_: [get_search_query_] , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: unfiltered_previous_searches , previous_searches_text_: previous_searches_text_ , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , input_field_: input_field_ , url_transformer_: url_transformer_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , selected_index_: selected_index_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , after_submit_: after_submit_ }) {
7505
+ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({ search_field_value_: search_field_value_ , search_query_: [get_search_query_] , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: unfiltered_previous_searches , previous_searches_text_: previous_searches_text_ , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , input_field_: input_field_ , url_transformer_: url_transformer_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , selected_index_: selected_index_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , after_submit_: after_submit_ , navigate_page_to_href_: navigate_page_to_href_ , on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ }) {
7152
7506
  const [searching_for_value, set_searching_for_value] = (0, $iBTHO$solidjs.createSignal)();
7153
7507
  const [read_search_field_value] = search_field_value_;
7154
7508
  const updating_blocked = (0, $iBTHO$solidjs.createSignal)(false);
@@ -7188,7 +7542,10 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({ search_field_value_: search
7188
7542
  search_field_value_: search_field_value_,
7189
7543
  updating_blocked_: updating_blocked,
7190
7544
  currently_showing_suggestions_: currently_showing_suggestions_,
7191
- set_override_on_enter_fn_: set_override_on_enter_fn_
7545
+ set_override_on_enter_fn_: set_override_on_enter_fn_,
7546
+ search_query_param_name_: search_page_url_param_name_,
7547
+ url_transformer_: url_transformer_,
7548
+ navigate_page_to_href_: navigate_page_to_href_
7192
7549
  });
7193
7550
  return [
7194
7551
  (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
@@ -7212,7 +7569,8 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({ search_field_value_: search
7212
7569
  url_transformer_: url_transformer_,
7213
7570
  get_search_query_: get_search_query_,
7214
7571
  alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
7215
- after_submit_: after_submit_
7572
+ after_submit_: after_submit_,
7573
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
7216
7574
  });
7217
7575
  }
7218
7576
  }),
@@ -7239,7 +7597,9 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({ search_field_value_: search
7239
7597
  currently_showing_suggestions_: currently_showing_suggestions_,
7240
7598
  get_search_query_: get_search_query_,
7241
7599
  include_category_suggestions_: include_category_suggestions_,
7242
- after_submit_: after_submit_
7600
+ after_submit_: after_submit_,
7601
+ navigate_page_to_href_: navigate_page_to_href_,
7602
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
7243
7603
  })
7244
7604
  ];
7245
7605
  }
@@ -7301,8 +7661,33 @@ function $036d367ce3058351$export$3340fdd8259bd4fd({ get_search_field_value_: ge
7301
7661
  }
7302
7662
 
7303
7663
 
7304
- const $f40a47a30a358305$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $f40a47a30a358305$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<b></b>`, 2), $f40a47a30a358305$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $f40a47a30a358305$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div id="depict-override" class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
7305
- function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search_field_value_ , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $iBTHO$solidjs.createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: submit_query_ , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , after_submit_: after_submit_ , bottom_distance_under_modal_: bottom_distance_under_modal_ }) {
7664
+
7665
+
7666
+
7667
+ const $f978ab22f3df4bd7$export$af8311b651139246 = (css_properties)=>{
7668
+ return Object.entries(css_properties).map(([key, value])=>`${key}: ${value};`).join(" ");
7669
+ };
7670
+ const $f978ab22f3df4bd7$export$1233ca167bf71f9a = (styles)=>{
7671
+ return Object.entries(styles).map(([selector, css_properties])=>`${selector} { ${$f978ab22f3df4bd7$export$af8311b651139246(css_properties)} }`).join(" ");
7672
+ };
7673
+
7674
+
7675
+
7676
+ const $b776f25acdda22eb$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<style></style>`, 2);
7677
+ function $b776f25acdda22eb$export$f021bdedd3ec901a(props) {
7678
+ const valid_css_string = (0, $iBTHO$solidjs.createMemo)(()=>{
7679
+ return (0, $f978ab22f3df4bd7$export$1233ca167bf71f9a)(props.styles());
7680
+ });
7681
+ return (()=>{
7682
+ const _el$ = $b776f25acdda22eb$var$_tmpl$.cloneNode(true);
7683
+ (0, $iBTHO$solidjsweb.insert)(_el$, valid_css_string);
7684
+ return _el$;
7685
+ })();
7686
+ }
7687
+
7688
+
7689
+ const $f40a47a30a358305$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $f40a47a30a358305$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<b></b>`, 2), $f40a47a30a358305$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $f40a47a30a358305$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
7690
+ function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search_field_value_ , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $iBTHO$solidjs.createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: submit_query_ , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , after_submit_: after_submit_ , bottom_distance_under_modal_: bottom_distance_under_modal_ , navigate_page_to_href_: navigate_page_to_href_ , on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ }) {
7306
7691
  let on_enter_in_query_input_function;
7307
7692
  const [input_field, set_input_field] = (0, $iBTHO$solidjs.createSignal)();
7308
7693
  const [get_search_field_value_] = search_field_value_;
@@ -7343,6 +7728,12 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search
7343
7728
  search_page_url_param_name_: search_page_url_param_name_,
7344
7729
  get_search_query_: search_query_[0]
7345
7730
  });
7731
+ const random_classname = (0, $iBTHO$depictaiutilishared.make_random_classname)();
7732
+ const body_style = (0, $iBTHO$solidjs.createMemo)(()=>{
7733
+ return {
7734
+ [`.depict .${random_classname}`]: style_props_[0]()
7735
+ };
7736
+ });
7346
7737
  const modal_element = (()=>{
7347
7738
  const _el$4 = $f40a47a30a358305$var$_tmpl$3.cloneNode(true), _el$5 = _el$4.firstChild, _el$6 = _el$5.firstChild;
7348
7739
  (0, $iBTHO$solidjsweb.addEventListener)(_el$4, "click", (0, $iBTHO$depictaiutilishared.catchify)(({ target: target })=>{
@@ -7382,7 +7773,9 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search
7382
7773
  url_transformer_: url_transformer_,
7383
7774
  i18n_: i18n_,
7384
7775
  include_category_suggestions_: enable_category_suggestions_ ?? true,
7385
- after_submit_: after_submit_
7776
+ after_submit_: after_submit_,
7777
+ navigate_page_to_href_: navigate_page_to_href_,
7778
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
7386
7779
  });
7387
7780
  }
7388
7781
  }), null);
@@ -7403,7 +7796,12 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search
7403
7796
  }), null);
7404
7797
  (0, $iBTHO$solidjsweb.insert)(_el$6, elements_inside_scrollable, null);
7405
7798
  (0, $iBTHO$solidjsweb.insert)(_el$5, elements_outside_scrollable, null);
7406
- (0, $iBTHO$solidjsweb.effect)((_$p)=>(0, $iBTHO$solidjsweb.style)(_el$5, style_props_[0](), _$p));
7799
+ (0, $iBTHO$solidjsweb.insert)(_el$4, (0, $iBTHO$solidjsweb.createComponent)((0, $b776f25acdda22eb$export$f021bdedd3ec901a), {
7800
+ styles: body_style
7801
+ }), null);
7802
+ (0, $iBTHO$solidjsweb.effect)((_$p)=>(0, $iBTHO$solidjsweb.classList)(_el$5, {
7803
+ [random_classname]: true
7804
+ }, _$p));
7407
7805
  return _el$4;
7408
7806
  })();
7409
7807
  return [
@@ -7411,7 +7809,15 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search
7411
7809
  const _el$7 = $f40a47a30a358305$var$_tmpl$4.cloneNode(true), _el$8 = _el$7.firstChild;
7412
7810
  (0, $iBTHO$solidjsweb.addEventListener)(_el$8, "click", close_modal_, true);
7413
7811
  (0, $iBTHO$solidjsweb.insert)(_el$7, modal_element, null);
7414
- (0, $iBTHO$solidjsweb.effect)((_$p)=>(0, $iBTHO$solidjsweb.classList)(_el$7, class_list_?.(), _$p));
7812
+ (0, $iBTHO$solidjsweb.effect)((_p$)=>{
7813
+ const _v$ = (0, $0b6e2070a98de347$export$44dad306455dddf).SEARCH_MODAL, _v$2 = class_list_?.();
7814
+ _v$ !== _p$._v$ && (0, $iBTHO$solidjsweb.setAttribute)(_el$7, "id", _p$._v$ = _v$);
7815
+ _p$._v$2 = (0, $iBTHO$solidjsweb.classList)(_el$7, _v$2, _p$._v$2);
7816
+ return _p$;
7817
+ }, {
7818
+ _v$: undefined,
7819
+ _v$2: undefined
7820
+ });
7415
7821
  return _el$7;
7416
7822
  })()
7417
7823
  ];
@@ -7458,6 +7864,8 @@ function $f40a47a30a358305$var$close_modal_when_navigating_away(close_modal, sea
7458
7864
 
7459
7865
 
7460
7866
 
7867
+
7868
+
7461
7869
  const $04048c1bef16c249$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="category-suggestions"></div>`, 2), $04048c1bef16c249$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="category-suggestion"></div>`, 2);
7462
7870
  function $04048c1bef16c249$export$c05a196222ba1302({ suggestions_: suggestions_ , children: children , selected_filters_: selected_filters_ , slider_arrow_button_: slider_arrow_button_ }) {
7463
7871
  const category_suggestions_ = (0, $iBTHO$solidjs.createMemo)(()=>suggestions_()?.suggestions.filter((s)=>s.type === "category"));
@@ -7510,130 +7918,6 @@ function $04048c1bef16c249$export$c05a196222ba1302({ suggestions_: suggestions_
7510
7918
 
7511
7919
 
7512
7920
 
7513
- const $fb29c6201c369e39$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="cards"></div>`, 2), $fb29c6201c369e39$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="search-recs"><h3 class="search-recs-title"></h3></div>`, 4), $fb29c6201c369e39$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<button class="show_more major" type="button"></button>`, 2);
7514
- const $fb29c6201c369e39$export$1c8c715550dc689d = 2;
7515
- function $fb29c6201c369e39$export$7de92c4c2205ebf3({ depict_api_: depict_api_ , i18n_: i18n_ , tenant_object_: tenant_object_ , search_query_base_: search_query_base_ , rr_options_: rr_options_ , showing_recommendation_rows_: showing_recommendation_rows_ , view_more_button_: view_more_button_ = true , layout_options_: layout_options_ }) {
7516
- const [is_showing_something, set_is_showing_something] = (0, $iBTHO$solidjs.createSignal)(false);
7517
- const cards = $fb29c6201c369e39$var$_tmpl$.cloneNode(true);
7518
- const on_next_render = [];
7519
- const main_element = (()=>{
7520
- const _el$2 = $fb29c6201c369e39$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
7521
- (0, $iBTHO$solidjsweb.insert)(_el$3, ()=>i18n_.search_recs_title_());
7522
- (0, $iBTHO$solidjsweb.insert)(_el$2, cards, null);
7523
- return _el$2;
7524
- })();
7525
- const [get_showing_recommendation_rows] = showing_recommendation_rows_;
7526
- const rows_object = view_more_button_ ? $fb29c6201c369e39$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
7527
- const cleanup_old_cards = [];
7528
- (0, $iBTHO$depictaiutilishared.Layout)({
7529
- container_element: cards,
7530
- layout: "grid",
7531
- rows: rows_object,
7532
- ...layout_options_
7533
- }).catch((e)=>(0, $iBTHO$depictaiutilishared.report)([
7534
- e,
7535
- "Layout failed"
7536
- ], "error"));
7537
- // copied from RecommendationGrid
7538
- // convoluted lazy loading that
7539
- // when the elements are in the DOM starts IntersectionObserver on whole grid
7540
- // when grid intersects starts Lazyfier
7541
- // this is because Lazyfier is fucking stupid
7542
- (0, $iBTHO$depictaiutilishared.observer).wait_for_element(cards).then((0, $iBTHO$depictaiutilishared.catchify)((element)=>{
7543
- let start_lazy_loading;
7544
- const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
7545
- const lf = new (0, $iBTHO$depictaiutilishared.Lazyfier)({
7546
- only_load_intersecting: true,
7547
- wait_for_dominsertion: lazy_loading_promise,
7548
- ignore_data_urls: true,
7549
- lazyfinder: {
7550
- unload () {}
7551
- }
7552
- });
7553
- lf.start_observing_for_new_children_(element);
7554
- const i_o = new IntersectionObserver((0, $iBTHO$depictaiutilishared.catchify)((records)=>{
7555
- for (const record of records)if (record.intersectionRatio > 0) {
7556
- start_lazy_loading();
7557
- i_o.disconnect();
7558
- return;
7559
- }
7560
- }));
7561
- i_o.observe(cards);
7562
- }));
7563
- const deparallelized_recs_fetcher = (0, $iBTHO$depictaiutilishared.deparallelize_no_drop)((0, $iBTHO$depictaiutilishared.catchify)(async (base_query)=>{
7564
- const recs_promise = depict_api_.get_recommended(base_query).then((r)=>r.displays);
7565
- // create owner to run product cards with an Owner, so they know when they've gotten removed
7566
- const [owner_for_cards, dispose_our_cards] = (0, $iBTHO$solidjs.createRoot)((dispose)=>[
7567
- (0, $iBTHO$solidjs.getOwner)(),
7568
- dispose
7569
- ]);
7570
- const rendering_result = await (await (0, $iBTHO$depictaiutilishared.make_placeholder_rr)({
7571
- // render the max amount of elements that there could be, to make sure scroll restoration works (placeholders can't be shorter than actual content)
7572
- num_items: (0, $aec24316ed262dc0$export$6c9030e511152266) + (0, $iBTHO$solidjs.untrack)(get_showing_recommendation_rows) * Math.max(...layout_options_.cols_at_size.map(([per_column])=>per_column))
7573
- }))(tenant_object_, {
7574
- type: "search_recs",
7575
- recs: recs_promise,
7576
- ...rr_options_,
7577
- ...typeof rr_options_.template === "function" ? {
7578
- template: (...args)=>(0, $iBTHO$solidjs.runWithOwner)(owner_for_cards, ()=>// give template the possibility to know when it gets removed from the DOM by using solid-js onCleanup
7579
- rr_options_.template(...args))
7580
- } : {}
7581
- });
7582
- const { elements: elements , should_stay_inserted: should_stay_inserted } = rendering_result;
7583
- let dead = false;
7584
- while(on_next_render.length)on_next_render.pop()();
7585
- on_next_render.push(()=>dead = true);
7586
- if (!elements) {
7587
- set_is_showing_something(false);
7588
- return;
7589
- }
7590
- cards.replaceChildren(...elements);
7591
- // Dispose the old cards just after the cards have been removed from the DOM
7592
- cleanup_old_cards.forEach((cleanup_function)=>cleanup_function());
7593
- cleanup_old_cards.push(dispose_our_cards); // push after calling, so that we don't instantly demolish ourselves lol
7594
- set_is_showing_something(true);
7595
- should_stay_inserted?.then((should)=>{
7596
- if (!should && !dead /* just in case */ ) set_is_showing_something(false);
7597
- });
7598
- }));
7599
- (0, $iBTHO$solidjs.createRenderEffect)(()=>deparallelized_recs_fetcher(search_query_base_()));
7600
- (0, $iBTHO$solidjs.onCleanup)(()=>cleanup_old_cards.forEach((fn)=>fn())); // if everything gets cleaned up without new cards replacing the old ones, clean up the last cards
7601
- return (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
7602
- get when () {
7603
- return is_showing_something();
7604
- },
7605
- children: main_element
7606
- });
7607
- }
7608
- function $fb29c6201c369e39$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
7609
- const ipns = (0, $iBTHO$depictaiutilishared.async_iterable_ipns)();
7610
- const rows = {
7611
- ipns: ipns,
7612
- start_rows: (0, $iBTHO$solidjs.untrack)(get_showing_recommendation_rows) ?? $fb29c6201c369e39$export$1c8c715550dc689d,
7613
- rows_per_click: 3,
7614
- button: (()=>{
7615
- const _el$4 = $fb29c6201c369e39$var$_tmpl$3.cloneNode(true);
7616
- (0, $iBTHO$solidjsweb.insert)(_el$4, ()=>i18n_.view_more_());
7617
- return _el$4;
7618
- })()
7619
- };
7620
- (0, $iBTHO$depictaiutilishared.catchify)(async ()=>{
7621
- for await (const number of ipns)set_showing_recommendation_rows(number);
7622
- })();
7623
- (0, $iBTHO$solidjs.createComputed)((0, $iBTHO$solidjs.on)(get_showing_recommendation_rows, (new_rows = $fb29c6201c369e39$export$1c8c715550dc689d)=>{
7624
- if (ipns.latest_call_value !== new_rows && ipns.state !== new_rows) ipns(new_rows);
7625
- }, {
7626
- defer: true
7627
- }));
7628
- return rows;
7629
- }
7630
-
7631
-
7632
-
7633
-
7634
-
7635
-
7636
-
7637
7921
 
7638
7922
 
7639
7923
  const $65a0c4b1c2eb5d0b$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<b></b>`, 2), $65a0c4b1c2eb5d0b$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="results-for"></div>`, 2);
@@ -7663,6 +7947,7 @@ function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({ search_query_: search_query
7663
7947
 
7664
7948
 
7665
7949
 
7950
+
7666
7951
  const $f1d7cb69f839a526$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $f1d7cb69f839a526$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp search"><div class="listing-page"></div></div>`, 4);
7667
7952
  function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
7668
7953
  const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , search_query_: search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , rr_options_: rr_options_ , recommendations_rr_options_: recommendations_rr_options_ = rr_options_ , search_recs_view_more_: search_recs_view_more_ , get_product_id_: get_product_id_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ } = opts;
@@ -7820,7 +8105,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
7820
8105
  tenant_object_.market = tenant_object_.MARKET = market_();
7821
8106
  });
7822
8107
  return [
7823
- document.createComment("Depict.ai frontend integrated search page"),
8108
+ document.createComment("Search page based on Depict SDK"),
7824
8109
  (()=>{
7825
8110
  const _el$2 = $f1d7cb69f839a526$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
7826
8111
  (0, $iBTHO$solidjsweb.insert)(_el$3, input_field, null);
@@ -7940,6 +8225,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
7940
8225
  });
7941
8226
  }
7942
8227
  }), null);
8228
+ (0, $iBTHO$solidjsweb.effect)(()=>(0, $iBTHO$solidjsweb.setAttribute)(_el$2, "id", (0, $0b6e2070a98de347$export$44dad306455dddf).SEARCH_PAGE));
7943
8229
  return _el$2;
7944
8230
  })()
7945
8231
  ];
@@ -7948,125 +8234,6 @@ function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
7948
8234
 
7949
8235
 
7950
8236
 
7951
-
7952
-
7953
-
7954
-
7955
-
7956
-
7957
-
7958
-
7959
-
7960
- const $ad63d2a35e827266$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="orig price"></span>`, 2), $ad63d2a35e827266$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="instant-card"><div class="img_part"></div><div class="right_part"><div class="title_brand_tagline"><span class="brand"></span><span class="title"></span></div><div class="price_container"><span class="price"></span></div></div></a>`, 16), $ad63d2a35e827266$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="tagline"></div>`, 2);
7961
- function $ad63d2a35e827266$export$3b5becc25bbaed73(display_or_variant_container, _index, get_fake_rendering_options, i18n_) {
7962
- // Support for Spendrups displays, should probably be in the Spendrups script
7963
- const display = (0, $iBTHO$solidjs.createMemo)(()=>{
7964
- const display = display_or_variant_container();
7965
- if (display.page_url) return display;
7966
- if (!display?.variants?.length) return;
7967
- return display.variants.filter((v)=>v.product_id == display.product_id)[0];
7968
- });
7969
- const image_url = (0, $iBTHO$solidjs.createMemo)(()=>display().image_url);
7970
- const contained_image = (0, $iBTHO$solidjs.createMemo)(()=>(0, $iBTHO$depictaiutilishared.ContainedImage)({
7971
- aspect_ratio: 1,
7972
- alt: "",
7973
- // @ts-ignore
7974
- "data-src": image_url(),
7975
- rendering_options: (0, $iBTHO$solidjs.untrack)(()=>get_fake_rendering_options()),
7976
- srcset_opts: {
7977
- set_dataset: true
7978
- },
7979
- init_with_placeholder: true
7980
- }));
7981
- const is_sale = (0, $iBTHO$solidjs.createMemo)(()=>display().sale_price !== display().original_price);
7982
- return (()=>{
7983
- const _el$ = $ad63d2a35e827266$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
7984
- (0, $iBTHO$solidjsweb.insert)(_el$2, contained_image);
7985
- (0, $iBTHO$solidjsweb.insert)(_el$5, ()=>display().brand);
7986
- (0, $iBTHO$solidjsweb.insert)(_el$6, ()=>display().title);
7987
- (0, $iBTHO$solidjsweb.insert)(_el$4, ()=>display().sub_heading_1 || display().sub_heading_2 && (()=>{
7988
- const _el$10 = $ad63d2a35e827266$var$_tmpl$3.cloneNode(true);
7989
- (0, $iBTHO$solidjsweb.insert)(_el$10, ()=>[
7990
- display().sub_heading_1,
7991
- display().sub_heading_2
7992
- ].filter((v)=>v).join(" | "));
7993
- return _el$10;
7994
- })(), null);
7995
- (0, $iBTHO$solidjsweb.insert)(_el$7, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
7996
- get when () {
7997
- return is_sale();
7998
- },
7999
- get children () {
8000
- const _el$8 = $ad63d2a35e827266$var$_tmpl$.cloneNode(true);
8001
- (0, $iBTHO$solidjsweb.insert)(_el$8, ()=>i18n_.price_formatting_().pre_, null);
8002
- (0, $iBTHO$solidjsweb.insert)(_el$8, ()=>(0, $d659702496cb72ea$export$469c7af753d08925)({
8003
- price_: (0, $iBTHO$solidjs.createMemo)(()=>display().original_price),
8004
- price_formatting_: i18n_.price_formatting_
8005
- }), null);
8006
- (0, $iBTHO$solidjsweb.insert)(_el$8, ()=>i18n_.price_formatting_().post_, null);
8007
- return _el$8;
8008
- }
8009
- }), _el$9);
8010
- (0, $iBTHO$solidjsweb.insert)(_el$9, ()=>i18n_.price_formatting_().pre_, null);
8011
- (0, $iBTHO$solidjsweb.insert)(_el$9, ()=>(0, $d659702496cb72ea$export$469c7af753d08925)({
8012
- price_: (0, $iBTHO$solidjs.createMemo)(()=>display().sale_price),
8013
- price_formatting_: i18n_.price_formatting_
8014
- }), null);
8015
- (0, $iBTHO$solidjsweb.insert)(_el$9, ()=>i18n_.price_formatting_().post_, null);
8016
- (0, $iBTHO$solidjsweb.effect)((_p$)=>{
8017
- const _v$ = display().page_url, _v$2 = !!is_sale();
8018
- _v$ !== _p$._v$ && (0, $iBTHO$solidjsweb.setAttribute)(_el$, "href", _p$._v$ = _v$);
8019
- _v$2 !== _p$._v$2 && _el$9.classList.toggle("sales_price", _p$._v$2 = _v$2);
8020
- return _p$;
8021
- }, {
8022
- _v$: undefined,
8023
- _v$2: undefined
8024
- });
8025
- return _el$;
8026
- })();
8027
- }
8028
-
8029
-
8030
-
8031
-
8032
-
8033
-
8034
-
8035
-
8036
-
8037
-
8038
-
8039
-
8040
-
8041
- const $dae23104ba8bb78c$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="parent_title"></span>`, 2), $dae23104ba8bb78c$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="category-suggestion"><span class="title"></span></a>`, 4);
8042
- function $dae23104ba8bb78c$export$d757d54550ebfb3d({ category_suggestion_: category_suggestion_ , on_navigation_: on_navigation_ }) {
8043
- return (()=>{
8044
- const _el$ = $dae23104ba8bb78c$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild;
8045
- (0, $iBTHO$solidjsweb.addEventListener)(_el$, "click", (0, $iBTHO$depictaiutilishared.catchify)((e)=>{
8046
- if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
8047
- return;
8048
- return on_navigation_?.(category_suggestion_().page_url);
8049
- }), true);
8050
- (0, $iBTHO$solidjsweb.insert)(_el$2, ()=>category_suggestion_().title);
8051
- (0, $iBTHO$solidjsweb.insert)(_el$, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
8052
- get when () {
8053
- return typeof category_suggestion_().parent_title === "string";
8054
- },
8055
- get children () {
8056
- const _el$3 = $dae23104ba8bb78c$var$_tmpl$.cloneNode(true);
8057
- (0, $iBTHO$solidjsweb.insert)(_el$3, ()=>category_suggestion_().parent_title);
8058
- return _el$3;
8059
- }
8060
- }), null);
8061
- (0, $iBTHO$solidjsweb.effect)(()=>(0, $iBTHO$solidjsweb.setAttribute)(_el$, "href", category_suggestion_().page_url));
8062
- return _el$;
8063
- })();
8064
- }
8065
- (0, $iBTHO$solidjsweb.delegateEvents)([
8066
- "click"
8067
- ]);
8068
-
8069
-
8070
8237
  const $4e04be41243c3d80$var$transform_elements = (sorted_cols_at_size)=>{
8071
8238
  const cols_at_size = [];
8072
8239
  for(let i = 0; i < sorted_cols_at_size.length; i++){
@@ -8113,6 +8280,8 @@ const $4e04be41243c3d80$export$6daf8749b65a1b77 = (cols_at_size)=>{
8113
8280
 
8114
8281
 
8115
8282
 
8283
+
8284
+
8116
8285
  const $fd2d5ef67fc09716$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp search"></div>`, 2);
8117
8286
  /**
8118
8287
  * Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
@@ -8126,7 +8295,7 @@ class $fd2d5ef67fc09716$export$ac6237957a15b3f0 {
8126
8295
  #modal_open_signal = (0, $iBTHO$solidjs.createSignal)(false);
8127
8296
  static #has_been_constructed = false;
8128
8297
  constructor({ search_query_url_param_name: search_query_url_param_name = "search_query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
8129
- disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , ...props_on_class }){
8298
+ disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , render_instant_card: render_instant_card , ...props_on_class }){
8130
8299
  if ($fd2d5ef67fc09716$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
8131
8300
  Object.assign(this, props_on_class);
8132
8301
  const alternative_query_submitter_for_spas_ = on_navigation && ((search_param_name, new_search_query, url_transformer)=>{
@@ -8157,8 +8326,9 @@ class $fd2d5ef67fc09716$export$ac6237957a15b3f0 {
8157
8326
  const previous_searches = (0, $2b7a005a65221045$export$84bba84a7b837187)(search_query_signal_);
8158
8327
  const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
8159
8328
  const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
8329
+ const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
8160
8330
  const configured_submit_query_ = ()=>(0, $f328bd45f8ede33c$export$e16630ecb9644a1c)({
8161
- on_submit_with_unchanged_value_: ()=>this.modal_open = false,
8331
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
8162
8332
  search_field_value_: state_.search_field_value,
8163
8333
  search_query_: search_query_signal_,
8164
8334
  search_param_name_: search_query_url_param_name,
@@ -8216,9 +8386,11 @@ class $fd2d5ef67fc09716$export$ac6237957a15b3f0 {
8216
8386
  submit_query_: configured_submit_query_,
8217
8387
  alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
8218
8388
  url_transformer_: url_transformer,
8389
+ navigate_page_to_href_: on_navigation,
8390
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
8219
8391
  instant_results_options_: {
8220
8392
  min_products_to_fetch_: $fd2d5ef67fc09716$var$min_products_to_fetch_,
8221
- render_instant_card_: (0, $ad63d2a35e827266$export$3b5becc25bbaed73),
8393
+ render_instant_card_: render_instant_card,
8222
8394
  render_instant_card_placeholder_: (0, $6f604560873e4f69$export$ee1733d9a8495996),
8223
8395
  has_sort_or_filters_: (0, $iBTHO$solidjs.createMemo)(()=>!!(Object.keys(state_.search_selected_filters[0]())?.length || state_.search_sorting[0]()))
8224
8396
  },
@@ -8261,21 +8433,16 @@ class $fd2d5ef67fc09716$export$ac6237957a15b3f0 {
8261
8433
  }
8262
8434
  // Open centered modal
8263
8435
  const supports_hover = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
8264
- const slim = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-width: 600px)");
8265
8436
  const desktop_short = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height: 790px)");
8266
8437
  const mobile_short = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height: 1000px)");
8267
- const transform_x = (0, $iBTHO$solidjs.createSignal)(false);
8268
- const transform_y = (0, $iBTHO$solidjs.createSignal)(false);
8438
+ const transform_y = (0, $iBTHO$solidjs.createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
8269
8439
  const style_props_ = (0, $iBTHO$solidjs.createSignal)({
8270
8440
  position: "fixed",
8271
- top: "50%",
8272
- left: "50%"
8441
+ top: "50%"
8273
8442
  });
8274
- (0, $iBTHO$solidjs.createComputed)(()=>transform_y[1](supports_hover() ? !desktop_short() : !mobile_short()));
8275
- (0, $iBTHO$solidjs.createComputed)(()=>transform_x[1](transform_y[0]() || !slim()));
8276
8443
  (0, $iBTHO$solidjs.createComputed)(()=>style_props_[1]((old_value)=>({
8277
8444
  ...old_value,
8278
- transform: transform_x[0]() && transform_y[0]() ? "translate(-50%,-50%)" : transform_x[0]() ? "translateX(-50%)" : transform_y[0]() ? "translateY(-50%)" : "unset"
8445
+ transform: transform_y() ? "translateY(-50%)" : "unset"
8279
8446
  })));
8280
8447
  if (signal_value_is_options) {
8281
8448
  const [options_arg1, ...rest1] = open_signal_value;
@@ -8440,6 +8607,7 @@ function $fd2d5ef67fc09716$export$b94867ecbd698f21({ depict_search: depict_searc
8440
8607
  (()=>{
8441
8608
  const _el$ = $fd2d5ef67fc09716$var$_tmpl$.cloneNode(true);
8442
8609
  (0, $iBTHO$solidjsweb.insert)(_el$, input);
8610
+ (0, $iBTHO$solidjsweb.effect)(()=>(0, $iBTHO$solidjsweb.setAttribute)(_el$, "id", (0, $0b6e2070a98de347$export$44dad306455dddf).SEARCH_MODAL));
8443
8611
  return _el$;
8444
8612
  })()
8445
8613
  ];
@@ -8472,3 +8640,6 @@ function $fd2d5ef67fc09716$var$run_in_root_or_auto_cleanup(component, error_mess
8472
8640
 
8473
8641
 
8474
8642
 
8643
+ (0, $iBTHO$depictaiutilishared.dlog)("@depict-ai/ui version", (0, $b757f75811f3261f$export$83d89fbfd8236492));
8644
+
8645
+