@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.
@@ -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,600 @@ $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, $3hooq$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 $3hooq$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] = $3hooq$solidjs.createSignal([]);
165
+ let existing_num = 0;
166
+ if (0, $3hooq$solidjsweb.isServer)
167
+ // want to render simple placeholders on server, effects don't run there
168
+ return $3hooq$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
+ $3hooq$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 = $3hooq$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] = $3hooq$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 $3hooq$solidjs.createMemo(() => {
215
+ if (resource.loading) return () => [];
216
+ return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
217
+ });
218
+ });
219
+ $3hooq$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 $3hooq$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_ = $3hooq$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 $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.For), {
280
+ get each() {
281
+ return [...displays_by_key_().keys()];
282
+ },
283
+ children: (product_id, index) => {
284
+ const owner = $3hooq$solidjs.getOwner();
285
+ const display_accessor = $3hooq$solidjs.createMemo(() => displays_by_key_().get(product_id));
286
+ const [product_card_resource] = $3hooq$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 => $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.createEffect(() => fn(index()))),
293
+ merchant: $3hooq$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: $3hooq$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
+ $3hooq$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$ = ["<div", ' class="', '">', "</div>"];
337
+ function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
338
+ return $3hooq$solidjs.ErrorBoundary({
339
+ fallback(err, retry) {
340
+ var _props$on_error_, _props$class_list_;
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 $3hooq$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 $3hooq$solidjsweb.ssr($1b3cf201cdd38687$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrClassList(Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || [])), $3hooq$solidjsweb.escape(message));
352
+ },
353
+ get children() {
354
+ return props.children;
355
+ }
356
+ });
357
+ }
358
+ const $6c2c739b113a8ddf$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"],
359
+ $6c2c739b113a8ddf$var$_tmpl$2 = ["<div", ' class="', '">', "</div>"];
360
+ function $6c2c739b113a8ddf$export$d21e32dfedac04be(props) {
361
+ const container_element_ = $3hooq$solidjsweb.ssrElement("div", props.element_attributes, () => $3hooq$solidjsweb.escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
362
+ return $3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
363
+ get message_() {
364
+ return "Failed calculating " + props.layout + " layout";
365
+ },
366
+ severity_: "error",
367
+ get children() {
368
+ return $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, container_element_);
369
+ }
370
+ });
371
+ }
372
+ function $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, container_element) {
373
+ let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
374
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
375
+ const show_all_rows = $3hooq$solidjs.createMemo(() => props.rows === "all");
376
+ const rows_or_empty_object = $3hooq$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
377
+ const view_more_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($3hooq$solidjs.createMemo(() => rows_or_empty_object().button));
378
+ const view_less_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($3hooq$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
379
+ const have_a_view_more_button = $3hooq$solidjs.createMemo(() => {
380
+ const button = view_more_button_elements();
381
+ return !(!button || Array.isArray(button) && !button.length);
382
+ });
383
+ const have_a_view_less_button = $3hooq$solidjs.createMemo(() => {
384
+ const button = view_less_button_elements();
385
+ return !(!button || Array.isArray(button) && !button.length);
386
+ });
387
+ const [get_styling, set_styling] = $3hooq$solidjs.createSignal();
388
+ const container_class = $3hooq$depictaiutilishared.make_random_classname();
389
+ const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
390
+ const [get_children_count, set_children_count] = $3hooq$solidjs.createSignal(0);
391
+ const update_children_count = () => set_children_count(container_element.children.length);
392
+ const col_styling = $3hooq$solidjs.createMemo(() => $3hooq$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
393
+ const default_currently_visible_signal = $3hooq$solidjs.createSignal($3hooq$solidjs.untrack(() => {
394
+ var _rows_or_empty_object;
395
+ return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
396
+ })); // 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
397
+ const rows_visible_signal = $3hooq$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
398
+ const get_rows_visible = $3hooq$solidjs.createMemo(() => rows_visible_signal()[0]());
399
+ const set_rows_visible = $3hooq$solidjs.createMemo(() => rows_visible_signal()[1]);
400
+ const view_more_button_class = $3hooq$depictaiutilishared.make_random_classname();
401
+ const view_less_button_class = $3hooq$depictaiutilishared.make_random_classname();
402
+ const style_element = $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), get_styling);
403
+ const view_more_button_container = $3hooq$solidjs.createMemo(() => have_a_view_more_button() && $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), "load-more-container ".concat($3hooq$solidjsweb.escape(view_more_button_class, true)), $3hooq$solidjsweb.escape(rows_or_empty_object().button)));
404
+ // 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
405
+ const view_less_button_container = $3hooq$solidjs.createMemo(() => have_a_view_less_button() && $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), "load-less-container ".concat($3hooq$solidjsweb.escape(view_less_button_class, true)), $3hooq$solidjsweb.escape(rows_or_empty_object().view_less_button)));
406
+ container_element.classList.add(container_class);
407
+ $3hooq$solidjs.createComputed(() => {
408
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
409
+ const rows_visible = get_rows_visible();
410
+ const max_rows = rows_or_empty_object().max_rows;
411
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
412
+ });
413
+ $3hooq$solidjs.createRenderEffect(() => {
414
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
415
+ if (show_all_rows()) {
416
+ // no view more functionality requested
417
+ set_styling(() => col_styling);
418
+ return;
419
+ }
420
+ update_children_count();
421
+ const mutation_observer = new MutationObserver($3hooq$depictaiutilishared.catchify(update_children_count));
422
+ mutation_observer.observe(container_element, {
423
+ childList: true
424
+ });
425
+ $3hooq$solidjs.onCleanup(() => mutation_observer.disconnect());
426
+ set_styling(
427
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
428
+ () => $3hooq$solidjs.createMemo(() => {
429
+ const {
430
+ rows_per_click: rows_per_click,
431
+ max_rows = -1,
432
+ start_rows: start_rows
433
+ } = rows_or_empty_object();
434
+ const rows_visible = get_rows_visible();
435
+ const children_count = get_children_count();
436
+ return col_styling() + props.cols_at_size.map(options => {
437
+ const [recs_per_row, min, max] = options;
438
+ let should_hide_view_more_button;
439
+ let visible_recs;
440
+ if (props.disable_partial_rows) {
441
+ visible_recs = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
442
+ const visible_recs_next_show_more = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
443
+ // Should this really be zero when we default rows_per_click to 1?
444
+ children_count, options);
445
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
446
+ } else {
447
+ visible_recs = $3hooq$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
448
+ should_hide_view_more_button = visible_recs >= children_count;
449
+ }
450
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
451
+ // 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
452
+ 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;
453
+ return "".concat($3hooq$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}") : "", "}");
454
+ }).join("");
455
+ }));
456
+ });
457
+ if (insert_after_container) container_element.after(style_element);
458
+ return [container_element, view_more_button_container(), view_less_button_container(), style_element];
459
+ }
460
+ const $9d19451330d04c3c$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
461
+ function $9d19451330d04c3c$export$8be2714ec7f169ee() {
462
+ var _$escape2, _$escape3;
463
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
464
+ return $3hooq$solidjsweb.ssr($9d19451330d04c3c$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrAttribute("width", (_$escape2 = $3hooq$solidjsweb.escape(props.width_, true)) !== null && _$escape2 !== void 0 ? _$escape2 : 14, false) + $3hooq$solidjsweb.ssrAttribute("height", (_$escape3 = $3hooq$solidjsweb.escape(props.height_, true)) !== null && _$escape3 !== void 0 ? _$escape3 : 26, false));
465
+ }
466
+ const $ad8ec7729fffeb9c$var$_tmpl$ = ["<div", ">", "</div>"];
467
+ function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
468
+ let {
469
+ children: children,
470
+ slider_ref_: slider_ref_,
471
+ faded_opacity_ = 0.7,
472
+ mutation_plugins_ = []
473
+ } = _ref;
474
+ const slider = new (0, $3hooq$depictaiutilishared.Amazing_Slider)({
475
+ button_contents: {
476
+ left: [$3hooq$solidjsweb.ssr($ad8ec7729fffeb9c$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {})))],
477
+ right: [$3hooq$solidjsweb.ssr($ad8ec7729fffeb9c$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {})))]
478
+ },
479
+ constructor_plugins: [$3hooq$depictaiutilishared.slider_snap_css().constructor_plugin],
480
+ mutation_plugins: [$3hooq$depictaiutilishared.slider_fading_factory({
481
+ threshold_: 0.96,
482
+ faded_opacity_: faded_opacity_
483
+ }).mutation_plugin_, ...mutation_plugins_]
484
+ });
485
+ $3hooq$solidjsweb.insert(slider.insert_here, children);
486
+ $3hooq$solidjs.onCleanup(() => slider.observer.disconnect());
487
+ slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
488
+ return slider.container;
489
+ }
490
+ function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
491
+ let {
492
+ recommendations_resource_: recommendations_resource_,
493
+ product_card_template_: product_card_template_,
494
+ layout_options_: layout_options_,
495
+ merchant_: merchant_,
496
+ market_: market_
497
+ } = _ref;
498
+ const is_showing_something = $3hooq$solidjs.createMemo(() => {
499
+ var _recommendations_reso;
500
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
501
+ });
502
+ const num_placeholders_ = () => 20;
503
+ const slider = $3hooq$solidjsweb.createComponent((0, $ad8ec7729fffeb9c$export$6649caad96ef8870), {
504
+ slider_ref_: slider => {
505
+ const Layout = props => $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, slider.insert_here, true);
506
+ // Do like this, so we don't have to call mergeProps ourselves
507
+ $3hooq$solidjsweb.createComponent(Layout, $3hooq$solidjsweb.mergeProps({
508
+ rows: "all",
509
+ layout: "slider"
510
+ }, layout_options_));
511
+ slider.insert_here.before($8edd3cf30d1fd8b4$export$a2cc176055f8f08());
512
+ },
513
+ get children() {
514
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
515
+ get fallback() {
516
+ return $e3915574cfd3466c$export$f33414a4df0afd3f({
517
+ num_placeholders_: num_placeholders_,
518
+ product_card_template_: product_card_template_
519
+ });
520
+ },
521
+ get children() {
522
+ return (() => {
523
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
524
+ const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
525
+ return $76012c4468a53d1f$export$43f0fb951fcb0c54({
526
+ displays_by_key_: displays_by_key_,
527
+ merchant_: merchant_,
528
+ market_: market_,
529
+ product_card_template_: product_card_template_
530
+ });
531
+ })();
532
+ }
533
+ });
534
+ }
535
+ });
536
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
537
+ get when() {
538
+ return is_showing_something();
539
+ },
540
+ children: slider
541
+ });
542
+ }
543
+ const $2badc30d7c6610e1$var$_tmpl$ = ["<div", ' class="depict plp">', "</div>"];
544
+ function $2badc30d7c6610e1$export$9574e176201e5e8d(props) {
545
+ const grid_spacing_override = $3hooq$solidjs.createMemo(() => {
546
+ const {
547
+ grid_spacing: grid_spacing
548
+ } = props; // can be reactive
549
+ return typeof grid_spacing === "string" ? {
550
+ grid_spacing: grid_spacing
551
+ } : {
552
+ override_vertical_spacing: grid_spacing.vertical,
553
+ grid_spacing: grid_spacing.horizontal
554
+ };
555
+ });
556
+ const [recommendations_resource_] = $3hooq$solidjs.createResource(() => props.recommendations, recs => recs);
557
+ return $3hooq$solidjsweb.ssr($2badc30d7c6610e1$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($236a257ee52e5414$export$d41d19e89346fa2({
558
+ product_card_template_: function () {
559
+ return props.product_card_template(...arguments);
560
+ },
561
+ recommendations_resource_: recommendations_resource_,
562
+ market_: () => props.market,
563
+ merchant_: () => props.merchant,
564
+ layout_options_: $3hooq$solidjs.createMemo(() => ({
565
+ cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77($b1ea8d47bcf03111$export$ff7109b9b2b206ba(props.cols_at_size)),
566
+ ...grid_spacing_override()
567
+ }))
568
+ })));
569
+ }
570
+ const $2c920813c92d6987$var$_tmpl$ = ["<div", ' class="recommendation-grid"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
571
+ function $2c920813c92d6987$export$7da560f849543dff(_ref) {
572
+ let {
573
+ recommendations_resource_: recommendations_resource_,
574
+ product_card_template_: product_card_template_,
575
+ layout_options_: layout_options_,
576
+ merchant_: merchant_,
577
+ market_: market_,
578
+ rows_object_: rows_object_
579
+ } = _ref;
580
+ const is_showing_something = $3hooq$solidjs.createMemo(() => {
581
+ var _recommendations_reso;
582
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
583
+ });
584
+ const num_placeholders_ = () => 20;
585
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
586
+ get when() {
587
+ return is_showing_something();
588
+ },
589
+ get children() {
590
+ return $3hooq$solidjsweb.ssr($2c920813c92d6987$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($8edd3cf30d1fd8b4$export$a2cc176055f8f08()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $3hooq$solidjsweb.mergeProps({
591
+ get rows() {
592
+ return rows_object_();
593
+ },
594
+ layout: "grid",
595
+ element_attributes: {
596
+ class: "cards"
597
+ }
598
+ }, layout_options_, {
599
+ get children() {
600
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
601
+ get fallback() {
602
+ return $e3915574cfd3466c$export$f33414a4df0afd3f({
603
+ num_placeholders_: num_placeholders_,
604
+ product_card_template_: product_card_template_
605
+ });
606
+ },
607
+ get children() {
608
+ return (() => {
609
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
610
+ const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
611
+ return $76012c4468a53d1f$export$43f0fb951fcb0c54({
612
+ displays_by_key_: displays_by_key_,
613
+ merchant_: merchant_,
614
+ market_: market_,
615
+ product_card_template_: product_card_template_
616
+ });
617
+ })();
618
+ }
619
+ });
620
+ }
621
+ }))));
622
+ }
623
+ });
624
+ }
625
+ const $41227f10ad680afd$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
626
+ $41227f10ad680afd$var$_tmpl$2 = ["<div", ' class="depict plp">', "</div>"];
627
+ function $41227f10ad680afd$export$9756467d34d91cdb(props) {
628
+ const rows_object_ = $3hooq$solidjs.createMemo(() => {
629
+ const view_more_button = props.view_more_button;
630
+ if (!view_more_button) return "all";
631
+ return {
632
+ start_rows: view_more_button.start_rows,
633
+ rows_per_click: view_more_button.rows_per_click,
634
+ button: $3hooq$solidjsweb.ssr($41227f10ad680afd$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(view_more_button.text))
635
+ };
636
+ });
637
+ const grid_spacing_override = $3hooq$solidjs.createMemo(() => {
638
+ const {
639
+ grid_spacing: grid_spacing
640
+ } = props; // can be reactive
641
+ return typeof grid_spacing === "string" ? {
642
+ grid_spacing: grid_spacing
643
+ } : {
644
+ override_vertical_spacing: grid_spacing.vertical,
645
+ grid_spacing: grid_spacing.horizontal
646
+ };
647
+ });
648
+ const [recommendations_resource_] = $3hooq$solidjs.createResource(() => props.recommendations, recs => recs);
649
+ return $3hooq$solidjsweb.ssr($41227f10ad680afd$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($2c920813c92d6987$export$7da560f849543dff({
650
+ rows_object_: rows_object_,
651
+ product_card_template_: function () {
652
+ return props.product_card_template(...arguments);
653
+ },
654
+ recommendations_resource_: recommendations_resource_,
655
+ market_: () => props.market,
656
+ merchant_: () => props.merchant,
657
+ layout_options_: $3hooq$solidjs.createMemo(() => ({
658
+ cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77($b1ea8d47bcf03111$export$ff7109b9b2b206ba(props.cols_at_size)),
659
+ ...grid_spacing_override()
660
+ }))
661
+ })));
662
+ }
68
663
  function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
