@depict-ai/ui 1.4.21 → 1.4.23

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.
@@ -1,11 +1,562 @@
1
- import { add_to_version_info as $i7OB2$add_to_version_info, catchify as $i7OB2$catchify, is_safari as $i7OB2$is_safari, report as $i7OB2$report, observer as $i7OB2$observer, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, make_random_classname as $i7OB2$make_random_classname, dlog as $i7OB2$dlog, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, javascript_media_query as $i7OB2$javascript_media_query, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, use_href_accessor as $i7OB2$use_href_accessor, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
2
- import { ssrElement as $i7OB2$ssrElement, ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, ssrStyle as $i7OB2$ssrStyle, ssrClassList as $i7OB2$ssrClassList, escape as $i7OB2$escape, insert as $i7OB2$insert, createComponent as $i7OB2$createComponent, ssrAttribute as $i7OB2$ssrAttribute, Dynamic as $i7OB2$Dynamic, isServer as $i7OB2$isServer, mergeProps as $i7OB2$mergeProps } from "solid-js/web";
3
- import { createSignal as $i7OB2$createSignal, onCleanup as $i7OB2$onCleanup, ErrorBoundary as $i7OB2$ErrorBoundary, createMemo as $i7OB2$createMemo, untrack as $i7OB2$untrack, createEffect as $i7OB2$createEffect, getOwner as $i7OB2$getOwner, Show as $i7OB2$Show, Index as $i7OB2$Index, For as $i7OB2$For, createRenderEffect as $i7OB2$createRenderEffect, createComputed as $i7OB2$createComputed, on as $i7OB2$on, batch as $i7OB2$batch, createRoot as $i7OB2$createRoot, runWithOwner as $i7OB2$runWithOwner, createResource as $i7OB2$createResource, createReaction as $i7OB2$createReaction, Suspense as $i7OB2$Suspense } from "solid-js";
1
+ import { add_to_version_info as $i7OB2$add_to_version_info, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, catchify as $i7OB2$catchify, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, report as $i7OB2$report, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, is_safari as $i7OB2$is_safari, observer as $i7OB2$observer, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, dlog as $i7OB2$dlog, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, javascript_media_query as $i7OB2$javascript_media_query, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, use_href_accessor as $i7OB2$use_href_accessor, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
2
+ import { ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as $i7OB2$escape, createComponent as $i7OB2$createComponent, mergeProps as $i7OB2$mergeProps, isServer as $i7OB2$isServer, ssrElement as $i7OB2$ssrElement, ssrClassList as $i7OB2$ssrClassList, insert as $i7OB2$insert, ssrAttribute as $i7OB2$ssrAttribute, ssrStyle as $i7OB2$ssrStyle, Dynamic as $i7OB2$Dynamic } from "solid-js/web";
3
+ import { createMemo as $i7OB2$createMemo, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, Show as $i7OB2$Show, createSignal as $i7OB2$createSignal, createRenderEffect as $i7OB2$createRenderEffect, createRoot as $i7OB2$createRoot, onCleanup as $i7OB2$onCleanup, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, createEffect as $i7OB2$createEffect, untrack as $i7OB2$untrack, createComputed as $i7OB2$createComputed, ErrorBoundary as $i7OB2$ErrorBoundary, Index as $i7OB2$Index, on as $i7OB2$on, batch as $i7OB2$batch, createReaction as $i7OB2$createReaction } from "solid-js";
4
4
 
5
5
  /*! Depict.ai search and product listing SDK */
6
6
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
7
7
  register_es_version("ui", "latest");
8
- const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.21";
8
+ const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.23";
9
+ const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
10
+ const cols_at_size = [];
11
+ for (let i = 0; i < sorted_cols_at_size.length; i++) {
12
+ const [nb_cols, width] = sorted_cols_at_size[i];
13
+ const next_width = sorted_cols_at_size[i + 1]?.[1];
14
+ const max_width = i === 0 ? "" : `${width}px`;
15
+ const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
16
+ const col_at_size = [nb_cols, min_width, max_width];
17
+ cols_at_size.push(col_at_size);
18
+ }
19
+ return cols_at_size;
20
+ };
21
+ const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
22
+ // Check that every element is an array
23
+ const are_arrays = cols_at_size.every(element => Array.isArray(element));
24
+ if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
25
+ // Check width duplicates
26
+ const widths = cols_at_size.map(([_, width]) => width);
27
+ const widths_set = new Set(widths);
28
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
29
+ if (cols_at_size.length === 1) {
30
+ const [nb_cols, width] = cols_at_size[0];
31
+ const max_width = width !== undefined ? `${width}px` : "";
32
+ return [[nb_cols, "", max_width]];
33
+ }
34
+ // Sort widths in ascending order
35
+ const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
36
+ const [_b, width_A] = a;
37
+ const [_a, width_b] = b;
38
+ if (width_A === undefined) return -1;
39
+ if (width_b === undefined) return 1;
40
+ return width_b - width_A;
41
+ });
42
+ return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
43
+ };
44
+
45
+ /**
46
+ * Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
47
+ */
48
+ function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
49
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
50
+ const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
51
+ const [[, smallest_max_width]] = sorted_sizes;
52
+ if (smallest_max_width > min_width_for_more_than_one_column)
53
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
54
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
55
+ const to_delete = [];
56
+ for (let i = 0; i < sorted_sizes.length; i++) {
57
+ const [, max_width] = sorted_sizes[i];
58
+ if (max_width > min_width_for_more_than_one_column) continue;
59
+ to_delete.push(i);
60
+ }
61
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
62
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
63
+ return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
64
+ }
65
+ function $a458486f22b22f63$export$a2cc176055f8f08() {
66
+ const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
67
+ return (0, $i7OB2$isServer) ? `<!-- ${text} -->` : document.createComment(text);
68
+ }
69
+ function $a52235d12ccf9c88$export$2f0cbfbb4354bb52(elements) {
70
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
71
+ return $i7OB2$createMemo(() => $a52235d12ccf9c88$var$unwrapping_helper(elements));
72
+ }
73
+ function $a52235d12ccf9c88$var$unwrapping_helper(elements) {
74
+ const result = [];
75
+ if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
76
+ const element = elements[i];
77
+ result.push(...$a52235d12ccf9c88$var$unwrapping_helper(element));
78
+ } else if (typeof elements == "function") result.push(...$a52235d12ccf9c88$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
79
+ return result;
80
+ }
81
+ let $6e41f1fde994db72$var$cached_placeholder_element;
82
+ let $6e41f1fde994db72$var$rendering_cached_placeholder_element;
83
+ function $6e41f1fde994db72$export$f33414a4df0afd3f({
84
+ product_card_template_: product_card_template_,
85
+ num_placeholders_: num_placeholders_
86
+ }) {
87
+ const [get_elements, set_elements] = $i7OB2$createSignal([]);
88
+ let existing_num = 0;
89
+ if (0, $i7OB2$isServer)
90
+ // want to render simple placeholders on server, effects don't run there
91
+ return $i7OB2$createMemo(() => Array.from({
92
+ length: num_placeholders_()
93
+ }).map(() => {
94
+ const template_result = product_card_template_(null, undefined);
95
+ // @ts-ignore
96
+ if (typeof template_result?.then !== "function") return template_result;
97
+ }));
98
+ $i7OB2$createRenderEffect(() => {
99
+ const to_add = num_placeholders_() - existing_num;
100
+ if (to_add <= 0) return;
101
+ // Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
102
+ // We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
103
+ // The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
104
+ set_elements(prev => [...prev, ...Array.from({
105
+ length: to_add
106
+ }).map(() => $6e41f1fde994db72$var$Placeholder({
107
+ product_card_template_: product_card_template_
108
+ }))]);
109
+ existing_num += to_add;
110
+ });
111
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
112
+ }
113
+ /**
114
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
115
+ */
116
+ function $6e41f1fde994db72$var$Placeholder({
117
+ product_card_template_: product_card_template_
118
+ }) {
119
+ const get_cloned_placeholders = (element_to_clone = $6e41f1fde994db72$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
120
+ if ($6e41f1fde994db72$var$cached_placeholder_element) return get_cloned_placeholders();
121
+ let dispose_original_copy;
122
+ const get_unwrapped_element = $i7OB2$createRoot(dispose => {
123
+ dispose_original_copy = dispose;
124
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
125
+ const [resource] = $i7OB2$createResource(() => {
126
+ if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) return $6e41f1fde994db72$var$rendering_cached_placeholder_element;
127
+ const return_value = product_card_template_(null, undefined);
128
+ if (typeof return_value === "object" && typeof return_value?.then === "function")
129
+ // Is Promise or promise-like object
130
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element = return_value;
131
+ return return_value;
132
+ });
133
+ return $i7OB2$createMemo(() => {
134
+ if (resource.loading) return () => [];
135
+ return $a52235d12ccf9c88$export$2f0cbfbb4354bb52(resource);
136
+ });
137
+ });
138
+ $i7OB2$onCleanup(() => {
139
+ if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) {
140
+ // If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
141
+ const unset_current_rendering = () => {
142
+ dispose_original_copy();
143
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
144
+ };
145
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
146
+ } else
147
+ // Otherwise, just make sure we've disposed our root
148
+ dispose_original_copy();
149
+ });
150
+ return $i7OB2$createMemo(() => {
151
+ const unwrapped_array = get_unwrapped_element()();
152
+ if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
153
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
154
+ return;
155
+ // placeholders have finished rendering, freeze the elements
156
+ // here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
157
+ $6e41f1fde994db72$var$cached_placeholder_element ||= get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
158
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
159
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
160
+ return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
161
+ });
162
+ }
163
+
164
+ /**
165
+ * Gets product_id (the thing we key the rendering on) from a display
166
+ */
167
+ function $16351e4c87b90b3d$export$548d053aba053d79(display) {
168
+ if ("variant_index" in display) {
169
+ const actual_display = display.variant_displays[display.variant_index];
170
+ return actual_display.product_id;
171
+ }
172
+ return display.product_id;
173
+ }
174
+ function $29ec7cddbe1d3484$export$7f8bd308237ab5a5(get_displays_) {
175
+ const displays_by_key_ = $i7OB2$createMemo(() => {
176
+ const displays = get_displays_();
177
+ // We key by product_id because that's what can be used to uniquely identify products
178
+ // This way <For> can optimize the rendering
179
+ const map = new Map();
180
+ for (let i = 0; i < displays.length; i++) {
181
+ const display = displays[i];
182
+ const product_id = $16351e4c87b90b3d$export$548d053aba053d79(display);
183
+ map.set(product_id, display);
184
+ }
185
+ return map;
186
+ });
187
+ return displays_by_key_;
188
+ }
189
+ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
190
+ displays_by_key_: displays_by_key_,
191
+ merchant_: merchant_,
192
+ market_: market_,
193
+ product_card_template_: product_card_template_,
194
+ do_per_elements_: do_per_elements_
195
+ }) {
196
+ return $i7OB2$createComponent((0, $i7OB2$For), {
197
+ get each() {
198
+ return [...displays_by_key_().keys()];
199
+ },
200
+ children: (product_id, index) => {
201
+ const owner = $i7OB2$getOwner();
202
+ const display_accessor = $i7OB2$createMemo(() => displays_by_key_().get(product_id));
203
+ const [product_card_resource] = $i7OB2$createResource(display_accessor,
204
+ // re-render when the reference to the display object changes
205
+ // this should only be the case when the merchant or market changes and the new request has completed
206
+ display => {
207
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
208
+ return product_card_template_(display, {
209
+ set_on_index_change: fn => $i7OB2$runWithOwner(owner, () => $i7OB2$createEffect(() => fn(index()))),
210
+ merchant: $i7OB2$untrack(merchant_),
211
+ // this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
212
+ market: $i7OB2$untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
213
+ });
214
+ });
215
+
216
+ const node_accessor = $a52235d12ccf9c88$export$2f0cbfbb4354bb52(product_card_resource);
217
+ $i7OB2$createEffect(() => {
218
+ const product_card_nodes = node_accessor();
219
+ const display = display_accessor();
220
+ const elements = [];
221
+ for (let i = 0; i < product_card_nodes.length; i++) {
222
+ const element = product_card_nodes[i];
223
+ if (!(element instanceof Element)) continue;
224
+ elements.push(element);
225
+ // Add tracking ids
226
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
227
+ const {
228
+ dataset: dataset
229
+ } = element;
230
+ const {
231
+ search_result_id: search_result_id,
232
+ product_listing_result_id: product_listing_result_id,
233
+ recommendation_id: recommendation_id
234
+ } = display;
235
+ if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
236
+ }
237
+ do_per_elements_?.(elements, index);
238
+ });
239
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
240
+ }
241
+ });
242
+ }
243
+
244
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
245
+ class $4fd48cb976bf1789$export$e1d52e4f0c7557a1 extends Error {}
246
+ class $4fd48cb976bf1789$export$aa14a9f43128f61f extends $4fd48cb976bf1789$export$e1d52e4f0c7557a1 {
247
+ constructor(templateError) {
248
+ super("Uncaught error in product card template", {
249
+ cause: templateError
250
+ });
251
+ }
252
+ }
253
+ const $b7436a6d1fd64e3b$var$_tmpl$ = ["<div", ' class="', '">', "</div>"];
254
+ function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
255
+ return $i7OB2$ErrorBoundary({
256
+ fallback(err, retry) {
257
+ const {
258
+ message_: message_,
259
+ severity_: severity_
260
+ } = props;
261
+ let message = message_;
262
+ if (err instanceof (0, $4fd48cb976bf1789$export$aa14a9f43128f61f)) {
263
+ console.error(err.cause);
264
+ message = `${message}: ${err.message}`;
265
+ } else $i7OB2$report([err, message_], severity_);
266
+ props.on_error_?.(retry);
267
+ return $i7OB2$ssr($b7436a6d1fd64e3b$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrClassList(Object.fromEntries(props.class_list_?.map(c => [c, true]) || [])), $i7OB2$escape(message));
268
+ },
269
+ get children() {
270
+ return props.children;
271
+ }
272
+ });
273
+ }
274
+ const $c8d5ff4524619fcd$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"],
275
+ $c8d5ff4524619fcd$var$_tmpl$2 = ["<div", ' class="', '">', "</div>"];
276
+ function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
277
+ const container_element_ = $i7OB2$ssrElement("div", props.element_attributes, () => $i7OB2$escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
278
+ return $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
279
+ get message_() {
280
+ return "Failed calculating " + props.layout + " layout";
281
+ },
282
+ severity_: "error",
283
+ get children() {
284
+ return $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element_);
285
+ }
286
+ });
287
+ }
288
+ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
289
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
290
+ const show_all_rows = $i7OB2$createMemo(() => props.rows === "all");
291
+ const rows_or_empty_object = $i7OB2$createMemo(() => show_all_rows() ? {} : props.rows);
292
+ const view_more_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($i7OB2$createMemo(() => rows_or_empty_object().button));
293
+ const view_less_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($i7OB2$createMemo(() => rows_or_empty_object().view_less_button));
294
+ const have_a_view_more_button = $i7OB2$createMemo(() => {
295
+ const button = view_more_button_elements();
296
+ return !(!button || Array.isArray(button) && !button.length);
297
+ });
298
+ const have_a_view_less_button = $i7OB2$createMemo(() => {
299
+ const button = view_less_button_elements();
300
+ return !(!button || Array.isArray(button) && !button.length);
301
+ });
302
+ const [get_styling, set_styling] = $i7OB2$createSignal();
303
+ const container_class = $i7OB2$make_random_classname();
304
+ const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
305
+ const [get_children_count, set_children_count] = $i7OB2$createSignal(0);
306
+ const update_children_count = () => set_children_count(container_element.children.length);
307
+ const col_styling = $i7OB2$createMemo(() => $i7OB2$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
308
+ const default_currently_visible_signal = $i7OB2$createSignal($i7OB2$untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
309
+ const rows_visible_signal = $i7OB2$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
310
+ const get_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[0]());
311
+ const set_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[1]);
312
+ const view_more_button_class = $i7OB2$make_random_classname();
313
+ const view_less_button_class = $i7OB2$make_random_classname();
314
+ const style_element = $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$, $i7OB2$ssrHydrationKey(), get_styling);
315
+ const view_more_button_container = $i7OB2$createMemo(() => have_a_view_more_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `load-more-container ${$i7OB2$escape(view_more_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().button)));
316
+ // We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
317
+ const view_less_button_container = $i7OB2$createMemo(() => have_a_view_less_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `load-less-container ${$i7OB2$escape(view_less_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().view_less_button)));
318
+ container_element.classList.add(container_class);
319
+ $i7OB2$createComputed(() => {
320
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
321
+ const rows_visible = get_rows_visible();
322
+ const max_rows = rows_or_empty_object().max_rows;
323
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
324
+ });
325
+ $i7OB2$createRenderEffect(() => {
326
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
327
+ if (show_all_rows()) {
328
+ // no view more functionality requested
329
+ set_styling(() => col_styling);
330
+ return;
331
+ }
332
+ update_children_count();
333
+ const mutation_observer = new MutationObserver($i7OB2$catchify(update_children_count));
334
+ mutation_observer.observe(container_element, {
335
+ childList: true
336
+ });
337
+ $i7OB2$onCleanup(() => mutation_observer.disconnect());
338
+ set_styling(
339
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
340
+ () => $i7OB2$createMemo(() => {
341
+ const {
342
+ rows_per_click: rows_per_click,
343
+ max_rows = -1,
344
+ start_rows: start_rows
345
+ } = rows_or_empty_object();
346
+ const rows_visible = get_rows_visible();
347
+ const children_count = get_children_count();
348
+ return col_styling() + props.cols_at_size.map(options => {
349
+ const [recs_per_row, min, max] = options;
350
+ let should_hide_view_more_button;
351
+ let visible_recs;
352
+ if (props.disable_partial_rows) {
353
+ visible_recs = $i7OB2$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
354
+ const visible_recs_next_show_more = $i7OB2$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
355
+ // Should this really be zero when we default rows_per_click to 1?
356
+ children_count, options);
357
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
358
+ } else {
359
+ visible_recs = $i7OB2$layout_get_total_rec_amount_for_row(rows_visible, options);
360
+ should_hide_view_more_button = visible_recs >= children_count;
361
+ }
362
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
363
+ // I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
364
+ const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
365
+ return `${$i7OB2$layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
366
+ }).join("");
367
+ }));
368
+ });
369
+ if (insert_after_container) container_element.after(style_element);
370
+ return [container_element, view_more_button_container(), view_less_button_container(), style_element];
371
+ }
372
+ const $fbbadcb080ad1d4a$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
373
+ function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
374
+ return $i7OB2$ssr($fbbadcb080ad1d4a$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("width", $i7OB2$escape(props.width_, true) ?? 14, false) + $i7OB2$ssrAttribute("height", $i7OB2$escape(props.height_, true) ?? 26, false));
375
+ }
376
+ const $f32e14878e75af51$var$_tmpl$ = ["<div", ">", "</div>"];
377
+ function $f32e14878e75af51$export$6649caad96ef8870({
378
+ children: children,
379
+ slider_ref_: slider_ref_,
380
+ faded_opacity_ = 0.7,
381
+ mutation_plugins_ = []
382
+ }) {
383
+ const slider = new (0, $i7OB2$Amazing_Slider)({
384
+ button_contents: {
385
+ left: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {})))],
386
+ right: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {})))]
387
+ },
388
+ constructor_plugins: [$i7OB2$slider_snap_css().constructor_plugin],
389
+ mutation_plugins: [$i7OB2$slider_fading_factory({
390
+ threshold_: 0.96,
391
+ faded_opacity_: faded_opacity_
392
+ }).mutation_plugin_, ...mutation_plugins_]
393
+ });
394
+ $i7OB2$insert(slider.insert_here, children);
395
+ $i7OB2$onCleanup(() => slider.observer.disconnect());
396
+ slider_ref_?.(slider);
397
+ return slider.container;
398
+ }
399
+ function $c4492d24952ed731$export$d41d19e89346fa2({
400
+ recommendations_resource_: recommendations_resource_,
401
+ product_card_template_: product_card_template_,
402
+ layout_options_: layout_options_,
403
+ merchant_: merchant_,
404
+ market_: market_
405
+ }) {
406
+ const is_showing_something = $i7OB2$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
407
+ const num_placeholders_ = () => 20;
408
+ const slider = $i7OB2$createComponent((0, $f32e14878e75af51$export$6649caad96ef8870), {
409
+ slider_ref_: slider => {
410
+ const Layout = props => $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, slider.insert_here, true);
411
+ // Do like this, so we don't have to call mergeProps ourselves
412
+ $i7OB2$createComponent(Layout, $i7OB2$mergeProps({
413
+ rows: "all",
414
+ layout: "slider"
415
+ }, layout_options_));
416
+ slider.insert_here.before($a458486f22b22f63$export$a2cc176055f8f08());
417
+ },
418
+ get children() {
419
+ return $i7OB2$createComponent((0, $i7OB2$Suspense), {
420
+ get fallback() {
421
+ return $6e41f1fde994db72$export$f33414a4df0afd3f({
422
+ num_placeholders_: num_placeholders_,
423
+ product_card_template_: product_card_template_
424
+ });
425
+ },
426
+ get children() {
427
+ return (() => {
428
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
429
+ const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => recommendations_resource_() || []));
430
+ return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
431
+ displays_by_key_: displays_by_key_,
432
+ merchant_: merchant_,
433
+ market_: market_,
434
+ product_card_template_: product_card_template_
435
+ });
436
+ })();
437
+ }
438
+ });
439
+ }
440
+ });
441
+ return $i7OB2$createComponent((0, $i7OB2$Show), {
442
+ get when() {
443
+ return is_showing_something();
444
+ },
445
+ children: slider
446
+ });
447
+ }
448
+ const $ee116da074deb002$var$_tmpl$ = ["<div", ' class="depict plp">', "</div>"];
449
+ function $ee116da074deb002$export$9574e176201e5e8d(props) {
450
+ const grid_spacing_override = $i7OB2$createMemo(() => {
451
+ const {
452
+ grid_spacing: grid_spacing
453
+ } = props; // can be reactive
454
+ return typeof grid_spacing === "string" ? {
455
+ grid_spacing: grid_spacing
456
+ } : {
457
+ override_vertical_spacing: grid_spacing.vertical,
458
+ grid_spacing: grid_spacing.horizontal
459
+ };
460
+ });
461
+ const [recommendations_resource_] = $i7OB2$createResource(() => props.recommendations, recs => recs);
462
+ return $i7OB2$ssr($ee116da074deb002$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($c4492d24952ed731$export$d41d19e89346fa2({
463
+ product_card_template_: (...args) => props.product_card_template(...args),
464
+ recommendations_resource_: recommendations_resource_,
465
+ market_: () => props.market,
466
+ merchant_: () => props.merchant,
467
+ layout_options_: $i7OB2$createMemo(() => ({
468
+ cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
469
+ ...grid_spacing_override()
470
+ }))
471
+ })));
472
+ }
473
+ const $3da8afe3ed57cf34$var$_tmpl$ = ["<div", ' class="recommendation-grid"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
474
+ function $3da8afe3ed57cf34$export$7da560f849543dff({
475
+ recommendations_resource_: recommendations_resource_,
476
+ product_card_template_: product_card_template_,
477
+ layout_options_: layout_options_,
478
+ merchant_: merchant_,
479
+ market_: market_,
480
+ rows_object_: rows_object_
481
+ }) {
482
+ const is_showing_something = $i7OB2$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
483
+ const num_placeholders_ = () => 20;
484
+ return $i7OB2$createComponent((0, $i7OB2$Show), {
485
+ get when() {
486
+ return is_showing_something();
487
+ },
488
+ get children() {
489
+ return $i7OB2$ssr($3da8afe3ed57cf34$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($a458486f22b22f63$export$a2cc176055f8f08()), $i7OB2$escape($i7OB2$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $i7OB2$mergeProps({
490
+ get rows() {
491
+ return rows_object_();
492
+ },
493
+ layout: "grid",
494
+ element_attributes: {
495
+ class: "cards"
496
+ }
497
+ }, layout_options_, {
498
+ get children() {
499
+ return $i7OB2$createComponent((0, $i7OB2$Suspense), {
500
+ get fallback() {
501
+ return $6e41f1fde994db72$export$f33414a4df0afd3f({
502
+ num_placeholders_: num_placeholders_,
503
+ product_card_template_: product_card_template_
504
+ });
505
+ },
506
+ get children() {
507
+ return (() => {
508
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
509
+ const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => recommendations_resource_() || []));
510
+ return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
511
+ displays_by_key_: displays_by_key_,
512
+ merchant_: merchant_,
513
+ market_: market_,
514
+ product_card_template_: product_card_template_
515
+ });
516
+ })();
517
+ }
518
+ });
519
+ }
520
+ }))));
521
+ }
522
+ });
523
+ }
524
+ const $9ea5383493360761$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
525
+ $9ea5383493360761$var$_tmpl$2 = ["<div", ' class="depict plp">', "</div>"];
526
+ function $9ea5383493360761$export$9756467d34d91cdb(props) {
527
+ const rows_object_ = $i7OB2$createMemo(() => {
528
+ const view_more_button = props.view_more_button;
529
+ if (!view_more_button) return "all";
530
+ return {
531
+ start_rows: view_more_button.start_rows,
532
+ rows_per_click: view_more_button.rows_per_click,
533
+ button: $i7OB2$ssr($9ea5383493360761$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(view_more_button.text))
534
+ };
535
+ });
536
+ const grid_spacing_override = $i7OB2$createMemo(() => {
537
+ const {
538
+ grid_spacing: grid_spacing
539
+ } = props; // can be reactive
540
+ return typeof grid_spacing === "string" ? {
541
+ grid_spacing: grid_spacing
542
+ } : {
543
+ override_vertical_spacing: grid_spacing.vertical,
544
+ grid_spacing: grid_spacing.horizontal
545
+ };
546
+ });
547
+ const [recommendations_resource_] = $i7OB2$createResource(() => props.recommendations, recs => recs);
548
+ return $i7OB2$ssr($9ea5383493360761$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape($3da8afe3ed57cf34$export$7da560f849543dff({
549
+ rows_object_: rows_object_,
550
+ product_card_template_: (...args) => props.product_card_template(...args),
551
+ recommendations_resource_: recommendations_resource_,
552
+ market_: () => props.market,
553
+ merchant_: () => props.merchant,
554
+ layout_options_: $i7OB2$createMemo(() => ({
555
+ cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
556
+ ...grid_spacing_override()
557
+ }))
558
+ })));
559
+ }
9
560
  function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
10
561
  const [size, setSize] = $i7OB2$createSignal(0);
11
562
  const resizeObserver = new ResizeObserver($i7OB2$catchify(records => {
@@ -50,37 +601,6 @@ const $f18d425032111270$var$_tmpl$ = ["<div", ' style="', '"></div>'];
50
601
  function $f18d425032111270$export$94026ee33dbabc26(props) {
51
602
  return $i7OB2$ssr($f18d425032111270$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrStyle(`position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`));
52
603
  }
53
-
54
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
55
- class $4fd48cb976bf1789$export$e1d52e4f0c7557a1 extends Error {}
56
- class $4fd48cb976bf1789$export$aa14a9f43128f61f extends $4fd48cb976bf1789$export$e1d52e4f0c7557a1 {
57
- constructor(templateError) {
58
- super("Uncaught error in product card template", {
59
- cause: templateError
60
- });
61
- }
62
- }
63
- const $b7436a6d1fd64e3b$var$_tmpl$ = ["<div", ' class="', '">', "</div>"];
64
- function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
65
- return $i7OB2$ErrorBoundary({
66
- fallback(err, retry) {
67
- const {
68
- message_: message_,
69
- severity_: severity_
70
- } = props;
71
- let message = message_;
72
- if (err instanceof (0, $4fd48cb976bf1789$export$aa14a9f43128f61f)) {
73
- console.error(err.cause);
74
- message = `${message}: ${err.message}`;
75
- } else $i7OB2$report([err, message_], severity_);
76
- props.on_error_?.(retry);
77
- return $i7OB2$ssr($b7436a6d1fd64e3b$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrClassList(Object.fromEntries(props.class_list_?.map(c => [c, true]) || [])), $i7OB2$escape(message));
78
- },
79
- get children() {
80
- return props.children;
81
- }
82
- });
83
- }
84
604
  function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
85
605
  const {
86
606
  collapse: collapse,
@@ -199,33 +719,6 @@ function $8c0f86cb3e266eeb$export$a71e92cfbb498adc(props) {
199
719
  return $i7OB2$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
200
720
  });
201
721
  }
202
- const $fbbadcb080ad1d4a$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
203
- function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
204
- return $i7OB2$ssr($fbbadcb080ad1d4a$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("width", $i7OB2$escape(props.width_, true) ?? 14, false) + $i7OB2$ssrAttribute("height", $i7OB2$escape(props.height_, true) ?? 26, false));
205
- }
206
- const $f32e14878e75af51$var$_tmpl$ = ["<div", ">", "</div>"];
207
- function $f32e14878e75af51$export$6649caad96ef8870({
208
- children: children,
209
- slider_ref_: slider_ref_,
210
- faded_opacity_ = 0.7,
211
- mutation_plugins_ = []
212
- }) {
213
- const slider = new (0, $i7OB2$Amazing_Slider)({
214
- button_contents: {
215
- left: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {})))],
216
- right: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {})))]
217
- },
218
- constructor_plugins: [$i7OB2$slider_snap_css().constructor_plugin],
219
- mutation_plugins: [$i7OB2$slider_fading_factory({
220
- threshold_: 0.96,
221
- faded_opacity_: faded_opacity_
222
- }).mutation_plugin_, ...mutation_plugins_]
223
- });
224
- $i7OB2$insert(slider.insert_here, children);
225
- $i7OB2$onCleanup(() => slider.observer.disconnect());
226
- slider_ref_?.(slider);
227
- return slider.container;
228
- }
229
722
  const $19976a74d273070d$var$_tmpl$ = '<path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z"></path>';
230
723
  function $19976a74d273070d$export$3b621d86b1566b2(props = {}) {
231
724
  return $i7OB2$ssrElement("svg", () => ({
@@ -1842,141 +2335,33 @@ function $5efb5894079b220e$var$modify_only_local_filter(local_filter_object, sel
1842
2335
  const new_meta = {
1843
2336
  ...old_meta
1844
2337
  };
1845
- modified_filter_object.meta = new_meta;
1846
- // set counts to 0
1847
- if ("counts" in new_meta) {
1848
- const counts = new_meta.counts;
1849
- if (counts) new_meta.counts = counts.map(() => 0);
1850
- }
1851
- if (Array.isArray(selected_filter_data) && "values" in new_meta) {
1852
- // we have an array of values and want to strip the ones from the available ones that aren't selected
1853
- const values = new_meta.values;
1854
- if (Array.isArray(values)) {
1855
- const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
1856
- const indexes_to_remove = new Set();
1857
- for (let i = 0; i < values.length; i++) {
1858
- const value = values[i];
1859
- if (!jsond_set_values.includes(JSON.stringify(value)))
1860
- // We want to remove the entry with this value from the filter object because it's not selected
1861
- indexes_to_remove.add(i);
1862
- }
1863
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
1864
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
1865
- if (new_meta.counts)
1866
- // remove counts that are too much, they're all zero anyway if they exist
1867
- new_meta.counts.length -= indexes_to_remove.size;
1868
- }
1869
- }
1870
- }
1871
- return modified_filter_object;
1872
- }
1873
- function $a52235d12ccf9c88$export$2f0cbfbb4354bb52(elements) {
1874
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
1875
- return $i7OB2$createMemo(() => $a52235d12ccf9c88$var$unwrapping_helper(elements));
1876
- }
1877
- function $a52235d12ccf9c88$var$unwrapping_helper(elements) {
1878
- const result = [];
1879
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
1880
- const element = elements[i];
1881
- result.push(...$a52235d12ccf9c88$var$unwrapping_helper(element));
1882
- } else if (typeof elements == "function") result.push(...$a52235d12ccf9c88$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
1883
- return result;
1884
- }
1885
- const $c8d5ff4524619fcd$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
1886
- $c8d5ff4524619fcd$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
1887
- function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
1888
- const container_element_ = $i7OB2$ssrElement("div", props.element_attributes, () => $i7OB2$escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
1889
- return $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
1890
- get message_() {
1891
- return "Failed calculating " + props.layout + " layout";
1892
- },
1893
- severity_: "error",
1894
- get children() {
1895
- return $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element_);
1896
- }
1897
- });
1898
- }
1899
- function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
1900
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
1901
- const show_all_rows = $i7OB2$createMemo(() => props.rows === "all");
1902
- const rows_or_empty_object = $i7OB2$createMemo(() => show_all_rows() ? {} : props.rows);
1903
- const view_more_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($i7OB2$createMemo(() => rows_or_empty_object().button));
1904
- const view_less_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($i7OB2$createMemo(() => rows_or_empty_object().view_less_button));
1905
- const have_a_view_more_button = $i7OB2$createMemo(() => {
1906
- const button = view_more_button_elements();
1907
- return !(!button || Array.isArray(button) && !button.length);
1908
- });
1909
- const have_a_view_less_button = $i7OB2$createMemo(() => {
1910
- const button = view_less_button_elements();
1911
- return !(!button || Array.isArray(button) && !button.length);
1912
- });
1913
- const [get_styling, set_styling] = $i7OB2$createSignal();
1914
- const container_class = $i7OB2$make_random_classname();
1915
- const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
1916
- const [get_children_count, set_children_count] = $i7OB2$createSignal(0);
1917
- const update_children_count = () => set_children_count(container_element.children.length);
1918
- const col_styling = $i7OB2$createMemo(() => $i7OB2$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
1919
- const default_currently_visible_signal = $i7OB2$createSignal($i7OB2$untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
1920
- const rows_visible_signal = $i7OB2$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
1921
- const get_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[0]());
1922
- const set_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[1]);
1923
- const view_more_button_class = $i7OB2$make_random_classname();
1924
- const view_less_button_class = $i7OB2$make_random_classname();
1925
- const view_more_button_container = $i7OB2$createMemo(() => have_a_view_more_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$, $i7OB2$ssrHydrationKey(), `load-more-container ${$i7OB2$escape(view_more_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().button)));
1926
- // We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
1927
- const view_less_button_container = $i7OB2$createMemo(() => have_a_view_less_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$, $i7OB2$ssrHydrationKey(), `load-less-container ${$i7OB2$escape(view_less_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().view_less_button)));
1928
- container_element.classList.add(container_class);
1929
- $i7OB2$createComputed(() => {
1930
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
1931
- const rows_visible = get_rows_visible();
1932
- const max_rows = rows_or_empty_object().max_rows;
1933
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
1934
- });
1935
- $i7OB2$createRenderEffect(() => {
1936
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
1937
- if (show_all_rows()) {
1938
- // no view more functionality requested
1939
- set_styling(() => col_styling);
1940
- return;
1941
- }
1942
- update_children_count();
1943
- const mutation_observer = new MutationObserver($i7OB2$catchify(update_children_count));
1944
- mutation_observer.observe(container_element, {
1945
- childList: true
1946
- });
1947
- $i7OB2$onCleanup(() => mutation_observer.disconnect());
1948
- set_styling(
1949
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
1950
- () => $i7OB2$createMemo(() => {
1951
- const {
1952
- rows_per_click: rows_per_click,
1953
- max_rows = -1,
1954
- start_rows: start_rows
1955
- } = rows_or_empty_object();
1956
- const rows_visible = get_rows_visible();
1957
- const children_count = get_children_count();
1958
- return col_styling() + props.cols_at_size.map(options => {
1959
- const [recs_per_row, min, max] = options;
1960
- let should_hide_view_more_button;
1961
- let visible_recs;
1962
- if (props.disable_partial_rows) {
1963
- visible_recs = $i7OB2$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
1964
- const visible_recs_next_show_more = $i7OB2$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
1965
- // Should this really be zero when we default rows_per_click to 1?
1966
- children_count, options);
1967
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
1968
- } else {
1969
- visible_recs = $i7OB2$layout_get_total_rec_amount_for_row(rows_visible, options);
1970
- should_hide_view_more_button = visible_recs >= children_count;
2338
+ modified_filter_object.meta = new_meta;
2339
+ // set counts to 0
2340
+ if ("counts" in new_meta) {
2341
+ const counts = new_meta.counts;
2342
+ if (counts) new_meta.counts = counts.map(() => 0);
2343
+ }
2344
+ if (Array.isArray(selected_filter_data) && "values" in new_meta) {
2345
+ // we have an array of values and want to strip the ones from the available ones that aren't selected
2346
+ const values = new_meta.values;
2347
+ if (Array.isArray(values)) {
2348
+ const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
2349
+ const indexes_to_remove = new Set();
2350
+ for (let i = 0; i < values.length; i++) {
2351
+ const value = values[i];
2352
+ if (!jsond_set_values.includes(JSON.stringify(value)))
2353
+ // We want to remove the entry with this value from the filter object because it's not selected
2354
+ indexes_to_remove.add(i);
1971
2355
  }
1972
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
1973
- // I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
1974
- const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
1975
- return `${$i7OB2$layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
1976
- }).join("");
1977
- }));
1978
- });
1979
- return [container_element, view_more_button_container(), view_less_button_container(), $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$2, $i7OB2$ssrHydrationKey(), get_styling)];
2356
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2357
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2358
+ if (new_meta.counts)
2359
+ // remove counts that are too much, they're all zero anyway if they exist
2360
+ new_meta.counts.length -= indexes_to_remove.size;
2361
+ }
2362
+ }
2363
+ }
2364
+ return modified_filter_object;
1980
2365
  }
