@depict-ai/ui 1.4.22 → 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.
package/latest/index.js CHANGED
@@ -1,11 +1,632 @@
1
- import { add_to_version_info as $9HbP8$add_to_version_info, catchify as $9HbP8$catchify, is_safari as $9HbP8$is_safari, report as $9HbP8$report, observer as $9HbP8$observer, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, make_random_classname as $9HbP8$make_random_classname, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
2
- import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, spread as $9HbP8$spread, mergeProps as $9HbP8$mergeProps, runHydrationEvents as $9HbP8$runHydrationEvents, effect as $9HbP8$effect, style as $9HbP8$style, insert as $9HbP8$insert, classList as $9HbP8$classList, createComponent as $9HbP8$createComponent, getNextMarker as $9HbP8$getNextMarker, addEventListener as $9HbP8$addEventListener, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, setAttribute as $9HbP8$setAttribute, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use, className as $9HbP8$className, isServer as $9HbP8$isServer } from "solid-js/web";
3
- import { createSignal as $9HbP8$createSignal, onCleanup as $9HbP8$onCleanup, ErrorBoundary as $9HbP8$ErrorBoundary, createMemo as $9HbP8$createMemo, untrack as $9HbP8$untrack, createEffect as $9HbP8$createEffect, getOwner as $9HbP8$getOwner, Show as $9HbP8$Show, runWithOwner as $9HbP8$runWithOwner, Index as $9HbP8$Index, createRoot as $9HbP8$createRoot, on as $9HbP8$on, For as $9HbP8$For, createRenderEffect as $9HbP8$createRenderEffect, createComputed as $9HbP8$createComputed, batch as $9HbP8$batch, createResource as $9HbP8$createResource, createReaction as $9HbP8$createReaction, Suspense as $9HbP8$Suspense } from "solid-js";
1
+ import { add_to_version_info as $9HbP8$add_to_version_info, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, catchify as $9HbP8$catchify, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, is_safari as $9HbP8$is_safari, observer as $9HbP8$observer, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
2
+ import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, insert as $9HbP8$insert, createComponent as $9HbP8$createComponent, mergeProps as $9HbP8$mergeProps, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, effect as $9HbP8$effect, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, getNextMarker as $9HbP8$getNextMarker, style as $9HbP8$style, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use } from "solid-js/web";
3
+ import { createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createSignal as $9HbP8$createSignal, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, onCleanup as $9HbP8$onCleanup, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createEffect as $9HbP8$createEffect, untrack as $9HbP8$untrack, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, Index as $9HbP8$Index, on as $9HbP8$on, batch as $9HbP8$batch, createReaction as $9HbP8$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.22";
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, $9HbP8$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 $9HbP8$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] = $9HbP8$createSignal([]);
88
+ let existing_num = 0;
89
+ if (0, $9HbP8$isServer)
90
+ // want to render simple placeholders on server, effects don't run there
91
+ return $9HbP8$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
+ $9HbP8$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 = $9HbP8$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] = $9HbP8$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 $9HbP8$createMemo(() => {
134
+ if (resource.loading) return () => [];
135
+ return $a52235d12ccf9c88$export$2f0cbfbb4354bb52(resource);
136
+ });
137
+ });
138
+ $9HbP8$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 $9HbP8$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_ = $9HbP8$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 $9HbP8$createComponent((0, $9HbP8$For), {
197
+ get each() {
198
+ return [...displays_by_key_().keys()];
199
+ },
200
+ children: (product_id, index) => {
201
+ const owner = $9HbP8$getOwner();
202
+ const display_accessor = $9HbP8$createMemo(() => displays_by_key_().get(product_id));
203
+ const [product_card_resource] = $9HbP8$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 => $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() => fn(index()))),
210
+ merchant: $9HbP8$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: $9HbP8$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
+ $9HbP8$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$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
254
+ function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
255
+ return $9HbP8$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 $9HbP8$report([err, message_], severity_);
266
+ props.on_error_?.(retry);
267
+ return (() => {
268
+ const _el$ = $9HbP8$getNextElement($b7436a6d1fd64e3b$var$_tmpl$);
269
+ $9HbP8$insert(_el$, message);
270
+ $9HbP8$effect(_$p => $9HbP8$classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
271
+ return _el$;
272
+ })();
273
+ },
274
+ get children() {
275
+ return props.children;
276
+ }
277
+ });
278
+ }
279
+ const $c8d5ff4524619fcd$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2),
280
+ $c8d5ff4524619fcd$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<style type="text/css"></style>`, 2);
281
+ function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
282
+ const container_element_ = (() => {
283
+ const _el$ = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
284
+ $9HbP8$spread(_el$, $9HbP8$mergeProps(() => props.element_attributes), false, true);
285
+ $9HbP8$insert(_el$, () => props.children);
286
+ $9HbP8$runHydrationEvents();
287
+ return _el$;
288
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
289
+ return $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
290
+ get message_() {
291
+ return "Failed calculating " + props.layout + " layout";
292
+ },
293
+ severity_: "error",
294
+ get children() {
295
+ return $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element_);
296
+ }
297
+ });
298
+ }
299
+ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
300
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
301
+ const show_all_rows = $9HbP8$createMemo(() => props.rows === "all");
302
+ const rows_or_empty_object = $9HbP8$createMemo(() => show_all_rows() ? {} : props.rows);
303
+ const view_more_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().button));
304
+ const view_less_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().view_less_button));
305
+ const have_a_view_more_button = $9HbP8$createMemo(() => {
306
+ const button = view_more_button_elements();
307
+ return !(!button || Array.isArray(button) && !button.length);
308
+ });
309
+ const have_a_view_less_button = $9HbP8$createMemo(() => {
310
+ const button = view_less_button_elements();
311
+ return !(!button || Array.isArray(button) && !button.length);
312
+ });
313
+ const [get_styling, set_styling] = $9HbP8$createSignal();
314
+ const container_class = $9HbP8$make_random_classname();
315
+ const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
316
+ const [get_children_count, set_children_count] = $9HbP8$createSignal(0);
317
+ const update_children_count = () => set_children_count(container_element.children.length);
318
+ const col_styling = $9HbP8$createMemo(() => $9HbP8$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
319
+ const default_currently_visible_signal = $9HbP8$createSignal($9HbP8$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
320
+ const rows_visible_signal = $9HbP8$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
321
+ const get_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[0]());
322
+ const set_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[1]);
323
+ const view_more_button_class = $9HbP8$make_random_classname();
324
+ const view_less_button_class = $9HbP8$make_random_classname();
325
+ const style_element = (() => {
326
+ const _el$2 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$2);
327
+ $9HbP8$insert(_el$2, get_styling);
328
+ return _el$2;
329
+ })();
330
+ const view_more_button_container = $9HbP8$createMemo(() => have_a_view_more_button() && (() => {
331
+ const _el$3 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
332
+ $9HbP8$addEventListener(_el$3, "click", $9HbP8$catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
333
+ $9HbP8$className(_el$3, `load-more-container ${view_more_button_class}`);
334
+ $9HbP8$insert(_el$3, () => rows_or_empty_object().button);
335
+ $9HbP8$runHydrationEvents();
336
+ return _el$3;
337
+ })());
338
+ // 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
339
+ const view_less_button_container = $9HbP8$createMemo(() => have_a_view_less_button() && (() => {
340
+ const _el$4 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
341
+ $9HbP8$addEventListener(_el$4, "click", $9HbP8$catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
342
+ $9HbP8$className(_el$4, `load-less-container ${view_less_button_class}`);
343
+ $9HbP8$insert(_el$4, () => rows_or_empty_object().view_less_button);
344
+ $9HbP8$runHydrationEvents();
345
+ return _el$4;
346
+ })());
347
+ container_element.classList.add(container_class);
348
+ $9HbP8$createComputed(() => {
349
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
350
+ const rows_visible = get_rows_visible();
351
+ const max_rows = rows_or_empty_object().max_rows;
352
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
353
+ });
354
+ $9HbP8$createRenderEffect(() => {
355
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
356
+ if (show_all_rows()) {
357
+ // no view more functionality requested
358
+ set_styling(() => col_styling);
359
+ return;
360
+ }
361
+ update_children_count();
362
+ const mutation_observer = new MutationObserver($9HbP8$catchify(update_children_count));
363
+ mutation_observer.observe(container_element, {
364
+ childList: true
365
+ });
366
+ $9HbP8$onCleanup(() => mutation_observer.disconnect());
367
+ set_styling(
368
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
369
+ () => $9HbP8$createMemo(() => {
370
+ const {
371
+ rows_per_click: rows_per_click,
372
+ max_rows = -1,
373
+ start_rows: start_rows
374
+ } = rows_or_empty_object();
375
+ const rows_visible = get_rows_visible();
376
+ const children_count = get_children_count();
377
+ return col_styling() + props.cols_at_size.map(options => {
378
+ const [recs_per_row, min, max] = options;
379
+ let should_hide_view_more_button;
380
+ let visible_recs;
381
+ if (props.disable_partial_rows) {
382
+ visible_recs = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
383
+ const visible_recs_next_show_more = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
384
+ // Should this really be zero when we default rows_per_click to 1?
385
+ children_count, options);
386
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
387
+ } else {
388
+ visible_recs = $9HbP8$layout_get_total_rec_amount_for_row(rows_visible, options);
389
+ should_hide_view_more_button = visible_recs >= children_count;
390
+ }
391
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
392
+ // 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
393
+ 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;
394
+ return `${$9HbP8$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}` : ``}}`;
395
+ }).join("");
396
+ }));
397
+ });
398
+ if (insert_after_container) container_element.after(style_element);
399
+ return [container_element, $9HbP8$memo(view_more_button_container), $9HbP8$memo(view_less_button_container), style_element];
400
+ }
401
+ $9HbP8$delegateEvents(["click"]);
402
+ const $fbbadcb080ad1d4a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<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>`, 4);
403
+ function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
404
+ return (() => {
405
+ const _el$ = $9HbP8$getNextElement($fbbadcb080ad1d4a$var$_tmpl$);
406
+ $9HbP8$effect(_p$ => {
407
+ const _v$ = props.width_ ?? 14,
408
+ _v$2 = props.height_ ?? 26;
409
+ _v$ !== _p$._v$ && $9HbP8$setAttribute(_el$, "width", _p$._v$ = _v$);
410
+ _v$2 !== _p$._v$2 && $9HbP8$setAttribute(_el$, "height", _p$._v$2 = _v$2);
411
+ return _p$;
412
+ }, {
413
+ _v$: undefined,
414
+ _v$2: undefined
415
+ });
416
+ return _el$;
417
+ })();
418
+ }
419
+ const $f32e14878e75af51$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
420
+ function $f32e14878e75af51$export$6649caad96ef8870({
421
+ children: children,
422
+ slider_ref_: slider_ref_,
423
+ faded_opacity_ = 0.7,
424
+ mutation_plugins_ = []
425
+ }) {
426
+ const slider = new (0, $9HbP8$Amazing_Slider)({
427
+ button_contents: {
428
+ left: [(() => {
429
+ const _el$ = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
430
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
431
+ return _el$;
432
+ })()],
433
+ right: [(() => {
434
+ const _el$2 = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
435
+ $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
436
+ return _el$2;
437
+ })()]
438
+ },
439
+ constructor_plugins: [$9HbP8$slider_snap_css().constructor_plugin],
440
+ mutation_plugins: [$9HbP8$slider_fading_factory({
441
+ threshold_: 0.96,
442
+ faded_opacity_: faded_opacity_
443
+ }).mutation_plugin_, ...mutation_plugins_]
444
+ });
445
+ $9HbP8$insert(slider.insert_here, children);
446
+ $9HbP8$onCleanup(() => slider.observer.disconnect());
447
+ slider_ref_?.(slider);
448
+ return slider.container;
449
+ }
450
+ function $c4492d24952ed731$export$d41d19e89346fa2({
451
+ recommendations_resource_: recommendations_resource_,
452
+ product_card_template_: product_card_template_,
453
+ layout_options_: layout_options_,
454
+ merchant_: merchant_,
455
+ market_: market_
456
+ }) {
457
+ const is_showing_something = $9HbP8$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
458
+ const num_placeholders_ = () => 20;
459
+ const slider = $9HbP8$createComponent((0, $f32e14878e75af51$export$6649caad96ef8870), {
460
+ slider_ref_: slider => {
461
+ const Layout = props => $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, slider.insert_here, true);
462
+ // Do like this, so we don't have to call mergeProps ourselves
463
+ $9HbP8$createComponent(Layout, $9HbP8$mergeProps({
464
+ rows: "all",
465
+ layout: "slider"
466
+ }, layout_options_));
467
+ slider.insert_here.before($a458486f22b22f63$export$a2cc176055f8f08());
468
+ },
469
+ get children() {
470
+ return $9HbP8$createComponent((0, $9HbP8$Suspense), {
471
+ get fallback() {
472
+ return $6e41f1fde994db72$export$f33414a4df0afd3f({
473
+ num_placeholders_: num_placeholders_,
474
+ product_card_template_: product_card_template_
475
+ });
476
+ },
477
+ get children() {
478
+ return (() => {
479
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
480
+ const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource_() || []));
481
+ return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
482
+ displays_by_key_: displays_by_key_,
483
+ merchant_: merchant_,
484
+ market_: market_,
485
+ product_card_template_: product_card_template_
486
+ });
487
+ })();
488
+ }
489
+ });
490
+ }
491
+ });
492
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
493
+ get when() {
494
+ return is_showing_something();
495
+ },
496
+ children: slider
497
+ });
498
+ }
499
+ const $ee116da074deb002$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="depict plp"></div>`, 2);
500
+ function $ee116da074deb002$export$9574e176201e5e8d(props) {
501
+ const grid_spacing_override = $9HbP8$createMemo(() => {
502
+ const {
503
+ grid_spacing: grid_spacing
504
+ } = props; // can be reactive
505
+ return typeof grid_spacing === "string" ? {
506
+ grid_spacing: grid_spacing
507
+ } : {
508
+ override_vertical_spacing: grid_spacing.vertical,
509
+ grid_spacing: grid_spacing.horizontal
510
+ };
511
+ });
512
+ const [recommendations_resource_] = $9HbP8$createResource(() => props.recommendations, recs => recs);
513
+ return (() => {
514
+ const _el$ = $9HbP8$getNextElement($ee116da074deb002$var$_tmpl$);
515
+ $9HbP8$insert(_el$, () => $c4492d24952ed731$export$d41d19e89346fa2({
516
+ product_card_template_: (...args) => props.product_card_template(...args),
517
+ recommendations_resource_: recommendations_resource_,
518
+ market_: () => props.market,
519
+ merchant_: () => props.merchant,
520
+ layout_options_: $9HbP8$createMemo(() => ({
521
+ cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
522
+ ...grid_spacing_override()
523
+ }))
524
+ }));
525
+ return _el$;
526
+ })();
527
+ }
528
+ const $3da8afe3ed57cf34$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
529
+ function $3da8afe3ed57cf34$export$7da560f849543dff({
530
+ recommendations_resource_: recommendations_resource_,
531
+ product_card_template_: product_card_template_,
532
+ layout_options_: layout_options_,
533
+ merchant_: merchant_,
534
+ market_: market_,
535
+ rows_object_: rows_object_
536
+ }) {
537
+ const is_showing_something = $9HbP8$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
538
+ const num_placeholders_ = () => 20;
539
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
540
+ get when() {
541
+ return is_showing_something();
542
+ },
543
+ get children() {
544
+ const _el$ = $9HbP8$getNextElement($3da8afe3ed57cf34$var$_tmpl$),
545
+ _el$2 = _el$.firstChild,
546
+ [_el$3, _co$] = $9HbP8$getNextMarker(_el$2.nextSibling),
547
+ _el$4 = _el$3.nextSibling,
548
+ [_el$5, _co$2] = $9HbP8$getNextMarker(_el$4.nextSibling);
549
+ $9HbP8$insert(_el$, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$3, _co$);
550
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
551
+ get rows() {
552
+ return rows_object_();
553
+ },
554
+ layout: "grid",
555
+ element_attributes: {
556
+ class: "cards"
557
+ }
558
+ }, layout_options_, {
559
+ get children() {
560
+ return $9HbP8$createComponent((0, $9HbP8$Suspense), {
561
+ get fallback() {
562
+ return $6e41f1fde994db72$export$f33414a4df0afd3f({
563
+ num_placeholders_: num_placeholders_,
564
+ product_card_template_: product_card_template_
565
+ });
566
+ },
567
+ get children() {
568
+ return (() => {
569
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
570
+ const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource_() || []));
571
+ return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
572
+ displays_by_key_: displays_by_key_,
573
+ merchant_: merchant_,
574
+ market_: market_,
575
+ product_card_template_: product_card_template_
576
+ });
577
+ })();
578
+ }
579
+ });
580
+ }
581
+ })), _el$5, _co$2);
582
+ return _el$;
583
+ }
584
+ });
585
+ }
586
+ const $9ea5383493360761$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button class="show-more major" type="button"></button>`, 2),
587
+ $9ea5383493360761$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class="depict plp"></div>`, 2);
588
+ function $9ea5383493360761$export$9756467d34d91cdb(props) {
589
+ const rows_object_ = $9HbP8$createMemo(() => {
590
+ const view_more_button = props.view_more_button;
591
+ if (!view_more_button) return "all";
592
+ return {
593
+ start_rows: view_more_button.start_rows,
594
+ rows_per_click: view_more_button.rows_per_click,
595
+ button: (() => {
596
+ const _el$ = $9HbP8$getNextElement($9ea5383493360761$var$_tmpl$);
597
+ $9HbP8$insert(_el$, () => view_more_button.text);
598
+ return _el$;
599
+ })()
600
+ };
601
+ });
602
+ const grid_spacing_override = $9HbP8$createMemo(() => {
603
+ const {
604
+ grid_spacing: grid_spacing
605
+ } = props; // can be reactive
606
+ return typeof grid_spacing === "string" ? {
607
+ grid_spacing: grid_spacing
608
+ } : {
609
+ override_vertical_spacing: grid_spacing.vertical,
610
+ grid_spacing: grid_spacing.horizontal
611
+ };
612
+ });
613
+ const [recommendations_resource_] = $9HbP8$createResource(() => props.recommendations, recs => recs);
614
+ return (() => {
615
+ const _el$2 = $9HbP8$getNextElement($9ea5383493360761$var$_tmpl$2);
616
+ $9HbP8$insert(_el$2, () => $3da8afe3ed57cf34$export$7da560f849543dff({
617
+ rows_object_: rows_object_,
618
+ product_card_template_: (...args) => props.product_card_template(...args),
619
+ recommendations_resource_: recommendations_resource_,
620
+ market_: () => props.market,
621
+ merchant_: () => props.merchant,
622
+ layout_options_: $9HbP8$createMemo(() => ({
623
+ cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
624
+ ...grid_spacing_override()
625
+ }))
626
+ }));
627
+ return _el$2;
628
+ })();
629
+ }
9
630
  const $e8ffe11ed01df0fe$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<img>`, 1);
10
631
  function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
11
632
  const [size, setSize] = $9HbP8$createSignal(0);
@@ -61,42 +682,6 @@ function $f18d425032111270$export$94026ee33dbabc26(props) {
61
682
  return _el$;
62
683
  })();
63
684
  }
64
-
65
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
66
- class $4fd48cb976bf1789$export$e1d52e4f0c7557a1 extends Error {}
67
- class $4fd48cb976bf1789$export$aa14a9f43128f61f extends $4fd48cb976bf1789$export$e1d52e4f0c7557a1 {
68
- constructor(templateError) {
69
- super("Uncaught error in product card template", {
70
- cause: templateError
71
- });
72
- }
73
- }
74
- const $b7436a6d1fd64e3b$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
75
- function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
76
- return $9HbP8$ErrorBoundary({
77
- fallback(err, retry) {
78
- const {
79
- message_: message_,
80
- severity_: severity_
81
- } = props;
82
- let message = message_;
83
- if (err instanceof (0, $4fd48cb976bf1789$export$aa14a9f43128f61f)) {
84
- console.error(err.cause);
85
- message = `${message}: ${err.message}`;
86
- } else $9HbP8$report([err, message_], severity_);
87
- props.on_error_?.(retry);
88
- return (() => {
89
- const _el$ = $9HbP8$getNextElement($b7436a6d1fd64e3b$var$_tmpl$);
90
- $9HbP8$insert(_el$, message);
91
- $9HbP8$effect(_$p => $9HbP8$classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
92
- return _el$;
93
- })();
94
- },
95
- get children() {
96
- return props.children;
97
- }
98
- });
99
- }
100
685
  function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
101
686
  const {
102
687
  collapse: collapse,
@@ -215,54 +800,6 @@ function $8c0f86cb3e266eeb$export$a71e92cfbb498adc(props) {
215
800
  return $9HbP8$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
216
801
  });
217
802
  }
218
- const $fbbadcb080ad1d4a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<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>`, 4);
219
- function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
220
- return (() => {
221
- const _el$ = $9HbP8$getNextElement($fbbadcb080ad1d4a$var$_tmpl$);
222
- $9HbP8$effect(_p$ => {
223
- const _v$ = props.width_ ?? 14,
224
- _v$2 = props.height_ ?? 26;
225
- _v$ !== _p$._v$ && $9HbP8$setAttribute(_el$, "width", _p$._v$ = _v$);
226
- _v$2 !== _p$._v$2 && $9HbP8$setAttribute(_el$, "height", _p$._v$2 = _v$2);
227
- return _p$;
228
- }, {
229
- _v$: undefined,
230
- _v$2: undefined
231
- });
232
- return _el$;
233
- })();
234
- }
235
- const $f32e14878e75af51$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
236
- function $f32e14878e75af51$export$6649caad96ef8870({
237
- children: children,
238
- slider_ref_: slider_ref_,
239
- faded_opacity_ = 0.7,
240
- mutation_plugins_ = []
241
- }) {
242
- const slider = new (0, $9HbP8$Amazing_Slider)({
243
- button_contents: {
244
- left: [(() => {
245
- const _el$ = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
246
- $9HbP8$insert(_el$, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
247
- return _el$;
248
- })()],
249
- right: [(() => {
250
- const _el$2 = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
251
- $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
252
- return _el$2;
253
- })()]
254
- },
255
- constructor_plugins: [$9HbP8$slider_snap_css().constructor_plugin],
256
- mutation_plugins: [$9HbP8$slider_fading_factory({
257
- threshold_: 0.96,
258
- faded_opacity_: faded_opacity_
259
- }).mutation_plugin_, ...mutation_plugins_]
260
- });
261
- $9HbP8$insert(slider.insert_here, children);
262
- $9HbP8$onCleanup(() => slider.observer.disconnect());
263
- slider_ref_?.(slider);
264
- return slider.container;
265
- }
266
803
  const $bf52d9f9eebd1938$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
267
804
  const $bf52d9f9eebd1938$var$closing_functions = /*@__PURE__*/new Set();
268
805
  const $bf52d9f9eebd1938$export$22970a0140fc759c = /*@__PURE__*/$9HbP8$createSignal(false);
@@ -2607,166 +3144,33 @@ function $5efb5894079b220e$var$modify_only_local_filter(local_filter_object, sel
2607
3144
  ...old_meta
2608
3145
  };
2609
3146
  modified_filter_object.meta = new_meta;
2610
- // set counts to 0
2611
- if ("counts" in new_meta) {
2612
- const counts = new_meta.counts;
2613
- if (counts) new_meta.counts = counts.map(() => 0);
2614
- }
2615
- if (Array.isArray(selected_filter_data) && "values" in new_meta) {
2616
- // we have an array of values and want to strip the ones from the available ones that aren't selected
2617
- const values = new_meta.values;
2618
- if (Array.isArray(values)) {
2619
- const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
2620
- const indexes_to_remove = new Set();
2621
- for (let i = 0; i < values.length; i++) {
2622
- const value = values[i];
2623
- if (!jsond_set_values.includes(JSON.stringify(value)))
2624
- // We want to remove the entry with this value from the filter object because it's not selected
2625
- indexes_to_remove.add(i);
2626
- }
2627
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2628
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2629
- if (new_meta.counts)
2630
- // remove counts that are too much, they're all zero anyway if they exist
2631
- new_meta.counts.length -= indexes_to_remove.size;
2632
- }
2633
- }
2634
- }
2635
- return modified_filter_object;
2636
- }
2637
- function $a52235d12ccf9c88$export$2f0cbfbb4354bb52(elements) {
2638
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
2639
- return $9HbP8$createMemo(() => $a52235d12ccf9c88$var$unwrapping_helper(elements));
2640
- }
2641
- function $a52235d12ccf9c88$var$unwrapping_helper(elements) {
2642
- const result = [];
2643
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
2644
- const element = elements[i];
2645
- result.push(...$a52235d12ccf9c88$var$unwrapping_helper(element));
2646
- } else if (typeof elements == "function") result.push(...$a52235d12ccf9c88$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
2647
- return result;
2648
- }
2649
- const $c8d5ff4524619fcd$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2),
2650
- $c8d5ff4524619fcd$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<style type="text/css"></style>`, 2);
2651
- function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
2652
- const container_element_ = (() => {
2653
- const _el$ = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
2654
- $9HbP8$spread(_el$, $9HbP8$mergeProps(() => props.element_attributes), false, true);
2655
- $9HbP8$insert(_el$, () => props.children);
2656
- $9HbP8$runHydrationEvents();
2657
- return _el$;
2658
- })(); // Don't want this in the error boundary below, it should only be for the actual layouting
2659
- return $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
2660
- get message_() {
2661
- return "Failed calculating " + props.layout + " layout";
2662
- },
2663
- severity_: "error",
2664
- get children() {
2665
- return $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element_);
2666
- }
2667
- });
2668
- }
2669
- function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
2670
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2671
- const show_all_rows = $9HbP8$createMemo(() => props.rows === "all");
2672
- const rows_or_empty_object = $9HbP8$createMemo(() => show_all_rows() ? {} : props.rows);
2673
- const view_more_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().button));
2674
- const view_less_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().view_less_button));
2675
- const have_a_view_more_button = $9HbP8$createMemo(() => {
2676
- const button = view_more_button_elements();
2677
- return !(!button || Array.isArray(button) && !button.length);
2678
- });
2679
- const have_a_view_less_button = $9HbP8$createMemo(() => {
2680
- const button = view_less_button_elements();
2681
- return !(!button || Array.isArray(button) && !button.length);
2682
- });
2683
- const [get_styling, set_styling] = $9HbP8$createSignal();
2684
- const container_class = $9HbP8$make_random_classname();
2685
- const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
2686
- const [get_children_count, set_children_count] = $9HbP8$createSignal(0);
2687
- const update_children_count = () => set_children_count(container_element.children.length);
2688
- const col_styling = $9HbP8$createMemo(() => $9HbP8$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2689
- const default_currently_visible_signal = $9HbP8$createSignal($9HbP8$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
2690
- const rows_visible_signal = $9HbP8$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2691
- const get_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[0]());
2692
- const set_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[1]);
2693
- const view_more_button_class = $9HbP8$make_random_classname();
2694
- const view_less_button_class = $9HbP8$make_random_classname();
2695
- const view_more_button_container = $9HbP8$createMemo(() => have_a_view_more_button() && (() => {
2696
- const _el$2 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
2697
- $9HbP8$addEventListener(_el$2, "click", $9HbP8$catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
2698
- $9HbP8$className(_el$2, `load-more-container ${view_more_button_class}`);
2699
- $9HbP8$insert(_el$2, () => rows_or_empty_object().button);
2700
- $9HbP8$runHydrationEvents();
2701
- return _el$2;
2702
- })());
2703
- // 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
2704
- const view_less_button_container = $9HbP8$createMemo(() => have_a_view_less_button() && (() => {
2705
- const _el$3 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
2706
- $9HbP8$addEventListener(_el$3, "click", $9HbP8$catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
2707
- $9HbP8$className(_el$3, `load-less-container ${view_less_button_class}`);
2708
- $9HbP8$insert(_el$3, () => rows_or_empty_object().view_less_button);
2709
- $9HbP8$runHydrationEvents();
2710
- return _el$3;
2711
- })());
2712
- container_element.classList.add(container_class);
2713
- $9HbP8$createComputed(() => {
2714
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
2715
- const rows_visible = get_rows_visible();
2716
- const max_rows = rows_or_empty_object().max_rows;
2717
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
2718
- });
2719
- $9HbP8$createRenderEffect(() => {
2720
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
2721
- if (show_all_rows()) {
2722
- // no view more functionality requested
2723
- set_styling(() => col_styling);
2724
- return;
2725
- }
2726
- update_children_count();
2727
- const mutation_observer = new MutationObserver($9HbP8$catchify(update_children_count));
2728
- mutation_observer.observe(container_element, {
2729
- childList: true
2730
- });
2731
- $9HbP8$onCleanup(() => mutation_observer.disconnect());
2732
- set_styling(
2733
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
2734
- () => $9HbP8$createMemo(() => {
2735
- const {
2736
- rows_per_click: rows_per_click,
2737
- max_rows = -1,
2738
- start_rows: start_rows
2739
- } = rows_or_empty_object();
2740
- const rows_visible = get_rows_visible();
2741
- const children_count = get_children_count();
2742
- return col_styling() + props.cols_at_size.map(options => {
2743
- const [recs_per_row, min, max] = options;
2744
- let should_hide_view_more_button;
2745
- let visible_recs;
2746
- if (props.disable_partial_rows) {
2747
- visible_recs = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
2748
- const visible_recs_next_show_more = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
2749
- // Should this really be zero when we default rows_per_click to 1?
2750
- children_count, options);
2751
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
2752
- } else {
2753
- visible_recs = $9HbP8$layout_get_total_rec_amount_for_row(rows_visible, options);
2754
- should_hide_view_more_button = visible_recs >= children_count;
3147
+ // set counts to 0
3148
+ if ("counts" in new_meta) {
3149
+ const counts = new_meta.counts;
3150
+ if (counts) new_meta.counts = counts.map(() => 0);
3151
+ }
3152
+ if (Array.isArray(selected_filter_data) && "values" in new_meta) {
3153
+ // we have an array of values and want to strip the ones from the available ones that aren't selected
3154
+ const values = new_meta.values;
3155
+ if (Array.isArray(values)) {
3156
+ const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
3157
+ const indexes_to_remove = new Set();
3158
+ for (let i = 0; i < values.length; i++) {
3159
+ const value = values[i];
3160
+ if (!jsond_set_values.includes(JSON.stringify(value)))
3161
+ // We want to remove the entry with this value from the filter object because it's not selected
3162
+ indexes_to_remove.add(i);
2755
3163
  }
2756
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
2757
- // 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
2758
- 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;
2759
- return `${$9HbP8$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}` : ``}}`;
2760
- }).join("");
2761
- }));
2762
- });
2763
- return [container_element, $9HbP8$memo(view_more_button_container), $9HbP8$memo(view_less_button_container), (() => {
2764
- const _el$4 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$2);
2765
- $9HbP8$insert(_el$4, get_styling);
2766
- return _el$4;
2767
- })()];
3164
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
3165
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
3166
+ if (new_meta.counts)
3167
+ // remove counts that are too much, they're all zero anyway if they exist
3168
+ new_meta.counts.length -= indexes_to_remove.size;
3169
+ }
3170
+ }
3171
+ }
3172
+ return modified_filter_object;
2768
3173
  }