69
664
  const [size, setSize] = $3hooq$solidjs.createSignal(0);
70
665
  const resizeObserver = new ResizeObserver($3hooq$depictaiutilishared.catchify(records => {
@@ -110,38 +705,6 @@ const $ce467edb5343cfcd$var$_tmpl$ = ["<div", ' style="', '"></div>'];
110
705
  function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
111
706
  return $3hooq$solidjsweb.ssr($ce467edb5343cfcd$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrStyle("position:relative;width:100%;padding-bottom:".concat(1 / props.aspectRatio * 100, "%")));
112
707
  }
113
-
114
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
115
- class $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 extends Error {}
116
- class $95e4006e1dcb5b72$export$aa14a9f43128f61f extends $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 {
117
- constructor(templateError) {
118
- super("Uncaught error in product card template", {
119
- cause: templateError
120
- });
121
- }
122
- }
123
- const $1b3cf201cdd38687$var$_tmpl$ = ["<div", ' class="', '">', "</div>"];
124
- function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
125
- return $3hooq$solidjs.ErrorBoundary({
126
- fallback(err, retry) {
127
- var _props$on_error_, _props$class_list_;
128
- const {
129
- message_: message_,
130
- severity_: severity_
131
- } = props;
132
- let message = message_;
133
- if (err instanceof (0, $95e4006e1dcb5b72$export$aa14a9f43128f61f)) {
134
- console.error(err.cause);
135
- message = "".concat(message, ": ").concat(err.message);
136
- } else $3hooq$depictaiutilishared.report([err, message_], severity_);
137
- (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
138
- return $3hooq$solidjsweb.ssr($1b3cf201cdd38687$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrClassList(Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || [])), $3hooq$solidjsweb.escape(message));
139
- },
140
- get children() {
141
- return props.children;
142
- }
143
- });
144
- }
145
708
  function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
146
709
  const {
147
710
  collapse: collapse,
@@ -261,36 +824,6 @@ function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
261
824
  return $3hooq$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
262
825
  });
