@depict-ai/ui 1.4.22 → 1.4.24

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.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  var $gVhhF$depictaiutilishared = require("@depict-ai/utilishared/latest");
2
2
  var $gVhhF$solidjsweb = require("solid-js/web");
3
3
  var $gVhhF$solidjs = require("solid-js");
4
+ var $gVhhF$depictaiutilisharedlatest = require("@depict-ai/utilishared/latest/latest");
4
5
  require("../multi_import_deduplicator.cjs").register_es_version("ui", "latest");
5
6
  function $parcel$export(e, n, v, s) {
6
7
  Object.defineProperty(e, n, {
@@ -10,6 +11,8 @@ function $parcel$export(e, n, v, s) {
10
11
  configurable: true
11
12
  });
12
13
  }
14
+ $parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
15
+ $parcel$export(module.exports, "RecommendationGrid", () => $1f8dbf7e28b3eff2$export$9756467d34d91cdb);
13
16
  $parcel$export(module.exports, "ShopifyResponsiveImg", () => $19950faaac026e09$export$6e5611bc7e57e477);
14
17
  $parcel$export(module.exports, "makeSizeAccessor", () => $19950faaac026e09$export$e6fffe67d4cdd848);
15
18
  $parcel$export(module.exports, "ImageContainer", () => $93304d59a9747aa6$export$94026ee33dbabc26);
@@ -58,7 +61,634 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
58
61
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
59
62
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
60
63
  /*! Depict.ai search and product listing SDK */
61
- const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.22";
64
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.24";
65
+ const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
66
+ const cols_at_size = [];
67
+ for (let i = 0; i < sorted_cols_at_size.length; i++) {
68
+ const [nb_cols, width] = sorted_cols_at_size[i];
69
+ const next_width = sorted_cols_at_size[i + 1]?.[1];
70
+ const max_width = i === 0 ? "" : `${width}px`;
71
+ const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
72
+ const col_at_size = [nb_cols, min_width, max_width];
73
+ cols_at_size.push(col_at_size);
74
+ }
75
+ return cols_at_size;
76
+ };
77
+ const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
78
+ // Check that every element is an array
79
+ const are_arrays = cols_at_size.every(element => Array.isArray(element));
80
+ if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
81
+ // Check width duplicates
82
+ const widths = cols_at_size.map(([_, width]) => width);
83
+ const widths_set = new Set(widths);
84
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
85
+ if (cols_at_size.length === 1) {
86
+ const [nb_cols, width] = cols_at_size[0];
87
+ const max_width = width !== undefined ? `${width}px` : "";
88
+ return [[nb_cols, "", max_width]];
89
+ }
90
+ // Sort widths in ascending order
91
+ const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
92
+ const [_b, width_A] = a;
93
+ const [_a, width_b] = b;
94
+ if (width_A === undefined) return -1;
95
+ if (width_b === undefined) return 1;
96
+ return width_b - width_A;
97
+ });
98
+ return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
99
+ };
100
+
101
+ /**
102
+ * 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
103
+ */
104
+ function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
105
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
106
+ const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
107
+ const [[, smallest_max_width]] = sorted_sizes;
108
+ if (smallest_max_width > min_width_for_more_than_one_column)
109
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
110
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
111
+ const to_delete = [];
112
+ for (let i = 0; i < sorted_sizes.length; i++) {
113
+ const [, max_width] = sorted_sizes[i];
114
+ if (max_width > min_width_for_more_than_one_column) continue;
115
+ to_delete.push(i);
116
+ }
117
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
118
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
119
+ return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
120
+ }
121
+ function $fc23d7668ae0011d$export$a2cc176055f8f08() {
122
+ 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.";
123
+ return (0, $gVhhF$solidjsweb.isServer) ? `<!-- ${text} -->` : document.createComment(text);
124
+ }
125
+ function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
126
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
127
+ return $gVhhF$solidjs.createMemo(() => $5f7d55c710fd1bc2$var$unwrapping_helper(elements));
128
+ }
129
+ function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
130
+ const result = [];
131
+ if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
132
+ const element = elements[i];
133
+ result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
134
+ } else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
135
+ return result;
136
+ }
137
+ let $0caf87eaa19079da$var$cached_placeholder_element;
138
+ let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
139
+ function $0caf87eaa19079da$export$f33414a4df0afd3f({
140
+ product_card_template_: product_card_template_,
141
+ num_placeholders_: num_placeholders_
142
+ }) {
143
+ const [get_elements, set_elements] = $gVhhF$solidjs.createSignal([]);
144
+ let existing_num = 0;
145
+ if (0, $gVhhF$solidjsweb.isServer)
146
+ // want to render simple placeholders on server, effects don't run there
147
+ return $gVhhF$solidjs.createMemo(() => Array.from({
148
+ length: num_placeholders_()
149
+ }).map(() => {
150
+ const template_result = product_card_template_(null, undefined);
151
+ // @ts-ignore
152
+ if (typeof template_result?.then !== "function") return template_result;
153
+ }));
154
+ $gVhhF$solidjs.createRenderEffect(() => {
155
+ const to_add = num_placeholders_() - existing_num;
156
+ if (to_add <= 0) return;
157
+ // 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.
158
+ // 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.
159
+ // 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.
160
+ set_elements(prev => [...prev, ...Array.from({
161
+ length: to_add
162
+ }).map(() => $0caf87eaa19079da$var$Placeholder({
163
+ product_card_template_: product_card_template_
164
+ }))]);
165
+ existing_num += to_add;
166
+ });
167
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
168
+ }
169
+ /**
170
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
171
+ */
172
+ function $0caf87eaa19079da$var$Placeholder({
173
+ product_card_template_: product_card_template_
174
+ }) {
175
+ const get_cloned_placeholders = (element_to_clone = $0caf87eaa19079da$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
176
+ if ($0caf87eaa19079da$var$cached_placeholder_element) return get_cloned_placeholders();
177
+ let dispose_original_copy;
178
+ const get_unwrapped_element = $gVhhF$solidjs.createRoot(dispose => {
179
+ dispose_original_copy = dispose;
180
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
181
+ const [resource] = $gVhhF$solidjs.createResource(() => {
182
+ if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) return $0caf87eaa19079da$var$rendering_cached_placeholder_element;
183
+ const return_value = product_card_template_(null, undefined);
184
+ if (typeof return_value === "object" && typeof return_value?.then === "function")
185
+ // Is Promise or promise-like object
186
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element = return_value;
187
+ return return_value;
188
+ });
189
+ return $gVhhF$solidjs.createMemo(() => {
190
+ if (resource.loading) return () => [];
191
+ return $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(resource);
192
+ });
193
+ });
194
+ $gVhhF$solidjs.onCleanup(() => {
195
+ if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) {
196
+ // 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
197
+ const unset_current_rendering = () => {
198
+ dispose_original_copy();
199
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
200
+ };
201
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
202
+ } else
203
+ // Otherwise, just make sure we've disposed our root
204
+ dispose_original_copy();
205
+ });
206
+ return $gVhhF$solidjs.createMemo(() => {
207
+ const unwrapped_array = get_unwrapped_element()();
208
+ if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
209
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
210
+ return;
211
+ // placeholders have finished rendering, freeze the elements
212
+ // 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
213
+ $0caf87eaa19079da$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
214
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
215
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
216
+ 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
217
+ });
218
+ }
219
+
220
+ /**
221
+ * Gets product_id (the thing we key the rendering on) from a display
222
+ */
223
+ function $a5871dacf261adf8$export$548d053aba053d79(display) {
224
+ if ("variant_index" in display) {
225
+ const actual_display = display.variant_displays[display.variant_index];
226
+ return actual_display.product_id;
227
+ }
228
+ return display.product_id;
229
+ }
230
+ function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
231
+ const displays_by_key_ = $gVhhF$solidjs.createMemo(() => {
232
+ const displays = get_displays_();
233
+ // We key by product_id because that's what can be used to uniquely identify products
234
+ // This way <For> can optimize the rendering
235
+ const map = new Map();
236
+ for (let i = 0; i < displays.length; i++) {
237
+ const display = displays[i];
238
+ const product_id = $a5871dacf261adf8$export$548d053aba053d79(display);
239
+ map.set(product_id, display);
240
+ }
241
+ return map;
242
+ });
243
+ return displays_by_key_;
244
+ }
245
+ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
246
+ displays_by_key_: displays_by_key_,
247
+ merchant_: merchant_,
248
+ market_: market_,
249
+ product_card_template_: product_card_template_,
250
+ do_per_elements_: do_per_elements_
251
+ }) {
252
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
253
+ get each() {
254
+ return [...displays_by_key_().keys()];
255
+ },
256
+ children: (product_id, index) => {
257
+ const owner = $gVhhF$solidjs.getOwner();
258
+ const display_accessor = $gVhhF$solidjs.createMemo(() => displays_by_key_().get(product_id));
259
+ const [product_card_resource] = $gVhhF$solidjs.createResource(display_accessor,
260
+ // re-render when the reference to the display object changes
261
+ // this should only be the case when the merchant or market changes and the new request has completed
262
+ display => {
263
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
264
+ return product_card_template_(display, {
265
+ set_on_index_change: fn => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => fn(index()))),
266
+ merchant: $gVhhF$solidjs.untrack(merchant_),
267
+ // 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
268
+ market: $gVhhF$solidjs.untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
269
+ });
270
+ });
271
+
272
+ const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
273
+ $gVhhF$solidjs.createEffect(() => {
274
+ const product_card_nodes = node_accessor();
275
+ const display = display_accessor();
276
+ const elements = [];
277
+ for (let i = 0; i < product_card_nodes.length; i++) {
278
+ const element = product_card_nodes[i];
279
+ if (!(element instanceof Element)) continue;
280
+ elements.push(element);
281
+ // Add tracking ids
282
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
283
+ const {
284
+ dataset: dataset
285
+ } = element;
286
+ const {
287
+ search_result_id: search_result_id,
288
+ product_listing_result_id: product_listing_result_id,
289
+ recommendation_id: recommendation_id
290
+ } = display;
291
+ 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;
292
+ }
293
+ do_per_elements_?.(elements, index);
294
+ });
295
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
296
+ }
297
+ });
298
+ }
299
+
300
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
301
+ class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
302
+ class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
303
+ constructor(templateError) {
304
+ super("Uncaught error in product card template", {
305
+ cause: templateError
306
+ });
307
+ }
308
+ }
309
+ const $edafe91daf3091d7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
310
+ function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
311
+ return $gVhhF$solidjs.ErrorBoundary({
312
+ fallback(err, retry) {
313
+ const {
314
+ message_: message_,
315
+ severity_: severity_
316
+ } = props;
317
+ let message = message_;
318
+ if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
319
+ console.error(err.cause);
320
+ message = `${message}: ${err.message}`;
321
+ } else $gVhhF$depictaiutilishared.report([err, message_], severity_);
322
+ props.on_error_?.(retry);
323
+ return (() => {
324
+ const _el$ = $gVhhF$solidjsweb.getNextElement($edafe91daf3091d7$var$_tmpl$);
325
+ $gVhhF$solidjsweb.insert(_el$, message);
326
+ $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
327
+ return _el$;
328
+ })();
329
+ },
330
+ get children() {
331
+ return props.children;
332
+ }
333
+ });
334
+ }
335
+ const $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2),
336
+ $f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type="text/css"></style>`, 2);
337
+ function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
338
+ const container_element_ = (() => {
339
+ const _el$ = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
340
+ $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(() => props.element_attributes), false, true);
341
+ $gVhhF$solidjsweb.insert(_el$, () => props.children);
342
+ $gVhhF$solidjsweb.runHydrationEvents();
343
+ return _el$;
344
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
345
+ return $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
346
+ get message_() {
347
+ return "Failed calculating " + props.layout + " layout";
348
+ },
349
+ severity_: "error",
350
+ get children() {
351
+ return $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element_);
352
+ }
353
+ });
354
+ }
355
+ function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
356
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
357
+ const show_all_rows = $gVhhF$solidjs.createMemo(() => props.rows === "all");
358
+ const rows_or_empty_object = $gVhhF$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
359
+ const view_more_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().button));
360
+ const view_less_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
361
+ const have_a_view_more_button = $gVhhF$solidjs.createMemo(() => {
362
+ const button = view_more_button_elements();
363
+ return !(!button || Array.isArray(button) && !button.length);
364
+ });
365
+ const have_a_view_less_button = $gVhhF$solidjs.createMemo(() => {
366
+ const button = view_less_button_elements();
367
+ return !(!button || Array.isArray(button) && !button.length);
368
+ });
369
+ const [get_styling, set_styling] = $gVhhF$solidjs.createSignal();
370
+ const container_class = $gVhhF$depictaiutilishared.make_random_classname();
371
+ const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
372
+ const [get_children_count, set_children_count] = $gVhhF$solidjs.createSignal(0);
373
+ const update_children_count = () => set_children_count(container_element.children.length);
374
+ const col_styling = $gVhhF$solidjs.createMemo(() => $gVhhF$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
375
+ const default_currently_visible_signal = $gVhhF$solidjs.createSignal($gVhhF$solidjs.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
376
+ const rows_visible_signal = $gVhhF$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
377
+ const get_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[0]());
378
+ const set_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[1]);
379
+ const view_more_button_class = $gVhhF$depictaiutilishared.make_random_classname();
380
+ const view_less_button_class = $gVhhF$depictaiutilishared.make_random_classname();
381
+ const style_element = (() => {
382
+ const _el$2 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
383
+ $gVhhF$solidjsweb.insert(_el$2, get_styling);
384
+ return _el$2;
385
+ })();
386
+ const view_more_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_more_button() && (() => {
387
+ const _el$3 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
388
+ $gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
389
+ $gVhhF$solidjsweb.className(_el$3, `load-more-container ${view_more_button_class}`);
390
+ $gVhhF$solidjsweb.insert(_el$3, () => rows_or_empty_object().button);
391
+ $gVhhF$solidjsweb.runHydrationEvents();
392
+ return _el$3;
393
+ })());
394
+ // 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
395
+ const view_less_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_less_button() && (() => {
396
+ const _el$4 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
397
+ $gVhhF$solidjsweb.addEventListener(_el$4, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
398
+ $gVhhF$solidjsweb.className(_el$4, `load-less-container ${view_less_button_class}`);
399
+ $gVhhF$solidjsweb.insert(_el$4, () => rows_or_empty_object().view_less_button);
400
+ $gVhhF$solidjsweb.runHydrationEvents();
401
+ return _el$4;
402
+ })());
403
+ container_element.classList.add(container_class);
404
+ $gVhhF$solidjs.createComputed(() => {
405
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
406
+ const rows_visible = get_rows_visible();
407
+ const max_rows = rows_or_empty_object().max_rows;
408
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
409
+ });
410
+ $gVhhF$solidjs.createRenderEffect(() => {
411
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
412
+ if (show_all_rows()) {
413
+ // no view more functionality requested
414
+ set_styling(() => col_styling);
415
+ return;
416
+ }
417
+ update_children_count();
418
+ const mutation_observer = new MutationObserver($gVhhF$depictaiutilishared.catchify(update_children_count));
419
+ mutation_observer.observe(container_element, {
420
+ childList: true
421
+ });
422
+ $gVhhF$solidjs.onCleanup(() => mutation_observer.disconnect());
423
+ set_styling(
424
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
425
+ () => $gVhhF$solidjs.createMemo(() => {
426
+ const {
427
+ rows_per_click: rows_per_click,
428
+ max_rows = -1,
429
+ start_rows: start_rows
430
+ } = rows_or_empty_object();
431
+ const rows_visible = get_rows_visible();
432
+ const children_count = get_children_count();
433
+ return col_styling() + props.cols_at_size.map(options => {
434
+ const [recs_per_row, min, max] = options;
435
+ let should_hide_view_more_button;
436
+ let visible_recs;
437
+ if (props.disable_partial_rows) {
438
+ visible_recs = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
439
+ const visible_recs_next_show_more = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
440
+ // Should this really be zero when we default rows_per_click to 1?
441
+ children_count, options);
442
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
443
+ } else {
444
+ visible_recs = $gVhhF$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
445
+ should_hide_view_more_button = visible_recs >= children_count;
446
+ }
447
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
448
+ // 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
449
+ 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;
450
+ return `${$gVhhF$depictaiutilishared.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}` : ``}}`;
451
+ }).join("");
452
+ }));
453
+ });
454
+ if (insert_after_container) container_element.after(style_element);
455
+ return [container_element, $gVhhF$solidjsweb.memo(view_more_button_container), $gVhhF$solidjsweb.memo(view_less_button_container), style_element];
456
+ }
457
+ $gVhhF$solidjsweb.delegateEvents(["click"]);
458
+ const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.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);
459
+ function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
460
+ return (() => {
461
+ const _el$ = $gVhhF$solidjsweb.getNextElement($0f313083912e447a$var$_tmpl$);
462
+ $gVhhF$solidjsweb.effect(_p$ => {
463
+ const _v$ = props.width_ ?? 14,
464
+ _v$2 = props.height_ ?? 26;
465
+ _v$ !== _p$._v$ && $gVhhF$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
466
+ _v$2 !== _p$._v$2 && $gVhhF$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
467
+ return _p$;
468
+ }, {
469
+ _v$: undefined,
470
+ _v$2: undefined
471
+ });
472
+ return _el$;
473
+ })();
474
+ }
475
+ const $a0e53f99354809d9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
476
+ function $a0e53f99354809d9$export$6649caad96ef8870({
477
+ children: children,
478
+ slider_ref_: slider_ref_,
479
+ faded_opacity_ = 0.7,
480
+ mutation_plugins_ = [],
481
+ disable_fading_: disable_fading_
482
+ }) {
483
+ const slider = new (0, $gVhhF$depictaiutilishared.Amazing_Slider)({
484
+ button_contents: {
485
+ left: [(() => {
486
+ const _el$ = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
487
+ $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
488
+ return _el$;
489
+ })()],
490
+ right: [(() => {
491
+ const _el$2 = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
492
+ $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
493
+ return _el$2;
494
+ })()]
495
+ },
496
+ constructor_plugins: [$gVhhF$depictaiutilishared.slider_snap_css().constructor_plugin],
497
+ mutation_plugins: [...(disable_fading_ ? [] : [$gVhhF$depictaiutilishared.slider_fading_factory({
498
+ threshold_: 0.96,
499
+ faded_opacity_: faded_opacity_
500
+ }).mutation_plugin_]), ...mutation_plugins_]
501
+ });
502
+ $gVhhF$solidjsweb.insert(slider.insert_here, children);
503
+ $gVhhF$solidjs.onCleanup(() => slider.observer.disconnect());
504
+ slider_ref_?.(slider);
505
+ return slider.container;
506
+ }
507
+ function $363ce4d1d71041aa$export$d41d19e89346fa2({
508
+ recommendations_resource_: recommendations_resource_,
509
+ product_card_template_: product_card_template_,
510
+ layout_options_: layout_options_,
511
+ merchant_: merchant_,
512
+ market_: market_
513
+ }) {
514
+ const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
515
+ const num_placeholders_ = () => 20;
516
+ const slider = $gVhhF$solidjsweb.createComponent((0, $a0e53f99354809d9$export$6649caad96ef8870), {
517
+ disable_fading_: true,
518
+ slider_ref_: slider => {
519
+ const {
520
+ insert_here: insert_here
521
+ } = slider;
522
+ const Layout = props => $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, insert_here, true);
523
+ // Do like this, so we don't have to call mergeProps ourselves
524
+ $gVhhF$solidjsweb.createComponent(Layout, $gVhhF$solidjsweb.mergeProps({
525
+ rows: "all",
526
+ layout: "slider"
527
+ }, layout_options_));
528
+ $gVhhF$depictaiutilisharedlatest.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
529
+ insert_here.before($fc23d7668ae0011d$export$a2cc176055f8f08());
530
+ },
531
+ get children() {
532
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
533
+ get fallback() {
534
+ return $0caf87eaa19079da$export$f33414a4df0afd3f({
535
+ num_placeholders_: num_placeholders_,
536
+ product_card_template_: product_card_template_
537
+ });
538
+ },
539
+ get children() {
540
+ return (() => {
541
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
542
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
543
+ return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
544
+ displays_by_key_: displays_by_key_,
545
+ merchant_: merchant_,
546
+ market_: market_,
547
+ product_card_template_: product_card_template_
548
+ });
549
+ })();
550
+ }
551
+ });
552
+ }
553
+ });
554
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
555
+ get when() {
556
+ return is_showing_something();
557
+ },
558
+ children: slider
559
+ });
560
+ }
561
+ const $72f96c4782db0b1b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict recommendations"></div>`, 2);
562
+ function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
563
+ const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
564
+ const {
565
+ grid_spacing: grid_spacing
566
+ } = props; // can be reactive
567
+ return typeof grid_spacing === "string" ? {
568
+ grid_spacing: grid_spacing
569
+ } : {
570
+ override_vertical_spacing: grid_spacing.vertical,
571
+ grid_spacing: grid_spacing.horizontal
572
+ };
573
+ });
574
+ const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
575
+ return (() => {
576
+ const _el$ = $gVhhF$solidjsweb.getNextElement($72f96c4782db0b1b$var$_tmpl$);
577
+ $gVhhF$solidjsweb.insert(_el$, () => $363ce4d1d71041aa$export$d41d19e89346fa2({
578
+ product_card_template_: (...args) => props.product_card_template(...args),
579
+ recommendations_resource_: recommendations_resource_,
580
+ market_: () => props.market,
581
+ merchant_: () => props.merchant,
582
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
583
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
584
+ ...grid_spacing_override()
585
+ }))
586
+ }));
587
+ return _el$;
588
+ })();
589
+ }
590
+ const $b8e79813f4f7ebe4$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
591
+ function $b8e79813f4f7ebe4$export$7da560f849543dff({
592
+ recommendations_resource_: recommendations_resource_,
593
+ product_card_template_: product_card_template_,
594
+ layout_options_: layout_options_,
595
+ merchant_: merchant_,
596
+ market_: market_,
597
+ rows_object_: rows_object_
598
+ }) {
599
+ const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
600
+ const num_placeholders_ = () => 20;
601
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
602
+ get when() {
603
+ return is_showing_something();
604
+ },
605
+ get children() {
606
+ const _el$ = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$),
607
+ _el$2 = _el$.firstChild,
608
+ [_el$3, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$2.nextSibling),
609
+ _el$4 = _el$3.nextSibling,
610
+ [_el$5, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$4.nextSibling);
611
+ $gVhhF$solidjsweb.insert(_el$, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$3, _co$);
612
+ $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
613
+ get rows() {
614
+ return rows_object_();
615
+ },
616
+ layout: "grid",
617
+ element_attributes: {
618
+ class: "cards"
619
+ }
620
+ }, layout_options_, {
621
+ get children() {
622
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
623
+ get fallback() {
624
+ return $0caf87eaa19079da$export$f33414a4df0afd3f({
625
+ num_placeholders_: num_placeholders_,
626
+ product_card_template_: product_card_template_
627
+ });
628
+ },
629
+ get children() {
630
+ return (() => {
631
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
632
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
633
+ return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
634
+ displays_by_key_: displays_by_key_,
635
+ merchant_: merchant_,
636
+ market_: market_,
637
+ product_card_template_: product_card_template_
638
+ });
639
+ })();
640
+ }
641
+ });
642
+ }
643
+ })), _el$5, _co$2);
644
+ return _el$;
645
+ }
646
+ });
647
+ }
648
+ const $1f8dbf7e28b3eff2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="show-more major" type="button"></button>`, 2),
649
+ $1f8dbf7e28b3eff2$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp recommendations"></div>`, 2);
650
+ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
651
+ const rows_object_ = $gVhhF$solidjs.createMemo(() => {
652
+ const view_more_button = props.view_more_button;
653
+ if (!view_more_button) return "all";
654
+ return {
655
+ start_rows: view_more_button.start_rows,
656
+ rows_per_click: view_more_button.rows_per_click,
657
+ button: (() => {
658
+ const _el$ = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$);
659
+ $gVhhF$solidjsweb.insert(_el$, () => view_more_button.text);
660
+ return _el$;
661
+ })()
662
+ };
663
+ });
664
+ const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
665
+ const {
666
+ grid_spacing: grid_spacing
667
+ } = props; // can be reactive
668
+ return typeof grid_spacing === "string" ? {
669
+ grid_spacing: grid_spacing
670
+ } : {
671
+ override_vertical_spacing: grid_spacing.vertical,
672
+ grid_spacing: grid_spacing.horizontal
673
+ };
674
+ });
675
+ const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
676
+ return (() => {
677
+ const _el$2 = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$2);
678
+ $gVhhF$solidjsweb.insert(_el$2, () => $b8e79813f4f7ebe4$export$7da560f849543dff({
679
+ rows_object_: rows_object_,
680
+ product_card_template_: (...args) => props.product_card_template(...args),
681
+ recommendations_resource_: recommendations_resource_,
682
+ market_: () => props.market,
683
+ merchant_: () => props.merchant,
684
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
685
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
686
+ ...grid_spacing_override()
687
+ }))
688
+ }));
689
+ return _el$2;
690
+ })();
691
+ }
62
692
  const $19950faaac026e09$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<img>`, 1);
63
693
  function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
64
694
  const [size, setSize] = $gVhhF$solidjs.createSignal(0);
@@ -114,42 +744,6 @@ function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
114
744
  return _el$;
115
745
  })();
116
746
  }
117
-
118
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
119
- class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
120
- class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
121
- constructor(templateError) {
122
- super("Uncaught error in product card template", {
123
- cause: templateError
124
- });
125
- }
126
- }
127
- const $edafe91daf3091d7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
128
- function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
129
- return $gVhhF$solidjs.ErrorBoundary({
130
- fallback(err, retry) {
131
- const {
132
- message_: message_,
133
- severity_: severity_
134
- } = props;
135
- let message = message_;
136
- if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
137
- console.error(err.cause);
138
- message = `${message}: ${err.message}`;
139
- } else $gVhhF$depictaiutilishared.report([err, message_], severity_);
140
- props.on_error_?.(retry);
141
- return (() => {
142
- const _el$ = $gVhhF$solidjsweb.getNextElement($edafe91daf3091d7$var$_tmpl$);
143
- $gVhhF$solidjsweb.insert(_el$, message);
144
- $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
145
- return _el$;
146
- })();
147
- },
148
- get children() {
149
- return props.children;
150
- }
151
- });
152
- }
153
747
  function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
154
748
  const {
155
749
  collapse: collapse,
@@ -268,54 +862,6 @@ function $d659702496cb72ea$export$a71e92cfbb498adc(props) {
268
862
  return $gVhhF$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
269
863
  });
270
864
  }
271
- const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.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);
272
- function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
273
- return (() => {
274
- const _el$ = $gVhhF$solidjsweb.getNextElement($0f313083912e447a$var$_tmpl$);
275
- $gVhhF$solidjsweb.effect(_p$ => {
276
- const _v$ = props.width_ ?? 14,
277
- _v$2 = props.height_ ?? 26;
278
- _v$ !== _p$._v$ && $gVhhF$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
279
- _v$2 !== _p$._v$2 && $gVhhF$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
280
- return _p$;
281
- }, {
282
- _v$: undefined,
283
- _v$2: undefined
284
- });
285
- return _el$;
286
- })();
287
- }
288
- const $a0e53f99354809d9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
289
- function $a0e53f99354809d9$export$6649caad96ef8870({
290
- children: children,
291
- slider_ref_: slider_ref_,
292
- faded_opacity_ = 0.7,
293
- mutation_plugins_ = []
294
- }) {
295
- const slider = new (0, $gVhhF$depictaiutilishared.Amazing_Slider)({
296
- button_contents: {
297
- left: [(() => {
298
- const _el$ = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
299
- $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
300
- return _el$;
301
- })()],
302
- right: [(() => {
303
- const _el$2 = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
304
- $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
305
- return _el$2;
306
- })()]
307
- },
308
- constructor_plugins: [$gVhhF$depictaiutilishared.slider_snap_css().constructor_plugin],
309
- mutation_plugins: [$gVhhF$depictaiutilishared.slider_fading_factory({
310
- threshold_: 0.96,
311
- faded_opacity_: faded_opacity_
312
- }).mutation_plugin_, ...mutation_plugins_]
313
- });
314
- $gVhhF$solidjsweb.insert(slider.insert_here, children);
315
- $gVhhF$solidjs.onCleanup(() => slider.observer.disconnect());
316
- slider_ref_?.(slider);
317
- return slider.container;
318
- }
319
865
  const $ee498ec5e7dc2bba$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
320
866
  const $ee498ec5e7dc2bba$var$closing_functions = /*@__PURE__*/new Set();
321
867
  const $ee498ec5e7dc2bba$export$22970a0140fc759c = /*@__PURE__*/$gVhhF$solidjs.createSignal(false);
@@ -2660,166 +3206,33 @@ function $70482f04605572e2$var$modify_only_local_filter(local_filter_object, sel
2660
3206
  ...old_meta
2661
3207
  };
2662
3208
  modified_filter_object.meta = new_meta;
2663
- // set counts to 0
2664
- if ("counts" in new_meta) {
2665
- const counts = new_meta.counts;
2666
- if (counts) new_meta.counts = counts.map(() => 0);
2667
- }
2668
- if (Array.isArray(selected_filter_data) && "values" in new_meta) {
2669
- // we have an array of values and want to strip the ones from the available ones that aren't selected
2670
- const values = new_meta.values;
2671
- if (Array.isArray(values)) {
2672
- const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
2673
- const indexes_to_remove = new Set();
2674
- for (let i = 0; i < values.length; i++) {
2675
- const value = values[i];
2676
- if (!jsond_set_values.includes(JSON.stringify(value)))
2677
- // We want to remove the entry with this value from the filter object because it's not selected
2678
- indexes_to_remove.add(i);
2679
- }
2680
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2681
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2682
- if (new_meta.counts)
2683
- // remove counts that are too much, they're all zero anyway if they exist
2684
- new_meta.counts.length -= indexes_to_remove.size;
2685
- }
2686
- }
2687
- }
2688
- return modified_filter_object;
2689
- }
2690
- function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
2691
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
2692
- return $gVhhF$solidjs.createMemo(() => $5f7d55c710fd1bc2$var$unwrapping_helper(elements));
2693
- }
2694
- function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
2695
- const result = [];
2696
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
2697
- const element = elements[i];
2698
- result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
2699
- } else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
2700
- return result;
2701
- }
2702
- const $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2),
2703
- $f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type="text/css"></style>`, 2);
2704
- function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
2705
- const container_element_ = (() => {
2706
- const _el$ = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
2707
- $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(() => props.element_attributes), false, true);
2708
- $gVhhF$solidjsweb.insert(_el$, () => props.children);
2709
- $gVhhF$solidjsweb.runHydrationEvents();
2710
- return _el$;
2711
- })(); // Don't want this in the error boundary below, it should only be for the actual layouting
2712
- return $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
2713
- get message_() {
2714
- return "Failed calculating " + props.layout + " layout";
2715
- },
2716
- severity_: "error",
2717
- get children() {
2718
- return $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element_);
2719
- }
2720
- });
2721
- }
2722
- function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
2723
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2724
- const show_all_rows = $gVhhF$solidjs.createMemo(() => props.rows === "all");
2725
- const rows_or_empty_object = $gVhhF$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
2726
- const view_more_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().button));
2727
- const view_less_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
2728
- const have_a_view_more_button = $gVhhF$solidjs.createMemo(() => {
2729
- const button = view_more_button_elements();
2730
- return !(!button || Array.isArray(button) && !button.length);
2731
- });
2732
- const have_a_view_less_button = $gVhhF$solidjs.createMemo(() => {
2733
- const button = view_less_button_elements();
2734
- return !(!button || Array.isArray(button) && !button.length);
2735
- });
2736
- const [get_styling, set_styling] = $gVhhF$solidjs.createSignal();
2737
- const container_class = $gVhhF$depictaiutilishared.make_random_classname();
2738
- const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
2739
- const [get_children_count, set_children_count] = $gVhhF$solidjs.createSignal(0);
2740
- const update_children_count = () => set_children_count(container_element.children.length);
2741
- const col_styling = $gVhhF$solidjs.createMemo(() => $gVhhF$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2742
- const default_currently_visible_signal = $gVhhF$solidjs.createSignal($gVhhF$solidjs.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
2743
- const rows_visible_signal = $gVhhF$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2744
- const get_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[0]());
2745
- const set_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[1]);
2746
- const view_more_button_class = $gVhhF$depictaiutilishared.make_random_classname();
2747
- const view_less_button_class = $gVhhF$depictaiutilishared.make_random_classname();
2748
- const view_more_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_more_button() && (() => {
2749
- const _el$2 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
2750
- $gVhhF$solidjsweb.addEventListener(_el$2, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
2751
- $gVhhF$solidjsweb.className(_el$2, `load-more-container ${view_more_button_class}`);
2752
- $gVhhF$solidjsweb.insert(_el$2, () => rows_or_empty_object().button);
2753
- $gVhhF$solidjsweb.runHydrationEvents();
2754
- return _el$2;
2755
- })());
2756
- // 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
2757
- const view_less_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_less_button() && (() => {
2758
- const _el$3 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
2759
- $gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
2760
- $gVhhF$solidjsweb.className(_el$3, `load-less-container ${view_less_button_class}`);
2761
- $gVhhF$solidjsweb.insert(_el$3, () => rows_or_empty_object().view_less_button);
2762
- $gVhhF$solidjsweb.runHydrationEvents();
2763
- return _el$3;
2764
- })());
2765
- container_element.classList.add(container_class);
2766
- $gVhhF$solidjs.createComputed(() => {
2767
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
2768
- const rows_visible = get_rows_visible();
2769
- const max_rows = rows_or_empty_object().max_rows;
2770
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
2771
- });
2772
- $gVhhF$solidjs.createRenderEffect(() => {
2773
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
2774
- if (show_all_rows()) {
2775
- // no view more functionality requested
2776
- set_styling(() => col_styling);
2777
- return;
2778
- }
2779
- update_children_count();
2780
- const mutation_observer = new MutationObserver($gVhhF$depictaiutilishared.catchify(update_children_count));
2781
- mutation_observer.observe(container_element, {
2782
- childList: true
2783
- });
2784
- $gVhhF$solidjs.onCleanup(() => mutation_observer.disconnect());
2785
- set_styling(
2786
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
2787
- () => $gVhhF$solidjs.createMemo(() => {
2788
- const {
2789
- rows_per_click: rows_per_click,
2790
- max_rows = -1,
2791
- start_rows: start_rows
2792
- } = rows_or_empty_object();
2793
- const rows_visible = get_rows_visible();
2794
- const children_count = get_children_count();
2795
- return col_styling() + props.cols_at_size.map(options => {
2796
- const [recs_per_row, min, max] = options;
2797
- let should_hide_view_more_button;
2798
- let visible_recs;
2799
- if (props.disable_partial_rows) {
2800
- visible_recs = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
2801
- const visible_recs_next_show_more = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
2802
- // Should this really be zero when we default rows_per_click to 1?
2803
- children_count, options);
2804
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
2805
- } else {
2806
- visible_recs = $gVhhF$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
2807
- should_hide_view_more_button = visible_recs >= children_count;
3209
+ // set counts to 0
3210
+ if ("counts" in new_meta) {
3211
+ const counts = new_meta.counts;
3212
+ if (counts) new_meta.counts = counts.map(() => 0);
3213
+ }
3214
+ if (Array.isArray(selected_filter_data) && "values" in new_meta) {
3215
+ // we have an array of values and want to strip the ones from the available ones that aren't selected
3216
+ const values = new_meta.values;
3217
+ if (Array.isArray(values)) {
3218
+ const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
3219
+ const indexes_to_remove = new Set();
3220
+ for (let i = 0; i < values.length; i++) {
3221
+ const value = values[i];
3222
+ if (!jsond_set_values.includes(JSON.stringify(value)))
3223
+ // We want to remove the entry with this value from the filter object because it's not selected
3224
+ indexes_to_remove.add(i);
2808
3225
  }
2809
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
2810
- // 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
2811
- 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;
2812
- return `${$gVhhF$depictaiutilishared.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}` : ``}}`;
2813
- }).join("");
2814
- }));
2815
- });
2816
- return [container_element, $gVhhF$solidjsweb.memo(view_more_button_container), $gVhhF$solidjsweb.memo(view_less_button_container), (() => {
2817
- const _el$4 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
2818
- $gVhhF$solidjsweb.insert(_el$4, get_styling);
2819
- return _el$4;
2820
- })()];
3226
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
3227
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
3228
+ if (new_meta.counts)
3229
+ // remove counts that are too much, they're all zero anyway if they exist
3230
+ new_meta.counts.length -= indexes_to_remove.size;
3231
+ }
3232
+ }
3233
+ }
3234
+ return modified_filter_object;
2821
3235
  }
2822
- $gVhhF$solidjsweb.delegateEvents(["click"]);
2823
3236
  async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2824
3237
  const body = await (0, $gVhhF$depictaiutilishared.observer).wait_for_element("body");
2825
3238
  let dispose_and_remove;
@@ -3515,92 +3928,6 @@ function $0d0b172488865048$export$ef6006467f04ee41({
3515
3928
  })()];
3516
3929
  }
3517
3930
  $gVhhF$solidjsweb.delegateEvents(["click"]);
3518
- function $fc23d7668ae0011d$export$a2cc176055f8f08() {
3519
- 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.";
3520
- return (0, $gVhhF$solidjsweb.isServer) ? `<!-- ${text} -->` : document.createComment(text);
3521
- }
3522
- let $0caf87eaa19079da$var$cached_placeholder_element;
3523
- let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
3524
- function $0caf87eaa19079da$export$f33414a4df0afd3f({
3525
- product_card_template_: product_card_template_,
3526
- num_placeholders_: num_placeholders_
3527
- }) {
3528
- const [get_elements, set_elements] = $gVhhF$solidjs.createSignal([]);
3529
- let existing_num = 0;
3530
- if (0, $gVhhF$solidjsweb.isServer)
3531
- // want to render simple placeholders on server, effects don't run there
3532
- return $gVhhF$solidjs.createMemo(() => Array.from({
3533
- length: num_placeholders_()
3534
- }).map(() => {
3535
- const template_result = product_card_template_(null, undefined);
3536
- // @ts-ignore
3537
- if (typeof template_result?.then !== "function") return template_result;
3538
- }));
3539
- $gVhhF$solidjs.createRenderEffect(() => {
3540
- const to_add = num_placeholders_() - existing_num;
3541
- if (to_add <= 0) return;
3542
- // 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.
3543
- // 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.
3544
- // 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.
3545
- set_elements(prev => [...prev, ...Array.from({
3546
- length: to_add
3547
- }).map(() => $0caf87eaa19079da$var$Placeholder({
3548
- product_card_template_: product_card_template_
3549
- }))]);
3550
- existing_num += to_add;
3551
- });
3552
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3553
- }
3554
- /**
3555
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
3556
- */
3557
- function $0caf87eaa19079da$var$Placeholder({
3558
- product_card_template_: product_card_template_
3559
- }) {
3560
- const get_cloned_placeholders = (element_to_clone = $0caf87eaa19079da$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
3561
- if ($0caf87eaa19079da$var$cached_placeholder_element) return get_cloned_placeholders();
3562
- let dispose_original_copy;
3563
- const get_unwrapped_element = $gVhhF$solidjs.createRoot(dispose => {
3564
- dispose_original_copy = dispose;
3565
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
3566
- const [resource] = $gVhhF$solidjs.createResource(() => {
3567
- if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) return $0caf87eaa19079da$var$rendering_cached_placeholder_element;
3568
- const return_value = product_card_template_(null, undefined);
3569
- if (typeof return_value === "object" && typeof return_value?.then === "function")
3570
- // Is Promise or promise-like object
3571
- $0caf87eaa19079da$var$rendering_cached_placeholder_element = return_value;
3572
- return return_value;
3573
- });
3574
- return $gVhhF$solidjs.createMemo(() => {
3575
- if (resource.loading) return () => [];
3576
- return $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(resource);
3577
- });
3578
- });
3579
- $gVhhF$solidjs.onCleanup(() => {
3580
- if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) {
3581
- // 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
3582
- const unset_current_rendering = () => {
3583
- dispose_original_copy();
3584
- $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
3585
- };
3586
- $0caf87eaa19079da$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
3587
- } else
3588
- // Otherwise, just make sure we've disposed our root
3589
- dispose_original_copy();
3590
- });
3591
- return $gVhhF$solidjs.createMemo(() => {
3592
- const unwrapped_array = get_unwrapped_element()();
3593
- if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
3594
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
3595
- return;
3596
- // placeholders have finished rendering, freeze the elements
3597
- // 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
3598
- $0caf87eaa19079da$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
3599
- $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
3600
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
3601
- 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
3602
- });
3603
- }
3604
3931
 
3605
3932
  /*
3606
3933
  * 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.
@@ -3706,86 +4033,6 @@ function $4117463e2939f5f4$export$63dd0350f8559dda({
3706
4033
  equals: false
3707
4034
  });
3708
4035
  }
3709
-
3710
- /**
3711
- * Gets product_id (the thing we key the rendering on) from a display
3712
- */
3713
- function $a5871dacf261adf8$export$548d053aba053d79(display) {
3714
- if ("variant_index" in display) {
3715
- const actual_display = display.variant_displays[display.variant_index];
3716
- return actual_display.product_id;
3717
- }
3718
- return display.product_id;
3719
- }
3720
- function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
3721
- const displays_by_key_ = $gVhhF$solidjs.createMemo(() => {
3722
- const displays = get_displays_();
3723
- // We key by product_id because that's what can be used to uniquely identify products
3724
- // This way <For> can optimize the rendering
3725
- const map = new Map();
3726
- for (let i = 0; i < displays.length; i++) {
3727
- const display = displays[i];
3728
- const product_id = $a5871dacf261adf8$export$548d053aba053d79(display);
3729
- map.set(product_id, display);
3730
- }
3731
- return map;
3732
- });
3733
- return displays_by_key_;
3734
- }
3735
- function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
3736
- displays_by_key_: displays_by_key_,
3737
- merchant_: merchant_,
3738
- market_: market_,
3739
- product_card_template_: product_card_template_,
3740
- do_per_elements_: do_per_elements_
3741
- }) {
3742
- return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
3743
- get each() {
3744
- return [...displays_by_key_().keys()];
3745
- },
3746
- children: (product_id, index) => {
3747
- const owner = $gVhhF$solidjs.getOwner();
3748
- const display_accessor = $gVhhF$solidjs.createMemo(() => displays_by_key_().get(product_id));
3749
- const [product_card_resource] = $gVhhF$solidjs.createResource(display_accessor,
3750
- // re-render when the reference to the display object changes
3751
- // this should only be the case when the merchant or market changes and the new request has completed
3752
- display => {
3753
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
3754
- return product_card_template_(display, {
3755
- set_on_index_change: fn => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => fn(index()))),
3756
- merchant: $gVhhF$solidjs.untrack(merchant_),
3757
- // 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
3758
- market: $gVhhF$solidjs.untrack(market_)
3759
- });
3760
- });
3761
- const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
3762
- $gVhhF$solidjs.createEffect(() => {
3763
- const product_card_nodes = node_accessor();
3764
- const display = display_accessor();
3765
- const elements = [];
3766
- for (let i = 0; i < product_card_nodes.length; i++) {
3767
- const element = product_card_nodes[i];
3768
- if (!(element instanceof Element)) continue;
3769
- elements.push(element);
3770
- // Add tracking ids
3771
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
3772
- const {
3773
- dataset: dataset
3774
- } = element;
3775
- const {
3776
- search_result_id: search_result_id,
3777
- product_listing_result_id: product_listing_result_id,
3778
- recommendation_id: recommendation_id
3779
- } = display;
3780
- 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;
3781
- }
3782
- do_per_elements_?.(elements, index);
3783
- });
3784
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3785
- }
3786
- });
3787
- }
3788
-
3789
4036
  function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
3790
4037
  plp_results_: plp_results_,
3791
4038
  product_card_template_: product_card_template_,
@@ -6071,41 +6318,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6071
6318
  return _el$13;
6072
6319
  })()];
6073
6320
  }
6074
- const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
6075
- const cols_at_size = [];
6076
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
6077
- const [nb_cols, width] = sorted_cols_at_size[i];
6078
- const next_width = sorted_cols_at_size[i + 1]?.[1];
6079
- const max_width = i === 0 ? "" : `${width}px`;
6080
- const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
6081
- const col_at_size = [nb_cols, min_width, max_width];
6082
- cols_at_size.push(col_at_size);
6083
- }
6084
- return cols_at_size;
6085
- };
6086
- const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
6087
- // Check that every element is an array
6088
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
6089
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
6090
- // Check width duplicates
6091
- const widths = cols_at_size.map(([_, width]) => width);
6092
- const widths_set = new Set(widths);
6093
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
6094
- if (cols_at_size.length === 1) {
6095
- const [nb_cols, width] = cols_at_size[0];
6096
- const max_width = width !== undefined ? `${width}px` : "";
6097
- return [[nb_cols, "", max_width]];
6098
- }
6099
- // Sort widths in ascending order
6100
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
6101
- const [_b, width_A] = a;
6102
- const [_a, width_b] = b;
6103
- if (width_A === undefined) return -1;
6104
- if (width_b === undefined) return 1;
6105
- return width_b - width_A;
6106
- });
6107
- return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
6108
- };
6109
6321
  function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
6110
6322
  const component_in_error_boundary = do_with_elements => {
6111
6323
  const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
@@ -6409,7 +6621,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
6409
6621
  #meta_title_suffix_ = $gVhhF$solidjs.createSignal();
6410
6622
  #disable_override_query_id = $gVhhF$solidjs.createSignal();
6411
6623
  #listing_type_signal = $gVhhF$solidjs.createSignal();
6412
- static #keys_constructed_with = new Set();
6624
+ static #keys_constructed_with = /*@__PURE__*/new Set();
6413
6625
  get localization() {
6414
6626
  // allow reactive access
6415
6627
  return this.#locale_signal[0]();
@@ -9655,27 +9867,6 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
9655
9867
  cleanup: cleanup
9656
9868
  };
9657
9869
  }
9658
-
9659
- /**
9660
- * 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
9661
- */
9662
- function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
9663
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
9664
- const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
9665
- const [[, smallest_max_width]] = sorted_sizes;
9666
- if (smallest_max_width > min_width_for_more_than_one_column)
9667
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
9668
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
9669
- const to_delete = [];
9670
- for (let i = 0; i < sorted_sizes.length; i++) {
9671
- const [, max_width] = sorted_sizes[i];
9672
- if (max_width > min_width_for_more_than_one_column) continue;
9673
- to_delete.push(i);
9674
- }
9675
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
9676
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
9677
- return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
9678
- }
9679
9870
  const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp search"></div>`, 2);
9680
9871
  // 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
9681
9872
  /**
@@ -9694,7 +9885,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
9694
9885
  #market_signal = $gVhhF$solidjs.createSignal();
9695
9886
  #modal_open_signal = $gVhhF$solidjs.createSignal(false);
9696
9887
  #content_search_signal = $gVhhF$solidjs.createSignal();
9697
- static #keys_constructed_with = new Set();
9888
+ static #keys_constructed_with = /*@__PURE__*/new Set();
9698
9889
  #router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
9699
9890
  constructor({
9700
9891
  unique_instance_key_for_state = "",
@@ -10212,7 +10403,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
10212
10403
  #revert_fns = [];
10213
10404
  #is_open = false;
10214
10405
  static #reverting_permitted = true;
10215
- static #visited_urls = (() => {
10406
+ static #visited_urls = /*@__PURE__*/(() => {
10216
10407
  // 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).
10217
10408
  $gVhhF$depictaiutilishared.catchify(async () => {
10218
10409
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
@@ -10253,14 +10444,14 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
10253
10444
  return $gVhhF$depictaiutilishared.catchify(this.render_, "rendering failed")() || [];
10254
10445
  });
10255
10446
  }
10256
- #unload = $gVhhF$depictaiutilishared.catchify(() => {
10447
+ #unload = /*@__PURE__*/$gVhhF$depictaiutilishared.catchify(() => {
10257
10448
  if (!this.#is_open) return;
10258
10449
  this.#disconnect_observer?.();
10259
10450
  if ($0a6acf31d1eae57c$export$3ccaa27d81dd8556.#reverting_permitted) while (this.#revert_fns.length) this.#revert_fns.pop()?.();
10260
10451
  this.#is_open = false;
10261
10452
  this.dispatchEvent(new CustomEvent("close"));
10262
10453
  }, "failed to close page");
10263
- #load = $gVhhF$depictaiutilishared.catchify(async els => {
10454
+ #load = /*@__PURE__*/$gVhhF$depictaiutilishared.catchify(async els => {
10264
10455
  this.#is_open = true;
10265
10456
  // So that #load doesn't get called again
10266
10457
  let set_should_stay_inserted;