2769
- $9HbP8$delegateEvents(["click"]);
2770
3174
  async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2771
3175
  const body = await (0, $9HbP8$observer).wait_for_element("body");
2772
3176
  let dispose_and_remove;
@@ -3462,92 +3866,6 @@ function $598245ecfe38f34b$export$ef6006467f04ee41({
3462
3866
  })()];
3463
3867
  }
3464
3868
  $9HbP8$delegateEvents(["click"]);
3465
- function $a458486f22b22f63$export$a2cc176055f8f08() {
3466
- 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.";
3467
- return (0, $9HbP8$isServer) ? `<!-- ${text} -->` : document.createComment(text);
3468
- }
3469
- let $6e41f1fde994db72$var$cached_placeholder_element;
3470
- let $6e41f1fde994db72$var$rendering_cached_placeholder_element;
3471
- function $6e41f1fde994db72$export$f33414a4df0afd3f({
3472
- product_card_template_: product_card_template_,
3473
- num_placeholders_: num_placeholders_
3474
- }) {
3475
- const [get_elements, set_elements] = $9HbP8$createSignal([]);
3476
- let existing_num = 0;
3477
- if (0, $9HbP8$isServer)
3478
- // want to render simple placeholders on server, effects don't run there
3479
- return $9HbP8$createMemo(() => Array.from({
3480
- length: num_placeholders_()
3481
- }).map(() => {
3482
- const template_result = product_card_template_(null, undefined);
3483
- // @ts-ignore
3484
- if (typeof template_result?.then !== "function") return template_result;
3485
- }));
3486
- $9HbP8$createRenderEffect(() => {
3487
- const to_add = num_placeholders_() - existing_num;
3488
- if (to_add <= 0) return;
3489
- // 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.
3490
- // 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.
3491
- // 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.
3492
- set_elements(prev => [...prev, ...Array.from({
3493
- length: to_add
3494
- }).map(() => $6e41f1fde994db72$var$Placeholder({
3495
- product_card_template_: product_card_template_
3496
- }))]);
3497
- existing_num += to_add;
3498
- });
3499
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3500
- }
3501
- /**
3502
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
3503
- */
3504
- function $6e41f1fde994db72$var$Placeholder({
3505
- product_card_template_: product_card_template_
3506
- }) {
3507
- 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;
3508
- if ($6e41f1fde994db72$var$cached_placeholder_element) return get_cloned_placeholders();
3509
- let dispose_original_copy;
3510
- const get_unwrapped_element = $9HbP8$createRoot(dispose => {
3511
- dispose_original_copy = dispose;
3512
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
3513
- const [resource] = $9HbP8$createResource(() => {
3514
- if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) return $6e41f1fde994db72$var$rendering_cached_placeholder_element;
3515
- const return_value = product_card_template_(null, undefined);
3516
- if (typeof return_value === "object" && typeof return_value?.then === "function")
3517
- // Is Promise or promise-like object
3518
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = return_value;
3519
- return return_value;
3520
- });
3521
- return $9HbP8$createMemo(() => {
3522
- if (resource.loading) return () => [];
3523
- return $a52235d12ccf9c88$export$2f0cbfbb4354bb52(resource);
3524
- });
3525
- });
3526
- $9HbP8$onCleanup(() => {
3527
- if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) {
3528
- // 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
3529
- const unset_current_rendering = () => {
3530
- dispose_original_copy();
3531
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
3532
- };
3533
- $6e41f1fde994db72$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
3534
- } else
3535
- // Otherwise, just make sure we've disposed our root
3536
- dispose_original_copy();
3537
- });
3538
- return $9HbP8$createMemo(() => {
3539
- const unwrapped_array = get_unwrapped_element()();
3540
- if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
3541
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
3542
- return;
3543
- // placeholders have finished rendering, freeze the elements
3544
- // 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
3545
- $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
3546
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
3547
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
3548
- 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
3549
- });
3550
- }
3551
3869
 