263
826
  }
264
- const $9d19451330d04c3c$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
265
- function $9d19451330d04c3c$export$8be2714ec7f169ee() {
266
- var _$escape2, _$escape3;
267
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
268
- return $3hooq$solidjsweb.ssr($9d19451330d04c3c$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrAttribute("width", (_$escape2 = $3hooq$solidjsweb.escape(props.width_, true)) !== null && _$escape2 !== void 0 ? _$escape2 : 14, false) + $3hooq$solidjsweb.ssrAttribute("height", (_$escape3 = $3hooq$solidjsweb.escape(props.height_, true)) !== null && _$escape3 !== void 0 ? _$escape3 : 26, false));
269
- }
270
- const $ad8ec7729fffeb9c$var$_tmpl$ = ["<div", ">", "</div>"];
271
- function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
272
- let {
273
- children: children,
274
- slider_ref_: slider_ref_,
275
- faded_opacity_ = 0.7,
276
- mutation_plugins_ = []
277
- } = _ref;
278
- const slider = new (0, $3hooq$depictaiutilishared.Amazing_Slider)({
279
- button_contents: {
280
- left: [$3hooq$solidjsweb.ssr($ad8ec7729fffeb9c$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {})))],
281
- right: [$3hooq$solidjsweb.ssr($ad8ec7729fffeb9c$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {})))]
282
- },
283
- constructor_plugins: [$3hooq$depictaiutilishared.slider_snap_css().constructor_plugin],
284
- mutation_plugins: [$3hooq$depictaiutilishared.slider_fading_factory({
285
- threshold_: 0.96,
286
- faded_opacity_: faded_opacity_
287
- }).mutation_plugin_, ...mutation_plugins_]
288
- });
289
- $3hooq$solidjsweb.insert(slider.insert_here, children);
290
- $3hooq$solidjs.onCleanup(() => slider.observer.disconnect());
291
- slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
292
- return slider.container;
293
- }
294
827
  const $083b2336093176cf$var$_tmpl$ = '<path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z"></path>';