1981
2366
  async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts) {
1982
2367
  const body = await (0, $i7OB2$observer).wait_for_element("body");
@@ -2635,92 +3020,6 @@ function $598245ecfe38f34b$export$ef6006467f04ee41({
2635
3020
  }
2636
3021
  })))];
2637
3022
  }
2638
- function $a458486f22b22f63$export$a2cc176055f8f08() {
2639
- const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
2640
- return (0, $i7OB2$isServer) ? `<!-- ${text} -->` : document.createComment(text);
2641
- }
2642
- let $6e41f1fde994db72$var$cached_placeholder_element;
2643
- let $6e41f1fde994db72$var$rendering_cached_placeholder_element;
2644
- function $6e41f1fde994db72$export$f33414a4df0afd3f({
2645
- product_card_template_: product_card_template_,
2646
- num_placeholders_: num_placeholders_
2647
- }) {
2648
- const [get_elements, set_elements] = $i7OB2$createSignal([]);
2649
- let existing_num = 0;
2650
- if (0, $i7OB2$isServer)
2651
- // want to render simple placeholders on server, effects don't run there
2652
- return $i7OB2$createMemo(() => Array.from({
2653
- length: num_placeholders_()
2654
- }).map(() => {
2655
- const template_result = product_card_template_(null, undefined);
2656
- // @ts-ignore
2657
- if (typeof template_result?.then !== "function") return template_result;
2658
- }));
2659
- $i7OB2$createRenderEffect(() => {
2660
- const to_add = num_placeholders_() - existing_num;
2661
- if (to_add <= 0) return;
2662
- // Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
2663
- // We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
2664
- // The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
2665
- set_elements(prev => [...prev, ...Array.from({
2666
- length: to_add
2667
- }).map(() => $6e41f1fde994db72$var$Placeholder({
2668
- product_card_template_: product_card_template_
2669
- }))]);
2670
- existing_num += to_add;
2671
- });
2672
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
2673
- }
2674
- /**
2675
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
2676
- */
2677
- function $6e41f1fde994db72$var$Placeholder({
2678
- product_card_template_: product_card_template_
2679
- }) {
2680
- const get_cloned_placeholders = (element_to_clone = $6e41f1fde994db72$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
2681
- if ($6e41f1fde994db72$var$cached_placeholder_element) return get_cloned_placeholders();
2682
- let dispose_original_copy;
2683
- const get_unwrapped_element = $i7OB2$createRoot(dispose => {
2684
- dispose_original_copy = dispose;
2685
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
2686
- const [resource] = $i7OB2$createResource(() => {
2687
- if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) return $6e41f1fde994db72$var$rendering_cached_placeholder_element;
2688
- const return_value = product_card_template_(null, undefined);
2689
- if (typeof return_value === "object" && typeof return_value?.then === "function")
2690
- // Is Promise or promise-like object
2691
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = return_value;
2692
- return return_value;
2693
- });
2694
- return $i7OB2$createMemo(() => {
2695
- if (resource.loading) return () => [];
2696
- return $a52235d12ccf9c88$export$2f0cbfbb4354bb52(resource);
2697
- });
2698
- });
2699
- $i7OB2$onCleanup(() => {
2700
- if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) {
2701
- // If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
2702
- const unset_current_rendering = () => {
2703
- dispose_original_copy();
2704
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
2705
- };
2706
- $6e41f1fde994db72$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
2707
- } else
2708
- // Otherwise, just make sure we've disposed our root
2709
- dispose_original_copy();
2710
- });
2711
- return $i7OB2$createMemo(() => {
2712
- const unwrapped_array = get_unwrapped_element()();
2713
- if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
2714
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
2715
- return;
2716
- // placeholders have finished rendering, freeze the elements
2717
- // here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
2718
- $6e41f1fde994db72$var$cached_placeholder_element ||= get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
2719
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
2720
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
2721
- return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
2722
- });
2723
- }
2724
3023
 
