@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/ES10/index.cjs CHANGED
@@ -16,6 +16,8 @@ function $parcel$export(e, n, v, s) {
16
16
  function $parcel$interopDefault(a) {
17
17
  return a && a.__esModule ? a.default : a;
18
18
  }
19
+ $parcel$export(module.exports, "RecommendationSlider", () => $2badc30d7c6610e1$export$9574e176201e5e8d);
20
+ $parcel$export(module.exports, "RecommendationGrid", () => $41227f10ad680afd$export$9756467d34d91cdb);
19
21
  $parcel$export(module.exports, "ShopifyResponsiveImg", () => $858fdcf73148519f$export$6e5611bc7e57e477);
20
22
  $parcel$export(module.exports, "makeSizeAccessor", () => $858fdcf73148519f$export$e6fffe67d4cdd848);
21
23
  $parcel$export(module.exports, "ImageContainer", () => $ce467edb5343cfcd$export$94026ee33dbabc26);
@@ -64,7 +66,679 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
64
66
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
65
67
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
66
68
  /*! Depict.ai search and product listing SDK */
67
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "1.4.22";
69
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "1.4.23";
70
+ const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
71
+ const cols_at_size = [];
72
+ for (let i = 0; i < sorted_cols_at_size.length; i++) {
73
+ var _sorted_cols_at_size;
74
+ const [nb_cols, width] = sorted_cols_at_size[i];
75
+ const next_width = (_sorted_cols_at_size = sorted_cols_at_size[i + 1]) === null || _sorted_cols_at_size === void 0 ? void 0 : _sorted_cols_at_size[1];
76
+ const max_width = i === 0 ? "" : "".concat(width, "px");
77
+ const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
78
+ const col_at_size = [nb_cols, min_width, max_width];
79
+ cols_at_size.push(col_at_size);
80
+ }
81
+ return cols_at_size;
82
+ };
83
+ const $5401a6698b0c0658$export$6daf8749b65a1b77 = cols_at_size => {
84
+ // Check that every element is an array
85
+ const are_arrays = cols_at_size.every(element => Array.isArray(element));
86
+ if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
87
+ // Check width duplicates
88
+ const widths = cols_at_size.map(_ref => {
89
+ let [_, width] = _ref;
90
+ return width;
91
+ });
92
+ const widths_set = new Set(widths);
93
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
94
+ if (cols_at_size.length === 1) {
95
+ const [nb_cols, width] = cols_at_size[0];
96
+ const max_width = width !== undefined ? "".concat(width, "px") : "";
97
+ return [[nb_cols, "", max_width]];
98
+ }
99
+ // Sort widths in ascending order
100
+ const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
101
+ const [_b, width_A] = a;
102
+ const [_a, width_b] = b;
103
+ if (width_A === undefined) return -1;
104
+ if (width_b === undefined) return 1;
105
+ return width_b - width_A;
106
+ });
107
+ return $5401a6698b0c0658$var$transform_elements(sorted_cols_at_size);
108
+ };
109
+
110
+ /**
111
+ * 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
112
+ */
113
+ function $b1ea8d47bcf03111$export$ff7109b9b2b206ba(sdk_cols_at_size) {
114
+ let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
115
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
116
+ const sorted_sizes = sdk_cols_at_size.map(_ref => {
117
+ let [cols, max_width] = _ref;
118
+ return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
119
+ }).sort((_ref2, _ref3) => {
120
+ let [, a] = _ref2;
121
+ let [, b] = _ref3;
122
+ return a - b;
123
+ });
124
+ const [[, smallest_max_width]] = sorted_sizes;
125
+ if (smallest_max_width > min_width_for_more_than_one_column)
126
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
127
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
128
+ const to_delete = [];
129
+ for (let i = 0; i < sorted_sizes.length; i++) {
130
+ const [, max_width] = sorted_sizes[i];
131
+ if (max_width > min_width_for_more_than_one_column) continue;
132
+ to_delete.push(i);
133
+ }
134
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
135
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
136
+ return sorted_sizes.map(_ref4 => {
137
+ let [cols, max_width] = _ref4;
138
+ return max_width == Infinity ? [cols] : [cols, max_width];
139
+ });
140
+ }
141
+ function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
142
+ 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.";
143
+ return (0, $52FdA$solidjsweb.isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
144
+ }
145
+ function $e82d0d417fa613e8$export$2f0cbfbb4354bb52(elements) {
146
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
147
+ return $52FdA$solidjs.createMemo(() => $e82d0d417fa613e8$var$unwrapping_helper(elements));
148
+ }
149
+ function $e82d0d417fa613e8$var$unwrapping_helper(elements) {
150
+ const result = [];
151
+ if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
152
+ const element = elements[i];
153
+ result.push(...$e82d0d417fa613e8$var$unwrapping_helper(element));
154
+ } else if (typeof elements == "function") result.push(...$e82d0d417fa613e8$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
155
+ return result;
156
+ }
157
+ let $e3915574cfd3466c$var$cached_placeholder_element;
158
+ let $e3915574cfd3466c$var$rendering_cached_placeholder_element;
159
+ function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
160
+ let {
161
+ product_card_template_: product_card_template_,
162
+ num_placeholders_: num_placeholders_
163
+ } = _ref;
164
+ const [get_elements, set_elements] = $52FdA$solidjs.createSignal([]);
165
+ let existing_num = 0;
166
+ if (0, $52FdA$solidjsweb.isServer)
167
+ // want to render simple placeholders on server, effects don't run there
168
+ return $52FdA$solidjs.createMemo(() => Array.from({
169
+ length: num_placeholders_()
170
+ }).map(() => {
171
+ const template_result = product_card_template_(null, undefined);
172
+ // @ts-ignore
173
+ if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
174
+ }));
175
+ $52FdA$solidjs.createRenderEffect(() => {
176
+ const to_add = num_placeholders_() - existing_num;
177
+ if (to_add <= 0) return;
178
+ // 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.
179
+ // 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.
180
+ // 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.
181
+ set_elements(prev => [...prev, ...Array.from({
182
+ length: to_add
183
+ }).map(() => $e3915574cfd3466c$var$Placeholder({
184
+ product_card_template_: product_card_template_
185
+ }))]);
186
+ existing_num += to_add;
187
+ });
188
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
189
+ }
190
+ /**
191
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
192
+ */
193
+ function $e3915574cfd3466c$var$Placeholder(_ref2) {
194
+ let {
195
+ product_card_template_: product_card_template_
196
+ } = _ref2;
197
+ const get_cloned_placeholders = function () {
198
+ let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $e3915574cfd3466c$var$cached_placeholder_element;
199
+ return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
200
+ };
201
+ if ($e3915574cfd3466c$var$cached_placeholder_element) return get_cloned_placeholders();
202
+ let dispose_original_copy;
203
+ const get_unwrapped_element = $52FdA$solidjs.createRoot(dispose => {
204
+ dispose_original_copy = dispose;
205
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
206
+ const [resource] = $52FdA$solidjs.createResource(() => {
207
+ if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) return $e3915574cfd3466c$var$rendering_cached_placeholder_element;
208
+ const return_value = product_card_template_(null, undefined);
209
+ if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
210
+ // Is Promise or promise-like object
211
+ $e3915574cfd3466c$var$rendering_cached_placeholder_element = return_value;
212
+ return return_value;
213
+ });
214
+ return $52FdA$solidjs.createMemo(() => {
215
+ if (resource.loading) return () => [];
216
+ return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
217
+ });
218
+ });
219
+ $52FdA$solidjs.onCleanup(() => {
220
+ if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) {
221
+ var _rendering_cached_pla;
222
+ // 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
223
+ const unset_current_rendering = () => {
224
+ dispose_original_copy();
225
+ $e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
226
+ };
227
+ (_rendering_cached_pla = $e3915574cfd3466c$var$rendering_cached_placeholder_element) === null || _rendering_cached_pla === void 0 || _rendering_cached_pla.then(unset_current_rendering, unset_current_rendering);
228
+ } else
229
+ // Otherwise, just make sure we've disposed our root
230
+ dispose_original_copy();
231
+ });
232
+ return $52FdA$solidjs.createMemo(() => {
233
+ const unwrapped_array = get_unwrapped_element()();
234
+ if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
235
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
236
+ return;
237
+ // placeholders have finished rendering, freeze the elements
238
+ // 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
239
+ $e3915574cfd3466c$var$cached_placeholder_element || ($e3915574cfd3466c$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
240
+ $e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
241
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
242
+ 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
243
+ });
244
+ }
245
+
246
+ /**
247
+ * Gets product_id (the thing we key the rendering on) from a display
248
+ */
249
+ function $b85edfec41cd3989$export$548d053aba053d79(display) {
250
+ if ("variant_index" in display) {
251
+ const actual_display = display.variant_displays[display.variant_index];
252
+ return actual_display.product_id;
253
+ }
254
+ return display.product_id;
255
+ }
256
+ function $76012c4468a53d1f$export$7f8bd308237ab5a5(get_displays_) {
257
+ const displays_by_key_ = $52FdA$solidjs.createMemo(() => {
258
+ const displays = get_displays_();
259
+ // We key by product_id because that's what can be used to uniquely identify products
260
+ // This way <For> can optimize the rendering
261
+ const map = new Map();
262
+ for (let i = 0; i < displays.length; i++) {
263
+ const display = displays[i];
264
+ const product_id = $b85edfec41cd3989$export$548d053aba053d79(display);
265
+ map.set(product_id, display);
266
+ }
267
+ return map;
268
+ });
269
+ return displays_by_key_;
270
+ }
271
+ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
272
+ let {
273
+ displays_by_key_: displays_by_key_,
274
+ merchant_: merchant_,
275
+ market_: market_,
276
+ product_card_template_: product_card_template_,
277
+ do_per_elements_: do_per_elements_
278
+ } = _ref;
279
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.For), {
280
+ get each() {
281
+ return [...displays_by_key_().keys()];
282
+ },
283
+ children: (product_id, index) => {
284
+ const owner = $52FdA$solidjs.getOwner();
285
+ const display_accessor = $52FdA$solidjs.createMemo(() => displays_by_key_().get(product_id));
286
+ const [product_card_resource] = $52FdA$solidjs.createResource(display_accessor,
287
+ // re-render when the reference to the display object changes
288
+ // this should only be the case when the merchant or market changes and the new request has completed
289
+ display => {
290
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
291
+ return product_card_template_(display, {
292
+ set_on_index_change: fn => $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.createEffect(() => fn(index()))),
293
+ merchant: $52FdA$solidjs.untrack(merchant_),
294
+ // 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
295
+ market: $52FdA$solidjs.untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
296
+ });
297
+ });
298
+
299
+ const node_accessor = $e82d0d417fa613e8$export$2f0cbfbb4354bb52(product_card_resource);
300
+ $52FdA$solidjs.createEffect(() => {
301
+ const product_card_nodes = node_accessor();
302
+ const display = display_accessor();
303
+ const elements = [];
304
+ for (let i = 0; i < product_card_nodes.length; i++) {
305
+ const element = product_card_nodes[i];
306
+ if (!(element instanceof Element)) continue;
307
+ elements.push(element);
308
+ // Add tracking ids
309
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
310
+ const {
311
+ dataset: dataset
312
+ } = element;
313
+ const {
314
+ search_result_id: search_result_id,
315
+ product_listing_result_id: product_listing_result_id,
316
+ recommendation_id: recommendation_id
317
+ } = display;
318
+ 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;
319
+ }
320
+ do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
321
+ });
322
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
323
+ }
324
+ });
325
+ }
326
+
327
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
328
+ class $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 extends Error {}
329
+ class $95e4006e1dcb5b72$export$aa14a9f43128f61f extends $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 {
330
+ constructor(templateError) {
331
+ super("Uncaught error in product card template", {
332
+ cause: templateError
333
+ });
334
+ }
335
+ }
336
+ const $1b3cf201cdd38687$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
337
+ function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
338
+ return $52FdA$solidjs.ErrorBoundary({
339
+ fallback(err, retry) {
340
+ var _props$on_error_;
341
+ const {
342
+ message_: message_,
343
+ severity_: severity_
344
+ } = props;
345
+ let message = message_;
346
+ if (err instanceof (0, $95e4006e1dcb5b72$export$aa14a9f43128f61f)) {
347
+ console.error(err.cause);
348
+ message = "".concat(message, ": ").concat(err.message);
349
+ } else $52FdA$depictaiutilishared.report([err, message_], severity_);
350
+ (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
351
+ return (() => {
352
+ const _el$ = $52FdA$solidjsweb.getNextElement($1b3cf201cdd38687$var$_tmpl$);
353
+ $52FdA$solidjsweb.insert(_el$, message);
354
+ $52FdA$solidjsweb.effect(_$p => {
355
+ var _props$class_list_;
356
+ return $52FdA$solidjsweb.classList(_el$, Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || []), _$p);
357
+ });
358
+ return _el$;
359
+ })();
360
+ },
361
+ get children() {
362
+ return props.children;
363
+ }
364
+ });
365
+ }
366
+ const $6c2c739b113a8ddf$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2),
367
+ $6c2c739b113a8ddf$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type="text/css"></style>`, 2);
368
+ function $6c2c739b113a8ddf$export$d21e32dfedac04be(props) {
369
+ const container_element_ = (() => {
370
+ const _el$ = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$);
371
+ $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => props.element_attributes), false, true);
372
+ $52FdA$solidjsweb.insert(_el$, () => props.children);
373
+ $52FdA$solidjsweb.runHydrationEvents();
374
+ return _el$;
375
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
376
+ return $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
377
+ get message_() {
378
+ return "Failed calculating " + props.layout + " layout";
379
+ },
380
+ severity_: "error",
381
+ get children() {
382
+ return $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, container_element_);
383
+ }
384
+ });
385
+ }
386
+ function $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, container_element) {
387
+ let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
388
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
389
+ const show_all_rows = $52FdA$solidjs.createMemo(() => props.rows === "all");
390
+ const rows_or_empty_object = $52FdA$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
391
+ const view_more_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($52FdA$solidjs.createMemo(() => rows_or_empty_object().button));
392
+ const view_less_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($52FdA$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
393
+ const have_a_view_more_button = $52FdA$solidjs.createMemo(() => {
394
+ const button = view_more_button_elements();
395
+ return !(!button || Array.isArray(button) && !button.length);
396
+ });
397
+ const have_a_view_less_button = $52FdA$solidjs.createMemo(() => {
398
+ const button = view_less_button_elements();
399
+ return !(!button || Array.isArray(button) && !button.length);
400
+ });
401
+ const [get_styling, set_styling] = $52FdA$solidjs.createSignal();
402
+ const container_class = $52FdA$depictaiutilishared.make_random_classname();
403
+ const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
404
+ const [get_children_count, set_children_count] = $52FdA$solidjs.createSignal(0);
405
+ const update_children_count = () => set_children_count(container_element.children.length);
406
+ const col_styling = $52FdA$solidjs.createMemo(() => $52FdA$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
407
+ const default_currently_visible_signal = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(() => {
408
+ var _rows_or_empty_object;
409
+ return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
410
+ })); // 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
411
+ const rows_visible_signal = $52FdA$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
412
+ const get_rows_visible = $52FdA$solidjs.createMemo(() => rows_visible_signal()[0]());
413
+ const set_rows_visible = $52FdA$solidjs.createMemo(() => rows_visible_signal()[1]);
414
+ const view_more_button_class = $52FdA$depictaiutilishared.make_random_classname();
415
+ const view_less_button_class = $52FdA$depictaiutilishared.make_random_classname();
416
+ const style_element = (() => {
417
+ const _el$2 = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$2);
418
+ $52FdA$solidjsweb.insert(_el$2, get_styling);
419
+ return _el$2;
420
+ })();
421
+ const view_more_button_container = $52FdA$solidjs.createMemo(() => have_a_view_more_button() && (() => {
422
+ const _el$3 = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$);
423
+ $52FdA$solidjsweb.addEventListener(_el$3, "click", $52FdA$depictaiutilishared.catchify(() => set_rows_visible()(prev => {
424
+ var _rows_or_empty_object2;
425
+ return prev + ((_rows_or_empty_object2 = rows_or_empty_object().rows_per_click) !== null && _rows_or_empty_object2 !== void 0 ? _rows_or_empty_object2 : 1);
426
+ })), true);
427
+ $52FdA$solidjsweb.className(_el$3, "load-more-container ".concat(view_more_button_class));
428
+ $52FdA$solidjsweb.insert(_el$3, () => rows_or_empty_object().button);
429
+ $52FdA$solidjsweb.runHydrationEvents();
430
+ return _el$3;
431
+ })());
432
+ // 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
433
+ const view_less_button_container = $52FdA$solidjs.createMemo(() => have_a_view_less_button() && (() => {
434
+ const _el$4 = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$);
435
+ $52FdA$solidjsweb.addEventListener(_el$4, "click", $52FdA$depictaiutilishared.catchify(() => set_rows_visible()(() => {
436
+ var _rows_or_empty_object3;
437
+ return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
438
+ })), true);
439
+ $52FdA$solidjsweb.className(_el$4, "load-less-container ".concat(view_less_button_class));
440
+ $52FdA$solidjsweb.insert(_el$4, () => rows_or_empty_object().view_less_button);
441
+ $52FdA$solidjsweb.runHydrationEvents();
442
+ return _el$4;
443
+ })());
444
+ container_element.classList.add(container_class);
445
+ $52FdA$solidjs.createComputed(() => {
446
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
447
+ const rows_visible = get_rows_visible();
448
+ const max_rows = rows_or_empty_object().max_rows;
449
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
450
+ });
451
+ $52FdA$solidjs.createRenderEffect(() => {
452
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
453
+ if (show_all_rows()) {
454
+ // no view more functionality requested
455
+ set_styling(() => col_styling);
456
+ return;
457
+ }
458
+ update_children_count();
459
+ const mutation_observer = new MutationObserver($52FdA$depictaiutilishared.catchify(update_children_count));
460
+ mutation_observer.observe(container_element, {
461
+ childList: true
462
+ });
463
+ $52FdA$solidjs.onCleanup(() => mutation_observer.disconnect());
464
+ set_styling(
465
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
466
+ () => $52FdA$solidjs.createMemo(() => {
467
+ const {
468
+ rows_per_click: rows_per_click,
469
+ max_rows = -1,
470
+ start_rows: start_rows
471
+ } = rows_or_empty_object();
472
+ const rows_visible = get_rows_visible();
473
+ const children_count = get_children_count();
474
+ return col_styling() + props.cols_at_size.map(options => {
475
+ const [recs_per_row, min, max] = options;
476
+ let should_hide_view_more_button;
477
+ let visible_recs;
478
+ if (props.disable_partial_rows) {
479
+ visible_recs = $52FdA$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
480
+ const visible_recs_next_show_more = $52FdA$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
481
+ // Should this really be zero when we default rows_per_click to 1?
482
+ children_count, options);
483
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
484
+ } else {
485
+ visible_recs = $52FdA$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
486
+ should_hide_view_more_button = visible_recs >= children_count;
487
+ }
488
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
489
+ // 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
490
+ 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;
491
+ return "".concat($52FdA$depictaiutilishared.layout_media_query_header(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(view_more_button_class, "{display:none!important}") : "").concat(should_hide_view_less_button ? ".depict .".concat(view_less_button_class, "{display:none!important}") : "", "}");
492
+ }).join("");
493
+ }));
494
+ });
495
+ if (insert_after_container) container_element.after(style_element);
496
+ return [container_element, $52FdA$solidjsweb.memo(view_more_button_container), $52FdA$solidjsweb.memo(view_less_button_container), style_element];
497
+ }
498
+ $52FdA$solidjsweb.delegateEvents(["click"]);
499
+ const $9d19451330d04c3c$var$_tmpl$ = /*#__PURE__*/$52FdA$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);
500
+ function $9d19451330d04c3c$export$8be2714ec7f169ee() {
501
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
502
+ return (() => {
503
+ const _el$ = $52FdA$solidjsweb.getNextElement($9d19451330d04c3c$var$_tmpl$);
504
+ $52FdA$solidjsweb.effect(_p$ => {
505
+ var _props$width_, _props$height_;
506
+ const _v$ = (_props$width_ = props.width_) !== null && _props$width_ !== void 0 ? _props$width_ : 14,
507
+ _v$2 = (_props$height_ = props.height_) !== null && _props$height_ !== void 0 ? _props$height_ : 26;
508
+ _v$ !== _p$._v$ && $52FdA$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
509
+ _v$2 !== _p$._v$2 && $52FdA$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
510
+ return _p$;
511
+ }, {
512
+ _v$: undefined,
513
+ _v$2: undefined
514
+ });
515
+ return _el$;
516
+ })();
517
+ }
518
+ const $ad8ec7729fffeb9c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
519
+ function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
520
+ let {
521
+ children: children,
522
+ slider_ref_: slider_ref_,
523
+ faded_opacity_ = 0.7,
524
+ mutation_plugins_ = []
525
+ } = _ref;
526
+ const slider = new (0, $52FdA$depictaiutilishared.Amazing_Slider)({
527
+ button_contents: {
528
+ left: [(() => {
529
+ const _el$ = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
530
+ $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {}));
531
+ return _el$;
532
+ })()],
533
+ right: [(() => {
534
+ const _el$2 = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
535
+ $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {}));
536
+ return _el$2;
537
+ })()]
538
+ },
539
+ constructor_plugins: [$52FdA$depictaiutilishared.slider_snap_css().constructor_plugin],
540
+ mutation_plugins: [$52FdA$depictaiutilishared.slider_fading_factory({
541
+ threshold_: 0.96,
542
+ faded_opacity_: faded_opacity_
543
+ }).mutation_plugin_, ...mutation_plugins_]
544
+ });
545
+ $52FdA$solidjsweb.insert(slider.insert_here, children);
546
+ $52FdA$solidjs.onCleanup(() => slider.observer.disconnect());
547
+ slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
548
+ return slider.container;
549
+ }
550
+ function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
551
+ let {
552
+ recommendations_resource_: recommendations_resource_,
553
+ product_card_template_: product_card_template_,
554
+ layout_options_: layout_options_,
555
+ merchant_: merchant_,
556
+ market_: market_
557
+ } = _ref;
558
+ const is_showing_something = $52FdA$solidjs.createMemo(() => {
559
+ var _recommendations_reso;
560
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
561
+ });
562
+ const num_placeholders_ = () => 20;
563
+ const slider = $52FdA$solidjsweb.createComponent((0, $ad8ec7729fffeb9c$export$6649caad96ef8870), {
564
+ slider_ref_: slider => {
565
+ const Layout = props => $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, slider.insert_here, true);
566
+ // Do like this, so we don't have to call mergeProps ourselves
567
+ $52FdA$solidjsweb.createComponent(Layout, $52FdA$solidjsweb.mergeProps({
568
+ rows: "all",
569
+ layout: "slider"
570
+ }, layout_options_));
571
+ slider.insert_here.before($8edd3cf30d1fd8b4$export$a2cc176055f8f08());
572
+ },
573
+ get children() {
574
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
575
+ get fallback() {
576
+ return $e3915574cfd3466c$export$f33414a4df0afd3f({
577
+ num_placeholders_: num_placeholders_,
578
+ product_card_template_: product_card_template_
579
+ });
580
+ },
581
+ get children() {
582
+ return (() => {
583
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
584
+ const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => recommendations_resource_() || []));
585
+ return $76012c4468a53d1f$export$43f0fb951fcb0c54({
586
+ displays_by_key_: displays_by_key_,
587
+ merchant_: merchant_,
588
+ market_: market_,
589
+ product_card_template_: product_card_template_
590
+ });
591
+ })();
592
+ }
593
+ });
594
+ }
595
+ });
596
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
597
+ get when() {
598
+ return is_showing_something();
599
+ },
600
+ children: slider
601
+ });
602
+ }
603
+ const $2badc30d7c6610e1$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict plp"></div>`, 2);
604
+ function $2badc30d7c6610e1$export$9574e176201e5e8d(props) {
605
+ const grid_spacing_override = $52FdA$solidjs.createMemo(() => {
606
+ const {
607
+ grid_spacing: grid_spacing
608
+ } = props; // can be reactive
609
+ return typeof grid_spacing === "string" ? {
610
+ grid_spacing: grid_spacing
611
+ } : {
612
+ override_vertical_spacing: grid_spacing.vertical,
613
+ grid_spacing: grid_spacing.horizontal
614
+ };
615
+ });
616
+ const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
617
+ return (() => {
618
+ const _el$ = $52FdA$solidjsweb.getNextElement($2badc30d7c6610e1$var$_tmpl$);
619
+ $52FdA$solidjsweb.insert(_el$, () => $236a257ee52e5414$export$d41d19e89346fa2({
620
+ product_card_template_: function () {
621
+ return props.product_card_template(...arguments);
622
+ },
623
+ recommendations_resource_: recommendations_resource_,
624
+ market_: () => props.market,
625
+ merchant_: () => props.merchant,
626
+ layout_options_: $52FdA$solidjs.createMemo(() => ({
627
+ cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77($b1ea8d47bcf03111$export$ff7109b9b2b206ba(props.cols_at_size)),
628
+ ...grid_spacing_override()
629
+ }))
630
+ }));
631
+ return _el$;
632
+ })();
633
+ }
634
+ const $2c920813c92d6987$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
635
+ function $2c920813c92d6987$export$7da560f849543dff(_ref) {
636
+ let {
637
+ recommendations_resource_: recommendations_resource_,
638
+ product_card_template_: product_card_template_,
639
+ layout_options_: layout_options_,
640
+ merchant_: merchant_,
641
+ market_: market_,
642
+ rows_object_: rows_object_
643
+ } = _ref;
644
+ const is_showing_something = $52FdA$solidjs.createMemo(() => {
645
+ var _recommendations_reso;
646
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
647
+ });
648
+ const num_placeholders_ = () => 20;
649
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
650
+ get when() {
651
+ return is_showing_something();
652
+ },
653
+ get children() {
654
+ const _el$ = $52FdA$solidjsweb.getNextElement($2c920813c92d6987$var$_tmpl$),
655
+ _el$2 = _el$.firstChild,
656
+ [_el$3, _co$] = $52FdA$solidjsweb.getNextMarker(_el$2.nextSibling),
657
+ _el$4 = _el$3.nextSibling,
658
+ [_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
659
+ $52FdA$solidjsweb.insert(_el$, (0, $8edd3cf30d1fd8b4$export$a2cc176055f8f08), _el$3, _co$);
660
+ $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $52FdA$solidjsweb.mergeProps({
661
+ get rows() {
662
+ return rows_object_();
663
+ },
664
+ layout: "grid",
665
+ element_attributes: {
666
+ class: "cards"
667
+ }
668
+ }, layout_options_, {
669
+ get children() {
670
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
671
+ get fallback() {
672
+ return $e3915574cfd3466c$export$f33414a4df0afd3f({
673
+ num_placeholders_: num_placeholders_,
674
+ product_card_template_: product_card_template_
675
+ });
676
+ },
677
+ get children() {
678
+ return (() => {
679
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
680
+ const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => recommendations_resource_() || []));
681
+ return $76012c4468a53d1f$export$43f0fb951fcb0c54({
682
+ displays_by_key_: displays_by_key_,
683
+ merchant_: merchant_,
684
+ market_: market_,
685
+ product_card_template_: product_card_template_
686
+ });
687
+ })();
688
+ }
689
+ });
690
+ }
691
+ })), _el$5, _co$2);
692
+ return _el$;
693
+ }
694
+ });
695
+ }
696
+ const $41227f10ad680afd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class="show-more major" type="button"></button>`, 2),
697
+ $41227f10ad680afd$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict plp"></div>`, 2);
698
+ function $41227f10ad680afd$export$9756467d34d91cdb(props) {
699
+ const rows_object_ = $52FdA$solidjs.createMemo(() => {
700
+ const view_more_button = props.view_more_button;
701
+ if (!view_more_button) return "all";
702
+ return {
703
+ start_rows: view_more_button.start_rows,
704
+ rows_per_click: view_more_button.rows_per_click,
705
+ button: (() => {
706
+ const _el$ = $52FdA$solidjsweb.getNextElement($41227f10ad680afd$var$_tmpl$);
707
+ $52FdA$solidjsweb.insert(_el$, () => view_more_button.text);
708
+ return _el$;
709
+ })()
710
+ };
711
+ });
712
+ const grid_spacing_override = $52FdA$solidjs.createMemo(() => {
713
+ const {
714
+ grid_spacing: grid_spacing
715
+ } = props; // can be reactive
716
+ return typeof grid_spacing === "string" ? {
717
+ grid_spacing: grid_spacing
718
+ } : {
719
+ override_vertical_spacing: grid_spacing.vertical,
720
+ grid_spacing: grid_spacing.horizontal
721
+ };
722
+ });
723
+ const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
724
+ return (() => {
725
+ const _el$2 = $52FdA$solidjsweb.getNextElement($41227f10ad680afd$var$_tmpl$2);
726
+ $52FdA$solidjsweb.insert(_el$2, () => $2c920813c92d6987$export$7da560f849543dff({
727
+ rows_object_: rows_object_,
728
+ product_card_template_: function () {
729
+ return props.product_card_template(...arguments);
730
+ },
731
+ recommendations_resource_: recommendations_resource_,
732
+ market_: () => props.market,
733
+ merchant_: () => props.merchant,
734
+ layout_options_: $52FdA$solidjs.createMemo(() => ({
735
+ cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77($b1ea8d47bcf03111$export$ff7109b9b2b206ba(props.cols_at_size)),
736
+ ...grid_spacing_override()
737
+ }))
738
+ }));
739
+ return _el$2;
740
+ })();
741
+ }
68
742
  const $858fdcf73148519f$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<img>`, 1);
69
743
  function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
70
744
  const [size, setSize] = $52FdA$solidjs.createSignal(0);
@@ -121,46 +795,6 @@ function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
121
795
  return _el$;
122
796
  })();
123
797
  }
124
-
125
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
126
- class $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 extends Error {}
127
- class $95e4006e1dcb5b72$export$aa14a9f43128f61f extends $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 {
128
- constructor(templateError) {
129
- super("Uncaught error in product card template", {
130
- cause: templateError
131
- });
132
- }
133
- }
134
- const $1b3cf201cdd38687$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
135
- function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
136
- return $52FdA$solidjs.ErrorBoundary({
137
- fallback(err, retry) {
138
- var _props$on_error_;
139
- const {
140
- message_: message_,
141
- severity_: severity_
142
- } = props;
143
- let message = message_;
144
- if (err instanceof (0, $95e4006e1dcb5b72$export$aa14a9f43128f61f)) {
145
- console.error(err.cause);
146
- message = "".concat(message, ": ").concat(err.message);
147
- } else $52FdA$depictaiutilishared.report([err, message_], severity_);
148
- (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
149
- return (() => {
150
- const _el$ = $52FdA$solidjsweb.getNextElement($1b3cf201cdd38687$var$_tmpl$);
151
- $52FdA$solidjsweb.insert(_el$, message);
152
- $52FdA$solidjsweb.effect(_$p => {
153
- var _props$class_list_;
154
- return $52FdA$solidjsweb.classList(_el$, Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || []), _$p);
155
- });
156
- return _el$;
157
- })();
158
- },
159
- get children() {
160
- return props.children;
161
- }
162
- });
163
- }
164
798
  function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
165
799
  const {
166
800
  collapse: collapse,
@@ -280,57 +914,6 @@ function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
280
914
  return $52FdA$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
281
915
  });
282
916
  }
283
- const $9d19451330d04c3c$var$_tmpl$ = /*#__PURE__*/$52FdA$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);
284
- function $9d19451330d04c3c$export$8be2714ec7f169ee() {
285
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
286
- return (() => {
287
- const _el$ = $52FdA$solidjsweb.getNextElement($9d19451330d04c3c$var$_tmpl$);
288
- $52FdA$solidjsweb.effect(_p$ => {
289
- var _props$width_, _props$height_;
290
- const _v$ = (_props$width_ = props.width_) !== null && _props$width_ !== void 0 ? _props$width_ : 14,
291
- _v$2 = (_props$height_ = props.height_) !== null && _props$height_ !== void 0 ? _props$height_ : 26;
292
- _v$ !== _p$._v$ && $52FdA$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
293
- _v$2 !== _p$._v$2 && $52FdA$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
294
- return _p$;
295
- }, {
296
- _v$: undefined,
297
- _v$2: undefined
298
- });
299
- return _el$;
300
- })();
301
- }
302
- const $ad8ec7729fffeb9c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
303
- function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
304
- let {
305
- children: children,
306
- slider_ref_: slider_ref_,
307
- faded_opacity_ = 0.7,
308
- mutation_plugins_ = []
309
- } = _ref;
310
- const slider = new (0, $52FdA$depictaiutilishared.Amazing_Slider)({
311
- button_contents: {
312
- left: [(() => {
313
- const _el$ = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
314
- $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {}));
315
- return _el$;
316
- })()],
317
- right: [(() => {
318
- const _el$2 = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
319
- $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {}));
320
- return _el$2;
321
- })()]
322
- },
323
- constructor_plugins: [$52FdA$depictaiutilishared.slider_snap_css().constructor_plugin],
324
- mutation_plugins: [$52FdA$depictaiutilishared.slider_fading_factory({
325
- threshold_: 0.96,
326
- faded_opacity_: faded_opacity_
327
- }).mutation_plugin_, ...mutation_plugins_]
328
- });
329
- $52FdA$solidjsweb.insert(slider.insert_here, children);
330
- $52FdA$solidjs.onCleanup(() => slider.observer.disconnect());
331
- slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
332
- return slider.container;
333
- }
334
917
  const $5909f8d84b7b4c30$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
335
918
  const $5909f8d84b7b4c30$var$closing_functions = /*@__PURE__*/new Set();
336
919
  const $5909f8d84b7b4c30$export$22970a0140fc759c = /*@__PURE__*/$52FdA$solidjs.createSignal(false);
@@ -2871,161 +3454,19 @@ function $a162c9a08dc208c2$var$modify_only_local_filter(local_filter_object, sel
2871
3454
  for (let i = 0; i < values.length; i++) {
2872
3455
  const value = values[i];
2873
3456
  if (!jsond_set_values.includes(JSON.stringify(value)))
2874
- // We want to remove the entry with this value from the filter object because it's not selected
2875
- indexes_to_remove.add(i);
2876
- }
2877
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2878
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2879
- if (new_meta.counts)
2880
- // remove counts that are too much, they're all zero anyway if they exist
2881
- new_meta.counts.length -= indexes_to_remove.size;
2882
- }
2883
- }
2884
- }
2885
- return modified_filter_object;
2886
- }
2887
- function $e82d0d417fa613e8$export$2f0cbfbb4354bb52(elements) {
2888
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
2889
- return $52FdA$solidjs.createMemo(() => $e82d0d417fa613e8$var$unwrapping_helper(elements));
2890
- }
2891
- function $e82d0d417fa613e8$var$unwrapping_helper(elements) {
2892
- const result = [];
2893
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
2894
- const element = elements[i];
2895
- result.push(...$e82d0d417fa613e8$var$unwrapping_helper(element));
2896
- } else if (typeof elements == "function") result.push(...$e82d0d417fa613e8$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
2897
- return result;
2898
- }
2899
- const $6c2c739b113a8ddf$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2),
2900
- $6c2c739b113a8ddf$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type="text/css"></style>`, 2);
2901
- function $6c2c739b113a8ddf$export$d21e32dfedac04be(props) {
2902
- const container_element_ = (() => {
2903
- const _el$ = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$);
2904
- $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => props.element_attributes), false, true);
2905
- $52FdA$solidjsweb.insert(_el$, () => props.children);
2906
- $52FdA$solidjsweb.runHydrationEvents();
2907
- return _el$;
2908
- })(); // Don't want this in the error boundary below, it should only be for the actual layouting
2909
- return $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
2910
- get message_() {
2911
- return "Failed calculating " + props.layout + " layout";
2912
- },
2913
- severity_: "error",
2914
- get children() {
2915
- return $6c2c739b113a8ddf$var$ActualSolidLayout(props, container_element_);
2916
- }
2917
- });
2918
- }
2919
- function $6c2c739b113a8ddf$var$ActualSolidLayout(props, container_element) {
2920
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2921
- const show_all_rows = $52FdA$solidjs.createMemo(() => props.rows === "all");
2922
- const rows_or_empty_object = $52FdA$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
2923
- const view_more_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($52FdA$solidjs.createMemo(() => rows_or_empty_object().button));
2924
- const view_less_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($52FdA$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
2925
- const have_a_view_more_button = $52FdA$solidjs.createMemo(() => {
2926
- const button = view_more_button_elements();
2927
- return !(!button || Array.isArray(button) && !button.length);
2928
- });
2929
- const have_a_view_less_button = $52FdA$solidjs.createMemo(() => {
2930
- const button = view_less_button_elements();
2931
- return !(!button || Array.isArray(button) && !button.length);
2932
- });
2933
- const [get_styling, set_styling] = $52FdA$solidjs.createSignal();
2934
- const container_class = $52FdA$depictaiutilishared.make_random_classname();
2935
- const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
2936
- const [get_children_count, set_children_count] = $52FdA$solidjs.createSignal(0);
2937
- const update_children_count = () => set_children_count(container_element.children.length);
2938
- const col_styling = $52FdA$solidjs.createMemo(() => $52FdA$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2939
- const default_currently_visible_signal = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(() => {
2940
- var _rows_or_empty_object;
2941
- return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
2942
- })); // 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
2943
- const rows_visible_signal = $52FdA$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2944
- const get_rows_visible = $52FdA$solidjs.createMemo(() => rows_visible_signal()[0]());
2945
- const set_rows_visible = $52FdA$solidjs.createMemo(() => rows_visible_signal()[1]);
2946
- const view_more_button_class = $52FdA$depictaiutilishared.make_random_classname();
2947
- const view_less_button_class = $52FdA$depictaiutilishared.make_random_classname();
2948
- const view_more_button_container = $52FdA$solidjs.createMemo(() => have_a_view_more_button() && (() => {
2949
- const _el$2 = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$);
2950
- $52FdA$solidjsweb.addEventListener(_el$2, "click", $52FdA$depictaiutilishared.catchify(() => set_rows_visible()(prev => {
2951
- var _rows_or_empty_object2;
2952
- return prev + ((_rows_or_empty_object2 = rows_or_empty_object().rows_per_click) !== null && _rows_or_empty_object2 !== void 0 ? _rows_or_empty_object2 : 1);
2953
- })), true);
2954
- $52FdA$solidjsweb.className(_el$2, "load-more-container ".concat(view_more_button_class));
2955
- $52FdA$solidjsweb.insert(_el$2, () => rows_or_empty_object().button);
2956
- $52FdA$solidjsweb.runHydrationEvents();
2957
- return _el$2;
2958
- })());
2959
- // 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
2960
- const view_less_button_container = $52FdA$solidjs.createMemo(() => have_a_view_less_button() && (() => {
2961
- const _el$3 = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$);
2962
- $52FdA$solidjsweb.addEventListener(_el$3, "click", $52FdA$depictaiutilishared.catchify(() => set_rows_visible()(() => {
2963
- var _rows_or_empty_object3;
2964
- return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
2965
- })), true);
2966
- $52FdA$solidjsweb.className(_el$3, "load-less-container ".concat(view_less_button_class));
2967
- $52FdA$solidjsweb.insert(_el$3, () => rows_or_empty_object().view_less_button);
2968
- $52FdA$solidjsweb.runHydrationEvents();
2969
- return _el$3;
2970
- })());
2971
- container_element.classList.add(container_class);
2972
- $52FdA$solidjs.createComputed(() => {
2973
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
2974
- const rows_visible = get_rows_visible();
2975
- const max_rows = rows_or_empty_object().max_rows;
2976
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
2977
- });
2978
- $52FdA$solidjs.createRenderEffect(() => {
2979
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
2980
- if (show_all_rows()) {
2981
- // no view more functionality requested
2982
- set_styling(() => col_styling);
2983
- return;
2984
- }
2985
- update_children_count();
2986
- const mutation_observer = new MutationObserver($52FdA$depictaiutilishared.catchify(update_children_count));
2987
- mutation_observer.observe(container_element, {
2988
- childList: true
2989
- });
2990
- $52FdA$solidjs.onCleanup(() => mutation_observer.disconnect());
2991
- set_styling(
2992
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
2993
- () => $52FdA$solidjs.createMemo(() => {
2994
- const {
2995
- rows_per_click: rows_per_click,
2996
- max_rows = -1,
2997
- start_rows: start_rows
2998
- } = rows_or_empty_object();
2999
- const rows_visible = get_rows_visible();
3000
- const children_count = get_children_count();
3001
- return col_styling() + props.cols_at_size.map(options => {
3002
- const [recs_per_row, min, max] = options;
3003
- let should_hide_view_more_button;
3004
- let visible_recs;
3005
- if (props.disable_partial_rows) {
3006
- visible_recs = $52FdA$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
3007
- const visible_recs_next_show_more = $52FdA$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
3008
- // Should this really be zero when we default rows_per_click to 1?
3009
- children_count, options);
3010
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
3011
- } else {
3012
- visible_recs = $52FdA$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
3013
- should_hide_view_more_button = visible_recs >= children_count;
3014
- }
3015
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
3016
- // 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
3017
- 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;
3018
- return "".concat($52FdA$depictaiutilishared.layout_media_query_header(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(view_more_button_class, "{display:none!important}") : "").concat(should_hide_view_less_button ? ".depict .".concat(view_less_button_class, "{display:none!important}") : "", "}");
3019
- }).join("");
3020
- }));
3021
- });
3022
- return [container_element, $52FdA$solidjsweb.memo(view_more_button_container), $52FdA$solidjsweb.memo(view_less_button_container), (() => {
3023
- const _el$4 = $52FdA$solidjsweb.getNextElement($6c2c739b113a8ddf$var$_tmpl$2);
3024
- $52FdA$solidjsweb.insert(_el$4, get_styling);
3025
- return _el$4;
3026
- })()];
3457
+ // We want to remove the entry with this value from the filter object because it's not selected
3458
+ indexes_to_remove.add(i);
3459
+ }
3460
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
3461
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
3462
+ if (new_meta.counts)
3463
+ // remove counts that are too much, they're all zero anyway if they exist
3464
+ new_meta.counts.length -= indexes_to_remove.size;
3465
+ }
3466
+ }
3467
+ }
3468
+ return modified_filter_object;
3027
3469
  }
