@opensite/ui 0.7.0 → 0.7.2

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.
Files changed (71) hide show
  1. package/dist/blog-cards-read-time.cjs +1 -1
  2. package/dist/blog-cards-read-time.js +1 -1
  3. package/dist/blog-cards-tagline-cta.cjs +1 -1
  4. package/dist/blog-cards-tagline-cta.js +1 -1
  5. package/dist/blog-category-overlay.cjs +1 -1
  6. package/dist/blog-category-overlay.js +1 -1
  7. package/dist/blog-featured-popular.cjs +1 -1
  8. package/dist/blog-featured-popular.js +1 -1
  9. package/dist/blog-grid-author-cards.cjs +1 -1
  10. package/dist/blog-grid-author-cards.js +1 -1
  11. package/dist/blog-grid-nine-posts.cjs +1 -1
  12. package/dist/blog-grid-nine-posts.js +1 -1
  13. package/dist/blog-horizontal-cards.cjs +1 -1
  14. package/dist/blog-horizontal-cards.js +1 -1
  15. package/dist/blog-tech-insights.cjs +54 -45
  16. package/dist/blog-tech-insights.js +54 -45
  17. package/dist/carousel-animated-sections.cjs +1224 -0
  18. package/dist/carousel-animated-sections.d.cts +154 -0
  19. package/dist/carousel-animated-sections.d.ts +154 -0
  20. package/dist/carousel-animated-sections.js +1203 -0
  21. package/dist/carousel-auto-progress-slides.cjs +1156 -0
  22. package/dist/carousel-auto-progress-slides.d.cts +122 -0
  23. package/dist/carousel-auto-progress-slides.d.ts +122 -0
  24. package/dist/carousel-auto-progress-slides.js +1135 -0
  25. package/dist/carousel-autoplay-progress.cjs +1141 -0
  26. package/dist/carousel-autoplay-progress.d.cts +119 -0
  27. package/dist/carousel-autoplay-progress.d.ts +119 -0
  28. package/dist/carousel-autoplay-progress.js +1116 -0
  29. package/dist/carousel-feature-badge.cjs +1216 -0
  30. package/dist/carousel-feature-badge.d.cts +99 -0
  31. package/dist/carousel-feature-badge.d.ts +99 -0
  32. package/dist/carousel-feature-badge.js +1192 -0
  33. package/dist/carousel-fullscreen-scroll-fx.cjs +526 -0
  34. package/dist/carousel-fullscreen-scroll-fx.d.cts +122 -0
  35. package/dist/carousel-fullscreen-scroll-fx.d.ts +122 -0
  36. package/dist/carousel-fullscreen-scroll-fx.js +505 -0
  37. package/dist/carousel-gallery-thumbnails.cjs +1059 -0
  38. package/dist/carousel-gallery-thumbnails.d.cts +122 -0
  39. package/dist/carousel-gallery-thumbnails.d.ts +122 -0
  40. package/dist/carousel-gallery-thumbnails.js +1038 -0
  41. package/dist/carousel-horizontal-cards.cjs +1083 -0
  42. package/dist/carousel-horizontal-cards.d.cts +126 -0
  43. package/dist/carousel-horizontal-cards.d.ts +126 -0
  44. package/dist/carousel-horizontal-cards.js +1062 -0
  45. package/dist/carousel-image-hero.cjs +1075 -0
  46. package/dist/carousel-image-hero.d.cts +116 -0
  47. package/dist/carousel-image-hero.d.ts +116 -0
  48. package/dist/carousel-image-hero.js +1054 -0
  49. package/dist/carousel-multi-step-showcase.cjs +1146 -0
  50. package/dist/carousel-multi-step-showcase.d.cts +142 -0
  51. package/dist/carousel-multi-step-showcase.d.ts +142 -0
  52. package/dist/carousel-multi-step-showcase.js +1125 -0
  53. package/dist/carousel-portfolio-hero.cjs +1063 -0
  54. package/dist/carousel-portfolio-hero.d.cts +134 -0
  55. package/dist/carousel-portfolio-hero.d.ts +134 -0
  56. package/dist/carousel-portfolio-hero.js +1042 -0
  57. package/dist/carousel-product-feature-showcase.cjs +1127 -0
  58. package/dist/carousel-product-feature-showcase.d.cts +161 -0
  59. package/dist/carousel-product-feature-showcase.d.ts +161 -0
  60. package/dist/carousel-product-feature-showcase.js +1106 -0
  61. package/dist/carousel-progress-slider.cjs +597 -0
  62. package/dist/carousel-progress-slider.d.cts +122 -0
  63. package/dist/carousel-progress-slider.d.ts +122 -0
  64. package/dist/carousel-progress-slider.js +576 -0
  65. package/dist/carousel-scrolling-feature-showcase.cjs +530 -0
  66. package/dist/carousel-scrolling-feature-showcase.d.cts +126 -0
  67. package/dist/carousel-scrolling-feature-showcase.d.ts +126 -0
  68. package/dist/carousel-scrolling-feature-showcase.js +509 -0
  69. package/dist/registry.cjs +349 -238
  70. package/dist/registry.js +349 -238
  71. package/package.json +3 -2
