@depict-ai/ui 4.7.33 → 4.7.34

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.
@@ -18,6 +18,7 @@ function $parcel$export(e, n, v, s) {
18
18
  function $parcel$interopDefault(a) {
19
19
  return a && a.__esModule ? a.default : a;
20
20
  }
21
+ $parcel$export(module.exports, "ModernResponsiveImage", () => $f3db423dc84bc35d$export$140423fa4bfb6d63);
21
22
  $parcel$export(module.exports, "setExtraDisplayTransformers", () => $cc9aacef898ccc9a$export$f98b8d5ea7207a1);
22
23
  $parcel$export(module.exports, "getExtraDisplayTransformers", () => $cc9aacef898ccc9a$export$b2d94be4f02525b2);
23
24
  $parcel$export(module.exports, "remap_blocks_to_index", () => $f8f375d6245ffff2$export$92aa5d691d588f3f);
@@ -60,7 +61,6 @@ $parcel$export(module.exports, "make_accurate_width_accessor", () => $c387d7f1d9
60
61
  $parcel$export(module.exports, "RecommendationSlider", () => $2badc30d7c6610e1$export$9574e176201e5e8d);
61
62
  $parcel$export(module.exports, "RecommendationGrid", () => $41227f10ad680afd$export$9756467d34d91cdb);
62
63
  $parcel$export(module.exports, "ShopifyResponsiveImg", () => $858fdcf73148519f$export$6e5611bc7e57e477);
63
- $parcel$export(module.exports, "makeSizeAccessor", () => $858fdcf73148519f$export$e6fffe67d4cdd848);
64
64
  $parcel$export(module.exports, "ImageContainer", () => $ce467edb5343cfcd$export$94026ee33dbabc26);
65
65
  $parcel$export(module.exports, "SentryErrorBoundary", () => $1b3cf201cdd38687$export$b69d0d92862de18b);
66
66
  $parcel$export(module.exports, "ExtraSentryContextProvider", () => $1b3cf201cdd38687$export$240ecf5363d76c0f);
@@ -112,45 +112,250 @@ $parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316
112
112
  $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7c3ce0ebe51f86);
113
113
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
114
114
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
115
+ $parcel$export(module.exports, "makeSizeAccessors", () => $054b1113e4897051$export$54c6d6ff54e72743);
115
116
  /*! Depict.ai search and product listing SDK */
116
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.33";
117
-
118
- // Value first so shopify merchants can set (extra) display transformers in the shopify app
119
- // Calling these functions normally doesn't do anything, but our shopify app respects them
120
- // Them being here is value first too because this can be easily imported in the product card editor
121
- let $cc9aacef898ccc9a$var$extraDisplayTransformers;
122
- const $cc9aacef898ccc9a$export$b2d94be4f02525b2 = () => $cc9aacef898ccc9a$var$extraDisplayTransformers;
123
- const $cc9aacef898ccc9a$export$f98b8d5ea7207a1 = displayTransformers => $cc9aacef898ccc9a$var$extraDisplayTransformers = displayTransformers;
124
- function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
125
- const signal = $3hooq$solidjs.createSignal(false);
126
- $3hooq$solidjs.onCleanup($3hooq$depictaiutilishared.javascript_media_query(media_query, _ref => {
127
- let {
128
- matches: matches
129
- } = _ref;
130
- return signal[1](matches);
131
- }).remove);
132
- return signal[0];
117
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.34";
118
+ const $d067f3a30f047b41$var$ListingContext = /*@__PURE__*/$3hooq$solidjs.createContext();
119
+ function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
120
+ const our_object = {};
121
+ return $3hooq$solidjsweb.createComponent($d067f3a30f047b41$var$ListingContext.Provider, {
122
+ value: our_object,
123
+ get children() {
124
+ return props.children;
125
+ }
126
+ });
133
127
  }
