sanity-plugin-mux-input 2.4.1 → 2.5.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/README.md +57 -55
- package/dist/index.js +364 -460
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +367 -463
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -9
- package/src/components/EditThumbnailDialog.tsx +122 -0
- package/src/components/PlayerActionsMenu.tsx +13 -0
- package/src/components/Uploader.tsx +21 -15
- package/src/components/VideoPlayer.tsx +66 -49
- package/src/components/VideoThumbnail.tsx +15 -8
- package/src/context/DialogStateContext.tsx +36 -0
- package/src/util/createUrlParamsObject.ts +25 -0
- package/src/util/formatSeconds.ts +28 -1
- package/src/util/getAnimatedPosterSrc.ts +5 -13
- package/src/util/getPosterSrc.ts +10 -15
- package/src/util/getVideoMetadata.ts +1 -1
- package/src/util/types.ts +4 -0
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useClient as useClient$1, useDocumentStore, collate, useDocumentValues, createHookFromObservableFactory, truncateString, useFormattedDuration, SanityDefaultPreview, useTimeAgo, TextWithTone, isRecord, getPreviewStateObservable, getPreviewValueWithFallback, DocumentPreviewPresence, useDocumentPreviewStore, useSchema, useDocumentPresence, PreviewCard, isReference, useProjectId, useDataset, PatchEvent, unset, setIfMissing, set, LinearProgress, FormField as FormField$2, definePlugin } from "sanity";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ErrorOutlineIcon,
|
|
4
|
-
import { Card, Box, Spinner, Stack, Text, Checkbox, Button, Dialog, Flex, Heading, Code, MenuButton, Menu, MenuItem, Tooltip, Inline, useToast, TabList, Tab, TabPanel,
|
|
5
|
-
import React, { useState, useMemo, useEffect, useRef, useId, memo, isValidElement, useCallback, useReducer, PureComponent, createElement, forwardRef, Suspense } from "react";
|
|
3
|
+
import { ErrorOutlineIcon, RetryIcon, CheckmarkCircleIcon, RetrieveIcon, SortIcon, WarningOutlineIcon, EditIcon, PublishIcon, DocumentIcon, TrashIcon, RevertIcon, SearchIcon, ClockIcon, CropIcon, CalendarIcon, TagIcon, CheckmarkIcon, LockIcon, PlayIcon, PlugIcon, EllipsisHorizontalIcon, UploadIcon, ImageIcon, ResetIcon, TranslateIcon, DocumentVideoIcon } from "@sanity/icons";
|
|
4
|
+
import { Card, Box, Spinner, Stack, Text, Checkbox, Button, Dialog, Flex, Heading, Code, MenuButton, Menu, MenuItem, TextInput, Tooltip, Inline, useToast, TabList, Tab, TabPanel, Label as Label$1, Grid, useClickOutsideEvent, Popover, MenuDivider, Autocomplete, Radio, rem } from "@sanity/ui";
|
|
5
|
+
import React, { useState, useMemo, useEffect, useRef, useId, memo, createContext, useContext, isValidElement, useCallback, useReducer, PureComponent, createElement, forwardRef, Suspense } from "react";
|
|
6
6
|
import { useObservable } from "react-rx";
|
|
7
7
|
import compact from "lodash/compact.js";
|
|
8
8
|
import toLower from "lodash/toLower.js";
|
|
@@ -40,14 +40,6 @@ const ToolIcon = () => /* @__PURE__ */ jsx(
|
|
|
40
40
|
function useClient() {
|
|
41
41
|
return useClient$1({ apiVersion: SANITY_API_VERSION });
|
|
42
42
|
}
|
|
43
|
-
var __defProp$j = Object.defineProperty, __getOwnPropSymbols$j = Object.getOwnPropertySymbols, __hasOwnProp$j = Object.prototype.hasOwnProperty, __propIsEnum$j = Object.prototype.propertyIsEnumerable, __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$j = (a2, b) => {
|
|
44
|
-
for (var prop in b || (b = {}))
|
|
45
|
-
__hasOwnProp$j.call(b, prop) && __defNormalProp$j(a2, prop, b[prop]);
|
|
46
|
-
if (__getOwnPropSymbols$j)
|
|
47
|
-
for (var prop of __getOwnPropSymbols$j(b))
|
|
48
|
-
__propIsEnum$j.call(b, prop) && __defNormalProp$j(a2, prop, b[prop]);
|
|
49
|
-
return a2;
|
|
50
|
-
};
|
|
51
43
|
const SPECIAL_CHARS = /([^!@#$%^&*(),\\/?";:{}|[\]+<>\s-])+/g, STRIP_EDGE_CHARS = /(^[.]+)|([.]+$)/;
|
|
52
44
|
function tokenize(string) {
|
|
53
45
|
return (string.match(SPECIAL_CHARS) || []).map((token) => token.replace(STRIP_EDGE_CHARS, ""));
|
|
@@ -69,17 +61,11 @@ function createSearchFilter(query) {
|
|
|
69
61
|
return {
|
|
70
62
|
filter: createConstraints(terms, query.length >= 8),
|
|
71
63
|
// if the search is big enough, include the assetId (mux id) in the results
|
|
72
|
-
params:
|
|
64
|
+
params: {
|
|
65
|
+
...toGroqParams(terms)
|
|
66
|
+
}
|
|
73
67
|
};
|
|
74
68
|
}
|
|
75
|
-
var __defProp$i = Object.defineProperty, __defProps$c = Object.defineProperties, __getOwnPropDescs$c = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$i = Object.getOwnPropertySymbols, __hasOwnProp$i = Object.prototype.hasOwnProperty, __propIsEnum$i = Object.prototype.propertyIsEnumerable, __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$i = (a2, b) => {
|
|
76
|
-
for (var prop in b || (b = {}))
|
|
77
|
-
__hasOwnProp$i.call(b, prop) && __defNormalProp$i(a2, prop, b[prop]);
|
|
78
|
-
if (__getOwnPropSymbols$i)
|
|
79
|
-
for (var prop of __getOwnPropSymbols$i(b))
|
|
80
|
-
__propIsEnum$i.call(b, prop) && __defNormalProp$i(a2, prop, b[prop]);
|
|
81
|
-
return a2;
|
|
82
|
-
}, __spreadProps$c = (a2, b) => __defProps$c(a2, __getOwnPropDescs$c(b));
|
|
83
69
|
const ASSET_SORT_OPTIONS = {
|
|
84
70
|
createdDesc: { groq: "_createdAt desc", label: "Newest first" },
|
|
85
71
|
createdAsc: { groq: "_createdAt asc", label: "First created (oldest)" },
|
|
@@ -109,8 +95,9 @@ function useAssets() {
|
|
|
109
95
|
assets: useMemo(
|
|
110
96
|
() => (
|
|
111
97
|
// Avoid displaying both drafts & published assets by collating them together and giving preference to drafts
|
|
112
|
-
collate(assetDocumentsObservable
|
|
113
|
-
(collated) =>
|
|
98
|
+
collate(assetDocumentsObservable ?? []).map(
|
|
99
|
+
(collated) => ({
|
|
100
|
+
...collated.draft || collated.published || {},
|
|
114
101
|
_id: collated.id
|
|
115
102
|
})
|
|
116
103
|
)
|
|
@@ -127,14 +114,6 @@ function useAssets() {
|
|
|
127
114
|
function parseMuxDate(date) {
|
|
128
115
|
return new Date(Number(date) * 1e3);
|
|
129
116
|
}
|
|
130
|
-
var __defProp$h = Object.defineProperty, __defProps$b = Object.defineProperties, __getOwnPropDescs$b = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$h = Object.getOwnPropertySymbols, __hasOwnProp$h = Object.prototype.hasOwnProperty, __propIsEnum$h = Object.prototype.propertyIsEnumerable, __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$h = (a2, b) => {
|
|
131
|
-
for (var prop in b || (b = {}))
|
|
132
|
-
__hasOwnProp$h.call(b, prop) && __defNormalProp$h(a2, prop, b[prop]);
|
|
133
|
-
if (__getOwnPropSymbols$h)
|
|
134
|
-
for (var prop of __getOwnPropSymbols$h(b))
|
|
135
|
-
__propIsEnum$h.call(b, prop) && __defNormalProp$h(a2, prop, b[prop]);
|
|
136
|
-
return a2;
|
|
137
|
-
}, __spreadProps$b = (a2, b) => __defProps$b(a2, __getOwnPropDescs$b(b));
|
|
138
117
|
const FIRST_PAGE = 1, ASSETS_PER_PAGE = 100;
|
|
139
118
|
async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
|
|
140
119
|
try {
|
|
@@ -156,7 +135,7 @@ async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
|
|
|
156
135
|
pageNum,
|
|
157
136
|
data: json.data
|
|
158
137
|
};
|
|
159
|
-
} catch
|
|
138
|
+
} catch {
|
|
160
139
|
return {
|
|
161
140
|
pageNum,
|
|
162
141
|
error: { _tag: "FetchError" }
|
|
@@ -165,7 +144,8 @@ async function fetchMuxAssetsPage({ secretKey, token }, pageNum) {
|
|
|
165
144
|
}
|
|
166
145
|
function accumulateIntermediateState(currentState, pageResult) {
|
|
167
146
|
const currentData = "data" in currentState && currentState.data || [];
|
|
168
|
-
return
|
|
147
|
+
return {
|
|
148
|
+
...currentState,
|
|
169
149
|
data: [
|
|
170
150
|
...currentData,
|
|
171
151
|
...("data" in pageResult && pageResult.data || []).filter(
|
|
@@ -179,7 +159,7 @@ function accumulateIntermediateState(currentState, pageResult) {
|
|
|
179
159
|
),
|
|
180
160
|
pageNum: pageResult.pageNum,
|
|
181
161
|
loading: !0
|
|
182
|
-
}
|
|
162
|
+
};
|
|
183
163
|
}
|
|
184
164
|
function hasMorePages(pageResult) {
|
|
185
165
|
return typeof pageResult == "object" && "data" in pageResult && Array.isArray(pageResult.data) && pageResult.data.length > 0;
|
|
@@ -207,7 +187,8 @@ function useMuxAssets({ secrets, enabled }) {
|
|
|
207
187
|
).subscribe({
|
|
208
188
|
// Once done, let the user know we've stopped loading
|
|
209
189
|
complete: () => {
|
|
210
|
-
setState((prev) =>
|
|
190
|
+
setState((prev) => ({
|
|
191
|
+
...prev,
|
|
211
192
|
loading: !1
|
|
212
193
|
}));
|
|
213
194
|
}
|
|
@@ -221,25 +202,24 @@ const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumen
|
|
|
221
202
|
path$1
|
|
222
203
|
), cache = useMemo(() => {
|
|
223
204
|
const exists = !!value, secrets = {
|
|
224
|
-
token:
|
|
225
|
-
secretKey:
|
|
226
|
-
enableSignedUrls:
|
|
227
|
-
signingKeyId:
|
|
228
|
-
signingKeyPrivate:
|
|
205
|
+
token: value?.token || null,
|
|
206
|
+
secretKey: value?.secretKey || null,
|
|
207
|
+
enableSignedUrls: value?.enableSignedUrls || !1,
|
|
208
|
+
signingKeyId: value?.signingKeyId || null,
|
|
209
|
+
signingKeyPrivate: value?.signingKeyPrivate || null
|
|
229
210
|
};
|
|
230
211
|
return {
|
|
231
212
|
isInitialSetup: !exists,
|
|
232
|
-
needsSetup: !
|
|
213
|
+
needsSetup: !secrets?.token || !secrets?.secretKey,
|
|
233
214
|
secrets
|
|
234
215
|
};
|
|
235
216
|
}, [value]);
|
|
236
217
|
return { error, isLoading, value: cache };
|
|
237
218
|
};
|
|
238
219
|
function useImportMuxAssets() {
|
|
239
|
-
var _a;
|
|
240
220
|
const documentStore = useDocumentStore(), client = useClient$1({
|
|
241
221
|
apiVersion: SANITY_API_VERSION
|
|
242
|
-
}), [assetsInSanity, assetsInSanityLoading] = useAssetsInSanity(documentStore), secretDocumentValues = useSecretsDocumentValues(), hasSecrets = !!
|
|
222
|
+
}), [assetsInSanity, assetsInSanityLoading] = useAssetsInSanity(documentStore), secretDocumentValues = useSecretsDocumentValues(), hasSecrets = !!secretDocumentValues.value.secrets?.secretKey, [importError, setImportError] = useState(), [importState, setImportState] = useState("closed"), dialogOpen = importState !== "closed", muxAssets = useMuxAssets({
|
|
243
223
|
secrets: secretDocumentValues.value.secrets,
|
|
244
224
|
enabled: hasSecrets && dialogOpen
|
|
245
225
|
}), missingAssets = useMemo(() => assetsInSanity && muxAssets.data ? muxAssets.data.filter((a2) => !assetExistsInSanity(a2, assetsInSanity)) : void 0, [assetsInSanity, muxAssets.data]), [selectedAssets, setSelectedAssets] = useState([]), closeDialog = () => {
|
|
@@ -273,8 +253,7 @@ function useImportMuxAssets() {
|
|
|
273
253
|
};
|
|
274
254
|
}
|
|
275
255
|
function muxAssetToSanityDocument(asset) {
|
|
276
|
-
|
|
277
|
-
const playbackId = (_a = (asset.playback_ids || []).find((p) => p.id)) == null ? void 0 : _a.id;
|
|
256
|
+
const playbackId = (asset.playback_ids || []).find((p) => p.id)?.id;
|
|
278
257
|
if (playbackId)
|
|
279
258
|
return {
|
|
280
259
|
_id: uuid(),
|
|
@@ -311,9 +290,8 @@ function useInView(options = {}) {
|
|
|
311
290
|
return useEffect(() => {
|
|
312
291
|
if (!ref.current) return;
|
|
313
292
|
const observer = new IntersectionObserver(([entry], obs) => {
|
|
314
|
-
var _a;
|
|
315
293
|
const nowInView = entry.isIntersecting && obs.thresholds.some((threshold) => entry.intersectionRatio >= threshold);
|
|
316
|
-
setInView(nowInView),
|
|
294
|
+
setInView(nowInView), options?.onChange?.(nowInView);
|
|
317
295
|
}, options), toObserve = ref.current;
|
|
318
296
|
return observer.observe(toObserve), () => {
|
|
319
297
|
toObserve && observer.unobserve(toObserve);
|
|
@@ -336,11 +314,11 @@ function readSecrets(client) {
|
|
|
336
314
|
{ _id }
|
|
337
315
|
);
|
|
338
316
|
return {
|
|
339
|
-
token:
|
|
340
|
-
secretKey:
|
|
341
|
-
enableSignedUrls: !!
|
|
342
|
-
signingKeyId:
|
|
343
|
-
signingKeyPrivate:
|
|
317
|
+
token: data?.token || null,
|
|
318
|
+
secretKey: data?.secretKey || null,
|
|
319
|
+
enableSignedUrls: !!data?.enableSignedUrls || !1,
|
|
320
|
+
signingKeyId: data?.signingKeyId || null,
|
|
321
|
+
signingKeyPrivate: data?.signingKeyPrivate || null
|
|
344
322
|
};
|
|
345
323
|
}, [cacheNs, _id, projectId, dataset]);
|
|
346
324
|
}
|
|
@@ -352,7 +330,7 @@ function generateJwt(client, playbackId, aud, payload) {
|
|
|
352
330
|
throw new TypeError("Missing `signingKeyPrivate`.\n Check your plugin's configuration");
|
|
353
331
|
const { default: sign } = suspend(() => import("jsonwebtoken-esm/sign"), ["jsonwebtoken-esm/sign"]);
|
|
354
332
|
return sign(
|
|
355
|
-
payload ? JSON.parse(JSON.stringify(payload, (_, v) => v
|
|
333
|
+
payload ? JSON.parse(JSON.stringify(payload, (_, v) => v ?? void 0)) : {},
|
|
356
334
|
atob(signingKeyPrivate),
|
|
357
335
|
{
|
|
358
336
|
algorithm: "RS256",
|
|
@@ -365,13 +343,23 @@ function generateJwt(client, playbackId, aud, payload) {
|
|
|
365
343
|
);
|
|
366
344
|
}
|
|
367
345
|
function getPlaybackId(asset) {
|
|
368
|
-
if (!
|
|
346
|
+
if (!asset?.playbackId)
|
|
369
347
|
throw console.error("Asset is missing a playbackId", { asset }), new TypeError("Missing playbackId");
|
|
370
348
|
return asset.playbackId;
|
|
371
349
|
}
|
|
372
350
|
function getPlaybackPolicy(asset) {
|
|
373
|
-
|
|
374
|
-
|
|
351
|
+
return asset.data?.playback_ids?.find((playbackId) => asset.playbackId === playbackId.id)?.policy ?? "public";
|
|
352
|
+
}
|
|
353
|
+
function createUrlParamsObject(client, asset, params, audience) {
|
|
354
|
+
const playbackId = getPlaybackId(asset);
|
|
355
|
+
let searchParams = new URLSearchParams(
|
|
356
|
+
JSON.parse(JSON.stringify(params, (_, v) => v ?? void 0))
|
|
357
|
+
);
|
|
358
|
+
if (getPlaybackPolicy(asset) === "signed") {
|
|
359
|
+
const token = generateJwt(client, playbackId, audience, params);
|
|
360
|
+
searchParams = new URLSearchParams({ token });
|
|
361
|
+
}
|
|
362
|
+
return { playbackId, searchParams };
|
|
375
363
|
}
|
|
376
364
|
function getAnimatedPosterSrc({
|
|
377
365
|
asset,
|
|
@@ -382,16 +370,22 @@ function getAnimatedPosterSrc({
|
|
|
382
370
|
end = start + 5,
|
|
383
371
|
fps = 15
|
|
384
372
|
}) {
|
|
385
|
-
const params = { height, width, start, end, fps }, playbackId =
|
|
386
|
-
let searchParams = new URLSearchParams(
|
|
387
|
-
JSON.parse(JSON.stringify(params, (_, v) => v != null ? v : void 0))
|
|
388
|
-
);
|
|
389
|
-
if (getPlaybackPolicy(asset) === "signed") {
|
|
390
|
-
const token = generateJwt(client, playbackId, "g", params);
|
|
391
|
-
searchParams = new URLSearchParams({ token });
|
|
392
|
-
}
|
|
373
|
+
const params = { height, width, start, end, fps }, { playbackId, searchParams } = createUrlParamsObject(client, asset, params, "g");
|
|
393
374
|
return `https://image.mux.com/${playbackId}/animated.gif?${searchParams}`;
|
|
394
375
|
}
|
|
376
|
+
function getPosterSrc({
|
|
377
|
+
asset,
|
|
378
|
+
client,
|
|
379
|
+
fit_mode,
|
|
380
|
+
height,
|
|
381
|
+
time = asset.thumbTime ?? void 0,
|
|
382
|
+
width
|
|
383
|
+
}) {
|
|
384
|
+
const params = { fit_mode, height, width };
|
|
385
|
+
time && (params.time = time);
|
|
386
|
+
const { playbackId, searchParams } = createUrlParamsObject(client, asset, params, "t");
|
|
387
|
+
return `https://image.mux.com/${playbackId}/thumbnail.png?${searchParams}`;
|
|
388
|
+
}
|
|
395
389
|
const Image = styled.img`
|
|
396
390
|
transition: opacity 0.175s ease-out 0s;
|
|
397
391
|
display: block;
|
|
@@ -406,16 +400,18 @@ const Image = styled.img`
|
|
|
406
400
|
};
|
|
407
401
|
function VideoThumbnail({
|
|
408
402
|
asset,
|
|
409
|
-
width
|
|
403
|
+
width,
|
|
404
|
+
staticImage = !1
|
|
410
405
|
}) {
|
|
411
|
-
const { inView, ref } = useInView(), posterWidth = width || 250, [status, setStatus] = useState("loading"), client = useClient(),
|
|
406
|
+
const { inView, ref } = useInView(), posterWidth = width || 250, [status, setStatus] = useState("loading"), client = useClient(), src = useMemo(() => {
|
|
412
407
|
try {
|
|
413
|
-
|
|
414
|
-
|
|
408
|
+
let thumbnail;
|
|
409
|
+
return staticImage ? thumbnail = getPosterSrc({ asset, client, width: posterWidth }) : thumbnail = getAnimatedPosterSrc({ asset, client, width: posterWidth }), thumbnail;
|
|
410
|
+
} catch {
|
|
415
411
|
status !== "error" && setStatus("error");
|
|
416
412
|
return;
|
|
417
413
|
}
|
|
418
|
-
}, [asset, client, posterWidth, status]);
|
|
414
|
+
}, [asset, client, posterWidth, status, staticImage]);
|
|
419
415
|
function handleLoad() {
|
|
420
416
|
setStatus("loaded");
|
|
421
417
|
}
|
|
@@ -470,8 +466,8 @@ function VideoThumbnail({
|
|
|
470
466
|
/* @__PURE__ */ jsx(
|
|
471
467
|
Image,
|
|
472
468
|
{
|
|
473
|
-
src
|
|
474
|
-
alt: `Preview for video ${asset.filename || asset.assetId}`,
|
|
469
|
+
src,
|
|
470
|
+
alt: `Preview for ${staticImage ? "image" : "video"} ${asset.filename || asset.assetId}`,
|
|
475
471
|
onLoad: handleLoad,
|
|
476
472
|
onError: handleError,
|
|
477
473
|
style: {
|
|
@@ -483,14 +479,6 @@ function VideoThumbnail({
|
|
|
483
479
|
}
|
|
484
480
|
);
|
|
485
481
|
}
|
|
486
|
-
var __defProp$g = Object.defineProperty, __getOwnPropSymbols$g = Object.getOwnPropertySymbols, __hasOwnProp$g = Object.prototype.hasOwnProperty, __propIsEnum$g = Object.prototype.propertyIsEnumerable, __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$g = (a2, b) => {
|
|
487
|
-
for (var prop in b || (b = {}))
|
|
488
|
-
__hasOwnProp$g.call(b, prop) && __defNormalProp$g(a2, prop, b[prop]);
|
|
489
|
-
if (__getOwnPropSymbols$g)
|
|
490
|
-
for (var prop of __getOwnPropSymbols$g(b))
|
|
491
|
-
__propIsEnum$g.call(b, prop) && __defNormalProp$g(a2, prop, b[prop]);
|
|
492
|
-
return a2;
|
|
493
|
-
};
|
|
494
482
|
const MissingAssetCheckbox = styled(Checkbox)`
|
|
495
483
|
position: static !important;
|
|
496
484
|
|
|
@@ -508,7 +496,6 @@ function MissingAsset({
|
|
|
508
496
|
selectAsset,
|
|
509
497
|
selected
|
|
510
498
|
}) {
|
|
511
|
-
var _a;
|
|
512
499
|
const duration = useFormattedDuration(asset.duration * 1e3);
|
|
513
500
|
return /* @__PURE__ */ jsx(
|
|
514
501
|
Card,
|
|
@@ -537,7 +524,7 @@ function MissingAsset({
|
|
|
537
524
|
assetId: asset.id,
|
|
538
525
|
data: asset,
|
|
539
526
|
filename: asset.id,
|
|
540
|
-
playbackId:
|
|
527
|
+
playbackId: asset.playback_ids.find((p) => p.id)?.id
|
|
541
528
|
},
|
|
542
529
|
width: 150
|
|
543
530
|
}
|
|
@@ -568,8 +555,7 @@ function MissingAsset({
|
|
|
568
555
|
);
|
|
569
556
|
}
|
|
570
557
|
function ImportVideosDialog(props) {
|
|
571
|
-
|
|
572
|
-
const { importState } = props, canTriggerImport = (importState === "idle" || importState === "error") && props.selectedAssets.length > 0, isImporting = importState === "importing", noAssetsToImport = ((_a = props.missingAssets) == null ? void 0 : _a.length) === 0 && !props.muxAssets.loading && !props.assetsInSanityLoading;
|
|
558
|
+
const { importState } = props, canTriggerImport = (importState === "idle" || importState === "error") && props.selectedAssets.length > 0, isImporting = importState === "importing", noAssetsToImport = props.missingAssets?.length === 0 && !props.muxAssets.loading && !props.assetsInSanityLoading;
|
|
573
559
|
return /* @__PURE__ */ jsx(
|
|
574
560
|
Dialog,
|
|
575
561
|
{
|
|
@@ -601,7 +587,7 @@ function ImportVideosDialog(props) {
|
|
|
601
587
|
fontSize: 2,
|
|
602
588
|
padding: 3,
|
|
603
589
|
mode: "ghost",
|
|
604
|
-
text:
|
|
590
|
+
text: props.selectedAssets?.length > 0 ? `Import ${props.selectedAssets.length} video(s)` : "No video(s) selected",
|
|
605
591
|
tone: "positive",
|
|
606
592
|
onClick: props.importAssets,
|
|
607
593
|
iconRight: isImporting && Spinner,
|
|
@@ -701,7 +687,7 @@ function ImportVideosDialog(props) {
|
|
|
701
687
|
function ImportVideosFromMux() {
|
|
702
688
|
const importAssets = useImportMuxAssets();
|
|
703
689
|
if (importAssets.hasSecrets)
|
|
704
|
-
return importAssets.dialogOpen ? /* @__PURE__ */ jsx(ImportVideosDialog,
|
|
690
|
+
return importAssets.dialogOpen ? /* @__PURE__ */ jsx(ImportVideosDialog, { ...importAssets }) : /* @__PURE__ */ jsx(Button, { mode: "bleed", text: "Import from Mux", onClick: importAssets.openDialog });
|
|
705
691
|
}
|
|
706
692
|
const CONTEXT_MENU_POPOVER_PROPS = {
|
|
707
693
|
constrainSize: !0,
|
|
@@ -762,40 +748,24 @@ const IconInfo = (props) => {
|
|
|
762
748
|
/* @__PURE__ */ jsx(Text, { size: props.size || 1, muted: props.muted, children: props.text })
|
|
763
749
|
] });
|
|
764
750
|
};
|
|
765
|
-
var __defProp$f = Object.defineProperty, __defProps$a = Object.defineProperties, __getOwnPropDescs$a = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$f = Object.getOwnPropertySymbols, __hasOwnProp$f = Object.prototype.hasOwnProperty, __propIsEnum$f = Object.prototype.propertyIsEnumerable, __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$f = (a2, b) => {
|
|
766
|
-
for (var prop in b || (b = {}))
|
|
767
|
-
__hasOwnProp$f.call(b, prop) && __defNormalProp$f(a2, prop, b[prop]);
|
|
768
|
-
if (__getOwnPropSymbols$f)
|
|
769
|
-
for (var prop of __getOwnPropSymbols$f(b))
|
|
770
|
-
__propIsEnum$f.call(b, prop) && __defNormalProp$f(a2, prop, b[prop]);
|
|
771
|
-
return a2;
|
|
772
|
-
}, __spreadProps$a = (a2, b) => __defProps$a(a2, __getOwnPropDescs$a(b));
|
|
773
751
|
function ResolutionIcon(props) {
|
|
774
|
-
return /* @__PURE__ */ jsx("svg",
|
|
752
|
+
return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsx(
|
|
775
753
|
"path",
|
|
776
754
|
{
|
|
777
755
|
fill: "currentColor",
|
|
778
756
|
d: "M20 9V6h-3V4h5v5h-2ZM2 9V4h5v2H4v3H2Zm15 11v-2h3v-3h2v5h-5ZM2 20v-5h2v3h3v2H2Zm4-4V8h12v8H6Zm2-2h8v-4H8v4Zm0 0v-4v4Z"
|
|
779
757
|
}
|
|
780
|
-
) })
|
|
758
|
+
) });
|
|
781
759
|
}
|
|
782
|
-
var __defProp$e = Object.defineProperty, __defProps$9 = Object.defineProperties, __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$e = Object.getOwnPropertySymbols, __hasOwnProp$e = Object.prototype.hasOwnProperty, __propIsEnum$e = Object.prototype.propertyIsEnumerable, __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$e = (a2, b) => {
|
|
783
|
-
for (var prop in b || (b = {}))
|
|
784
|
-
__hasOwnProp$e.call(b, prop) && __defNormalProp$e(a2, prop, b[prop]);
|
|
785
|
-
if (__getOwnPropSymbols$e)
|
|
786
|
-
for (var prop of __getOwnPropSymbols$e(b))
|
|
787
|
-
__propIsEnum$e.call(b, prop) && __defNormalProp$e(a2, prop, b[prop]);
|
|
788
|
-
return a2;
|
|
789
|
-
}, __spreadProps$9 = (a2, b) => __defProps$9(a2, __getOwnPropDescs$9(b));
|
|
790
760
|
function StopWatchIcon(props) {
|
|
791
761
|
return /* @__PURE__ */ jsxs(
|
|
792
762
|
"svg",
|
|
793
|
-
|
|
763
|
+
{
|
|
794
764
|
xmlns: "http://www.w3.org/2000/svg",
|
|
795
765
|
width: "1em",
|
|
796
766
|
height: "1em",
|
|
797
|
-
viewBox: "0 0 512 512"
|
|
798
|
-
|
|
767
|
+
viewBox: "0 0 512 512",
|
|
768
|
+
...props,
|
|
799
769
|
children: [
|
|
800
770
|
/* @__PURE__ */ jsx("path", { d: "M232 306.667h48V176h-48v130.667z", fill: "currentColor" }),
|
|
801
771
|
/* @__PURE__ */ jsx(
|
|
@@ -807,9 +777,17 @@ function StopWatchIcon(props) {
|
|
|
807
777
|
),
|
|
808
778
|
/* @__PURE__ */ jsx("path", { d: "M192 32h128v48H192z", fill: "currentColor" })
|
|
809
779
|
]
|
|
810
|
-
}
|
|
780
|
+
}
|
|
811
781
|
);
|
|
812
782
|
}
|
|
783
|
+
const DialogStateContext = createContext({
|
|
784
|
+
dialogState: !1,
|
|
785
|
+
setDialogState: () => null
|
|
786
|
+
}), DialogStateProvider = ({
|
|
787
|
+
dialogState,
|
|
788
|
+
setDialogState,
|
|
789
|
+
children
|
|
790
|
+
}) => /* @__PURE__ */ jsx(DialogStateContext.Provider, { value: { dialogState, setDialogState }, children }), useDialogStateContext = () => useContext(DialogStateContext);
|
|
813
791
|
function getVideoSrc({ asset, client }) {
|
|
814
792
|
const playbackId = getPlaybackId(asset), searchParams = new URLSearchParams();
|
|
815
793
|
if (getPlaybackPolicy(asset) === "signed") {
|
|
@@ -818,33 +796,102 @@ function getVideoSrc({ asset, client }) {
|
|
|
818
796
|
}
|
|
819
797
|
return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
|
|
820
798
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
return
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
799
|
+
function getDevicePixelRatio(options) {
|
|
800
|
+
const {
|
|
801
|
+
defaultDpr = 1,
|
|
802
|
+
maxDpr = 3,
|
|
803
|
+
round = !0
|
|
804
|
+
} = options || {}, dpr = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : defaultDpr;
|
|
805
|
+
return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
|
|
806
|
+
}
|
|
807
|
+
function formatSeconds(seconds) {
|
|
808
|
+
if (typeof seconds != "number" || Number.isNaN(seconds))
|
|
809
|
+
return "";
|
|
810
|
+
const hrs = ~~(seconds / 3600), mins = ~~(seconds % 3600 / 60), secs = ~~seconds % 60;
|
|
811
|
+
let ret = "";
|
|
812
|
+
return hrs > 0 && (ret += "" + hrs + ":" + (mins < 10 ? "0" : "")), ret += "" + mins + ":" + (secs < 10 ? "0" : ""), ret += "" + secs, ret;
|
|
813
|
+
}
|
|
814
|
+
function formatSecondsToHHMMSS(seconds) {
|
|
815
|
+
const hrs = Math.floor(seconds / 3600).toString().padStart(2, "0"), mins = Math.floor(seconds % 3600 / 60).toString().padStart(2, "0"), secs = Math.floor(seconds % 60).toString().padStart(2, "0");
|
|
816
|
+
return `${hrs}:${mins}:${secs}`;
|
|
817
|
+
}
|
|
818
|
+
function isValidTimeFormat(time) {
|
|
819
|
+
return /^([0-1]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])$/.test(time) || time === "";
|
|
820
|
+
}
|
|
821
|
+
function getSecondsFromTimeFormat(time) {
|
|
822
|
+
const [hh = 0, mm = 0, ss = 0] = time.split(":").map(Number);
|
|
823
|
+
return hh * 3600 + mm * 60 + ss;
|
|
824
|
+
}
|
|
825
|
+
function EditThumbnailDialog({ asset, currentTime = 0 }) {
|
|
826
|
+
const client = useClient(), { setDialogState } = useDialogStateContext(), dialogId = `EditThumbnailDialog${useId()}`, [timeFormatted, setTimeFormatted] = useState(
|
|
827
|
+
() => formatSecondsToHHMMSS(currentTime)
|
|
828
|
+
), [nextTime, setNextTime] = useState(currentTime), [inputError, setInputError] = useState(""), assetWithNewThumbnail = useMemo(() => ({ ...asset, thumbTime: nextTime }), [asset, nextTime]), [saving, setSaving] = useState(!1), [saveThumbnailError, setSaveThumbnailError] = useState(null), handleSave = () => {
|
|
829
|
+
setSaving(!0), client.patch(asset._id).set({ thumbTime: nextTime }).commit({ returnDocuments: !1 }).then(() => void setDialogState(!1)).catch(setSaveThumbnailError).finally(() => void setSaving(!1));
|
|
830
|
+
}, width = 300 * getDevicePixelRatio({ maxDpr: 2 });
|
|
831
|
+
if (saveThumbnailError)
|
|
832
|
+
throw saveThumbnailError;
|
|
833
|
+
return /* @__PURE__ */ jsx(
|
|
834
|
+
Dialog,
|
|
835
|
+
{
|
|
836
|
+
id: dialogId,
|
|
837
|
+
header: "Edit thumbnail",
|
|
838
|
+
onClose: () => setDialogState(!1),
|
|
839
|
+
footer: /* @__PURE__ */ jsx(Stack, { padding: 3, children: /* @__PURE__ */ jsx(
|
|
840
|
+
Button,
|
|
841
|
+
{
|
|
842
|
+
disabled: inputError !== "",
|
|
843
|
+
mode: "ghost",
|
|
844
|
+
tone: "primary",
|
|
845
|
+
loading: saving,
|
|
846
|
+
onClick: handleSave,
|
|
847
|
+
text: "Set new thumbnail"
|
|
848
|
+
},
|
|
849
|
+
"thumbnail"
|
|
850
|
+
) }),
|
|
851
|
+
children: /* @__PURE__ */ jsxs(Stack, { space: 3, padding: 3, children: [
|
|
852
|
+
/* @__PURE__ */ jsxs(Stack, { space: 2, children: [
|
|
853
|
+
/* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: "Current:" }),
|
|
854
|
+
/* @__PURE__ */ jsx(VideoThumbnail, { asset, width, staticImage: !0 })
|
|
855
|
+
] }),
|
|
856
|
+
/* @__PURE__ */ jsxs(Stack, { space: 2, children: [
|
|
857
|
+
/* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: "New:" }),
|
|
858
|
+
/* @__PURE__ */ jsx(VideoThumbnail, { asset: assetWithNewThumbnail, width, staticImage: !0 })
|
|
859
|
+
] }),
|
|
860
|
+
/* @__PURE__ */ jsx(Stack, { space: 2, children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: /* @__PURE__ */ jsx(Text, { size: 5, weight: "semibold", children: "Or" }) }) }),
|
|
861
|
+
/* @__PURE__ */ jsxs(Stack, { space: 2, children: [
|
|
862
|
+
/* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: "Selected time for thumbnail (hh:mm:ss):" }),
|
|
863
|
+
/* @__PURE__ */ jsx(
|
|
864
|
+
TextInput,
|
|
865
|
+
{
|
|
866
|
+
size: 1,
|
|
867
|
+
value: timeFormatted,
|
|
868
|
+
placeholder: "hh:mm:ss",
|
|
869
|
+
onChange: (event) => {
|
|
870
|
+
const value = event.currentTarget.value;
|
|
871
|
+
if (setTimeFormatted(value), isValidTimeFormat(value)) {
|
|
872
|
+
setInputError("");
|
|
873
|
+
const totalSeconds = getSecondsFromTimeFormat(value);
|
|
874
|
+
setNextTime(totalSeconds);
|
|
875
|
+
} else
|
|
876
|
+
setInputError("Invalid time format");
|
|
877
|
+
},
|
|
878
|
+
customValidity: inputError
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
] })
|
|
882
|
+
] })
|
|
883
|
+
}
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
function VideoPlayer({
|
|
887
|
+
asset,
|
|
888
|
+
thumbnailWidth = 250,
|
|
889
|
+
children,
|
|
890
|
+
...props
|
|
891
|
+
}) {
|
|
892
|
+
const client = useClient(), { dialogState } = useDialogStateContext(), isAudio = assetIsAudio(asset), muxPlayer = useRef(null), thumbnail = getPosterSrc({ asset, client, width: thumbnailWidth }), { src: videoSrc, error } = useMemo(() => {
|
|
846
893
|
try {
|
|
847
|
-
const src =
|
|
894
|
+
const src = asset?.playbackId && getVideoSrc({ client, asset });
|
|
848
895
|
return src ? { src } : { error: new TypeError("Asset has no playback ID") };
|
|
849
896
|
} catch (error2) {
|
|
850
897
|
return { error: error2 };
|
|
@@ -852,61 +899,66 @@ function VideoPlayer(_a) {
|
|
|
852
899
|
}, [asset, client]), signedToken = useMemo(() => {
|
|
853
900
|
try {
|
|
854
901
|
return new URL(videoSrc).searchParams.get("token");
|
|
855
|
-
} catch
|
|
902
|
+
} catch {
|
|
856
903
|
return !1;
|
|
857
904
|
}
|
|
858
|
-
}, [videoSrc]), [width, height] = (
|
|
905
|
+
}, [videoSrc]), [width, height] = (asset?.data?.aspect_ratio ?? "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height);
|
|
859
906
|
let aspectRatio = Math.max(MIN_ASPECT_RATIO, targetAspectRatio);
|
|
860
907
|
return isAudio && (aspectRatio = props.forceAspectRatio ? (
|
|
861
908
|
// Make it wider when forcing aspect ratio to balance with videos' rendering height (audio players overflow a bit)
|
|
862
909
|
props.forceAspectRatio * 1.2
|
|
863
|
-
) : AUDIO_ASPECT_RATIO), /* @__PURE__ */ jsxs(
|
|
864
|
-
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
910
|
+
) : AUDIO_ASPECT_RATIO), /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
911
|
+
/* @__PURE__ */ jsxs(Card, { tone: "transparent", style: { aspectRatio, position: "relative" }, children: [
|
|
912
|
+
videoSrc && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
913
|
+
/* @__PURE__ */ jsx(
|
|
914
|
+
MuxPlayer,
|
|
915
|
+
{
|
|
916
|
+
poster: thumbnail,
|
|
917
|
+
ref: muxPlayer,
|
|
918
|
+
...props,
|
|
919
|
+
playsInline: !0,
|
|
920
|
+
playbackId: asset.playbackId,
|
|
921
|
+
tokens: signedToken ? { playback: signedToken, thumbnail: signedToken, storyboard: signedToken } : void 0,
|
|
922
|
+
preload: "metadata",
|
|
923
|
+
crossOrigin: "anonymous",
|
|
924
|
+
metadata: {
|
|
925
|
+
player_name: "Sanity Admin Dashboard",
|
|
926
|
+
player_version: "2.5.0",
|
|
927
|
+
page_type: "Preview Player"
|
|
928
|
+
},
|
|
929
|
+
audio: isAudio,
|
|
930
|
+
style: {
|
|
931
|
+
height: "100%",
|
|
932
|
+
width: "100%",
|
|
933
|
+
display: "block",
|
|
934
|
+
objectFit: "contain"
|
|
935
|
+
}
|
|
884
936
|
}
|
|
885
|
-
|
|
886
|
-
|
|
937
|
+
),
|
|
938
|
+
children
|
|
939
|
+
] }),
|
|
940
|
+
error ? /* @__PURE__ */ jsx(
|
|
941
|
+
"div",
|
|
942
|
+
{
|
|
943
|
+
style: {
|
|
944
|
+
position: "absolute",
|
|
945
|
+
top: "50%",
|
|
946
|
+
left: "50%",
|
|
947
|
+
transform: "translate(-50%, -50%)"
|
|
948
|
+
},
|
|
949
|
+
children: /* @__PURE__ */ jsxs(Text, { muted: !0, children: [
|
|
950
|
+
/* @__PURE__ */ jsx(ErrorOutlineIcon, { style: { marginRight: "0.15em" } }),
|
|
951
|
+
typeof error == "object" && "message" in error && typeof error.message == "string" ? error.message : "Error loading video"
|
|
952
|
+
] })
|
|
953
|
+
}
|
|
954
|
+
) : null,
|
|
887
955
|
children
|
|
888
956
|
] }),
|
|
889
|
-
|
|
890
|
-
"div",
|
|
891
|
-
{
|
|
892
|
-
style: {
|
|
893
|
-
position: "absolute",
|
|
894
|
-
top: "50%",
|
|
895
|
-
left: "50%",
|
|
896
|
-
transform: "translate(-50%, -50%)"
|
|
897
|
-
},
|
|
898
|
-
children: /* @__PURE__ */ jsxs(Text, { muted: !0, children: [
|
|
899
|
-
/* @__PURE__ */ jsx(ErrorOutlineIcon, { style: { marginRight: "0.15em" } }),
|
|
900
|
-
typeof error == "object" && "message" in error && typeof error.message == "string" ? error.message : "Error loading video"
|
|
901
|
-
] })
|
|
902
|
-
}
|
|
903
|
-
) : null,
|
|
904
|
-
children
|
|
957
|
+
dialogState === "edit-thumbnail" && /* @__PURE__ */ jsx(EditThumbnailDialog, { asset, currentTime: muxPlayer?.current?.currentTime })
|
|
905
958
|
] });
|
|
906
959
|
}
|
|
907
960
|
function assetIsAudio(asset) {
|
|
908
|
-
|
|
909
|
-
return ((_a = asset.data) == null ? void 0 : _a.max_stored_resolution) === "Audio only";
|
|
961
|
+
return asset.data?.max_stored_resolution === "Audio only";
|
|
910
962
|
}
|
|
911
963
|
function deleteAssetOnMux(client, assetId) {
|
|
912
964
|
const { dataset } = client.config();
|
|
@@ -921,16 +973,16 @@ async function deleteAsset({
|
|
|
921
973
|
asset,
|
|
922
974
|
deleteOnMux
|
|
923
975
|
}) {
|
|
924
|
-
if (!
|
|
976
|
+
if (!asset?._id) return !0;
|
|
925
977
|
try {
|
|
926
978
|
await client.delete(asset._id);
|
|
927
|
-
} catch
|
|
979
|
+
} catch {
|
|
928
980
|
return "failed-sanity";
|
|
929
981
|
}
|
|
930
|
-
if (deleteOnMux && asset
|
|
982
|
+
if (deleteOnMux && asset?.assetId)
|
|
931
983
|
try {
|
|
932
984
|
await deleteAssetOnMux(client, asset.assetId);
|
|
933
|
-
} catch
|
|
985
|
+
} catch {
|
|
934
986
|
return "failed-mux";
|
|
935
987
|
}
|
|
936
988
|
return !0;
|
|
@@ -943,14 +995,6 @@ function getAsset(client, assetId) {
|
|
|
943
995
|
method: "GET"
|
|
944
996
|
});
|
|
945
997
|
}
|
|
946
|
-
var __defProp$c = Object.defineProperty, __defProps$7 = Object.defineProperties, __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$c = Object.getOwnPropertySymbols, __hasOwnProp$c = Object.prototype.hasOwnProperty, __propIsEnum$c = Object.prototype.propertyIsEnumerable, __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$c = (a2, b) => {
|
|
947
|
-
for (var prop in b || (b = {}))
|
|
948
|
-
__hasOwnProp$c.call(b, prop) && __defNormalProp$c(a2, prop, b[prop]);
|
|
949
|
-
if (__getOwnPropSymbols$c)
|
|
950
|
-
for (var prop of __getOwnPropSymbols$c(b))
|
|
951
|
-
__propIsEnum$c.call(b, prop) && __defNormalProp$c(a2, prop, b[prop]);
|
|
952
|
-
return a2;
|
|
953
|
-
}, __spreadProps$7 = (a2, b) => __defProps$7(a2, __getOwnPropDescs$7(b));
|
|
954
998
|
const getUnknownTypeFallback = (id, typeName) => ({
|
|
955
999
|
title: /* @__PURE__ */ jsxs("em", { children: [
|
|
956
1000
|
"No schema found for type ",
|
|
@@ -964,7 +1008,7 @@ const getUnknownTypeFallback = (id, typeName) => ({
|
|
|
964
1008
|
});
|
|
965
1009
|
function MissingSchemaType(props) {
|
|
966
1010
|
const { layout, value } = props;
|
|
967
|
-
return /* @__PURE__ */ jsx(SanityDefaultPreview,
|
|
1011
|
+
return /* @__PURE__ */ jsx(SanityDefaultPreview, { ...getUnknownTypeFallback(value._id, value._type), layout });
|
|
968
1012
|
}
|
|
969
1013
|
function TimeAgo({ time }) {
|
|
970
1014
|
const timeAgo = useTimeAgo(time);
|
|
@@ -1003,14 +1047,6 @@ function PublishedStatus(props) {
|
|
|
1003
1047
|
}
|
|
1004
1048
|
);
|
|
1005
1049
|
}
|
|
1006
|
-
var __defProp$b = Object.defineProperty, __defProps$6 = Object.defineProperties, __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$b = Object.getOwnPropertySymbols, __hasOwnProp$b = Object.prototype.hasOwnProperty, __propIsEnum$b = Object.prototype.propertyIsEnumerable, __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$b = (a2, b) => {
|
|
1007
|
-
for (var prop in b || (b = {}))
|
|
1008
|
-
__hasOwnProp$b.call(b, prop) && __defNormalProp$b(a2, prop, b[prop]);
|
|
1009
|
-
if (__getOwnPropSymbols$b)
|
|
1010
|
-
for (var prop of __getOwnPropSymbols$b(b))
|
|
1011
|
-
__propIsEnum$b.call(b, prop) && __defNormalProp$b(a2, prop, b[prop]);
|
|
1012
|
-
return a2;
|
|
1013
|
-
}, __spreadProps$6 = (a2, b) => __defProps$6(a2, __getOwnPropDescs$6(b));
|
|
1014
1050
|
function PaneItemPreview(props) {
|
|
1015
1051
|
const { icon, layout, presence, schemaType, value } = props, title = isRecord(value.title) && isValidElement(value.title) || isString(value.title) || isNumber(value.title) ? value.title : null, observable = useMemo(
|
|
1016
1052
|
() => getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id, title),
|
|
@@ -1026,12 +1062,13 @@ function PaneItemPreview(props) {
|
|
|
1026
1062
|
] });
|
|
1027
1063
|
return /* @__PURE__ */ jsx(
|
|
1028
1064
|
SanityDefaultPreview,
|
|
1029
|
-
|
|
1065
|
+
{
|
|
1066
|
+
...getPreviewValueWithFallback({ value, draft, published }),
|
|
1030
1067
|
isPlaceholder: isLoading,
|
|
1031
1068
|
icon,
|
|
1032
1069
|
layout,
|
|
1033
1070
|
status
|
|
1034
|
-
}
|
|
1071
|
+
}
|
|
1035
1072
|
);
|
|
1036
1073
|
}
|
|
1037
1074
|
function getIconWithFallback(icon, schemaType, defaultIcon) {
|
|
@@ -1052,7 +1089,7 @@ function DocumentPreviewInRool(props) {
|
|
|
1052
1089
|
return (linkProps) => /* @__PURE__ */ jsx(IntentLink, { intent: "edit", params: { id: props.documentPair.id }, children: linkProps.children });
|
|
1053
1090
|
}
|
|
1054
1091
|
function DocumentPreview(props) {
|
|
1055
|
-
const { schemaType, documentPair } = props, doc =
|
|
1092
|
+
const { schemaType, documentPair } = props, doc = documentPair?.draft || documentPair?.published, id = documentPair.id || "", documentPreviewStore = useDocumentPreviewStore(), schema = useSchema(), documentPresence = useDocumentPresence(id), hasSchemaType = !!(schemaType && schemaType.name && schema.get(schemaType.name)), PreviewComponent = useMemo(() => doc ? !schemaType || !hasSchemaType ? /* @__PURE__ */ jsx(MissingSchemaType, { value: doc }) : /* @__PURE__ */ jsx(
|
|
1056
1093
|
PaneItemPreview,
|
|
1057
1094
|
{
|
|
1058
1095
|
documentPreviewStore,
|
|
@@ -1088,14 +1125,13 @@ const Container = styled(Box)`
|
|
|
1088
1125
|
font-size: ${(props) => props.theme.sanity.fonts.text.sizes[1]};
|
|
1089
1126
|
}
|
|
1090
1127
|
`, VideoReferences = (props) => {
|
|
1091
|
-
var _a;
|
|
1092
1128
|
const schema = useSchema();
|
|
1093
1129
|
if (!props.isLoaded)
|
|
1094
1130
|
return /* @__PURE__ */ jsx(SpinnerBox, {});
|
|
1095
|
-
if (!
|
|
1131
|
+
if (!props.references?.length)
|
|
1096
1132
|
return /* @__PURE__ */ jsx(Card, { border: !0, radius: 3, padding: 3, children: /* @__PURE__ */ jsx(Text, { size: 2, children: "No documents are using this video" }) });
|
|
1097
1133
|
const documentPairs = collate(props.references || []);
|
|
1098
|
-
return /* @__PURE__ */ jsx(Container, { children: documentPairs
|
|
1134
|
+
return /* @__PURE__ */ jsx(Container, { children: documentPairs?.map((documentPair) => {
|
|
1099
1135
|
const schemaType = schema.get(documentPair.type);
|
|
1100
1136
|
return /* @__PURE__ */ jsx(
|
|
1101
1137
|
Card,
|
|
@@ -1128,7 +1164,7 @@ function DeleteDialog({
|
|
|
1128
1164
|
}) {
|
|
1129
1165
|
const client = useClient(), [state, setState] = useState("checkingReferences"), [deleteOnMux, setDeleteOnMux] = useState(!0), toast = useToast();
|
|
1130
1166
|
useEffect(() => {
|
|
1131
|
-
state !== "checkingReferences" || referencesLoading || setState(references
|
|
1167
|
+
state !== "checkingReferences" || referencesLoading || setState(references?.length ? "cantDelete" : "confirm");
|
|
1132
1168
|
}, [state, references, referencesLoading]);
|
|
1133
1169
|
async function confirmDelete() {
|
|
1134
1170
|
if (state !== "confirm") return;
|
|
@@ -1170,7 +1206,7 @@ function DeleteDialog({
|
|
|
1170
1206
|
/* @__PURE__ */ jsx(Heading, { size: 2, children: "Video can't be deleted" }),
|
|
1171
1207
|
/* @__PURE__ */ jsxs(Text, { size: 2, style: { marginBottom: "2rem" }, children: [
|
|
1172
1208
|
"There are ",
|
|
1173
|
-
references
|
|
1209
|
+
references?.length,
|
|
1174
1210
|
" document",
|
|
1175
1211
|
references && references.length > 0 && "s",
|
|
1176
1212
|
" ",
|
|
@@ -1241,40 +1277,24 @@ const useDocReferences = createHookFromObservableFactory(({ documentStore, id })
|
|
|
1241
1277
|
apiVersion: SANITY_API_VERSION
|
|
1242
1278
|
}
|
|
1243
1279
|
));
|
|
1244
|
-
function formatSeconds(seconds) {
|
|
1245
|
-
if (typeof seconds != "number" || Number.isNaN(seconds))
|
|
1246
|
-
return "";
|
|
1247
|
-
const hrs = ~~(seconds / 3600), mins = ~~(seconds % 3600 / 60), secs = ~~seconds % 60;
|
|
1248
|
-
let ret = "";
|
|
1249
|
-
return hrs > 0 && (ret += "" + hrs + ":" + (mins < 10 ? "0" : "")), ret += "" + mins + ":" + (secs < 10 ? "0" : ""), ret += "" + secs, ret;
|
|
1250
|
-
}
|
|
1251
1280
|
function getVideoMetadata(doc) {
|
|
1252
|
-
|
|
1253
|
-
const id = doc.assetId || doc._id || "", date = (_a = doc.data) != null && _a.created_at ? new Date(Number(doc.data.created_at) * 1e3) : new Date(doc._createdAt || doc._updatedAt || Date.now());
|
|
1281
|
+
const id = doc.assetId || doc._id || "", date = doc.data?.created_at ? new Date(Number(doc.data.created_at) * 1e3) : new Date(doc._createdAt || doc._updatedAt || Date.now());
|
|
1254
1282
|
return {
|
|
1255
1283
|
title: doc.filename || id.slice(0, 12),
|
|
1256
1284
|
id,
|
|
1257
1285
|
playbackId: doc.playbackId,
|
|
1258
1286
|
createdAt: date,
|
|
1259
|
-
duration:
|
|
1260
|
-
aspect_ratio:
|
|
1261
|
-
max_stored_resolution:
|
|
1262
|
-
max_stored_frame_rate:
|
|
1287
|
+
duration: doc.data?.duration ? formatSeconds(doc.data?.duration) : void 0,
|
|
1288
|
+
aspect_ratio: doc.data?.aspect_ratio,
|
|
1289
|
+
max_stored_resolution: doc.data?.max_stored_resolution,
|
|
1290
|
+
max_stored_frame_rate: doc.data?.max_stored_frame_rate
|
|
1263
1291
|
};
|
|
1264
1292
|
}
|
|
1265
|
-
var __defProp$a = Object.defineProperty, __defProps$5 = Object.defineProperties, __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$a = Object.getOwnPropertySymbols, __hasOwnProp$a = Object.prototype.hasOwnProperty, __propIsEnum$a = Object.prototype.propertyIsEnumerable, __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$a = (a2, b) => {
|
|
1266
|
-
for (var prop in b || (b = {}))
|
|
1267
|
-
__hasOwnProp$a.call(b, prop) && __defNormalProp$a(a2, prop, b[prop]);
|
|
1268
|
-
if (__getOwnPropSymbols$a)
|
|
1269
|
-
for (var prop of __getOwnPropSymbols$a(b))
|
|
1270
|
-
__propIsEnum$a.call(b, prop) && __defNormalProp$a(a2, prop, b[prop]);
|
|
1271
|
-
return a2;
|
|
1272
|
-
}, __spreadProps$5 = (a2, b) => __defProps$5(a2, __getOwnPropDescs$5(b));
|
|
1273
1293
|
function useVideoDetails(props) {
|
|
1274
1294
|
const documentStore = useDocumentStore(), toast = useToast(), client = useClient(), [references, referencesLoading] = useDocReferences({
|
|
1275
1295
|
documentStore,
|
|
1276
1296
|
id: props.asset._id
|
|
1277
|
-
}), [originalAsset, setOriginalAsset] = useState(() => props.asset), [filename, setFilename] = useState(props.asset.filename), modified = filename !== originalAsset.filename, displayInfo = getVideoMetadata(
|
|
1297
|
+
}), [originalAsset, setOriginalAsset] = useState(() => props.asset), [filename, setFilename] = useState(props.asset.filename), modified = filename !== originalAsset.filename, displayInfo = getVideoMetadata({ ...props.asset, filename }), [state, setState] = useState("idle");
|
|
1278
1298
|
function handleClose() {
|
|
1279
1299
|
if (state === "idle") {
|
|
1280
1300
|
if (modified) {
|
|
@@ -1291,7 +1311,7 @@ function useVideoDetails(props) {
|
|
|
1291
1311
|
if (state === "idle") {
|
|
1292
1312
|
setState("saving");
|
|
1293
1313
|
try {
|
|
1294
|
-
await client.patch(props.asset._id).set({ filename }).commit(), setOriginalAsset((prev) =>
|
|
1314
|
+
await client.patch(props.asset._id).set({ filename }).commit(), setOriginalAsset((prev) => ({ ...prev, filename })), toast.push({
|
|
1295
1315
|
title: "Video title updated",
|
|
1296
1316
|
description: `New title: ${filename}`,
|
|
1297
1317
|
status: "success"
|
|
@@ -1506,7 +1526,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsx(FormField$1, { title: props.la
|
|
|
1506
1526
|
}
|
|
1507
1527
|
),
|
|
1508
1528
|
/* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
1509
|
-
|
|
1529
|
+
displayInfo?.duration && /* @__PURE__ */ jsx(
|
|
1510
1530
|
IconInfo,
|
|
1511
1531
|
{
|
|
1512
1532
|
text: `Duration: ${displayInfo.duration}`,
|
|
@@ -1514,7 +1534,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsx(FormField$1, { title: props.la
|
|
|
1514
1534
|
size: 2
|
|
1515
1535
|
}
|
|
1516
1536
|
),
|
|
1517
|
-
|
|
1537
|
+
displayInfo?.max_stored_resolution && /* @__PURE__ */ jsx(
|
|
1518
1538
|
IconInfo,
|
|
1519
1539
|
{
|
|
1520
1540
|
text: `Max Resolution: ${displayInfo.max_stored_resolution}`,
|
|
@@ -1522,7 +1542,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsx(FormField$1, { title: props.la
|
|
|
1522
1542
|
size: 2
|
|
1523
1543
|
}
|
|
1524
1544
|
),
|
|
1525
|
-
|
|
1545
|
+
displayInfo?.max_stored_frame_rate && /* @__PURE__ */ jsx(
|
|
1526
1546
|
IconInfo,
|
|
1527
1547
|
{
|
|
1528
1548
|
text: `Frame rate: ${displayInfo.max_stored_frame_rate}`,
|
|
@@ -1530,7 +1550,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsx(FormField$1, { title: props.la
|
|
|
1530
1550
|
size: 2
|
|
1531
1551
|
}
|
|
1532
1552
|
),
|
|
1533
|
-
|
|
1553
|
+
displayInfo?.aspect_ratio && /* @__PURE__ */ jsx(
|
|
1534
1554
|
IconInfo,
|
|
1535
1555
|
{
|
|
1536
1556
|
text: `Aspect Ratio: ${displayInfo.aspect_ratio}`,
|
|
@@ -1555,7 +1575,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsx(FormField$1, { title: props.la
|
|
|
1555
1575
|
),
|
|
1556
1576
|
/* @__PURE__ */ jsx(IconInfo, { text: `Mux ID:
|
|
1557
1577
|
${displayInfo.id}`, icon: TagIcon, size: 2 }),
|
|
1558
|
-
|
|
1578
|
+
displayInfo?.playbackId && /* @__PURE__ */ jsx(
|
|
1559
1579
|
IconInfo,
|
|
1560
1580
|
{
|
|
1561
1581
|
text: `Playback ID: ${displayInfo.playbackId}`,
|
|
@@ -1609,7 +1629,7 @@ ${displayInfo.id}`, icon: TagIcon, size: 2 }),
|
|
|
1609
1629
|
}
|
|
1610
1630
|
),
|
|
1611
1631
|
/* @__PURE__ */ jsxs(Inline, { space: 3, children: [
|
|
1612
|
-
|
|
1632
|
+
displayInfo?.duration && /* @__PURE__ */ jsx(IconInfo, { text: displayInfo.duration, icon: ClockIcon, size: 1, muted: !0 }),
|
|
1613
1633
|
/* @__PURE__ */ jsx(
|
|
1614
1634
|
IconInfo,
|
|
1615
1635
|
{
|
|
@@ -1685,7 +1705,7 @@ function VideoInBrowser({
|
|
|
1685
1705
|
onEdit,
|
|
1686
1706
|
asset
|
|
1687
1707
|
}) {
|
|
1688
|
-
const [renderVideo, setRenderVideo] = useState(!1), select = React.useCallback(() => onSelect
|
|
1708
|
+
const [renderVideo, setRenderVideo] = useState(!1), select = React.useCallback(() => onSelect?.(asset), [onSelect, asset]), edit = React.useCallback(() => onEdit?.(asset), [onEdit, asset]);
|
|
1689
1709
|
if (!asset)
|
|
1690
1710
|
return null;
|
|
1691
1711
|
const playbackPolicy = getPlaybackPolicy(asset);
|
|
@@ -1806,7 +1826,7 @@ function VideoInBrowser({
|
|
|
1806
1826
|
}
|
|
1807
1827
|
function VideosBrowser({ onSelect }) {
|
|
1808
1828
|
const { assets, isLoading, searchQuery, setSearchQuery, setSort, sort } = useAssets(), [editedAsset, setEditedAsset] = useState(null), freshEditedAsset = useMemo(
|
|
1809
|
-
() => assets.find((a2) => a2._id ===
|
|
1829
|
+
() => assets.find((a2) => a2._id === editedAsset?._id) || editedAsset,
|
|
1810
1830
|
[editedAsset, assets]
|
|
1811
1831
|
), placement = onSelect ? "input" : "tool";
|
|
1812
1832
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1827,7 +1847,7 @@ function VideosBrowser({ onSelect }) {
|
|
|
1827
1847
|
placement === "tool" && /* @__PURE__ */ jsx(ImportVideosFromMux, {})
|
|
1828
1848
|
] }),
|
|
1829
1849
|
/* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
1830
|
-
|
|
1850
|
+
assets?.length > 0 && /* @__PURE__ */ jsxs(Label$1, { muted: !0, children: [
|
|
1831
1851
|
assets.length,
|
|
1832
1852
|
" video",
|
|
1833
1853
|
assets.length > 1 ? "s" : null,
|
|
@@ -1866,14 +1886,6 @@ function VideosBrowser({ onSelect }) {
|
|
|
1866
1886
|
)
|
|
1867
1887
|
] });
|
|
1868
1888
|
}
|
|
1869
|
-
var __defProp$9 = Object.defineProperty, __getOwnPropSymbols$9 = Object.getOwnPropertySymbols, __hasOwnProp$9 = Object.prototype.hasOwnProperty, __propIsEnum$9 = Object.prototype.propertyIsEnumerable, __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$9 = (a2, b) => {
|
|
1870
|
-
for (var prop in b || (b = {}))
|
|
1871
|
-
__hasOwnProp$9.call(b, prop) && __defNormalProp$9(a2, prop, b[prop]);
|
|
1872
|
-
if (__getOwnPropSymbols$9)
|
|
1873
|
-
for (var prop of __getOwnPropSymbols$9(b))
|
|
1874
|
-
__propIsEnum$9.call(b, prop) && __defNormalProp$9(a2, prop, b[prop]);
|
|
1875
|
-
return a2;
|
|
1876
|
-
};
|
|
1877
1889
|
const StudioTool = () => /* @__PURE__ */ jsx(VideosBrowser, {}), DEFAULT_TOOL_CONFIG = {
|
|
1878
1890
|
icon: ToolIcon,
|
|
1879
1891
|
title: "Videos"
|
|
@@ -1884,7 +1896,7 @@ function createStudioTool(config) {
|
|
|
1884
1896
|
name: "mux",
|
|
1885
1897
|
icon: toolConfig.icon || DEFAULT_TOOL_CONFIG.icon,
|
|
1886
1898
|
title: toolConfig.title || DEFAULT_TOOL_CONFIG.title,
|
|
1887
|
-
component: (props) => /* @__PURE__ */ jsx(StudioTool,
|
|
1899
|
+
component: (props) => /* @__PURE__ */ jsx(StudioTool, { ...config, ...props })
|
|
1888
1900
|
};
|
|
1889
1901
|
}
|
|
1890
1902
|
const path = ["assetId", "data", "playbackId", "status", "thumbTime", "filename"], useAssetDocumentValues = (asset) => useDocumentValues(
|
|
@@ -1895,16 +1907,12 @@ function useDialogState() {
|
|
|
1895
1907
|
return useState(!1);
|
|
1896
1908
|
}
|
|
1897
1909
|
const useMuxPolling = (asset) => {
|
|
1898
|
-
var _a, _b;
|
|
1899
1910
|
const client = useClient(), projectId = useProjectId(), dataset = useDataset(), shouldFetch = useMemo(
|
|
1900
|
-
() =>
|
|
1901
|
-
|
|
1902
|
-
return !!(asset != null && asset.assetId) && ((asset == null ? void 0 : asset.status) === "preparing" || ((_b2 = (_a2 = asset == null ? void 0 : asset.data) == null ? void 0 : _a2.static_renditions) == null ? void 0 : _b2.status) === "preparing");
|
|
1903
|
-
},
|
|
1904
|
-
[asset == null ? void 0 : asset.assetId, (_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.static_renditions) == null ? void 0 : _b.status, asset == null ? void 0 : asset.status]
|
|
1911
|
+
() => !!asset?.assetId && (asset?.status === "preparing" || asset?.data?.static_renditions?.status === "preparing"),
|
|
1912
|
+
[asset?.assetId, asset?.data?.static_renditions?.status, asset?.status]
|
|
1905
1913
|
);
|
|
1906
1914
|
return useSWR(
|
|
1907
|
-
shouldFetch ? `/${projectId}/addons/mux/assets/${dataset}/data/${asset
|
|
1915
|
+
shouldFetch ? `/${projectId}/addons/mux/assets/${dataset}/data/${asset?.assetId}` : null,
|
|
1908
1916
|
async () => {
|
|
1909
1917
|
const { data } = await client.request({
|
|
1910
1918
|
url: `/addons/mux/assets/${dataset}/data/${asset.assetId}`,
|
|
@@ -1955,7 +1963,7 @@ async function haveValidSigningKeys(client, signingKeyId, signingKeyPrivate) {
|
|
|
1955
1963
|
method: "GET"
|
|
1956
1964
|
});
|
|
1957
1965
|
return !!(res.data && res.data.id);
|
|
1958
|
-
} catch
|
|
1966
|
+
} catch {
|
|
1959
1967
|
return console.error("Error fetching signingKeyId", signingKeyId, "assuming it is not valid"), !1;
|
|
1960
1968
|
}
|
|
1961
1969
|
}
|
|
@@ -1977,16 +1985,14 @@ const useSaveSecrets = (client, secrets) => useCallback(
|
|
|
1977
1985
|
}) => {
|
|
1978
1986
|
let { signingKeyId, signingKeyPrivate } = secrets;
|
|
1979
1987
|
try {
|
|
1980
|
-
await saveSecrets(
|
|
1988
|
+
if (await saveSecrets(
|
|
1981
1989
|
client,
|
|
1982
1990
|
token,
|
|
1983
1991
|
secretKey,
|
|
1984
1992
|
enableSignedUrls,
|
|
1985
1993
|
signingKeyId,
|
|
1986
1994
|
signingKeyPrivate
|
|
1987
|
-
)
|
|
1988
|
-
const valid = await testSecrets(client);
|
|
1989
|
-
if (!(valid != null && valid.status) && token && secretKey)
|
|
1995
|
+
), !(await testSecrets(client))?.status && token && secretKey)
|
|
1990
1996
|
throw new Error("Invalid secrets");
|
|
1991
1997
|
} catch (err) {
|
|
1992
1998
|
throw console.error("Error while trying to save secrets:", err), err;
|
|
@@ -2007,7 +2013,7 @@ const useSaveSecrets = (client, secrets) => useCallback(
|
|
|
2007
2013
|
signingKeyPrivate
|
|
2008
2014
|
);
|
|
2009
2015
|
} catch (err) {
|
|
2010
|
-
throw console.log("Error while creating and saving signing key:", err
|
|
2016
|
+
throw console.log("Error while creating and saving signing key:", err?.message), err;
|
|
2011
2017
|
}
|
|
2012
2018
|
return {
|
|
2013
2019
|
token,
|
|
@@ -2019,37 +2025,29 @@ const useSaveSecrets = (client, secrets) => useCallback(
|
|
|
2019
2025
|
},
|
|
2020
2026
|
[client, secrets]
|
|
2021
2027
|
);
|
|
2022
|
-
var __defProp$8 = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$8 = (a2, b) => {
|
|
2023
|
-
for (var prop in b || (b = {}))
|
|
2024
|
-
__hasOwnProp$8.call(b, prop) && __defNormalProp$8(a2, prop, b[prop]);
|
|
2025
|
-
if (__getOwnPropSymbols$8)
|
|
2026
|
-
for (var prop of __getOwnPropSymbols$8(b))
|
|
2027
|
-
__propIsEnum$8.call(b, prop) && __defNormalProp$8(a2, prop, b[prop]);
|
|
2028
|
-
return a2;
|
|
2029
|
-
}, __spreadProps$4 = (a2, b) => __defProps$4(a2, __getOwnPropDescs$4(b));
|
|
2030
2028
|
function init({ token, secretKey, enableSignedUrls }) {
|
|
2031
2029
|
return {
|
|
2032
2030
|
submitting: !1,
|
|
2033
2031
|
error: null,
|
|
2034
2032
|
// Form inputs don't set the state back to null when clearing a field, but uses empty strings
|
|
2035
2033
|
// This ensures the `dirty` check works correctly
|
|
2036
|
-
token: token
|
|
2037
|
-
secretKey: secretKey
|
|
2038
|
-
enableSignedUrls: enableSignedUrls
|
|
2034
|
+
token: token ?? "",
|
|
2035
|
+
secretKey: secretKey ?? "",
|
|
2036
|
+
enableSignedUrls: enableSignedUrls ?? !1
|
|
2039
2037
|
};
|
|
2040
2038
|
}
|
|
2041
2039
|
function reducer(state, action) {
|
|
2042
|
-
switch (action
|
|
2040
|
+
switch (action?.type) {
|
|
2043
2041
|
case "submit":
|
|
2044
|
-
return
|
|
2042
|
+
return { ...state, submitting: !0, error: null };
|
|
2045
2043
|
case "error":
|
|
2046
|
-
return
|
|
2044
|
+
return { ...state, submitting: !1, error: action.payload };
|
|
2047
2045
|
case "reset":
|
|
2048
2046
|
return init(action.payload);
|
|
2049
2047
|
case "change":
|
|
2050
|
-
return
|
|
2048
|
+
return { ...state, [action.payload.name]: action.payload.value };
|
|
2051
2049
|
default:
|
|
2052
|
-
throw new Error(`Unknown action type: ${action
|
|
2050
|
+
throw new Error(`Unknown action type: ${action?.type}`);
|
|
2053
2051
|
}
|
|
2054
2052
|
}
|
|
2055
2053
|
const useSecretsFormState = (secrets) => useReducer(reducer, secrets, init), ids = [
|
|
@@ -2652,7 +2650,6 @@ const Logo = styled.span`
|
|
|
2652
2650
|
"API Credentials"
|
|
2653
2651
|
] }), fieldNames = ["token", "secretKey", "enableSignedUrls"];
|
|
2654
2652
|
function ConfigureApi({ secrets, setDialogState }) {
|
|
2655
|
-
var _a, _b;
|
|
2656
2653
|
const client = useClient(), [state, dispatch] = useSecretsFormState(secrets), hasSecretsInitially = useMemo(() => secrets.token && secrets.secretKey, [secrets]), handleClose = useCallback(() => setDialogState(!1), [setDialogState]), dirty = useMemo(
|
|
2657
2654
|
() => secrets.token !== state.token || secrets.secretKey !== state.secretKey || secrets.enableSignedUrls !== state.enableSignedUrls,
|
|
2658
2655
|
[secrets, state]
|
|
@@ -2744,7 +2741,7 @@ function ConfigureApi({ secrets, setDialogState }) {
|
|
|
2744
2741
|
ref: firstField,
|
|
2745
2742
|
onChange: handleChangeToken,
|
|
2746
2743
|
type: "text",
|
|
2747
|
-
value:
|
|
2744
|
+
value: state.token ?? "",
|
|
2748
2745
|
required: !!state.secretKey || state.enableSignedUrls
|
|
2749
2746
|
}
|
|
2750
2747
|
) }),
|
|
@@ -2754,7 +2751,7 @@ function ConfigureApi({ secrets, setDialogState }) {
|
|
|
2754
2751
|
id: secretKeyId,
|
|
2755
2752
|
onChange: handleChangeSecretKey,
|
|
2756
2753
|
type: "text",
|
|
2757
|
-
value:
|
|
2754
|
+
value: state.secretKey ?? "",
|
|
2758
2755
|
required: !!state.token || state.enableSignedUrls
|
|
2759
2756
|
}
|
|
2760
2757
|
) }),
|
|
@@ -2852,7 +2849,7 @@ function a(t) {
|
|
|
2852
2849
|
function ErrorBoundaryCard(props) {
|
|
2853
2850
|
const { children, schemaType } = props, { push: pushToast } = useToast(), errorRef = useRef(null), { ErrorBoundary, didCatch, error, reset } = a({
|
|
2854
2851
|
onDidCatch: (err, errorInfo) => {
|
|
2855
|
-
console.group(err.toString()), console.groupCollapsed("console.error"), console.error(err), console.groupEnd(), err.stack && (console.groupCollapsed("error.stack"), console.log(err.stack), console.groupEnd()), errorInfo
|
|
2852
|
+
console.group(err.toString()), console.groupCollapsed("console.error"), console.error(err), console.groupEnd(), err.stack && (console.groupCollapsed("error.stack"), console.log(err.stack), console.groupEnd()), errorInfo?.componentStack && (console.groupCollapsed("errorInfo.componentStack"), console.log(errorInfo.componentStack), console.groupEnd()), console.groupEnd(), pushToast({
|
|
2856
2853
|
status: "error",
|
|
2857
2854
|
title: "Plugin crashed",
|
|
2858
2855
|
description: /* @__PURE__ */ jsx(Flex, { align: "center", children: /* @__PURE__ */ jsxs(Inline, { space: 1, children: [
|
|
@@ -2886,7 +2883,7 @@ function ErrorBoundaryCard(props) {
|
|
|
2886
2883
|
/* @__PURE__ */ jsx("code", { children: name }),
|
|
2887
2884
|
" plugin crashed"
|
|
2888
2885
|
] }),
|
|
2889
|
-
|
|
2886
|
+
error?.message && /* @__PURE__ */ jsx(Card, { padding: 3, tone: "critical", shadow: 1, radius: 2, children: /* @__PURE__ */ jsx(Text, { children: error.message }) }),
|
|
2890
2887
|
/* @__PURE__ */ jsx(Inline, { children: /* @__PURE__ */ jsx(Button, { onClick: handleRetry, text: "Retry" }) })
|
|
2891
2888
|
] }) }) }) : /* @__PURE__ */ jsx(ErrorBoundary, { children });
|
|
2892
2889
|
}
|
|
@@ -2952,14 +2949,6 @@ function createUpChunkObservable(uuid2, uploadUrl2, source) {
|
|
|
2952
2949
|
return upchunk.on("success", successHandler), upchunk.on("error", errorHandler), upchunk.on("progress", progressHandler), upchunk.on("offline", offlineHandler), upchunk.on("online", onlineHandler), () => upchunk.abort();
|
|
2953
2950
|
});
|
|
2954
2951
|
}
|
|
2955
|
-
var __defProp$7 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$7 = Object.getOwnPropertySymbols, __hasOwnProp$7 = Object.prototype.hasOwnProperty, __propIsEnum$7 = Object.prototype.propertyIsEnumerable, __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$7 = (a2, b) => {
|
|
2956
|
-
for (var prop in b || (b = {}))
|
|
2957
|
-
__hasOwnProp$7.call(b, prop) && __defNormalProp$7(a2, prop, b[prop]);
|
|
2958
|
-
if (__getOwnPropSymbols$7)
|
|
2959
|
-
for (var prop of __getOwnPropSymbols$7(b))
|
|
2960
|
-
__propIsEnum$7.call(b, prop) && __defNormalProp$7(a2, prop, b[prop]);
|
|
2961
|
-
return a2;
|
|
2962
|
-
}, __spreadProps$3 = (a2, b) => __defProps$3(a2, __getOwnPropDescs$3(b));
|
|
2963
2952
|
function cancelUpload(client, uuid2) {
|
|
2964
2953
|
return client.observable.request({
|
|
2965
2954
|
url: `/addons/mux/uploads/${client.config().dataset}/${uuid2}`,
|
|
@@ -3040,7 +3029,7 @@ function uploadFile({
|
|
|
3040
3029
|
// eslint-disable-next-line max-nested-callbacks
|
|
3041
3030
|
mergeMap((event) => event.type !== "success" ? of(event) : from(updateAssetDocumentFromUpload(client, uuid$1)).pipe(
|
|
3042
3031
|
// eslint-disable-next-line max-nested-callbacks
|
|
3043
|
-
mergeMap((doc) => of(
|
|
3032
|
+
mergeMap((doc) => of({ ...event, asset: doc }))
|
|
3044
3033
|
)),
|
|
3045
3034
|
// eslint-disable-next-line max-nested-callbacks
|
|
3046
3035
|
catchError((err) => cancelUpload(client, uuid$1).pipe(mergeMapTo(throwError(err))))
|
|
@@ -3111,7 +3100,7 @@ function testUrl(url) {
|
|
|
3111
3100
|
let parsed;
|
|
3112
3101
|
try {
|
|
3113
3102
|
parsed = new URL(url);
|
|
3114
|
-
} catch
|
|
3103
|
+
} catch {
|
|
3115
3104
|
return throwError(error);
|
|
3116
3105
|
}
|
|
3117
3106
|
return parsed && !parsed.protocol.match(/http:|https:/) ? throwError(error) : of(url);
|
|
@@ -3127,7 +3116,7 @@ function isValidUrl(url) {
|
|
|
3127
3116
|
try {
|
|
3128
3117
|
const parsed = new URL(url);
|
|
3129
3118
|
return parsed && !!parsed.protocol.match(/http:|https:/);
|
|
3130
|
-
} catch
|
|
3119
|
+
} catch {
|
|
3131
3120
|
return !1;
|
|
3132
3121
|
}
|
|
3133
3122
|
}
|
|
@@ -3142,7 +3131,7 @@ function normalizeItems(items) {
|
|
|
3142
3131
|
let entry;
|
|
3143
3132
|
try {
|
|
3144
3133
|
entry = item.webkitGetAsEntry();
|
|
3145
|
-
} catch
|
|
3134
|
+
} catch {
|
|
3146
3135
|
return [item.getAsFile()];
|
|
3147
3136
|
}
|
|
3148
3137
|
return entry ? entry.isDirectory ? walk(entry) : [item.getAsFile()] : [];
|
|
@@ -3175,7 +3164,7 @@ function walk(entry) {
|
|
|
3175
3164
|
function SelectAssets({ asset: selectedAsset, onChange, setDialogState }) {
|
|
3176
3165
|
const handleSelect = useCallback(
|
|
3177
3166
|
(chosenAsset) => {
|
|
3178
|
-
chosenAsset
|
|
3167
|
+
chosenAsset?._id || onChange(PatchEvent.from([unset(["asset"])])), chosenAsset._id !== selectedAsset?._id && onChange(
|
|
3179
3168
|
PatchEvent.from([
|
|
3180
3169
|
setIfMissing({ asset: {}, _type: "mux.video" }),
|
|
3181
3170
|
set({ _type: "reference", _weak: !0, _ref: chosenAsset._id }, ["asset"])
|
|
@@ -3285,24 +3274,18 @@ const TopControls = styled.div`
|
|
|
3285
3274
|
}
|
|
3286
3275
|
) : null
|
|
3287
3276
|
] }) }), Player = ({ asset, buttons, readOnly, onChange }) => {
|
|
3288
|
-
|
|
3289
|
-
const isLoading = useMemo(() => (asset == null ? void 0 : asset.status) === "preparing" ? "Preparing the video" : (asset == null ? void 0 : asset.status) === "waiting_for_upload" ? "Waiting for upload to start" : (asset == null ? void 0 : asset.status) === "waiting" ? "Processing upload" : !((asset == null ? void 0 : asset.status) === "ready" || typeof (asset == null ? void 0 : asset.status) > "u"), [asset]), isPreparingStaticRenditions = useMemo(() => {
|
|
3290
|
-
var _a2, _b2;
|
|
3291
|
-
return ((_b2 = (_a2 = asset == null ? void 0 : asset.data) == null ? void 0 : _a2.static_renditions) == null ? void 0 : _b2.status) === "preparing";
|
|
3292
|
-
}, [(_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.static_renditions) == null ? void 0 : _b.status]), playRef = useRef(null), muteRef = useRef(null), handleCancelUpload = useCancelUpload(asset, onChange);
|
|
3277
|
+
const isLoading = useMemo(() => asset?.status === "preparing" ? "Preparing the video" : asset?.status === "waiting_for_upload" ? "Waiting for upload to start" : asset?.status === "waiting" ? "Processing upload" : !(asset?.status === "ready" || typeof asset?.status > "u"), [asset]), isPreparingStaticRenditions = useMemo(() => asset?.data?.static_renditions?.status === "preparing", [asset?.data?.static_renditions?.status]), playRef = useRef(null), muteRef = useRef(null), handleCancelUpload = useCancelUpload(asset, onChange);
|
|
3293
3278
|
return useEffect(() => {
|
|
3294
|
-
var _a2, _b2;
|
|
3295
3279
|
const style = document.createElement("style");
|
|
3296
|
-
style.innerHTML = "button svg { vertical-align: middle; }",
|
|
3280
|
+
style.innerHTML = "button svg { vertical-align: middle; }", playRef.current?.shadowRoot && playRef.current.shadowRoot.appendChild(style), muteRef?.current?.shadowRoot && muteRef.current.shadowRoot.appendChild(style.cloneNode(!0));
|
|
3297
3281
|
}, []), useEffect(() => {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
}, [(_d = (_c = asset.data) == null ? void 0 : _c.errors) == null ? void 0 : _d.messages, asset == null ? void 0 : asset.status, handleCancelUpload]), !asset || !asset.status ? null : isLoading ? /* @__PURE__ */ jsx(
|
|
3282
|
+
if (asset?.status === "errored")
|
|
3283
|
+
throw handleCancelUpload(), new Error(asset.data?.errors?.messages?.join(" "));
|
|
3284
|
+
}, [asset.data?.errors?.messages, asset?.status, handleCancelUpload]), !asset || !asset.status ? null : isLoading ? /* @__PURE__ */ jsx(
|
|
3302
3285
|
UploadProgress,
|
|
3303
3286
|
{
|
|
3304
3287
|
progress: 100,
|
|
3305
|
-
filename: asset
|
|
3288
|
+
filename: asset?.filename,
|
|
3306
3289
|
text: isLoading !== !0 && isLoading || "Waiting for Mux to complete the upload",
|
|
3307
3290
|
onCancel: readOnly ? void 0 : () => handleCancelUpload()
|
|
3308
3291
|
}
|
|
@@ -3363,25 +3346,8 @@ const FileButton = styled(MenuItem)(({ theme }) => {
|
|
|
3363
3346
|
opacity: 0;
|
|
3364
3347
|
}
|
|
3365
3348
|
`;
|
|
3366
|
-
})
|
|
3367
|
-
|
|
3368
|
-
for (var prop in b || (b = {}))
|
|
3369
|
-
__hasOwnProp$6.call(b, prop) && __defNormalProp$6(a2, prop, b[prop]);
|
|
3370
|
-
if (__getOwnPropSymbols$6)
|
|
3371
|
-
for (var prop of __getOwnPropSymbols$6(b))
|
|
3372
|
-
__propIsEnum$6.call(b, prop) && __defNormalProp$6(a2, prop, b[prop]);
|
|
3373
|
-
return a2;
|
|
3374
|
-
}, __spreadProps$2 = (a2, b) => __defProps$2(a2, __getOwnPropDescs$2(b)), __objRest$2 = (source, exclude) => {
|
|
3375
|
-
var target = {};
|
|
3376
|
-
for (var prop in source)
|
|
3377
|
-
__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]);
|
|
3378
|
-
if (source != null && __getOwnPropSymbols$6)
|
|
3379
|
-
for (var prop of __getOwnPropSymbols$6(source))
|
|
3380
|
-
exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop) && (target[prop] = source[prop]);
|
|
3381
|
-
return target;
|
|
3382
|
-
};
|
|
3383
|
-
const FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
|
|
3384
|
-
const _a = props, {
|
|
3349
|
+
}), FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
|
|
3350
|
+
const {
|
|
3385
3351
|
icon,
|
|
3386
3352
|
id: idProp,
|
|
3387
3353
|
accept,
|
|
@@ -3392,20 +3358,9 @@ const FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
|
|
|
3392
3358
|
space = 3,
|
|
3393
3359
|
textAlign,
|
|
3394
3360
|
text,
|
|
3395
|
-
disabled
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
"id",
|
|
3399
|
-
"accept",
|
|
3400
|
-
"capture",
|
|
3401
|
-
"fontSize",
|
|
3402
|
-
"multiple",
|
|
3403
|
-
"onSelect",
|
|
3404
|
-
"space",
|
|
3405
|
-
"textAlign",
|
|
3406
|
-
"text",
|
|
3407
|
-
"disabled"
|
|
3408
|
-
]), idHook = useId(), id = idProp || idHook, handleChange = React.useCallback(
|
|
3361
|
+
disabled,
|
|
3362
|
+
...rest
|
|
3363
|
+
} = props, idHook = useId(), id = idProp || idHook, handleChange = React.useCallback(
|
|
3409
3364
|
(event) => {
|
|
3410
3365
|
onSelect && event.target.files && onSelect(Array.from(event.target.files));
|
|
3411
3366
|
},
|
|
@@ -3417,7 +3372,7 @@ const FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
|
|
|
3417
3372
|
] }) }),
|
|
3418
3373
|
text && /* @__PURE__ */ jsx(Text, { align: textAlign, size: fontSize, textOverflow: "ellipsis", children: text })
|
|
3419
3374
|
] });
|
|
3420
|
-
return /* @__PURE__ */ jsxs(FileButton,
|
|
3375
|
+
return /* @__PURE__ */ jsxs(FileButton, { ...rest, htmlFor: id, disabled, ref: forwardedRef, children: [
|
|
3421
3376
|
content,
|
|
3422
3377
|
/* @__PURE__ */ jsx(
|
|
3423
3378
|
"input",
|
|
@@ -3433,7 +3388,7 @@ const FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
|
|
|
3433
3388
|
disabled
|
|
3434
3389
|
}
|
|
3435
3390
|
)
|
|
3436
|
-
] })
|
|
3391
|
+
] });
|
|
3437
3392
|
}), LockCard = styled(Card)`
|
|
3438
3393
|
position: absolute;
|
|
3439
3394
|
top: 0;
|
|
@@ -3444,7 +3399,7 @@ const FileInputMenuItem = React.forwardRef(function(props, forwardedRef) {
|
|
|
3444
3399
|
`, LockButton = styled(Button)`
|
|
3445
3400
|
background: transparent;
|
|
3446
3401
|
color: white;
|
|
3447
|
-
|
|
3402
|
+
`, isVideoAsset = (asset) => asset._type === "mux.videoAsset";
|
|
3448
3403
|
function PlayerActionsMenu(props) {
|
|
3449
3404
|
const { asset, readOnly, dialogState, setDialogState, onChange, onSelect } = props, [open, setOpen] = useState(!1), [menuElement, setMenuRef] = useState(null), isSigned = useMemo(() => getPlaybackPolicy(asset) === "signed", [asset]), onReset = useCallback(() => onChange(PatchEvent.from(unset([]))), [onChange]);
|
|
3450
3405
|
return useEffect(() => {
|
|
@@ -3488,6 +3443,14 @@ function PlayerActionsMenu(props) {
|
|
|
3488
3443
|
onClick: () => setDialogState("select-video")
|
|
3489
3444
|
}
|
|
3490
3445
|
),
|
|
3446
|
+
isVideoAsset(asset) && /* @__PURE__ */ jsx(
|
|
3447
|
+
MenuItem,
|
|
3448
|
+
{
|
|
3449
|
+
icon: ImageIcon,
|
|
3450
|
+
text: "Thumbnail",
|
|
3451
|
+
onClick: () => setDialogState("edit-thumbnail")
|
|
3452
|
+
}
|
|
3453
|
+
),
|
|
3491
3454
|
/* @__PURE__ */ jsx(MenuDivider, {}),
|
|
3492
3455
|
/* @__PURE__ */ jsx(
|
|
3493
3456
|
MenuItem,
|
|
@@ -3593,7 +3556,7 @@ function TextTracksEditor({
|
|
|
3593
3556
|
{
|
|
3594
3557
|
id: "include-autogenerated-track",
|
|
3595
3558
|
style: { display: "block" },
|
|
3596
|
-
checked: !!
|
|
3559
|
+
checked: !!track?.language_code,
|
|
3597
3560
|
onChange: () => {
|
|
3598
3561
|
dispatch(track ? { action: "track", id: track._id, subAction: "delete" } : {
|
|
3599
3562
|
action: "track",
|
|
@@ -3629,10 +3592,7 @@ function TextTracksEditor({
|
|
|
3629
3592
|
placeholder: "Select language",
|
|
3630
3593
|
filterOption: (query, option) => option.label.toLowerCase().indexOf(query.toLowerCase()) > -1 || option.value.toLowerCase().indexOf(query.toLowerCase()) > -1,
|
|
3631
3594
|
openButton: !0,
|
|
3632
|
-
renderValue: (value) =>
|
|
3633
|
-
var _a;
|
|
3634
|
-
return ((_a = SUBTITLE_LANGUAGES[track.type].find((l) => l.value === value)) == null ? void 0 : _a.label) || value;
|
|
3635
|
-
},
|
|
3595
|
+
renderValue: (value) => SUBTITLE_LANGUAGES[track.type].find((l) => l.value === value)?.label || value,
|
|
3636
3596
|
renderOption: (option) => /* @__PURE__ */ jsx(Card, { "data-as": "button", padding: 3, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxs(Text, { size: 2, textOverflow: "ellipsis", children: [
|
|
3637
3597
|
option.label,
|
|
3638
3598
|
" (",
|
|
@@ -3643,14 +3603,6 @@ function TextTracksEditor({
|
|
|
3643
3603
|
)
|
|
3644
3604
|
] }) });
|
|
3645
3605
|
}
|
|
3646
|
-
var __defProp$5 = Object.defineProperty, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$5 = (a2, b) => {
|
|
3647
|
-
for (var prop in b || (b = {}))
|
|
3648
|
-
__hasOwnProp$5.call(b, prop) && __defNormalProp$5(a2, prop, b[prop]);
|
|
3649
|
-
if (__getOwnPropSymbols$5)
|
|
3650
|
-
for (var prop of __getOwnPropSymbols$5(b))
|
|
3651
|
-
__propIsEnum$5.call(b, prop) && __defNormalProp$5(a2, prop, b[prop]);
|
|
3652
|
-
return a2;
|
|
3653
|
-
};
|
|
3654
3606
|
const ENCODING_OPTIONS = [
|
|
3655
3607
|
{ value: "smart", label: "Smart" },
|
|
3656
3608
|
{ value: "baseline", label: "Baseline" }
|
|
@@ -3677,14 +3629,13 @@ function UploadConfiguration({
|
|
|
3677
3629
|
] : []
|
|
3678
3630
|
).current, [config, dispatch] = useReducer(
|
|
3679
3631
|
(prev, action) => {
|
|
3680
|
-
var _a;
|
|
3681
3632
|
switch (action.action) {
|
|
3682
3633
|
case "encoding_tier":
|
|
3683
3634
|
return action.value === "baseline" ? Object.assign({}, prev, {
|
|
3684
3635
|
encoding_tier: action.value,
|
|
3685
3636
|
mp4_support: "none",
|
|
3686
3637
|
max_resolution_tier: "1080p",
|
|
3687
|
-
text_tracks:
|
|
3638
|
+
text_tracks: prev.text_tracks?.filter(({ type }) => type !== "autogenerated")
|
|
3688
3639
|
}) : Object.assign({}, prev, {
|
|
3689
3640
|
encoding_tier: action.value,
|
|
3690
3641
|
mp4_support: pluginConfig.mp4_support,
|
|
@@ -3702,13 +3653,17 @@ function UploadConfiguration({
|
|
|
3702
3653
|
switch (action.subAction) {
|
|
3703
3654
|
case "add":
|
|
3704
3655
|
if (target_track_i !== -1) break;
|
|
3705
|
-
text_tracks.push(
|
|
3706
|
-
_id: action.id
|
|
3707
|
-
|
|
3656
|
+
text_tracks.push({
|
|
3657
|
+
_id: action.id,
|
|
3658
|
+
...action.value
|
|
3659
|
+
});
|
|
3708
3660
|
break;
|
|
3709
3661
|
case "update":
|
|
3710
3662
|
if (target_track_i === -1) break;
|
|
3711
|
-
text_tracks[target_track_i] =
|
|
3663
|
+
text_tracks[target_track_i] = {
|
|
3664
|
+
...text_tracks[target_track_i],
|
|
3665
|
+
...action.value
|
|
3666
|
+
};
|
|
3712
3667
|
break;
|
|
3713
3668
|
case "delete":
|
|
3714
3669
|
if (target_track_i === -1) break;
|
|
@@ -3994,24 +3949,7 @@ const ctrlKey = 17, cmdKey = 91, UploadCardWithFocusRing = withFocusRing(Card),
|
|
|
3994
3949
|
&:focus {
|
|
3995
3950
|
outline: none;
|
|
3996
3951
|
}
|
|
3997
|
-
|
|
3998
|
-
var __defProp$4 = Object.defineProperty, __getOwnPropSymbols$4 = Object.getOwnPropertySymbols, __hasOwnProp$4 = Object.prototype.hasOwnProperty, __propIsEnum$4 = Object.prototype.propertyIsEnumerable, __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$4 = (a2, b) => {
|
|
3999
|
-
for (var prop in b || (b = {}))
|
|
4000
|
-
__hasOwnProp$4.call(b, prop) && __defNormalProp$4(a2, prop, b[prop]);
|
|
4001
|
-
if (__getOwnPropSymbols$4)
|
|
4002
|
-
for (var prop of __getOwnPropSymbols$4(b))
|
|
4003
|
-
__propIsEnum$4.call(b, prop) && __defNormalProp$4(a2, prop, b[prop]);
|
|
4004
|
-
return a2;
|
|
4005
|
-
}, __objRest$1 = (source, exclude) => {
|
|
4006
|
-
var target = {};
|
|
4007
|
-
for (var prop in source)
|
|
4008
|
-
__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]);
|
|
4009
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
4010
|
-
for (var prop of __getOwnPropSymbols$4(source))
|
|
4011
|
-
exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop) && (target[prop] = source[prop]);
|
|
4012
|
-
return target;
|
|
4013
|
-
};
|
|
4014
|
-
const HiddenInput = styled.input`
|
|
3952
|
+
`, HiddenInput = styled.input`
|
|
4015
3953
|
overflow: hidden;
|
|
4016
3954
|
width: 0.1px;
|
|
4017
3955
|
height: 0.1px;
|
|
@@ -4020,17 +3958,13 @@ const HiddenInput = styled.input`
|
|
|
4020
3958
|
z-index: -1;
|
|
4021
3959
|
`, Label = styled.label`
|
|
4022
3960
|
position: relative;
|
|
4023
|
-
`, FileInputButton = (
|
|
4024
|
-
var _b = _a, { onSelect, accept } = _b, props = __objRest$1(_b, ["onSelect", "accept"]);
|
|
3961
|
+
`, FileInputButton = ({ onSelect, accept, ...props }) => {
|
|
4025
3962
|
const inputId = `FileSelect${useId()}`, inputRef = useRef(null), handleSelect = useCallback(
|
|
4026
3963
|
(event) => {
|
|
4027
3964
|
onSelect && onSelect(event.target.files);
|
|
4028
3965
|
},
|
|
4029
3966
|
[onSelect]
|
|
4030
|
-
), handleButtonClick = useCallback(() =>
|
|
4031
|
-
var _a2;
|
|
4032
|
-
return (_a2 = inputRef.current) == null ? void 0 : _a2.click();
|
|
4033
|
-
}, []);
|
|
3967
|
+
), handleButtonClick = useCallback(() => inputRef.current?.click(), []);
|
|
4034
3968
|
return /* @__PURE__ */ jsxs(Label, { htmlFor: inputId, children: [
|
|
4035
3969
|
/* @__PURE__ */ jsx(
|
|
4036
3970
|
HiddenInput,
|
|
@@ -4046,12 +3980,13 @@ const HiddenInput = styled.input`
|
|
|
4046
3980
|
),
|
|
4047
3981
|
/* @__PURE__ */ jsx(
|
|
4048
3982
|
Button,
|
|
4049
|
-
|
|
3983
|
+
{
|
|
4050
3984
|
onClick: handleButtonClick,
|
|
4051
3985
|
mode: "default",
|
|
4052
3986
|
tone: "primary",
|
|
4053
|
-
style: { width: "100%" }
|
|
4054
|
-
|
|
3987
|
+
style: { width: "100%" },
|
|
3988
|
+
...props
|
|
3989
|
+
}
|
|
4055
3990
|
)
|
|
4056
3991
|
] });
|
|
4057
3992
|
};
|
|
@@ -4112,29 +4047,12 @@ function UploadPlaceholder(props) {
|
|
|
4112
4047
|
}
|
|
4113
4048
|
);
|
|
4114
4049
|
}
|
|
4115
|
-
var __defProp$3 = Object.defineProperty, __defProps$1 = Object.defineProperties, __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$3 = Object.getOwnPropertySymbols, __hasOwnProp$3 = Object.prototype.hasOwnProperty, __propIsEnum$3 = Object.prototype.propertyIsEnumerable, __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$3 = (a2, b) => {
|
|
4116
|
-
for (var prop in b || (b = {}))
|
|
4117
|
-
__hasOwnProp$3.call(b, prop) && __defNormalProp$3(a2, prop, b[prop]);
|
|
4118
|
-
if (__getOwnPropSymbols$3)
|
|
4119
|
-
for (var prop of __getOwnPropSymbols$3(b))
|
|
4120
|
-
__propIsEnum$3.call(b, prop) && __defNormalProp$3(a2, prop, b[prop]);
|
|
4121
|
-
return a2;
|
|
4122
|
-
}, __spreadProps$1 = (a2, b) => __defProps$1(a2, __getOwnPropDescs$1(b)), __objRest = (source, exclude) => {
|
|
4123
|
-
var target = {};
|
|
4124
|
-
for (var prop in source)
|
|
4125
|
-
__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0 && (target[prop] = source[prop]);
|
|
4126
|
-
if (source != null && __getOwnPropSymbols$3)
|
|
4127
|
-
for (var prop of __getOwnPropSymbols$3(source))
|
|
4128
|
-
exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop) && (target[prop] = source[prop]);
|
|
4129
|
-
return target;
|
|
4130
|
-
};
|
|
4131
4050
|
const INITIAL_STATE = {
|
|
4132
4051
|
stagedUpload: null,
|
|
4133
4052
|
uploadStatus: null,
|
|
4134
4053
|
error: null
|
|
4135
4054
|
};
|
|
4136
4055
|
function Uploader(props) {
|
|
4137
|
-
var _a;
|
|
4138
4056
|
const toast = useToast(), containerRef = useRef(null), dragEnteredEls = useRef([]), [dragState, setDragState] = useState(null), cancelUploadButton = useRef(
|
|
4139
4057
|
(() => {
|
|
4140
4058
|
const events$ = new Subject();
|
|
@@ -4145,31 +4063,33 @@ function Uploader(props) {
|
|
|
4145
4063
|
})()
|
|
4146
4064
|
).current, uploadRef = useRef(null), [state, dispatch] = useReducer(
|
|
4147
4065
|
(prev, action) => {
|
|
4148
|
-
var _b, _c;
|
|
4149
4066
|
switch (action.action) {
|
|
4150
4067
|
case "stageUpload":
|
|
4151
4068
|
return Object.assign({}, INITIAL_STATE, { stagedUpload: action.input });
|
|
4152
4069
|
case "commitUpload":
|
|
4153
4070
|
return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
|
|
4154
4071
|
case "progressInfo": {
|
|
4155
|
-
const
|
|
4072
|
+
const { ...payload } = action;
|
|
4156
4073
|
return Object.assign({}, prev, {
|
|
4157
|
-
uploadStatus:
|
|
4158
|
-
|
|
4159
|
-
|
|
4074
|
+
uploadStatus: {
|
|
4075
|
+
...prev.uploadStatus,
|
|
4076
|
+
progress: prev.uploadStatus.progress,
|
|
4077
|
+
...payload
|
|
4078
|
+
}
|
|
4160
4079
|
});
|
|
4161
4080
|
}
|
|
4162
4081
|
case "progress":
|
|
4163
4082
|
return Object.assign({}, prev, {
|
|
4164
|
-
uploadStatus:
|
|
4083
|
+
uploadStatus: {
|
|
4084
|
+
...prev.uploadStatus,
|
|
4165
4085
|
progress: action.percent
|
|
4166
|
-
}
|
|
4086
|
+
}
|
|
4167
4087
|
});
|
|
4168
4088
|
case "reset":
|
|
4169
4089
|
case "complete":
|
|
4170
|
-
return
|
|
4090
|
+
return uploadRef.current?.unsubscribe(), uploadRef.current = null, INITIAL_STATE;
|
|
4171
4091
|
case "error":
|
|
4172
|
-
return
|
|
4092
|
+
return uploadRef.current?.unsubscribe(), uploadRef.current = null, Object.assign({}, INITIAL_STATE, { error: action.error });
|
|
4173
4093
|
default:
|
|
4174
4094
|
return prev;
|
|
4175
4095
|
}
|
|
@@ -4205,8 +4125,7 @@ function Uploader(props) {
|
|
|
4205
4125
|
takeUntil(
|
|
4206
4126
|
cancelUploadButton.observable.pipe(
|
|
4207
4127
|
tap(() => {
|
|
4208
|
-
|
|
4209
|
-
(_a2 = state.uploadStatus) != null && _a2.uuid && props.client.delete(state.uploadStatus.uuid);
|
|
4128
|
+
state.uploadStatus?.uuid && props.client.delete(state.uploadStatus.uuid);
|
|
4210
4129
|
})
|
|
4211
4130
|
)
|
|
4212
4131
|
)
|
|
@@ -4219,7 +4138,7 @@ function Uploader(props) {
|
|
|
4219
4138
|
case "uuid":
|
|
4220
4139
|
case "file":
|
|
4221
4140
|
case "url":
|
|
4222
|
-
dispatch(
|
|
4141
|
+
dispatch({ action: "progressInfo", ...event });
|
|
4223
4142
|
break;
|
|
4224
4143
|
case "progress":
|
|
4225
4144
|
dispatch({ action: "progress", percent: event.percent });
|
|
@@ -4260,17 +4179,16 @@ function Uploader(props) {
|
|
|
4260
4179
|
}, handleDragOver = (event) => {
|
|
4261
4180
|
event.preventDefault(), event.stopPropagation();
|
|
4262
4181
|
}, handleDragEnter = (event) => {
|
|
4263
|
-
var _a2, _b;
|
|
4264
4182
|
event.stopPropagation(), dragEnteredEls.current.push(event.target);
|
|
4265
|
-
const type =
|
|
4266
|
-
setDragState(type
|
|
4183
|
+
const type = event.dataTransfer.items?.[0]?.type;
|
|
4184
|
+
setDragState(type?.startsWith("video/") ? "valid" : "invalid");
|
|
4267
4185
|
}, handleDragLeave = (event) => {
|
|
4268
4186
|
event.stopPropagation();
|
|
4269
4187
|
const idx = dragEnteredEls.current.indexOf(event.target);
|
|
4270
4188
|
idx > -1 && dragEnteredEls.current.splice(idx, 1), dragEnteredEls.current.length === 0 && setDragState(null);
|
|
4271
4189
|
};
|
|
4272
4190
|
if (state.error !== null) {
|
|
4273
|
-
const error = {
|
|
4191
|
+
const error = {};
|
|
4274
4192
|
return /* @__PURE__ */ jsxs(Flex, { gap: 3, direction: "column", justify: "center", align: "center", children: [
|
|
4275
4193
|
/* @__PURE__ */ jsx(Text, { size: 5, muted: !0, children: /* @__PURE__ */ jsx(ErrorOutlineIcon, {}) }),
|
|
4276
4194
|
/* @__PURE__ */ jsx(Text, { children: "Something went wrong" }),
|
|
@@ -4285,7 +4203,7 @@ function Uploader(props) {
|
|
|
4285
4203
|
{
|
|
4286
4204
|
onCancel: cancelUploadButton.handleClick,
|
|
4287
4205
|
progress: uploadStatus.progress,
|
|
4288
|
-
filename:
|
|
4206
|
+
filename: uploadStatus.file?.name || uploadStatus.url
|
|
4289
4207
|
}
|
|
4290
4208
|
);
|
|
4291
4209
|
}
|
|
@@ -4313,20 +4231,27 @@ function Uploader(props) {
|
|
|
4313
4231
|
onPaste: handlePaste,
|
|
4314
4232
|
ref: containerRef,
|
|
4315
4233
|
children: props.asset ? /* @__PURE__ */ jsx(
|
|
4316
|
-
|
|
4234
|
+
DialogStateProvider,
|
|
4317
4235
|
{
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
PlayerActionsMenu$1,
|
|
4236
|
+
dialogState: props.dialogState,
|
|
4237
|
+
setDialogState: props.setDialogState,
|
|
4238
|
+
children: /* @__PURE__ */ jsx(
|
|
4239
|
+
Player,
|
|
4323
4240
|
{
|
|
4241
|
+
readOnly: props.readOnly,
|
|
4324
4242
|
asset: props.asset,
|
|
4325
|
-
dialogState: props.dialogState,
|
|
4326
|
-
setDialogState: props.setDialogState,
|
|
4327
4243
|
onChange: props.onChange,
|
|
4328
|
-
|
|
4329
|
-
|
|
4244
|
+
buttons: /* @__PURE__ */ jsx(
|
|
4245
|
+
PlayerActionsMenu$1,
|
|
4246
|
+
{
|
|
4247
|
+
asset: props.asset,
|
|
4248
|
+
dialogState: props.dialogState,
|
|
4249
|
+
setDialogState: props.setDialogState,
|
|
4250
|
+
onChange: props.onChange,
|
|
4251
|
+
onSelect: handleUpload,
|
|
4252
|
+
readOnly: props.readOnly
|
|
4253
|
+
}
|
|
4254
|
+
)
|
|
4330
4255
|
}
|
|
4331
4256
|
)
|
|
4332
4257
|
}
|
|
@@ -4352,24 +4277,16 @@ function Uploader(props) {
|
|
|
4352
4277
|
)
|
|
4353
4278
|
] });
|
|
4354
4279
|
}
|
|
4355
|
-
var __defProp$2 = Object.defineProperty, __defProps = Object.defineProperties, __getOwnPropDescs = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2 = Object.getOwnPropertySymbols, __hasOwnProp$2 = Object.prototype.hasOwnProperty, __propIsEnum$2 = Object.prototype.propertyIsEnumerable, __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$2 = (a2, b) => {
|
|
4356
|
-
for (var prop in b || (b = {}))
|
|
4357
|
-
__hasOwnProp$2.call(b, prop) && __defNormalProp$2(a2, prop, b[prop]);
|
|
4358
|
-
if (__getOwnPropSymbols$2)
|
|
4359
|
-
for (var prop of __getOwnPropSymbols$2(b))
|
|
4360
|
-
__propIsEnum$2.call(b, prop) && __defNormalProp$2(a2, prop, b[prop]);
|
|
4361
|
-
return a2;
|
|
4362
|
-
}, __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
4363
4280
|
const Input = (props) => {
|
|
4364
|
-
|
|
4365
|
-
const client = useClient(), secretDocumentValues = useSecretsDocumentValues(), assetDocumentValues = useAssetDocumentValues((_a = props.value) == null ? void 0 : _a.asset), poll = useMuxPolling(props.readOnly ? void 0 : (assetDocumentValues == null ? void 0 : assetDocumentValues.value) || void 0), [dialogState, setDialogState] = useDialogState(), error = secretDocumentValues.error || assetDocumentValues.error || poll.error;
|
|
4281
|
+
const client = useClient(), secretDocumentValues = useSecretsDocumentValues(), assetDocumentValues = useAssetDocumentValues(props.value?.asset), poll = useMuxPolling(props.readOnly ? void 0 : assetDocumentValues?.value || void 0), [dialogState, setDialogState] = useDialogState(), error = secretDocumentValues.error || assetDocumentValues.error || poll.error;
|
|
4366
4282
|
if (error)
|
|
4367
4283
|
throw error;
|
|
4368
4284
|
const isLoading = secretDocumentValues.isLoading || assetDocumentValues.isLoading;
|
|
4369
4285
|
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(ErrorBoundaryCard$1, { schemaType: props.schemaType, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(InputFallback, {}), children: isLoading ? /* @__PURE__ */ jsx(InputFallback, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4370
4286
|
secretDocumentValues.value.needsSetup && !assetDocumentValues.value ? /* @__PURE__ */ jsx(Onboard, { setDialogState }) : /* @__PURE__ */ jsx(
|
|
4371
4287
|
Uploader,
|
|
4372
|
-
|
|
4288
|
+
{
|
|
4289
|
+
...props,
|
|
4373
4290
|
config: props.config,
|
|
4374
4291
|
onChange: props.onChange,
|
|
4375
4292
|
client,
|
|
@@ -4378,7 +4295,7 @@ const Input = (props) => {
|
|
|
4378
4295
|
dialogState,
|
|
4379
4296
|
setDialogState,
|
|
4380
4297
|
needsSetup: secretDocumentValues.value.needsSetup
|
|
4381
|
-
}
|
|
4298
|
+
}
|
|
4382
4299
|
),
|
|
4383
4300
|
dialogState === "secrets" && /* @__PURE__ */ jsx(
|
|
4384
4301
|
ConfigureApi$1,
|
|
@@ -4389,18 +4306,11 @@ const Input = (props) => {
|
|
|
4389
4306
|
)
|
|
4390
4307
|
] }) }) }) });
|
|
4391
4308
|
};
|
|
4392
|
-
var Input$1 = memo(Input)
|
|
4393
|
-
for (var prop in b || (b = {}))
|
|
4394
|
-
__hasOwnProp$1.call(b, prop) && __defNormalProp$1(a2, prop, b[prop]);
|
|
4395
|
-
if (__getOwnPropSymbols$1)
|
|
4396
|
-
for (var prop of __getOwnPropSymbols$1(b))
|
|
4397
|
-
__propIsEnum$1.call(b, prop) && __defNormalProp$1(a2, prop, b[prop]);
|
|
4398
|
-
return a2;
|
|
4399
|
-
};
|
|
4309
|
+
var Input$1 = memo(Input);
|
|
4400
4310
|
function muxVideoCustomRendering(config) {
|
|
4401
4311
|
return {
|
|
4402
4312
|
components: {
|
|
4403
|
-
input: (props) => /* @__PURE__ */ jsx(Input$1,
|
|
4313
|
+
input: (props) => /* @__PURE__ */ jsx(Input$1, { config: { ...config, ...props.schemaType.options }, ...props })
|
|
4404
4314
|
},
|
|
4405
4315
|
preview: {
|
|
4406
4316
|
select: {
|
|
@@ -4588,16 +4498,7 @@ const muxVideoSchema = {
|
|
|
4588
4498
|
muxStaticRenditions,
|
|
4589
4499
|
muxAssetData,
|
|
4590
4500
|
muxVideoAsset
|
|
4591
|
-
]
|
|
4592
|
-
var __defProp = Object.defineProperty, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a2, b) => {
|
|
4593
|
-
for (var prop in b || (b = {}))
|
|
4594
|
-
__hasOwnProp.call(b, prop) && __defNormalProp(a2, prop, b[prop]);
|
|
4595
|
-
if (__getOwnPropSymbols)
|
|
4596
|
-
for (var prop of __getOwnPropSymbols(b))
|
|
4597
|
-
__propIsEnum.call(b, prop) && __defNormalProp(a2, prop, b[prop]);
|
|
4598
|
-
return a2;
|
|
4599
|
-
};
|
|
4600
|
-
const defaultConfig = {
|
|
4501
|
+
], defaultConfig = {
|
|
4601
4502
|
mp4_support: "none",
|
|
4602
4503
|
encoding_tier: "smart",
|
|
4603
4504
|
max_resolution_tier: "1080p",
|
|
@@ -4605,13 +4506,16 @@ const defaultConfig = {
|
|
|
4605
4506
|
defaultSigned: !1,
|
|
4606
4507
|
tool: DEFAULT_TOOL_CONFIG
|
|
4607
4508
|
}, muxInput = definePlugin((userConfig) => {
|
|
4608
|
-
const config =
|
|
4509
|
+
const config = { ...defaultConfig, ...userConfig || {} };
|
|
4609
4510
|
return {
|
|
4610
4511
|
name: "mux-input",
|
|
4611
4512
|
schema: {
|
|
4612
4513
|
types: [
|
|
4613
4514
|
...schemaTypes,
|
|
4614
|
-
|
|
4515
|
+
{
|
|
4516
|
+
...muxVideoSchema,
|
|
4517
|
+
...muxVideoCustomRendering(config)
|
|
4518
|
+
}
|
|
4615
4519
|
]
|
|
4616
4520
|
},
|
|
4617
4521
|
tools: config.tool === !1 ? void 0 : [createStudioTool(config)]
|