295
828
  function $083b2336093176cf$export$3b621d86b1566b2() {
296
829
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -2078,130 +2611,19 @@ function $a162c9a08dc208c2$var$modify_only_local_filter(local_filter_object, sel
2078
2611
  const indexes_to_remove = new Set();
2079
2612
  for (let i = 0; i < values.length; i++) {
2080
2613
  const value = values[i];
2081
- if (!jsond_set_values.includes(JSON.stringify(value)))
2082
- // We want to remove the entry with this value from the filter object because it's not selected
2083
- indexes_to_remove.add(i);
2084
- }
2085
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2086
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2087
- if (new_meta.counts)
2088
- // remove counts that are too much, they're all zero anyway if they exist
2089
- new_meta.counts.length -= indexes_to_remove.size;
2090
- }
2091
- }
2092
- }
2093
- return modified_filter_object;
2094
- }
2095
- function $e82d0d417fa613e8$export$2f0cbfbb4354bb52(elements) {
2096
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
2097
- return $3hooq$solidjs.createMemo(() => $e82d0d417fa613e8$var$unwrapping_helper(elements));
2098
- }
2099
- function $e82d0d417fa613e8$var$unwrapping_helper(elements) {
2100
- const result = [];
2101
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
2102
- const element = elements[i];
2103
- result.push(...$e82d0d417fa613e8$var$unwrapping_helper(element));
2104
- } else if (typeof elements == "function") result.push(...$e82d0d417fa613e8$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
2105
- return result;
2106
- }
2107
- const $6c2c739b113a8ddf$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
2108
- $6c2c739b113a8ddf$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
2109
- function $6c2c739b113a8ddf$export$d21e32dfedac04be(props) {
2110
- const container_element_ = $3hooq$solidjsweb.ssrElement("div", props.element_attributes, () => $3hooq$solidjsweb.escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
2111
- return $3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
2112
- get message_() {
2113
- return "Failed calculating " + props.layout + " layout";
2114
- },
2115
- severity_: "error",
2116
- get children() {
2117
- return $6c2c739b113a8ddf$var$ActualSolidLayout(props, container_element_);
2118
- }
2119
- });
2120
- }
2121
- function $6c2c739b113a8ddf$var$ActualSolidLayout(props, container_element) {
2122
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2123
- const show_all_rows = $3hooq$solidjs.createMemo(() => props.rows === "all");
2124
- const rows_or_empty_object = $3hooq$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
2125
- const view_more_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($3hooq$solidjs.createMemo(() => rows_or_empty_object().button));
2126
- const view_less_button_elements = $e82d0d417fa613e8$export$2f0cbfbb4354bb52($3hooq$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
2127
- const have_a_view_more_button = $3hooq$solidjs.createMemo(() => {
2128
- const button = view_more_button_elements();
2129
- return !(!button || Array.isArray(button) && !button.length);
2130
- });
2131
- const have_a_view_less_button = $3hooq$solidjs.createMemo(() => {
2132
- const button = view_less_button_elements();
2133
- return !(!button || Array.isArray(button) && !button.length);
2134
- });
2135
- const [get_styling, set_styling] = $3hooq$solidjs.createSignal();
2136
- const container_class = $3hooq$depictaiutilishared.make_random_classname();
2137
- const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
2138
- const [get_children_count, set_children_count] = $3hooq$solidjs.createSignal(0);
2139
- const update_children_count = () => set_children_count(container_element.children.length);
2140
- const col_styling = $3hooq$solidjs.createMemo(() => $3hooq$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2141
- const default_currently_visible_signal = $3hooq$solidjs.createSignal($3hooq$solidjs.untrack(() => {
2142
- var _rows_or_empty_object;
2143
- return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
2144
- })); // 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
2145
- const rows_visible_signal = $3hooq$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2146
- const get_rows_visible = $3hooq$solidjs.createMemo(() => rows_visible_signal()[0]());
2147
- const set_rows_visible = $3hooq$solidjs.createMemo(() => rows_visible_signal()[1]);
2148
- const view_more_button_class = $3hooq$depictaiutilishared.make_random_classname();
2149
- const view_less_button_class = $3hooq$depictaiutilishared.make_random_classname();
2150
- const view_more_button_container = $3hooq$solidjs.createMemo(() => have_a_view_more_button() && $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "load-more-container ".concat($3hooq$solidjsweb.escape(view_more_button_class, true)), $3hooq$solidjsweb.escape(rows_or_empty_object().button)));
2151
- // 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
2152
- const view_less_button_container = $3hooq$solidjs.createMemo(() => have_a_view_less_button() && $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "load-less-container ".concat($3hooq$solidjsweb.escape(view_less_button_class, true)), $3hooq$solidjsweb.escape(rows_or_empty_object().view_less_button)));
2153
- container_element.classList.add(container_class);
2154
- $3hooq$solidjs.createComputed(() => {
2155
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
2156
- const rows_visible = get_rows_visible();
2157
- const max_rows = rows_or_empty_object().max_rows;
2158
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
2159
- });
2160
- $3hooq$solidjs.createRenderEffect(() => {
2161
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
2162
- if (show_all_rows()) {
2163
- // no view more functionality requested
2164
- set_styling(() => col_styling);
2165
- return;
2166
- }
2167
- update_children_count();
2168
- const mutation_observer = new MutationObserver($3hooq$depictaiutilishared.catchify(update_children_count));
2169
- mutation_observer.observe(container_element, {
2170
- childList: true
2171
- });
2172
- $3hooq$solidjs.onCleanup(() => mutation_observer.disconnect());
2173
- set_styling(
2174
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
2175
- () => $3hooq$solidjs.createMemo(() => {
2176
- const {
2177
- rows_per_click: rows_per_click,
2178
- max_rows = -1,
2179
- start_rows: start_rows
2180
- } = rows_or_empty_object();
2181
- const rows_visible = get_rows_visible();
2182
- const children_count = get_children_count();
2183
- return col_styling() + props.cols_at_size.map(options => {
2184
- const [recs_per_row, min, max] = options;
2185
- let should_hide_view_more_button;
2186
- let visible_recs;
2187
- if (props.disable_partial_rows) {
2188
- visible_recs = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
2189
- const visible_recs_next_show_more = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
2190
- // Should this really be zero when we default rows_per_click to 1?
2191
- children_count, options);
2192
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
2193
- } else {
2194
- visible_recs = $3hooq$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
2195
- should_hide_view_more_button = visible_recs >= children_count;
2196
- }
2197
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
2198
- // 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
2199
- 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;
2200
- return "".concat($3hooq$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}") : "", "}");
2201
- }).join("");
2202
- }));
2203
- });
2204
- return [container_element, view_more_button_container(), view_less_button_container(), $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), get_styling)];
2614
+ if (!jsond_set_values.includes(JSON.stringify(value)))
2615
+ // We want to remove the entry with this value from the filter object because it's not selected
2616
+ indexes_to_remove.add(i);
2617
+ }
2618
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2619
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2620
+ if (new_meta.counts)
2621
+ // remove counts that are too much, they're all zero anyway if they exist
2622
+ new_meta.counts.length -= indexes_to_remove.size;
2623
+ }
2624
+ }
2625
+ }
2626
+ return modified_filter_object;
2205
2627
  }
