@opensite/ui 3.9.0 → 3.11.0

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.
@@ -0,0 +1,789 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var mediaImmersive = require('@page-speed/media-immersive');
6
+ var clsx = require('clsx');
7
+ var tailwindMerge = require('tailwind-merge');
8
+ var icon = require('@page-speed/icon');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+
31
+ // components/blocks/gallery/instagram-post-grid.tsx
32
+ function cn(...inputs) {
33
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
34
+ }
35
+ var DEFAULT_ICON_API_KEY = "au382bi7fsh96w9h9xlrnat2jglx";
36
+ var DynamicIcon = React__namespace.memo(function DynamicIcon2({
37
+ apiKey,
38
+ name,
39
+ ...props
40
+ }) {
41
+ if (name == null) return null;
42
+ if (typeof name !== "string") {
43
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: name });
44
+ }
45
+ return /* @__PURE__ */ jsxRuntime.jsx(icon.Icon, { ...props, name, apiKey: apiKey ?? DEFAULT_ICON_API_KEY });
46
+ });
47
+ DynamicIcon.displayName = "DynamicIcon";
48
+ var maxWidthStyles = {
49
+ sm: "max-w-screen-sm",
50
+ md: "max-w-screen-md",
51
+ lg: "max-w-screen-lg",
52
+ xl: "max-w-7xl",
53
+ "2xl": "max-w-screen-2xl",
54
+ "4xl": "max-w-[1536px]",
55
+ full: "max-w-full"
56
+ };
57
+ var Container = React__namespace.default.forwardRef(
58
+ ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
59
+ const Component = as;
60
+ return /* @__PURE__ */ jsxRuntime.jsx(
61
+ Component,
62
+ {
63
+ ref,
64
+ className: cn(
65
+ "mx-auto w-full px-2 sm:px-4 lg:px-8",
66
+ maxWidthStyles[maxWidth],
67
+ className
68
+ ),
69
+ ...props,
70
+ children
71
+ }
72
+ );
73
+ }
74
+ );
75
+ Container.displayName = "Container";
76
+
77
+ // lib/patternSvgs.ts
78
+ var patternSvgs = {
79
+ squareAltGrid: "https://cdn.ing/assets/files/record/286187/4gpn0yq2ptra8iwlvmwwv860ggwv",
80
+ grid1: "https://cdn.ing/assets/files/record/286186/nbdflpgp4ostrno079hygibsflp3",
81
+ noise: "https://cdn.ing/assets/i/r/286188/zrqcp9hynh3j7p2laihwzfbujgrl/noise.png",
82
+ dots: "https://cdn.ing/assets/files/record/286198/yfsjx9thvtxzhl2qtshxyhkrm524",
83
+ dotPattern: "https://cdn.ing/assets/files/record/286192/7ig0cku8aqbboiza8nuk6hw0nnsr",
84
+ dotPattern2: "https://cdn.ing/assets/files/record/286189/arez6gd2s7isn9i1o6c7sexdq7bl",
85
+ circles: "https://cdn.ing/assets/files/record/286190/gtmia3sncjtzetdshc20zf1d3c17",
86
+ waves: "https://cdn.ing/assets/files/record/286191/mqlb33fzxz9cdth1bx7if0wmpkp1",
87
+ crossPattern: "https://cdn.ing/assets/files/record/286193/9yfqwdbnqaipbp7fsb3wbzzmq472",
88
+ architect: "https://cdn.ing/assets/files/record/286194/vgs88ugpvyhxu13wqgy0acvae6re",
89
+ tinyCheckers: "https://cdn.ing/assets/files/record/286195/65efaknsw8kcpf9o3c2gybytsl5b",
90
+ p6: "https://cdn.ing/assets/i/r/286196/6kl0rqnd6mjk8j7e525fo8fo0vkc/p6.webp"
91
+ };
92
+ var maskTop = "radial-gradient(ellipse 70% 60% at 50% 0%, #000 60%, transparent 100%)";
93
+ var maskBottom = "radial-gradient(ellipse 100% 80% at 50% 100%, #000 50%, transparent 90%)";
94
+ var maskCenter = "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 70%)";
95
+ var maskTopLeft = "radial-gradient(ellipse 80% 80% at 0% 0%, #000 50%, transparent 90%)";
96
+ var maskTopRight = "radial-gradient(ellipse 80% 80% at 100% 0%, #000 50%, transparent 90%)";
97
+ var maskBottomLeft = "radial-gradient(ellipse 80% 80% at 0% 100%, #000 50%, transparent 90%)";
98
+ var maskBottomRight = "radial-gradient(ellipse 80% 80% at 100% 100%, #000 50%, transparent 90%)";
99
+ var circuitBoardPattern = (id, mask) => /* @__PURE__ */ jsxRuntime.jsxs(
100
+ "svg",
101
+ {
102
+ className: "h-full w-full",
103
+ xmlns: "http://www.w3.org/2000/svg",
104
+ style: mask ? {
105
+ maskImage: mask,
106
+ WebkitMaskImage: mask
107
+ } : void 0,
108
+ children: [
109
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
110
+ "pattern",
111
+ {
112
+ id,
113
+ x: "0",
114
+ y: "0",
115
+ width: "100",
116
+ height: "100",
117
+ patternUnits: "userSpaceOnUse",
118
+ children: [
119
+ /* @__PURE__ */ jsxRuntime.jsx(
120
+ "path",
121
+ {
122
+ d: "M0 50h40M60 50h40M50 0v40M50 60v40",
123
+ stroke: "hsl(var(--muted))",
124
+ strokeWidth: "1",
125
+ fill: "none"
126
+ }
127
+ ),
128
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "50", r: "3", fill: "hsl(var(--muted))" }),
129
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "0", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
130
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "100", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
131
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "0", r: "2", fill: "hsl(var(--muted))" }),
132
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "100", r: "2", fill: "hsl(var(--muted))" })
133
+ ]
134
+ }
135
+ ) }),
136
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
137
+ ]
138
+ }
139
+ );
140
+ var gridDotsPattern = (id, mask) => /* @__PURE__ */ jsxRuntime.jsxs(
141
+ "svg",
142
+ {
143
+ className: "h-full w-full",
144
+ xmlns: "http://www.w3.org/2000/svg",
145
+ style: mask ? {
146
+ maskImage: mask,
147
+ WebkitMaskImage: mask
148
+ } : void 0,
149
+ children: [
150
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
151
+ "pattern",
152
+ {
153
+ id,
154
+ x: "0",
155
+ y: "0",
156
+ width: "40",
157
+ height: "40",
158
+ patternUnits: "userSpaceOnUse",
159
+ children: [
160
+ /* @__PURE__ */ jsxRuntime.jsx(
161
+ "path",
162
+ {
163
+ d: "M0 20h40M20 0v40",
164
+ stroke: "hsl(var(--muted))",
165
+ strokeWidth: "0.5",
166
+ fill: "none"
167
+ }
168
+ ),
169
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "20", cy: "20", r: "2", fill: "hsl(var(--muted))" })
170
+ ]
171
+ }
172
+ ) }),
173
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
174
+ ]
175
+ }
176
+ );
177
+ var gridPattern = (size, mask) => /* @__PURE__ */ jsxRuntime.jsx(
178
+ "div",
179
+ {
180
+ 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)]",
181
+ style: {
182
+ backgroundSize: `${size}px ${size}px`,
183
+ ...mask ? {
184
+ maskImage: mask,
185
+ WebkitMaskImage: mask
186
+ } : {}
187
+ }
188
+ }
189
+ );
190
+ var diagonalCrossPattern = (mask) => /* @__PURE__ */ jsxRuntime.jsx(
191
+ "div",
192
+ {
193
+ className: "h-full w-full",
194
+ style: {
195
+ 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)",
196
+ ...mask ? {
197
+ maskImage: mask,
198
+ WebkitMaskImage: mask
199
+ } : {}
200
+ }
201
+ }
202
+ );
203
+ 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)";
204
+ var dashedGridPattern = (fadeMask) => {
205
+ const mask = fadeMask ? `${dashedGridMaskBase}, ${fadeMask}` : dashedGridMaskBase;
206
+ return /* @__PURE__ */ jsxRuntime.jsx(
207
+ "div",
208
+ {
209
+ className: "h-full w-full",
210
+ style: {
211
+ backgroundImage: "linear-gradient(to right, hsl(var(--muted)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--muted)) 1px, transparent 1px)",
212
+ backgroundSize: "20px 20px",
213
+ backgroundPosition: "0 0, 0 0",
214
+ maskImage: mask,
215
+ WebkitMaskImage: mask,
216
+ maskComposite: "intersect",
217
+ WebkitMaskComposite: "source-in"
218
+ }
219
+ }
220
+ );
221
+ };
222
+ var gradientGlow = (position) => /* @__PURE__ */ jsxRuntime.jsx(
223
+ "div",
224
+ {
225
+ className: cn(
226
+ "pointer-events-none absolute left-1/2 z-0 aspect-square w-3/4 -translate-x-1/2 rounded-full opacity-50 blur-3xl",
227
+ position === "top" ? "-top-1/4" : "-bottom-1/4"
228
+ ),
229
+ style: {
230
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
231
+ }
232
+ }
233
+ );
234
+ var spotlight = (position) => /* @__PURE__ */ jsxRuntime.jsx(
235
+ "div",
236
+ {
237
+ className: cn(
238
+ "pointer-events-none absolute top-1/2 z-0 aspect-square w-3/4 -translate-y-1/2 rounded-full opacity-40 blur-3xl",
239
+ position === "left" ? "-left-1/4" : "-right-1/4"
240
+ ),
241
+ style: {
242
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
243
+ }
244
+ }
245
+ );
246
+ var patternOverlays = {
247
+ circuitBoardBasic: () => circuitBoardPattern("circuit-board-basic"),
248
+ circuitBoardFadeTop: () => circuitBoardPattern("circuit-board-fade-top", maskTop),
249
+ circuitBoardFadeBottom: () => circuitBoardPattern("circuit-board-fade-bottom", maskBottom),
250
+ circuitBoardFadeCenter: () => circuitBoardPattern("circuit-board-fade-center", maskCenter),
251
+ circuitBoardFadeTopLeft: () => circuitBoardPattern("circuit-board-fade-top-left", maskTopLeft),
252
+ circuitBoardFadeTopRight: () => circuitBoardPattern("circuit-board-fade-top-right", maskTopRight),
253
+ circuitBoardFadeBottomLeft: () => circuitBoardPattern("circuit-board-fade-bottom-left", maskBottomLeft),
254
+ circuitBoardFadeBottomRight: () => circuitBoardPattern("circuit-board-fade-bottom-right", maskBottomRight),
255
+ dashedGridBasic: () => dashedGridPattern(),
256
+ dashedGridFadeTop: () => dashedGridPattern(maskTop),
257
+ dashedGridFadeBottom: () => dashedGridPattern(maskBottom),
258
+ dashedGridFadeCenter: () => dashedGridPattern(maskCenter),
259
+ dashedGridFadeTopLeft: () => dashedGridPattern(maskTopLeft),
260
+ dashedGridFadeTopRight: () => dashedGridPattern(maskTopRight),
261
+ dashedGridFadeBottomLeft: () => dashedGridPattern(maskBottomLeft),
262
+ dashedGridFadeBottomRight: () => dashedGridPattern(maskBottomRight),
263
+ diagonalCrossBasic: () => diagonalCrossPattern(),
264
+ diagonalCrossFadeTop: () => diagonalCrossPattern(maskTop),
265
+ diagonalCrossFadeBottom: () => diagonalCrossPattern(maskBottom),
266
+ diagonalCrossFadeCenter: () => diagonalCrossPattern(maskCenter),
267
+ diagonalCrossFadeTopLeft: () => diagonalCrossPattern(maskTopLeft),
268
+ diagonalCrossFadeTopRight: () => diagonalCrossPattern(maskTopRight),
269
+ diagonalCrossFadeBottomLeft: () => diagonalCrossPattern(maskBottomLeft),
270
+ diagonalCrossFadeBottomRight: () => diagonalCrossPattern(maskBottomRight),
271
+ gridBasic: () => gridPattern(40),
272
+ gridFadeTop: () => gridPattern(32, maskTop),
273
+ gridFadeBottom: () => gridPattern(32, maskBottom),
274
+ gridFadeCenter: () => gridPattern(40, maskCenter),
275
+ gridFadeTopLeft: () => gridPattern(32, maskTopLeft),
276
+ gridFadeTopRight: () => gridPattern(32, maskTopRight),
277
+ gridFadeBottomLeft: () => gridPattern(32, maskBottomLeft),
278
+ gridFadeBottomRight: () => gridPattern(32, maskBottomRight),
279
+ gridDotsBasic: () => gridDotsPattern("grid-dots-basic"),
280
+ gridDotsFadeCenter: () => gridDotsPattern("grid-dots-fade-center", maskCenter),
281
+ gradientGlowTop: () => gradientGlow("top"),
282
+ gradientGlowBottom: () => gradientGlow("bottom"),
283
+ spotlightLeft: () => spotlight("left"),
284
+ spotlightRight: () => spotlight("right")
285
+ };
286
+ var inlinePatternStyles = {
287
+ radialGradientTop: {
288
+ background: "radial-gradient(125% 125% at 50% 10%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
289
+ },
290
+ radialGradientBottom: {
291
+ background: "radial-gradient(125% 125% at 50% 90%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
292
+ }
293
+ };
294
+ function PatternBackground({
295
+ pattern,
296
+ opacity = 0.08,
297
+ className,
298
+ style
299
+ }) {
300
+ if (!pattern) {
301
+ return null;
302
+ }
303
+ if (pattern in inlinePatternStyles) {
304
+ const inlineStyle = inlinePatternStyles[pattern];
305
+ return /* @__PURE__ */ jsxRuntime.jsx(
306
+ "div",
307
+ {
308
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
309
+ style: { ...inlineStyle, opacity, ...style },
310
+ "aria-hidden": "true"
311
+ }
312
+ );
313
+ }
314
+ if (pattern in patternOverlays) {
315
+ const Overlay = patternOverlays[pattern];
316
+ return /* @__PURE__ */ jsxRuntime.jsx(
317
+ "div",
318
+ {
319
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
320
+ style: { opacity, ...style },
321
+ "aria-hidden": "true",
322
+ children: Overlay()
323
+ }
324
+ );
325
+ }
326
+ const patternUrl = pattern in patternSvgs ? patternSvgs[pattern] : pattern;
327
+ return /* @__PURE__ */ jsxRuntime.jsx(
328
+ "div",
329
+ {
330
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
331
+ style: {
332
+ backgroundImage: `url(${patternUrl})`,
333
+ backgroundRepeat: "repeat",
334
+ backgroundSize: "auto",
335
+ opacity,
336
+ ...style
337
+ },
338
+ "aria-hidden": "true"
339
+ }
340
+ );
341
+ }
342
+ var backgroundStyles = {
343
+ default: "bg-background text-foreground",
344
+ white: "bg-white text-dark",
345
+ gray: "bg-muted/30 text-foreground",
346
+ dark: "bg-foreground text-background",
347
+ transparent: "bg-transparent text-foreground",
348
+ gradient: "bg-linear-to-br from-primary via-primary/90 to-foreground text-primary-foreground",
349
+ primary: "bg-primary text-primary-foreground",
350
+ secondary: "bg-secondary text-secondary-foreground",
351
+ muted: "bg-muted text-muted-foreground"
352
+ };
353
+ var spacingStyles = {
354
+ none: "py-0 md:py-0",
355
+ sm: "py-12 md:py-16",
356
+ md: "py-16 md:py-24",
357
+ lg: "py-20 md:py-32",
358
+ xl: "py-24 md:py-40",
359
+ hero: "pt-32 pb-12 md:pt-40 md:pb-40"
360
+ };
361
+ var predefinedSpacings = ["none", "sm", "md", "lg", "xl", "hero"];
362
+ var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
363
+ var Section = React__namespace.default.forwardRef(
364
+ ({
365
+ id,
366
+ title,
367
+ subtitle,
368
+ children,
369
+ className,
370
+ style,
371
+ background = "default",
372
+ spacing = "lg",
373
+ pattern,
374
+ patternOpacity,
375
+ patternClassName,
376
+ containerClassName,
377
+ containerMaxWidth = "xl",
378
+ ...props
379
+ }, ref) => {
380
+ const effectivePatternOpacity = patternOpacity !== void 0 ? patternOpacity : pattern ? 1 : 0;
381
+ return /* @__PURE__ */ jsxRuntime.jsxs(
382
+ "section",
383
+ {
384
+ ref,
385
+ id,
386
+ className: cn(
387
+ "relative",
388
+ pattern ? "overflow-hidden" : null,
389
+ backgroundStyles[background],
390
+ isPredefinedSpacing(spacing) ? spacingStyles[spacing] : spacing,
391
+ className
392
+ ),
393
+ style,
394
+ ...props,
395
+ children: [
396
+ /* @__PURE__ */ jsxRuntime.jsx(
397
+ PatternBackground,
398
+ {
399
+ pattern,
400
+ opacity: effectivePatternOpacity,
401
+ className: patternClassName
402
+ }
403
+ ),
404
+ /* @__PURE__ */ jsxRuntime.jsxs(
405
+ Container,
406
+ {
407
+ maxWidth: containerMaxWidth,
408
+ className: cn("relative z-10", containerClassName),
409
+ children: [
410
+ (title || subtitle) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6 text-center md:mb-16", children: [
411
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-sm font-semibold uppercase tracking-wider", children: subtitle }),
412
+ title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl", children: title })
413
+ ] }),
414
+ children
415
+ ]
416
+ }
417
+ )
418
+ ]
419
+ }
420
+ );
421
+ }
422
+ );
423
+ Section.displayName = "Section";
424
+ var IG_TILE_WIDTH = 320;
425
+ var IG_TILE_STYLE = { width: "100%" };
426
+ var TITLE_MAX = 90;
427
+ function truncate(text, max = TITLE_MAX) {
428
+ const trimmed = text.trim();
429
+ if (trimmed.length <= max) return trimmed;
430
+ const slice = trimmed.slice(0, max);
431
+ const lastSpace = slice.lastIndexOf(" ");
432
+ const head = lastSpace > max * 0.6 ? slice.slice(0, lastSpace) : slice;
433
+ return `${head.trimEnd()}\u2026`;
434
+ }
435
+ function captionToString(caption) {
436
+ return typeof caption === "string" ? caption : "";
437
+ }
438
+ function toMediaItem(item) {
439
+ const isVideo = Boolean(item.isVideo && item.videoUrl);
440
+ const fullCaption = captionToString(item.caption);
441
+ const title = truncate(fullCaption) || item.imageAlt || "Instagram post";
442
+ const meta = {
443
+ href: item.href,
444
+ likeCount: item.likeCount,
445
+ commentCount: item.commentCount,
446
+ viewCount: item.viewCount,
447
+ date: item.date
448
+ };
449
+ return {
450
+ id: item.id,
451
+ type: isVideo ? "video" : "image",
452
+ poster: item.image,
453
+ // Video source only when the post is a real video (image posts ignore it).
454
+ src: isVideo ? item.videoUrl : void 0,
455
+ title,
456
+ caption: fullCaption || void 0,
457
+ kind: "Instagram",
458
+ meta
459
+ };
460
+ }
461
+ function openPermalink(item) {
462
+ if (typeof window === "undefined") return;
463
+ const href = item.meta?.href;
464
+ if (!href) return;
465
+ window.open(href, "_blank", "noopener,noreferrer");
466
+ }
467
+ function likeBadge(likeCount) {
468
+ return /* @__PURE__ */ jsxRuntime.jsxs(
469
+ "span",
470
+ {
471
+ "aria-label": `${likeCount.toLocaleString()} likes`,
472
+ style: {
473
+ display: "inline-flex",
474
+ alignItems: "center",
475
+ gap: 4,
476
+ padding: "3px 8px",
477
+ borderRadius: 999,
478
+ background: "rgba(8,12,24,0.65)",
479
+ backdropFilter: "blur(6px)",
480
+ WebkitBackdropFilter: "blur(6px)",
481
+ color: "#fff",
482
+ fontSize: 11,
483
+ fontWeight: 700,
484
+ lineHeight: 1
485
+ },
486
+ children: [
487
+ /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/heart", size: 13, "aria-hidden": "true" }),
488
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: likeCount.toLocaleString() })
489
+ ]
490
+ }
491
+ );
492
+ }
493
+ var VIEWER_ACTIONS = [
494
+ {
495
+ id: "open-in-instagram",
496
+ icon: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/external-link", size: 22, "aria-hidden": "true" }),
497
+ label: "Instagram",
498
+ ariaLabel: "Open in Instagram",
499
+ onPress: (item) => openPermalink(item)
500
+ }
501
+ ];
502
+ function RailStat({
503
+ iconName,
504
+ count,
505
+ label,
506
+ onPress
507
+ }) {
508
+ return /* @__PURE__ */ jsxRuntime.jsxs(
509
+ "button",
510
+ {
511
+ type: "button",
512
+ "aria-label": `${count.toLocaleString()} ${label}`,
513
+ onClick: (e) => {
514
+ e.stopPropagation();
515
+ onPress();
516
+ },
517
+ style: {
518
+ display: "flex",
519
+ flexDirection: "column",
520
+ alignItems: "center",
521
+ gap: 5,
522
+ padding: 0,
523
+ border: "none",
524
+ background: "transparent",
525
+ color: "inherit",
526
+ cursor: "pointer",
527
+ font: "inherit"
528
+ },
529
+ children: [
530
+ /* @__PURE__ */ jsxRuntime.jsx(
531
+ "span",
532
+ {
533
+ style: {
534
+ width: 46,
535
+ height: 46,
536
+ borderRadius: "50%",
537
+ background: "var(--psmi-chrome-bg, rgba(255,255,255,0.14))",
538
+ backdropFilter: "blur(6px)",
539
+ WebkitBackdropFilter: "blur(6px)",
540
+ display: "flex",
541
+ alignItems: "center",
542
+ justifyContent: "center"
543
+ },
544
+ children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: iconName, size: 22, "aria-hidden": "true" })
545
+ }
546
+ ),
547
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { fontSize: 11, fontWeight: 600 }, children: count.toLocaleString() })
548
+ ]
549
+ }
550
+ );
551
+ }
552
+ function InstagramViewerRail({ item }) {
553
+ const meta = item.meta ?? {};
554
+ const open = () => openPermalink(item);
555
+ return /* @__PURE__ */ jsxRuntime.jsxs(
556
+ "div",
557
+ {
558
+ style: {
559
+ position: "absolute",
560
+ right: 11,
561
+ bottom: 135,
562
+ display: "flex",
563
+ flexDirection: "column",
564
+ alignItems: "center",
565
+ gap: 18,
566
+ color: "var(--psmi-chrome-fg, #fff)",
567
+ zIndex: 3
568
+ },
569
+ children: [
570
+ typeof meta.likeCount === "number" ? /* @__PURE__ */ jsxRuntime.jsx(
571
+ RailStat,
572
+ {
573
+ iconName: "lucide/heart",
574
+ count: meta.likeCount,
575
+ label: "likes",
576
+ onPress: open
577
+ }
578
+ ) : null,
579
+ typeof meta.commentCount === "number" ? /* @__PURE__ */ jsxRuntime.jsx(
580
+ RailStat,
581
+ {
582
+ iconName: "lucide/message-circle",
583
+ count: meta.commentCount,
584
+ label: "comments",
585
+ onPress: open
586
+ }
587
+ ) : null,
588
+ typeof meta.viewCount === "number" ? /* @__PURE__ */ jsxRuntime.jsx(
589
+ RailStat,
590
+ {
591
+ iconName: "lucide/eye",
592
+ count: meta.viewCount,
593
+ label: "views",
594
+ onPress: open
595
+ }
596
+ ) : null,
597
+ meta.href ? /* @__PURE__ */ jsxRuntime.jsxs(
598
+ "a",
599
+ {
600
+ href: meta.href,
601
+ target: "_blank",
602
+ rel: "noopener noreferrer",
603
+ "aria-label": "Open in Instagram",
604
+ onClick: (e) => e.stopPropagation(),
605
+ style: {
606
+ display: "flex",
607
+ flexDirection: "column",
608
+ alignItems: "center",
609
+ gap: 5,
610
+ padding: 0,
611
+ border: "none",
612
+ background: "transparent",
613
+ color: "inherit",
614
+ cursor: "pointer",
615
+ font: "inherit",
616
+ textDecoration: "none"
617
+ },
618
+ children: [
619
+ /* @__PURE__ */ jsxRuntime.jsx(
620
+ "span",
621
+ {
622
+ style: {
623
+ width: 46,
624
+ height: 46,
625
+ borderRadius: "50%",
626
+ background: "var(--psmi-chrome-bg, rgba(255,255,255,0.14))",
627
+ backdropFilter: "blur(6px)",
628
+ WebkitBackdropFilter: "blur(6px)",
629
+ display: "flex",
630
+ alignItems: "center",
631
+ justifyContent: "center"
632
+ },
633
+ children: /* @__PURE__ */ jsxRuntime.jsx(
634
+ DynamicIcon,
635
+ {
636
+ name: "lucide/external-link",
637
+ size: 22,
638
+ "aria-hidden": "true"
639
+ }
640
+ )
641
+ }
642
+ ),
643
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { fontSize: 11, fontWeight: 600 }, children: "Instagram" })
644
+ ]
645
+ }
646
+ ) : null
647
+ ]
648
+ }
649
+ );
650
+ }
651
+ function InstagramFeedGrid({
652
+ mediaItems,
653
+ gridClassName,
654
+ itemClassName,
655
+ imageClassName,
656
+ optixFlowConfig
657
+ }) {
658
+ const { open } = mediaImmersive.useImmersiveFeed();
659
+ const posterImgProps = React.useMemo(() => {
660
+ const next = {};
661
+ if (imageClassName) next.className = imageClassName;
662
+ if (optixFlowConfig) next.optixFlowConfig = optixFlowConfig;
663
+ return Object.keys(next).length > 0 ? next : void 0;
664
+ }, [imageClassName, optixFlowConfig]);
665
+ return /* @__PURE__ */ jsxRuntime.jsx(
666
+ "div",
667
+ {
668
+ className: cn(
669
+ "grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",
670
+ gridClassName
671
+ ),
672
+ children: mediaItems.map((mediaItem) => {
673
+ const likeCount = mediaItem.meta?.likeCount;
674
+ return /* @__PURE__ */ jsxRuntime.jsx(
675
+ mediaImmersive.ThumbnailCard,
676
+ {
677
+ item: mediaItem,
678
+ onOpen: open,
679
+ size: IG_TILE_WIDTH,
680
+ style: IG_TILE_STYLE,
681
+ className: itemClassName,
682
+ elevated: false,
683
+ showDuration: false,
684
+ glyphMode: "hover",
685
+ posterImgProps,
686
+ badgeSlot: typeof likeCount === "number" ? likeBadge(likeCount) : void 0
687
+ },
688
+ mediaItem.id
689
+ );
690
+ })
691
+ }
692
+ );
693
+ }
694
+ function InstagramPostGrid({
695
+ sectionId = "instagram-post-grid",
696
+ heading,
697
+ subheading,
698
+ items,
699
+ itemsSlot,
700
+ className,
701
+ containerClassName,
702
+ headerClassName,
703
+ headingClassName,
704
+ subheadingClassName,
705
+ gridClassName,
706
+ itemClassName,
707
+ imageClassName,
708
+ optixFlowConfig,
709
+ background,
710
+ spacing,
711
+ pattern,
712
+ patternOpacity,
713
+ patternClassName
714
+ }) {
715
+ const mediaItems = React.useMemo(() => {
716
+ if (itemsSlot || !items) return [];
717
+ return items.filter((item) => Boolean(item.image)).map(toMediaItem);
718
+ }, [items, itemsSlot]);
719
+ if (!itemsSlot && (!items || items.length === 0)) {
720
+ return null;
721
+ }
722
+ return /* @__PURE__ */ jsxRuntime.jsxs(
723
+ Section,
724
+ {
725
+ id: sectionId,
726
+ background,
727
+ spacing,
728
+ pattern,
729
+ patternOpacity,
730
+ patternClassName,
731
+ className,
732
+ containerClassName,
733
+ children: [
734
+ (heading || subheading) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mb-8 flex flex-col gap-2", headerClassName), children: [
735
+ heading && (typeof heading === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
736
+ "h2",
737
+ {
738
+ className: cn(
739
+ "text-xl font-medium tracking-tight md:text-2xl lg:text-3xl text-balance",
740
+ headingClassName
741
+ ),
742
+ children: heading
743
+ }
744
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: headingClassName, children: heading })),
745
+ subheading && (typeof subheading === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
746
+ "p",
747
+ {
748
+ className: cn(
749
+ "max-w-2xl text-balance text-muted-foreground",
750
+ subheadingClassName
751
+ ),
752
+ children: subheading
753
+ }
754
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: subheadingClassName, children: subheading }))
755
+ ] }),
756
+ itemsSlot ? /* @__PURE__ */ jsxRuntime.jsx(
757
+ "div",
758
+ {
759
+ className: cn(
760
+ "grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",
761
+ gridClassName
762
+ ),
763
+ children: itemsSlot
764
+ }
765
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(mediaImmersive.ImmersiveFeedProvider, { items: mediaItems, actions: VIEWER_ACTIONS, children: [
766
+ /* @__PURE__ */ jsxRuntime.jsx(
767
+ InstagramFeedGrid,
768
+ {
769
+ mediaItems,
770
+ gridClassName,
771
+ itemClassName,
772
+ imageClassName,
773
+ optixFlowConfig
774
+ }
775
+ ),
776
+ /* @__PURE__ */ jsxRuntime.jsx(
777
+ mediaImmersive.ImmersiveViewer,
778
+ {
779
+ ariaLabel: "Instagram post viewer",
780
+ renderActions: ({ item }) => /* @__PURE__ */ jsxRuntime.jsx(InstagramViewerRail, { item })
781
+ }
782
+ )
783
+ ] })
784
+ ]
785
+ }
786
+ );
787
+ }
788
+
789
+ exports.InstagramPostGrid = InstagramPostGrid;