3028
- $52FdA$solidjsweb.delegateEvents(["click"]);
3029
3470
  async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_opts) {
3030
3471
  const body = await (0, $52FdA$depictaiutilishared.observer).wait_for_element("body");
3031
3472
  let dispose_and_remove;
@@ -3801,98 +4242,6 @@ function $063a16c081021c3f$export$ef6006467f04ee41(_ref) {
3801
4242
  })()];
3802
4243
  }
3803
4244
  $52FdA$solidjsweb.delegateEvents(["click"]);
3804
- function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
3805
- 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.";
3806
- return (0, $52FdA$solidjsweb.isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
3807
- }
3808
- let $e3915574cfd3466c$var$cached_placeholder_element;
3809
- let $e3915574cfd3466c$var$rendering_cached_placeholder_element;
3810
- function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
3811
- let {
3812
- product_card_template_: product_card_template_,
3813
- num_placeholders_: num_placeholders_
3814
- } = _ref;
3815
- const [get_elements, set_elements] = $52FdA$solidjs.createSignal([]);
3816
- let existing_num = 0;
3817
- if (0, $52FdA$solidjsweb.isServer)
3818
- // want to render simple placeholders on server, effects don't run there
3819
- return $52FdA$solidjs.createMemo(() => Array.from({
3820
- length: num_placeholders_()
3821
- }).map(() => {
3822
- const template_result = product_card_template_(null, undefined);
3823
- // @ts-ignore
3824
- if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
3825
- }));
3826
- $52FdA$solidjs.createRenderEffect(() => {
3827
- const to_add = num_placeholders_() - existing_num;
3828
- if (to_add <= 0) return;
3829
- // 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.
3830
- // 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.
3831
- // 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.
3832
- set_elements(prev => [...prev, ...Array.from({
3833
- length: to_add
3834
- }).map(() => $e3915574cfd3466c$var$Placeholder({
3835
- product_card_template_: product_card_template_
3836
- }))]);
3837
- existing_num += to_add;
3838
- });
3839
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3840
- }
3841
- /**
3842
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
3843
- */
3844
- function $e3915574cfd3466c$var$Placeholder(_ref2) {
3845
- let {
3846
- product_card_template_: product_card_template_
3847
- } = _ref2;
3848
- const get_cloned_placeholders = function () {
3849
- let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $e3915574cfd3466c$var$cached_placeholder_element;
3850
- return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
3851
- };
3852
- if ($e3915574cfd3466c$var$cached_placeholder_element) return get_cloned_placeholders();
3853
- let dispose_original_copy;
3854
- const get_unwrapped_element = $52FdA$solidjs.createRoot(dispose => {
3855
- dispose_original_copy = dispose;
3856
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
3857
- const [resource] = $52FdA$solidjs.createResource(() => {
3858
- if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) return $e3915574cfd3466c$var$rendering_cached_placeholder_element;
3859
- const return_value = product_card_template_(null, undefined);
3860
- if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
3861
- // Is Promise or promise-like object
3862
- $e3915574cfd3466c$var$rendering_cached_placeholder_element = return_value;
3863
- return return_value;
3864
- });
3865
- return $52FdA$solidjs.createMemo(() => {
3866
- if (resource.loading) return () => [];
3867
- return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
3868
- });
3869
- });
3870
- $52FdA$solidjs.onCleanup(() => {
3871
- if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) {
3872
- var _rendering_cached_pla;
3873
- // 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
3874
- const unset_current_rendering = () => {
3875
- dispose_original_copy();
3876
- $e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
3877
- };
3878
- (_rendering_cached_pla = $e3915574cfd3466c$var$rendering_cached_placeholder_element) === null || _rendering_cached_pla === void 0 || _rendering_cached_pla.then(unset_current_rendering, unset_current_rendering);
3879
- } else
3880
- // Otherwise, just make sure we've disposed our root
3881
- dispose_original_copy();
3882
- });
3883
- return $52FdA$solidjs.createMemo(() => {
3884
- const unwrapped_array = get_unwrapped_element()();
3885
- if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
3886
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
3887
- return;
3888
- // placeholders have finished rendering, freeze the elements
3889
- // 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
3890
- $e3915574cfd3466c$var$cached_placeholder_element || ($e3915574cfd3466c$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
3891
- $e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
3892
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
3893
- 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
3894
- });
3895
- }
3896
4245
 