2206
2628
  async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2207
2629
  const body = await (0, $3hooq$depictaiutilishared.observer).wait_for_element("body");
@@ -2940,98 +3362,6 @@ function $063a16c081021c3f$export$ef6006467f04ee41(_ref) {
2940
3362
  }
2941
3363
  })))];
2942
3364
  }
2943
- function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
2944
- 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.";
2945
- return (0, $3hooq$solidjsweb.isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
2946
- }
2947
- let $e3915574cfd3466c$var$cached_placeholder_element;
2948
- let $e3915574cfd3466c$var$rendering_cached_placeholder_element;
2949
- function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
2950
- let {
2951
- product_card_template_: product_card_template_,
2952
- num_placeholders_: num_placeholders_
2953
- } = _ref;
2954
- const [get_elements, set_elements] = $3hooq$solidjs.createSignal([]);
2955
- let existing_num = 0;
2956
- if (0, $3hooq$solidjsweb.isServer)
2957
- // want to render simple placeholders on server, effects don't run there
2958
- return $3hooq$solidjs.createMemo(() => Array.from({
2959
- length: num_placeholders_()
2960
- }).map(() => {
2961
- const template_result = product_card_template_(null, undefined);
2962
- // @ts-ignore
2963
- if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
2964
- }));
2965
- $3hooq$solidjs.createRenderEffect(() => {
2966
- const to_add = num_placeholders_() - existing_num;
2967
- if (to_add <= 0) return;
2968
- // 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.
2969
- // 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.
2970
- // 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.
2971
- set_elements(prev => [...prev, ...Array.from({
2972
- length: to_add
2973
- }).map(() => $e3915574cfd3466c$var$Placeholder({
2974
- product_card_template_: product_card_template_
2975
- }))]);
2976
- existing_num += to_add;
2977
- });
2978
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
2979
- }
2980
- /**
2981
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
2982
- */
2983
- function $e3915574cfd3466c$var$Placeholder(_ref2) {
2984
- let {
2985
- product_card_template_: product_card_template_
2986
- } = _ref2;
2987
- const get_cloned_placeholders = function () {
2988
- let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $e3915574cfd3466c$var$cached_placeholder_element;
2989
- return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
2990
- };
2991
- if ($e3915574cfd3466c$var$cached_placeholder_element) return get_cloned_placeholders();
2992
- let dispose_original_copy;
2993
- const get_unwrapped_element = $3hooq$solidjs.createRoot(dispose => {
2994
- dispose_original_copy = dispose;
2995
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
2996
- const [resource] = $3hooq$solidjs.createResource(() => {
2997
- if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) return $e3915574cfd3466c$var$rendering_cached_placeholder_element;
2998
- const return_value = product_card_template_(null, undefined);
2999
- if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
3000
- // Is Promise or promise-like object
3001
- $e3915574cfd3466c$var$rendering_cached_placeholder_element = return_value;
3002
- return return_value;
3003
- });
3004
- return $3hooq$solidjs.createMemo(() => {
3005
- if (resource.loading) return () => [];
3006
- return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
3007
- });
3008
- });
3009
- $3hooq$solidjs.onCleanup(() => {
3010
- if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) {
3011
- var _rendering_cached_pla;
3012
- // 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
3013
- const unset_current_rendering = () => {
3014
- dispose_original_copy();
3015
- $e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
3016
- };
3017
- (_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);
3018
- } else
3019
- // Otherwise, just make sure we've disposed our root
3020
- dispose_original_copy();
3021
- });
3022
- return $3hooq$solidjs.createMemo(() => {
3023
- const unwrapped_array = get_unwrapped_element()();
3024
- if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
3025
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
3026
- return;
3027
- // placeholders have finished rendering, freeze the elements
3028
- // 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
3029
- $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
3030
- $e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
3031
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
3032
- 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
3033
- });
3034
- }
3035
3365
 