134
- function $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_) {
135
- const size_active = $3hooq$solidjs.createMemo(() => cols_at_size_().map(_ref => {
136
- let [n_cols, min_width, max_width] = _ref;
137
- const media_query = $3hooq$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
138
- const matches = $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query);
139
- return [matches, n_cols];
140
- }));
141
- const n_cols_currently_showing = $3hooq$solidjs.createMemo(() => {
142
- try {
143
- const [, n_cols_currently_showing] = size_active().find(_ref2 => {
144
- let [media_query] = _ref2;
145
- return media_query();
128
+ function $d067f3a30f047b41$export$8d0c4fdbb05a2f2e() {
129
+ return $3hooq$solidjs.useContext($d067f3a30f047b41$var$ListingContext);
130
+ }
131
+ var $ce467edb5343cfcd$var$_tmpl$ = ["<div", ' style="', '"', ">", "</div>"];
132
+ function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
133
+ return $3hooq$solidjsweb.ssr($ce467edb5343cfcd$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrStyle("padding-bottom:calc(calc(1 / ".concat(props.aspectRatio, ") * 100%)")), $3hooq$solidjsweb.ssrAttribute("class", "s-image-container" + (props.class ? " " + $3hooq$solidjsweb.escape(props.class, true) : ""), false), $3hooq$solidjsweb.escape(props.children));
134
+ }
135
+ const $b54645378dfc7280$var$ProductCardIndexContext = /*@__PURE__*/$3hooq$solidjs.createContext();
136
+ function $b54645378dfc7280$export$11354f017ddc9790(props) {
137
+ return $3hooq$solidjsweb.createComponent($b54645378dfc7280$var$ProductCardIndexContext.Provider, {
138
+ get value() {
139
+ return props.index_;
140
+ },
141
+ get children() {
142
+ return props.children;
143
+ }
144
+ });
145
+ }
146
+ function $b54645378dfc7280$export$e3faf4d95300054f() {
147
+ return $3hooq$solidjs.useContext($b54645378dfc7280$var$ProductCardIndexContext);
148
+ }
149
+ let $e4e98e5080f4386e$var$browserIsBugged = false;
150
+ function $e4e98e5080f4386e$export$2972b890694ced75(callback, _ref) {
151
+ let {
152
+ timeout: timeout
153
+ } = _ref;
154
+ if ($e4e98e5080f4386e$var$browserIsBugged) timeout /= 4;
155
+ const cancel = () => {
156
+ cancelIdleCallback(idleHandle);
157
+ clearTimeout(racingTimeout);
158
+ };
159
+ const idleHandle = requestIdleCallback(deadline => {
160
+ cancel();
161
+ return callback(deadline);
162
+ }, {
163
+ timeout: timeout
164
+ });
165
+ const racingTimeout = setTimeout(() => {
166
+ $3hooq$depictaiutilishared.dwarn("Browser did not respect requestIdleCallback timeout");
167
+ $e4e98e5080f4386e$var$browserIsBugged = true;
168
+ cancel();
169
+ callback({
170
+ didTimeout: false,
171
+ timeRemaining() {
172
+ return 500;
173
+ }
174
+ });
175
+ }, timeout + 1000);
176
+ return cancel;
177
+ }
178
+ const $858fdcf73148519f$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
179
+ const $858fdcf73148519f$export$f8945274f08a3105 = /*@__PURE__*/Symbol("listingContextAspectRatios");
180
+ const $858fdcf73148519f$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingContextAspectRatios");
181
+ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
182
+ const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
183
+ const [ourRatioKeyed, setOurRatioKeyed] = $3hooq$solidjs.createSignal();
184
+ const sizeToUse = $3hooq$solidjs.createMemo(() => {
185
+ var _props$sizeHeight;
186
+ // props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes (also we need to multiply, and it's good with some diffing here so people calling the comp don't have to)
187
+ const incomingSize = props.size();
188
+ const ratio = ourRatioKeyed();
189
+ const containerHeight = (_props$sizeHeight = props.sizeHeight) === null || _props$sizeHeight === void 0 ? void 0 : _props$sizeHeight.call(props);
190
+ if (!incomingSize || !ratio || !containerHeight || getComputedStyle(img).objectFit !== "cover") return incomingSize;
191
+ const maybeCorrectedSize = ratio * containerHeight;
192
+ return Math.round(Math.max(incomingSize, maybeCorrectedSize));
193
+ });
194
+ const src_options = $3hooq$solidjs.createMemo(() => {
195
+ const {
196
+ src: src,
197
+ customUrls: customUrls
198
+ } = props;
199
+ const fallback_src = (customUrls || $858fdcf73148519f$export$1d6267828870adda)(src, 400);
200
+ const srcset = $858fdcf73148519f$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096], customUrls);
201
+ // The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
202
+ return {
203
+ srcset: srcset,
204
+ src: fallback_src
205
+ };
206
+ });
207
+ // Work around https://github.com/solidjs/solid/issues/1828
208
+ const [, otherAttributes] = $3hooq$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading", "keyRatioUpdating", "sizeHeight", "customUrls" // Can't have properties ending on underscore because the property name mangling will get confused by this <-
209
+ ]);
210
+
211
+ const [hasSetSize, setHasSetSize] = $3hooq$solidjs.createSignal(false);
212
+ const [hasDecoded, setHasDecoded] = $3hooq$solidjs.createSignal(false);
213
+ const productCardIndexAccessor = $b54645378dfc7280$export$e3faf4d95300054f();
214
+ const listingContext = $d067f3a30f047b41$export$8d0c4fdbb05a2f2e();
215
+ const isPrioritisedImage = $3hooq$solidjs.createMemo(() => (productCardIndexAccessor === null || productCardIndexAccessor === void 0 ? void 0 : productCardIndexAccessor()) < 8);
216
+ const shouldActuallyEnableLazyLoading = $3hooq$solidjs.createMemo(() => {
217
+ const {
218
+ loading: loading
219
+ } = props;
220
+ if (loading === "force-lazy") return true;
221
+ return loading === "lazy" && !isPrioritisedImage();
222
+ });
223
+ const modifiedOtherAttributes = $3hooq$solidjs.mergeProps(otherAttributes, {
224
+ get loading() {
225
+ return shouldActuallyEnableLazyLoading() ? "lazy" : undefined;
226
+ }
227
+ });
228
+ // Batch idle callbacks so that MutationObserver can batch the resulting mutations better, so we don't lose tons of CPU time to MutationObservers doing lots of things for each image
229
+ // Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
230
+ const executeWhenIdleBatched = (fn, isSizesUpdate) => {
231
+ if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
232
+ if ((!isSizesUpdate || !sizeSetFastPath) && $3hooq$solidjs.untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately (improves lighthouse metrics)
233
+ // unless we're just a `sizes` update after the initial sizes setting (this optimisation makes the looks animation a lot smoother on low-cpu devices)
234
+ const existingStack = listingContext === null || listingContext === void 0 ? void 0 : listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol];
235
+ if (existingStack) return existingStack.add(fn);
236
+ const newStack = new Set([fn]);
237
+ if (listingContext) listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol] = newStack;
238
+ const processStackWhenIdle = () => $e4e98e5080f4386e$export$2972b890694ced75($3hooq$depictaiutilishared.catchify(deadline => {
239
+ const start = performance.now();
240
+ const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
241
+ for (const fn of newStack) {
242
+ newStack.delete(fn);
243
+ fn();
244
+ const timeTaken = performance.now() - start;
245
+ if ((!deadline.timeRemaining() || timeTaken > thirdDeadlineTime) && newStack.size) {
246
+ // There's still work to be done but no time, so schedule another idle callback
247
+ processStackWhenIdle();
248
+ return;
249
+ }
250
+ }
251
+ // Stack is empty
252
+ if (listingContext) delete listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol];
253
+ }), {
254
+ timeout: 15000
255
+ } // long timeout, better to not have images than to freeze the browser. But also we don't want to confuse user why no iamges are loading
256
+ );
257
+
258
+ processStackWhenIdle();
259
+ };
260
+ let sizeSetFastPath = false;
261
+ let hasDecodedFastPath = false;
262
+ let timeoutSet = false;
263
+ let gotCleanedUp = false;
264
+ let srcJustChanged = true;
265
+ img.classList.add("s-responsive-image");
266
+ if (listingContext) {
267
+ let prevValue;
268
+ const aspectRatios = listingContext[$858fdcf73148519f$export$f8945274f08a3105] || (listingContext[$858fdcf73148519f$export$f8945274f08a3105] = new Set());
269
+ const [, setMostPrevalentAspectRatio] = listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] || (listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] = $3hooq$solidjs.createSignal());
270
+ img.addEventListener("load", $3hooq$depictaiutilishared.catchify(() => {
271
+ const aspectRatio_ = img.naturalWidth / img.naturalHeight;
272
+ if (srcJustChanged)
273
+ // Always key object-fit-cover compensation to avoid loading-different-images-infinite-loop
274
+ setOurRatioKeyed(aspectRatio_);else if (props.keyRatioUpdating) return;
275
+ srcJustChanged = false;
276
+ // Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2 and LookItem
277
+ if (prevValue) aspectRatios.delete(prevValue);
278
+ const newValue = !isNaN(aspectRatio_) ? {
279
+ aspectRatio_: aspectRatio_
280
+ } : undefined;
281
+ if (newValue) aspectRatios.add(newValue);
282
+ prevValue = newValue;
283
+ // Do all calculations resulting of an update directly, for performance
284
+ const asArray = [...aspectRatios].map(_ref => {
285
+ let {
286
+ aspectRatio_: aspectRatio_
287
+ } = _ref;
288
+ return aspectRatio_;
146
289
  });
147
- return n_cols_currently_showing;
148
- } catch (e) {
149
- $3hooq$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks or looks");
150
- return null;
290
+ const mostPrevalentAspectRatio = $3hooq$depictaiutilishared.findMostFrequentItem(asArray);
291
+ setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
292
+ }));
293
+ $3hooq$solidjs.onCleanup(() => prevValue && aspectRatios.delete(prevValue));
294
+ }
295
+ $3hooq$solidjs.onCleanup(() => gotCleanedUp = true);
296
+ $3hooq$solidjsweb.spread(img, $3hooq$solidjs.mergeProps(modifiedOtherAttributes), false, true);
297
+ $3hooq$solidjs.createRenderEffect(() => {
298
+ props.src;
299
+ srcJustChanged = true;
300
+ });
301
+ $3hooq$solidjs.createEffect(() => {
302
+ if (!sizeToUse()) return; // wait until we have a size, run every time the size changes
303
+ if (timeoutSet) return;
304
+ const handler = $3hooq$depictaiutilishared.catchify(() => {
305
+ if (gotCleanedUp) return;
306
+ img.sizes = "".concat(sizeToUse(), "px"); // use latest available value of size in case it has changed
307
+ if (!sizeSetFastPath) {
308
+ setHasSetSize(true);
309
+ sizeSetFastPath = true;
310
+ }
311
+ timeoutSet = false;
312
+ });
313
+ // Throttle the updating of sizes to avoid unnecessary image re-fetches during resize
314
+ // And also because we first set src after sizes has been set, wait with loading and decoding images until browser is idle
315
+ // This greatly improves performance when loading (more) products
316
+ // See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
317
+ timeoutSet = true; // Important to set timeoutSet before the call to executeWhenIdleBatched since if this is an important image executeWhenIdleBatched will execute fn immediately
318
+ executeWhenIdleBatched(handler, true);
319
+ });
320
+ const dontLoadImageYet = $3hooq$solidjs.createMemo(() => !sizeToUse() || !hasSetSize()); // Moving this condition into a memo saves us from re-setting src and srcset (expensive) if just props.size changes
321
+ $3hooq$solidjs.createEffect(() => {
322
+ if (dontLoadImageYet()) return; // If size isn't known or set, don't assign src yet since it would cause the most low res image to load
323
+ Object.assign(img, src_options());
324
+ // Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
325
+ // We can do this because there has to be a container around us giving us a size
326
+ // No need to listen if we're already in the DOM
327
+ if (hasDecodedFastPath) return;
328
+ if (shouldActuallyEnableLazyLoading()) {
329
+ // For lazy loading there's no decoding to wait for as it only occurs when the image is visible
330
+ // Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
331
+ setHasDecoded(true);
332
+ hasDecodedFastPath = true;
333
+ return;
151
334
  }
335
+ img.decode().catch(e => $3hooq$depictaiutilishared.dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
336
+ .then(async () => {
337
+ // Also wait with inserting image (i.e. paint) until browser is idle
338
+ await new Promise(r => executeWhenIdleBatched(r, false));
339
+ if (gotCleanedUp) return;
340
+ setHasDecoded(true);
341
+ hasDecodedFastPath = true;
342
+ });
152
343
  });
153
- return n_cols_currently_showing;
344
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
345
+ get when() {
346
+ return hasDecoded();
347
+ },
348
+ children: img
349
+ });
350
+ }
351
+ function $858fdcf73148519f$var$make_srcset(url, resolutions, customGenerateImageUrl_) {
352
+ return resolutions.map(width => "".concat((customGenerateImageUrl_ || $858fdcf73148519f$export$1d6267828870adda)(url, width), " ").concat(width, "w")).join(", ");
353
+ }
354
+ function $858fdcf73148519f$export$1d6267828870adda(url, width) {
355
+ // Even just creating one `URL` object per image src and then setting the search parameter is quite slow (0.25ms to set the width param)
356
+ // We're making the assumptions that the url has already at least one query parameter and that the image resizing service will choose the last one out of a duplicate width parameter (shopify's does)
357
+ // That way we can just to string concatenation which is insanely fast
358
+ return url + "&width=" + encodeURIComponent(width);
154
359
  }
