@postrun/react 2.7.0 → 2.9.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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { createContext, memo, useMemo, useState, useEffect, useRef, useLayoutEffect, Fragment as Fragment$1, useCallback, createElement, useContext, useId } from 'react';
2
+ import { createContext, memo, useMemo, useState, useEffect, Fragment as Fragment$1, useRef, useLayoutEffect, useCallback, createElement, useContext, useId } from 'react';
3
3
  import { useInfiniteQuery, useQuery, useMutation, QueryClient } from '@tanstack/react-query';
4
4
  import { xPollDurationLabel, linkedinPollDurationLabel, createPostrunClient, profilesList, profilesGet, profilesCreate, profilesUpdate, profilesDelete, connectionsConnect, connectionsListByProfile, connectionsGet, connectionsListAccounts, connectionsSelect, connectionsDelete, mediaGet, mediaList, mediaUpdate, mediaDelete, postsList, postsGet, postsCreate, buildCreatePost, isPostPlatform, failedVariants, isPublished, postsValidate, postsUpdate, postsDelete, tiktokCreatorInfo, audiencePrivacyOptions, audienceUnselected, tiktokPrivacyLabel, parsePrivacyLevel, TIKTOK_AUDIENCE_REQUIRED_HINT, captionMaxFor, commercialLabelNotice, commercialDisclosureIncomplete, setCommercialDisclosure, setBrandKind, TIKTOK_DISCLOSURE_REQUIRED_HINT, TIKTOK_BRANDED_CONTENT_POLICY_URL, TIKTOK_MUSIC_CONFIRMATION_URL, interactionRows, interactionValueKey, toggleInteraction, tiktokOptionsReady, TIKTOK_PROCESSING_NOTICE, brandedContentDeclared, mediaCreate, PostrunError } from '@postrun/js';
5
5
  export { TIKTOK_CAPTION_MAX, captionMaxFor } from '@postrun/js';
@@ -10,10 +10,11 @@ import pRetry, { AbortError } from 'p-retry';
10
10
  import axios, { isAxiosError } from 'axios';
11
11
  import { enrichTweet, TweetContainer, TweetHeader, TweetInReplyTo, TweetBody, TweetMedia, QuotedTweet } from 'react-tweet';
12
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
- import { FiMessageCircle, FiRepeat, FiHeart, FiBarChart2, FiShare, FiGlobe, FiUsers, FiThumbsUp, FiMessageSquare, FiSend, FiFileText } from 'react-icons/fi';
13
+ import { FiMessageCircle, FiRepeat, FiHeart, FiBarChart2, FiShare, FiGlobe, FiUsers, FiThumbsUp, FiMessageSquare, FiSend, FiBookmark, FiMoreHorizontal, FiFileText } from 'react-icons/fi';
14
14
  import twitterText from 'twitter-text';
15
15
  import { LuBadgeCheck } from 'react-icons/lu';
16
16
  import useEmblaCarousel from 'embla-carousel-react';
17
+ import { MdVerified, MdMusicNote } from 'react-icons/md';
17
18
  import { IoMusicalNotes } from 'react-icons/io5';
18
19
 
19
20
  // src/context.tsx