3036
3366
  /*
3037
3367
  * 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.
@@ -3140,87 +3470,6 @@ function $45c16e404a883f74$export$63dd0350f8559dda(_ref) {
3140
3470
  equals: false
3141
3471
  });
3142
3472
  }
3143
-
3144
- /**
3145
- * Gets product_id (the thing we key the rendering on) from a display
3146
- */
3147
- function $b85edfec41cd3989$export$548d053aba053d79(display) {
3148
- if ("variant_index" in display) {
3149
- const actual_display = display.variant_displays[display.variant_index];
3150
- return actual_display.product_id;
3151
- }
3152
- return display.product_id;
3153
- }
3154
- function $76012c4468a53d1f$export$7f8bd308237ab5a5(get_displays_) {
3155
- const displays_by_key_ = $3hooq$solidjs.createMemo(() => {
3156
- const displays = get_displays_();
3157
- // We key by product_id because that's what can be used to uniquely identify products
3158
- // This way <For> can optimize the rendering
3159
- const map = new Map();
3160
- for (let i = 0; i < displays.length; i++) {
3161
- const display = displays[i];
3162
- const product_id = $b85edfec41cd3989$export$548d053aba053d79(display);
3163
- map.set(product_id, display);
3164
- }
3165
- return map;
3166
- });
3167
- return displays_by_key_;
3168
- }
3169
- function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
3170
- let {
3171
- displays_by_key_: displays_by_key_,
3172
- merchant_: merchant_,
3173
- market_: market_,
3174
- product_card_template_: product_card_template_,
3175
- do_per_elements_: do_per_elements_
3176
- } = _ref;
3177
- return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.For), {
3178
- get each() {
3179
- return [...displays_by_key_().keys()];
3180
- },
3181
- children: (product_id, index) => {
3182
- const owner = $3hooq$solidjs.getOwner();
3183
- const display_accessor = $3hooq$solidjs.createMemo(() => displays_by_key_().get(product_id));
3184
- const [product_card_resource] = $3hooq$solidjs.createResource(display_accessor,
3185
- // re-render when the reference to the display object changes
3186
- // this should only be the case when the merchant or market changes and the new request has completed
3187
- display => {
3188
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
3189
- return product_card_template_(display, {
3190
- set_on_index_change: fn => $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.createEffect(() => fn(index()))),
3191
- merchant: $3hooq$solidjs.untrack(merchant_),
3192
- // 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
3193
- market: $3hooq$solidjs.untrack(market_)
3194
- });
3195
- });
3196
- const node_accessor = $e82d0d417fa613e8$export$2f0cbfbb4354bb52(product_card_resource);
3197
- $3hooq$solidjs.createEffect(() => {
3198
- const product_card_nodes = node_accessor();
3199
- const display = display_accessor();
3200
- const elements = [];
3201
- for (let i = 0; i < product_card_nodes.length; i++) {
3202
- const element = product_card_nodes[i];
3203
- if (!(element instanceof Element)) continue;
3204
- elements.push(element);
3205
- // Add tracking ids
3206
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
3207
- const {
3208
- dataset: dataset
3209
- } = element;
3210
- const {
3211
- search_result_id: search_result_id,
3212
- product_listing_result_id: product_listing_result_id,
3213
- recommendation_id: recommendation_id
3214
- } = display;
3215
- 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;
3216
- }
3217
- do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
3218
- });
3219
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3220
- }
3221
- });
3222
- }
3223
-
3224
3473
  function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