155
360
  var $e3d733f899558f40$var$_tmpl$ = ["<span", ' class="', '" style="', '"></span>'];
156
361
  function $e3d733f899558f40$export$acb3eaade4b23afd(props) {
@@ -188,11 +393,198 @@ function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
188
393
  }
189
394
  });
190
395
  }
191
- var $f8f375d6245ffff2$var$_tmpl$ = ["<div", ' class="', '" style="', '">', "</div>"];
192
- function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
193
- let {
194
- content_blocks_: incoming_content_blocks,
195
- cols_at_size_: cols_at_size_,
396
+ function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
397
+ const style = $3hooq$solidjs.createMemo(() => {
398
+ const {
399
+ style: style,
400
+ height: height,
401
+ width: width
402
+ } = props;
403
+ return {
404
+ ...(style || {}),
405
+ height: height !== null && height !== void 0 ? height : "1em",
406
+ ...(width && {
407
+ width: width
408
+ })
409
+ };
410
+ });
411
+ return $3hooq$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
412
+ get style() {
413
+ return style();
414
+ },
415
+ get ["class"]() {
416
+ return props.class;
417
+ }
418
+ });
419
+ }
420
+ var $c0cf6af094336798$var$_tmpl$ = ["<div", ' class="instant-card"><div class="img-part">', '</div><div class="right-part"><div class="title-brand-tagline"><span class="title">', '</span></div><div class="price-container">', "</div></div></div>"];
421
+ const $c0cf6af094336798$export$8a2234b5b1a5ebd4 = "--image-aspect-ratio";
422
+ function $c0cf6af094336798$export$ee1733d9a8495996() {
423
+ return $3hooq$solidjsweb.ssr($c0cf6af094336798$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
424
+ aspectRatio: "var(".concat($c0cf6af094336798$export$8a2234b5b1a5ebd4, ", 1)")
425
+ })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
426
+ width: "20ch",
427
+ height: "1em"
428
+ })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
429
+ width: "5ch",
430
+ height: "1em",
431
+ "class": "price"
432
+ })));
433
+ }
434
+ function $054b1113e4897051$export$54c6d6ff54e72743(whatToWatch) {
435
+ const [width, setWidth] = $3hooq$solidjs.createSignal(0);
436
+ const [height, setHeight] = $3hooq$solidjs.createSignal(0);
437
+ const resizeObserver = new ResizeObserver($3hooq$depictaiutilishared.catchify(records => $3hooq$solidjs.batch(() => {
438
+ for (let j = 0; j < records.length; j++) {
439
+ const {
440
+ width: width,
441
+ height: height
442
+ } = records[j].contentRect;
443
+ // Padding hack makes that we can't use contentRect to get the height since that's apparently without padding
444
+ const definitiveHeight = height || whatToWatch.getBoundingClientRect().height;
445
+ if (definitiveHeight) setHeight(Math.ceil(definitiveHeight));
446
+ if (width) setWidth(Math.ceil(width));
447
+ }
448
+ })));
449
+ // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
450
+ // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
451
+ const disconnect = (0, $3hooq$depictaiutilishared.observer).onexists(whatToWatch, _ref => {
452
+ let {
453
+ element: element
454
+ } = _ref;
455
+ return requestAnimationFrame($3hooq$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
456
+ });
457
+ $3hooq$solidjs.onCleanup(() => {
458
+ resizeObserver.disconnect();
459
+ disconnect();
460
+ });
461
+ return [width, height];
462
+ }
463
+ const $28535bb7671c63d1$var$backupSizeSignal = /*@__PURE__*/$3hooq$solidjs.createSignal();
464
+ const $28535bb7671c63d1$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
465
+ function $28535bb7671c63d1$export$e4b984597b71e989(props) {
466
+ const context = $d067f3a30f047b41$export$8d0c4fdbb05a2f2e();
467
+ if (context && !context[$28535bb7671c63d1$export$d7b7ab832c20e2f4])
468
+ // create a signal that's the same for all items in this listing
469
+ context[$28535bb7671c63d1$export$d7b7ab832c20e2f4] = $3hooq$solidjs.createSignal();
470
+ const [currentImageSize, setCurrentImageSize] = (context === null || context === void 0 ? void 0 : context[$28535bb7671c63d1$export$d7b7ab832c20e2f4]) || $28535bb7671c63d1$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
471
+ const [mostPrevalentAspectRatio] = context ? context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] || (context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] = $3hooq$solidjs.createSignal()) : [];
472
+ const container = $ce467edb5343cfcd$export$94026ee33dbabc26({
473
+ // Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
474
+ get class() {
475
+ return props.class;
476
+ },
477
+ get aspectRatio() {
478
+ if (props.autoAdjustAspectRatio) {
479
+ const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
480
+ if (targetRatio != undefined) return "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
481
+ }
482
+ return props.aspectRatio;
483
+ }
484
+ });
485
+ const owner = $3hooq$solidjs.getOwner();
486
+ let createdSizeAccessor = false;
487
+ let wasCleanedUp = false;
488
+ $3hooq$solidjs.createEffect(() => {
489
+ if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
490
+ // ensure we always have a size accessor
491
+ // what this whole thing does is set the sizes attribute to the actual size of one of the existing image containers, therefore the value doesn't have to manually be specified
492
+ createdSizeAccessor = true;
493
+ setCurrentImageSize(() => $3hooq$solidjs.runWithOwner(owner, () => $054b1113e4897051$export$54c6d6ff54e72743(container)));
494
+ });
495
+ $3hooq$solidjs.onCleanup(() => {
496
+ wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
497
+ if (!createdSizeAccessor) return;
498
+ $3hooq$depictaiutilishared.queueMacroTask(() => setCurrentImageSize()); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
499
+ });
500
+
501
+ $3hooq$solidjsweb.insert(container, $3hooq$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), $3hooq$solidjsweb.mergeProps({
502
+ size: () => {
503
+ var _currentImageSize, _currentImageSize$;
504
+ return ((_currentImageSize = currentImageSize()) === null || _currentImageSize === void 0 ? void 0 : (_currentImageSize$ = _currentImageSize[0]) === null || _currentImageSize$ === void 0 ? void 0 : _currentImageSize$.call(_currentImageSize)) || 0;
505
+ },
506
+ sizeHeight: () => {
507
+ var _currentImageSize2, _currentImageSize2$;
508
+ return ((_currentImageSize2 = currentImageSize()) === null || _currentImageSize2 === void 0 ? void 0 : (_currentImageSize2$ = _currentImageSize2[1]) === null || _currentImageSize2$ === void 0 ? void 0 : _currentImageSize2$.call(_currentImageSize2)) || 0;
509
+ },
510
+ get src() {
511
+ return props.src;
512
+ }
513
+ }, () => props.imgProps, {
514
+ get style() {
515
+ var _props$imgProps;
516
+ return (_props$imgProps = props.imgProps) === null || _props$imgProps === void 0 ? void 0 : _props$imgProps.style;
517
+ }
518
+ })));
519
+ return container;
520
+ }
521
+ const $f3db423dc84bc35d$var$customUrls = (url, width) => {
522
+ var _url$startsWith;
523
+ if (url !== null && url !== void 0 && (_url$startsWith = url.startsWith) !== null && _url$startsWith !== void 0 && _url$startsWith.call(url, "https://cdn.shopify.com"))
524
+ // The shopify image resizing CDN blocks Cloudflare's image resizer. It's possible that we can't detect shopify image URLs sometimes because they go to the merchant's domain,
525
+ // but it seems like the URLs returned by the Depict API always goes to the cdn.shopify.com version of an image, so this simple workaround works.
526
+ return $858fdcf73148519f$export$1d6267828870adda(url, width);
527
+ // Use cloudflare image resizer instead of img.depict.ai because it's a lot faster (and also auto-chooses other formats if webp is not supported)
528
+ return "https://app.depict.ai/cdn-cgi/image/width=".concat(width, ",format=auto/").concat(url);
529
+ };
530
+ function $f3db423dc84bc35d$export$9d4a4b669b1929ab(props) {
531
+ return $3hooq$solidjsweb.createComponent((0, $28535bb7671c63d1$export$e4b984597b71e989), $3hooq$solidjsweb.mergeProps(props, {
532
+ get imgProps() {
533
+ return {
534
+ ...props.imgProps,
535
+ customUrls: $f3db423dc84bc35d$var$customUrls
536
+ };
537
+ }
538
+ }));
539
+ }
540
+ function $f3db423dc84bc35d$export$140423fa4bfb6d63(props) {
541
+ return $3hooq$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), $3hooq$solidjsweb.mergeProps(props, {
542
+ customUrls: $f3db423dc84bc35d$var$customUrls
543
+ }));
544
+ }
545
+
546
+ // Value first so shopify merchants can set (extra) display transformers in the shopify app
547
+ // Calling these functions normally doesn't do anything, but our shopify app respects them
548
+ // Them being here is value first too because this can be easily imported in the product card editor
549
+ let $cc9aacef898ccc9a$var$extraDisplayTransformers;
550
+ const $cc9aacef898ccc9a$export$b2d94be4f02525b2 = () => $cc9aacef898ccc9a$var$extraDisplayTransformers;
551
+ const $cc9aacef898ccc9a$export$f98b8d5ea7207a1 = displayTransformers => $cc9aacef898ccc9a$var$extraDisplayTransformers = displayTransformers;
552
+ function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
553
+ const signal = $3hooq$solidjs.createSignal(false);
554
+ $3hooq$solidjs.onCleanup($3hooq$depictaiutilishared.javascript_media_query(media_query, _ref => {
555
+ let {
556
+ matches: matches
557
+ } = _ref;
558
+ return signal[1](matches);
559
+ }).remove);
560
+ return signal[0];
561
+ }
562
+ function $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_) {
563
+ const size_active = $3hooq$solidjs.createMemo(() => cols_at_size_().map(_ref => {
564
+ let [n_cols, min_width, max_width] = _ref;
565
+ const media_query = $3hooq$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
566
+ const matches = $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query);
567
+ return [matches, n_cols];
568
+ }));
569
+ const n_cols_currently_showing = $3hooq$solidjs.createMemo(() => {
570
+ try {
571
+ const [, n_cols_currently_showing] = size_active().find(_ref2 => {
572
+ let [media_query] = _ref2;
573
+ return media_query();
574
+ });
575
+ return n_cols_currently_showing;
576
+ } catch (e) {
577
+ $3hooq$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks or looks");
578
+ return null;
579
+ }
580
+ });
581
+ return n_cols_currently_showing;
582
+ }
583
+ var $f8f375d6245ffff2$var$_tmpl$ = ["<div", ' class="', '" style="', '">', "</div>"];
584
+ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
585
+ let {
586
+ content_blocks_: incoming_content_blocks,
587
+ cols_at_size_: cols_at_size_,
196
588
  set_top_row_shortened_by_: set_top_row_shortened_by_
197
589
  } = _ref;