2725
3024
  /*
2726
3025
  * Usually product templates are somewhat height-elastic depending on the content, i.e. if the title is longer we might up to two extra rows for this. That means that the placeholders almost never will reflect the size of the actual content when we do scroll restoration. This magic number specifies how many extra placeholders we should render everytime to compensate for this, since if the placeholders are in total shorter than the old scroll location the scroll restoration won't work.
@@ -2750,6 +3049,7 @@ function $056f6ac0a6caa919$export$5e4aed86c12acdd9({
2750
3049
  last_loaded = +new Date();
2751
3050
  is_first_load = true;
2752
3051
  });
3052
+ // percentage_in_view_ has equals: false so it should update even when set to the same value. That is to make sure that if the user bounces around below the "viewport" of our product listing we still start fetching as soon as is_loading_more becomes false again and we get IntersectionObserverEntries
2753
3053
  $i7OB2$createEffect($i7OB2$catchify(async () => {
2754
3054
  const be_above_percentage = is_first_load ? 50 : 75; // if first load, load earlier
2755
3055
  if (percentage_in_view_() < be_above_percentage || is_loading_more) return;
@@ -2821,88 +3121,10 @@ function $0e0b96a8dc1ad492$export$63dd0350f8559dda({
2821
3121
  // No product card in view and not after last card, assume first card
2822
3122
  return 0;
2823
3123
  return last / displays_by_key_().size * 100;
3124
+ }, undefined, {
3125
+ equals: false
2824
3126
  });
2825
3127
  }
2826
-
2827
- /**
2828
- * Gets product_id (the thing we key the rendering on) from a display
2829
- */
2830
- function $16351e4c87b90b3d$export$548d053aba053d79(display) {
2831
- if ("variant_index" in display) {
2832
- const actual_display = display.variant_displays[display.variant_index];
2833
- return actual_display.product_id;
2834
- }
2835
- return display.product_id;
2836
- }
2837
- function $29ec7cddbe1d3484$export$7f8bd308237ab5a5(get_displays_) {
2838
- const displays_by_key_ = $i7OB2$createMemo(() => {
2839
- const displays = get_displays_();
2840
- // We key by product_id because that's what can be used to uniquely identify products
2841
- // This way <For> can optimize the rendering
2842
- const map = new Map();
2843
- for (let i = 0; i < displays.length; i++) {
2844
- const display = displays[i];
2845
- const product_id = $16351e4c87b90b3d$export$548d053aba053d79(display);
2846
- map.set(product_id, display);
2847
- }
2848
- return map;
2849
- });
2850
- return displays_by_key_;
2851
- }
2852
- function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
2853
- displays_by_key_: displays_by_key_,
2854
- merchant_: merchant_,
2855
- market_: market_,
2856
- product_card_template_: product_card_template_,
2857
- do_per_elements_: do_per_elements_
2858
- }) {
2859
- return $i7OB2$createComponent((0, $i7OB2$For), {
2860
- get each() {
2861
- return [...displays_by_key_().keys()];
2862
- },
2863
- children: (product_id, index) => {
2864
- const owner = $i7OB2$getOwner();
2865
- const display_accessor = $i7OB2$createMemo(() => displays_by_key_().get(product_id));
2866
- const [product_card_resource] = $i7OB2$createResource(display_accessor,
2867
- // re-render when the reference to the display object changes
2868
- // this should only be the case when the merchant or market changes and the new request has completed
2869
- display => {
2870
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
2871
- return product_card_template_(display, {
2872
- set_on_index_change: fn => $i7OB2$runWithOwner(owner, () => $i7OB2$createEffect(() => fn(index()))),
2873
- merchant: $i7OB2$untrack(merchant_),
2874
- // this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
2875
- market: $i7OB2$untrack(market_)
2876
- });
2877
- });
2878
- const node_accessor = $a52235d12ccf9c88$export$2f0cbfbb4354bb52(product_card_resource);
2879
- $i7OB2$createEffect(() => {
2880
- const product_card_nodes = node_accessor();
2881
- const display = display_accessor();
2882
- const elements = [];
2883
- for (let i = 0; i < product_card_nodes.length; i++) {
2884
- const element = product_card_nodes[i];
2885
- if (!(element instanceof Element)) continue;
2886
- elements.push(element);
2887
- // Add tracking ids
2888
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
2889
- const {
2890
- dataset: dataset
2891
- } = element;
2892
- const {
2893
- search_result_id: search_result_id,
2894
- product_listing_result_id: product_listing_result_id,
2895
- recommendation_id: recommendation_id
2896
- } = display;
2897
- if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
2898
- }
2899
- do_per_elements_?.(elements, index);
2900
- });
2901
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
2902
- }
2903
- });
2904
- }
2905
-
2906
3128
  function $0449e7d49398c077$export$a1fd619a4743ca08({
2907
3129
  plp_results_: plp_results_,
2908
3130
  product_card_template_: product_card_template_,
@@ -4784,41 +5006,6 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
4784
5006
  }
4785
5007
  })))];
