@automattic/social-previews 3.2.4 → 3.3.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 DELETED
@@ -1,2446 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/helpers.tsx
2
- var _element = require('@wordpress/element');
3
- var _i18n = require('@wordpress/i18n');
4
- var _jsxruntime = require('react/jsx-runtime');
5
- var baseDomain = (url) => {
6
- const withoutProtocol = url.replace(/^[^/]+:\/\//, "");
7
- const slashIndex = withoutProtocol.indexOf("/");
8
- return slashIndex === -1 ? withoutProtocol : withoutProtocol.substring(0, slashIndex);
9
- };
10
- var codepointLength = (text) => Array.from(text).length;
11
- var codepointSlice = (text, start, end) => Array.from(text).slice(start, end).join("");
12
- var shortEnough = (limit) => (title) => codepointLength(title) <= limit ? title : false;
13
- var truncatedAtSpace = (lower, upper) => (fullTitle) => {
14
- const title = fullTitle.slice(0, upper);
15
- const lastSpace = title.lastIndexOf(" ");
16
- return lastSpace > lower && lastSpace < upper ? title.slice(0, lastSpace).concat("\u2026") : false;
17
- };
18
- var hardTruncation = (limit) => (title) => codepointSlice(title, 0, limit).concat("\u2026");
19
- var firstValid = (...predicates) => (a) => _optionalChain([predicates, 'access', _ => _.find, 'call', _2 => _2((p) => false !== p(a)), 'optionalCall', _3 => _3(a)]);
20
- var stripHtmlTags = (description, allowedTags = []) => {
21
- const pattern = new RegExp(`(<([^${allowedTags.join("")}>]+)>)`, "gi");
22
- return description ? description.replace(pattern, "") : "";
23
- };
24
- var getTitleFromDescription = (description) => {
25
- return stripHtmlTags(description).substring(0, 50);
26
- };
27
- var hasTag = (text, tag) => {
28
- const pattern = new RegExp(`<${tag}[^>]*>`, "gi");
29
- return pattern.test(text);
30
- };
31
- var formatNextdoorDate = new Intl.DateTimeFormat("en-GB", {
32
- // Result: "7 Oct", "31 Dec"
33
- day: "numeric",
34
- month: "short"
35
- }).format;
36
- var formatThreadsDate = new Intl.DateTimeFormat("en-US", {
37
- // Result: "'06/21/2024"
38
- day: "2-digit",
39
- month: "2-digit",
40
- year: "numeric"
41
- }).format;
42
- var formatTweetDate = new Intl.DateTimeFormat("en-US", {
43
- // Result: "Apr 7", "Dec 31"
44
- month: "short",
45
- day: "numeric"
46
- }).format;
47
- var formatMastodonDate = new Intl.DateTimeFormat("en-US", {
48
- // Result: "Apr 7, 2024", "Dec 31, 2023"
49
- month: "short",
50
- day: "numeric",
51
- year: "numeric"
52
- }).format;
53
- var hashtagUrlMap = {
54
- twitter: "https://twitter.com/hashtag/%1$s",
55
- facebook: "https://www.facebook.com/hashtag/%1$s",
56
- linkedin: "https://www.linkedin.com/feed/hashtag/?keywords=%1$s",
57
- instagram: "https://www.instagram.com/explore/tags/%1$s",
58
- mastodon: "https://%2$s/tags/%1$s",
59
- nextdoor: "https://nextdoor.com/hashtag/%1$s",
60
- threads: "https://www.threads.net/search?q=%1$s&serp_type=tags",
61
- tumblr: "https://www.tumblr.com/tagged/%1$s",
62
- bluesky: "https://bsky.app/hashtag/%1$s"
63
- };
64
- function preparePreviewText(text, options) {
65
- const {
66
- platform,
67
- maxChars,
68
- maxLines,
69
- hyperlinkHashtags = true,
70
- // Instagram doesn't support hyperlink URLs at the moment.
71
- hyperlinkUrls = "instagram" !== platform
72
- } = options;
73
- let result = stripHtmlTags(text);
74
- result = result.replaceAll(/(?:\s*[\n\r]){2,}/g, "\n\n");
75
- if (maxChars && codepointLength(result) > maxChars) {
76
- result = hardTruncation(maxChars)(result);
77
- }
78
- if (maxLines) {
79
- const lines = result.split("\n");
80
- if (lines.length > maxLines) {
81
- result = lines.slice(0, maxLines).join("\n");
82
- }
83
- }
84
- const componentMap = {};
85
- if (hyperlinkUrls) {
86
- const urls = result.match(/(https?:\/\/\S+)/g) || [];
87
- urls.forEach((url, index) => {
88
- componentMap[`Link${index}`] = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: url, rel: "noopener noreferrer", target: "_blank", children: url });
89
- result = result.replace(url, `<Link${index} />`);
90
- });
91
- }
92
- if (hyperlinkHashtags && hashtagUrlMap[platform]) {
93
- const hashtags = result.matchAll(/(^|\s)#(\w+)/g);
94
- const hashtagUrl = hashtagUrlMap[platform];
95
- [...hashtags].forEach(([fullMatch, whitespace, hashtag], index) => {
96
- const url = _i18n.sprintf.call(void 0, hashtagUrl, hashtag, options.hashtagDomain);
97
- componentMap[`Hashtag${index}`] = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: url, rel: "noopener noreferrer", target: "_blank", children: `#${hashtag}` });
98
- result = result.replace(fullMatch, `${whitespace}<Hashtag${index} />`);
99
- });
100
- }
101
- result = result.replace(/\n/g, "<br />");
102
- componentMap.br = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {});
103
- return _element.createInterpolateElement.call(void 0, result, componentMap);
104
- }
105
-
106
- // src/site-icon-with-fallback.tsx
107
- var _react = require('react');
108
-
109
- // src/icons/globe-icon.tsx
110
-
111
- function GlobeIcon(props) {
112
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
113
- "svg",
114
- {
115
- focusable: "false",
116
- "aria-hidden": "true",
117
- xmlns: "http://www.w3.org/2000/svg",
118
- viewBox: "0 0 24 24",
119
- width: "14",
120
- height: "14",
121
- ...props,
122
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
123
- "path",
124
- {
125
- fill: "currentColor",
126
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"
127
- }
128
- )
129
- }
130
- );
131
- }
132
-
133
- // src/site-icon-with-fallback.tsx
134
-
135
- function DefaultSiteIcon({ className }) {
136
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
137
- "span",
138
- {
139
- className,
140
- "aria-hidden": "true",
141
- style: {
142
- display: "inline-flex",
143
- alignItems: "center",
144
- justifyContent: "center",
145
- backgroundColor: "#e8eaed",
146
- color: "#5f6368",
147
- borderRadius: "50%"
148
- },
149
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GlobeIcon, { style: { width: "60%", height: "60%" } })
150
- }
151
- );
152
- }
153
- function SiteIconWithFallback({
154
- src: siteIconUrl,
155
- alt = "",
156
- className,
157
- fallback = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultSiteIcon, { className })
158
- }) {
159
- const [imageUrlWithError, setImageUrlWithError] = _react.useState.call(void 0, "");
160
- const onError = _react.useCallback.call(void 0, (event) => {
161
- setImageUrlWithError(event.target.src);
162
- }, []);
163
- const showIcon = siteIconUrl && // Check if the image URL with error is different from the provided site icon URL
164
- // to ensure that a change in siteIconUrl resets the error state
165
- imageUrlWithError !== siteIconUrl;
166
- return showIcon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: siteIconUrl, alt, onError, className }) : fallback;
167
- }
168
-
169
- // src/google-search-preview/index.tsx
170
-
171
- var URL_LENGTH = 68;
172
- var TITLE_LENGTH = 63;
173
- var DESCRIPTION_LENGTH = 160;
174
- var googleUrl = (url) => {
175
- const protocol = url.startsWith("https://") ? "https://" : "http://";
176
- const breadcrumb = protocol + url.replace(protocol, "").split("/").join(" \u203A ");
177
- const truncateBreadcrumb = firstValid(shortEnough(URL_LENGTH), hardTruncation(URL_LENGTH));
178
- return truncateBreadcrumb(breadcrumb);
179
- };
180
- var googleTitle = firstValid(
181
- shortEnough(TITLE_LENGTH),
182
- truncatedAtSpace(TITLE_LENGTH - 40, TITLE_LENGTH + 10),
183
- hardTruncation(TITLE_LENGTH)
184
- );
185
- var googleDescription = firstValid(
186
- shortEnough(DESCRIPTION_LENGTH),
187
- truncatedAtSpace(DESCRIPTION_LENGTH - 80, DESCRIPTION_LENGTH + 10),
188
- hardTruncation(DESCRIPTION_LENGTH)
189
- );
190
- var GoogleSearchPreview = ({
191
- description = "",
192
- siteIcon,
193
- siteTitle,
194
- title = "",
195
- url = ""
196
- }) => {
197
- const domain = baseDomain(url);
198
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "search-preview", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "search-preview__display", children: [
199
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "search-preview__header", children: [
200
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "search-preview__branding", children: [
201
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SiteIconWithFallback, { className: "search-preview__icon", src: siteIcon }),
202
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "search-preview__site", children: [
203
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "search-preview__site--title", children: siteTitle || domain }),
204
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "search-preview__url", children: googleUrl(url) })
205
- ] })
206
- ] }),
207
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "search-preview__menu", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { focusable: "false", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }) })
208
- ] }),
209
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "search-preview__title", children: googleTitle(title) }),
210
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "search-preview__description", children: googleDescription(stripHtmlTags(description)) })
211
- ] }) });
212
- };
213
-
214
- // src/twitter-preview/card.tsx
215
- var _clsx = require('clsx'); var _clsx2 = _interopRequireDefault(_clsx);
216
-
217
- var DESCRIPTION_LENGTH2 = 280;
218
- var twitterDescription = firstValid(
219
- shortEnough(DESCRIPTION_LENGTH2),
220
- hardTruncation(DESCRIPTION_LENGTH2)
221
- );
222
- var Card = ({
223
- description,
224
- image,
225
- title,
226
- cardType,
227
- url
228
- }) => {
229
- const cardClassNames = _clsx2.default.call(void 0, `twitter-preview__card-${cardType}`, {
230
- "twitter-preview__card-has-image": !!image
231
- });
232
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__card", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cardClassNames, children: [
233
- image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "twitter-preview__card-image", src: image, alt: "" }),
234
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__card-body", children: [
235
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__card-url", children: baseDomain(url || "") }),
236
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__card-title", children: title }),
237
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__card-description", children: twitterDescription(stripHtmlTags(description)) })
238
- ] })
239
- ] }) });
240
- };
241
-
242
- // src/twitter-preview/footer.tsx
243
-
244
- var Footer = () => {
245
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__footer", children: [
246
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__icon-replies", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z" }) }) }),
247
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__icon-retweets", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M4.5 3.88l4.432 4.14-1.364 1.46L5.5 7.55V16c0 1.1.896 2 2 2H13v2H7.5c-2.209 0-4-1.79-4-4V7.55L1.432 9.48.068 8.02 4.5 3.88zM16.5 6H11V4h5.5c2.209 0 4 1.79 4 4v8.45l2.068-1.93 1.364 1.46-4.432 4.14-4.432-4.14 1.364-1.46 2.068 1.93V8c0-1.1-.896-2-2-2z" }) }) }),
248
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__icon-likes", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M16.697 5.5c-1.222-.06-2.679.51-3.89 2.16l-.805 1.09-.806-1.09C9.984 6.01 8.526 5.44 7.304 5.5c-1.243.07-2.349.78-2.91 1.91-.552 1.12-.633 2.78.479 4.82 1.074 1.97 3.257 4.27 7.129 6.61 3.87-2.34 6.052-4.64 7.126-6.61 1.111-2.04 1.03-3.7.477-4.82-.561-1.13-1.666-1.84-2.908-1.91zm4.187 7.69c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z" }) }) }),
249
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__icon-analytics", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.75 21V3h2v18h-2zM18 21V8.5h2V21h-2zM4 21l.004-10h2L6 21H4zm9.248 0v-7h2v7h-2z" }) }) }),
250
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__icon-share", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12 2.59l5.7 5.7-1.41 1.42L13 6.41V16h-2V6.41l-3.3 3.3-1.41-1.42L12 2.59zM21 15l-.02 3.51c0 1.38-1.12 2.49-2.5 2.49H5.5C4.11 21 3 19.88 3 18.5V15h2v3.5c0 .28.22.5.5.5h12.98c.28 0 .5-.22.5-.5L19 15h2z" }) }) })
251
- ] });
252
- };
253
-
254
- // src/twitter-preview/header.tsx
255
-
256
-
257
- var Header = ({ name, screenName, date }) => {
258
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__header", children: [
259
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__name", children: name || _i18n.__.call(void 0, "Account Name", "social-previews") }),
260
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__screen-name", children: screenName || "@account" }),
261
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\xB7" }),
262
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "twitter-preview__date", children: formatTweetDate(date || Date.now()) })
263
- ] });
264
- };
265
-
266
- // src/twitter-preview/media.tsx
267
-
268
-
269
-
270
- var Media = ({ media }) => {
271
- const filteredMedia = media.filter(
272
- (mediaItem) => mediaItem.type.startsWith("image/") || mediaItem.type.startsWith("video/")
273
- ).filter((mediaItem, idx, array) => {
274
- if (0 === idx) {
275
- return true;
276
- }
277
- if (array[0].type.startsWith("video/") || "image/gif" === array[0].type) {
278
- return false;
279
- }
280
- if (mediaItem.type.startsWith("video/") || "image/gif" === mediaItem.type) {
281
- return false;
282
- }
283
- return true;
284
- }).slice(0, 4);
285
- if (0 === filteredMedia.length) {
286
- return null;
287
- }
288
- const isVideo = filteredMedia[0].type.startsWith("video/");
289
- const mediaClasses = _clsx2.default.call(void 0, [
290
- "twitter-preview__media",
291
- "twitter-preview__media-children-" + filteredMedia.length
292
- ]);
293
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: mediaClasses, children: filteredMedia.map((mediaItem, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: isVideo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { alt: mediaItem.alt || "", src: mediaItem.url }) }, `twitter-preview__media-item-${index}`)) });
294
- };
295
-
296
- // src/twitter-preview/quote-tweet.tsx
297
- var _components = require('@wordpress/components');
298
-
299
- var QuoteTweet = ({ tweetUrl }) => {
300
- if (!tweetUrl) {
301
- return null;
302
- }
303
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__quote-tweet", children: [
304
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
305
- _components.SandBox,
306
- {
307
- html: `<blockquote class="twitter-tweet" data-conversation="none" data-dnt="true"><a href="${tweetUrl}"></a></blockquote>`,
308
- scripts: ["https://platform.twitter.com/widgets.js"],
309
- title: "Embedded tweet"
310
- }
311
- ),
312
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__quote-tweet-overlay" })
313
- ] });
314
- };
315
-
316
- // src/avatar-with-fallback.tsx
317
-
318
-
319
- function DefaultAvatar(props) {
320
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
321
- "svg",
322
- {
323
- xmlns: "http://www.w3.org/2000/svg",
324
- viewBox: "0 0 340 340",
325
- width: "36",
326
- height: "36",
327
- "aria-hidden": "true",
328
- ...props,
329
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
330
- "path",
331
- {
332
- fill: "#DDD",
333
- d: "m169,.5a169,169 0 1,0 2,0zm0,86a76,76 0 1 1-2,0zM57,287q27-35 67-35h92q40,0 67,35a164,164 0 0,1-226,0"
334
- }
335
- )
336
- }
337
- );
338
- }
339
- function AvatarWithFallback({
340
- src: avatarUrl,
341
- alt = "",
342
- className,
343
- fallback = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultAvatar, { className })
344
- }) {
345
- const [imageUrlWithError, setImageUrlWithError] = _react.useState.call(void 0, "");
346
- const onError = _react.useCallback.call(void 0, (event) => {
347
- setImageUrlWithError(event.target.src);
348
- }, []);
349
- const showAvatar = !!avatarUrl && // Check if the image URL with error is different from the provided avatar URL
350
- // to ensure that a change in avatarUrl resets the error state
351
- imageUrlWithError !== avatarUrl;
352
- return showAvatar ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: avatarUrl, alt, onError, className }) : fallback;
353
- }
354
-
355
- // src/twitter-preview/sidebar.tsx
356
-
357
- var Sidebar = ({ profileImage, showThreadConnector }) => {
358
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__sidebar", children: [
359
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__profile-image", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarWithFallback, { src: profileImage }) }),
360
- showThreadConnector && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__connector" })
361
- ] });
362
- };
363
-
364
- // src/twitter-preview/text.tsx
365
-
366
- var Text = ({ text }) => {
367
- if (!text) {
368
- return null;
369
- }
370
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__text", children: preparePreviewText(text, { platform: "twitter" }) });
371
- };
372
-
373
- // src/twitter-preview/post-preview.tsx
374
-
375
- var TwitterPostPreview = ({
376
- date,
377
- description,
378
- image,
379
- media,
380
- name,
381
- profileImage,
382
- screenName,
383
- showThreadConnector,
384
- text,
385
- title,
386
- tweetUrl,
387
- cardType,
388
- url
389
- }) => {
390
- const hasMedia = !!_optionalChain([media, 'optionalAccess', _4 => _4.length]);
391
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "twitter-preview__wrapper", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__container", children: [
392
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Sidebar, { profileImage, showThreadConnector }),
393
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__main", children: [
394
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header, { name, screenName, date }),
395
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "twitter-preview__content", children: [
396
- text ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { text }) : null,
397
- hasMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Media, { media }) : null,
398
- tweetUrl ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QuoteTweet, { tweetUrl }) : null,
399
- !hasMedia && url && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
400
- Card,
401
- {
402
- description: description || "",
403
- image,
404
- title: title || "",
405
- cardType: cardType || "",
406
- url
407
- }
408
- )
409
- ] }),
410
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Footer, {})
411
- ] })
412
- ] }) });
413
- };
414
-
415
- // src/twitter-preview/link-preview.tsx
416
-
417
- var TwitterLinkPreview = (props) => {
418
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
419
- TwitterPostPreview,
420
- {
421
- ...props,
422
- text: "",
423
- media: void 0
424
- }
425
- );
426
- };
427
-
428
- // src/twitter-preview/previews.tsx
429
-
430
-
431
- // src/shared/section-heading/index.tsx
432
-
433
- var HEADING_LEVELS = [2, 3, 4, 5, 6];
434
- var SectionHeading = ({
435
- className,
436
- level,
437
- children
438
- }) => {
439
- const Tag = `h${level && HEADING_LEVELS.includes(level) ? level : 3}`;
440
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tag, { className: `social-preview__section-heading ${_nullishCoalesce(className, () => ( ""))}`, children });
441
- };
442
- var section_heading_default = SectionHeading;
443
-
444
- // src/twitter-preview/previews.tsx
445
-
446
- var TwitterPreviews = ({
447
- headingLevel,
448
- hideLinkPreview,
449
- hidePostPreview,
450
- tweets
451
- }) => {
452
- if (!_optionalChain([tweets, 'optionalAccess', _5 => _5.length])) {
453
- return null;
454
- }
455
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview twitter-preview", children: [
456
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section twitter-preview__section", children: [
457
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
458
- level: headingLevel,
459
- // translators: refers to a social post on Twitter
460
- children: _i18n.__.call(void 0, "Your post", "social-previews")
461
- }),
462
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on X:", "social-previews") }),
463
- tweets.map((tweet, index) => {
464
- const isLast = index + 1 === tweets.length;
465
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
466
- TwitterPostPreview,
467
- {
468
- ...tweet,
469
- showThreadConnector: !isLast
470
- },
471
- `twitter-preview__tweet-${index}`
472
- );
473
- })
474
- ] }),
475
- !hideLinkPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section twitter-preview__section", children: [
476
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
477
- level: headingLevel,
478
- // translators: refers to a link to a Twitter post
479
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
480
- }),
481
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
482
- "This is what it will look like when someone shares the link to your WordPress post on X.",
483
- "social-previews"
484
- ) }),
485
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TwitterLinkPreview, { ...tweets[0], name: "", profileImage: "", screenName: "" })
486
- ] })
487
- ] });
488
- };
489
-
490
- // src/linkedin-preview/post-preview.tsx
491
-
492
-
493
- // src/shared/expandable-text/index.tsx
494
-
495
-
496
-
497
-
498
- var EXPAND_THRESHOLD_CHARS = 400;
499
- function codepointLength2(text) {
500
- return Array.from(text).length;
501
- }
502
- function truncateAtWordBoundary(text, limit) {
503
- const codepoints = Array.from(text);
504
- if (codepoints.length <= limit) {
505
- return text;
506
- }
507
- const slice = codepoints.slice(0, limit).join("");
508
- const lastSpace = slice.lastIndexOf(" ");
509
- const cut = lastSpace > limit - 80 ? lastSpace : slice.length;
510
- return slice.slice(0, cut);
511
- }
512
- function ExpandableText(props) {
513
- const { text, children } = props;
514
- const [expanded, toggle] = _react.useReducer.call(void 0, (state) => !state, false);
515
- const stripped = stripHtmlTags(text);
516
- if (codepointLength2(stripped) <= EXPAND_THRESHOLD_CHARS) {
517
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: children(text) });
518
- }
519
- if (expanded) {
520
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
521
- children(text),
522
- " ",
523
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Button, { variant: "link", className: "social-previews__expand-toggle", onClick: toggle, children: _i18n.__.call(void 0, "See less", "social-previews") })
524
- ] });
525
- }
526
- const truncated = truncateAtWordBoundary(stripped, EXPAND_THRESHOLD_CHARS);
527
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
528
- children(truncated),
529
- "\u2026 ",
530
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.Button, { variant: "link", className: "social-previews__expand-toggle", onClick: toggle, children: _i18n.__.call(void 0, "See more", "social-previews") })
531
- ] });
532
- }
533
-
534
- // src/linkedin-preview/constants.ts
535
- var FEED_TEXT_MAX_LENGTH = 3e3;
536
-
537
- // src/linkedin-preview/post-preview.tsx
538
-
539
- function LinkedInPostPreview({
540
- articleReadTime = 5,
541
- image,
542
- jobTitle,
543
- name,
544
- profileImage,
545
- description,
546
- media,
547
- title,
548
- url
549
- }) {
550
- const hasMedia = !!_optionalChain([media, 'optionalAccess', _6 => _6.length]);
551
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "linkedin-preview__wrapper", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: `linkedin-preview__container ${hasMedia ? "has-media" : ""}`, children: [
552
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__header", children: [
553
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "linkedin-preview__header--avatar", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarWithFallback, { src: profileImage }) }),
554
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__header--profile", children: [
555
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__header--profile-info", children: [
556
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "linkedin-preview__header--profile-name", children: name || _i18n.__.call(void 0, "Account Name", "social-previews") }),
557
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2022" }),
558
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
559
- className: "linkedin-preview__header--profile-actor",
560
- // translators: refers to the actor level of the post being shared, e.g. "1st", "2nd", "3rd", etc.
561
- children: _i18n.__.call(void 0, "1st", "social-previews")
562
- })
563
- ] }),
564
- jobTitle ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "linkedin-preview__header--profile-title", children: jobTitle }) : null,
565
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__header--profile-meta", children: [
566
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
567
- // translators: refers to the time since the post was published, e.g. "1h"
568
- children: _i18n.__.call(void 0, "1h", "social-previews")
569
- }),
570
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2022" }),
571
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 16 16", fill: "currentColor", width: "16", height: "16", focusable: "false", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 1a7 7 0 107 7 7 7 0 00-7-7zM3 8a5 5 0 011-3l.55.55A1.5 1.5 0 015 6.62v1.07a.75.75 0 00.22.53l.56.56a.75.75 0 00.53.22H7v.69a.75.75 0 00.22.53l.56.56a.75.75 0 01.22.53V13a5 5 0 01-5-5zm6.24 4.83l2-2.46a.75.75 0 00.09-.8l-.58-1.16A.76.76 0 0010 8H7v-.19a.51.51 0 01.28-.45l.38-.19a.74.74 0 01.68 0L9 7.5l.38-.7a1 1 0 00.12-.48v-.85a.78.78 0 01.21-.53l1.07-1.09a5 5 0 01-1.54 9z" }) })
572
- ] })
573
- ] })
574
- ] }),
575
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__content", children: [
576
- description ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__caption", children: [
577
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: description, children: (visibleText) => preparePreviewText(visibleText, {
578
- platform: "linkedin",
579
- maxChars: FEED_TEXT_MAX_LENGTH
580
- }) }) }),
581
- hasMedia && url && !description.includes(url) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
582
- " - ",
583
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: url, rel: "nofollow noopener noreferrer", target: "_blank", children: url })
584
- ] })
585
- ] }) : null,
586
- hasMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "linkedin-preview__media", children: media.map((mediaItem, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
587
- "div",
588
- {
589
- className: "linkedin-preview__media-item",
590
- children: mediaItem.type.startsWith("video/") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { alt: mediaItem.alt || "", src: mediaItem.url })
591
- },
592
- `linkedin-preview__media-item-${index}`
593
- )) }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "article", { children: [
594
- image ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "linkedin-preview__image", src: image, alt: "" }) : null,
595
- url ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__description", children: [
596
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "linkedin-preview__description--title", children: title || getTitleFromDescription(description) }),
597
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "linkedin-preview__description--meta", children: [
598
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "linkedin-preview__description--url", children: baseDomain(url) }),
599
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2022" }),
600
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _i18n.sprintf.call(void 0,
601
- // translators: %d is the number of minutes it takes to read the article
602
- _i18n.__.call(void 0, "%d min read", "social-previews"),
603
- articleReadTime
604
- ) })
605
- ] })
606
- ] }) : null
607
- ] })
608
- ] })
609
- ] }) });
610
- }
611
-
612
- // src/linkedin-preview/link-preview.tsx
613
-
614
- function LinkedInLinkPreview(props) {
615
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
616
- LinkedInPostPreview,
617
- {
618
- name: "",
619
- profileImage: "",
620
- ...props,
621
- description: "",
622
- media: void 0,
623
- title: props.title || getTitleFromDescription(props.description)
624
- }
625
- );
626
- }
627
-
628
- // src/linkedin-preview/previews.tsx
629
-
630
-
631
- var LinkedInPreviews = ({
632
- headingLevel,
633
- hideLinkPreview,
634
- hidePostPreview,
635
- ...props
636
- }) => {
637
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview linkedin-preview", children: [
638
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section linkedin-preview__section", children: [
639
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
640
- level: headingLevel,
641
- // translators: refers to a social post on LinkedIn
642
- children: _i18n.__.call(void 0, "Your post", "social-previews")
643
- }),
644
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on LinkedIn:", "social-previews") }),
645
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkedInPostPreview, { ...props })
646
- ] }),
647
- !hideLinkPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section linkedin-preview__section", children: [
648
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
649
- level: headingLevel,
650
- // translators: refers to a link to a LinkedIn post
651
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
652
- }),
653
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
654
- "This is what it will look like when someone shares the link to your WordPress post on LinkedIn.",
655
- "social-previews"
656
- ) }),
657
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkedInLinkPreview, { ...props, name: "", profileImage: "" })
658
- ] })
659
- ] });
660
- };
661
-
662
- // src/tumblr-preview/link-preview.tsx
663
-
664
-
665
- // src/tumblr-preview/helpers.ts
666
- var TITLE_LENGTH2 = 1e3;
667
- var DESCRIPTION_LENGTH3 = 4096;
668
- var tumblrTitle = (text) => firstValid(
669
- shortEnough(TITLE_LENGTH2),
670
- hardTruncation(TITLE_LENGTH2)
671
- )(stripHtmlTags(text)) || "";
672
- var tumblrDescription = (text) => {
673
- let processedText = text;
674
- let startIndex = processedText.indexOf("<!--");
675
- while (startIndex !== -1) {
676
- const endIndex = processedText.indexOf("-->", startIndex);
677
- if (endIndex === -1) {
678
- processedText = processedText.substring(0, startIndex);
679
- break;
680
- }
681
- processedText = processedText.substring(0, startIndex) + processedText.substring(endIndex + 3);
682
- startIndex = processedText.indexOf("<!--");
683
- }
684
- processedText = processedText.replace(/<\/p>/g, "</p>\n\n");
685
- return firstValid(
686
- shortEnough(DESCRIPTION_LENGTH3),
687
- hardTruncation(DESCRIPTION_LENGTH3)
688
- )(stripHtmlTags(processedText)) || "";
689
- };
690
-
691
- // src/tumblr-preview/post/actions/index.tsx
692
-
693
-
694
- // src/tumblr-preview/post/icons/index.tsx
695
-
696
- var TumblrPostIcon = ({ name }) => {
697
- let svg;
698
- switch (name) {
699
- case "blaze":
700
- svg = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 25 22", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "m7.5059-0.24414c-0.79843 0.057223-1.2169 0.88587-1.1635 1.6128-0.2266 2.0449-1.4898 3.8696-3.1975 4.9778-3.0182 2.414-4.2201 6.8066-2.8033 10.411 0.92417 2.4679 2.9589 4.5674 5.4768 5.3928 0.95914 0.16102 1.7233-0.94358 1.3074-1.8059-0.11578-0.51062-0.17482-0.96516-0.17845-1.487 1.0413 1.5607 2.5484 2.8986 4.341 3.4975 1.0396-0.0154 1.98-0.64458 2.8516-1.1608 3.3821-2.1786 4.9604-6.7097 3.6597-10.518-0.49144-1.4599-1.2948-2.8935-2.5028-3.8698-0.7512-0.45498-1.661 0.09677-1.9202 0.86038-0.12274 0.16822-0.70352 1.1955-0.6191 0.61976 0.25488-3.4397-1.6789-7.0066-4.8123-8.4958-0.14322-0.037843-0.292-0.049464-0.43945-0.035156zm1.0586 3.5605c1.8947 2.0016 2.2326 5.1984 0.89062 7.5879-0.38498 0.96148 0.71762 2.0063 1.6567 1.5681 1.4159-0.4624 2.6998-1.3259 3.6577-2.4665 1.6442 2.5888 1.1465 6.2819-1.0629 8.3379-0.62378 0.60782-1.3666 1.0945-2.1754 1.4179-1.9543-0.989-3.3534-3.0966-3.5625-5.3125-0.25636-1.0253-1.81-1.2013-2.2852-0.25781-0.75058 1.3054-1.1846 2.7948-1.2305 4.3008-2.2396-1.9852-2.8468-5.4435-1.4609-8.0527 0.58926-1.239 1.651-2.13 2.724-2.9329 1.2958-1.1271 2.2791-2.62 2.7682-4.2683l0.071578 0.069832z" }) });
701
- break;
702
- case "delete":
703
- svg = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 14 17", children: [
704
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12 5v9c.1.7-.3 1-1 1H3c-.5 0-.9-.3-1-1V5c0-.6-.4-1-1-1-.5 0-1 .4-1 1v9.5C0 16.1 1.4 17 3 17h8c1.8 0 3-.8 3-2.5V5c0-.6-.5-1-1-1-.6 0-1 .5-1 1z" }),
705
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M4 12s0 1 1 1 1-1 1-1V5c0-.5-.4-1-1-1-.5 0-1 .5-1 1v7zm4 0s0 1 1 1 1-1 1-1V5c0-.5-.4-1-1-1-.5 0-1 .5-1 1v7zm5-10c.5 0 1-.4 1-1 0-.5-.4-.9-1-1H1C.5.1 0 .5 0 1c0 .6.6 1 1.1 1H13z" })
706
- ] });
707
- break;
708
- case "edit":
709
- svg = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 17.6 17.6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M5.3 13.8l-2.1.7.7-2.1L10.3 6l1.4 1.4-6.4 6.4zm6.4-9.3l-1.4-1.4-1.4 1.4-6.7 6.7-.2.5-2 5.9 3.8-1.3 2.1-.7.4-.1.3-.3 7.8-7.8c.1 0-2.7-2.9-2.7-2.9zm5.6-1.4L14.5.3c-.4-.4-1-.4-1.4 0l-1.4 1.4L15.9 6l1.4-1.4c.4-.5.4-1.1 0-1.5" }) });
710
- break;
711
- case "share":
712
- svg = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12.6173 1.07612C12.991 0.921338 13.4211 1.00689 13.7071 1.29289L22.7071 10.2929C23.0832 10.669 23.0991 11.2736 22.7433 11.669L13.7433 21.669C13.4663 21.9767 13.0283 22.082 12.6417 21.9336C12.2552 21.7853 12 21.414 12 21V16H11.5C7.31775 16 3.92896 18.2486 2.95256 21.3044C2.80256 21.7738 2.33292 22.064 1.84598 21.9881C1.35904 21.9122 1 21.4928 1 21V18.5C1 12.3162 5.88069 7.27245 12 7.01067V2C12 1.59554 12.2436 1.2309 12.6173 1.07612ZM14 4.41421V8C14 8.55228 13.5523 9 13 9H12.5C7.64534 9 3.64117 12.6414 3.06988 17.3419C5.09636 15.2366 8.18218 14 11.5 14H13C13.5523 14 14 14.4477 14 15V18.394L20.622 11.0362L14 4.41421Z" }) });
713
- break;
714
- case "reply":
715
- svg = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 17 17", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.7 0C4.1 0 .4 3.7.4 8.3c0 1.2.2 2.3.7 3.4-.2.6-.4 1.5-.7 2.5L0 15.8c-.2.7.5 1.4 1.2 1.2l1.6-.4 2.4-.7c1.1.5 2.2.7 3.4.7 4.6 0 8.3-3.7 8.3-8.3C17 3.7 13.3 0 8.7 0zM15 8.3c0 3.5-2.8 6.3-6.4 6.3-1.2 0-2.3-.3-3.2-.9l-3.2.9.9-3.2c-.5-.9-.9-2-.9-3.2.1-3.4 3-6.2 6.5-6.2S15 4.8 15 8.3z" }) });
716
- break;
717
- case "reblog":
718
- svg = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 17 18.1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12.8.2c-.4-.4-.8-.2-.8.4v2H2c-2 0-2 2-2 2v5s0 1 1 1 1-1 1-1v-4c0-1 .5-1 1-1h9v2c0 .6.3.7.8.4L17 3.6 12.8.2zM4.2 17.9c.5.4.8.2.8-.3v-2h10c2 0 2-2 2-2v-5s0-1-1-1-1 1-1 1v4c0 1-.5 1-1 1H5v-2c0-.6-.3-.7-.8-.4L0 14.6l4.2 3.3z" }) });
719
- break;
720
- case "like":
721
- svg = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 20 18", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M14.658 0c-1.625 0-3.21.767-4.463 2.156-.06.064-.127.138-.197.225-.074-.085-.137-.159-.196-.225C8.547.766 6.966 0 5.35 0 4.215 0 3.114.387 2.162 1.117c-2.773 2.13-2.611 5.89-1.017 8.5 2.158 3.535 6.556 7.18 7.416 7.875A2.3 2.3 0 0 0 9.998 18c.519 0 1.028-.18 1.436-.508.859-.695 5.257-4.34 7.416-7.875 1.595-2.616 1.765-6.376-1-8.5C16.895.387 15.792 0 14.657 0h.001zm0 2.124c.645 0 1.298.208 1.916.683 1.903 1.461 1.457 4.099.484 5.695-1.973 3.23-6.16 6.7-6.94 7.331a.191.191 0 0 1-.241 0c-.779-.631-4.966-4.101-6.94-7.332-.972-1.595-1.4-4.233.5-5.694.619-.475 1.27-.683 1.911-.683 1.064 0 2.095.574 2.898 1.461.495.549 1.658 2.082 1.753 2.203.095-.12 1.259-1.654 1.752-2.203.8-.887 1.842-1.461 2.908-1.461h-.001z" }) });
722
- break;
723
- case "ellipsis":
724
- svg = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 17.5 3.9", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M17.5 1.9c0 1.1-.9 1.9-1.9 1.9-1.1 0-1.9-.9-1.9-1.9S14.5 0 15.6 0c1 0 1.9.9 1.9 1.9m-6.8 0c0 1.1-.9 1.9-1.9 1.9-1.1.1-2-.8-2-1.9 0-1 .9-1.9 2-1.9s1.9.9 1.9 1.9m-6.8 0c0 1.1-.9 2-2 2-1 0-1.9-.9-1.9-2S.9 0 1.9 0c1.1 0 2 .9 2 1.9" }) });
725
- break;
726
- }
727
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `tumblr-preview__post-icon tumblr-preview__post-icon-${name}`, children: svg });
728
- };
729
- var icons_default = TumblrPostIcon;
730
-
731
- // src/tumblr-preview/post/actions/index.tsx
732
-
733
- var TumblrPostActions = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__post-actions", children: [
734
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__post-manage-actions", children: [
735
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__post-actions-blaze", children: [
736
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, icons_default, { name: "blaze" }),
737
- "\xA0Blaze"
738
- ] }),
739
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { children: [
740
- {
741
- icon: "delete",
742
- // translators: "Delete" action on a Tumblr post
743
- label: _i18n.__.call(void 0, "Delete", "social-previews")
744
- },
745
- {
746
- icon: "edit",
747
- // translators: "Edit" action on a Tumblr post
748
- label: _i18n.__.call(void 0, "Edit", "social-previews")
749
- }
750
- ].map(({ icon, label }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { "aria-label": label, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, icons_default, { name: icon }) }, icon)) })
751
- ] }),
752
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__post-social-actions", children: [
753
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
754
- // translators: count of notes on a Tumblr post
755
- children: _i18n.__.call(void 0, "0 notes", "social-previews")
756
- }),
757
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { children: [
758
- {
759
- icon: "share",
760
- // translators: "Share" action on a Tumblr post
761
- label: _i18n.__.call(void 0, "Share", "social-previews")
762
- },
763
- {
764
- icon: "reply",
765
- // translators: "Reply" action on a Tumblr post
766
- label: _i18n.__.call(void 0, "Reply", "social-previews")
767
- },
768
- {
769
- icon: "reblog",
770
- // translators: "Reblog" action on a Tumblr post
771
- label: _i18n.__.call(void 0, "Reblog", "social-previews")
772
- },
773
- {
774
- icon: "like",
775
- // translators: "Like" action on a Tumblr post
776
- label: _i18n.__.call(void 0, "Like", "social-previews")
777
- }
778
- ].map(({ icon, label }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { "aria-label": label, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, icons_default, { name: icon }) }, icon)) })
779
- ] })
780
- ] });
781
- var actions_default = TumblrPostActions;
782
-
783
- // src/tumblr-preview/post/header/index.tsx
784
-
785
-
786
- var TumblrPostHeader = ({ user }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__post-header", children: [
787
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__post-header-username", children: _optionalChain([user, 'optionalAccess', _7 => _7.displayName]) || // translators: username of a fictional Tumblr User
788
- _i18n.__.call(void 0, "anonymous-user", "social-previews") }),
789
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, icons_default, { name: "ellipsis" })
790
- ] });
791
- var header_default = TumblrPostHeader;
792
-
793
- // src/tumblr-preview/link-preview.tsx
794
-
795
- var TumblrLinkPreview = ({
796
- title,
797
- description,
798
- image,
799
- user,
800
- url
801
- }) => {
802
- const avatarUrl = _optionalChain([user, 'optionalAccess', _8 => _8.avatarUrl]);
803
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__post", children: [
804
- avatarUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "tumblr-preview__avatar", src: avatarUrl, alt: "" }),
805
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__card", children: [
806
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default, { user }),
807
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__window", children: [
808
- image && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__window-top", children: [
809
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__overlay", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__title", children: tumblrTitle(title) }) }),
810
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
811
- "img",
812
- {
813
- className: "tumblr-preview__image",
814
- src: image,
815
- alt: _i18n.__.call(void 0, "Tumblr preview thumbnail", "social-previews")
816
- }
817
- )
818
- ] }),
819
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `tumblr-preview__window-bottom ${!image ? "is-full" : ""}`, children: [
820
- !image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__title", children: tumblrTitle(title) }),
821
- description && image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__description", children: tumblrDescription(description) }),
822
- url && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__site-name", children: baseDomain(url) })
823
- ] })
824
- ] }),
825
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default, {})
826
- ] })
827
- ] });
828
- };
829
-
830
- // src/tumblr-preview/post-preview.tsx
831
-
832
-
833
- var TumblrPostPreview = ({
834
- title,
835
- description,
836
- image,
837
- user,
838
- url,
839
- media
840
- }) => {
841
- const avatarUrl = _optionalChain([user, 'optionalAccess', _9 => _9.avatarUrl]);
842
- const mediaItem = _optionalChain([media, 'optionalAccess', _10 => _10[0]]);
843
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__post", children: [
844
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarWithFallback, { className: "tumblr-preview__avatar", src: avatarUrl }),
845
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__card", children: [
846
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default, { user }),
847
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tumblr-preview__body", children: [
848
- title ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__title", children: tumblrTitle(title) }) : null,
849
- description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__description", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: description, children: (visibleText) => preparePreviewText(tumblrDescription(visibleText), {
850
- platform: "tumblr"
851
- }) }) }),
852
- mediaItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "tumblr-preview__media-item", children: mediaItem.type.startsWith("video/") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, className: "tumblr-preview__media--video", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "tumblr-preview__image", src: mediaItem.url, alt: "" }) }) : image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
853
- "img",
854
- {
855
- className: "tumblr-preview__image",
856
- src: image,
857
- alt: _i18n.__.call(void 0, "Tumblr preview thumbnail", "social-previews")
858
- }
859
- ),
860
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { className: "tumblr-preview__url", href: url, target: "_blank", rel: "noreferrer", children: _i18n.__.call(void 0, "View On WordPress", "social-previews") })
861
- ] }),
862
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default, {})
863
- ] })
864
- ] });
865
- };
866
-
867
- // src/tumblr-preview/previews.tsx
868
-
869
-
870
- var TumblrPreviews = ({
871
- headingLevel,
872
- hideLinkPreview,
873
- hidePostPreview,
874
- ...props
875
- }) => {
876
- const hasMedia = !!_optionalChain([props, 'access', _11 => _11.media, 'optionalAccess', _12 => _12.length]);
877
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview tumblr-preview", children: [
878
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section tumblr-preview__section", children: [
879
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SectionHeading, {
880
- level: headingLevel,
881
- // translators: refers to a social post on Tumblr
882
- children: _i18n.__.call(void 0, "Your post", "social-previews")
883
- }),
884
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on Tumblr:", "social-previews") }),
885
- hasMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TumblrPostPreview, { ...props }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TumblrLinkPreview, { ...props })
886
- ] }),
887
- !hideLinkPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section tumblr-preview__section", children: [
888
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SectionHeading, {
889
- level: headingLevel,
890
- // translators: refers to a link on Tumblr
891
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
892
- }),
893
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
894
- "This is what it will look like when someone shares the link to your WordPress post on Tumblr.",
895
- "social-previews"
896
- ) }),
897
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TumblrLinkPreview, { ...props, user: void 0 })
898
- ] })
899
- ] });
900
- };
901
-
902
- // src/facebook-preview/previews.tsx
903
-
904
-
905
- // src/facebook-preview/link-preview.tsx
906
-
907
-
908
- // src/constants.ts
909
- var AUTO_SHARED_SOCIAL_POST_PREVIEW = "AUTO_SHARED_SOCIAL_POST_PREVIEW";
910
- var AUTO_SHARED_LINK_PREVIEW = "AUTO_SHARED_LINK_PREVIEW";
911
- var DEFAULT_LINK_PREVIEW = "DEFAULT_LINK_PREVIEW";
912
- var TYPE_WEBSITE = "website";
913
- var TYPE_ARTICLE = "article";
914
- var LANDSCAPE_MODE = "landscape";
915
- var PORTRAIT_MODE = "portrait";
916
-
917
- // src/facebook-preview/helpers.ts
918
- var TITLE_LENGTH3 = 110;
919
- var DESCRIPTION_LENGTH4 = 200;
920
- var CUSTOM_TEXT_LENGTH = 63206;
921
- var facebookTitle = (text) => firstValid(
922
- shortEnough(TITLE_LENGTH3),
923
- hardTruncation(TITLE_LENGTH3)
924
- )(stripHtmlTags(text)) || "";
925
- var facebookDescription = (text) => firstValid(
926
- shortEnough(DESCRIPTION_LENGTH4),
927
- hardTruncation(DESCRIPTION_LENGTH4)
928
- )(stripHtmlTags(text)) || "";
929
-
930
- // src/facebook-preview/custom-text.tsx
931
-
932
- var CustomText = ({ text, url, forceUrlDisplay }) => {
933
- let postLink;
934
- const showPostLink = hasTag(text, "a") || forceUrlDisplay && !!url && !text.includes(url);
935
- if (showPostLink) {
936
- postLink = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
937
- "a",
938
- {
939
- className: "facebook-preview__custom-text-post-url",
940
- href: url,
941
- rel: "nofollow noopener noreferrer",
942
- target: "_blank",
943
- children: url
944
- }
945
- );
946
- }
947
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "facebook-preview__custom-text", children: [
948
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text, children: (visibleText) => preparePreviewText(visibleText, {
949
- platform: "facebook",
950
- maxChars: CUSTOM_TEXT_LENGTH
951
- }) }) }),
952
- postLink
953
- ] });
954
- };
955
- var custom_text_default = CustomText;
956
-
957
- // src/facebook-preview/hooks/use-image-hook.ts
958
-
959
-
960
- var useImage = ({ mode: initialMode }) => {
961
- const [mode, setMode] = _react.useState.call(void 0, initialMode);
962
- const [isLoadingImage, setLoadingImage] = _react.useState.call(void 0, true);
963
- const onLoad = _react.useCallback.call(void 0,
964
- ({ target }) => {
965
- if (!mode) {
966
- const image = target;
967
- setMode(image.naturalWidth > image.naturalHeight ? LANDSCAPE_MODE : PORTRAIT_MODE);
968
- }
969
- setLoadingImage(false);
970
- },
971
- [mode]
972
- );
973
- const onError = _react.useCallback.call(void 0, () => setLoadingImage(false), []);
974
- return [
975
- mode,
976
- isLoadingImage,
977
- {
978
- alt: _i18n.__.call(void 0, "Facebook Preview Thumbnail", "social-previews"),
979
- onLoad,
980
- onError
981
- }
982
- ];
983
- };
984
- var use_image_hook_default = useImage;
985
-
986
- // src/facebook-preview/post/actions/index.tsx
987
-
988
-
989
- // src/facebook-preview/post/icons/index.tsx
990
-
991
- var FacebookPostIcon = ({ name }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "i", { className: `facebook-preview__post-icon facebook-preview__post-icon-${name}` });
992
- var icons_default2 = FacebookPostIcon;
993
-
994
- // src/facebook-preview/post/actions/index.tsx
995
-
996
- var FacebookPostActions = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "facebook-preview__post-actions", children: [
997
- {
998
- icon: "like",
999
- // translators: Facebook "Like" action
1000
- label: _i18n.__.call(void 0, "Like", "social-previews")
1001
- },
1002
- {
1003
- icon: "comment",
1004
- // translators: Facebook "Comment" action
1005
- label: _i18n.__.call(void 0, "Comment", "social-previews")
1006
- },
1007
- {
1008
- icon: "share",
1009
- // translators: Facebook "Share" action
1010
- label: _i18n.__.call(void 0, "Share", "social-previews")
1011
- }
1012
- ].map(({ icon, label }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { children: [
1013
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, icons_default2, { name: icon }),
1014
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: label })
1015
- ] }, icon)) });
1016
- var actions_default2 = FacebookPostActions;
1017
-
1018
- // src/facebook-preview/post/header/index.tsx
1019
-
1020
-
1021
- var FacebookPostHeader = ({ user, timeElapsed, hideOptions }) => {
1022
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__post-header", children: [
1023
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__post-header-content", children: [
1024
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1025
- AvatarWithFallback,
1026
- {
1027
- className: "facebook-preview__post-header-avatar",
1028
- src: _optionalChain([user, 'optionalAccess', _13 => _13.avatarUrl])
1029
- }
1030
- ),
1031
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1032
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__post-header-name", children: _optionalChain([user, 'optionalAccess', _14 => _14.displayName]) || // translators: name of a fictional Facebook User
1033
- _i18n.__.call(void 0, "Anonymous User", "social-previews") }),
1034
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__post-header-share", children: [
1035
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "facebook-preview__post-header-time", children: timeElapsed ? _i18n.__.call(void 0,
1036
- // translators: short version of `1 hour`
1037
- "1h",
1038
- "social-previews"
1039
- ) : _i18n._x.call(void 0,
1040
- // translators: temporal indication of when a post was published
1041
- "Just now",
1042
- "",
1043
- "social-previews"
1044
- ) }),
1045
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "facebook-preview__post-header-dot", "aria-hidden": "true", children: "\xB7" }),
1046
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, icons_default2, { name: "public" })
1047
- ] })
1048
- ] })
1049
- ] }),
1050
- !hideOptions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__post-header-more" })
1051
- ] });
1052
- };
1053
- var header_default2 = FacebookPostHeader;
1054
-
1055
- // src/facebook-preview/link-preview.tsx
1056
-
1057
- var FacebookLinkPreview = ({
1058
- url,
1059
- title,
1060
- description,
1061
- image,
1062
- user,
1063
- customText,
1064
- type,
1065
- imageMode,
1066
- compactDescription
1067
- }) => {
1068
- const [mode, isLoadingImage, imgProps] = use_image_hook_default({ mode: imageMode });
1069
- const isArticle = type === TYPE_ARTICLE;
1070
- const portraitMode = isArticle && !image || mode === PORTRAIT_MODE;
1071
- const modeClass = `is-${portraitMode ? "portrait" : "landscape"}`;
1072
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__post", children: [
1073
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default2, { user }),
1074
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__content", children: [
1075
- customText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, custom_text_default, { text: customText, url }),
1076
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1077
- "div",
1078
- {
1079
- className: `facebook-preview__body ${modeClass} ${image && isLoadingImage ? "is-loading" : ""}`,
1080
- children: [
1081
- (image || isArticle) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1082
- "div",
1083
- {
1084
- className: `facebook-preview__image ${image ? "" : "is-empty"} ${modeClass}`,
1085
- children: image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: image, ...imgProps })
1086
- }
1087
- ),
1088
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__text", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__text-wrapper", children: [
1089
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__url", children: baseDomain(url) }),
1090
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__title", children: facebookTitle(title) || baseDomain(url) }),
1091
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1092
- "div",
1093
- {
1094
- className: `facebook-preview__description ${compactDescription ? "is-compact" : ""}`,
1095
- children: [
1096
- description && facebookDescription(description),
1097
- isArticle && !description && // translators: Default description for a Facebook post
1098
- _i18n.__.call(void 0, "Visit the post for more.", "social-previews")
1099
- ]
1100
- }
1101
- ),
1102
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, icons_default2, { name: "info" }) })
1103
- ] }) })
1104
- ]
1105
- }
1106
- )
1107
- ] }),
1108
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default2, {})
1109
- ] });
1110
- };
1111
-
1112
- // src/facebook-preview/link-preview-details.tsx
1113
-
1114
- var LinkPreviewDetails = ({
1115
- url,
1116
- customImage,
1117
- user,
1118
- customText,
1119
- imageMode
1120
- }) => {
1121
- const [mode, isLoadingImage, imgProps] = use_image_hook_default({ mode: imageMode });
1122
- const modeClass = `is-${mode === PORTRAIT_MODE ? "portrait" : "landscape"}`;
1123
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__post", children: [
1124
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default2, { user: void 0 }),
1125
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__content", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1126
- "div",
1127
- {
1128
- className: `facebook-preview__window ${modeClass} ${customImage && isLoadingImage ? "is-loading" : ""}`,
1129
- children: [
1130
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `facebook-preview__custom-image ${modeClass}`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: customImage, ...imgProps }) }),
1131
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default2, { user, timeElapsed: true, hideOptions: true }),
1132
- customText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, custom_text_default, { text: customText, url, forceUrlDisplay: true })
1133
- ]
1134
- }
1135
- ) }),
1136
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default2, {})
1137
- ] });
1138
- };
1139
-
1140
- // src/facebook-preview/post-preview.tsx
1141
-
1142
- var FacebookPostPreview = ({
1143
- url,
1144
- user,
1145
- customText,
1146
- media,
1147
- imageMode
1148
- }) => {
1149
- const [mode] = use_image_hook_default({ mode: imageMode });
1150
- const modeClass = `is-${mode === PORTRAIT_MODE ? "portrait" : "landscape"}`;
1151
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__post", children: [
1152
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default2, { user }),
1153
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "facebook-preview__content", children: [
1154
- customText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, custom_text_default, { text: customText, url, forceUrlDisplay: true }),
1155
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "facebook-preview__body", children: media ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `facebook-preview__media ${modeClass}`, children: media.map((mediaItem, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1156
- "div",
1157
- {
1158
- className: `facebook-preview__media-item ${modeClass}`,
1159
- children: mediaItem.type.startsWith("video/") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { alt: mediaItem.alt || "", src: mediaItem.url })
1160
- },
1161
- `facebook-preview__media-item-${index}`
1162
- )) }) : null })
1163
- ] }),
1164
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default2, {})
1165
- ] });
1166
- };
1167
-
1168
- // src/facebook-preview/previews.tsx
1169
-
1170
- var FacebookPreviews = ({
1171
- headingLevel,
1172
- hideLinkPreview,
1173
- hidePostPreview,
1174
- ...props
1175
- }) => {
1176
- const hasMedia = !!_optionalChain([props, 'access', _15 => _15.media, 'optionalAccess', _16 => _16.length]);
1177
- const hasCustomImage = !!props.customImage;
1178
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview facebook-preview", children: [
1179
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section facebook-preview__section", children: [
1180
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
1181
- level: headingLevel,
1182
- // translators: refers to a social post on Facebook
1183
- children: _i18n.__.call(void 0, "Your post", "social-previews")
1184
- }),
1185
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on Facebook:", "social-previews") }),
1186
- hasMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacebookPostPreview, { ...props }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacebookLinkPreview, { ...props })
1187
- ] }),
1188
- !hideLinkPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section facebook-preview__section", children: [
1189
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
1190
- level: headingLevel,
1191
- // translators: refers to a link to a Facebook post
1192
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
1193
- }),
1194
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
1195
- "This is what it will look like when someone shares the link to your WordPress post on Facebook.",
1196
- "social-previews"
1197
- ) }),
1198
- hasCustomImage ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkPreviewDetails, { ...props }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacebookLinkPreview, { ...props, compactDescription: true, customText: "", user: void 0 })
1199
- ] })
1200
- ] });
1201
- };
1202
-
1203
- // src/mastodon-preview/post/actions/index.tsx
1204
-
1205
- var MastodonPostActions = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__post-actions", children: [
1206
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1207
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1208
- "svg",
1209
- {
1210
- xmlns: "http://www.w3.org/2000/svg",
1211
- height: "24",
1212
- viewBox: "0 -960 960 960",
1213
- width: "24",
1214
- "aria-hidden": "true",
1215
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M760-200v-160q0-50-35-85t-85-35H273l144 144-57 56-240-240 240-240 57 56-144 144h367q83 0 141.5 58.5T840-360v160h-80Z" })
1216
- }
1217
- ),
1218
- "\xA0",
1219
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: 0 })
1220
- ] }),
1221
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1222
- "svg",
1223
- {
1224
- xmlns: "http://www.w3.org/2000/svg",
1225
- height: "24",
1226
- viewBox: "0 -960 960 960",
1227
- width: "24",
1228
- "aria-hidden": "true",
1229
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M280-80 120-240l160-160 56 58-62 62h406v-160h80v240H274l62 62-56 58Zm-80-440v-240h486l-62-62 56-58 160 160-160 160-56-58 62-62H280v160h-80Z" })
1230
- }
1231
- ) }),
1232
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1233
- "svg",
1234
- {
1235
- xmlns: "http://www.w3.org/2000/svg",
1236
- height: "24",
1237
- viewBox: "0 -960 960 960",
1238
- width: "24",
1239
- "aria-hidden": "true",
1240
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "m354-287 126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM233-120l65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-350Z" })
1241
- }
1242
- ) }),
1243
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1244
- "svg",
1245
- {
1246
- xmlns: "http://www.w3.org/2000/svg",
1247
- height: "24",
1248
- viewBox: "0 -960 960 960",
1249
- width: "24",
1250
- "aria-hidden": "true",
1251
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z" })
1252
- }
1253
- ) }),
1254
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1255
- "svg",
1256
- {
1257
- xmlns: "http://www.w3.org/2000/svg",
1258
- height: "24",
1259
- viewBox: "0 -960 960 960",
1260
- width: "24",
1261
- "aria-hidden": "true",
1262
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z" })
1263
- }
1264
- ) })
1265
- ] });
1266
- var actions_default3 = MastodonPostActions;
1267
-
1268
- // src/mastodon-preview/post/card/index.tsx
1269
-
1270
-
1271
-
1272
- // src/mastodon-preview/constants.ts
1273
- var DEFAULT_MASTODON_INSTANCE = "mastodon.social";
1274
-
1275
- // src/mastodon-preview/helpers.ts
1276
- var TITLE_LENGTH4 = 200;
1277
- var BODY_LENGTH = 500;
1278
- var ADDRESS_PATTERN = /^@([^@]*)@([^@]*)$/i;
1279
- var mastodonTitle = (text) => firstValid(
1280
- shortEnough(TITLE_LENGTH4),
1281
- hardTruncation(TITLE_LENGTH4)
1282
- )(stripHtmlTags(text)) || "";
1283
- var mastodonBody = (text, options) => {
1284
- const { instance, offset } = options;
1285
- return preparePreviewText(text, {
1286
- platform: "mastodon",
1287
- maxChars: BODY_LENGTH - offset,
1288
- hashtagDomain: instance
1289
- });
1290
- };
1291
- var getMastodonAddressDetails = (address) => {
1292
- const matches = address.match(ADDRESS_PATTERN);
1293
- return {
1294
- username: _optionalChain([matches, 'optionalAccess', _17 => _17[1]]) || "",
1295
- instance: _optionalChain([matches, 'optionalAccess', _18 => _18[2]]) || DEFAULT_MASTODON_INSTANCE
1296
- };
1297
- };
1298
-
1299
- // src/mastodon-preview/post/card/index.tsx
1300
-
1301
- var MastodonPostCard = ({
1302
- siteName,
1303
- title,
1304
- description,
1305
- url,
1306
- image,
1307
- customImage
1308
- }) => {
1309
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _clsx2.default.call(void 0, "mastodon-preview__card", { "has-image": image }), children: [
1310
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mastodon-preview__card-img", children: image || customImage ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1311
- "img",
1312
- {
1313
- src: image || customImage,
1314
- alt: _i18n.__.call(void 0, "Mastodon preview thumbnail", "social-previews")
1315
- }
1316
- ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mastodon-preview__card-img--fallback", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1317
- "svg",
1318
- {
1319
- xmlns: "http://www.w3.org/2000/svg",
1320
- height: "24",
1321
- viewBox: "0 -960 960 960",
1322
- width: "24",
1323
- "aria-hidden": "true",
1324
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520h200L520-800v200Z" })
1325
- }
1326
- ) }) }),
1327
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__card-text", children: [
1328
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mastodon-preview__card-site", children: siteName || baseDomain(url) }),
1329
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mastodon-preview__card-title", children: mastodonTitle(title) || getTitleFromDescription(description) }),
1330
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mastodon-preview__card-description", children: stripHtmlTags(description) })
1331
- ] })
1332
- ] });
1333
- };
1334
- var card_default = MastodonPostCard;
1335
-
1336
- // src/mastodon-preview/post/header/index.tsx
1337
-
1338
-
1339
- // src/mastodon-preview/post/icons/index.tsx
1340
-
1341
- function GlobeIcon2() {
1342
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1343
- "svg",
1344
- {
1345
- xmlns: "http://www.w3.org/2000/svg",
1346
- height: "15",
1347
- viewBox: "0 -960 960 960",
1348
- width: "15",
1349
- role: "img",
1350
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-40-82v-78q-33 0-56.5-23.5T360-320v-40L168-552q-3 18-5.5 36t-2.5 36q0 121 79.5 212T440-162Zm276-102q20-22 36-47.5t26.5-53q10.5-27.5 16-56.5t5.5-59q0-98-54.5-179T600-776v16q0 33-23.5 56.5T520-680h-80v80q0 17-11.5 28.5T400-560h-80v80h240q17 0 28.5 11.5T600-440v120h40q26 0 47 15.5t29 40.5Z" })
1351
- }
1352
- );
1353
- }
1354
-
1355
- // src/mastodon-preview/post/header/index.tsx
1356
-
1357
- var MastodonPostHeader = ({ user }) => {
1358
- const { displayName, address, avatarUrl } = user || {};
1359
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__post-header", children: [
1360
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__post-header-user", children: [
1361
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarWithFallback, { className: "mastodon-preview__post-avatar", src: avatarUrl }),
1362
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1363
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mastodon-preview__post-header-displayname", children: displayName || // translators: username of a fictional Mastodon User
1364
- _i18n.__.call(void 0, "anonymous-user", "social-previews") }),
1365
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mastodon-preview__post-header-username", children: _optionalChain([address, 'optionalAccess', _19 => _19.replace, 'call', _20 => _20(`@${DEFAULT_MASTODON_INSTANCE}`, "")]) || "@username" })
1366
- ] })
1367
- ] }),
1368
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__post-header-audience", children: [
1369
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GlobeIcon2, {}),
1370
- formatMastodonDate(/* @__PURE__ */ new Date())
1371
- ] })
1372
- ] });
1373
- };
1374
- var header_default3 = MastodonPostHeader;
1375
-
1376
- // src/mastodon-preview/link-preview.tsx
1377
-
1378
- var MastodonLinkPreview = (props) => {
1379
- const { user } = props;
1380
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__post", children: [
1381
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default3, { user }),
1382
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, card_default, { ...props, customImage: "" }),
1383
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default3, {})
1384
- ] });
1385
- };
1386
-
1387
- // src/mastodon-preview/post-preview.tsx
1388
-
1389
-
1390
- // src/mastodon-preview/post/body/index.tsx
1391
-
1392
- var MastonPostBody = (props) => {
1393
- const { title, description, customText, user, children } = props;
1394
- const instance = _optionalChain([user, 'optionalAccess', _21 => _21.address]) ? getMastodonAddressDetails(user.address).instance : "";
1395
- const options = {
1396
- instance,
1397
- offset: 0
1398
- };
1399
- let bodyTxt;
1400
- if (customText) {
1401
- bodyTxt = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: customText, children: (visibleText) => mastodonBody(visibleText, options) }) });
1402
- } else if (description) {
1403
- if (title) {
1404
- const renderedTitle = stripHtmlTags(title);
1405
- options.offset = renderedTitle.length;
1406
- bodyTxt = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1407
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: renderedTitle }),
1408
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: description, children: (visibleText) => mastodonBody(visibleText, options) }) })
1409
- ] });
1410
- } else {
1411
- bodyTxt = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: description, children: (visibleText) => mastodonBody(visibleText, options) }) });
1412
- }
1413
- } else {
1414
- bodyTxt = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: mastodonBody(title, options) });
1415
- }
1416
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__body", children: [
1417
- bodyTxt,
1418
- children
1419
- ] });
1420
- };
1421
- var body_default = MastonPostBody;
1422
-
1423
- // src/mastodon-preview/post-preview.tsx
1424
-
1425
- var MastodonPostPreview = (props) => {
1426
- const { user, media } = props;
1427
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__post", children: [
1428
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default3, { user }),
1429
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, body_default, { ...props, children: _optionalChain([media, 'optionalAccess', _22 => _22.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _clsx2.default.call(void 0, "mastodon-preview__media", { "as-grid": media.length > 1 }), children: media.map((mediaItem, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1430
- "div",
1431
- {
1432
- className: "mastodon-preview__media-item",
1433
- children: mediaItem.type.startsWith("video/") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { alt: mediaItem.alt || "", src: mediaItem.url })
1434
- },
1435
- `mastodon-preview__media-item-${index}`
1436
- )) }) : null }),
1437
- !_optionalChain([media, 'optionalAccess', _23 => _23.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, card_default, { ...props }) : null,
1438
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default3, {})
1439
- ] });
1440
- };
1441
-
1442
- // src/mastodon-preview/previews.tsx
1443
-
1444
-
1445
- var MastodonPreviews = ({
1446
- headingLevel,
1447
- hidePostPreview,
1448
- hideLinkPreview,
1449
- ...props
1450
- }) => {
1451
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview mastodon-preview", children: [
1452
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section mastodon-preview__section", children: [
1453
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SectionHeading, {
1454
- level: headingLevel,
1455
- // translators: refers to a social post on Mastodon
1456
- children: _i18n.__.call(void 0, "Your post", "social-previews")
1457
- }),
1458
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on Mastodon:", "social-previews") }),
1459
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MastodonPostPreview, { ...props })
1460
- ] }),
1461
- !hideLinkPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section mastodon-preview__section", children: [
1462
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SectionHeading, {
1463
- level: headingLevel,
1464
- // translators: refers to a link to a Mastodon post
1465
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
1466
- }),
1467
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
1468
- "This is what it will look like when someone shares the link to your WordPress post on Mastodon.",
1469
- "social-previews"
1470
- ) }),
1471
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MastodonLinkPreview, { ...props, user: void 0 })
1472
- ] })
1473
- ] });
1474
- };
1475
-
1476
- // src/nextdoor-preview/post-preview.tsx
1477
-
1478
-
1479
-
1480
- // src/nextdoor-preview/constants.ts
1481
- var FEED_TEXT_MAX_LENGTH2 = 65e3;
1482
-
1483
- // src/nextdoor-preview/footer-actions.tsx
1484
-
1485
-
1486
- // src/nextdoor-preview/icons/comment-icon.tsx
1487
-
1488
- function CommentIcon() {
1489
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1490
- "path",
1491
- {
1492
- fill: "currentColor",
1493
- fillRule: "evenodd",
1494
- d: "M2 10.031C2 5.596 5.574 2 10 2h4c4.427 0 8 3.596 8 8.031 0 4.435-3.573 8.031-8 8.031h-1.52a17.033 17.033 0 0 1-1.377 1.467c-.991.938-2.456 2.079-4.086 2.437a1.403 1.403 0 0 1-1.458-.565 1.55 1.55 0 0 1-.195-1.394c.28-.823.395-1.734.434-2.464.014-.257.018-.485.018-.672A8.017 8.017 0 0 1 2 10.031Zm5.798 6.178a7.02 7.02 0 0 1 .016.418c.005.252.004.606-.019 1.023-.03.573-.103 1.285-.266 2.024.775-.377 1.54-.974 2.202-1.598a15.066 15.066 0 0 0 1.448-1.586l.017-.022.003-.004a1 1 0 0 1 .801-.402h2c3.314 0 6-2.692 6-6.03C20 6.691 17.314 4 14 4h-4c-3.314 0-6 2.692-6 6.031 0 2.336 1.32 4.36 3.258 5.359.308.159.515.474.54.82Z",
1495
- clipRule: "evenodd"
1496
- }
1497
- ) });
1498
- }
1499
-
1500
- // src/nextdoor-preview/icons/like-icon.tsx
1501
-
1502
- function LikeIcon() {
1503
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1504
- "path",
1505
- {
1506
- fill: "currentColor",
1507
- fillRule: "evenodd",
1508
- d: "M13.275 8.752a1.5 1.5 0 0 1-2.55 0C9.75 7.18 8.719 5.617 6.565 6.074 5.248 6.352 4 7.433 4 9.644c0 2.153 1.348 4.592 4.259 7.236A28.475 28.475 0 0 0 12 19.74a28.475 28.475 0 0 0 3.741-2.86C18.651 14.236 20 11.797 20 9.643c0-2.21-1.25-3.29-2.564-3.57-2.155-.456-3.187 1.106-4.16 2.68Zm-2.581-3.48C7.634 2.58 2 4.217 2 9.643c0 2.996 1.85 5.934 4.914 8.717 1.478 1.343 3.1 2.585 4.839 3.575a.5.5 0 0 0 .494 0c1.739-.99 3.361-2.232 4.84-3.575C20.148 15.577 22 12.64 22 9.643c0-5.426-5.634-7.062-8.694-4.371A5.287 5.287 0 0 0 12 7.04a5.287 5.287 0 0 0-1.306-1.77Z",
1509
- clipRule: "evenodd"
1510
- }
1511
- ) });
1512
- }
1513
-
1514
- // src/nextdoor-preview/icons/share-icon.tsx
1515
-
1516
- function ShareIcon() {
1517
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1518
- "path",
1519
- {
1520
- fill: "currentColor",
1521
- fillRule: "evenodd",
1522
- d: "M11.617 2.076a1 1 0 0 1 1.09.217l9 9a1 1 0 0 1 0 1.414l-9 9A1 1 0 0 1 11 21v-4.436c-2.849.366-5.261 2.271-6.384 4.837a1 1 0 0 1-1.856-.06C2.338 20.182 2 18.86 2 17.5a9.959 9.959 0 0 1 9-9.951V3a1 1 0 0 1 .617-.924ZM13 5.414V8.5a1 1 0 0 1-1 1c-4.448 0-8 3.552-8 8 0 .31.023.625.066.94C5.905 16.067 8.776 14.5 12 14.5a1 1 0 0 1 1 1v3.086L19.586 12 13 5.414Z",
1523
- clipRule: "evenodd"
1524
- }
1525
- ) });
1526
- }
1527
-
1528
- // src/nextdoor-preview/footer-actions.tsx
1529
-
1530
- function FooterActions() {
1531
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__footer--actions", children: [
1532
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__footer--actions-item", children: [
1533
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LikeIcon, {}),
1534
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _i18n.__.call(void 0, "Like", "social-previews") })
1535
- ] }),
1536
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__footer--actions-item", children: [
1537
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CommentIcon, {}),
1538
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _i18n.__.call(void 0, "Comment", "social-previews") })
1539
- ] }),
1540
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__footer--actions-item", children: [
1541
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ShareIcon, {}),
1542
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _i18n.__.call(void 0, "Share", "social-previews") })
1543
- ] })
1544
- ] });
1545
- }
1546
-
1547
- // src/nextdoor-preview/icons/chevron-icon.tsx
1548
-
1549
- function ChevronIcon() {
1550
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1551
- "path",
1552
- {
1553
- fill: "#dfe1e4",
1554
- fillRule: "evenodd",
1555
- d: "M7.127 13.876a.732.732 0 1 0 1.035 1.035l4.75-4.749a.732.732 0 0 0 0-1.035L8.123 4.34A.732.732 0 0 0 7.09 5.375l4.27 4.27-4.232 4.23Z"
1556
- }
1557
- ) });
1558
- }
1559
-
1560
- // src/nextdoor-preview/icons/default-image.tsx
1561
-
1562
- function DefaultImage() {
1563
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nextdoor-preview__default-image", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1564
- "svg",
1565
- {
1566
- width: "24",
1567
- height: "24",
1568
- fill: "none",
1569
- viewBox: "0 0 24 24",
1570
- "aria-hidden": "true",
1571
- color: "#055c00",
1572
- children: [
1573
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1574
- "path",
1575
- {
1576
- fill: "currentColor",
1577
- d: "M13.207 5.207c1.51-1.51 4.076-1.51 5.586 0 1.51 1.51 1.51 4.076 0 5.586l-2.1 2.1c-1.51 1.51-4.077 1.51-5.586 0a1 1 0 1 0-1.414 1.414c2.29 2.29 6.123 2.29 8.414 0l2.1-2.1c2.29-2.29 2.29-6.124 0-8.414s-6.124-2.29-8.414 0l-.7.7a1 1 0 0 0 1.414 1.414l.7-.7Z"
1578
- }
1579
- ),
1580
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1581
- "path",
1582
- {
1583
- fill: "currentColor",
1584
- d: "M7.307 11.107c1.51-1.51 4.076-1.51 5.586 0a1 1 0 0 0 1.414-1.414c-2.29-2.29-6.124-2.29-8.414 0l-2.1 2.1c-2.29 2.29-2.29 6.123 0 8.414 2.29 2.29 6.124 2.29 8.414 0l.7-.7a1 1 0 0 0-1.414-1.414l-.7.7c-1.51 1.51-4.076 1.51-5.586 0-1.51-1.51-1.51-4.076 0-5.586l2.1-2.1Z"
1585
- }
1586
- )
1587
- ]
1588
- }
1589
- ) });
1590
- }
1591
-
1592
- // src/nextdoor-preview/icons/globe-icon.tsx
1593
-
1594
- function GlobeIcon3() {
1595
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "14", height: "14", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1596
- "path",
1597
- {
1598
- fill: "currentColor",
1599
- fillRule: "evenodd",
1600
- d: "M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm9.495-7.643c.286-.335.46-.357.505-.357.045 0 .219.022.505.357.282.33.581.868.852 1.619.464 1.283.79 3.034.872 5.024H9.771c.082-1.99.408-3.741.871-5.024.272-.751.571-1.289.854-1.62ZM7.77 11c.084-2.181.439-4.171.992-5.704.093-.255.192-.502.298-.738A8.009 8.009 0 0 0 4.062 11h3.707Zm-3.707 2h3.707c.084 2.181.439 4.171.992 5.704.093.255.192.502.298.738A8.009 8.009 0 0 1 4.062 13Zm15.876-2a8.009 8.009 0 0 0-4.997-6.442c.106.236.205.483.298.738.553 1.533.908 3.523.992 5.704h3.707Zm-3.707 2h3.707a8.009 8.009 0 0 1-4.997 6.442c.106-.236.205-.483.298-.738.553-1.533.908-3.523.992-5.704Zm-2.002 0c-.082 1.99-.408 3.741-.871 5.024-.272.751-.571 1.289-.854 1.62-.285.334-.46.356-.504.356-.045 0-.219-.022-.505-.357-.282-.33-.581-.868-.852-1.619-.464-1.283-.79-3.034-.872-5.024h4.458Z",
1601
- clipRule: "evenodd"
1602
- }
1603
- ) });
1604
- }
1605
-
1606
- // src/nextdoor-preview/post-preview.tsx
1607
-
1608
- function NextdoorPostPreview({
1609
- image,
1610
- name,
1611
- profileImage,
1612
- description,
1613
- neighborhood,
1614
- media,
1615
- title,
1616
- url
1617
- }) {
1618
- const hasMedia = !!_optionalChain([media, 'optionalAccess', _24 => _24.length]);
1619
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nextdoor-preview__wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "section", { className: `nextdoor-preview__container ${hasMedia ? "has-media" : ""}`, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__content", children: [
1620
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__header", children: [
1621
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nextdoor-preview__header--avatar", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarWithFallback, { src: profileImage }) }),
1622
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__header--details", children: [
1623
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nextdoor-preview__header--name", children: name || _i18n.__.call(void 0, "Account Name", "social-previews") }),
1624
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__header--meta", children: [
1625
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: neighborhood || _i18n.__.call(void 0, "Neighborhood", "social-previews") }),
1626
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2022" }),
1627
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: formatNextdoorDate(Date.now()) }),
1628
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2022" }),
1629
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GlobeIcon3, {})
1630
- ] })
1631
- ] })
1632
- ] }),
1633
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__body", children: [
1634
- description ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__caption", children: [
1635
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: description, children: (visibleText) => preparePreviewText(visibleText, {
1636
- platform: "nextdoor",
1637
- maxChars: FEED_TEXT_MAX_LENGTH2
1638
- }) }) }),
1639
- !hasMedia && url && !description.includes(url) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1640
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
1641
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
1642
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: url, rel: "nofollow noopener noreferrer", target: "_blank", children: url })
1643
- ] })
1644
- ] }) : null,
1645
- hasMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nextdoor-preview__media", children: media.map((mediaItem, index) => {
1646
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1647
- "div",
1648
- {
1649
- className: "nextdoor-preview__media-item",
1650
- children: _optionalChain([mediaItem, 'optionalAccess', _25 => _25.type, 'optionalAccess', _26 => _26.startsWith, 'call', _27 => _27("video/")]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { alt: mediaItem.alt || "", src: mediaItem.url })
1651
- },
1652
- `nextdoor-preview__media-item-${index}`
1653
- );
1654
- }) }) : null,
1655
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1656
- "article",
1657
- {
1658
- className: _clsx2.default.call(void 0, "nextdoor-preview__card", {
1659
- "small-preview": !image || hasMedia
1660
- }),
1661
- children: [
1662
- image ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "nextdoor-preview__image", src: image, alt: "" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultImage, {}),
1663
- url ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "nextdoor-preview__description", children: [
1664
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "nextdoor-preview__description--title", children: title || getTitleFromDescription(description) }),
1665
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "nextdoor-preview__description--url", children: baseDomain(url) })
1666
- ] }) : null,
1667
- hasMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nextdoor-preview__card--chevron-wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronIcon, {}) }) : null
1668
- ]
1669
- }
1670
- )
1671
- ] }),
1672
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "nextdoor-preview__footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FooterActions, {}) })
1673
- ] }) }) });
1674
- }
1675
-
1676
- // src/nextdoor-preview/link-preview.tsx
1677
-
1678
- function NextdoorLinkPreview(props) {
1679
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1680
- NextdoorPostPreview,
1681
- {
1682
- name: "",
1683
- profileImage: "",
1684
- ...props,
1685
- description: "",
1686
- media: void 0,
1687
- title: props.title || getTitleFromDescription(props.description)
1688
- }
1689
- );
1690
- }
1691
-
1692
- // src/nextdoor-preview/previews.tsx
1693
-
1694
-
1695
- var NextdoorPreviews = ({
1696
- headingLevel,
1697
- hideLinkPreview,
1698
- hidePostPreview,
1699
- ...props
1700
- }) => {
1701
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview nextdoor-preview", children: [
1702
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section nextdoor-preview__section", children: [
1703
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
1704
- level: headingLevel,
1705
- // translators: refers to a social post on Nextdoor
1706
- children: _i18n.__.call(void 0, "Your post", "social-previews")
1707
- }),
1708
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on Nextdoor:", "social-previews") }),
1709
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NextdoorPostPreview, { ...props })
1710
- ] }),
1711
- !hideLinkPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section nextdoor-preview__section", children: [
1712
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
1713
- level: headingLevel,
1714
- // translators: refers to a link to a Nextdoor post
1715
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
1716
- }),
1717
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
1718
- "This is what it will look like when someone shares the link to your WordPress post on Nextdoor.",
1719
- "social-previews"
1720
- ) }),
1721
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NextdoorLinkPreview, { ...props, name: "", profileImage: "" })
1722
- ] })
1723
- ] });
1724
- };
1725
-
1726
- // src/bluesky-preview/post-preview.tsx
1727
-
1728
-
1729
- // src/bluesky-preview/post/actions/index.tsx
1730
-
1731
- var BlueskyPostActions = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bluesky-preview__post-actions", children: [
1732
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1733
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1734
- "svg",
1735
- {
1736
- fill: "none",
1737
- width: "18",
1738
- viewBox: "0 0 24 24",
1739
- height: "18",
1740
- style: { color: "rgb(111, 134, 159)" },
1741
- "aria-hidden": "true",
1742
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1743
- "path",
1744
- {
1745
- fill: "hsl(211, 20%, 53%)",
1746
- fillRule: "evenodd",
1747
- clipRule: "evenodd",
1748
- d: "M2.002 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H12.28l-4.762 2.858A1 1 0 0 1 6.002 21v-2h-1a3 3 0 0 1-3-3V6Zm3-1a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h2a1 1 0 0 1 1 1v1.234l3.486-2.092a1 1 0 0 1 .514-.142h7a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-14Z"
1749
- }
1750
- )
1751
- }
1752
- ),
1753
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: 0 })
1754
- ] }),
1755
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1756
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1757
- "svg",
1758
- {
1759
- fill: "none",
1760
- width: "18",
1761
- viewBox: "0 0 24 24",
1762
- height: "18",
1763
- style: { color: "rgb(111, 134, 159)" },
1764
- "aria-hidden": "true",
1765
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1766
- "path",
1767
- {
1768
- fill: "hsl(211, 20%, 53%)",
1769
- fillRule: "evenodd",
1770
- clipRule: "evenodd",
1771
- d: "M17.957 2.293a1 1 0 1 0-1.414 1.414L17.836 5H6a3 3 0 0 0-3 3v3a1 1 0 1 0 2 0V8a1 1 0 0 1 1-1h11.836l-1.293 1.293a1 1 0 0 0 1.414 1.414l2.47-2.47a1.75 1.75 0 0 0 0-2.474l-2.47-2.47ZM20 12a1 1 0 0 1 1 1v3a3 3 0 0 1-3 3H6.164l1.293 1.293a1 1 0 1 1-1.414 1.414l-2.47-2.47a1.75 1.75 0 0 1 0-2.474l2.47-2.47a1 1 0 0 1 1.414 1.414L6.164 17H18a1 1 0 0 0 1-1v-3a1 1 0 0 1 1-1Z"
1772
- }
1773
- )
1774
- }
1775
- ),
1776
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: 0 })
1777
- ] }),
1778
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1779
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1780
- "svg",
1781
- {
1782
- fill: "none",
1783
- width: "18",
1784
- viewBox: "0 0 24 24",
1785
- height: "18",
1786
- style: { color: "rgb(111, 134, 159)" },
1787
- "aria-hidden": "true",
1788
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1789
- "path",
1790
- {
1791
- fill: "hsl(211, 20%, 53%)",
1792
- fillRule: "evenodd",
1793
- clipRule: "evenodd",
1794
- d: "M16.734 5.091c-1.238-.276-2.708.047-4.022 1.38a1 1 0 0 1-1.424 0C9.974 5.137 8.504 4.814 7.266 5.09c-1.263.282-2.379 1.206-2.92 2.556C3.33 10.18 4.252 14.84 12 19.348c7.747-4.508 8.67-9.168 7.654-11.7-.541-1.351-1.657-2.275-2.92-2.557Zm4.777 1.812c1.604 4-.494 9.69-9.022 14.47a1 1 0 0 1-.978 0C2.983 16.592.885 10.902 2.49 6.902c.779-1.942 2.414-3.334 4.342-3.764 1.697-.378 3.552.003 5.169 1.286 1.617-1.283 3.472-1.664 5.17-1.286 1.927.43 3.562 1.822 4.34 3.764Z"
1795
- }
1796
- )
1797
- }
1798
- ),
1799
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: 0 })
1800
- ] }),
1801
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { fill: "none", viewBox: "0 0 24 24", width: "20", height: "20", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1802
- "path",
1803
- {
1804
- fill: "hsl(211, 20%, 53%)",
1805
- fillRule: "evenodd",
1806
- clipRule: "evenodd",
1807
- d: "M2 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm16 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-6-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Z"
1808
- }
1809
- ) }) })
1810
- ] });
1811
- var actions_default4 = BlueskyPostActions;
1812
-
1813
- // src/bluesky-preview/helpers.ts
1814
- var TITLE_LENGTH5 = 200;
1815
- var BODY_LENGTH2 = 300;
1816
- var URL_LENGTH2 = 40;
1817
- var BODY_CHAR_LIMIT = BODY_LENGTH2 - URL_LENGTH2;
1818
- var blueskyTitle = (text) => firstValid(
1819
- shortEnough(TITLE_LENGTH5),
1820
- hardTruncation(TITLE_LENGTH5)
1821
- )(stripHtmlTags(text)) || "";
1822
- var blueskyBody = (text, options = {}) => {
1823
- const { offset = 0, reserveUrlSpace = true } = options;
1824
- return preparePreviewText(text, {
1825
- platform: "bluesky",
1826
- maxChars: BODY_LENGTH2 - (reserveUrlSpace ? URL_LENGTH2 : 0) - offset
1827
- });
1828
- };
1829
- var blueskyUrl = (text) => firstValid(shortEnough(URL_LENGTH2), hardTruncation(URL_LENGTH2))(stripHtmlTags(text)) || "";
1830
-
1831
- // src/bluesky-preview/post/body/index.tsx
1832
-
1833
- var BlueskyPostBody = ({ customText, url, children, appendUrl }) => {
1834
- const showUrl = appendUrl && !!url && !_optionalChain([customText, 'optionalAccess', _28 => _28.includes, 'call', _29 => _29(url)]);
1835
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bluesky-preview__body", children: [
1836
- customText ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1837
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: blueskyBody(customText, { reserveUrlSpace: showUrl }) }),
1838
- showUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1839
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
1840
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: url, target: "_blank", rel: "noreferrer noopener", children: blueskyUrl(url.replace(/^https?:\/\//, "")) })
1841
- ] }) : null
1842
- ] }) : null,
1843
- children
1844
- ] });
1845
- };
1846
- var body_default2 = BlueskyPostBody;
1847
-
1848
- // src/bluesky-preview/post/card/index.tsx
1849
-
1850
- var BlueskyPostCard = ({ title, description, url, image }) => {
1851
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bluesky-preview__card", children: [
1852
- image ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__card-image", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: image, alt: "" }) }) : null,
1853
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bluesky-preview__card-text", children: [
1854
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__card-site", children: baseDomain(url) }),
1855
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__card-title", children: blueskyTitle(title) || getTitleFromDescription(description) }),
1856
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__card-description", children: stripHtmlTags(description) })
1857
- ] })
1858
- ] });
1859
- };
1860
- var card_default2 = BlueskyPostCard;
1861
-
1862
- // src/bluesky-preview/post/header/index.tsx
1863
-
1864
-
1865
- var BlueskyPostHeader = ({ user }) => {
1866
- const { displayName, address } = user || {};
1867
- let handle = address || "username.bsky.social";
1868
- if (!handle.startsWith("@")) {
1869
- handle = "@" + handle;
1870
- }
1871
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bluesky-preview__post-header", children: [
1872
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bluesky-preview__post-header-user", children: [
1873
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "bluesky-preview__post-header--displayname", children: displayName || _i18n.__.call(void 0, "Account name", "social-previews") }),
1874
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "bluesky-preview__post-header--username", children: handle })
1875
- ] }),
1876
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__post-header--separator", children: "\xB7" }),
1877
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__post-header--date", children: _i18n._x.call(void 0,
1878
- "1h",
1879
- 'refers to the time since the post was published, e.g. "1h"',
1880
- "social-previews"
1881
- ) })
1882
- ] });
1883
- };
1884
- var header_default4 = BlueskyPostHeader;
1885
-
1886
- // src/bluesky-preview/post/sidebar/index.tsx
1887
-
1888
- var BlueskyPostSidebar = ({ user }) => {
1889
- const { avatarUrl } = user || {};
1890
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__post-sidebar", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bluesky-preview__post-sidebar-user", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarWithFallback, { className: "bluesky-preview__post-avatar", src: avatarUrl }) }) });
1891
- };
1892
-
1893
- // src/bluesky-preview/post-preview.tsx
1894
-
1895
- var BlueskyPostPreview = (props) => {
1896
- const { user, media, appendUrl } = props;
1897
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bluesky-preview__post", children: [
1898
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlueskyPostSidebar, { user }),
1899
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1900
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, header_default4, { user }),
1901
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, body_default2, { ...props, appendUrl: _nullishCoalesce(appendUrl, () => ( Boolean(_optionalChain([media, 'optionalAccess', _30 => _30.length])))), children: _optionalChain([media, 'optionalAccess', _31 => _31.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _clsx2.default.call(void 0, "bluesky-preview__media", { "as-grid": media.length > 1 }), children: media.map((mediaItem, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1902
- "div",
1903
- {
1904
- className: "bluesky-preview__media-item",
1905
- children: mediaItem.type.startsWith("video/") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { alt: mediaItem.alt || "", src: mediaItem.url })
1906
- },
1907
- `bluesky-preview__media-item-${index}`
1908
- )) }) : null }),
1909
- !_optionalChain([media, 'optionalAccess', _32 => _32.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, card_default2, { ...props }) : null,
1910
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actions_default4, {})
1911
- ] })
1912
- ] });
1913
- };
1914
-
1915
- // src/bluesky-preview/link-preview.tsx
1916
-
1917
- var BlueskyLinkPreview = (props) => {
1918
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlueskyPostPreview, { ...props, user: void 0, media: void 0, customText: "" });
1919
- };
1920
-
1921
- // src/bluesky-preview/previews.tsx
1922
-
1923
-
1924
- var BlueskyPreviews = ({
1925
- headingLevel,
1926
- hidePostPreview,
1927
- hideLinkPreview,
1928
- ...props
1929
- }) => {
1930
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview bluesky-preview", children: [
1931
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section bluesky-preview__section", children: [
1932
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SectionHeading, {
1933
- level: headingLevel,
1934
- // translators: refers to a social post on Bluesky
1935
- children: _i18n.__.call(void 0, "Your post", "social-previews")
1936
- }),
1937
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on Bluesky:", "social-previews") }),
1938
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlueskyPostPreview, { ...props })
1939
- ] }),
1940
- !hideLinkPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section bluesky-preview__section", children: [
1941
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SectionHeading, {
1942
- level: headingLevel,
1943
- // translators: refers to a link to a Bluesky post
1944
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
1945
- }),
1946
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
1947
- "This is what it will look like when someone shares the link to your WordPress post on Bluesky.",
1948
- "social-previews"
1949
- ) }),
1950
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlueskyLinkPreview, { ...props })
1951
- ] })
1952
- ] });
1953
- };
1954
-
1955
- // src/threads-preview/link-preview.tsx
1956
-
1957
-
1958
- // src/threads-preview/card.tsx
1959
-
1960
-
1961
- // src/threads-preview/helpers.ts
1962
- var TITLE_LENGTH6 = 120;
1963
- var CAPTION_MAX_CHARS = 500;
1964
- var threadsTitle = (text) => firstValid(
1965
- shortEnough(TITLE_LENGTH6),
1966
- hardTruncation(TITLE_LENGTH6)
1967
- )(stripHtmlTags(text)) || "";
1968
-
1969
- // src/threads-preview/card.tsx
1970
-
1971
- var Card2 = ({ image, title, url }) => {
1972
- const cardClassNames = _clsx2.default.call(void 0, {
1973
- "threads-preview__card-has-image": !!image
1974
- });
1975
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "threads-preview__card", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cardClassNames, children: [
1976
- image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "threads-preview__card-image", src: image, alt: "" }),
1977
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "threads-preview__card-body", children: [
1978
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "threads-preview__card-url", children: baseDomain(url || "") }),
1979
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "threads-preview__card-title", children: threadsTitle(title) })
1980
- ] })
1981
- ] }) });
1982
- };
1983
-
1984
- // src/threads-preview/footer.tsx
1985
-
1986
- var Footer2 = () => {
1987
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "threads-preview__footer", children: [
1988
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "threads-preview__icon--like", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { role: "img", viewBox: "0 0 18 18", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1989
- "path",
1990
- {
1991
- d: "M1.34375 7.53125L1.34375 7.54043C1.34374 8.04211 1.34372 8.76295 1.6611 9.65585C1.9795 10.5516 2.60026 11.5779 3.77681 12.7544C5.59273 14.5704 7.58105 16.0215 8.33387 16.5497C8.73525 16.8313 9.26573 16.8313 9.66705 16.5496C10.4197 16.0213 12.4074 14.5703 14.2232 12.7544C15.3997 11.5779 16.0205 10.5516 16.3389 9.65585C16.6563 8.76296 16.6563 8.04211 16.6562 7.54043V7.53125C16.6562 5.23466 15.0849 3.25 12.6562 3.25C11.5214 3.25 10.6433 3.78244 9.99228 4.45476C9.59009 4.87012 9.26356 5.3491 9 5.81533C8.73645 5.3491 8.40991 4.87012 8.00772 4.45476C7.35672 3.78244 6.47861 3.25 5.34375 3.25C2.9151 3.25 1.34375 5.23466 1.34375 7.53125Z",
1992
- strokeWidth: "1.25"
1993
- }
1994
- ) }) }),
1995
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "threads-preview__icon--reply", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { role: "img", viewBox: "0 0 18 18", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1996
- "path",
1997
- {
1998
- d: "M15.376 13.2177L16.2861 16.7955L12.7106 15.8848C12.6781 15.8848 12.6131 15.8848 12.5806 15.8848C11.3779 16.5678 9.94767 16.8931 8.41995 16.7955C4.94194 16.5353 2.08152 13.7381 1.72397 10.2578C1.2689 5.63919 5.13697 1.76863 9.75264 2.22399C13.2307 2.58177 16.0261 5.41151 16.2861 8.92429C16.4161 10.453 16.0586 11.8841 15.376 13.0876C15.376 13.1526 15.376 13.1852 15.376 13.2177Z",
1999
- strokeLinejoin: "round",
2000
- strokeWidth: "1.25"
2001
- }
2002
- ) }) }),
2003
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "threads-preview__icon--repost", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { role: "img", viewBox: "0 0 18 18", children: [
2004
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M6.41256 1.23531C6.6349 0.971277 7.02918 0.937481 7.29321 1.15982L9.96509 3.40982C10.1022 3.52528 10.1831 3.69404 10.1873 3.87324C10.1915 4.05243 10.1186 4.2248 9.98706 4.34656L7.31518 6.81971C7.06186 7.05419 6.66643 7.03892 6.43196 6.7856C6.19748 6.53228 6.21275 6.13685 6.46607 5.90237L7.9672 4.51289H5.20312C3.68434 4.51289 2.45312 5.74411 2.45312 7.26289V9.51289V11.7629C2.45312 13.2817 3.68434 14.5129 5.20312 14.5129C5.5483 14.5129 5.82812 14.7927 5.82812 15.1379C5.82812 15.4831 5.5483 15.7629 5.20312 15.7629C2.99399 15.7629 1.20312 13.972 1.20312 11.7629V9.51289V7.26289C1.20312 5.05375 2.99399 3.26289 5.20312 3.26289H7.85002L6.48804 2.11596C6.22401 1.89362 6.19021 1.49934 6.41256 1.23531Z" }),
2005
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M11.5874 17.7904C11.3651 18.0545 10.9708 18.0883 10.7068 17.8659L8.03491 15.6159C7.89781 15.5005 7.81687 15.3317 7.81267 15.1525C7.80847 14.9733 7.8814 14.801 8.01294 14.6792L10.6848 12.206C10.9381 11.9716 11.3336 11.9868 11.568 12.2402C11.8025 12.4935 11.7872 12.8889 11.5339 13.1234L10.0328 14.5129H12.7969C14.3157 14.5129 15.5469 13.2816 15.5469 11.7629V9.51286V7.26286C15.5469 5.74408 14.3157 4.51286 12.7969 4.51286C12.4517 4.51286 12.1719 4.23304 12.1719 3.88786C12.1719 3.54269 12.4517 3.26286 12.7969 3.26286C15.006 3.26286 16.7969 5.05373 16.7969 7.26286V9.51286V11.7629C16.7969 13.972 15.006 15.7629 12.7969 15.7629H10.15L11.512 16.9098C11.776 17.1321 11.8098 17.5264 11.5874 17.7904Z" })
2006
- ] }) }),
2007
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "threads-preview__icon--share", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { role: "img", viewBox: "0 0 18 18", children: [
2008
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2009
- "path",
2010
- {
2011
- d: "M15.6097 4.09082L6.65039 9.11104",
2012
- strokeLinejoin: "round",
2013
- strokeWidth: "1.25"
2014
- }
2015
- ),
2016
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2017
- "path",
2018
- {
2019
- d: "M7.79128 14.439C8.00463 15.3275 8.11131 15.7718 8.33426 15.932C8.52764 16.071 8.77617 16.1081 9.00173 16.0318C9.26179 15.9438 9.49373 15.5501 9.95761 14.7628L15.5444 5.2809C15.8883 4.69727 16.0603 4.40546 16.0365 4.16566C16.0159 3.95653 15.9071 3.76612 15.7374 3.64215C15.5428 3.5 15.2041 3.5 14.5267 3.5H3.71404C2.81451 3.5 2.36474 3.5 2.15744 3.67754C1.97758 3.83158 1.88253 4.06254 1.90186 4.29856C1.92415 4.57059 2.24363 4.88716 2.88259 5.52032L6.11593 8.7243C6.26394 8.87097 6.33795 8.94431 6.39784 9.02755C6.451 9.10144 6.4958 9.18101 6.53142 9.26479C6.57153 9.35916 6.59586 9.46047 6.64451 9.66309L7.79128 14.439Z",
2020
- strokeLinejoin: "round",
2021
- strokeWidth: "1.25"
2022
- }
2023
- )
2024
- ] }) })
2025
- ] });
2026
- };
2027
-
2028
- // src/threads-preview/header.tsx
2029
-
2030
-
2031
- var Header2 = ({ name, date }) => {
2032
- const postDate = date || /* @__PURE__ */ new Date();
2033
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "threads-preview__header", children: [
2034
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "threads-preview__name", children: name || _i18n.__.call(void 0, "Account Name", "social-previews") }),
2035
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "time", { className: "threads-preview__date", dateTime: postDate.toISOString(), children: formatThreadsDate(postDate) })
2036
- ] });
2037
- };
2038
-
2039
- // src/threads-preview/media.tsx
2040
-
2041
-
2042
-
2043
- var Media2 = ({ media }) => {
2044
- const filteredMedia = media.filter(
2045
- (mediaItem) => mediaItem.type.startsWith("image/") || mediaItem.type.startsWith("video/")
2046
- ).filter((mediaItem, idx, array) => {
2047
- if (0 === idx) {
2048
- return true;
2049
- }
2050
- if (array[0].type.startsWith("video/") || "image/gif" === array[0].type) {
2051
- return false;
2052
- }
2053
- if (mediaItem.type.startsWith("video/") || "image/gif" === mediaItem.type) {
2054
- return false;
2055
- }
2056
- return true;
2057
- }).slice(0, 4);
2058
- if (0 === filteredMedia.length) {
2059
- return null;
2060
- }
2061
- const isVideo = filteredMedia[0].type.startsWith("video/");
2062
- const mediaClasses = _clsx2.default.call(void 0, [
2063
- "threads-preview__media",
2064
- "threads-preview__media-children-" + filteredMedia.length
2065
- ]);
2066
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: mediaClasses, children: filteredMedia.map((mediaItem, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: isVideo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { alt: mediaItem.alt || "", src: mediaItem.url }) }, `threads-preview__media-item-${index}`)) });
2067
- };
2068
-
2069
- // src/threads-preview/sidebar.tsx
2070
-
2071
-
2072
- var Sidebar2 = ({ profileImage, showThreadConnector }) => {
2073
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "threads-preview__sidebar", children: [
2074
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "threads-preview__profile-image", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2075
- AvatarWithFallback,
2076
- {
2077
- alt: _i18n.__.call(void 0, "Threads profile image", "social-previews"),
2078
- src: profileImage
2079
- }
2080
- ) }),
2081
- showThreadConnector && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "threads-preview__connector" })
2082
- ] });
2083
- };
2084
-
2085
- // src/threads-preview/post-preview.tsx
2086
-
2087
- var ThreadsPostPreview = ({
2088
- caption,
2089
- date,
2090
- image,
2091
- media,
2092
- name,
2093
- profileImage,
2094
- showThreadConnector,
2095
- title,
2096
- url
2097
- }) => {
2098
- const hasMedia = !!_optionalChain([media, 'optionalAccess', _33 => _33.length]);
2099
- const displayAsCard = url && image && !hasMedia;
2100
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "threads-preview__wrapper", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "threads-preview__container", children: [
2101
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Sidebar2, { profileImage, showThreadConnector }),
2102
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "threads-preview__main", children: [
2103
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header2, { name, date }),
2104
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "threads-preview__content", children: [
2105
- caption ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "threads-preview__text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: caption, children: (visibleText) => preparePreviewText(visibleText, {
2106
- platform: "threads",
2107
- maxChars: CAPTION_MAX_CHARS
2108
- }) }) }) : null,
2109
- hasMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Media2, { media }) : null,
2110
- displayAsCard ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Card2, { image, title: title || "", url }) : null
2111
- ] }),
2112
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Footer2, {})
2113
- ] })
2114
- ] }) });
2115
- };
2116
-
2117
- // src/threads-preview/link-preview.tsx
2118
-
2119
- var ThreadsLinkPreview = (props) => {
2120
- if (!props.image) {
2121
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
2122
- "Threads link preview requires an image to be set for the post. Please add an image to see the preview.",
2123
- "social-previews"
2124
- ) });
2125
- }
2126
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2127
- ThreadsPostPreview,
2128
- {
2129
- ...props,
2130
- caption: "",
2131
- media: void 0
2132
- }
2133
- );
2134
- };
2135
-
2136
- // src/threads-preview/previews.tsx
2137
-
2138
-
2139
- var ThreadsPreviews = ({
2140
- headingLevel,
2141
- hideLinkPreview,
2142
- hidePostPreview,
2143
- posts
2144
- }) => {
2145
- if (!_optionalChain([posts, 'optionalAccess', _34 => _34.length])) {
2146
- return null;
2147
- }
2148
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "social-preview threads-preview", children: [
2149
- !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section threads-preview__section", children: [
2150
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
2151
- level: headingLevel,
2152
- // translators: refers to a social post on Threads
2153
- children: _i18n.__.call(void 0, "Your post", "social-previews")
2154
- }),
2155
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0, "This is what your social post will look like on Threads:", "social-previews") }),
2156
- posts.map((post, index) => {
2157
- const isLast = index + 1 === posts.length;
2158
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2159
- ThreadsPostPreview,
2160
- {
2161
- ...post,
2162
- showThreadConnector: !isLast
2163
- },
2164
- `threads-preview__post-${index}`
2165
- );
2166
- })
2167
- ] }),
2168
- !hideLinkPreview ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section threads-preview__section", children: [
2169
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
2170
- level: headingLevel,
2171
- // translators: refers to a link to a Threads post
2172
- children: _i18n.__.call(void 0, "Link preview", "social-previews")
2173
- }),
2174
- posts[0].image ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2175
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
2176
- "This is what it will look like when someone shares the link to your WordPress post on Threads.",
2177
- "social-previews"
2178
- ) }),
2179
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadsLinkPreview, { ...posts[0], name: "", profileImage: "" })
2180
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
2181
- "Threads link preview requires an image to be set for the post. Please add an image to see the preview.",
2182
- "social-previews"
2183
- ) })
2184
- ] }) : null
2185
- ] });
2186
- };
2187
-
2188
- // src/instagram-preview/post-preview.tsx
2189
-
2190
-
2191
- // src/instagram-preview/constants.tsx
2192
- var FEED_TEXT_MAX_LENGTH3 = 2200;
2193
-
2194
- // src/instagram-preview/icons/bookmark.tsx
2195
-
2196
- var Bookmark = () => {
2197
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2198
- "svg",
2199
- {
2200
- color: "rgb(38, 38, 38)",
2201
- fill: "rgb(38, 38, 38)",
2202
- height: "24",
2203
- role: "img",
2204
- viewBox: "0 0 24 24",
2205
- width: "24",
2206
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2207
- "polygon",
2208
- {
2209
- fill: "none",
2210
- points: "20 21 12 13.44 4 21 4 3 20 3 20 21",
2211
- stroke: "currentColor",
2212
- strokeLinecap: "round",
2213
- strokeLinejoin: "round",
2214
- strokeWidth: "2"
2215
- }
2216
- )
2217
- }
2218
- );
2219
- };
2220
-
2221
- // src/instagram-preview/icons/comment.tsx
2222
-
2223
- var Comment = () => {
2224
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2225
- "svg",
2226
- {
2227
- color: "rgb(38, 38, 38)",
2228
- fill: "rgb(38, 38, 38)",
2229
- height: "24",
2230
- role: "img",
2231
- viewBox: "0 0 24 24",
2232
- width: "24",
2233
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2234
- "path",
2235
- {
2236
- d: "M20.656 17.008a9.993 9.993 0 1 0-3.59 3.615L22 22Z",
2237
- fill: "none",
2238
- stroke: "currentColor",
2239
- strokeLinejoin: "round",
2240
- strokeWidth: "2"
2241
- }
2242
- )
2243
- }
2244
- );
2245
- };
2246
-
2247
- // src/instagram-preview/icons/heart.tsx
2248
-
2249
- var Heart = () => {
2250
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2251
- "svg",
2252
- {
2253
- color: "rgb(38, 38, 38)",
2254
- fill: "rgb(38, 38, 38)",
2255
- height: "24",
2256
- role: "img",
2257
- viewBox: "0 0 24 24",
2258
- width: "24",
2259
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M16.792 3.904A4.989 4.989 0 0 1 21.5 9.122c0 3.072-2.652 4.959-5.197 7.222-2.512 2.243-3.865 3.469-4.303 3.752-.477-.309-2.143-1.823-4.303-3.752C5.141 14.072 2.5 12.167 2.5 9.122a4.989 4.989 0 0 1 4.708-5.218 4.21 4.21 0 0 1 3.675 1.941c.84 1.175.98 1.763 1.12 1.763s.278-.588 1.11-1.766a4.17 4.17 0 0 1 3.679-1.938m0-2a6.04 6.04 0 0 0-4.797 2.127 6.052 6.052 0 0 0-4.787-2.127A6.985 6.985 0 0 0 .5 9.122c0 3.61 2.55 5.827 5.015 7.97.283.246.569.494.853.747l1.027.918a44.998 44.998 0 0 0 3.518 3.018 2 2 0 0 0 2.174 0 45.263 45.263 0 0 0 3.626-3.115l.922-.824c.293-.26.59-.519.885-.774 2.334-2.025 4.98-4.32 4.98-7.94a6.985 6.985 0 0 0-6.708-7.218Z" })
2260
- }
2261
- );
2262
- };
2263
-
2264
- // src/instagram-preview/icons/menu.tsx
2265
-
2266
- var Menu = () => {
2267
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: "17", height: "5", viewBox: "0 0 17 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2268
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2269
- "path",
2270
- {
2271
- d: "M2.11865 3.5C2.67094 3.5 3.11865 3.05228 3.11865 2.5C3.11865 1.94772 2.67094 1.5 2.11865 1.5C1.56637 1.5 1.11865 1.94772 1.11865 2.5C1.11865 3.05228 1.56637 3.5 2.11865 3.5Z",
2272
- fill: "black",
2273
- stroke: "black",
2274
- strokeWidth: "2"
2275
- }
2276
- ),
2277
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2278
- "path",
2279
- {
2280
- d: "M8.55933 3.5C9.11161 3.5 9.55933 3.05228 9.55933 2.5C9.55933 1.94772 9.11161 1.5 8.55933 1.5C8.00704 1.5 7.55933 1.94772 7.55933 2.5C7.55933 3.05228 8.00704 3.5 8.55933 3.5Z",
2281
- fill: "black",
2282
- stroke: "black",
2283
- strokeWidth: "2"
2284
- }
2285
- ),
2286
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2287
- "path",
2288
- {
2289
- d: "M15 3.5C15.5523 3.5 16 3.05228 16 2.5C16 1.94772 15.5523 1.5 15 1.5C14.4477 1.5 14 1.94772 14 2.5C14 3.05228 14.4477 3.5 15 3.5Z",
2290
- fill: "black",
2291
- stroke: "black",
2292
- strokeWidth: "2"
2293
- }
2294
- )
2295
- ] });
2296
- };
2297
-
2298
- // src/instagram-preview/icons/share.tsx
2299
-
2300
- var Share = () => {
2301
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2302
- "svg",
2303
- {
2304
- color: "rgb(38, 38, 38)",
2305
- fill: "rgb(38, 38, 38)",
2306
- height: "24",
2307
- role: "img",
2308
- viewBox: "0 0 24 24",
2309
- width: "24",
2310
- children: [
2311
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2312
- "line",
2313
- {
2314
- fill: "none",
2315
- stroke: "currentColor",
2316
- strokeLinejoin: "round",
2317
- strokeWidth: "2",
2318
- x1: "22",
2319
- x2: "9.218",
2320
- y1: "3",
2321
- y2: "10.083"
2322
- }
2323
- ),
2324
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2325
- "polygon",
2326
- {
2327
- fill: "none",
2328
- points: "11.698 20.334 22 3.001 2 3.001 9.218 10.084 11.698 20.334",
2329
- stroke: "currentColor",
2330
- strokeLinejoin: "round",
2331
- strokeWidth: "2"
2332
- }
2333
- )
2334
- ]
2335
- }
2336
- );
2337
- };
2338
-
2339
- // src/instagram-preview/post-preview.tsx
2340
-
2341
- function InstagramPostPreview({
2342
- image,
2343
- media,
2344
- name,
2345
- profileImage,
2346
- caption,
2347
- url
2348
- }) {
2349
- const username = name || "username";
2350
- const mediaItem = _optionalChain([media, 'optionalAccess', _35 => _35[0]]);
2351
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__wrapper", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "instagram-preview__container", children: [
2352
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "instagram-preview__header", children: [
2353
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__header--avatar", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarWithFallback, { src: profileImage }) }),
2354
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "instagram-preview__header--profile", children: [
2355
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__header--profile-name", children: username }),
2356
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__header--profile-menu", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Menu, {}) })
2357
- ] })
2358
- ] }),
2359
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__media", children: mediaItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__media-item", children: mediaItem.type.startsWith("video/") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { controls: false, className: "instagram-preview__media--video", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { src: mediaItem.url, type: mediaItem.type }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "instagram-preview__media--image", src: mediaItem.url, alt: "" }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "instagram-preview__media--image", src: image, alt: "" }) }),
2360
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "instagram-preview__content", children: [
2361
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "instagram-preview__content--actions", children: [
2362
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "instagram-preview__content--actions-primary", children: [
2363
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Heart, {}),
2364
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Comment, {}),
2365
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Share, {})
2366
- ] }),
2367
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__content--actions-secondary", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Bookmark, {}) })
2368
- ] }),
2369
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "instagram-preview__content--body", children: [
2370
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__content--name", children: username }),
2371
- "\xA0",
2372
- caption ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "instagram-preview__content--text", children: [
2373
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandableText, { text: caption, children: (visibleText) => preparePreviewText(visibleText, {
2374
- platform: "instagram",
2375
- maxChars: FEED_TEXT_MAX_LENGTH3
2376
- }) }),
2377
- media && url && !caption.includes(url) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2378
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
2379
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
2380
- url
2381
- ] })
2382
- ] }) : null
2383
- ] }),
2384
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "instagram-preview__content--footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _i18n.__.call(void 0, "View one comment", "social-previews") }) })
2385
- ] })
2386
- ] }) });
2387
- }
2388
-
2389
- // src/instagram-preview/previews.tsx
2390
-
2391
-
2392
- var InstagramPreviews = ({
2393
- headingLevel,
2394
- hidePostPreview,
2395
- ...props
2396
- }) => {
2397
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "social-preview instagram-preview", children: !hidePostPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { className: "social-preview__section instagram-preview__section", children: [
2398
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, section_heading_default, {
2399
- level: headingLevel,
2400
- // translators: refers to a social post on Instagram
2401
- children: _i18n.__.call(void 0, "Your post", "social-previews")
2402
- }),
2403
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "social-preview__section-desc", children: _i18n.__.call(void 0,
2404
- "This is what your social post will look like on Instagram:",
2405
- "social-previews"
2406
- ) }),
2407
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InstagramPostPreview, { ...props })
2408
- ] }) });
2409
- };
2410
-
2411
-
2412
-
2413
-
2414
-
2415
-
2416
-
2417
-
2418
-
2419
-
2420
-
2421
-
2422
-
2423
-
2424
-
2425
-
2426
-
2427
-
2428
-
2429
-
2430
-
2431
-
2432
-
2433
-
2434
-
2435
-
2436
-
2437
-
2438
-
2439
-
2440
-
2441
-
2442
-
2443
-
2444
-
2445
- exports.AUTO_SHARED_LINK_PREVIEW = AUTO_SHARED_LINK_PREVIEW; exports.AUTO_SHARED_SOCIAL_POST_PREVIEW = AUTO_SHARED_SOCIAL_POST_PREVIEW; exports.BlueskyLinkPreview = BlueskyLinkPreview; exports.BlueskyPostPreview = BlueskyPostPreview; exports.BlueskyPreviews = BlueskyPreviews; exports.DEFAULT_LINK_PREVIEW = DEFAULT_LINK_PREVIEW; exports.FacebookLinkPreview = FacebookLinkPreview; exports.FacebookPostPreview = FacebookPostPreview; exports.FacebookPreviews = FacebookPreviews; exports.GoogleSearchPreview = GoogleSearchPreview; exports.InstagramPostPreview = InstagramPostPreview; exports.InstagramPreviews = InstagramPreviews; exports.LANDSCAPE_MODE = LANDSCAPE_MODE; exports.LinkedInLinkPreview = LinkedInLinkPreview; exports.LinkedInPostPreview = LinkedInPostPreview; exports.LinkedInPreviews = LinkedInPreviews; exports.MastodonLinkPreview = MastodonLinkPreview; exports.MastodonPostPreview = MastodonPostPreview; exports.MastodonPreviews = MastodonPreviews; exports.NextdoorLinkPreview = NextdoorLinkPreview; exports.NextdoorPostPreview = NextdoorPostPreview; exports.NextdoorPreviews = NextdoorPreviews; exports.PORTRAIT_MODE = PORTRAIT_MODE; exports.TYPE_ARTICLE = TYPE_ARTICLE; exports.TYPE_WEBSITE = TYPE_WEBSITE; exports.ThreadsLinkPreview = ThreadsLinkPreview; exports.ThreadsPostPreview = ThreadsPostPreview; exports.ThreadsPreviews = ThreadsPreviews; exports.TumblrLinkPreview = TumblrLinkPreview; exports.TumblrPostPreview = TumblrPostPreview; exports.TumblrPreviews = TumblrPreviews; exports.TwitterLinkPreview = TwitterLinkPreview; exports.TwitterPostPreview = TwitterPostPreview; exports.TwitterPreviews = TwitterPreviews;
2446
- //# sourceMappingURL=index.js.map