@depict-ai/portal-components 2.7.5 → 2.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,14 +1,13 @@
1
- import {add_to_version_info as $2MCgq$add_to_version_info} from "@depict-ai/utilishared/latest";
2
- import {createSignal as $2MCgq$createSignal, createMemo as $2MCgq$createMemo, untrack as $2MCgq$untrack} from "solid-js";
3
- import {accessor_of_object_to_object_with_accessor_values as $2MCgq$accessor_of_object_to_object_with_accessor_values, create_modified_filters as $2MCgq$create_modified_filters, SelectedFilters as $2MCgq$SelectedFilters, FilterBody as $2MCgq$FilterBody, ExpandingDetails as $2MCgq$ExpandingDetails, ListingProvider as $2MCgq$ListingProvider, PseudoRouter as $2MCgq$PseudoRouter, LookCard as $2MCgq$LookCard} from "@depict-ai/ui/latest";
4
- import {render as $2MCgq$render, insert as $2MCgq$insert} from "solid-js/web";
1
+ import {add_to_version_info as $2MCgq$add_to_version_info, standard_price_format as $2MCgq$standard_price_format, catchify as $2MCgq$catchify, dlog as $2MCgq$dlog, dwarn as $2MCgq$dwarn} from "@depict-ai/utilishared/latest";
2
+ import {render as $2MCgq$render, template as $2MCgq$template, createComponent as $2MCgq$createComponent, addEventListener as $2MCgq$addEventListener, use as $2MCgq$use, insert as $2MCgq$insert, effect as $2MCgq$effect, className as $2MCgq$className, setAttribute as $2MCgq$setAttribute, memo as $2MCgq$memo, style as $2MCgq$style, classList as $2MCgq$classList, spread as $2MCgq$spread, mergeProps as $2MCgq$mergeProps, delegateEvents as $2MCgq$delegateEvents} from "solid-js/web";
5
3
  import {useRef as $2MCgq$useRef, useState as $2MCgq$useState, useEffect as $2MCgq$useEffect, createElement as $2MCgq$createElement, Fragment as $2MCgq$Fragment} from "react";
6
4
  import {createStore as $2MCgq$createStore, reconcile as $2MCgq$reconcile} from "solid-js/store";
5
+ import {media_query_to_accessor as $2MCgq$media_query_to_accessor, TextPlaceholder as $2MCgq$TextPlaceholder, useSlidableInformation as $2MCgq$useSlidableInformation, SlidableItems as $2MCgq$SlidableItems, ImagePlaceholder as $2MCgq$ImagePlaceholder, ImageContainer as $2MCgq$ImageContainer, ShopifyContainedImage as $2MCgq$ShopifyContainedImage, useVisibilityState as $2MCgq$useVisibilityState, useProductCardIndex as $2MCgq$useProductCardIndex, useProductCardIsVisible as $2MCgq$useProductCardIsVisible, accessor_of_object_to_object_with_accessor_values as $2MCgq$accessor_of_object_to_object_with_accessor_values, create_modified_filters as $2MCgq$create_modified_filters, SelectedFilters as $2MCgq$SelectedFilters, FilterBody as $2MCgq$FilterBody, ExpandingDetails as $2MCgq$ExpandingDetails, ListingProvider as $2MCgq$ListingProvider, PseudoRouter as $2MCgq$PseudoRouter, LookCard as $2MCgq$LookCard} from "@depict-ai/ui/latest";
6
+ import {createContext as $2MCgq$createContext, createMemo as $2MCgq$createMemo, createSignal as $2MCgq$createSignal, untrack as $2MCgq$untrack, createResource as $2MCgq$createResource, Suspense as $2MCgq$Suspense, createEffect as $2MCgq$createEffect, Show as $2MCgq$Show, children as $2MCgq$children, onCleanup as $2MCgq$onCleanup, For as $2MCgq$For, createRenderEffect as $2MCgq$createRenderEffect, on as $2MCgq$on, useContext as $2MCgq$useContext} from "solid-js";
7
7
  import {createPortal as $2MCgq$createPortal} from "react-dom";
8
8
 