198
590
  // these are by row
@@ -528,20 +920,6 @@ function $e82d0d417fa613e8$var$unwrapping_helper(elements) {
528
920
  } else if (typeof elements == "function") result.push(...$e82d0d417fa613e8$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
529
921
  return result;
530
922
  }
531
- const $b54645378dfc7280$var$ProductCardIndexContext = /*@__PURE__*/$3hooq$solidjs.createContext();
532
- function $b54645378dfc7280$export$11354f017ddc9790(props) {
533
- return $3hooq$solidjsweb.createComponent($b54645378dfc7280$var$ProductCardIndexContext.Provider, {
534
- get value() {
535
- return props.index_;
536
- },
537
- get children() {
538
- return props.children;
539
- }
540
- });
541
- }
542
- function $b54645378dfc7280$export$e3faf4d95300054f() {
543
- return $3hooq$solidjs.useContext($b54645378dfc7280$var$ProductCardIndexContext);
544
- }
545
923
 
546
924
  /**
547
925
  * This is a function that will safely clone an object that may contain promises.
@@ -1151,506 +1529,145 @@ function $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, container_element) {
1151
1529
  start_rows: start_rows
1152
1530
  } = rows_or_empty_object();
1153
1531
  const rows_visible = get_rows_visible();
1154
- const children_count = get_children_count();
1155
- return force_style_update() + col_styling() + props.cols_at_size.map(options => {
1156
- const [recs_per_row, min, max] = options;
1157
- let should_hide_view_more_button;
1158
- let visible_recs;
1159
- if (props.disable_partial_rows) {
1160
- visible_recs = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
1161
- const visible_recs_next_show_more = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
1162
- // Should this really be zero when we default rows_per_click to 1?
1163
- children_count, options);
1164
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
1165
- } else {
1166
- visible_recs = $3hooq$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
1167
- should_hide_view_more_button = visible_recs >= children_count;
1168
- }
1169
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
1170
- // 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
1171
- 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;
1172
- 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}") : "", "}");
1173
- }).join("");
1174
- }));
1175
- });
1176
- const style_element = $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), get_styling); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
1177
- if (insert_after_container) container_element.after(style_element);
1178
- return [container_element, view_more_button_container(), view_less_button_container(), style_element];
1179
- }
1180
- var $236a257ee52e5414$var$_tmpl$ = ["<h2", ' class="recs-title">', "</h2>"];
1181
- function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
1182
- let {
1183
- recommendations_resource_: recommendations_resource_,
1184
- product_card_template_: product_card_template_,
1185
- layout_options_: layout_options_,
1186
- title_: title_,
1187
- NoResultsFallback_: NoResultsFallback_,
1188
- placeholderCacheKey_: placeholderCacheKey_
1189
- } = _ref;
1190
- const is_showing_something = $3hooq$solidjs.createMemo(() => {
1191
- var _recommendations_reso;
1192
- return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
1193
- });
1194
- const title = $3hooq$solidjs.createMemo(() => title_ === null || title_ === void 0 ? void 0 : title_()); // In case getter/accessor creates elements, don't create them twice
1195
- const num_placeholders_ = () => 20;
1196
- const slider = [$3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1197
- get when() {
1198
- return title();
1199
- },
1200
- get children() {
1201
- return $3hooq$solidjsweb.ssr($236a257ee52e5414$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(title()));
1202
- }
1203
- }), $3hooq$solidjsweb.createComponent((0, $ad8ec7729fffeb9c$export$6649caad96ef8870), {
1204
- arrow_height_: 25,
1205
- arrow_width_: 12.5,
1206
- disable_fading_: true,
1207
- slider_ref_: slider => {
1208
- const {
1209
- insert_here: insert_here,
1210
- container: container
1211
- } = slider;
1212
- const Layout = props => $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, insert_here, true);
1213
- // Do like this, so we don't have to call mergeProps ourselves
1214
- $3hooq$solidjsweb.createComponent(Layout, $3hooq$solidjsweb.mergeProps({
1215
- rows: "all",
1216
- layout: "slider"
1217
- }, layout_options_));
1218
- $3hooq$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
1219
- insert_here.before($8edd3cf30d1fd8b4$export$a2cc176055f8f08());
1220
- container.classList.add("products");
1221
- },
1222
- get children() {
1223
- return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
1224
- get fallback() {
1225
- return $e3915574cfd3466c$export$f33414a4df0afd3f({
1226
- num_placeholders_: num_placeholders_,
1227
- product_card_template_: product_card_template_,
1228
- placeholderCacheKey_: placeholderCacheKey_
1229
- });
1230
- },
1231
- get children() {
1232
- return (() => {
1233
- // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
1234
- const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
1235
- const {
1236
- renderedDisplays_: renderedDisplays_
1237
- } = $a52942afacbced93$export$4a14175d33d81a96({
1238
- displays_by_key_: displays_by_key_,
1239
- product_card_template_: product_card_template_
1240
- });
1241
- return renderedDisplays_;
1242
- })();
1243
- }
1244
- });
1245
- }
1246
- })];
1247
- return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1248
- get when() {
1249
- return is_showing_something();
1250
- },
1251
- get fallback() {
1252
- return NoResultsFallback_ === null || NoResultsFallback_ === void 0 ? void 0 : NoResultsFallback_();
1253
- },
1254
- children: slider
1255
- });
1256
- }
1257
- function $d05611ff6b8c8357$export$23fca46f3143581f(component, error_message) {
1258
- const component_in_error_boundary = do_with_elements => {
1259
- const error_boundary_wrapped = $1b3cf201cdd38687$export$b69d0d92862de18b({
1260
- severity_: "error",
1261
- message_: error_message,
1262
- get children() {
1263
- const elements = component();
1264
- do_with_elements === null || do_with_elements === void 0 || do_with_elements(elements);
1265
- return elements;
1266
- }
1267
- });
1268
- // This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
1269
- if (typeof error_boundary_wrapped === "function")
1270
- // @ts-ignore
1271
- return error_boundary_wrapped();
1272
- // On the server it returns a string, so we just return that
1273
- return error_boundary_wrapped;
1274
- };
1275
- const owner = $3hooq$solidjs.getOwner();
1276
- if (owner == null) return $3hooq$solidjs.createRoot(dispose => {
1277
- // if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
1278
- return component_in_error_boundary(elements => {
1279
- const have_multiple = Array.isArray(elements);
1280
- if (have_multiple ? !(elements !== null && elements !== void 0 && elements.length) : !elements) return;
1281
- (0, $3hooq$depictaiutilishared.observer).onremoved(have_multiple ? elements[0] : elements, _ref => {
1282
- let {
1283
- element: element
1284
- } = _ref;
1285
- if (document.documentElement.contains(element)) return; // If element has instantly been re-inserted, don't dispose
1286
- // See https://depictaiworkspace.slack.com/archives/C050GHEPBTR/p1695809102791259?thread_ts=1695106805.459729&cid=C050GHEPBTR
1287
- dispose();
1288
- });
1289
- });
1290
- });else
1291
- // we're already in a root so cleanups are handled
1292
- return component_in_error_boundary();
1293
- }
1294
- const $d067f3a30f047b41$var$ListingContext = /*@__PURE__*/$3hooq$solidjs.createContext();
1295
- function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
1296
- const our_object = {};
1297
- return $3hooq$solidjsweb.createComponent($d067f3a30f047b41$var$ListingContext.Provider, {
1298
- value: our_object,
1299
- get children() {
1300
- return props.children;
1301
- }
1302
- });
1303
- }
1304
- function $d067f3a30f047b41$export$8d0c4fdbb05a2f2e() {
1305
- return $3hooq$solidjs.useContext($d067f3a30f047b41$var$ListingContext);
1306
- }
1307
- function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
1308
- const style = $3hooq$solidjs.createMemo(() => {
1309
- const {
1310
- style: style,
1311
- height: height,
1312
- width: width
1313
- } = props;
1314
- return {
1315
- ...(style || {}),
1316
- height: height !== null && height !== void 0 ? height : "1em",
1317
- ...(width && {
1318
- width: width
1319
- })
1320
- };
1321
- });
1322
- return $3hooq$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
1323
- get style() {
1324
- return style();
1325
- },
1326
- get ["class"]() {
1327
- return props.class;
1328
- }
1329
- });
1330
- }
1331
- var $c0cf6af094336798$var$_tmpl$ = ["<div", ' class="instant-card"><div class="img-part">', '</div><div class="right-part"><div class="title-brand-tagline"><span class="title">', '</span></div><div class="price-container">', "</div></div></div>"];
1332
- const $c0cf6af094336798$export$8a2234b5b1a5ebd4 = "--image-aspect-ratio";
1333
- function $c0cf6af094336798$export$ee1733d9a8495996() {
1334
- return $3hooq$solidjsweb.ssr($c0cf6af094336798$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
1335
- aspectRatio: "var(".concat($c0cf6af094336798$export$8a2234b5b1a5ebd4, ", 1)")
1336
- })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
1337
- width: "20ch",
1338
- height: "1em"
1339
- })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
1340
- width: "5ch",
1341
- height: "1em",
1342
- "class": "price"
1343
- })));
1344
- }
1345
- var $ce467edb5343cfcd$var$_tmpl$ = ["<div", ' style="', '"', ">", "</div>"];
1346
- function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
1347
- return $3hooq$solidjsweb.ssr($ce467edb5343cfcd$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrStyle("padding-bottom:calc(calc(1 / ".concat(props.aspectRatio, ") * 100%)")), $3hooq$solidjsweb.ssrAttribute("class", "s-image-container" + (props.class ? " " + $3hooq$solidjsweb.escape(props.class, true) : ""), false), $3hooq$solidjsweb.escape(props.children));
1348
- }
1349
- let $e4e98e5080f4386e$var$browserIsBugged = false;
1350
- function $e4e98e5080f4386e$export$2972b890694ced75(callback, _ref) {
1351
- let {
1352
- timeout: timeout
1353
- } = _ref;
1354
- if ($e4e98e5080f4386e$var$browserIsBugged) timeout /= 4;
1355
- const cancel = () => {
1356
- cancelIdleCallback(idleHandle);
1357
- clearTimeout(racingTimeout);
1358
- };
1359
- const idleHandle = requestIdleCallback(deadline => {
1360
- cancel();
1361
- return callback(deadline);
1362
- }, {
1363
- timeout: timeout
1364
- });
1365
- const racingTimeout = setTimeout(() => {
1366
- $3hooq$depictaiutilishared.dwarn("Browser did not respect requestIdleCallback timeout");
1367
- $e4e98e5080f4386e$var$browserIsBugged = true;
1368
- cancel();
1369
- callback({
1370
- didTimeout: false,
1371
- timeRemaining() {
1372
- return 500;
1373
- }
1374
- });
1375
- }, timeout + 1000);
1376
- return cancel;
1377
- }
1378
- function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
1379
- const [size, setSize] = $3hooq$solidjs.createSignal(0);
1380
- const resizeObserver = new ResizeObserver($3hooq$depictaiutilishared.catchify(records => {
1381
- for (let j = 0; j < records.length; j++) {
1382
- const {
1383
- width: width
1384
- } = records[j].contentRect;
1385
- if (!width) continue;
1386
- setSize(Math.ceil(width));
1387
- }
1388
- }));
1389
- // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
1390
- // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
1391
- const disconnect = (0, $3hooq$depictaiutilishared.observer).onexists(whatToWatch, _ref => {
1392
- let {
1393
- element: element
1394
- } = _ref;
1395
- return requestAnimationFrame($3hooq$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
1396
- });
1397
- $3hooq$solidjs.onCleanup(() => {
1398
- resizeObserver.disconnect();
1399
- disconnect();
1400
- });
1401
- return size;
1402
- }
1403
- const $858fdcf73148519f$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
1404
- const $858fdcf73148519f$export$f8945274f08a3105 = /*@__PURE__*/Symbol("listingContextAspectRatios");
1405
- const $858fdcf73148519f$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingContextAspectRatios");
1406
- function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
1407
- const src_options = $3hooq$solidjs.createMemo(() => {
1408
- const {
1409
- src: src,
1410
- customUrls: customUrls
1411
- } = props;
1412
- const fallback_src = (customUrls || $858fdcf73148519f$export$1d6267828870adda)(src, 400);
1413
- const srcset = $858fdcf73148519f$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096], customUrls);
1414
- // The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
1415
- return {
1416
- srcset: srcset,
1417
- src: fallback_src
1418
- };
1419
- });
1420
- // Work around https://github.com/solidjs/solid/issues/1828
1421
- const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
1422
- const [, otherAttributes] = $3hooq$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading", "keyRatioUpdating", "customUrls" // Can't have properties ending on underscore because the property name mangling will get confused by this <-
1423
- ]);
1424
-
1425
- const [hasSetSize, setHasSetSize] = $3hooq$solidjs.createSignal(false);
1426
- const [hasDecoded, setHasDecoded] = $3hooq$solidjs.createSignal(false);
1427
- const productCardIndexAccessor = $b54645378dfc7280$export$e3faf4d95300054f();
1428
- const sizePX = $3hooq$solidjs.createMemo(() => "".concat(props.size(), "px")); // props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes
1429
- const listingContext = $d067f3a30f047b41$export$8d0c4fdbb05a2f2e();
1430
- const isPrioritisedImage = $3hooq$solidjs.createMemo(() => (productCardIndexAccessor === null || productCardIndexAccessor === void 0 ? void 0 : productCardIndexAccessor()) < 8);
1431
- const shouldActuallyEnableLazyLoading = $3hooq$solidjs.createMemo(() => {
1432
- const {
1433
- loading: loading
1434
- } = props;
1435
- if (loading === "force-lazy") return true;
1436
- return loading === "lazy" && !isPrioritisedImage();
1437
- });
1438
- const modifiedOtherAttributes = $3hooq$solidjs.mergeProps(otherAttributes, {
1439
- get loading() {
1440
- return shouldActuallyEnableLazyLoading() ? "lazy" : undefined;
1441
- }
1442
- });
1443
- // Batch idle callbacks so that MutationObserver can batch the resulting mutations better, so we don't lose tons of CPU time to MutationObservers doing lots of things for each image
1444
- // Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
1445
- const executeWhenIdleBatched = (fn, isSizesUpdate) => {
1446
- if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
1447
- if ((!isSizesUpdate || !sizeSetFastPath) && $3hooq$solidjs.untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately (improves lighthouse metrics)
1448
- // unless we're just a `sizes` update after the initial sizes setting (this optimisation makes the looks animation a lot smoother on low-cpu devices)
1449
- const existingStack = listingContext === null || listingContext === void 0 ? void 0 : listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol];
1450
- if (existingStack) return existingStack.add(fn);
1451
- const newStack = new Set([fn]);
1452
- if (listingContext) listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol] = newStack;
1453
- const processStackWhenIdle = () => $e4e98e5080f4386e$export$2972b890694ced75($3hooq$depictaiutilishared.catchify(deadline => {
1454
- const start = performance.now();
1455
- const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
1456
- for (const fn of newStack) {
1457
- newStack.delete(fn);
1458
- fn();
1459
- const timeTaken = performance.now() - start;
1460
- if ((!deadline.timeRemaining() || timeTaken > thirdDeadlineTime) && newStack.size) {
1461
- // There's still work to be done but no time, so schedule another idle callback
1462
- processStackWhenIdle();
1463
- return;
1464
- }
1465
- }
1466
- // Stack is empty
1467
- if (listingContext) delete listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol];
1468
- }), {
1469
- timeout: 15000
1470
- } // long timeout, better to not have images than to freeze the browser. But also we don't want to confuse user why no iamges are loading
1471
- );
1472
-
1473
- processStackWhenIdle();
1474
- };
1475
- let sizeSetFastPath = false;
1476
- let hasDecodedFastPath = false;
1477
- let timeoutSet = false;
1478
- let gotCleanedUp = false;
1479
- let srcJustChanged = true;
1480
- img.classList.add("s-responsive-image");
1481
- if (listingContext) {
1482
- let prevValue;
1483
- const aspectRatios = listingContext[$858fdcf73148519f$export$f8945274f08a3105] || (listingContext[$858fdcf73148519f$export$f8945274f08a3105] = new Set());
1484
- const [, setMostPrevalentAspectRatio] = listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] || (listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] = $3hooq$solidjs.createSignal());
1485
- img.addEventListener("load", $3hooq$depictaiutilishared.catchify(() => {
1486
- if (props.keyRatioUpdating) {
1487
- if (!srcJustChanged) return;
1488
- srcJustChanged = false;
1489
- }
1490
- // Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2 and LookItem
1491
- const aspectRatio_ = img.naturalWidth / img.naturalHeight;
1492
- if (prevValue) aspectRatios.delete(prevValue);
1493
- const newValue = !isNaN(aspectRatio_) ? {
1494
- aspectRatio_: aspectRatio_
1495
- } : undefined;
1496
- if (newValue) aspectRatios.add(newValue);
1497
- prevValue = newValue;
1498
- // Do all calculations resulting of an update directly, for performance
1499
- const asArray = [...aspectRatios].map(_ref2 => {
1500
- let {
1501
- aspectRatio_: aspectRatio_
1502
- } = _ref2;
1503
- return aspectRatio_;
1504
- });
1505
- const mostPrevalentAspectRatio = $3hooq$depictaiutilishared.findMostFrequentItem(asArray);
1506
- setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
1532
+ const children_count = get_children_count();
1533
+ return force_style_update() + col_styling() + props.cols_at_size.map(options => {
1534
+ const [recs_per_row, min, max] = options;
1535
+ let should_hide_view_more_button;
1536
+ let visible_recs;
1537
+ if (props.disable_partial_rows) {
1538
+ visible_recs = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
1539
+ const visible_recs_next_show_more = $3hooq$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
1540
+ // Should this really be zero when we default rows_per_click to 1?
1541
+ children_count, options);
1542
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
1543
+ } else {
1544
+ visible_recs = $3hooq$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
1545
+ should_hide_view_more_button = visible_recs >= children_count;
1546
+ }
1547
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
1548
+ // 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
1549
+ 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;
1550
+ 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}") : "", "}");
1551
+ }).join("");
1507
1552
  }));