3552
3870
  /*
3553
3871
  * 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.
@@ -3653,86 +3971,6 @@ function $0e0b96a8dc1ad492$export$63dd0350f8559dda({
3653
3971
  equals: false
3654
3972
  });
3655
3973
  }
3656
-
3657
- /**
3658
- * Gets product_id (the thing we key the rendering on) from a display
3659
- */
3660
- function $16351e4c87b90b3d$export$548d053aba053d79(display) {
3661
- if ("variant_index" in display) {
3662
- const actual_display = display.variant_displays[display.variant_index];
3663
- return actual_display.product_id;
3664
- }
3665
- return display.product_id;
3666
- }
3667
- function $29ec7cddbe1d3484$export$7f8bd308237ab5a5(get_displays_) {
3668
- const displays_by_key_ = $9HbP8$createMemo(() => {
3669
- const displays = get_displays_();
3670
- // We key by product_id because that's what can be used to uniquely identify products
3671
- // This way <For> can optimize the rendering
3672
- const map = new Map();
3673
- for (let i = 0; i < displays.length; i++) {
3674
- const display = displays[i];
3675
- const product_id = $16351e4c87b90b3d$export$548d053aba053d79(display);
3676
- map.set(product_id, display);
3677
- }
3678
- return map;
3679
- });
3680
- return displays_by_key_;
3681
- }
3682
- function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
3683
- displays_by_key_: displays_by_key_,
3684
- merchant_: merchant_,
3685
- market_: market_,
3686
- product_card_template_: product_card_template_,
3687
- do_per_elements_: do_per_elements_
3688
- }) {
3689
- return $9HbP8$createComponent((0, $9HbP8$For), {
3690
- get each() {
3691
- return [...displays_by_key_().keys()];
3692
- },
3693
- children: (product_id, index) => {
3694
- const owner = $9HbP8$getOwner();
3695
- const display_accessor = $9HbP8$createMemo(() => displays_by_key_().get(product_id));
3696
- const [product_card_resource] = $9HbP8$createResource(display_accessor,
3697
- // re-render when the reference to the display object changes
3698
- // this should only be the case when the merchant or market changes and the new request has completed
3699
- display => {
3700
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
3701
- return product_card_template_(display, {
3702
- set_on_index_change: fn => $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() => fn(index()))),
3703
- merchant: $9HbP8$untrack(merchant_),
3704
- // 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
3705
- market: $9HbP8$untrack(market_)
3706
- });
3707
- });
3708
- const node_accessor = $a52235d12ccf9c88$export$2f0cbfbb4354bb52(product_card_resource);
3709
- $9HbP8$createEffect(() => {
3710
- const product_card_nodes = node_accessor();
3711
- const display = display_accessor();
3712
- const elements = [];
3713
- for (let i = 0; i < product_card_nodes.length; i++) {
3714
- const element = product_card_nodes[i];
3715
- if (!(element instanceof Element)) continue;
3716
- elements.push(element);
3717
- // Add tracking ids
3718
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
3719
- const {
3720
- dataset: dataset
3721
- } = element;
3722
- const {
3723
- search_result_id: search_result_id,
3724
- product_listing_result_id: product_listing_result_id,
3725
- recommendation_id: recommendation_id
3726
- } = display;
3727
- 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;
3728
- }
3729
- do_per_elements_?.(elements, index);
3730
- });
3731
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3732
- }
3733
- });
3734
- }
3735
-
3736
3974
  function $0449e7d49398c077$export$a1fd619a4743ca08({
3737
3975
  plp_results_: plp_results_,
3738
3976
  product_card_template_: product_card_template_,
@@ -6018,41 +6256,6 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6018
6256
  return _el$13;
6019
6257
  })()];