9
9
  /*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
10
- const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.5";
11
-
10
+ const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.7";
12
11
 
13
12
 
14
13
 
@@ -36,6 +35,977 @@ function $0fe03f2fcd2418f8$export$f6e64e17bd69eeef({ solid_component: solid_comp
36
35
 
37
36
 
38
37
 
38
+
39
+
40
+
41
+ var $29535f590238371c$var$_tmpl$ = /*#__PURE__*/ (0, $2MCgq$template)(`<a>`), $29535f590238371c$var$_tmpl$2 = /*#__PURE__*/ (0, $2MCgq$template)(`<div class="d-title line-clamp">`), $29535f590238371c$var$_tmpl$3 = /*#__PURE__*/ (0, $2MCgq$template)(`<div class=d-product-card>`), $29535f590238371c$var$_tmpl$4 = /*#__PURE__*/ (0, $2MCgq$template)(`<svg xmlns=http://www.w3.org/2000/svg width=12 height=12 class=more><path d="M10.8 6c0 .153-.061.299-.169.407s-.255.169-.407.169H6.576v3.648c0 .153-.061.299-.169.407S6.153 10.8 6 10.8s-.299-.061-.407-.169-.169-.255-.169-.407V6.576H1.776c-.153 0-.299-.061-.407-.169S1.2 6.153 1.2 6s.061-.299.169-.407.255-.169.407-.169h3.648V1.776c0-.153.061-.299.169-.407S5.847 1.2 6 1.2s.299.061.407.169.169.255.169.407v3.648h3.648c.153 0 .299.061.407.169s.169.255.169.407z">`), $29535f590238371c$var$_tmpl$5 = /*#__PURE__*/ (0, $2MCgq$template)(`<div class=d-swatches>`), $29535f590238371c$var$_tmpl$6 = /*#__PURE__*/ (0, $2MCgq$template)(`<a class=d-swatch>`), $29535f590238371c$var$_tmpl$7 = /*#__PURE__*/ (0, $2MCgq$template)(`<span class=more>+ <!> more`), $29535f590238371c$var$_tmpl$8 = /*#__PURE__*/ (0, $2MCgq$template)(`<div class=sizes>`), $29535f590238371c$var$_tmpl$9 = /*#__PURE__*/ (0, $2MCgq$template)(`<span>`), $29535f590238371c$var$_tmpl$10 = /*#__PURE__*/ (0, $2MCgq$template)(`<s>`), $29535f590238371c$var$_tmpl$11 = /*#__PURE__*/ (0, $2MCgq$template)(`<div>`), $29535f590238371c$var$_tmpl$12 = /*#__PURE__*/ (0, $2MCgq$template)(`<div class="media-item video">`), $29535f590238371c$var$_tmpl$13 = /*#__PURE__*/ (0, $2MCgq$template)(`<div class="media-item image">`), $29535f590238371c$var$_tmpl$14 = /*#__PURE__*/ (0, $2MCgq$template)(`<source type=application/x-mpegURL>`), $29535f590238371c$var$_tmpl$15 = /*#__PURE__*/ (0, $2MCgq$template)(`<video class=s-responsive-image crossorigin=anonymous>`), $29535f590238371c$var$_tmpl$16 = /*#__PURE__*/ (0, $2MCgq$template)(`<source>`), $29535f590238371c$var$_tmpl$17 = /*#__PURE__*/ (0, $2MCgq$template)(`<span class=price>`), $29535f590238371c$var$_tmpl$18 = /*#__PURE__*/ (0, $2MCgq$template)(`<span class=original-price>`);
42
+ // You can import from the solid-js library here and leverage its reactivity to create an interactive UI.
43
+ // Also, Depict packages can be imported (you must import /latest from those).
44
+ const $29535f590238371c$var$sizeOrder = [
45
+ "XXS",
46
+ "XS",
47
+ "XS/S",
48
+ "S",
49
+ "S/M",
50
+ "M",
51
+ "M/L",
52
+ "L",
53
+ "L/XL",
54
+ "XL",
55
+ "XL/XXL",
56
+ "XXL",
57
+ "One Size",
58
+ "Onesize"
59
+ ];
60
+ const $29535f590238371c$var$ContainsColorSwatchesContext = /*@__PURE__*/ (0, $2MCgq$createContext)();
61
+ let $29535f590238371c$var$colorCanvasContext;
62
+ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOptions_ = ()=>({
63
+ image_radius: "md",
64
+ alignment: "left",
65
+ sizes: true,
66
+ smart_labels: {
67
+ font_size_rem: 0.5,
68
+ enabled: true,
69
+ bold: false,
70
+ italic: false,
71
+ color: "red",
72
+ bg_color: "yellow"
73
+ },
74
+ title: {
75
+ font_size_rem: 1.6,
76
+ enabled: true,
77
+ bold: false,
78
+ italic: false,
79
+ color: "black"
80
+ },
81
+ price: {
82
+ font_size_rem: 1.5,
83
+ enabled: true,
84
+ bold: false,
85
+ italic: false,
86
+ color: "black"
87
+ },
88
+ original_price: {
89
+ font_size_rem: 0.9,
90
+ enabled: true,
91
+ bold: false,
92
+ italic: false,
93
+ color: "black"
94
+ },
95
+ use_hover_image: true,
96
+ image_carousel: true,
97
+ color_options: true,
98
+ image_aspect_ratio: 1
99
+ })) {
100
+ const variantDisplays = (0, $2MCgq$createMemo)(()=>display()?.variant_displays);
101
+ const defaultVariantIndex = (0, $2MCgq$createMemo)(()=>display()?.variant_index);
102
+ const [showVariantIndex, setShowVariantIndex] = (0, $2MCgq$createSignal)((0, $2MCgq$untrack)(defaultVariantIndex));
103
+ const [cardIsHovered, setCardIsHovered] = (0, $2MCgq$createSignal)(false);
104
+ const variantToShow = (0, $2MCgq$createMemo)(()=>variantDisplays()?.[showVariantIndex()]);
105
+ const noHoverSupport_ = (0, $2MCgq$media_query_to_accessor)("(hover: none)");
106
+ const [salePrice] = (0, $2MCgq$createResource)(variantToShow, (v)=>v?.sale_price);
107
+ const [originalPrice] = (0, $2MCgq$createResource)(variantToShow, (v)=>v?.original_price);
108
+ const onSale = (0, $2MCgq$createMemo)(()=>(0, $2MCgq$createComponent)((0, $2MCgq$Suspense), {
109
+ get children () {
110
+ return originalPrice() !== salePrice();
111
+ }
112
+ }));
113
+ const aspectRatio_ = (0, $2MCgq$createMemo)(()=>configuredOptions_().image_aspect_ratio);
114
+ const sizesInStock_ = (0, $2MCgq$createMemo)(()=>new Map(variantDisplays()?.map((d)=>[
115
+ d.size_name,
116
+ d.in_stock
117
+ ]).filter(([name])=>name)));
118
+ const titleOptions = (0, $2MCgq$createMemo)(()=>configuredOptions_().title);
119
+ const colorMap = (0, $2MCgq$createMemo)(()=>new Map(variantDisplays()?.map((variant, index)=>[
120
+ variant.color_name,
121
+ {
122
+ hexColor_: variant.color_name,
123
+ pageUrl_: variant.page_url,
124
+ variantIndex_: index
125
+ }
126
+ ]).filter(([colorName])=>colorName) // in case color_name is null
127
+ ));
128
+ const swatchContainerHeight = (0, $2MCgq$createMemo)(()=>{
129
+ // To avoid the product cards switching around as one hovers and price switches to the swatches, we have to make the swatches container have the same height as the price one
130
+ let considerSize = [];
131
+ const { original_price: original_price, price: price } = configuredOptions_();
132
+ const isOnSale = onSale?.()?.(); // Hack for getting if we're on sale without triggering <Suspense> above us
133
+ if (price.enabled) considerSize.push(price.font_size_rem);
134
+ if (original_price.enabled && isOnSale) considerSize.push(original_price.font_size_rem);
135
+ if (!considerSize.length) return;
136
+ return Math.max(...considerSize);
137
+ });
138
+ const LinkWrapped = (props)=>(()=>{
139
+ var _el$ = $29535f590238371c$var$_tmpl$();
140
+ (0, $2MCgq$addEventListener)(_el$, "click", (0, $2MCgq$catchify)((e)=>{
141
+ const { target: target } = e;
142
+ const navbuttonSelector = ".d-navbutton";
143
+ if (target.matches(navbuttonSelector) || target.closest(navbuttonSelector)) // Don't navigate if optional slider button that can be shown using css was clicked
144
+ e.preventDefault();
145
+ }), true);
146
+ (0, $2MCgq$use)((el)=>props?.ref?.(el), _el$);
147
+ (0, $2MCgq$insert)(_el$, ()=>props.children);
148
+ (0, $2MCgq$effect)((_p$)=>{
149
+ var _v$ = props.class, _v$2 = variantToShow()?.page_url || "#";
150
+ _v$ !== _p$.e && (0, $2MCgq$className)(_el$, _p$.e = _v$);
151
+ _v$2 !== _p$.t && (0, $2MCgq$setAttribute)(_el$, "href", _p$.t = _v$2);
152
+ return _p$;
153
+ }, {
154
+ e: undefined,
155
+ t: undefined
156
+ });
157
+ return _el$;
158
+ })();
159
+ const Title = (props)=>(()=>{
160
+ var _el$2 = $29535f590238371c$var$_tmpl$2();
161
+ (0, $2MCgq$use)((el)=>{
162
+ props.ref_?.(el);
163
+ $29535f590238371c$var$setStyleForTextOptions(el, titleOptions);
164
+ }, _el$2);
165
+ (0, $2MCgq$insert)(_el$2, ()=>variantToShow()?.title ?? [
166
+ (0, $2MCgq$createComponent)((0, $2MCgq$TextPlaceholder), {
167
+ height: "1em",
168
+ width: "20ch"
169
+ }),
170
+ (0, $2MCgq$createComponent)((0, $2MCgq$TextPlaceholder), {
171
+ height: "1em",
172
+ width: "20ch"
173
+ })
174
+ ]);
175
+ (0, $2MCgq$effect)(()=>(0, $2MCgq$setAttribute)(_el$2, "title", variantToShow()?.title));
176
+ return _el$2;
177
+ })();
178
+ const mainStyle = ()=>{
179
+ const { alignment: alignment } = configuredOptions_();
180
+ const flexAlignment = alignment === "center" ? alignment : "flex-" + alignment;
181
+ return {
182
+ "--flex-alignment": flexAlignment,
183
+ "--alignment": alignment
184
+ };
185
+ };
186
+ (0, $2MCgq$createEffect)(()=>(0, $2MCgq$dlog)("Got passed options", JSON.parse(JSON.stringify(configuredOptions_()))));
187
+ (0, $2MCgq$createEffect)(()=>(0, $2MCgq$dlog)("Got passed display", JSON.parse(JSON.stringify(display()))));
188
+ (0, $2MCgq$createEffect)(()=>noHoverSupport_() && setCardIsHovered(false));
189
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$ContainsColorSwatchesProvider, {
190
+ get children () {
191
+ var _el$3 = $29535f590238371c$var$_tmpl$3();
192
+ (0, $2MCgq$addEventListener)(_el$3, "mouseleave", (0, $2MCgq$catchify)(()=>!noHoverSupport_() && setCardIsHovered(false)));
193
+ (0, $2MCgq$addEventListener)(_el$3, "mouseenter", (0, $2MCgq$catchify)(()=>!noHoverSupport_() && setCardIsHovered(true)));
194
+ (0, $2MCgq$insert)(_el$3, (0, $2MCgq$createComponent)(LinkWrapped, {
195
+ "class": "upper",
196
+ get children () {
197
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$ImagesAndVideos, {
198
+ image_urls_: ()=>variantToShow()?.image_urls,
199
+ video_: ()=>variantToShow()?.videos?.[0],
200
+ configuredOptions_: configuredOptions_,
201
+ cardIsHovered_: ()=>showVariantIndex() === display()?.variant_index && cardIsHovered(),
202
+ aspectRatio_: aspectRatio_
203
+ });
204
+ }
205
+ }), null);
206
+ (0, $2MCgq$insert)(_el$3, (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
207
+ get when () {
208
+ return titleOptions().enabled || configuredOptions_().price.enabled || configuredOptions_().sizes || configuredOptions_().color_options;
209
+ },
210
+ get children () {
211
+ return (()=>{
212
+ // We want the whole product card to be a link, except for the color swatches
213
+ const [containsColorSwatches] = $29535f590238371c$var$useContainsColorSwatches();
214
+ const LinkWrappedIfHaveSwatches = (props)=>{
215
+ const resolved = (0, $2MCgq$children)(()=>props.children);
216
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
217
+ get when () {
218
+ return containsColorSwatches();
219
+ },
220
+ get fallback () {
221
+ return resolved();
222
+ },
223
+ get children () {
224
+ return (0, $2MCgq$createComponent)(LinkWrapped, {
225
+ get children () {
226
+ return resolved();
227
+ }
228
+ });
229
+ }
230
+ });
231
+ };
232
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$InComponentOrDiv, {
233
+ get component_ () {
234
+ return !containsColorSwatches() && LinkWrapped;
235
+ },
236
+ class_: "text-container",
237
+ get children () {
238
+ return [
239
+ (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
240
+ get when () {
241
+ return titleOptions().enabled;
242
+ },
243
+ get fallback () {
244
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
245
+ get when () {
246
+ return configuredOptions_().sizes;
247
+ },
248
+ get children () {
249
+ return (0, $2MCgq$createComponent)(LinkWrappedIfHaveSwatches, {
250
+ get children () {
251
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$Sizes, {
252
+ sizesInStock_: sizesInStock_,
253
+ fontSizeRem_: ()=>titleOptions().font_size_rem
254
+ });
255
+ }
256
+ });
257
+ }
258
+ });
259
+ },
260
+ get children () {
261
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
262
+ get when () {
263
+ return (0, $2MCgq$memo)(()=>!!configuredOptions_().sizes)() && sizesInStock_().size > 1;
264
+ },
265
+ get fallback () {
266
+ return (0, $2MCgq$createComponent)(LinkWrappedIfHaveSwatches, {
267
+ get children () {
268
+ return (0, $2MCgq$createComponent)(Title, {});
269
+ }
270
+ });
271
+ },
272
+ get children () {
273
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$AnimatedRowSwitch, {
274
+ DefaultComponent_: Title,
275
+ HoveredComponent_: ({ ref_: ref_ })=>(0, $2MCgq$createComponent)($29535f590238371c$var$Sizes, {
276
+ sizesInStock_: sizesInStock_,
277
+ fontSizeRem_: ()=>titleOptions().font_size_rem,
278
+ ref_: ref_
279
+ }),
280
+ cardIsHovered_: cardIsHovered,
281
+ containerComponent_: ()=>containsColorSwatches() && LinkWrapped
282
+ });
283
+ }
284
+ });
285
+ }
286
+ }),
287
+ (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
288
+ get when () {
289
+ return configuredOptions_().price.enabled;
290
+ },
291
+ get fallback () {
292
+ return (0, $2MCgq$memo)(()=>!!configuredOptions_().color_options)() && (0, $2MCgq$createComponent)($29535f590238371c$var$ColorSwatches, {
293
+ colorMap_: colorMap,
294
+ showVariantIndex_: showVariantIndex,
295
+ setShowVariantIndex_: setShowVariantIndex,
296
+ colorsAtIndex_: ()=>variantDisplays()?.map((variant)=>variant.color_name),
297
+ wantedContainerHeightRem_: swatchContainerHeight,
298
+ defaultVariantIndex_: defaultVariantIndex
299
+ });
300
+ },
301
+ get children () {
302
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
303
+ get when () {
304
+ return (0, $2MCgq$memo)(()=>!!configuredOptions_().color_options)() && colorMap().size > 1;
305
+ },
306
+ get fallback () {
307
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$Prices, {
308
+ variantToShow_: variantToShow,
309
+ get formatPrice_ () {
310
+ return info?.formatPrice;
311
+ },
312
+ configuredOptions_: configuredOptions_,
313
+ salePrice_: salePrice,
314
+ originalPrice_: originalPrice,
315
+ wrapperComponent_: ()=>containsColorSwatches() && LinkWrapped
316
+ });
317
+ },
318
+ get children () {
319
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$AnimatedRowSwitch, {
320
+ containerComponent_: ()=>!containsColorSwatches() && LinkWrapped,
321
+ DefaultComponent_: ({ ref_: ref_ })=>(0, $2MCgq$createComponent)($29535f590238371c$var$Prices, {
322
+ variantToShow_: variantToShow,
323
+ get formatPrice_ () {
324
+ return info?.formatPrice;
325
+ },
326
+ salePrice_: salePrice,
327
+ originalPrice_: originalPrice,
328
+ configuredOptions_: configuredOptions_,
329
+ wrapperComponent_: ()=>containsColorSwatches() && LinkWrapped,
330
+ ref_: ref_
331
+ }),
332
+ HoveredComponent_: ({ ref_: ref_ })=>(0, $2MCgq$createComponent)($29535f590238371c$var$ColorSwatches, {
333
+ colorMap_: colorMap,
334
+ showVariantIndex_: showVariantIndex,
335
+ setShowVariantIndex_: setShowVariantIndex,
336
+ colorsAtIndex_: ()=>variantDisplays()?.map((variant)=>variant.color_name),
337
+ ref_: ref_,
338
+ wantedContainerHeightRem_: swatchContainerHeight,
339
+ defaultVariantIndex_: defaultVariantIndex
340
+ }),
341
+ cardIsHovered_: cardIsHovered
342
+ });
343
+ }
344
+ });
345
+ }
346
+ })
347
+ ];
348
+ }
349
+ });
350
+ })();
351
+ }
352
+ }), null);
353
+ (0, $2MCgq$effect)((_$p)=>(0, $2MCgq$style)(_el$3, mainStyle(), _$p));
354
+ return _el$3;
355
+ }
356
+ });
357
+ }
358
+ /**
359
+ * Transitions between DefaultComponent_ and HoveredComponent_ when cardIsHovered_ changes in both height and opacity.
360
+ */ function $29535f590238371c$var$AnimatedRowSwitch({ DefaultComponent_: DefaultComponent_, HoveredComponent_: HoveredComponent_, cardIsHovered_: cardIsHovered_, containerComponent_: containerComponent_ }) {
361
+ let defaultElement;
362
+ let hoveredElement;
363
+ let containerElement;
364
+ let defaultElementAnimation;
365
+ let hoveredElementAnimation;
366
+ let containerAnimation;
367
+ const fadeInKeyframes = [
368
+ {
369
+ opacity: 0,
370
+ pointerEvents: "none",
371
+ cursor: "default"
372
+ },
373
+ {
374
+ opacity: 1,
375
+ pointerEvents: "auto",
376
+ cursor: "unset"
377
+ }
378
+ ];
379
+ const fadeOutKeyframes = [
380
+ ...fadeInKeyframes
381
+ ].reverse();
382
+ (0, $2MCgq$createEffect)((firstRun)=>{
383
+ const isHovered = cardIsHovered_();
384
+ if (!hoveredElement || !defaultElement) return; // Got no sizes probably, can't switch to anything
385
+ const hoveredStyle = hoveredElement.style;
386
+ const defaultStyle = defaultElement.style;
387
+ const containerStyle = containerElement.style;
388
+ const duration = 200;
389
+ const easing = "ease-in-out";
390
+ hoveredStyle.position = "absolute";
391
+ if (firstRun) {
392
+ Object.assign(hoveredStyle, fadeInKeyframes[0]);
393
+ return;
394
+ }
395
+ defaultStyle.position = "absolute";
396
+ // These animations we can let live forever, since opacity always goes between 0 and 1
397
+ hoveredElementAnimation ||= hoveredElement.animate(fadeInKeyframes, {
398
+ duration: duration,
399
+ fill: "both",
400
+ easing: easing
401
+ });
402
+ defaultElementAnimation ||= defaultElement.animate(fadeOutKeyframes, {
403
+ duration: duration,
404
+ fill: "both",
405
+ easing: easing
406
+ });
407
+ if (!containerAnimation) {
408
+ const containerKeyframes = [
409
+ {
410
+ height: defaultElement.getBoundingClientRect().height + "px"
411
+ },
412
+ {
413
+ height: hoveredElement.getBoundingClientRect().height + "px"
414
+ }
415
+ ];
416
+ containerAnimation = containerElement.animate(containerKeyframes, {
417
+ duration: duration,
418
+ easing: easing
419
+ });
420
+ containerAnimation.finished.then(()=>{
421
+ containerAnimation?.cancel();
422
+ containerAnimation = undefined;
423
+ // Animation can survive direction change so need to get current hovered state when it finishes
424
+ const hoveredNow = (0, $2MCgq$untrack)(cardIsHovered_);
425
+ containerStyle.height = "";
426
+ if (hoveredNow) hoveredStyle.position = "";
427
+ else defaultStyle.position = "";
428
+ });
429
+ if (!isHovered) // When starting the animation in reverse we need to set the current time to the end of the animation
430
+ containerAnimation.currentTime = containerAnimation.effect.getComputedTiming().endTime;
431
+ // Remove this animation once it has finished and re-create it later since the size of the elements containing texts might change, i.e. when the window is resized of zoom level adjusted
432
+ }
433
+ const animationDirection = isHovered ? 1 : -1;
434
+ defaultElementAnimation.updatePlaybackRate(animationDirection);
435
+ defaultElementAnimation.play();
436
+ hoveredElementAnimation.updatePlaybackRate(animationDirection);
437
+ hoveredElementAnimation.play();
438
+ containerAnimation.updatePlaybackRate(animationDirection);
439
+ }, true);
440
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$InComponentOrDiv, {
441
+ get component_ () {
442
+ return containerComponent_();
443
+ },
444
+ class_: "animated-row-switch",
445
+ ref_: (el)=>containerElement = el,
446
+ get children () {
447
+ return [
448
+ (0, $2MCgq$createComponent)(DefaultComponent_, {
449
+ ref_: (el)=>defaultElement = el
450
+ }),
451
+ (0, $2MCgq$createComponent)(HoveredComponent_, {
452
+ ref_: (el)=>hoveredElement = el
453
+ })
454
+ ];
455
+ }
456
+ });
457
+ }
458
+ function $29535f590238371c$var$ColorSwatches({ colorMap_: colorMap_, setShowVariantIndex_: setShowVariantIndex_, showVariantIndex_: showVariantIndex_, colorsAtIndex_: colorsAtIndex_, wantedContainerHeightRem_: wantedContainerHeightRem_, defaultVariantIndex_: defaultVariantIndex_, ref_: ref_ }) {
459
+ let unHoverDebouncedTimeout;
460
+ const entriesToShow = ()=>[
461
+ ...colorMap_().entries()
462
+ ].slice(0, 12);
463
+ const [, setContainsColorSwatches] = $29535f590238371c$var$useContainsColorSwatches();
464
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
465
+ get when () {
466
+ return entriesToShow().length > 1;
467
+ },
468
+ get children () {
469
+ return (()=>{
470
+ setContainsColorSwatches(true);
471
+ (0, $2MCgq$onCleanup)(()=>setContainsColorSwatches(false));
472
+ return (()=>{
473
+ var _el$4 = $29535f590238371c$var$_tmpl$5();
474
+ (0, $2MCgq$use)((el)=>{
475
+ ref_?.(el);
476
+ // Do like this so we don't override other styles set by AnimateRowSwitch
477
+ (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(el.style, "--swatch-container-height", wantedContainerHeightRem_() && wantedContainerHeightRem_() + "rem"));
478
+ }, _el$4);
479
+ (0, $2MCgq$insert)(_el$4, (0, $2MCgq$createComponent)((0, $2MCgq$For), {
480
+ get each () {
481
+ return entriesToShow();
482
+ },
483
+ children: ([colorName, { pageUrl_: pageUrl_, hexColor_: hexColor_, variantIndex_: variantIndex_ }])=>{
484
+ const thisColorIsDefaultColor = (0, $2MCgq$createMemo)(()=>colorsAtIndex_()?.[defaultVariantIndex_()] === colorName);
485
+ // Since we don't have actual colors right now and rely on color names working as css colors
486
+ // We need a default fallback for it being usable
487
+ const [invalidColor, setInvalidColor] = (0, $2MCgq$createSignal)(false);
488
+ return (()=>{
489
+ var _el$6 = $29535f590238371c$var$_tmpl$6();
490
+ (0, $2MCgq$use)((element)=>requestAnimationFrame(// After one frame we're usually in the DOM, if we're not boxShadow is ""
491
+ // If it's none, the color was invalid - so just show this swatch as a white swatch which is the prettiest
492
+ (0, $2MCgq$catchify)(()=>getComputedStyle(element).boxShadow === "none" && setInvalidColor(true))), _el$6);
493
+ (0, $2MCgq$addEventListener)(_el$6, "pointerleave", (0, $2MCgq$catchify)((e)=>{
494
+ clearTimeout(unHoverDebouncedTimeout);
495
+ unHoverDebouncedTimeout = setTimeout((0, $2MCgq$catchify)(()=>setShowVariantIndex_(defaultVariantIndex_())), 500);
496
+ }));
497
+ (0, $2MCgq$addEventListener)(_el$6, "pointerenter", (0, $2MCgq$catchify)((e)=>{
498
+ clearTimeout(unHoverDebouncedTimeout);
499
+ setShowVariantIndex_(thisColorIsDefaultColor() ? defaultVariantIndex_() : variantIndex_);
500
+ }));
501
+ (0, $2MCgq$setAttribute)(_el$6, "href", pageUrl_);
502
+ (0, $2MCgq$setAttribute)(_el$6, "title", colorName);
503
+ (0, $2MCgq$effect)((_p$)=>{
504
+ var _v$3 = `--background:${invalidColor() ? "white" : hexColor_}`, _v$4 = !!(colorsAtIndex_()?.[showVariantIndex_()] === colorName), _v$5 = !!thisColorIsDefaultColor(), _v$6 = !!($29535f590238371c$var$isLightColor(hexColor_) || invalidColor());
505
+ _p$.e = (0, $2MCgq$style)(_el$6, _v$3, _p$.e);
506
+ _v$4 !== _p$.t && _el$6.classList.toggle("selected", _p$.t = _v$4);
507
+ _v$5 !== _p$.a && _el$6.classList.toggle("first", _p$.a = _v$5);
508
+ _v$6 !== _p$.o && _el$6.classList.toggle("light-colored", _p$.o = _v$6);
509
+ return _p$;
510
+ }, {
511
+ e: undefined,
512
+ t: undefined,
513
+ a: undefined,
514
+ o: undefined
515
+ });
516
+ return _el$6;
517
+ })();
518
+ }
519
+ }), null);
520
+ (0, $2MCgq$insert)(_el$4, (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
521
+ get when () {
522
+ return entriesToShow().length !== colorMap_().size;
523
+ },
524
+ get children () {
525
+ return $29535f590238371c$var$_tmpl$4();
526
+ }
527
+ }), null);
528
+ return _el$4;
529
+ })();
530
+ })();
531
+ }
532
+ });
533
+ }
534
+ function $29535f590238371c$var$Sizes({ sizesInStock_: sizesInStock_, ref_: ref_, fontSizeRem_: fontSizeRem_ }) {
535
+ const keys = ()=>[
536
+ ...sizesInStock_().keys()
537
+ ];
538
+ const keysToShow = ()=>keys().slice(0, 7);
539
+ const hidden = ()=>keys().length - keysToShow().length;
540
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
541
+ get when () {
542
+ return keysToShow().length > 1;
543
+ },
544
+ get children () {
545
+ var _el$7 = $29535f590238371c$var$_tmpl$8();
546
+ (0, $2MCgq$use)((el)=>{
547
+ ref_?.(el);
548
+ // Do like this so we don't override other styles set by AnimateRowSwitch
549
+ (0, $2MCgq$createEffect)(()=>el.style.setProperty("--font-size-rem", fontSizeRem_() + "rem"));
550
+ }, _el$7);
551
+ (0, $2MCgq$insert)(_el$7, (0, $2MCgq$createComponent)((0, $2MCgq$For), {
552
+ get each () {
553
+ return $29535f590238371c$var$sortSizes(keysToShow());
554
+ },
555
+ children: (size)=>(0, $2MCgq$createComponent)((0, $2MCgq$Show), {
556
+ get when () {
557
+ return sizesInStock_().get(size);
558
+ },
559
+ get fallback () {
560
+ return (()=>{
561
+ var _el$13 = $29535f590238371c$var$_tmpl$10();
562
+ (0, $2MCgq$insert)(_el$13, size);
563
+ return _el$13;
564
+ })();
565
+ },
566
+ get children () {
567
+ var _el$12 = $29535f590238371c$var$_tmpl$9();
568
+ (0, $2MCgq$insert)(_el$12, size);
569
+ return _el$12;
570
+ }
571
+ })
572
+ }), null);
573
+ (0, $2MCgq$insert)(_el$7, (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
574
+ get when () {
575
+ return hidden() > 0;
576
+ },
577
+ get children () {
578
+ var _el$8 = $29535f590238371c$var$_tmpl$7(), _el$9 = _el$8.firstChild, _el$11 = _el$9.nextSibling, _el$10 = _el$11.nextSibling;
579
+ (0, $2MCgq$insert)(_el$8, hidden, _el$11);
580
+ return _el$8;
581
+ }
582
+ }), null);
583
+ return _el$7;
584
+ }
585
+ });
586
+ }
587
+ function $29535f590238371c$var$setPropertyIfExists(style, property, value) {
588
+ if (value) style.setProperty(property, value);
589
+ else style.removeProperty(property);
590
+ }
591
+ function $29535f590238371c$var$setStyleForTextOptions({ style: style }, options) {
592
+ // Doing this instead of just using style={} because AnimatedRowSwitch needs to be able to set inline styling without it being overridden
593
+ (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(style, "--font-size-rem", options().font_size_rem + "rem"));
594
+ (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(style, "--font-weight", options().bold && "bold"));
595
+ (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(style, "--font-style", options().italic && "italic"));
596
+ (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(style, "--color", options().color));
597
+ (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(style, "--background", options().bg_color));
598
+ }
599
+ function $29535f590238371c$var$ImagesAndVideos({ image_urls_: image_urls_, video_: video_, configuredOptions_: configuredOptions_, cardIsHovered_: cardIsHovered_, aspectRatio_: aspectRatio_ }) {
600
+ const isAlreadyInSlider = !!(0, $2MCgq$useSlidableInformation)();
601
+ const containerClasses = ()=>[
602
+ "image-video",
603
+ "border-radius-" + configuredOptions_().image_radius
604
+ ];
605
+ // Don't make cards swipable inside of sliders (PLP slider or recs slider)
606
+ const slidable = (0, $2MCgq$createMemo)(()=>!isAlreadyInSlider && configuredOptions_().image_carousel);
607
+ const hoverImageDisabled = (0, $2MCgq$createMemo)(()=>!configuredOptions_().use_hover_image);
608
+ const video_urls = ()=>video_()?.video_urls;
609
+ const Container = (props)=>{
610
+ const resolved = (0, $2MCgq$children)(()=>props.children);
611
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
612
+ get when () {
613
+ return slidable();
614
+ },
615
+ get fallback () {
616
+ return (()=>{
617
+ var _el$14 = $29535f590238371c$var$_tmpl$11();
618
+ (0, $2MCgq$insert)(_el$14, resolved);
619
+ (0, $2MCgq$effect)(()=>(0, $2MCgq$className)(_el$14, containerClasses().join(" ")));
620
+ return _el$14;
621
+ })();
622
+ },
623
+ get children () {
624
+ return (0, $2MCgq$createComponent)((0, $2MCgq$SlidableItems), {
625
+ arrow_height_: 25,
626
+ arrow_width_: 12.5,
627
+ disable_fading_: true,
628
+ slider_ref_: (slider)=>{
629
+ const { container: container, insert_here: insert_here } = slider;
630
+ slider.stepstoslide = 1; // In case anyone enables the hidden buttons using css
631
+ (0, $2MCgq$createRenderEffect)((previous)=>(0, $2MCgq$classList)(container, {
632
+ products: true,
633
+ ...Object.fromEntries(containerClasses().map((cls)=>[
634
+ cls,
635
+ true
636
+ ]))
637
+ }, previous));
638
+ // Scroll to beginning when changing what variant we're showing
639
+ (0, $2MCgq$createEffect)((0, $2MCgq$on)(image_urls_, ()=>insert_here.scrollTo({
640
+ left: 0,
641
+ behavior: "auto"
642
+ }), {
643
+ defer: true
644
+ }));
645
+ },
646
+ get children () {
647
+ return resolved();
648
+ }
649
+ });
650
+ }
651
+ });
652
+ };
653
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
654
+ get when () {
655
+ return image_urls_();
656
+ },
657
+ get fallback () {
658
+ return (0, $2MCgq$createComponent)((0, $2MCgq$ImagePlaceholder), {
659
+ get aspectRatio () {
660
+ return aspectRatio_();
661
+ }
662
+ });
663
+ },
664
+ get children () {
665
+ return (0, $2MCgq$createComponent)(Container, {
666
+ get children () {
667
+ return [
668
+ (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
669
+ get when () {
670
+ return video_urls()?.length;
671
+ },
672
+ get children () {
673
+ var _el$15 = $29535f590238371c$var$_tmpl$12();
674
+ (0, $2MCgq$insert)(_el$15, (0, $2MCgq$createComponent)((0, $2MCgq$ImageContainer), {
675
+ get aspectRatio () {
676
+ return aspectRatio_();
677
+ },
678
+ get children () {
679
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$Video, {
680
+ get video_sources_ () {
681
+ return video_urls();
682
+ },
683
+ get poster_ () {
684
+ return video_()?.preview_image_url || image_urls_()?.[0];
685
+ }
686
+ });
687
+ }
688
+ }));
689
+ return _el$15;
690
+ }
691
+ }),
692
+ (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
693
+ get when () {
694
+ return !video_urls()?.length || slidable();
695
+ },
696
+ get children () {
697
+ return (0, $2MCgq$createComponent)((0, $2MCgq$For), {
698
+ get each () {
699
+ return (0, $2MCgq$memo)(()=>!!slidable())() ? image_urls_() : image_urls_()?.slice(0, 1);
700
+ },
701
+ children: (image_url, index)=>(0, $2MCgq$createComponent)((0, $2MCgq$Show), {
702
+ get when () {
703
+ return hoverImageDisabled() || index() !== 1;
704
+ },
705
+ get children () {
706
+ var _el$16 = $29535f590238371c$var$_tmpl$13();
707
+ (0, $2MCgq$insert)(_el$16, (0, $2MCgq$createComponent)((0, $2MCgq$ShopifyContainedImage), {
708
+ src: image_url,
709
+ get aspectRatio () {
710
+ return aspectRatio_();
711
+ },
712
+ imgProps: {
713
+ alt: "Product image"
714
+ }
715
+ }), null);
716
+ (0, $2MCgq$insert)(_el$16, (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
717
+ get when () {
718
+ return (0, $2MCgq$memo)(()=>!!(!index() && image_urls_()?.[1]))() && !hoverImageDisabled();
719
+ },
720
+ get children () {
721
+ return (0, $2MCgq$createComponent)((0, $2MCgq$ShopifyContainedImage), {
722
+ get src () {
723
+ return image_urls_()[1];
724
+ },
725
+ get aspectRatio () {
726
+ return aspectRatio_();
727
+ },
728
+ imgProps: {
729
+ alt: "Product image"
730
+ },
731
+ get ["class"] () {
732
+ return `hover${cardIsHovered_() ? " visible" : ""}`;
733
+ }
734
+ });
735
+ }
736
+ }), null);
737
+ return _el$16;
738
+ }
739
+ })
740
+ });
741
+ }
742
+ })
743
+ ];
744
+ }
745
+ });
746
+ }
747
+ });
748
+ }
749
+ function $29535f590238371c$var$Video(props) {
750
+ // Making some assumptions for shopify here rn, change those if wanting to support other browsers too
751
+ const tabIsVisible = (0, $2MCgq$useVisibilityState)();
752
+ const hlsSource = (0, $2MCgq$createMemo)(()=>props.video_sources_.find((src)=>src.endsWith(".m3u8"))); // Prefer HLS when given by backend and browser supported
753
+ // This is because HLS automatically lets the browser choose both a fitting resolution and quality, depending on video dimensions and network conditions
754
+ const nonHLSSources = (0, $2MCgq$createMemo)(()=>{
755
+ const sources = props.video_sources_?.filter((src)=>!src.endsWith(".m3u8"));
756
+ try {
757
+ $29535f590238371c$var$sortVideoUrlsByQuality(sources);
758
+ } catch (e) {
759
+ (0, $2MCgq$dlog)("Sorting by quality failed", e);
760
+ }
761
+ return sources;
762
+ });
763
+ const productCardIndexAccessor = (0, $2MCgq$useProductCardIndex)();
764
+ const isVisible = (0, $2MCgq$useProductCardIsVisible)();
765
+ const slidableInformation = (0, $2MCgq$useSlidableInformation)();
766
+ const hiddenInImageCarousel = (0, $2MCgq$createMemo)(()=>{
767
+ // Pause video when swiping to the next image
768
+ slidableInformation?.intersectionEntries_(); // Re-check when intersecting entries change
769
+ const intersectingsObject = slidableInformation?.slider_.intersecting_items_object;
770
+ // If intersection observers haven't started yet or we aren't in a slider, we count as visible for faster playback
771
+ if (!intersectingsObject || !Object.keys(intersectingsObject).length) return false;
772
+ // Video is always the first card in the slider
773
+ const ratio = intersectingsObject?.[0]?.intersectionRatio;
774
+ return !ratio;
775
+ });
776
+ return (()=>{
777
+ var _el$17 = $29535f590238371c$var$_tmpl$15();
778
+ (0, $2MCgq$use)((element)=>{
779
+ element.disablePictureInPicture = true;
780
+ (0, $2MCgq$createEffect)(()=>{
781
+ if (isVisible() && tabIsVisible() && !hiddenInImageCarousel()) element.play().catch((e)=>(0, $2MCgq$dwarn)("Error playing video", e));
782
+ else element.pause();
783
+ });
784
+ }, _el$17);
785
+ _el$17.controls = false;
786
+ _el$17.playsInline = true;
787
+ _el$17.loop = true;
788
+ _el$17.muted = true;
789
+ (0, $2MCgq$spread)(_el$17, (0, $2MCgq$mergeProps)({
790
+ get poster () {
791
+ return props.poster_;
792
+ }
793
+ }, ()=>productCardIndexAccessor?.() < 8 && {
794
+ preload: "auto"
795
+ }), false, true);
796
+ (0, $2MCgq$insert)(_el$17, (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
797
+ get when () {
798
+ return hlsSource();
799
+ },
800
+ get children () {
801
+ var _el$18 = $29535f590238371c$var$_tmpl$14();
802
+ (0, $2MCgq$effect)(()=>(0, $2MCgq$setAttribute)(_el$18, "src", hlsSource()));
803
+ return _el$18;
804
+ }
805
+ }), null);
806
+ (0, $2MCgq$insert)(_el$17, (0, $2MCgq$createComponent)((0, $2MCgq$For), {
807
+ get each () {
808
+ return nonHLSSources();
809
+ },
810
+ children: (source)=>(()=>{
811
+ var _el$19 = $29535f590238371c$var$_tmpl$16();
812
+ (0, $2MCgq$setAttribute)(_el$19, "src", source);
813
+ return _el$19;
814
+ })()
815
+ }), null);
816
+ return _el$17;
817
+ })();
818
+ }
819
+ // ChatGPT written
820
+ function $29535f590238371c$var$sortVideoUrlsByQuality(urls) {
821
+ // Function to extract resolution from a URL, assuming format consistency
822
+ function getResolution(url) {
823
+ const match = url.match(/(\d+)p/);
824
+ return match ? parseInt(match[1], 10) : 0;
825
+ }
826
+ // Sort the URLs based on the resolution extracted
827
+ return urls.sort((a, b)=>{
828
+ const resolutionA = getResolution(a);
829
+ const resolutionB = getResolution(b);
830
+ // For descending order, compare B to A
831
+ return resolutionB - resolutionA;
832
+ });
833
+ }
834
+ function $29535f590238371c$var$Prices({ formatPrice_: formatPrice_, configuredOptions_: configuredOptions_, salePrice_: salePrice_, originalPrice_: originalPrice_, ref_: ref_, variantToShow_: variantToShow_, wrapperComponent_: wrapperComponent_ }) {
835
+ // Depict is fetching the prices from Shopify's storefront API on the frontend. This is because getting all prices in all currencies from Shopify be too computationally intensive (~1 million prices for some customers that can change at any time depending on exchange rate).
836
+ // This is why the prices are wrapped in a Promise (we want to render product cards without having to wait for the price request).
837
+ const priceOptions = ()=>configuredOptions_().price;
838
+ const originalPriceOptions = ()=>configuredOptions_().original_price;
839
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
840
+ get when () {
841
+ return priceOptions().enabled;
842
+ },
843
+ get children () {
844
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$InComponentOrDiv, {
845
+ get component_ () {
846
+ return wrapperComponent_();
847
+ },
848
+ class_: "price-container",
849
+ ref_: ref_,
850
+ get children () {
851
+ return [
852
+ (()=>{
853
+ var _el$20 = $29535f590238371c$var$_tmpl$17();
854
+ (0, $2MCgq$use)((el)=>$29535f590238371c$var$setStyleForTextOptions(el, priceOptions), _el$20);
855
+ (0, $2MCgq$insert)(_el$20, (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
856
+ get when () {
857
+ return variantToShow_();
858
+ },
859
+ get fallback () {
860
+ return (0, $2MCgq$createComponent)((0, $2MCgq$TextPlaceholder), {
861
+ height: "1em",
862
+ width: "5ch"
863
+ });
864
+ },
865
+ get children () {
866
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Suspense), {
867
+ get fallback () {
868
+ return (0, $2MCgq$createComponent)((0, $2MCgq$TextPlaceholder), {
869
+ height: "1em",
870
+ width: "5ch"
871
+ });
872
+ },
873
+ get children () {
874
+ return formatPrice_?.(salePrice_());
875
+ }
876
+ });
877
+ }
878
+ }));
879
+ return _el$20;
880
+ })(),
881
+ (0, $2MCgq$createComponent)((0, $2MCgq$Suspense), {
882
+ get children () {
883
+ return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
884
+ get when () {
885
+ return (0, $2MCgq$memo)(()=>originalPrice_() !== salePrice_())() && originalPriceOptions().enabled;
886
+ },
887
+ get children () {
888
+ return [
889
+ " ",
890
+ (()=>{
891
+ var _el$21 = $29535f590238371c$var$_tmpl$18();
892
+ (0, $2MCgq$use)((el)=>$29535f590238371c$var$setStyleForTextOptions(el, originalPriceOptions), _el$21);
893
+ (0, $2MCgq$insert)(_el$21, ()=>formatPrice_?.(originalPrice_()));
894
+ return _el$21;
895
+ })()
896
+ ];
897
+ }
898
+ });
899
+ }
900
+ })
901
+ ];
902
+ }
903
+ });
904
+ }
905
+ });
906
+ }
907
+ function $29535f590238371c$var$isLightColor(anyCssColor) {
908
+ // Source: https://stackoverflow.com/a/47355187
909
+ $29535f590238371c$var$colorCanvasContext ||= document.createElement("canvas").getContext("2d");
910
+ $29535f590238371c$var$colorCanvasContext.fillStyle = anyCssColor;
911
+ const asHex = $29535f590238371c$var$colorCanvasContext.fillStyle;
912
+ // Source: https://stackoverflow.com/a/12043228
913
+ const stripped = asHex.substring(1); // strip #
914
+ const rgb = parseInt(stripped, 16); // convert rrggbb to decimal
915
+ const r = rgb >> 16 & 0xff; // extract red
916
+ const g = rgb >> 8 & 0xff; // extract green
917
+ const b = rgb >> 0 & 0xff; // extract blue
918
+ const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b; // per ITU-R BT.709, apparently between 0 and 255
919
+ return luma > 200;
920
+ }
921
+ // Mostly written by chatGPT
922
+ function $29535f590238371c$var$sortSizes(sizesToSort) {
923
+ const sizeEntries = sizesToSort.map((size)=>{
924
+ const numericMatch = size.match(/^(\d+)(?:\/\d+)?$/);
925
+ if (numericMatch) // It's a numeric size or a range like "44/46", we sort by the first number.
926
+ return {
927
+ size: size,
928
+ numericValue: parseInt(numericMatch[1], 10)
929
+ };
930
+ return {
931
+ size: size
932
+ };
933
+ });
934
+ sizeEntries.sort((a, b)=>{
935
+ const indexA = $29535f590238371c$var$sizeOrder.indexOf(a.size);
936
+ const indexB = $29535f590238371c$var$sizeOrder.indexOf(b.size);
937
+ // Both sizes are in the predefined list
938
+ if (indexA !== -1 && indexB !== -1) return indexA - indexB;
939
+ // Handle numeric and mixed sorting
940
+ if (a.numericValue != null && b.numericValue != null) return a.numericValue - b.numericValue;
941
+ if (a.numericValue != null && indexB === -1) return -1; // numeric values come before unknown text
942
+ if (b.numericValue != null && indexA === -1) return 1; // numeric values come before unknown text
943
+ // Fallback if both are unrecognized, sort alphabetically
944
+ return a.size.localeCompare(b.size);
945
+ });
946
+ return sizeEntries.map((entry)=>entry.size);
947
+ }
948
+ function $29535f590238371c$var$ContainsColorSwatchesProvider(props) {
949
+ const containsSignal = (0, $2MCgq$createSignal)(false);
950
+ return (0, $2MCgq$createComponent)($29535f590238371c$var$ContainsColorSwatchesContext.Provider, {
951
+ value: containsSignal,
952
+ get children () {
953
+ return props.children;
954
+ }
955
+ });
956
+ }
957
+ function $29535f590238371c$var$useContainsColorSwatches() {
958
+ return (0, $2MCgq$useContext)($29535f590238371c$var$ContainsColorSwatchesContext);
959
+ }
960
+ // Work around https://github.com/solidjs/solid/issues/2136 and random shit I thought was an issue before I found https://github.com/solidjs/solid/issues/2137
961
+ function $29535f590238371c$var$InComponentOrDiv(props) {
962
+ const resolved = (0, $2MCgq$children)(()=>props.children);
963
+ return (0, $2MCgq$createMemo)(()=>{
964
+ const Component = props.component_;
965
+ if (Component) // Written like this because the JSX transform mutates our props object: https://github.com/ryansolid/dom-expressions/pull/316#issuecomment-2066925544
966
+ return (0, $2MCgq$createComponent)(Component, {
967
+ get class () {
968
+ return props.class_;
969
+ },
970
+ get ref () {
971
+ return props.ref_;
972
+ },
973
+ children: resolved
974
+ });
975
+ return (()=>{
976
+ var _el$22 = $29535f590238371c$var$_tmpl$11();
977
+ (0, $2MCgq$use)((el)=>props?.ref_?.(el), _el$22);
978
+ (0, $2MCgq$insert)(_el$22, resolved);
979
+ (0, $2MCgq$effect)(()=>(0, $2MCgq$className)(_el$22, props.class_));
980
+ return _el$22;
981
+ })();
982
+ });
983
+ }
984
+ (0, $2MCgq$delegateEvents)([
985
+ "click"
986
+ ]);
987
+
988
+
989
+
990
+ function $474e9d712b745d60$export$d1a48be4967fe67c(react_props) {
991
+ return (0, $0fe03f2fcd2418f8$export$f6e64e17bd69eeef)({
992
+ solid_component: (props_store)=>{
993
+ return (0, $29535f590238371c$export$f11681c54c860912)(()=>props_store.display, {
994
+ set_on_index_change: ()=>{},
995
+ depictCardsDataset: {},
996
+ formatPrice: (price)=>price && (0, $2MCgq$standard_price_format)(price)
997
+ }, ()=>props_store.options);
998
+ },
999
+ // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1000
+ props: structuredClone(react_props),
1001
+ className: "depict"
1002
+ });
1003
+ }
1004
+
1005
+
1006
+
1007
+
1008
+
39
1009
  function $d899f63cec76a884$export$32717ad33b14d079(get_value, get_set_function) {
40
1010
  const return_value = [
41
1011
  get_value,
@@ -220,4 +1190,4 @@ function $8a700ff0722c56b3$export$48787da2a5568bc(react_props) {
220
1190
  (0, $2MCgq$add_to_version_info)("react-ui", (0, $91c11b750e80ede3$export$83d89fbfd8236492));
221
1191
 
222
1192
 
223
- export {$0cb1638b3c084153$export$aea1707d7b01c3a2 as ReactSelectedFilters, $890b58a81f64b470$export$d929db7fb6179159 as ReactFilterBody, $c79c5cb5e9424dd7$export$4ea53cd12ff17334 as ExpandingSection, $8a700ff0722c56b3$export$48787da2a5568bc as ReactLookCard, $91c11b750e80ede3$export$83d89fbfd8236492 as version};
1193
+ export {$474e9d712b745d60$export$d1a48be4967fe67c as ReactDefaultProductCard, $0cb1638b3c084153$export$aea1707d7b01c3a2 as ReactSelectedFilters, $890b58a81f64b470$export$d929db7fb6179159 as ReactFilterBody, $c79c5cb5e9424dd7$export$4ea53cd12ff17334 as ExpandingSection, $8a700ff0722c56b3$export$48787da2a5568bc as ReactLookCard, $91c11b750e80ede3$export$83d89fbfd8236492 as version};