@@ -0,0 +1,1116 @@
1
+ "use client";
2
+ import * as React6 from 'react';
3
+ import React6__default from 'react';
4
+ import useEmblaCarousel from 'embla-carousel-react';
5
+ import Autoplay from 'embla-carousel-autoplay';
6
+ import { clsx } from 'clsx';
7
+ import { twMerge } from 'tailwind-merge';
8
+ import { cva } from 'class-variance-authority';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
+ import { Img } from '@page-speed/img';
11
+
12
+ // components/blocks/carousel/carousel-autoplay-progress.tsx
13
+ function cn(...inputs) {
14
+ return twMerge(clsx(inputs));
15
+ }
16
+ function normalizePhoneNumber(input) {
17
+ const trimmed = input.trim();
18
+ if (trimmed.toLowerCase().startsWith("tel:")) {
19
+ return trimmed;
20
+ }
21
+ const match = trimmed.match(/^[\s\+\-\(\)]*(\d[\d\s\-\(\)\.]*\d)[\s\-]*(x|ext\.?|extension)?[\s\-]*(\d+)?$/i);
22
+ if (match) {
23
+ const mainNumber = match[1].replace(/[\s\-\(\)\.]/g, "");
24
+ const extension = match[3];
25
+ const normalized = mainNumber.length >= 10 && !trimmed.startsWith("+") ? `+${mainNumber}` : mainNumber;
26
+ const withExtension = extension ? `${normalized};ext=${extension}` : normalized;
27
+ return `tel:${withExtension}`;
28
+ }
29
+ const cleaned = trimmed.replace(/[\s\-\(\)\.]/g, "");
30
+ return `tel:${cleaned}`;
31
+ }
32
+ function normalizeEmail(input) {
33
+ const trimmed = input.trim();
34
+ if (trimmed.toLowerCase().startsWith("mailto:")) {
35
+ return trimmed;
36
+ }
37
+ return `mailto:${trimmed}`;
38
+ }
39
+ function isEmail(input) {
40
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
41
+ return emailRegex.test(input.trim());
42
+ }
43
+ function isPhoneNumber(input) {
44
+ const trimmed = input.trim();
45
+ if (trimmed.toLowerCase().startsWith("tel:")) {
46
+ return true;
47
+ }
48
+ const phoneRegex = /^[\s\+\-\(\)]*\d[\d\s\-\(\)\.]*\d[\s\-]*(x|ext\.?|extension)?[\s\-]*\d*$/i;
49
+ return phoneRegex.test(trimmed);
50
+ }
51
+ function isInternalUrl(href) {
52
+ if (typeof window === "undefined") {
53
+ return href.startsWith("/") && !href.startsWith("//");
54
+ }
55
+ const trimmed = href.trim();
56
+ if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
57
+ return true;
58
+ }
59
+ try {
60
+ const url = new URL(trimmed, window.location.href);
61
+ const currentOrigin = window.location.origin;
62
+ const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
63
+ return normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin);
64
+ } catch {
65
+ return false;
66
+ }
67
+ }
68
+ function toRelativePath(href) {
69
+ if (typeof window === "undefined") {
70
+ return href;
71
+ }
72
+ const trimmed = href.trim();
73
+ if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
74
+ return trimmed;
75
+ }
76
+ try {
77
+ const url = new URL(trimmed, window.location.href);
78
+ const currentOrigin = window.location.origin;
79
+ const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
80
+ if (normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin)) {
81
+ return url.pathname + url.search + url.hash;
82
+ }
83
+ } catch {
84
+ }
85
+ return trimmed;
86
+ }
87
+ function useNavigation({
88
+ href,
89
+ onClick
90
+ } = {}) {
91
+ const linkType = React6.useMemo(() => {
92
+ if (!href || href.trim() === "") {
93
+ return onClick ? "none" : "none";
94
+ }
95
+ const trimmed = href.trim();
96
+ if (trimmed.toLowerCase().startsWith("mailto:") || isEmail(trimmed)) {
97
+ return "mailto";
98
+ }
99
+ if (trimmed.toLowerCase().startsWith("tel:") || isPhoneNumber(trimmed)) {
100
+ return "tel";
101
+ }
102
+ if (isInternalUrl(trimmed)) {
103
+ return "internal";
104
+ }
105
+ try {
106
+ new URL(trimmed, typeof window !== "undefined" ? window.location.href : "http://localhost");
107
+ return "external";
108
+ } catch {
109
+ return "internal";
110
+ }
111
+ }, [href, onClick]);
112
+ const normalizedHref = React6.useMemo(() => {
113
+ if (!href || href.trim() === "") {
114
+ return void 0;
115
+ }
116
+ const trimmed = href.trim();
117
+ switch (linkType) {
118
+ case "tel":
119
+ return normalizePhoneNumber(trimmed);
120
+ case "mailto":
121
+ return normalizeEmail(trimmed);
122
+ case "internal":
123
+ return toRelativePath(trimmed);
124
+ case "external":
125
+ return trimmed;
126
+ default:
127
+ return trimmed;
128
+ }
129
+ }, [href, linkType]);
130
+ const target = React6.useMemo(() => {
131
+ switch (linkType) {
132
+ case "external":
133
+ return "_blank";
134
+ case "internal":
135
+ return "_self";
136
+ case "mailto":
137
+ case "tel":
138
+ return void 0;
139
+ default:
140
+ return void 0;
141
+ }
142
+ }, [linkType]);
143
+ const rel = React6.useMemo(() => {
144
+ if (linkType === "external") {
145
+ return "noopener noreferrer";
146
+ }
147
+ return void 0;
148
+ }, [linkType]);
149
+ const isExternal = linkType === "external";
150
+ const isInternal = linkType === "internal";
151
+ const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
152
+ const handleClick = React6.useCallback(
153
+ (event) => {
154
+ if (onClick) {
155
+ try {
156
+ onClick(event);
157
+ } catch (error) {
158
+ console.error("Error in user onClick handler:", error);
159
+ }
160
+ }
161
+ if (event.defaultPrevented) {
162
+ return;
163
+ }
164
+ if (shouldUseRouter && normalizedHref && event.button === 0 && // left-click only
165
+ !event.metaKey && !event.altKey && !event.ctrlKey && !event.shiftKey) {
166
+ if (typeof window !== "undefined") {
167
+ const handler = window.__opensiteNavigationHandler;
168
+ if (typeof handler === "function") {
169
+ try {
170
+ const handled = handler(normalizedHref, event.nativeEvent || event);
171
+ if (handled !== false) {
172
+ event.preventDefault();
173
+ }
174
+ } catch (error) {
175
+ console.error("Error in navigation handler:", error);
176
+ }
177
+ }
178
+ }
179
+ }
180
+ },
181
+ [onClick, shouldUseRouter, normalizedHref]
182
+ );
183
+ return {
184
+ linkType,
185
+ normalizedHref,
186
+ target,
187
+ rel,
188
+ isExternal,
189
+ isInternal,
190
+ shouldUseRouter,
191
+ handleClick
192
+ };
193
+ }
194
+ var baseStyles = [
195
+ // Layout
196
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap shrink-0",
197
+ // Typography - using CSS variables with sensible defaults
198
+ "font-[var(--button-font-family,inherit)]",
199
+ "font-[var(--button-font-weight,500)]",
200
+ "tracking-[var(--button-letter-spacing,0)]",
201
+ "leading-[var(--button-line-height,1.25)]",
202
+ "[text-transform:var(--button-text-transform,none)]",
203
+ "text-sm",
204
+ // Border radius
205
+ "rounded-[var(--button-radius,var(--radius,0.375rem))]",
206
+ // Smooth transition - using [transition:...] to set full shorthand property (not just transition-property)
207
+ "[transition:var(--button-transition,all_250ms_cubic-bezier(0.4,0,0.2,1))]",
208
+ // Box shadow (master level) - using [box-shadow:...] for complex multi-value shadows
209
+ "[box-shadow:var(--button-shadow,none)]",
210
+ "hover:[box-shadow:var(--button-shadow-hover,var(--button-shadow,none))]",
211
+ // Disabled state
212
+ "disabled:pointer-events-none disabled:opacity-50",
213
+ // SVG handling
214
+ "[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
215
+ // Focus styles
216
+ "outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
217
+ // Invalid state
218
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
219
+ ].join(" ");
220
+ var buttonVariants = cva(baseStyles, {
221
+ variants: {
222
+ variant: {
223
+ // Default (Primary) variant - full customization
224
+ default: [
225
+ "bg-[var(--button-default-bg,hsl(var(--primary)))]",
226
+ "text-[var(--button-default-fg,hsl(var(--primary-foreground)))]",
227
+ "border-[length:var(--button-default-border-width,0px)]",
228
+ "border-[color:var(--button-default-border,transparent)]",
229
+ "[box-shadow:var(--button-default-shadow,var(--button-shadow,none))]",
230
+ "hover:bg-[var(--button-default-hover-bg,hsl(var(--primary)/0.9))]",
231
+ "hover:text-[var(--button-default-hover-fg,var(--button-default-fg,hsl(var(--primary-foreground))))]",
232
+ "hover:border-[color:var(--button-default-hover-border,var(--button-default-border,transparent))]",
233
+ "hover:[box-shadow:var(--button-default-shadow-hover,var(--button-shadow-hover,var(--button-default-shadow,var(--button-shadow,none))))]"
234
+ ].join(" "),
235
+ // Destructive variant - full customization
236
+ destructive: [
237
+ "bg-[var(--button-destructive-bg,hsl(var(--destructive)))]",
238
+ "text-[var(--button-destructive-fg,white)]",
239
+ "border-[length:var(--button-destructive-border-width,0px)]",
240
+ "border-[color:var(--button-destructive-border,transparent)]",
241
+ "[box-shadow:var(--button-destructive-shadow,var(--button-shadow,none))]",
242
+ "hover:bg-[var(--button-destructive-hover-bg,hsl(var(--destructive)/0.9))]",
243
+ "hover:text-[var(--button-destructive-hover-fg,var(--button-destructive-fg,white))]",
244
+ "hover:border-[color:var(--button-destructive-hover-border,var(--button-destructive-border,transparent))]",
245
+ "hover:[box-shadow:var(--button-destructive-shadow-hover,var(--button-shadow-hover,var(--button-destructive-shadow,var(--button-shadow,none))))]",
246
+ "focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
247
+ "dark:bg-destructive/60"
248
+ ].join(" "),
249
+ // Outline variant - full customization with proper border handling
250
+ outline: [
251
+ "bg-[var(--button-outline-bg,hsl(var(--background)))]",
252
+ "text-[var(--button-outline-fg,inherit)]",
253
+ "border-[length:var(--button-outline-border-width,1px)]",
254
+ "border-[color:var(--button-outline-border,hsl(var(--border)))]",
255
+ "[box-shadow:var(--button-outline-shadow,var(--button-shadow,0_1px_2px_0_rgb(0_0_0/0.05)))]",
256
+ "hover:bg-[var(--button-outline-hover-bg,hsl(var(--accent)))]",
257
+ "hover:text-[var(--button-outline-hover-fg,hsl(var(--accent-foreground)))]",
258
+ "hover:border-[color:var(--button-outline-hover-border,var(--button-outline-border,hsl(var(--border))))]",
259
+ "hover:[box-shadow:var(--button-outline-shadow-hover,var(--button-shadow-hover,var(--button-outline-shadow,var(--button-shadow,none))))]",
260
+ "dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
261
+ ].join(" "),
262
+ // Secondary variant - full customization
263
+ secondary: [
264
+ "bg-[var(--button-secondary-bg,hsl(var(--secondary)))]",
265
+ "text-[var(--button-secondary-fg,hsl(var(--secondary-foreground)))]",
266
+ "border-[length:var(--button-secondary-border-width,0px)]",
267
+ "border-[color:var(--button-secondary-border,transparent)]",
268
+ "[box-shadow:var(--button-secondary-shadow,var(--button-shadow,none))]",
269
+ "hover:bg-[var(--button-secondary-hover-bg,hsl(var(--secondary)/0.8))]",
270
+ "hover:text-[var(--button-secondary-hover-fg,var(--button-secondary-fg,hsl(var(--secondary-foreground))))]",
271
+ "hover:border-[color:var(--button-secondary-hover-border,var(--button-secondary-border,transparent))]",
272
+ "hover:[box-shadow:var(--button-secondary-shadow-hover,var(--button-shadow-hover,var(--button-secondary-shadow,var(--button-shadow,none))))]"
273
+ ].join(" "),
274
+ // Ghost variant - full customization
275
+ ghost: [
276
+ "bg-[var(--button-ghost-bg,transparent)]",
277
+ "text-[var(--button-ghost-fg,inherit)]",
278
+ "border-[length:var(--button-ghost-border-width,0px)]",
279
+ "border-[color:var(--button-ghost-border,transparent)]",
280
+ "[box-shadow:var(--button-ghost-shadow,var(--button-shadow,none))]",
281
+ "hover:bg-[var(--button-ghost-hover-bg,hsl(var(--accent)))]",
282
+ "hover:text-[var(--button-ghost-hover-fg,hsl(var(--accent-foreground)))]",
283
+ "hover:border-[color:var(--button-ghost-hover-border,var(--button-ghost-border,transparent))]",
284
+ "hover:[box-shadow:var(--button-ghost-shadow-hover,var(--button-shadow-hover,var(--button-ghost-shadow,var(--button-shadow,none))))]",
285
+ "dark:hover:bg-accent/50"
286
+ ].join(" "),
287
+ // Link variant - full customization
288
+ link: [
289
+ "bg-[var(--button-link-bg,transparent)]",
290
+ "text-[var(--button-link-fg,hsl(var(--primary)))]",
291
+ "border-[length:var(--button-link-border-width,0px)]",
292
+ "border-[color:var(--button-link-border,transparent)]",
293
+ "[box-shadow:var(--button-link-shadow,none)]",
294
+ "hover:bg-[var(--button-link-hover-bg,transparent)]",
295
+ "hover:text-[var(--button-link-hover-fg,var(--button-link-fg,hsl(var(--primary))))]",
296
+ "hover:[box-shadow:var(--button-link-shadow-hover,none)]",
297
+ "underline-offset-4 hover:underline"
298
+ ].join(" ")
299
+ },
300
+ size: {
301
+ default: [
302
+ "h-[var(--button-height-md,2.25rem)]",
303
+ "px-[var(--button-padding-x-md,1rem)]",
304
+ "py-[var(--button-padding-y-md,0.5rem)]",
305
+ "has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
306
+ ].join(" "),
307
+ sm: [
308
+ "h-[var(--button-height-sm,2rem)]",
309
+ "px-[var(--button-padding-x-sm,0.75rem)]",
310
+ "py-[var(--button-padding-y-sm,0.25rem)]",
311
+ "gap-1.5",
312
+ "has-[>svg]:px-[calc(var(--button-padding-x-sm,0.75rem)*0.83)]"
313
+ ].join(" "),
314
+ md: [
315
+ "h-[var(--button-height-md,2.25rem)]",
316
+ "px-[var(--button-padding-x-md,1rem)]",
317
+ "py-[var(--button-padding-y-md,0.5rem)]",
318
+ "has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
319
+ ].join(" "),
320
+ lg: [
321
+ "h-[var(--button-height-lg,2.5rem)]",
322
+ "px-[var(--button-padding-x-lg,1.5rem)]",
323
+ "py-[var(--button-padding-y-lg,0.5rem)]",
324
+ "has-[>svg]:px-[calc(var(--button-padding-x-lg,1.5rem)*0.67)]"
325
+ ].join(" "),
326
+ icon: "size-[var(--button-height-md,2.25rem)]",
327
+ "icon-sm": "size-[var(--button-height-sm,2rem)]",
328
+ "icon-lg": "size-[var(--button-height-lg,2.5rem)]"
329
+ }
330
+ },
331
+ defaultVariants: {
332
+ variant: "default",
333
+ size: "default"
334
+ }
335
+ });
336
+ var Pressable = React6.forwardRef(
337
+ ({
338
+ children,
339
+ className,
340
+ href,
341
+ onClick,
342
+ variant,
343
+ size,
344
+ asButton = false,
345
+ fallbackComponentType = "span",
346
+ componentType,
347
+ "aria-label": ariaLabel,
348
+ "aria-describedby": ariaDescribedby,
349
+ id,
350
+ ...props
351
+ }, ref) => {
352
+ const navigation = useNavigation({ href, onClick });
353
+ const {
354
+ normalizedHref,
355
+ target,
356
+ rel,
357
+ linkType,
358
+ isInternal,
359
+ handleClick
360
+ } = navigation;
361
+ const shouldRenderLink = normalizedHref && linkType !== "none";
362
+ const shouldRenderButton = !shouldRenderLink && onClick;
363
+ const effectiveComponentType = componentType || (shouldRenderLink ? "a" : shouldRenderButton ? "button" : fallbackComponentType);
364
+ const finalComponentType = isInternal && shouldRenderLink ? "a" : effectiveComponentType;
365
+ const shouldApplyButtonStyles = asButton || variant || size;
366
+ const combinedClassName = cn(
367
+ shouldApplyButtonStyles && buttonVariants({ variant, size }),
368
+ className
369
+ );
370
+ const dataProps = Object.fromEntries(
371
+ Object.entries(props).filter(([key]) => key.startsWith("data-"))
372
+ );
373
+ const buttonDataAttributes = shouldApplyButtonStyles ? {
374
+ "data-slot": "button",
375
+ "data-variant": variant ?? "default",
376
+ "data-size": size ?? "default"
377
+ } : {};
378
+ const commonProps = {
379
+ className: combinedClassName,
380
+ onClick: handleClick,
381
+ "aria-label": ariaLabel,
382
+ "aria-describedby": ariaDescribedby,
383
+ id,
384
+ ...dataProps,
385
+ ...buttonDataAttributes
386
+ };
387
+ if (finalComponentType === "a" && shouldRenderLink) {
388
+ return /* @__PURE__ */ jsx(
389
+ "a",
390
+ {
391
+ ref,
392
+ href: normalizedHref,
393
+ target,
394
+ rel,
395
+ ...commonProps,
396
+ ...props,
397
+ children
398
+ }
399
+ );
400
+ }
401
+ if (finalComponentType === "button") {
402
+ return /* @__PURE__ */ jsx(
403
+ "button",
404
+ {
405
+ ref,
406
+ type: props.type || "button",
407
+ ...commonProps,
408
+ ...props,
409
+ children
410
+ }
411
+ );
412
+ }
413
+ if (finalComponentType === "div") {
414
+ return /* @__PURE__ */ jsx(
415
+ "div",
416
+ {
417
+ ref,
418
+ ...commonProps,
419
+ children
420
+ }
421
+ );
422
+ }
423
+ return /* @__PURE__ */ jsx(
424
+ "span",
425
+ {
426
+ ref,
427
+ ...commonProps,
428
+ children
429
+ }
430
+ );
431
+ }
432
+ );
433
+ Pressable.displayName = "Pressable";
434
+ var svgCache = /* @__PURE__ */ new Map();
435
+ function DynamicIcon({
436
+ name,
437
+ size = 28,
438
+ color,
439
+ className,
440
+ alt
441
+ }) {
442
+ const [svgContent, setSvgContent] = React6.useState(null);
443
+ const [isLoading, setIsLoading] = React6.useState(true);
444
+ const [error, setError] = React6.useState(null);
445
+ const { url, iconName } = React6.useMemo(() => {
446
+ const separator = name.includes("/") ? "/" : ":";
447
+ const [prefix, iconName2] = name.split(separator);
448
+ const baseUrl = `https://icons.opensite.ai/api/icon/${prefix}/${iconName2}?format=svg&width=${size}&height=${size}`;
449
+ return {
450
+ url: baseUrl,
451
+ iconName: iconName2
452
+ };
453
+ }, [name, size]);
454
+ React6.useEffect(() => {
455
+ let isMounted = true;
456
+ const fetchSvg = async () => {
457
+ const cached = svgCache.get(url);
458
+ if (cached) {
459
+ if (isMounted) {
460
+ setSvgContent(cached);
461
+ setIsLoading(false);
462
+ }
463
+ return;
464
+ }
465
+ try {
466
+ setIsLoading(true);
467
+ setError(null);
468
+ const response = await fetch(url);
469
+ if (!response.ok) {
470
+ throw new Error(`Failed to fetch icon: ${response.status}`);
471
+ }
472
+ let svg = await response.text();
473
+ svg = processSvgForCurrentColor(svg);
474
+ svgCache.set(url, svg);
475
+ if (isMounted) {
476
+ setSvgContent(svg);
477
+ setIsLoading(false);
478
+ }
479
+ } catch (err) {
480
+ if (isMounted) {
481
+ setError(err instanceof Error ? err.message : "Failed to load icon");
482
+ setIsLoading(false);
483
+ }
484
+ }
485
+ };
486
+ fetchSvg();
487
+ return () => {
488
+ isMounted = false;
489
+ };
490
+ }, [url]);
491
+ if (isLoading) {
492
+ return /* @__PURE__ */ jsx(
493
+ "span",
494
+ {
495
+ className: cn("inline-block", className),
496
+ style: { width: size, height: size },
497
+ "aria-hidden": "true"
498
+ }
499
+ );
500
+ }
501
+ if (error || !svgContent) {
502
+ return /* @__PURE__ */ jsx(
503
+ "span",
504
+ {
505
+ className: cn("inline-block", className),
506
+ style: { width: size, height: size },
507
+ role: "img",
508
+ "aria-label": alt || iconName
509
+ }
510
+ );
511
+ }
512
+ return /* @__PURE__ */ jsx(
513
+ "span",
514
+ {
515
+ className: cn("inline-flex items-center justify-center", className),
516
+ style: {
517
+ width: size,
518
+ height: size,
519
+ color: color || "inherit"
520
+ },
521
+ role: "img",
522
+ "aria-label": alt || iconName,
523
+ dangerouslySetInnerHTML: { __html: svgContent }
524
+ }
525
+ );
526
+ }
527
+ function processSvgForCurrentColor(svg) {
528
+ let processed = svg;
529
+ processed = processed.replace(
530
+ /stroke=["'](#000000|#000|black)["']/gi,
531
+ 'stroke="currentColor"'
532
+ );
533
+ processed = processed.replace(
534
+ /fill=["'](#000000|#000|black)["']/gi,
535
+ 'fill="currentColor"'
536
+ );
537
+ return processed;
538
+ }
539
+ var maxWidthStyles = {
540
+ sm: "max-w-screen-sm",
541
+ md: "max-w-screen-md",
542
+ lg: "max-w-screen-lg",
543
+ xl: "max-w-7xl",
544
+ "2xl": "max-w-screen-2xl",
545
+ "4xl": "max-w-[1536px]",
546
+ full: "max-w-full"
547
+ };
548
+ var Container = React6__default.forwardRef(
549
+ ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
550
+ const Component = as;
551
+ return /* @__PURE__ */ jsx(
552
+ Component,
553
+ {
554
+ ref,
555
+ className: cn(
556
+ "mx-auto w-full px-2 sm:px-4 lg:px-8",
557
+ maxWidthStyles[maxWidth],
558
+ className
559
+ ),
560
+ ...props,
561
+ children
562
+ }
563
+ );
564
+ }
565
+ );
566
+ Container.displayName = "Container";
567
+
568
+ // lib/patternSvgs.ts
569
+ var patternSvgs = {
570
+ squareAltGrid: "https://cdn.ing/assets/files/record/286187/4gpn0yq2ptra8iwlvmwwv860ggwv",
571
+ grid1: "https://cdn.ing/assets/files/record/286186/nbdflpgp4ostrno079hygibsflp3",
572
+ noise: "https://cdn.ing/assets/i/r/286188/zrqcp9hynh3j7p2laihwzfbujgrl/noise.png",
573
+ dots: "https://cdn.ing/assets/files/record/286198/yfsjx9thvtxzhl2qtshxyhkrm524",
574
+ dotPattern: "https://cdn.ing/assets/files/record/286192/7ig0cku8aqbboiza8nuk6hw0nnsr",
575
+ dotPattern2: "https://cdn.ing/assets/files/record/286189/arez6gd2s7isn9i1o6c7sexdq7bl",
576
+ circles: "https://cdn.ing/assets/files/record/286190/gtmia3sncjtzetdshc20zf1d3c17",
577
+ waves: "https://cdn.ing/assets/files/record/286191/mqlb33fzxz9cdth1bx7if0wmpkp1",
578
+ crossPattern: "https://cdn.ing/assets/files/record/286193/9yfqwdbnqaipbp7fsb3wbzzmq472",
579
+ architect: "https://cdn.ing/assets/files/record/286194/vgs88ugpvyhxu13wqgy0acvae6re",
580
+ tinyCheckers: "https://cdn.ing/assets/files/record/286195/65efaknsw8kcpf9o3c2gybytsl5b",
581
+ p6: "https://cdn.ing/assets/i/r/286196/6kl0rqnd6mjk8j7e525fo8fo0vkc/p6.webp"
582
+ };
583
+ var maskTop = "radial-gradient(ellipse 70% 60% at 50% 0%, #000 60%, transparent 100%)";
584
+ var maskBottom = "radial-gradient(ellipse 100% 80% at 50% 100%, #000 50%, transparent 90%)";
585
+ var maskCenter = "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 70%)";
586
+ var maskTopLeft = "radial-gradient(ellipse 80% 80% at 0% 0%, #000 50%, transparent 90%)";
587
+ var maskTopRight = "radial-gradient(ellipse 80% 80% at 100% 0%, #000 50%, transparent 90%)";
588
+ var maskBottomLeft = "radial-gradient(ellipse 80% 80% at 0% 100%, #000 50%, transparent 90%)";
589
+ var maskBottomRight = "radial-gradient(ellipse 80% 80% at 100% 100%, #000 50%, transparent 90%)";
590
+ var circuitBoardPattern = (id, mask) => /* @__PURE__ */ jsxs(
591
+ "svg",
592
+ {
593
+ className: "h-full w-full",
594
+ xmlns: "http://www.w3.org/2000/svg",
595
+ style: mask ? {
596
+ maskImage: mask,
597
+ WebkitMaskImage: mask
598
+ } : void 0,
599
+ children: [
600
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
601
+ "pattern",
602
+ {
603
+ id,
604
+ x: "0",
605
+ y: "0",
606
+ width: "100",
607
+ height: "100",
608
+ patternUnits: "userSpaceOnUse",
609
+ children: [
610
+ /* @__PURE__ */ jsx(
611
+ "path",
612
+ {
613
+ d: "M0 50h40M60 50h40M50 0v40M50 60v40",
614
+ stroke: "hsl(var(--muted))",
615
+ strokeWidth: "1",
616
+ fill: "none"
617
+ }
618
+ ),
619
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "50", r: "3", fill: "hsl(var(--muted))" }),
620
+ /* @__PURE__ */ jsx("circle", { cx: "0", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
621
+ /* @__PURE__ */ jsx("circle", { cx: "100", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
622
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "0", r: "2", fill: "hsl(var(--muted))" }),
623
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "100", r: "2", fill: "hsl(var(--muted))" })
624
+ ]
625
+ }
626
+ ) }),
627
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
628
+ ]
629
+ }
630
+ );
631
+ var gridDotsPattern = (id, mask) => /* @__PURE__ */ jsxs(
632
+ "svg",
633
+ {
634
+ className: "h-full w-full",
635
+ xmlns: "http://www.w3.org/2000/svg",
636
+ style: mask ? {
637
+ maskImage: mask,
638
+ WebkitMaskImage: mask
639
+ } : void 0,
640
+ children: [
641
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
642
+ "pattern",
643
+ {
644
+ id,
645
+ x: "0",
646
+ y: "0",
647
+ width: "40",
648
+ height: "40",
649
+ patternUnits: "userSpaceOnUse",
650
+ children: [
651
+ /* @__PURE__ */ jsx(
652
+ "path",
653
+ {
654
+ d: "M0 20h40M20 0v40",
655
+ stroke: "hsl(var(--muted))",
656
+ strokeWidth: "0.5",
657
+ fill: "none"
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsx("circle", { cx: "20", cy: "20", r: "2", fill: "hsl(var(--muted))" })
661
+ ]
662
+ }
663
+ ) }),
664
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
665
+ ]
666
+ }
667
+ );
668
+ var gridPattern = (size, mask) => /* @__PURE__ */ jsx(
669
+ "div",
670
+ {
671
+ className: "h-full w-full bg-[linear-gradient(to_right,_hsl(var(--muted))_1px,_transparent_1px),linear-gradient(to_bottom,_hsl(var(--muted))_1px,_transparent_1px)]",
672
+ style: {
673
+ backgroundSize: `${size}px ${size}px`,
674
+ ...mask ? {
675
+ maskImage: mask,
676
+ WebkitMaskImage: mask
677
+ } : {}
678
+ }
679
+ }
680
+ );
681
+ var diagonalCrossPattern = (mask) => /* @__PURE__ */ jsx(
682
+ "div",
683
+ {
684
+ className: "h-full w-full",
685
+ style: {
686
+ backgroundImage: "repeating-linear-gradient(45deg, transparent, transparent 32px, hsl(var(--muted)) 32px, hsl(var(--muted)) 33px), repeating-linear-gradient(135deg, transparent, transparent 32px, hsl(var(--muted)) 32px, hsl(var(--muted)) 33px)",
687
+ ...mask ? {
688
+ maskImage: mask,
689
+ WebkitMaskImage: mask
690
+ } : {}
691
+ }
692
+ }
693
+ );
694
+ var dashedGridMaskBase = "repeating-linear-gradient(to right, black 0px, black 3px, transparent 3px, transparent 8px), repeating-linear-gradient(to bottom, black 0px, black 3px, transparent 3px, transparent 8px)";
695
+ var dashedGridPattern = (fadeMask) => {
696
+ const mask = fadeMask ? `${dashedGridMaskBase}, ${fadeMask}` : dashedGridMaskBase;
697
+ return /* @__PURE__ */ jsx(
698
+ "div",
699
+ {
700
+ className: "h-full w-full",
701
+ style: {
702
+ backgroundImage: "linear-gradient(to right, hsl(var(--muted)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--muted)) 1px, transparent 1px)",
703
+ backgroundSize: "20px 20px",
704
+ backgroundPosition: "0 0, 0 0",
705
+ maskImage: mask,
706
+ WebkitMaskImage: mask,
707
+ maskComposite: "intersect",
708
+ WebkitMaskComposite: "source-in"
709
+ }
710
+ }
711
+ );
712
+ };
713
+ var gradientGlow = (position) => /* @__PURE__ */ jsx(
714
+ "div",
715
+ {
716
+ className: cn(
717
+ "pointer-events-none absolute left-1/2 z-0 aspect-square w-3/4 -translate-x-1/2 rounded-full opacity-50 blur-3xl",
718
+ position === "top" ? "-top-1/4" : "-bottom-1/4"
719
+ ),
720
+ style: {
721
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
722
+ }
723
+ }
724
+ );
725
+ var spotlight = (position) => /* @__PURE__ */ jsx(
726
+ "div",
727
+ {
728
+ className: cn(
729
+ "pointer-events-none absolute top-1/2 z-0 aspect-square w-3/4 -translate-y-1/2 rounded-full opacity-40 blur-3xl",
730
+ position === "left" ? "-left-1/4" : "-right-1/4"
731
+ ),
732
+ style: {
733
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
734
+ }
735
+ }
736
+ );
737
+ var patternOverlays = {
738
+ circuitBoardBasic: () => circuitBoardPattern("circuit-board-basic"),
739
+ circuitBoardFadeTop: () => circuitBoardPattern("circuit-board-fade-top", maskTop),
740
+ circuitBoardFadeBottom: () => circuitBoardPattern("circuit-board-fade-bottom", maskBottom),
741
+ circuitBoardFadeCenter: () => circuitBoardPattern("circuit-board-fade-center", maskCenter),
742
+ circuitBoardFadeTopLeft: () => circuitBoardPattern("circuit-board-fade-top-left", maskTopLeft),
743
+ circuitBoardFadeTopRight: () => circuitBoardPattern("circuit-board-fade-top-right", maskTopRight),
744
+ circuitBoardFadeBottomLeft: () => circuitBoardPattern("circuit-board-fade-bottom-left", maskBottomLeft),
745
+ circuitBoardFadeBottomRight: () => circuitBoardPattern("circuit-board-fade-bottom-right", maskBottomRight),
746
+ dashedGridBasic: () => dashedGridPattern(),
747
+ dashedGridFadeTop: () => dashedGridPattern(maskTop),
748
+ dashedGridFadeBottom: () => dashedGridPattern(maskBottom),
749
+ dashedGridFadeCenter: () => dashedGridPattern(maskCenter),
750
+ dashedGridFadeTopLeft: () => dashedGridPattern(maskTopLeft),
751
+ dashedGridFadeTopRight: () => dashedGridPattern(maskTopRight),
752
+ dashedGridFadeBottomLeft: () => dashedGridPattern(maskBottomLeft),
753
+ dashedGridFadeBottomRight: () => dashedGridPattern(maskBottomRight),
754
+ diagonalCrossBasic: () => diagonalCrossPattern(),
755
+ diagonalCrossFadeTop: () => diagonalCrossPattern(maskTop),
756
+ diagonalCrossFadeBottom: () => diagonalCrossPattern(maskBottom),
757
+ diagonalCrossFadeCenter: () => diagonalCrossPattern(maskCenter),
758
+ diagonalCrossFadeTopLeft: () => diagonalCrossPattern(maskTopLeft),
759
+ diagonalCrossFadeTopRight: () => diagonalCrossPattern(maskTopRight),
760
+ diagonalCrossFadeBottomLeft: () => diagonalCrossPattern(maskBottomLeft),
761
+ diagonalCrossFadeBottomRight: () => diagonalCrossPattern(maskBottomRight),
762
+ gridBasic: () => gridPattern(40),
763
+ gridFadeTop: () => gridPattern(32, maskTop),
764
+ gridFadeBottom: () => gridPattern(32, maskBottom),
765
+ gridFadeCenter: () => gridPattern(40, maskCenter),
766
+ gridFadeTopLeft: () => gridPattern(32, maskTopLeft),
767
+ gridFadeTopRight: () => gridPattern(32, maskTopRight),
768
+ gridFadeBottomLeft: () => gridPattern(32, maskBottomLeft),
769
+ gridFadeBottomRight: () => gridPattern(32, maskBottomRight),
770
+ gridDotsBasic: () => gridDotsPattern("grid-dots-basic"),
771
+ gridDotsFadeCenter: () => gridDotsPattern("grid-dots-fade-center", maskCenter),
772
+ gradientGlowTop: () => gradientGlow("top"),
773
+ gradientGlowBottom: () => gradientGlow("bottom"),
774
+ spotlightLeft: () => spotlight("left"),
775
+ spotlightRight: () => spotlight("right")
776
+ };
777
+ var inlinePatternStyles = {
778
+ radialGradientTop: {
779
+ background: "radial-gradient(125% 125% at 50% 10%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
780
+ },
781
+ radialGradientBottom: {
782
+ background: "radial-gradient(125% 125% at 50% 90%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
783
+ }
784
+ };
785
+ function PatternBackground({
786
+ pattern,
787
+ opacity = 0.08,
788
+ className,
789
+ style
790
+ }) {
791
+ if (!pattern) {
792
+ return null;
793
+ }
794
+ if (pattern in inlinePatternStyles) {
795
+ const inlineStyle = inlinePatternStyles[pattern];
796
+ return /* @__PURE__ */ jsx(
797
+ "div",
798
+ {
799
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
800
+ style: { ...inlineStyle, opacity, ...style },
801
+ "aria-hidden": "true"
802
+ }
803
+ );
804
+ }
805
+ if (pattern in patternOverlays) {
806
+ const Overlay = patternOverlays[pattern];
807
+ return /* @__PURE__ */ jsx(
808
+ "div",
809
+ {
810
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
811
+ style: { opacity, ...style },
812
+ "aria-hidden": "true",
813
+ children: Overlay()
814
+ }
815
+ );
816
+ }
817
+ const patternUrl = pattern in patternSvgs ? patternSvgs[pattern] : pattern;
818
+ return /* @__PURE__ */ jsx(
819
+ "div",
820
+ {
821
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
822
+ style: {
823
+ backgroundImage: `url(${patternUrl})`,
824
+ backgroundRepeat: "repeat",
825
+ backgroundSize: "auto",
826
+ opacity,
827
+ ...style
828
+ },
829
+ "aria-hidden": "true"
830
+ }
831
+ );
832
+ }
833
+ var backgroundStyles = {
834
+ default: "bg-background text-foreground",
835
+ white: "bg-white text-dark",
836
+ gray: "bg-muted/30 text-foreground",
837
+ dark: "bg-foreground text-background",
838
+ transparent: "bg-transparent text-foreground",
839
+ gradient: "bg-linear-to-br from-primary via-primary/90 to-foreground text-primary-foreground",
840
+ primary: "bg-primary text-primary-foreground",
841
+ secondary: "bg-secondary text-secondary-foreground",
842
+ muted: "bg-muted text-muted-foreground"
843
+ };
844
+ var spacingStyles = {
845
+ none: "py-0 md:py-0",
846
+ sm: "py-12 md:py-16",
847
+ md: "py-16 md:py-24",
848
+ lg: "py-20 md:py-32",
849
+ xl: "py-24 md:py-40"
850
+ };
851
+ var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
852
+ var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
853
+ var Section = React6__default.forwardRef(
854
+ ({
855
+ id,
856
+ title,
857
+ subtitle,
858
+ children,
859
+ className,
860
+ style,
861
+ background = "default",
862
+ spacing = "lg",
863
+ pattern,
864
+ patternOpacity,
865
+ patternClassName,
866
+ containerClassName,
867
+ containerMaxWidth = "xl",
868
+ ...props
869
+ }, ref) => {
870
+ const effectivePatternOpacity = patternOpacity !== void 0 ? patternOpacity : pattern ? 1 : 0;
871
+ return /* @__PURE__ */ jsxs(
872
+ "section",
873
+ {
874
+ ref,
875
+ id,
876
+ className: cn(
877
+ "relative",
878
+ pattern ? "overflow-hidden" : null,
879
+ backgroundStyles[background],
880
+ isPredefinedSpacing(spacing) ? spacingStyles[spacing] : spacing,
881
+ className
882
+ ),
883
+ style,
884
+ ...props,
885
+ children: [
886
+ /* @__PURE__ */ jsx(
887
+ PatternBackground,
888
+ {
889
+ pattern,
890
+ opacity: effectivePatternOpacity,
891
+ className: patternClassName
892
+ }
893
+ ),
894
+ /* @__PURE__ */ jsxs(
895
+ Container,
896
+ {
897
+ maxWidth: containerMaxWidth,
898
+ className: cn("relative z-10", containerClassName),
899
+ children: [
900
+ (title || subtitle) && /* @__PURE__ */ jsxs("div", { className: "mb-12 text-center md:mb-16", children: [
901
+ subtitle && /* @__PURE__ */ jsx("p", { className: "mb-2 text-sm font-semibold uppercase tracking-wider text-primary", children: subtitle }),
902
+ title && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl", children: title })
903
+ ] }),
904
+ children
905
+ ]
906
+ }
907
+ )
908
+ ]
909
+ }
910
+ );
911
+ }
912
+ );
913
+ Section.displayName = "Section";
914
+ function useDotButton(emblaApi) {
915
+ const [selectedIndex, setSelectedIndex] = React6.useState(0);
916
+ const [scrollSnaps, setScrollSnaps] = React6.useState([]);
917
+ const onDotButtonClick = React6.useCallback(
918
+ (index) => {
919
+ if (!emblaApi) return;
920
+ emblaApi.scrollTo(index);
921
+ },
922
+ [emblaApi]
923
+ );
924
+ const onInit = React6.useCallback((api) => {
925
+ setScrollSnaps(api.scrollSnapList());
926
+ }, []);
927
+ const onSelect = React6.useCallback((api) => {
928
+ setSelectedIndex(api.selectedScrollSnap());
929
+ }, []);
930
+ React6.useEffect(() => {
931
+ if (!emblaApi) return;
932
+ onInit(emblaApi);
933
+ onSelect(emblaApi);
934
+ emblaApi.on("reInit", onInit).on("reInit", onSelect).on("select", onSelect);
935
+ }, [emblaApi, onInit, onSelect]);
936
+ return { selectedIndex, scrollSnaps, onDotButtonClick };
937
+ }
938
+ function useAutoplay(emblaApi) {
939
+ const [autoplayIsPlaying, setAutoplayIsPlaying] = React6.useState(false);
940
+ const onAutoplayButtonClick = React6.useCallback(
941
+ (callback) => {
942
+ const autoplay = emblaApi?.plugins()?.autoplay;
943
+ if (!autoplay) return;
944
+ const resetOrStop = autoplay.options.stopOnInteraction === false ? autoplay.reset : autoplay.stop;
945
+ resetOrStop();
946
+ callback();
947
+ },
948
+ [emblaApi]
949
+ );
950
+ const toggleAutoplay = React6.useCallback(() => {
951
+ const autoplay = emblaApi?.plugins()?.autoplay;
952
+ if (!autoplay) return;
953
+ const playOrStop = autoplay.isPlaying() ? autoplay.stop : autoplay.play;
954
+ playOrStop();
955
+ }, [emblaApi]);
956
+ React6.useEffect(() => {
957
+ const autoplay = emblaApi?.plugins()?.autoplay;
958
+ if (!autoplay) return;
959
+ setAutoplayIsPlaying(autoplay.isPlaying());
960
+ emblaApi.on("autoplay:play", () => setAutoplayIsPlaying(true)).on("autoplay:stop", () => setAutoplayIsPlaying(false)).on("reInit", () => setAutoplayIsPlaying(autoplay.isPlaying()));
961
+ }, [emblaApi]);
962
+ return { autoplayIsPlaying, toggleAutoplay, onAutoplayButtonClick };
963
+ }
964
+ function useAutoplayProgress(emblaApi, progressNode) {
965
+ const [showAutoplayProgress, setShowAutoplayProgress] = React6.useState(false);
966
+ const animationName = React6.useRef("");
967
+ const timeoutId = React6.useRef(0);
968
+ const rafId = React6.useRef(0);
969
+ const startProgress = React6.useCallback(
970
+ (timeUntilNext) => {
971
+ const node = progressNode.current;
972
+ if (!node || timeUntilNext === null) return;
973
+ if (!animationName.current) {
974
+ const style = window.getComputedStyle(node);
975
+ animationName.current = style.animationName;
976
+ }
977
+ node.style.animationName = "none";
978
+ node.style.transform = "translate3d(0,0,0)";
979
+ rafId.current = window.requestAnimationFrame(() => {
980
+ timeoutId.current = window.setTimeout(() => {
981
+ node.style.animationName = animationName.current;
982
+ node.style.animationDuration = `${timeUntilNext}ms`;
983
+ }, 0);
984
+ });
985
+ setShowAutoplayProgress(true);
986
+ },
987
+ [progressNode]
988
+ );
989
+ React6.useEffect(() => {
990
+ const autoplay = emblaApi?.plugins()?.autoplay;
991
+ if (!autoplay) return;
992
+ emblaApi.on("autoplay:timerset", () => startProgress(autoplay.timeUntilNext())).on("autoplay:timerstopped", () => setShowAutoplayProgress(false));
993
+ }, [emblaApi, startProgress]);
994
+ React6.useEffect(() => {
995
+ return () => {
996
+ cancelAnimationFrame(rafId.current);
997
+ clearTimeout(timeoutId.current);
998
+ };
999
+ }, []);
1000
+ return { showAutoplayProgress };
1001
+ }
1002
+ function CarouselAutoplayProgress({
1003
+ slides,
1004
+ slidesSlot,
1005
+ options,
1006
+ autoplayDelay = 3e3,
1007
+ className,
1008
+ containerClassName,
1009
+ trackClassName,
1010
+ slideClassName,
1011
+ imageClassName,
1012
+ controlsClassName,
1013
+ dotsClassName,
1014
+ progressClassName,
1015
+ optixFlowConfig,
1016
+ background = "white",
1017
+ spacing = "xl",
1018
+ pattern,
1019
+ patternOpacity
1020
+ }) {
1021
+ const progressNode = React6.useRef(null);
1022
+ const [emblaRef, emblaApi] = useEmblaCarousel(options, [
1023
+ Autoplay({ playOnInit: true, delay: autoplayDelay })
1024
+ ]);
1025
+ const { autoplayIsPlaying, toggleAutoplay, onAutoplayButtonClick } = useAutoplay(emblaApi);
1026
+ const { showAutoplayProgress } = useAutoplayProgress(emblaApi, progressNode);
1027
+ const { selectedIndex, scrollSnaps, onDotButtonClick } = useDotButton(emblaApi);
1028
+ return /* @__PURE__ */ jsxs(
1029
+ Section,
1030
+ {
1031
+ background,
1032
+ spacing,
1033
+ className: cn(className),
1034
+ pattern,
1035
+ patternOpacity,
1036
+ children: [
1037
+ /* @__PURE__ */ jsx("div", { className: cn("overflow-hidden", containerClassName), ref: emblaRef, children: /* @__PURE__ */ jsx("div", { className: cn("ml-auto mr-3 flex touch-pan-y touch-pinch-zoom", trackClassName), children: slidesSlot ? slidesSlot : slides?.map((slide, index) => /* @__PURE__ */ jsxs(
1038
+ "div",
1039
+ {
1040
+ className: cn("flex-[0_0_70%] transform-gpu pl-3", slideClassName, slide.className),
1041
+ children: [
1042
+ /* @__PURE__ */ jsx("div", { className: "aspect-video overflow-hidden rounded-lg", children: /* @__PURE__ */ jsx(
1043
+ Img,
1044
+ {
1045
+ src: slide.src,
1046
+ alt: typeof slide.alt === "string" ? slide.alt : `Slide ${index + 1}`,
1047
+ className: cn("h-full w-full object-cover", imageClassName, slide.imageClassName),
1048
+ optixFlowConfig
1049
+ }
1050
+ ) }),
1051
+ slide.content && /* @__PURE__ */ jsx("div", { className: "mt-4", children: slide.content })
1052
+ ]
1053
+ },
1054
+ index
1055
+ )) }) }),
1056
+ /* @__PURE__ */ jsxs("div", { className: cn("mx-auto mt-7 flex max-w-80 items-center justify-between gap-3", controlsClassName), children: [
1057
+ /* @__PURE__ */ jsx("div", { className: cn("flex justify-center gap-2", dotsClassName), children: scrollSnaps.map((_, index) => /* @__PURE__ */ jsx(
1058
+ "button",
1059
+ {
1060
+ type: "button",
1061
+ onClick: () => onAutoplayButtonClick(() => onDotButtonClick(index)),
1062
+ className: cn(
1063
+ "h-3 w-3 rounded-full border-2 border-border transition-colors duration-200",
1064
+ index === selectedIndex ? "bg-foreground" : "bg-transparent hover:bg-muted"
1065
+ )
1066
+ },
1067
+ index
1068
+ )) }),
1069
+ /* @__PURE__ */ jsx(
1070
+ "div",
1071
+ {
1072
+ className: cn(
1073
+ "relative h-2 w-40 max-w-[90%] justify-self-center self-center overflow-hidden rounded-[1.8rem] border-2 border-border bg-background transition-opacity duration-300 ease-in-out",
1074
+ showAutoplayProgress ? "opacity-100" : "opacity-0",
1075
+ progressClassName
1076
+ ),
1077
+ children: /* @__PURE__ */ jsx(
1078
+ "div",
1079
+ {
1080
+ className: "absolute bottom-0 top-0 -left-full w-full bg-foreground",
1081
+ ref: progressNode,
1082
+ style: {
1083
+ animation: "autoplay-progress linear 1",
1084
+ animationPlayState: showAutoplayProgress ? "running" : "paused"
1085
+ }
1086
+ }
1087
+ )
1088
+ }
1089
+ ),
1090
+ /* @__PURE__ */ jsx(
1091
+ Pressable,
1092
+ {
1093
+ size: "icon",
1094
+ variant: "secondary",
1095
+ onClick: toggleAutoplay,
1096
+ asButton: true,
1097
+ children: autoplayIsPlaying ? /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/pause", size: 16 }) : /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/play", size: 16 })
1098
+ }
1099
+ )
1100
+ ] }),
1101
+ /* @__PURE__ */ jsx("style", { children: `
1102
+ @keyframes autoplay-progress {
1103
+ from {
1104
+ transform: translateX(0);
1105
+ }
1106
+ to {
1107
+ transform: translateX(100%);
1108
+ }
1109
+ }
1110
+ ` })
1111
+ ]
1112
+ }
1113
+ );
1114
+ }
1115
+
1116
+ export { CarouselAutoplayProgress };