1508
- $3hooq$solidjs.onCleanup(() => prevValue && aspectRatios.delete(prevValue));
1509
- }
1510
- $3hooq$solidjs.onCleanup(() => gotCleanedUp = true);
1511
- $3hooq$solidjsweb.spread(img, $3hooq$solidjs.mergeProps(modifiedOtherAttributes), false, true);
1512
- $3hooq$solidjs.createRenderEffect(() => {
1513
- props.src;
1514
- srcJustChanged = true;
1515
1553
  });
1516
- $3hooq$solidjs.createEffect(() => {
1517
- if (!props.size()) return; // wait until we have a size, run every time the size changes
1518
- if (timeoutSet) return;
1519
- const handler = $3hooq$depictaiutilishared.catchify(() => {
1520
- if (gotCleanedUp) return;
1521
- img.sizes = sizePX(); // use latest available value of props.size
1522
- if (!sizeSetFastPath) {
1523
- setHasSetSize(true);
1524
- sizeSetFastPath = true;
1525
- }
1526
- timeoutSet = false;
1527
- });
1528
- // Throttle the updating of sizes to avoid unnecessary image re-fetches during resize
1529
- // And also because we first set src after sizes has been set, wait with loading and decoding images until browser is idle
1530
- // This greatly improves performance when loading (more) products
1531
- // See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
1532
- timeoutSet = true; // Important to set timeoutSet before the call to executeWhenIdleBatched since if this is an important image executeWhenIdleBatched will execute fn immediately
1533
- executeWhenIdleBatched(handler, true);
1554
+ const style_element = $3hooq$solidjsweb.ssr($6c2c739b113a8ddf$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), get_styling); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
1555
+ if (insert_after_container) container_element.after(style_element);
1556
+ return [container_element, view_more_button_container(), view_less_button_container(), style_element];
1557
+ }
1558
+ var $236a257ee52e5414$var$_tmpl$ = ["<h2", ' class="recs-title">', "</h2>"];
1559
+ function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
1560
+ let {
1561
+ recommendations_resource_: recommendations_resource_,
1562
+ product_card_template_: product_card_template_,
1563
+ layout_options_: layout_options_,
1564
+ title_: title_,
1565
+ NoResultsFallback_: NoResultsFallback_,
1566
+ placeholderCacheKey_: placeholderCacheKey_
1567
+ } = _ref;
1568
+ const is_showing_something = $3hooq$solidjs.createMemo(() => {
1569
+ var _recommendations_reso;
1570
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
1534
1571
  });