6020
6258
  }
6021
- const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
6022
- const cols_at_size = [];
6023
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
6024
- const [nb_cols, width] = sorted_cols_at_size[i];
6025
- const next_width = sorted_cols_at_size[i + 1]?.[1];
6026
- const max_width = i === 0 ? "" : `${width}px`;
6027
- const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
6028
- const col_at_size = [nb_cols, min_width, max_width];
6029
- cols_at_size.push(col_at_size);
6030
- }
6031
- return cols_at_size;
6032
- };
6033
- const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
6034
- // Check that every element is an array
6035
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
6036
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
6037
- // Check width duplicates
6038
- const widths = cols_at_size.map(([_, width]) => width);
6039
- const widths_set = new Set(widths);
6040
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
6041
- if (cols_at_size.length === 1) {
6042
- const [nb_cols, width] = cols_at_size[0];
6043
- const max_width = width !== undefined ? `${width}px` : "";
6044
- return [[nb_cols, "", max_width]];
6045
- }
6046
- // Sort widths in ascending order
6047
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
6048
- const [_b, width_A] = a;
6049
- const [_a, width_b] = b;
6050
- if (width_A === undefined) return -1;
6051
- if (width_b === undefined) return 1;
6052
- return width_b - width_A;
6053
- });
6054
- return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
6055
- };
6056
6259
  function $16b52438165aafe2$export$23fca46f3143581f(component, error_message) {
6057
6260
  const component_in_error_boundary = do_with_elements => {
6058
6261
  const error_boundary_wrapped = $b7436a6d1fd64e3b$export$b69d0d92862de18b({
@@ -6356,7 +6559,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
6356
6559
  #meta_title_suffix_ = $9HbP8$createSignal();
6357
6560
  #disable_override_query_id = $9HbP8$createSignal();
6358
6561
  #listing_type_signal = $9HbP8$createSignal();
6359
- static #keys_constructed_with = new Set();
6562
+ static #keys_constructed_with = /*@__PURE__*/new Set();
6360
6563
  get localization() {
6361
6564
  // allow reactive access
6362
6565
  return this.#locale_signal[0]();
@@ -9602,27 +9805,6 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
9602
9805
  cleanup: cleanup
9603
9806
  };
9604
9807
  }
9605
-
9606
- /**
9607
- * 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
9608
- */
9609
- function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
9610
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
9611
- const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
9612
- const [[, smallest_max_width]] = sorted_sizes;
9613
- if (smallest_max_width > min_width_for_more_than_one_column)
9614
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
9615
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
9616
- const to_delete = [];
9617
- for (let i = 0; i < sorted_sizes.length; i++) {
9618
- const [, max_width] = sorted_sizes[i];
9619
- if (max_width > min_width_for_more_than_one_column) continue;
9620
- to_delete.push(i);
9621
- }
9622
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
9623
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
9624
- return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
9625
- }
9626
9808
  const $806c97b931758897$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="depict plp search"></div>`, 2);
9627
9809
  // 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
9628
9810
  /**
@@ -9641,7 +9823,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
9641
9823
  #market_signal = $9HbP8$createSignal();
9642
9824
  #modal_open_signal = $9HbP8$createSignal(false);
9643
9825
  #content_search_signal = $9HbP8$createSignal();
9644
- static #keys_constructed_with = new Set();
9826
+ static #keys_constructed_with = /*@__PURE__*/new Set();
9645
9827
  #router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation");
9646
9828
  constructor({
9647
9829
  unique_instance_key_for_state = "",
@@ -10159,7 +10341,7 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
10159
10341
  #revert_fns = [];
10160
10342
  #is_open = false;
10161
10343
  static #reverting_permitted = true;
10162
- static #visited_urls = (() => {
10344
+ static #visited_urls = /*@__PURE__*/(() => {
10163
10345
  // 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).
10164
10346
  $9HbP8$catchify(async () => {
10165
10347
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
@@ -10200,14 +10382,14 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
10200
10382
  return $9HbP8$catchify(this.render_, "rendering failed")() || [];
10201
10383
  });
10202
10384
  }
10203
- #unload = $9HbP8$catchify(() => {
10385
+ #unload = /*@__PURE__*/$9HbP8$catchify(() => {
10204
10386
  if (!this.#is_open) return;
10205
10387
  this.#disconnect_observer?.();
10206
10388
  if ($753e9b2889a47c89$export$3ccaa27d81dd8556.#reverting_permitted) while (this.#revert_fns.length) this.#revert_fns.pop()?.();
10207
10389
  this.#is_open = false;
10208
10390
  this.dispatchEvent(new CustomEvent("close"));
10209
10391
  }, "failed to close page");
10210
- #load = $9HbP8$catchify(async els => {
10392
+ #load = /*@__PURE__*/$9HbP8$catchify(async els => {
10211
10393
  this.#is_open = true;
10212
10394
  // So that #load doesn't get called again
10213
10395
  let set_should_stay_inserted;
@@ -10322,4 +10504,4 @@ const $4690a06c8489dcd0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
10322
10504
  const $4690a06c8489dcd0$export$864d304a0bc46829 = "2%";
10323
10505
  const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b91cec6bdc6b32a1);
10324
10506
  $9HbP8$add_to_version_info("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
10325
- 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 };
10507
+ 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 };