@@ -1113,6 +1114,38 @@ var ACTIONS = [
1113
1114
  function XPreviewActions() {
1114
1115
  return /* @__PURE__ */ jsx("div", { style: ROW, children: ACTIONS.map(({ label, Icon: Icon2 }) => /* @__PURE__ */ jsx(Icon2, { size: 18, "aria-label": label, role: "img" }, label)) });
1115
1116
  }
1117
+ function twitterMediaUrl(src) {
1118
+ try {
1119
+ const url = new URL(src);
1120
+ const extension = url.pathname.split(".").pop();
1121
+ if (!extension) {
1122
+ return src;
1123
+ }
1124
+ url.pathname = url.pathname.replace(`.${extension}`, "");
1125
+ url.searchParams.set("format", extension);
1126
+ url.searchParams.set("name", "small");
1127
+ return url.toString();
1128
+ } catch {
1129
+ return src;
1130
+ }
1131
+ }
1132
+ function rawSrcLookup(...lists) {
1133
+ const map = /* @__PURE__ */ new Map();
1134
+ for (const list of lists) {
1135
+ for (const item of list) {
1136
+ const poster = item.posterSrc ?? item.src;
1137
+ map.set(twitterMediaUrl(item.src), item.src);
1138
+ map.set(twitterMediaUrl(poster), poster);
1139
+ }
1140
+ }
1141
+ return map;
1142
+ }
1143
+ function makeRawMediaImg(rawBySrc) {
1144
+ return function RawMediaImg(props) {
1145
+ const raw = typeof props.src === "string" ? rawBySrc.get(props.src) ?? props.src : props.src;
1146
+ return /* @__PURE__ */ jsx("img", { ...props, src: raw });
1147
+ };
1148
+ }
1116
1149
  var {
1117
1150
  extractCashtagsWithIndices,
1118
1151
  extractHashtagsWithIndices,
@@ -1163,9 +1196,12 @@ function buildUser(author) {
1163
1196
  return {
1164
1197
  id_str: "",
1165
1198
  name: author.name,
1166
- profile_image_url_https: author.avatarUrl ?? PLACEHOLDER_AVATAR,
1199
+ profile_image_url_https: author.avatar_url ?? PLACEHOLDER_AVATAR,
1167
1200
  profile_image_shape: "Circle",
1168
- screen_name: author.handle,
1201
+ // `username`/`avatar_url` derive from the SDK Connection and are nullable.
1202
+ screen_name: author.username ?? "",
1203
+ // Legacy (pre-X-era) verification flag — always false for organic posts; the
1204
+ // X Blue checkmark rides on `is_blue_verified`.
1169
1205
  verified: false,
1170
1206
  is_blue_verified: verified
1171
1207
  };
@@ -1228,7 +1264,11 @@ function buildQuoted(quote, hasQuoteId) {
1228
1264
  if (!quote && !hasQuoteId) {
1229
1265
  return void 0;
1230
1266
  }
1231
- const author = quote?.author ?? { name: "Quoted post", handle: "" };
1267
+ const author = quote?.author ?? {
1268
+ name: "Quoted post",
1269
+ username: "",
1270
+ avatar_url: null
1271
+ };
1232
1272
  const body = quote?.body ?? "";
1233
1273
  const media = quote?.media ?? [];
1234
1274
  return {
@@ -1294,7 +1334,7 @@ function XPostPreviewImpl({
1294
1334
  showActions = true,
1295
1335
  className,
1296
1336
  style,
1297
- components
1337
+ components: componentsProp
1298
1338
  }) {
1299
1339
  const resolvedMedia = useResolvedMedia(
1300
1340
  media,
@@ -1302,6 +1342,15 @@ function XPostPreviewImpl({
1302
1342
  altSignatureOf(variant.media)
1303
1343
  );
1304
1344
  const resolvedQuotedMedia = useResolvedMedia(quotedTweet?.media, void 0, "");
1345
+ const components = useMemo(
1346
+ () => ({
1347
+ MediaImg: makeRawMediaImg(
1348
+ rawSrcLookup(resolvedMedia, resolvedQuotedMedia)
1349
+ ),
1350
+ ...componentsProp
1351
+ }),
1352
+ [resolvedMedia, resolvedQuotedMedia, componentsProp]
1353
+ );
1305
1354
  const tweet = useMemo(() => {
1306
1355
  const resolvedQuoted = quotedTweet ? {
1307
1356
  author: quotedTweet.author,
@@ -1344,6 +1393,8 @@ function XPostPreviewImpl({
1344
1393
  );
1345
1394
  }
1346
1395
  var XPostPreview = memo(XPostPreviewImpl);
1396
+
1397
+ // src/preview/linkedin/theme.ts
1347
1398
  var LI_VAR = {
1348
1399
  bg: "--pr-li-bg",
1349
1400
  text: "--pr-li-text",
@@ -1351,53 +1402,21 @@ var LI_VAR = {
1351
1402
  border: "--pr-li-border",
1352
1403
  accent: "--pr-li-accent"
1353
1404
  };
1354
- var LIGHT = {
1355
- bg: "#ffffff",
1356
- text: "rgba(0,0,0,0.9)",
1357
- muted: "rgba(0,0,0,0.6)",
1358
- border: "rgba(0,0,0,0.08)",
1359
- accent: "rgb(10,102,194)"
1360
- };
1361
- var DARK = {
1362
- bg: "#1b1f23",
1363
- text: "rgba(255,255,255,0.9)",
1364
- muted: "rgba(255,255,255,0.6)",
1365
- border: "rgba(255,255,255,0.15)",
1366
- accent: "rgb(112,181,249)"
1367
- };
1368
1405
  function varRef(name) {
1369
1406
  return `var(${name})`;
1370
1407
  }
1371
- function paletteVars(dark) {
1372
- const p = dark ? DARK : LIGHT;
1373
- return {
1374
- "--pr-li-bg": p.bg,
1375
- "--pr-li-text": p.text,
1376
- "--pr-li-muted": p.muted,
1377
- "--pr-li-border": p.border,
1378
- "--pr-li-accent": p.accent
1379
- };
1380
- }
1381
- function usePrefersDark() {
1382
- const [dark, setDark] = useState(false);
1383
- useEffect(() => {
1384
- if (typeof window === "undefined" || !window.matchMedia) {
1385
- return;
1386
- }
1387
- const mq = window.matchMedia("(prefers-color-scheme: dark)");
1388
- setDark(mq.matches);
1389
- const onChange = (event) => setDark(event.matches);
1390
- mq.addEventListener("change", onChange);
1391
- return () => mq.removeEventListener("change", onChange);
1392
- }, []);
1393
- return dark;
1408
+ var PALETTE_VARS = {
1409
+ [LI_VAR.bg]: "light-dark(#ffffff, #1b1f23)",
1410
+ [LI_VAR.text]: "light-dark(rgba(0,0,0,0.9), rgba(255,255,255,0.9))",
1411
+ [LI_VAR.muted]: "light-dark(rgba(0,0,0,0.6), rgba(255,255,255,0.6))",
1412
+ [LI_VAR.border]: "light-dark(rgba(0,0,0,0.08), rgba(255,255,255,0.15))",
1413
+ [LI_VAR.accent]: "light-dark(rgb(10,102,194), rgb(112,181,249))"
1414
+ };
1415
+ function paletteVars() {
1416
+ return PALETTE_VARS;
1394
1417
  }
1395
- function useIsDark(theme) {
1396
- const prefersDark = usePrefersDark();
1397
- if (theme === "auto") {
1398
- return prefersDark;
1399
- }
1400
- return theme === "dark";
1418
+ function colorSchemeFor(theme) {
1419
+ return theme === "auto" ? "light dark" : theme;
1401
1420
  }
1402
1421
  function domainOf(source) {
1403
1422
  try {
@@ -1540,7 +1559,7 @@ function Header({ author, visibility, time = "Now" }) {
1540
1559
  /* @__PURE__ */ jsx(
1541
1560
  "img",
1542
1561
  {
1543
- src: author.avatarUrl ?? PLACEHOLDER_AVATAR2,
1562
+ src: author.avatar_url ?? PLACEHOLDER_AVATAR2,
1544
1563
  alt: "",
1545
1564
  width: 48,
1546
1565
  height: 48,
@@ -1639,7 +1658,6 @@ function Tile({
1639
1658
  overlay ? /* @__PURE__ */ jsx(
1640
1659
  "div",
1641
1660
  {
1642
- "aria-hidden": false,
1643
1661
  style: {
1644
1662
  position: "absolute",
1645
1663
  inset: 0,
@@ -1810,7 +1828,18 @@ function linkify(text, colors, mentionNames) {
1810
1828
  );
1811
1829
  } else if (token.startsWith("#")) {
1812
1830
  nodes.push(
1813
- /* @__PURE__ */ jsx("a", { href: "#", style: linkStyle(colors.accent), children: token }, key++)
1831
+ // Preview-only hashtag: no real destination, so prevent the host SPA from
1832
+ // navigating / scrolling to top on click.
1833
+ /* @__PURE__ */ jsx(
1834
+ "a",
1835
+ {
1836
+ href: "#",
1837
+ style: linkStyle(colors.accent),
1838
+ onClick: (e) => e.preventDefault(),
1839
+ children: token
1840
+ },
1841
+ key++
1842
+ )
1814
1843
  );
1815
1844
  } else {
1816
1845
  nodes.push(
@@ -1828,32 +1857,41 @@ function PostBody({ text, mentionNames = [], colors }) {
1828
1857
  const [expanded, setExpanded] = useState(false);
1829
1858
  const isLong = text.length > FOLD_CHARS;
1830
1859
  const shown = isLong && !expanded ? truncateAtWord(text, FOLD_CHARS) : text;
1860
+ const nodes = useMemo(
1861
+ () => linkify(shown, colors, mentionNames),
1862
+ [shown, colors, mentionNames]
1863
+ );
1864
+ const toggleStyle2 = {
1865
+ background: "none",
1866
+ border: "none",
1867
+ padding: 0,
1868
+ cursor: "pointer",
1869
+ color: colors.muted,
1870
+ fontWeight: 600,
1871
+ fontSize: 14
1872
+ };
1831
1873
  return /* @__PURE__ */ jsxs("div", { style: BODY_STYLE, children: [
1832
- linkify(shown, colors, mentionNames),
1833
- isLong && !expanded ? /* @__PURE__ */ jsxs(Fragment, { children: [
1834
- "\u2026",
1835
- " ",
1874
+ nodes,
1875
+ isLong ? /* @__PURE__ */ jsxs(Fragment, { children: [
1876
+ !expanded ? "\u2026 " : " ",
1836
1877
  /* @__PURE__ */ jsx(
1837
1878
  "button",
1838
1879
  {
1839
1880
  type: "button",
1840
- onClick: () => setExpanded(true),
1841
- style: {
1842
- background: "none",
1843
- border: "none",
1844
- padding: 0,
1845
- cursor: "pointer",
1846
- color: colors.muted,
1847
- fontWeight: 600,
1848
- fontSize: 14
1849
- },
1850
- children: "more"
1881
+ "aria-expanded": expanded,
1882
+ onClick: () => setExpanded((v) => !v),
1883
+ style: toggleStyle2,
1884
+ children: expanded ? "see less" : "more"
1851
1885
  }
1852
1886
  )
1853
1887
  ] }) : null
1854
1888
  ] });
1855
1889
  }
1856
1890
  var FONT_STACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
1891
+ var BODY_COLORS = {
1892
+ accent: varRef(LI_VAR.accent),
1893
+ muted: varRef(LI_VAR.muted)
1894
+ };
1857
1895
  function LinkedInPostPreviewImpl({
1858
1896
  variant,
1859
1897
  author,
@@ -1864,20 +1902,19 @@ function LinkedInPostPreviewImpl({
1864
1902
  className,
1865
1903
  style
1866
1904
  }) {
1867
- const dark = useIsDark(theme);
1868
1905
  const resolvedMedia = useResolvedMedia(
1869
1906
  media,
1870
1907
  variant.media,
1871
1908
  altSignatureOf(variant.media)
1872
1909
  );
1873
1910
  const visibility = variant.settings?.visibility ?? "PUBLIC";
1874
- const mentionNames = (variant.settings?.mentions ?? []).map((m) => m.name);
1875
- const bodyColors = {
1876
- accent: varRef(LI_VAR.accent),
1877
- muted: varRef(LI_VAR.muted)
1878
- };
1879
- const cardStyle4 = {
1880
- ...paletteVars(dark),
1911
+ const mentionNames = useMemo(
1912
+ () => (variant.settings?.mentions ?? []).map((m) => m.name),
1913
+ [variant.settings?.mentions]
1914
+ );
1915
+ const cardStyle5 = {
1916
+ ...paletteVars(),
1917
+ colorScheme: colorSchemeFor(theme),
1881
1918
  background: varRef(LI_VAR.bg),
1882
1919
  color: varRef(LI_VAR.text),
1883
1920
  border: `1px solid ${varRef(LI_VAR.border)}`,
@@ -1887,14 +1924,14 @@ function LinkedInPostPreviewImpl({
1887
1924
  fontFamily: FONT_STACK,
1888
1925
  ...style
1889
1926
  };
1890
- return /* @__PURE__ */ jsxs("div", { className, style: cardStyle4, children: [
1927
+ return /* @__PURE__ */ jsxs("div", { className, style: cardStyle5, children: [
1891
1928
  /* @__PURE__ */ jsx(Header, { author, visibility, time }),
1892
1929
  variant.body ? /* @__PURE__ */ jsx("div", { style: { padding: "8px 16px 0" }, children: /* @__PURE__ */ jsx(
1893
1930
  PostBody,
1894
1931
  {
1895
1932
  text: variant.body,
1896
1933
  mentionNames,
1897
- colors: bodyColors
1934
+ colors: BODY_COLORS
1898
1935
  }
1899
1936
  ) }) : null,
1900
1937
  renderContent(variant, resolvedMedia),
@@ -1918,10 +1955,59 @@ function renderContent(variant, media) {
1918
1955
  }
1919
1956
  var INSET = { padding: "12px 16px 0" };
1920
1957
  var LinkedInPostPreview = memo(LinkedInPostPreviewImpl);
1921
- var LINK_COLOR = "#8ab4ff";
1922
- var TOKEN = /([#@][\p{L}\p{N}_.]+)/gu;
1923
- var IS_TOKEN = /^[#@][\p{L}\p{N}_.]+$/u;
1924
- function Caption({ body }) {
1958
+
1959
+ // src/preview/instagram/theme.ts
1960
+ var IG_VAR = {
1961
+ bg: "--pr-ig-bg",
1962
+ text: "--pr-ig-text",
1963
+ muted: "--pr-ig-muted",
1964
+ border: "--pr-ig-border",
1965
+ accent: "--pr-ig-accent"
1966
+ };
1967
+ function varRef2(name) {
1968
+ return `var(${name})`;
1969
+ }
1970
+ var PALETTE_VARS2 = {
1971
+ [IG_VAR.bg]: "light-dark(#ffffff, #000000)",
1972
+ [IG_VAR.text]: "light-dark(#000000, #f5f5f5)",
1973
+ [IG_VAR.muted]: "light-dark(#737373, #a8a8a8)",
1974
+ [IG_VAR.border]: "light-dark(#dbdbdb, #262626)",
1975
+ [IG_VAR.accent]: "light-dark(#00376b, #e0f1ff)"
1976
+ };
1977
+ function paletteVars2() {
1978
+ return PALETTE_VARS2;
1979
+ }
1980
+ function colorSchemeFor2(theme) {
1981
+ return theme === "auto" ? "light dark" : theme;
1982
+ }
1983
+ function Actions() {
1984
+ return /* @__PURE__ */ jsxs("div", { style: rowStyle, children: [
1985
+ /* @__PURE__ */ jsxs("div", { style: leftStyle, children: [
1986
+ /* @__PURE__ */ jsx(FiHeart, { size: 24, "aria-label": "Like", role: "img" }),
1987
+ /* @__PURE__ */ jsx(FiMessageCircle, { size: 24, "aria-label": "Comment", role: "img" }),
1988
+ /* @__PURE__ */ jsx(FiSend, { size: 24, "aria-label": "Share", role: "img" })
1989
+ ] }),
1990
+ /* @__PURE__ */ jsx(FiBookmark, { size: 24, "aria-label": "Save", role: "img" })
1991
+ ] });
1992
+ }
1993
+ var rowStyle = {
1994
+ display: "flex",
1995
+ alignItems: "center",
1996
+ justifyContent: "space-between",
1997
+ padding: "10px 12px 4px",
1998
+ color: varRef2(IG_VAR.text)
1999
+ };
2000
+ var leftStyle = {
2001
+ display: "flex",
2002
+ alignItems: "center",
2003
+ gap: 16
2004
+ };
2005
+ function ExpandableText({
2006
+ children,
2007
+ lines = 2,
2008
+ toggleColor,
2009
+ style
2010
+ }) {
1925
2011
  const [expanded, setExpanded] = useState(false);
1926
2012
  const [overflowing, setOverflowing] = useState(false);
1927
2013
  const ref = useRef(null);
@@ -1930,56 +2016,418 @@ function Caption({ body }) {
1930
2016
  if (!el || expanded) {
1931
2017
  return;
1932
2018
  }
1933
- setOverflowing(el.scrollHeight > el.clientHeight + 1);
1934
- }, [body, expanded]);
1935
- const parts = body.split(TOKEN);
1936
- return /* @__PURE__ */ jsxs("div", { style: wrapStyle3, children: [
1937
- /* @__PURE__ */ jsx("div", { ref, style: expanded ? expandedTextStyle : clampedTextStyle, children: parts.map(
1938
- (part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
1939
- ) }),
2019
+ const measure = () => setOverflowing(el.scrollHeight > el.clientHeight + 1);
2020
+ measure();
2021
+ if (typeof ResizeObserver === "undefined") {
2022
+ return;
2023
+ }
2024
+ const ro = new ResizeObserver(measure);
2025
+ ro.observe(el);
2026
+ return () => ro.disconnect();
2027
+ }, [expanded, children]);
2028
+ const textStyle = expanded ? FULL : { ...FULL, ...clampStyle(lines) };
2029
+ return /* @__PURE__ */ jsxs("div", { style, children: [
2030
+ /* @__PURE__ */ jsx("div", { ref, style: textStyle, children }),
1940
2031
  overflowing || expanded ? /* @__PURE__ */ jsx(
1941
2032
  "button",
1942
2033
  {
1943
2034
  type: "button",
1944
2035
  "aria-expanded": expanded,
1945
- "aria-label": expanded ? "Collapse caption" : "Expand caption",
2036
+ "aria-label": expanded ? "Show less" : "Show more",
1946
2037
  onClick: () => setExpanded((v) => !v),
1947
- style: moreStyle,
2038
+ style: { ...toggleStyle, color: toggleColor ?? "inherit" },
1948
2039
  children: expanded ? "less" : "more"
1949
2040
  }
1950
2041
  ) : null
1951
2042
  ] });
1952
2043
  }
1953
- var wrapStyle3 = {
1954
- fontSize: 14,
1955
- lineHeight: 1.35
1956
- };
1957
- var clampedTextStyle = {
1958
- display: "-webkit-box",
1959
- WebkitLineClamp: 2,
1960
- WebkitBoxOrient: "vertical",
1961
- overflow: "hidden",
2044
+ var FULL = {
1962
2045
  whiteSpace: "pre-wrap",
1963
2046
  wordBreak: "break-word"
1964
2047
  };
1965
- var expandedTextStyle = {
1966
- maxHeight: 180,
1967
- overflowY: "auto",
1968
- whiteSpace: "pre-wrap",
1969
- wordBreak: "break-word",
1970
- overscrollBehavior: "contain"
1971
- };
1972
- var moreStyle = {
2048
+ function clampStyle(lines) {
2049
+ return {
2050
+ display: "-webkit-box",
2051
+ WebkitLineClamp: lines,
2052
+ WebkitBoxOrient: "vertical",
2053
+ overflow: "hidden"
2054
+ };
2055
+ }
2056
+ var toggleStyle = {
1973
2057
  display: "inline-block",
1974
2058
  marginTop: 2,
1975
2059
  padding: 0,
1976
2060
  border: 0,
1977
2061
  background: "transparent",
1978
- color: "rgba(255,255,255,0.82)",
1979
- fontSize: 13,
2062
+ font: "inherit",
1980
2063
  fontWeight: 600,
1981
- cursor: "pointer",
1982
- fontFamily: "inherit"
2064
+ cursor: "pointer"
2065
+ };
2066
+ var TOKEN = /([#@][\p{L}\p{N}_.]+)/gu;
2067
+ var IS_TOKEN = /^[#@][\p{L}\p{N}_.]+$/u;
2068
+ function Caption({
2069
+ username,
2070
+ body
2071
+ }) {
2072
+ const parts = body.split(TOKEN);
2073
+ return /* @__PURE__ */ jsxs(
2074
+ ExpandableText,
2075
+ {
2076
+ lines: 2,
2077
+ toggleColor: varRef2(IG_VAR.muted),
2078
+ style: wrapStyle3,
2079
+ children: [
2080
+ username ? /* @__PURE__ */ jsxs("span", { style: { fontWeight: 600 }, children: [
2081
+ username,
2082
+ " "
2083
+ ] }) : null,
2084
+ parts.map(
2085
+ (part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsx("span", { style: { color: varRef2(IG_VAR.accent) }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
2086
+ )
2087
+ ]
2088
+ }
2089
+ );
2090
+ }
2091
+ var wrapStyle3 = {
2092
+ padding: "4px 12px 0",
2093
+ fontSize: 14,
2094
+ lineHeight: 1.4,
2095
+ color: varRef2(IG_VAR.text)
2096
+ };
2097
+ function FeedMedia({ media }) {
2098
+ if (media.length <= 1) {
2099
+ return /* @__PURE__ */ jsx("div", { style: frameStyle, children: media[0] ? /* @__PURE__ */ jsx(Tile2, { item: media[0] }) : null });
2100
+ }
2101
+ return /* @__PURE__ */ jsx(Carousel, { media });
2102
+ }
2103
+ function Tile2({ item }) {
2104
+ if (item.kind === "video") {
2105
+ return /* @__PURE__ */ jsx("video", { src: item.src, poster: item.posterSrc, controls: true, style: mediaStyle });
2106
+ }
2107
+ return /* @__PURE__ */ jsx("img", { src: item.src, alt: item.alt ?? "", style: mediaStyle });
2108
+ }
2109
+ function Carousel({ media }) {
2110
+ const [emblaRef, emblaApi] = useEmblaCarousel({ loop: false, align: "start" });
2111
+ const [selected, setSelected] = useState(0);
2112
+ const sync = useCallback((api) => {
2113
+ setSelected(api.selectedScrollSnap());
2114
+ }, []);
2115
+ useEffect(() => {
2116
+ if (!emblaApi) {
2117
+ return;
2118
+ }
2119
+ sync(emblaApi);
2120
+ emblaApi.on("select", sync).on("reInit", sync);
2121
+ return () => {
2122
+ emblaApi.off("select", sync).off("reInit", sync);
2123
+ };
2124
+ }, [emblaApi, sync]);
2125
+ return /* @__PURE__ */ jsxs("div", { style: frameStyle, children: [
2126
+ /* @__PURE__ */ jsx("div", { ref: emblaRef, style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx("div", { style: { display: "flex", height: "100%" }, children: media.map((item) => /* @__PURE__ */ jsx("div", { style: slideStyle, children: /* @__PURE__ */ jsx(Tile2, { item }) }, item.src)) }) }),
2127
+ /* @__PURE__ */ jsxs("div", { style: pillStyle, children: [
2128
+ selected + 1,
2129
+ "/",
2130
+ media.length
2131
+ ] }),
2132
+ /* @__PURE__ */ jsx("div", { style: dotsStyle, children: media.map((item, i) => /* @__PURE__ */ jsx(
2133
+ "span",
2134
+ {
2135
+ style: { ...dotStyle, opacity: i === selected ? 1 : 0.5 }
2136
+ },
2137
+ `dot-${item.src}`
2138
+ )) })
2139
+ ] });
2140
+ }
2141
+ var frameStyle = {
2142
+ position: "relative",
2143
+ width: "100%",
2144
+ aspectRatio: "1 / 1",
2145
+ background: "#000",
2146
+ overflow: "hidden"
2147
+ };
2148
+ var mediaStyle = {
2149
+ position: "absolute",
2150
+ inset: 0,
2151
+ width: "100%",
2152
+ height: "100%",
2153
+ objectFit: "cover"
2154
+ };
2155
+ var slideStyle = {
2156
+ position: "relative",
2157
+ flex: "0 0 100%",
2158
+ minWidth: 0,
2159
+ height: "100%"
2160
+ };
2161
+ var pillStyle = {
2162
+ position: "absolute",
2163
+ top: 12,
2164
+ right: 12,
2165
+ background: "rgba(0,0,0,0.6)",
2166
+ color: "#fff",
2167
+ fontSize: 12,
2168
+ fontWeight: 600,
2169
+ padding: "2px 9px",
2170
+ borderRadius: 999
2171
+ };
2172
+ var dotsStyle = {
2173
+ position: "absolute",
2174
+ bottom: 10,
2175
+ left: "50%",
2176
+ transform: "translateX(-50%)",
2177
+ display: "flex",
2178
+ gap: 4
2179
+ };
2180
+ var dotStyle = {
2181
+ width: 6,
2182
+ height: 6,
2183
+ borderRadius: "50%",
2184
+ background: "#fff"
2185
+ };
2186
+ var PLACEHOLDER_AVATAR3 = "data:image/svg+xml;utf8," + encodeURIComponent(
2187
+ '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="16" fill="#b3b3b3"/></svg>'
2188
+ );
2189
+ function Header2({
2190
+ author,
2191
+ collaborators
2192
+ }) {
2193
+ return /* @__PURE__ */ jsxs("div", { style: rowStyle2, children: [
2194
+ /* @__PURE__ */ jsx(
2195
+ "img",
2196
+ {
2197
+ src: author.avatar_url ?? PLACEHOLDER_AVATAR3,
2198
+ alt: "",
2199
+ width: 32,
2200
+ height: 32,
2201
+ style: avatarStyle
2202
+ }
2203
+ ),
2204
+ /* @__PURE__ */ jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column" }, children: [
2205
+ /* @__PURE__ */ jsxs("span", { style: nameStyle, children: [
2206
+ author.username ?? "",
2207
+ author.verified ? /* @__PURE__ */ jsx(
2208
+ MdVerified,
2209
+ {
2210
+ size: 13,
2211
+ "aria-label": "Verified",
2212
+ role: "img",
2213
+ style: { color: "#3897f0", marginLeft: 3, flex: "0 0 auto" }
2214
+ }
2215
+ ) : null
2216
+ ] }),
2217
+ collaborators.length > 0 ? /* @__PURE__ */ jsxs("span", { style: collabStyle, children: [
2218
+ "with ",
2219
+ collaborators.map((c) => `@${c}`).join(", ")
2220
+ ] }) : null
2221
+ ] }),
2222
+ /* @__PURE__ */ jsx(
2223
+ FiMoreHorizontal,
2224
+ {
2225
+ size: 18,
2226
+ "aria-hidden": true,
2227
+ style: { marginLeft: "auto", color: varRef2(IG_VAR.text) }
2228
+ }
2229
+ )
2230
+ ] });
2231
+ }
2232
+ var rowStyle2 = {
2233
+ display: "flex",
2234
+ alignItems: "center",
2235
+ gap: 10,
2236
+ padding: "10px 12px"
2237
+ };
2238
+ var avatarStyle = {
2239
+ width: 32,
2240
+ height: 32,
2241
+ borderRadius: "50%",
2242
+ objectFit: "cover",
2243
+ flex: "0 0 auto"
2244
+ };
2245
+ var nameStyle = {
2246
+ display: "flex",
2247
+ alignItems: "center",
2248
+ fontSize: 14,
2249
+ fontWeight: 600,
2250
+ color: varRef2(IG_VAR.text),
2251
+ lineHeight: 1.2
2252
+ };
2253
+ var collabStyle = {
2254
+ fontSize: 12,
2255
+ color: varRef2(IG_VAR.muted),
2256
+ lineHeight: 1.2
2257
+ };
2258
+ function ReelPreview({
2259
+ author,
2260
+ body,
2261
+ media,
2262
+ audioName,
2263
+ className,
2264
+ style
2265
+ }) {
2266
+ const first = media[0];
2267
+ const username = author.username;
2268
+ return /* @__PURE__ */ jsxs("div", { className, style: { ...cardStyle3, ...style }, children: [
2269
+ first ? first.kind === "video" ? /* @__PURE__ */ jsx(
2270
+ "video",
2271
+ {
2272
+ src: first.src,
2273
+ poster: first.posterSrc,
2274
+ autoPlay: true,
2275
+ muted: true,
2276
+ loop: true,
2277
+ playsInline: true,
2278
+ style: coverStyle2
2279
+ }
2280
+ ) : /* @__PURE__ */ jsx("img", { src: first.src, alt: first.alt ?? "", style: coverStyle2 }) : null,
2281
+ /* @__PURE__ */ jsx("div", { style: scrimStyle }),
2282
+ /* @__PURE__ */ jsxs("div", { style: infoStyle, children: [
2283
+ /* @__PURE__ */ jsxs("div", { style: authorRowStyle, children: [
2284
+ username ? /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: 14 }, children: username }) : null,
2285
+ author.verified ? /* @__PURE__ */ jsx(MdVerified, { size: 13, "aria-label": "Verified", role: "img", style: { color: "#fff" } }) : null
2286
+ ] }),
2287
+ body ? /* @__PURE__ */ jsx(
2288
+ ExpandableText,
2289
+ {
2290
+ lines: 2,
2291
+ toggleColor: "rgba(255,255,255,0.7)",
2292
+ style: captionStyle,
2293
+ children: body
2294
+ }
2295
+ ) : null,
2296
+ /* @__PURE__ */ jsxs("div", { style: audioStyle, children: [
2297
+ /* @__PURE__ */ jsx(MdMusicNote, { size: 14, "aria-hidden": true }),
2298
+ /* @__PURE__ */ jsx("span", { children: audioName ?? "Original audio" })
2299
+ ] })
2300
+ ] }),
2301
+ /* @__PURE__ */ jsxs("div", { style: railStyle, children: [
2302
+ /* @__PURE__ */ jsx(FiHeart, { size: 26, "aria-label": "Like", role: "img" }),
2303
+ /* @__PURE__ */ jsx(FiMessageCircle, { size: 26, "aria-label": "Comment", role: "img" }),
2304
+ /* @__PURE__ */ jsx(FiSend, { size: 26, "aria-label": "Share", role: "img" }),
2305
+ /* @__PURE__ */ jsx(FiBookmark, { size: 26, "aria-label": "Save", role: "img" }),
2306
+ /* @__PURE__ */ jsx(FiMoreHorizontal, { size: 22, "aria-hidden": true })
2307
+ ] })
2308
+ ] });
2309
+ }
2310
+ var cardStyle3 = {
2311
+ position: "relative",
2312
+ width: "100%",
2313
+ maxWidth: 320,
2314
+ aspectRatio: "9 / 16",
2315
+ borderRadius: 12,
2316
+ overflow: "hidden",
2317
+ background: "#000",
2318
+ color: "#fff",
2319
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
2320
+ };
2321
+ var coverStyle2 = {
2322
+ position: "absolute",
2323
+ inset: 0,
2324
+ width: "100%",
2325
+ height: "100%",
2326
+ objectFit: "cover"
2327
+ };
2328
+ var scrimStyle = {
2329
+ position: "absolute",
2330
+ inset: 0,
2331
+ background: "linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.55) 100%)",
2332
+ pointerEvents: "none"
2333
+ };
2334
+ var infoStyle = {
2335
+ position: "absolute",
2336
+ left: 12,
2337
+ right: 60,
2338
+ bottom: 14,
2339
+ display: "flex",
2340
+ flexDirection: "column",
2341
+ gap: 6,
2342
+ textShadow: "0 1px 3px rgba(0,0,0,0.5)"
2343
+ };
2344
+ var authorRowStyle = {
2345
+ display: "flex",
2346
+ alignItems: "center",
2347
+ gap: 5
2348
+ };
2349
+ var captionStyle = {
2350
+ fontSize: 13,
2351
+ lineHeight: 1.35
2352
+ };
2353
+ var audioStyle = {
2354
+ display: "flex",
2355
+ alignItems: "center",
2356
+ gap: 6,
2357
+ fontSize: 12
2358
+ };
2359
+ var railStyle = {
2360
+ position: "absolute",
2361
+ right: 8,
2362
+ bottom: 16,
2363
+ display: "flex",
2364
+ flexDirection: "column",
2365
+ alignItems: "center",
2366
+ gap: 18,
2367
+ color: "#fff",
2368
+ filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.4))"
2369
+ };
2370
+ function InstagramPostPreviewImpl({
2371
+ variant,
2372
+ author,
2373
+ media,
2374
+ theme = "auto",
2375
+ className,
2376
+ style
2377
+ }) {
2378
+ const resolvedMedia = useResolvedMedia(
2379
+ media,
2380
+ variant.media,
2381
+ altSignatureOf(variant.media)
2382
+ );
2383
+ const settings = variant.settings;
2384
+ const isReel = variant.post_type === "reel";
2385
+ if (isReel) {
2386
+ return /* @__PURE__ */ jsx(
2387
+ ReelPreview,
2388
+ {
2389
+ author,
2390
+ body: variant.body ?? "",
2391
+ media: resolvedMedia,
2392
+ audioName: settings?.audio_name,
2393
+ className,
2394
+ style
2395
+ }
2396
+ );
2397
+ }
2398
+ const collaborators = settings?.collaborators ?? [];
2399
+ const cardStyle5 = {
2400
+ ...paletteVars2(),
2401
+ colorScheme: colorSchemeFor2(theme),
2402
+ background: varRef2(IG_VAR.bg),
2403
+ color: varRef2(IG_VAR.text),
2404
+ border: `1px solid ${varRef2(IG_VAR.border)}`,
2405
+ borderRadius: 8,
2406
+ maxWidth: 470,
2407
+ overflow: "hidden",
2408
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
2409
+ ...style
2410
+ };
2411
+ return /* @__PURE__ */ jsxs("div", { className, style: cardStyle5, children: [
2412
+ /* @__PURE__ */ jsx(Header2, { author, collaborators }),
2413
+ /* @__PURE__ */ jsx(FeedMedia, { media: resolvedMedia }),
2414
+ /* @__PURE__ */ jsx(Actions, {}),
2415
+ variant.body ? /* @__PURE__ */ jsx("div", { style: { paddingBottom: 12 }, children: /* @__PURE__ */ jsx(Caption, { username: author.username, body: variant.body }) }) : null
2416
+ ] });
2417
+ }
2418
+ var InstagramPostPreview = memo(InstagramPostPreviewImpl);
2419
+ var LINK_COLOR = "#8ab4ff";
2420
+ var TOKEN2 = /([#@][\p{L}\p{N}_.]+)/gu;
2421
+ var IS_TOKEN2 = /^[#@][\p{L}\p{N}_.]+$/u;
2422
+ function Caption2({ body }) {
2423
+ const parts = body.split(TOKEN2);
2424
+ return /* @__PURE__ */ jsx(ExpandableText, { lines: 2, toggleColor: "rgba(255,255,255,0.82)", style: wrapStyle4, children: parts.map(
2425
+ (part, i) => IS_TOKEN2.test(part) ? /* @__PURE__ */ jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
2426
+ ) });
2427
+ }
2428
+ var wrapStyle4 = {
2429
+ fontSize: 14,
2430
+ lineHeight: 1.35
1983
2431
  };
1984
2432
  function Media2({
1985
2433
  media,
@@ -1999,7 +2447,7 @@ function Media2({
1999
2447
  muted: true,
2000
2448
  loop: true,
2001
2449
  playsInline: true,
2002
- style: coverStyle2
2450
+ style: coverStyle3
2003
2451
  }
2004
2452
  );
2005
2453
  }
@@ -2026,11 +2474,11 @@ function PhotoCarousel({ media }) {
2026
2474
  };
2027
2475
  }, [emblaApi, sync]);
2028
2476
  return /* @__PURE__ */ jsxs("div", { style: { position: "absolute", inset: 0 }, children: [
2029
- /* @__PURE__ */ jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsx("div", { style: slideStyle, children: /* @__PURE__ */ jsx("img", { src: m.src, alt: m.alt ?? "", style: coverStyle2 }) }, `${m.src}-${i}`)) }) }),
2030
- media.length > 1 ? /* @__PURE__ */ jsx("div", { style: dotsStyle, children: media.map((m, i) => /* @__PURE__ */ jsx(
2477
+ /* @__PURE__ */ jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsx("div", { style: slideStyle2, children: /* @__PURE__ */ jsx("img", { src: m.src, alt: m.alt ?? "", style: coverStyle3 }) }, `${m.src}-${i}`)) }) }),
2478
+ media.length > 1 ? /* @__PURE__ */ jsx("div", { style: dotsStyle2, children: media.map((m, i) => /* @__PURE__ */ jsx(
2031
2479
  "span",
2032
2480
  {
2033
- style: { ...dotStyle, opacity: i === selected ? 1 : 0.4 }
2481
+ style: { ...dotStyle2, opacity: i === selected ? 1 : 0.4 }
2034
2482
  },
2035
2483
  `dot-${m.src}-${i}`
2036
2484
  )) }) : null
@@ -2041,11 +2489,13 @@ function EmptyMedia() {
2041
2489
  }
2042
2490
  function ProcessingMedia() {
2043
2491
  return /* @__PURE__ */ jsxs("div", { style: emptyStyle, children: [
2492
+ /* @__PURE__ */ jsx("style", { children: SHIMMER_KEYFRAME }),
2044
2493
  /* @__PURE__ */ jsx("div", { style: shimmerStyle }),
2045
2494
  /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children: "Processing media\u2026" })
2046
2495
  ] });
2047
2496
  }
2048
- var coverStyle2 = {
2497
+ var SHIMMER_KEYFRAME = `@keyframes pr-tt-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}`;
2498
+ var coverStyle3 = {
2049
2499
  position: "absolute",
2050
2500
  inset: 0,
2051
2501
  width: "100%",
@@ -2061,13 +2511,13 @@ var containerStyle = {
2061
2511
  display: "flex",
2062
2512
  height: "100%"
2063
2513
  };
2064
- var slideStyle = {
2514
+ var slideStyle2 = {
2065
2515
  position: "relative",
2066
2516
  flex: "0 0 100%",
2067
2517
  minWidth: 0,
2068
2518
  height: "100%"
2069
2519
  };
2070
- var dotsStyle = {
2520
+ var dotsStyle2 = {
2071
2521
  position: "absolute",
2072
2522
  bottom: 124,
2073
2523
  left: "50%",
@@ -2076,7 +2526,7 @@ var dotsStyle = {
2076
2526
  gap: 5,
2077
2527
  alignItems: "center"
2078
2528
  };
2079
- var dotStyle = {
2529
+ var dotStyle2 = {
2080
2530
  width: 6,
2081
2531
  height: 6,
2082
2532
  borderRadius: "50%",
@@ -2171,16 +2621,16 @@ function TikTokPostPreviewImpl({
2171
2621
  const label = commercialLabel(variant.settings);
2172
2622
  const isAigc = Boolean(variant.settings?.is_aigc);
2173
2623
  const pending = (media?.length ?? 0) > 0 && resolvedMedia.length === 0;
2174
- return /* @__PURE__ */ jsxs("div", { className, style: { ...cardStyle3, ...style }, children: [
2624
+ return /* @__PURE__ */ jsxs("div", { className, style: { ...cardStyle4, ...style }, children: [
2175
2625
  /* @__PURE__ */ jsx("style", { children: KEYFRAMES }),
2176
2626
  /* @__PURE__ */ jsx(Media2, { media: resolvedMedia, pending }),
2177
- /* @__PURE__ */ jsx("div", { style: scrimStyle }),
2178
- /* @__PURE__ */ jsxs("div", { style: infoStyle, children: [
2627
+ /* @__PURE__ */ jsx("div", { style: scrimStyle2 }),
2628
+ /* @__PURE__ */ jsxs("div", { style: infoStyle2, children: [
2179
2629
  /* @__PURE__ */ jsx("div", { style: usernameStyle, children: handle }),
2180
- variant.body ? /* @__PURE__ */ jsx(Caption, { body: variant.body }) : null,
2630
+ variant.body ? /* @__PURE__ */ jsx(Caption2, { body: variant.body }) : null,
2181
2631
  label || isAigc ? /* @__PURE__ */ jsxs("div", { style: labelsStyle, children: [
2182
- label ? /* @__PURE__ */ jsx("span", { style: pillStyle, children: label }) : null,
2183
- isAigc ? /* @__PURE__ */ jsx("span", { style: pillStyle, children: "Creator labeled as AI-generated" }) : null
2632
+ label ? /* @__PURE__ */ jsx("span", { style: pillStyle2, children: label }) : null,
2633
+ isAigc ? /* @__PURE__ */ jsx("span", { style: pillStyle2, children: "Creator labeled as AI-generated" }) : null
2184
2634
  ] }) : null,
2185
2635
  /* @__PURE__ */ jsxs("div", { style: musicRowStyle, children: [
2186
2636
  /* @__PURE__ */ jsx(IoMusicalNotes, { size: 13 }),
@@ -2190,7 +2640,7 @@ function TikTokPostPreviewImpl({
2190
2640
  ] })
2191
2641
  ] })
2192
2642
  ] }),
2193
- /* @__PURE__ */ jsxs("div", { style: railStyle, children: [
2643
+ /* @__PURE__ */ jsxs("div", { style: railStyle2, children: [
2194
2644
  /* @__PURE__ */ jsxs("div", { style: avatarWrapStyle, children: [
2195
2645
  /* @__PURE__ */ jsx(Avatar, { url: creator.avatar_url, name: creator.nickname }),
2196
2646
  /* @__PURE__ */ jsx("span", { style: followBadgeStyle, children: /* @__PURE__ */ jsx(PlusIcon, { size: 14 }) })
@@ -2211,14 +2661,14 @@ function RailAction({ icon, count }) {
2211
2661
  }
2212
2662
  function Avatar({ url, name }) {
2213
2663
  if (url) {
2214
- return /* @__PURE__ */ jsx("img", { src: url, alt: name, style: avatarStyle });
2664
+ return /* @__PURE__ */ jsx("img", { src: url, alt: name, style: avatarStyle2 });
2215
2665
  }
2216
- return /* @__PURE__ */ jsx("div", { style: { ...avatarStyle, ...avatarFallbackStyle }, children: name.slice(0, 1).toUpperCase() });
2666
+ return /* @__PURE__ */ jsx("div", { style: { ...avatarStyle2, ...avatarFallbackStyle }, children: name.slice(0, 1).toUpperCase() });
2217
2667
  }
2218
2668
  function Disc({ url }) {
2219
2669
  return /* @__PURE__ */ jsx("div", { style: discStyle, children: url ? /* @__PURE__ */ jsx("img", { src: url, alt: "", style: discImgStyle }) : null });
2220
2670
  }
2221
- var cardStyle3 = {
2671
+ var cardStyle4 = {
2222
2672
  position: "relative",
2223
2673
  width: "100%",
2224
2674
  maxWidth: 320,
@@ -2229,13 +2679,13 @@ var cardStyle3 = {
2229
2679
  color: "#fff",
2230
2680
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
2231
2681
  };
2232
- var scrimStyle = {
2682
+ var scrimStyle2 = {
2233
2683
  position: "absolute",
2234
2684
  inset: 0,
2235
2685
  background: "linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%)",
2236
2686
  pointerEvents: "none"
2237
2687
  };
2238
- var infoStyle = {
2688
+ var infoStyle2 = {
2239
2689
  position: "absolute",
2240
2690
  left: 14,
2241
2691
  right: 70,
@@ -2256,7 +2706,7 @@ var labelsStyle = {
2256
2706
  gap: 4,
2257
2707
  marginTop: 2
2258
2708
  };
2259
- var pillStyle = {
2709
+ var pillStyle2 = {
2260
2710
  display: "inline-flex",
2261
2711
  alignItems: "center",
2262
2712
  background: "rgba(255,255,255,0.18)",
@@ -2273,7 +2723,7 @@ var musicRowStyle = {
2273
2723
  fontSize: 13,
2274
2724
  marginTop: 4
2275
2725
  };
2276
- var railStyle = {
2726
+ var railStyle2 = {
2277
2727
  position: "absolute",
2278
2728
  right: 8,
2279
2729
  bottom: 14,
@@ -2287,7 +2737,7 @@ var avatarWrapStyle = {
2287
2737
  position: "relative",
2288
2738
  marginBottom: 8
2289
2739
  };
2290
- var avatarStyle = {
2740
+ var avatarStyle2 = {
2291
2741
  width: 46,
2292
2742
  height: 46,
2293
2743
  borderRadius: "50%",
@@ -2350,6 +2800,8 @@ var discImgStyle = {
2350
2800
  };
2351
2801
  var KEYFRAMES = `@keyframes pr-tt-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pr-tt-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}`;
2352
2802
  var TikTokPostPreview = memo(TikTokPostPreviewImpl);
2803
+
2804
+ // src/preview/tiktok/theme.ts
2353
2805
  var TT_VAR = {
2354
2806
  text: "--pr-tt-text",
2355
2807
  muted: "--pr-tt-muted",
@@ -2357,58 +2809,26 @@ var TT_VAR = {
2357
2809
  accent: "--pr-tt-accent",
2358
2810
  switchOff: "--pr-tt-switch-off"
2359
2811
  };
2360
- var LIGHT2 = {
2361
- text: "rgba(0,0,0,0.9)",
2362
- muted: "rgba(0,0,0,0.55)",
2363
- border: "rgba(0,0,0,0.12)",
2364
- accent: "#fe2c55",
2365
- switchOff: "rgba(0,0,0,0.18)"
2366
- };
2367
- var DARK2 = {
2368
- text: "rgba(255,255,255,0.92)",
2369
- muted: "#8a8a92",
2370
- border: "rgba(255,255,255,0.14)",
2371
- accent: "#fe2c55",
2372
- switchOff: "rgba(255,255,255,0.22)"
2373
- };
2374
- function varRef2(name) {
2812
+ function varRef3(name) {
2375
2813
  return `var(${name})`;
2376
2814
  }
2377
- function paletteVars2(dark) {
2378
- const p = dark ? DARK2 : LIGHT2;
2379
- return {
2380
- [TT_VAR.text]: p.text,
2381
- [TT_VAR.muted]: p.muted,
2382
- [TT_VAR.border]: p.border,
2383
- [TT_VAR.accent]: p.accent,
2384
- [TT_VAR.switchOff]: p.switchOff
2385
- };
2386
- }
2387
- function usePrefersDark2() {
2388
- const [dark, setDark] = useState(false);
2389
- useEffect(() => {
2390
- if (typeof window === "undefined" || !window.matchMedia) {
2391
- return;
2392
- }
2393
- const mq = window.matchMedia("(prefers-color-scheme: dark)");
2394
- setDark(mq.matches);
2395
- const onChange = (event) => setDark(event.matches);
2396
- mq.addEventListener("change", onChange);
2397
- return () => mq.removeEventListener("change", onChange);
2398
- }, []);
2399
- return dark;
2815
+ var PALETTE_VARS3 = {
2816
+ [TT_VAR.text]: "light-dark(rgba(0,0,0,0.9), rgba(255,255,255,0.92))",
2817
+ [TT_VAR.muted]: "light-dark(rgba(0,0,0,0.55), #8a8a92)",
2818
+ [TT_VAR.border]: "light-dark(rgba(0,0,0,0.12), rgba(255,255,255,0.14))",
2819
+ [TT_VAR.accent]: "#fe2c55",
2820
+ [TT_VAR.switchOff]: "light-dark(rgba(0,0,0,0.18), rgba(255,255,255,0.22))"
2821
+ };
2822
+ function paletteVars3() {
2823
+ return PALETTE_VARS3;
2400
2824
  }
2401
- function useIsDark2(theme) {
2402
- const prefersDark = usePrefersDark2();
2403
- if (theme === "auto") {
2404
- return prefersDark;
2405
- }
2406
- return theme === "dark";
2825
+ function colorSchemeFor3(theme) {
2826
+ return theme === "auto" ? "light dark" : theme;
2407
2827
  }
2408
- var MUTED2 = varRef2(TT_VAR.muted);
2409
- var BORDER = varRef2(TT_VAR.border);
2410
- var ACCENT = varRef2(TT_VAR.accent);
2411
- var SWITCH_OFF = varRef2(TT_VAR.switchOff);
2828
+ var MUTED2 = varRef3(TT_VAR.muted);
2829
+ var BORDER = varRef3(TT_VAR.border);
2830
+ var ACCENT = varRef3(TT_VAR.accent);
2831
+ var SWITCH_OFF = varRef3(TT_VAR.switchOff);
2412
2832
  var ON = "#34c759";
2413
2833
  function Row({
2414
2834
  label,
@@ -2416,11 +2836,17 @@ function Row({
2416
2836
  control,
2417
2837
  htmlFor
2418
2838
  }) {
2419
- return /* @__PURE__ */ jsxs("div", { style: rowStyle, children: [
2420
- /* @__PURE__ */ jsxs("label", { htmlFor, style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
2421
- /* @__PURE__ */ jsx("span", { style: { fontSize: 14 }, children: label }),
2422
- sublabel ? /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: MUTED2 }, children: sublabel }) : null
2423
- ] }),
2839
+ const text = /* @__PURE__ */ jsxs(Fragment, { children: [
2840
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 14 }, children: label }),
2841
+ sublabel ? /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: MUTED2 }, children: sublabel }) : null
2842
+ ] });
2843
+ const textStyle = {
2844
+ display: "flex",
2845
+ flexDirection: "column",
2846
+ gap: 2
2847
+ };
2848
+ return /* @__PURE__ */ jsxs("div", { style: rowStyle3, children: [
2849
+ htmlFor ? /* @__PURE__ */ jsx("label", { htmlFor, style: textStyle, children: text }) : /* @__PURE__ */ jsx("span", { style: textStyle, children: text }),
2424
2850
  control
2425
2851
  ] });
2426
2852
  }
@@ -2488,7 +2914,7 @@ function CheckRow({
2488
2914
  /* @__PURE__ */ jsx("span", { style: { fontSize: 14 }, children: label })
2489
2915
  ] });
2490
2916
  }
2491
- var rowStyle = {
2917
+ var rowStyle3 = {
2492
2918
  display: "flex",
2493
2919
  alignItems: "center",
2494
2920
  justifyContent: "space-between",
@@ -2542,7 +2968,6 @@ function AudienceSelect({
2542
2968
  value,
2543
2969
  onChange
2544
2970
  }) {
2545
- const id = useId();
2546
2971
  const options = audiencePrivacyOptions(creatorInfo.privacy_options, value);
2547
2972
  const unselected = audienceUnselected(value);
2548
2973
  return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
@@ -2550,7 +2975,7 @@ function AudienceSelect({
2550
2975
  /* @__PURE__ */ jsxs(
2551
2976
  "select",
2552
2977
  {
2553
- id,
2978
+ "aria-label": "Who can view this post",
2554
2979
  value: value.privacy_level ?? "",
2555
2980
  onChange: (e) => onChange({
2556
2981
  ...value,
@@ -2593,7 +3018,7 @@ function TikTokCaptionField({
2593
3018
  const max = captionMaxFor(postType);
2594
3019
  const count = value.length;
2595
3020
  const over = count > max;
2596
- return /* @__PURE__ */ jsxs("div", { className, style: { ...wrapStyle4, ...style }, children: [
3021
+ return /* @__PURE__ */ jsxs("div", { className, style: { ...wrapStyle5, ...style }, children: [
2597
3022
  /* @__PURE__ */ jsxs("div", { style: labelRowStyle, children: [
2598
3023
  /* @__PURE__ */ jsx("label", { htmlFor: id, style: labelStyle, children: "Caption" }),
2599
3024
  /* @__PURE__ */ jsxs(
@@ -2601,7 +3026,7 @@ function TikTokCaptionField({
2601
3026
  {
2602
3027
  style: {
2603
3028
  ...countStyle,
2604
- color: over ? varRef2(TT_VAR.accent) : varRef2(TT_VAR.muted)
3029
+ color: over ? varRef3(TT_VAR.accent) : varRef3(TT_VAR.muted)
2605
3030
  },
2606
3031
  children: [
2607
3032
  count.toLocaleString(),
@@ -2621,13 +3046,13 @@ function TikTokCaptionField({
2621
3046
  rows: 4,
2622
3047
  style: {
2623
3048
  ...textareaStyle,
2624
- borderColor: over ? varRef2(TT_VAR.accent) : varRef2(TT_VAR.border)
3049
+ borderColor: over ? varRef3(TT_VAR.accent) : varRef3(TT_VAR.border)
2625
3050
  }
2626
3051
  }
2627
3052
  )
2628
3053
  ] });
2629
3054
  }
2630
- var wrapStyle4 = {
3055
+ var wrapStyle5 = {
2631
3056
  display: "flex",
2632
3057
  flexDirection: "column",
2633
3058
  gap: 6,
@@ -2783,7 +3208,6 @@ function TikTokPublishPanel({
2783
3208
  className,
2784
3209
  style
2785
3210
  }) {
2786
- const dark = useIsDark2(theme);
2787
3211
  const isVideo = variant.post_type === "video";
2788
3212
  const captionOver = caption.length > captionMaxFor(variant.post_type);
2789
3213
  const mediaOk = mediaCountValid(variant.post_type, variant.media?.length ?? 0);
@@ -2793,9 +3217,10 @@ function TikTokPublishPanel({
2793
3217
  {
2794
3218
  className,
2795
3219
  style: {
2796
- ...paletteVars2(dark),
3220
+ ...paletteVars3(),
3221
+ colorScheme: colorSchemeFor3(theme),
2797
3222
  ...panelStyle,
2798
- color: varRef2(TT_VAR.text),
3223
+ color: varRef3(TT_VAR.text),
2799
3224
  ...style
2800
3225
  },
2801
3226
  children: [
@@ -2886,6 +3311,6 @@ var postButtonStyle = {
2886
3311
  transition: "opacity 160ms ease"
2887
3312
  };
2888
3313
 
2889
- export { ArticleCard, AudienceSelect, CommercialDisclosure, Connect, Declaration, DocumentCard, InteractionToggles, LinkedInPostPreview, Poll, PostrunProvider, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel, UploadError, XPoll, XPostPreview, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, toPreviewMedia, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useTikTokCreatorInfo, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
3314
+ export { ArticleCard, AudienceSelect, CommercialDisclosure, Connect, Declaration, DocumentCard, InstagramPostPreview, InteractionToggles, LinkedInPostPreview, Poll, PostrunProvider, ReelPreview, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel, UploadError, XPoll, XPostPreview, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, toPreviewMedia, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useTikTokCreatorInfo, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
2890
3315
  //# sourceMappingURL=index.js.map
2891
3316
  //# sourceMappingURL=index.js.map