1535
- const dontLoadImageYet = $3hooq$solidjs.createMemo(() => !props.size() || !hasSetSize()); // Moving this condition into a memo saves us from re-setting src and srcset (expensive) if just props.size changes
1536
- $3hooq$solidjs.createEffect(() => {
1537
- if (dontLoadImageYet()) return; // If size isn't known or set, don't assign src yet since it would cause the most low res image to load
1538
- Object.assign(img, src_options());
1539
- // Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
1540
- // We can do this because there has to be a container around us giving us a size
1541
- // No need to listen if we're already in the DOM
1542
- if (hasDecodedFastPath) return;
1543
- if (shouldActuallyEnableLazyLoading()) {
1544
- // For lazy loading there's no decoding to wait for as it only occurs when the image is visible
1545
- // Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
1546
- setHasDecoded(true);
1547
- hasDecodedFastPath = true;
1548
- return;
1572
+ const title = $3hooq$solidjs.createMemo(() => title_ === null || title_ === void 0 ? void 0 : title_()); // In case getter/accessor creates elements, don't create them twice
1573
+ const num_placeholders_ = () => 20;
1574
+ const slider = [$3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1575
+ get when() {
1576
+ return title();
1577
+ },
1578
+ get children() {
1579
+ return $3hooq$solidjsweb.ssr($236a257ee52e5414$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(title()));
1549
1580
  }
1550
- img.decode().catch(e => $3hooq$depictaiutilishared.dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
1551
- .then(async () => {
1552
- // Also wait with inserting image (i.e. paint) until browser is idle
1553
- await new Promise(r => executeWhenIdleBatched(r, false));
1554
- if (gotCleanedUp) return;
1555
- setHasDecoded(true);
1556
- hasDecodedFastPath = true;
1557
- });
1558
- });
1581
+ }), $3hooq$solidjsweb.createComponent((0, $ad8ec7729fffeb9c$export$6649caad96ef8870), {
1582
+ arrow_height_: 25,
1583
+ arrow_width_: 12.5,
1584
+ disable_fading_: true,
1585
+ slider_ref_: slider => {
1586
+ const {
1587
+ insert_here: insert_here,
1588
+ container: container
1589
+ } = slider;
1590
+ const Layout = props => $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, insert_here, true);
1591
+ // Do like this, so we don't have to call mergeProps ourselves
1592
+ $3hooq$solidjsweb.createComponent(Layout, $3hooq$solidjsweb.mergeProps({
1593
+ rows: "all",
1594
+ layout: "slider"
1595
+ }, layout_options_));
1596
+ $3hooq$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
1597
+ insert_here.before($8edd3cf30d1fd8b4$export$a2cc176055f8f08());
1598
+ container.classList.add("products");
1599
+ },
1600
+ get children() {
1601
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
1602
+ get fallback() {
1603
+ return $e3915574cfd3466c$export$f33414a4df0afd3f({
1604
+ num_placeholders_: num_placeholders_,
1605
+ product_card_template_: product_card_template_,
1606
+ placeholderCacheKey_: placeholderCacheKey_
1607
+ });
1608
+ },
1609
+ get children() {
1610
+ return (() => {
1611
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
1612
+ const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
1613
+ const {
1614
+ renderedDisplays_: renderedDisplays_
1615
+ } = $a52942afacbced93$export$4a14175d33d81a96({
1616
+ displays_by_key_: displays_by_key_,
1617
+ product_card_template_: product_card_template_
1618
+ });
1619
+ return renderedDisplays_;
1620
+ })();
1621
+ }
1622
+ });
1623
+ }
1624
+ })];
1559
1625
  return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1560