3225
3474
  let {
3226
3475
  plp_results_: plp_results_,
@@ -5239,45 +5488,6 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
5239
5488
  }
5240
5489
  })))];
5241
5490
  }
5242
- const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
5243
- const cols_at_size = [];
5244
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
5245
- var _sorted_cols_at_size;
5246
- const [nb_cols, width] = sorted_cols_at_size[i];
5247
- 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];
5248
- const max_width = i === 0 ? "" : "".concat(width, "px");
5249
- const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
5250
- const col_at_size = [nb_cols, min_width, max_width];
5251
- cols_at_size.push(col_at_size);
5252
- }
5253
- return cols_at_size;
5254
- };
5255
- const $5401a6698b0c0658$export$6daf8749b65a1b77 = cols_at_size => {
5256
- // Check that every element is an array
5257
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
5258
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
5259
- // Check width duplicates
5260
- const widths = cols_at_size.map(_ref => {
5261
- let [_, width] = _ref;
5262
- return width;
5263
- });
5264
- const widths_set = new Set(widths);
5265
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
5266
- if (cols_at_size.length === 1) {
5267
- const [nb_cols, width] = cols_at_size[0];
5268
- const max_width = width !== undefined ? "".concat(width, "px") : "";
5269
- return [[nb_cols, "", max_width]];
5270
- }
5271
- // Sort widths in ascending order
5272
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
5273
- const [_b, width_A] = a;
5274
- const [_a, width_b] = b;
5275
- if (width_A === undefined) return -1;
5276
- if (width_b === undefined) return 1;
5277
- return width_b - width_A;
5278
- });
5279
- return $5401a6698b0c0658$var$transform_elements(sorted_cols_at_size);
5280
- };
5281
5491
  function $d05611ff6b8c8357$export$23fca46f3143581f(component, error_message) {
5282
5492
  const component_in_error_boundary = do_with_elements => {
5283
5493
  const error_boundary_wrapped = $1b3cf201cdd38687$export$b69d0d92862de18b({
@@ -5793,7 +6003,7 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
5793
6003
  */
5794
6004
  var $9cbefc32b9dab36d$var$_keys_constructed_with = {
5795
6005
  writable: true,
5796
- value: new Set()
6006
+ value: /*@__PURE__*/new Set()
5797
6007
  };
5798
6008
  function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
5799
6009
  const {
@@ -8453,38 +8663,6 @@ function $98bd00c15a2e3159$export$828dcdd425fd3231(aligner) {
8453
8663
  cleanup: cleanup
8454
8664
  };
8455
8665
  }
8456
-
8457
- /**
8458
- * 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
8459
- */
8460
- function $b1ea8d47bcf03111$export$ff7109b9b2b206ba(sdk_cols_at_size) {
8461
- let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
8462
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
8463
- const sorted_sizes = sdk_cols_at_size.map(_ref => {
8464
- let [cols, max_width] = _ref;
8465
- return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
8466
- }).sort((_ref2, _ref3) => {
8467
- let [, a] = _ref2;
8468
- let [, b] = _ref3;
8469
- return a - b;
8470
- });
8471
- const [[, smallest_max_width]] = sorted_sizes;
8472
- if (smallest_max_width > min_width_for_more_than_one_column)
8473
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
8474
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
8475
- const to_delete = [];
8476
- for (let i = 0; i < sorted_sizes.length; i++) {
8477
- const [, max_width] = sorted_sizes[i];
8478
- if (max_width > min_width_for_more_than_one_column) continue;
8479
- to_delete.push(i);
8480
- }
8481
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
8482
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
8483
- return sorted_sizes.map(_ref4 => {
8484
- let [cols, max_width] = _ref4;
8485
- return max_width == Infinity ? [cols] : [cols, max_width];
8486
- });
8487
- }
8488
8666
  const $ddd39c5f36f49703$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
8489
8667
  function $ddd39c5f36f49703$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
8490
8668
  $ddd39c5f36f49703$var$_checkPrivateRedeclaration(obj, privateMap);
@@ -8810,7 +8988,7 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
8810
8988
  }
8811
8989
  var $ddd39c5f36f49703$var$_keys_constructed_with = {
8812
8990
  writable: true,
8813
- value: new Set()
8991
+ value: /*@__PURE__*/new Set()
8814
8992
  };
8815
8993
  function $ddd39c5f36f49703$var$get_shared_properties(depict_search) {
8816
8994
  const shared_properties = $ddd39c5f36f49703$var$privately_shared_properties.get(depict_search);
@@ -9179,7 +9357,7 @@ class $33e797e57f1b6354$export$3ccaa27d81dd8556 extends EventTarget {
9179
9357
  });
9180
9358
  $33e797e57f1b6354$var$_classPrivateFieldInitSpec(this, $33e797e57f1b6354$var$_unload, {
9181
9359
  writable: true,
9182
- value: $3hooq$depictaiutilishared.catchify(() => {
9360
+ value: /*@__PURE__*/$3hooq$depictaiutilishared.catchify(() => {
9183
9361
  var _classPrivateFieldGet3;
9184
9362
  if (!$parcel$interopDefault($3hooq$babelruntimehelpersclassPrivateFieldGet)(this, $33e797e57f1b6354$var$_is_open)) return;
9185
9363
  (_classPrivateFieldGet3 = $parcel$interopDefault($3hooq$babelruntimehelpersclassPrivateFieldGet)(this, $33e797e57f1b6354$var$_disconnect_observer)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.call(this);
@@ -9193,7 +9371,7 @@ class $33e797e57f1b6354$export$3ccaa27d81dd8556 extends EventTarget {
9193
9371
  });
9194
9372
  $33e797e57f1b6354$var$_classPrivateFieldInitSpec(this, $33e797e57f1b6354$var$_load, {
9195
9373
  writable: true,
9196
- value: $3hooq$depictaiutilishared.catchify(async els => {
9374
+ value: /*@__PURE__*/$3hooq$depictaiutilishared.catchify(async els => {
9197
9375
  $parcel$interopDefault($3hooq$babelruntimehelpersclassPrivateFieldSet)(this, $33e797e57f1b6354$var$_is_open, true);
9198
9376
  // So that #load doesn't get called again
9199
9377
  let set_should_stay_inserted;
@@ -9321,7 +9499,7 @@ var $33e797e57f1b6354$var$_reverting_permitted = {
9321
9499
  };
9322
9500
  var $33e797e57f1b6354$var$_visited_urls = {
9323
9501
  writable: true,
9324
- value: (() => {
9502
+ value: /*@__PURE__*/(() => {
9325
9503
  // 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).
9326
9504
  $3hooq$depictaiutilishared.catchify(async () => {
9327
9505
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.