3897
4246
  /*
3898
4247
  * 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.
@@ -4001,87 +4350,6 @@ function $45c16e404a883f74$export$63dd0350f8559dda(_ref) {
4001
4350
  equals: false
4002
4351
  });
4003
4352
  }
4004
-
4005
- /**
4006
- * Gets product_id (the thing we key the rendering on) from a display
4007
- */
4008
- function $b85edfec41cd3989$export$548d053aba053d79(display) {
4009
- if ("variant_index" in display) {
4010
- const actual_display = display.variant_displays[display.variant_index];
4011
- return actual_display.product_id;
4012
- }
4013
- return display.product_id;
4014
- }
4015
- function $76012c4468a53d1f$export$7f8bd308237ab5a5(get_displays_) {
4016
- const displays_by_key_ = $52FdA$solidjs.createMemo(() => {
4017
- const displays = get_displays_();
4018
- // We key by product_id because that's what can be used to uniquely identify products
4019
- // This way <For> can optimize the rendering
4020
- const map = new Map();
4021
- for (let i = 0; i < displays.length; i++) {
4022
- const display = displays[i];
4023
- const product_id = $b85edfec41cd3989$export$548d053aba053d79(display);
4024
- map.set(product_id, display);
4025
- }
4026
- return map;
4027
- });
4028
- return displays_by_key_;
4029
- }
4030
- function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
4031
- let {
4032
- displays_by_key_: displays_by_key_,
4033
- merchant_: merchant_,
4034
- market_: market_,
4035
- product_card_template_: product_card_template_,
4036
- do_per_elements_: do_per_elements_
4037
- } = _ref;
4038
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.For), {
4039
- get each() {
4040
- return [...displays_by_key_().keys()];
4041
- },
4042
- children: (product_id, index) => {
4043
- const owner = $52FdA$solidjs.getOwner();
4044
- const display_accessor = $52FdA$solidjs.createMemo(() => displays_by_key_().get(product_id));
4045
- const [product_card_resource] = $52FdA$solidjs.createResource(display_accessor,
4046
- // re-render when the reference to the display object changes
4047
- // this should only be the case when the merchant or market changes and the new request has completed
4048
- display => {
4049
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
4050
- return product_card_template_(display, {
4051
- set_on_index_change: fn => $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.createEffect(() => fn(index()))),
4052
- merchant: $52FdA$solidjs.untrack(merchant_),
4053
- // 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
4054
- market: $52FdA$solidjs.untrack(market_)
4055
- });
4056
- });
4057
- const node_accessor = $e82d0d417fa613e8$export$2f0cbfbb4354bb52(product_card_resource);
4058
- $52FdA$solidjs.createEffect(() => {
4059
- const product_card_nodes = node_accessor();
4060
- const display = display_accessor();
4061
- const elements = [];
4062
- for (let i = 0; i < product_card_nodes.length; i++) {
4063
- const element = product_card_nodes[i];
4064
- if (!(element instanceof Element)) continue;
4065
- elements.push(element);
4066
- // Add tracking ids
4067
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
4068
- const {
4069
- dataset: dataset
4070
- } = element;
4071
- const {
4072
- search_result_id: search_result_id,
4073
- product_listing_result_id: product_listing_result_id,
4074
- recommendation_id: recommendation_id
4075
- } = display;
4076
- 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;
4077
- }
4078
- do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
4079
- });
4080
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
4081
- }
4082
- });
4083
- }
4084
-
4085
4353
  function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