1626
  get when() {
1561
- return hasDecoded();
1627
+ return is_showing_something();
1562
1628
  },
1563
- children: img
1629
+ get fallback() {
1630
+ return NoResultsFallback_ === null || NoResultsFallback_ === void 0 ? void 0 : NoResultsFallback_();
1631
+ },
1632
+ children: slider
1564
1633
  });
1565
1634
  }
1566
- function $858fdcf73148519f$var$make_srcset(url, resolutions, customGenerateImageUrl_) {
1567
- return resolutions.map(width => "".concat((customGenerateImageUrl_ || $858fdcf73148519f$export$1d6267828870adda)(url, width), " ").concat(width, "w")).join(", ");
1568
- }
1569
- function $858fdcf73148519f$export$1d6267828870adda(url, width) {
1570
- // Even just creating one `URL` object per image src and then setting the search parameter is quite slow (0.25ms to set the width param)
1571
- // We're making the assumptions that the url has already at least one query parameter and that the image resizing service will choose the last one out of a duplicate width parameter (shopify's does)
1572
- // That way we can just to string concatenation which is insanely fast
1573
- return url + "&width=" + encodeURIComponent(width);
1574
- }
1575
- const $28535bb7671c63d1$var$backupSizeSignal = /*@__PURE__*/$3hooq$solidjs.createSignal();
1576
- const $28535bb7671c63d1$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
1577
- function $28535bb7671c63d1$export$e4b984597b71e989(props) {
1578
- const context = $d067f3a30f047b41$export$8d0c4fdbb05a2f2e();
1579
- if (context && !context[$28535bb7671c63d1$export$d7b7ab832c20e2f4])
1580
- // create a signal that's the same for all items in this listing
1581
- context[$28535bb7671c63d1$export$d7b7ab832c20e2f4] = $3hooq$solidjs.createSignal();
1582
- const [currentImageSize, setCurrentImageSize] = (context === null || context === void 0 ? void 0 : context[$28535bb7671c63d1$export$d7b7ab832c20e2f4]) || $28535bb7671c63d1$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
1583
- const [mostPrevalentAspectRatio] = context ? context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] || (context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] = $3hooq$solidjs.createSignal()) : [];
1584
- const container = $ce467edb5343cfcd$export$94026ee33dbabc26({
1585
- // Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
1586
- get class() {
1587
- return props.class;
1588
- },
1589
- get aspectRatio() {
1590
- if (props.autoAdjustAspectRatio) {
1591
- const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
1592
- if (targetRatio != undefined) return "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
1635
+ function $d05611ff6b8c8357$export$23fca46f3143581f(component, error_message) {
1636
+ const component_in_error_boundary = do_with_elements => {
1637
+ const error_boundary_wrapped = $1b3cf201cdd38687$export$b69d0d92862de18b({
1638
+ severity_: "error",
1639
+ message_: error_message,
1640
+ get children() {
1641
+ const elements = component();
1642
+ do_with_elements === null || do_with_elements === void 0 || do_with_elements(elements);
1643
+ return elements;
1593
1644
  }
1594
- return props.aspectRatio;
1595
- }
1596
- });
1645
+ });
1646
+ // This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
1647
+ if (typeof error_boundary_wrapped === "function")
1648
+ // @ts-ignore
1649
+ return error_boundary_wrapped();
1650
+ // On the server it returns a string, so we just return that
1651
+ return error_boundary_wrapped;
1652
+ };
1597
1653
  const owner = $3hooq$solidjs.getOwner();
1598
- let createdSizeAccessor = false;
1599
- let wasCleanedUp = false;
1600
- $3hooq$solidjs.createEffect(() => {
1601
- if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
1602
- // ensure we always have a size accessor
1603
- // what this whole thing does is set the sizes attribute to the actual size of one of the existing image containers, therefore the value doesn't have to manually be specified
1604
- createdSizeAccessor = true;
1605
- setCurrentImageSize(() => $3hooq$solidjs.runWithOwner(owner, () => $858fdcf73148519f$export$e6fffe67d4cdd848(container)));
1606
- });
1607
- $3hooq$solidjs.onCleanup(() => {
1608
- wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
1609
- if (!createdSizeAccessor) return;
1610
- $3hooq$depictaiutilishared.queueMacroTask(() => setCurrentImageSize()); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
1611
- });
1612
-
1613
- $3hooq$solidjsweb.insert(container, $3hooq$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), $3hooq$solidjsweb.mergeProps({
1614
- get size() {
1615
- return $3hooq$solidjs.createMemo(() => {
1616
- var _currentImageSize;
1617
- return ((_currentImageSize = currentImageSize()) === null || _currentImageSize === void 0 ? void 0 : _currentImageSize()) || 0;
1654
+ if (owner == null) return $3hooq$solidjs.createRoot(dispose => {
1655
+ // if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
1656
+ return component_in_error_boundary(elements => {
1657
+ const have_multiple = Array.isArray(elements);
1658
+ if (have_multiple ? !(elements !== null && elements !== void 0 && elements.length) : !elements) return;
1659
+ (0, $3hooq$depictaiutilishared.observer).onremoved(have_multiple ? elements[0] : elements, _ref => {
1660
+ let {
1661
+ element: element
1662
+ } = _ref;
1663
+ if (document.documentElement.contains(element)) return; // If element has instantly been re-inserted, don't dispose
1664
+ // See https://depictaiworkspace.slack.com/archives/C050GHEPBTR/p1695809102791259?thread_ts=1695106805.459729&cid=C050GHEPBTR
1665
+ dispose();
1618
1666
  });
1619
- },
1620
- get src() {
1621
- return props.src;
1622
- }
1623
- }, () => props.imgProps, {
1624
- get style() {
1625
- var _props$imgProps;
1626
- return (_props$imgProps = props.imgProps) === null || _props$imgProps === void 0 ? void 0 : _props$imgProps.style;
1627
- }
1628
- })));
1629
- return container;
1630
- }
1631
- const $f3db423dc84bc35d$var$customUrls = (url, width) => {
1632
- var _url$startsWith;
1633
- if (url !== null && url !== void 0 && (_url$startsWith = url.startsWith) !== null && _url$startsWith !== void 0 && _url$startsWith.call(url, "https://cdn.shopify.com"))
1634
- // The shopify image resizing CDN blocks Cloudflare's image resizer. It's possible that we can't detect shopify image URLs sometimes because they go to the merchant's domain,
1635
- // but it seems like the URLs returned by the Depict API always goes to the cdn.shopify.com version of an image, so this simple workaround works.
1636
- return $858fdcf73148519f$export$1d6267828870adda(url, width);
1637
- // Use cloudflare image resizer instead of img.depict.ai because it's a lot faster (and also auto-chooses other formats if webp is not supported)
1638
- return "https://app.depict.ai/cdn-cgi/image/width=".concat(width, ",format=auto/").concat(url);
1639
- };
1640
- function $f3db423dc84bc35d$export$9d4a4b669b1929ab(props) {
1641
- return $3hooq$solidjsweb.createComponent((0, $28535bb7671c63d1$export$e4b984597b71e989), $3hooq$solidjsweb.mergeProps(props, {
1642
- get imgProps() {
1643
- return {
1644
- ...props.imgProps,
1645
- customUrls: $f3db423dc84bc35d$var$customUrls
1646
- };
1647
- }
1648
- }));
1649
- }
1650
- function $f3db423dc84bc35d$export$140423fa4bfb6d63(props) {
1651
- return $3hooq$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), $3hooq$solidjsweb.mergeProps(props, {
1652
- customUrls: $f3db423dc84bc35d$var$customUrls
1653
- }));
1667
+ });
1668
+ });else
1669
+ // we're already in a root so cleanups are handled
1670
+ return component_in_error_boundary();
1654
1671
  }