4786
5008
  }
4787
- const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
4788
- const cols_at_size = [];
4789
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
4790
- const [nb_cols, width] = sorted_cols_at_size[i];
4791
- const next_width = sorted_cols_at_size[i + 1]?.[1];
4792
- const max_width = i === 0 ? "" : `${width}px`;
4793
- const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
4794
- const col_at_size = [nb_cols, min_width, max_width];
4795
- cols_at_size.push(col_at_size);
4796
- }
4797
- return cols_at_size;
4798
- };
4799
- const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
4800
- // Check that every element is an array
4801
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
4802
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
4803
- // Check width duplicates
4804
- const widths = cols_at_size.map(([_, width]) => width);
4805
- const widths_set = new Set(widths);
4806
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
4807
- if (cols_at_size.length === 1) {
4808
- const [nb_cols, width] = cols_at_size[0];
4809
- const max_width = width !== undefined ? `${width}px` : "";
4810
- return [[nb_cols, "", max_width]];
4811
- }
4812
- // Sort widths in ascending order
4813
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
4814
- const [_b, width_A] = a;
4815
- const [_a, width_b] = b;
4816
- if (width_A === undefined) return -1;
4817
- if (width_b === undefined) return 1;
4818
- return width_b - width_A;
4819
- });
4820
- return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
4821
- };
4822
5009
  function $16b52438165aafe2$export$23fca46f3143581f(component, error_message) {
4823
5010
  const component_in_error_boundary = do_with_elements => {
4824
5011
  const error_boundary_wrapped = $b7436a6d1fd64e3b$export$b69d0d92862de18b({
@@ -5117,7 +5304,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5117
5304
  #meta_title_suffix_ = $i7OB2$createSignal();
5118
5305
  #disable_override_query_id = $i7OB2$createSignal();
5119
5306
  #listing_type_signal = $i7OB2$createSignal();
5120
- static #keys_constructed_with = new Set();
5307
+ static #keys_constructed_with = /*@__PURE__*/new Set();
5121
5308
  get localization() {
5122
5309
  // allow reactive access
5123
5310
  return this.#locale_signal[0]();
@@ -7735,27 +7922,6 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
7735
7922
  cleanup: cleanup
7736
7923
  };
7737
7924
  }
7738
-
7739
- /**
7740
- * Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
7741
- */
7742
- function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
7743
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
7744
- const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
7745
- const [[, smallest_max_width]] = sorted_sizes;
7746
- if (smallest_max_width > min_width_for_more_than_one_column)
7747
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
7748
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
7749
- const to_delete = [];
7750
- for (let i = 0; i < sorted_sizes.length; i++) {
7751
- const [, max_width] = sorted_sizes[i];
7752
- if (max_width > min_width_for_more_than_one_column) continue;
7753
- to_delete.push(i);
7754
- }
7755
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
7756
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
7757
- return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
7758
- }
7759
7925
  const $806c97b931758897$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
7760
7926
  // We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
7761
7927
  /**
@@ -7774,7 +7940,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
7774
7940
  #market_signal = $i7OB2$createSignal();
7775
7941
  #modal_open_signal = $i7OB2$createSignal(false);
7776
7942
  #content_search_signal = $i7OB2$createSignal();
7777
- static #keys_constructed_with = new Set();
7943
+ static #keys_constructed_with = /*@__PURE__*/new Set();
7778
7944
  #router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation");
7779
7945
  constructor({
7780
7946
  unique_instance_key_for_state = "",
@@ -8288,7 +8454,7 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
8288
8454
  #revert_fns = [];
8289
8455
  #is_open = false;
8290
8456
  static #reverting_permitted = true;
8291
- static #visited_urls = (() => {
8457
+ static #visited_urls = /*@__PURE__*/(() => {
8292
8458
  // Keep track of all URLs that have been visited since the document that was initially loaded (loaded means the process where the browser creates a new `document` and `window` object).
8293
8459
  $i7OB2$catchify(async () => {
8294
8460
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
@@ -8329,14 +8495,14 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
8329
8495
  return $i7OB2$catchify(this.render_, "rendering failed")() || [];
8330
8496
  });
8331
8497
  }
8332
- #unload = $i7OB2$catchify(() => {
8498
+ #unload = /*@__PURE__*/$i7OB2$catchify(() => {
8333
8499
  if (!this.#is_open) return;
8334
8500
  this.#disconnect_observer?.();
8335
8501
  if ($753e9b2889a47c89$export$3ccaa27d81dd8556.#reverting_permitted) while (this.#revert_fns.length) this.#revert_fns.pop()?.();
8336
8502
  this.#is_open = false;
8337
8503
  this.dispatchEvent(new CustomEvent("close"));
8338
8504
  }, "failed to close page");
8339
- #load = $i7OB2$catchify(async els => {
8505
+ #load = /*@__PURE__*/$i7OB2$catchify(async els => {
8340
8506
  this.#is_open = true;
8341
8507
  // So that #load doesn't get called again
8342
8508
  let set_should_stay_inserted;
@@ -8451,4 +8617,4 @@ const $4690a06c8489dcd0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
8451
8617
  const $4690a06c8489dcd0$export$864d304a0bc46829 = "2%";
8452
8618
  const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b91cec6bdc6b32a1);
8453
8619
  $i7OB2$add_to_version_info("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
8454
- export { $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $c9312089e8983364$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version };
8620
+ export { $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $c9312089e8983364$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version };