4086
4354
  let {
4087
4355
  plp_results_: plp_results_,
@@ -6525,45 +6793,6 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
6525
6793
  return _el$13;
6526
6794
  })()];
6527
6795
  }
6528
- const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
6529
- const cols_at_size = [];
6530
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
6531
- var _sorted_cols_at_size;
6532
- const [nb_cols, width] = sorted_cols_at_size[i];
6533
- const next_width = (_sorted_cols_at_size = sorted_cols_at_size[i + 1]) === null || _sorted_cols_at_size === void 0 ? void 0 : _sorted_cols_at_size[1];
6534
- const max_width = i === 0 ? "" : "".concat(width, "px");
6535
- const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
6536
- const col_at_size = [nb_cols, min_width, max_width];
6537
- cols_at_size.push(col_at_size);
6538
- }
6539
- return cols_at_size;
6540
- };
6541
- const $5401a6698b0c0658$export$6daf8749b65a1b77 = cols_at_size => {
6542
- // Check that every element is an array
6543
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
6544
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
6545
- // Check width duplicates
6546
- const widths = cols_at_size.map(_ref => {
6547
- let [_, width] = _ref;
6548
- return width;
6549
- });
6550
- const widths_set = new Set(widths);
6551
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
6552
- if (cols_at_size.length === 1) {
6553
- const [nb_cols, width] = cols_at_size[0];
6554
- const max_width = width !== undefined ? "".concat(width, "px") : "";
6555
- return [[nb_cols, "", max_width]];
6556
- }
6557
- // Sort widths in ascending order
6558
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
6559
- const [_b, width_A] = a;
6560
- const [_a, width_b] = b;
6561
- if (width_A === undefined) return -1;
6562
- if (width_b === undefined) return 1;
6563
- return width_b - width_A;
6564
- });
6565
- return $5401a6698b0c0658$var$transform_elements(sorted_cols_at_size);
6566
- };
6567
6796
  function $d05611ff6b8c8357$export$23fca46f3143581f(component, error_message) {
6568
6797
  const component_in_error_boundary = do_with_elements => {
6569
6798
  const error_boundary_wrapped = $1b3cf201cdd38687$export$b69d0d92862de18b({
@@ -7084,7 +7313,7 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
7084
7313
  */
7085
7314
  var $9cbefc32b9dab36d$var$_keys_constructed_with = {
7086
7315
  writable: true,
7087
- value: new Set()
7316
+ value: /*@__PURE__*/new Set()
7088
7317
  };
7089
7318
  function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
7090
7319
  const {
@@ -10377,38 +10606,6 @@ function $98bd00c15a2e3159$export$828dcdd425fd3231(aligner) {
10377
10606
  cleanup: cleanup
10378
10607
  };
10379
10608
  }
10380
-
10381
- /**
10382
- * 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
10383
- */
10384
- function $b1ea8d47bcf03111$export$ff7109b9b2b206ba(sdk_cols_at_size) {
10385
- let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
10386
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
10387
- const sorted_sizes = sdk_cols_at_size.map(_ref => {
10388
- let [cols, max_width] = _ref;
10389
- return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
10390
- }).sort((_ref2, _ref3) => {
10391
- let [, a] = _ref2;
10392
- let [, b] = _ref3;
10393
- return a - b;
10394
- });
10395
- const [[, smallest_max_width]] = sorted_sizes;
10396
- if (smallest_max_width > min_width_for_more_than_one_column)
10397
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
10398
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
10399
- const to_delete = [];
10400
- for (let i = 0; i < sorted_sizes.length; i++) {
10401
- const [, max_width] = sorted_sizes[i];
10402
- if (max_width > min_width_for_more_than_one_column) continue;
10403
- to_delete.push(i);
10404
- }
10405
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
10406
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
10407
- return sorted_sizes.map(_ref4 => {
10408
- let [cols, max_width] = _ref4;
10409
- return max_width == Infinity ? [cols] : [cols, max_width];
10410
- });
10411
- }
10412
10609
  const $ddd39c5f36f49703$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict plp search"></div>`, 2);
10413
10610
  function $ddd39c5f36f49703$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
10414
10611
  $ddd39c5f36f49703$var$_checkPrivateRedeclaration(obj, privateMap);
@@ -10734,7 +10931,7 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
10734
10931
  }
10735
10932
  var $ddd39c5f36f49703$var$_keys_constructed_with = {
10736
10933
  writable: true,
10737
- value: new Set()
10934
+ value: /*@__PURE__*/new Set()
10738
10935
  };
10739
10936
  function $ddd39c5f36f49703$var$get_shared_properties(depict_search) {
10740
10937
  const shared_properties = $ddd39c5f36f49703$var$privately_shared_properties.get(depict_search);
@@ -11107,7 +11304,7 @@ class $33e797e57f1b6354$export$3ccaa27d81dd8556 extends EventTarget {
11107
11304
  });
11108
11305
  $33e797e57f1b6354$var$_classPrivateFieldInitSpec(this, $33e797e57f1b6354$var$_unload, {
11109
11306
  writable: true,
11110
- value: $52FdA$depictaiutilishared.catchify(() => {
11307
+ value: /*@__PURE__*/$52FdA$depictaiutilishared.catchify(() => {
11111
11308
  var _classPrivateFieldGet3;
11112
11309
  if (!$parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $33e797e57f1b6354$var$_is_open)) return;
11113
11310
  (_classPrivateFieldGet3 = $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $33e797e57f1b6354$var$_disconnect_observer)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.call(this);
@@ -11121,7 +11318,7 @@ class $33e797e57f1b6354$export$3ccaa27d81dd8556 extends EventTarget {
11121
11318
  });
11122
11319
  $33e797e57f1b6354$var$_classPrivateFieldInitSpec(this, $33e797e57f1b6354$var$_load, {
11123
11320
  writable: true,
11124
- value: $52FdA$depictaiutilishared.catchify(async els => {
11321
+ value: /*@__PURE__*/$52FdA$depictaiutilishared.catchify(async els => {
11125
11322
  $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldSet)(this, $33e797e57f1b6354$var$_is_open, true);
11126
11323
  // So that #load doesn't get called again
11127
11324
  let set_should_stay_inserted;
@@ -11249,7 +11446,7 @@ var $33e797e57f1b6354$var$_reverting_permitted = {
11249
11446
  };
11250
11447
  var $33e797e57f1b6354$var$_visited_urls = {
11251
11448
  writable: true,
11252
- value: (() => {
11449
+ value: /*@__PURE__*/(() => {
11253
11450
  // 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).
11254
11451
  $52FdA$depictaiutilishared.catchify(async () => {
11255
11452
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.