1655
1672
  function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
1656
1673
  return $3hooq$solidjs.createMemo(() => {
@@ -13340,11 +13357,13 @@ function $c19709057a32b2e7$export$780a853d15174484(_ref) {
13340
13357
  }, {
13341
13358
  get children() {
13342
13359
  return $3hooq$solidjsweb.createComponent((0, $f3db423dc84bc35d$export$140423fa4bfb6d63), {
13343
- get size() {
13344
- return $3hooq$solidjs.createMemo(() => {
13345
- var _wrapperSize;
13346
- return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : _wrapperSize()) || 0;
13347
- });
13360
+ size: () => {
13361
+ var _wrapperSize, _wrapperSize$;
13362
+ return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : (_wrapperSize$ = _wrapperSize[0]) === null || _wrapperSize$ === void 0 ? void 0 : _wrapperSize$.call(_wrapperSize)) || 0;
13363
+ },
13364
+ sizeHeight: () => {
13365
+ var _wrapperSize2, _wrapperSize2$;
13366
+ return ((_wrapperSize2 = wrapperSize()) === null || _wrapperSize2 === void 0 ? void 0 : (_wrapperSize2$ = _wrapperSize2[1]) === null || _wrapperSize2$ === void 0 ? void 0 : _wrapperSize2$.call(_wrapperSize2)) || 0;
13348
13367
  },
13349
13368
  src: mediaUrl,
13350
13369
  "class": "d-standard-content"