sanity-plugin-mux-input 2.3.3 → 2.3.5

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.
@@ -1,7 +1,7 @@
1
1
  import { useClient as useClient$1, createHookFromObservableFactory, useDocumentStore, collate, useDocumentValues, 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, RetrieveIcon, RetryIcon, CheckmarkCircleIcon, SortIcon, WarningOutlineIcon, EditIcon, PublishIcon, DocumentIcon, TrashIcon, CheckmarkIcon, RevertIcon, SearchIcon, ClockIcon, CropIcon, CalendarIcon, TagIcon, LockIcon, PlayIcon, PlugIcon, UploadIcon, ResetIcon, EllipsisHorizontalIcon, AddIcon, TranslateIcon, DocumentVideoIcon } from "@sanity/icons";
4
- import { Card, Box, Spinner, Stack, Text, Checkbox, Button, Dialog, Flex, Heading, Code, MenuButton, Menu, MenuItem, Tooltip, Inline, useToast, TabList, Tab, TabPanel, TextInput, Label as Label$1, Grid, useClickOutside, Popover, MenuDivider, Radio, Autocomplete, rem } from "@sanity/ui";
3
+ import { ErrorOutlineIcon, RetrieveIcon, RetryIcon, CheckmarkCircleIcon, SortIcon, WarningOutlineIcon, EditIcon, PublishIcon, DocumentIcon, TrashIcon, CheckmarkIcon, RevertIcon, SearchIcon, ClockIcon, CropIcon, CalendarIcon, TagIcon, LockIcon, PlayIcon, PlugIcon, UploadIcon, ResetIcon, EllipsisHorizontalIcon, TranslateIcon, DocumentVideoIcon } from "@sanity/icons";
4
+ import { Card, Box, Spinner, Stack, Text, Checkbox, Button, Dialog, Flex, Heading, Code, MenuButton, Menu, MenuItem, Tooltip, Inline, useToast, TabList, Tab, TabPanel, TextInput, Label as Label$1, Grid, useClickOutside, Popover, MenuDivider, Autocomplete, Radio, rem } from "@sanity/ui";
5
5
  import React, { useState, useMemo, useEffect, useRef, useId, memo, isValidElement, useCallback, useReducer, createElement, forwardRef, Suspense } from "react";
6
6
  import compact from "lodash/compact.js";
7
7
  import toLower from "lodash/toLower.js";
@@ -161,8 +161,7 @@ function hasMorePages(pageResult) {
161
161
  function useMuxAssets({ secrets, enabled }) {
162
162
  const [state, setState] = useState({ loading: !0, pageNum: FIRST_PAGE });
163
163
  return useEffect(() => {
164
- if (!enabled)
165
- return;
164
+ if (!enabled) return;
166
165
  const subscription = defer(
167
166
  () => fetchMuxAssetsPage(
168
167
  secrets,
@@ -191,7 +190,7 @@ function useMuxAssets({ secrets, enabled }) {
191
190
  return () => subscription.unsubscribe();
192
191
  }, [enabled]), state;
193
192
  }
194
- const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumentId = "secrets.mux", DIALOGS_Z_INDEX = 6e4, THUMBNAIL_ASPECT_RATIO = 1.7777777777777777, MIN_ASPECT_RATIO = 5 / 4, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
193
+ const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumentId = "secrets.mux", DIALOGS_Z_INDEX = 6e4, THUMBNAIL_ASPECT_RATIO = 1.7777777777777777, MIN_ASPECT_RATIO = 5 / 4, AUDIO_ASPECT_RATIO = 5 / 1, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
195
194
  const { error, isLoading, value } = useDocumentValues(
196
195
  muxSecretsDocumentId,
197
196
  path$1
@@ -225,7 +224,7 @@ function useImportMuxAssets() {
225
224
  };
226
225
  async function importAssets() {
227
226
  setImportState("importing");
228
- const documents = selectedAssets.map(muxAssetToSanityDocument), tx = client.transaction();
227
+ const documents = selectedAssets.flatMap((asset) => muxAssetToSanityDocument(asset) || []), tx = client.transaction();
229
228
  documents.forEach((doc) => tx.create(doc));
230
229
  try {
231
230
  await tx.commit({ returnDocuments: !1 }), setSelectedAssets([]), setImportState("done");
@@ -250,17 +249,19 @@ function useImportMuxAssets() {
250
249
  }
251
250
  function muxAssetToSanityDocument(asset) {
252
251
  var _a;
253
- return {
254
- _id: uuid(),
255
- _type: "mux.videoAsset",
256
- _updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
257
- _createdAt: parseMuxDate(asset.created_at).toISOString(),
258
- assetId: asset.id,
259
- playbackId: (_a = asset.playback_ids.find((p) => p.id)) == null ? void 0 : _a.id,
260
- filename: `Asset #${truncateString(asset.id, 15)}`,
261
- status: asset.status,
262
- data: asset
263
- };
252
+ const playbackId = (_a = (asset.playback_ids || []).find((p) => p.id)) == null ? void 0 : _a.id;
253
+ if (playbackId)
254
+ return {
255
+ _id: uuid(),
256
+ _type: "mux.videoAsset",
257
+ _updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
258
+ _createdAt: parseMuxDate(asset.created_at).toISOString(),
259
+ assetId: asset.id,
260
+ playbackId,
261
+ filename: `Asset #${truncateString(asset.id, 15)}`,
262
+ status: asset.status,
263
+ data: asset
264
+ };
264
265
  }
265
266
  const useAssetsInSanity = createHookFromObservableFactory(
266
267
  (documentStore) => documentStore.listenQuery(
@@ -283,8 +284,7 @@ function assetExistsInSanity(asset, existingAssets) {
283
284
  function useInView(options = {}) {
284
285
  const [inView, setInView] = useState(!1), ref = useRef(null);
285
286
  return useEffect(() => {
286
- if (!ref.current)
287
- return;
287
+ if (!ref.current) return;
288
288
  const observer = new IntersectionObserver(([entry], obs) => {
289
289
  var _a;
290
290
  const nowInView = entry.isIntersecting && obs.thresholds.some((threshold) => entry.intersectionRatio >= threshold);
@@ -322,9 +322,9 @@ function readSecrets(client) {
322
322
  function generateJwt(client, playbackId, aud, payload) {
323
323
  const { signingKeyId, signingKeyPrivate } = readSecrets(client);
324
324
  if (!signingKeyId)
325
- throw new TypeError("Missing signingKeyId");
325
+ throw new TypeError("Missing `signingKeyId`.\n Check your plugin's configuration");
326
326
  if (!signingKeyPrivate)
327
- throw new TypeError("Missing signingKeyPrivate");
327
+ throw new TypeError("Missing `signingKeyPrivate`.\n Check your plugin's configuration");
328
328
  const { default: sign } = suspend(() => import("jsonwebtoken-esm/sign"), ["jsonwebtoken-esm/sign"]);
329
329
  return sign(
330
330
  payload ? JSON.parse(JSON.stringify(payload, (_, v) => v != null ? v : void 0)) : {},
@@ -775,7 +775,7 @@ function VideoPlayer({
775
775
  ...props
776
776
  }) {
777
777
  var _a, _b;
778
- const client = useClient(), { src: videoSrc, error } = useMemo(() => {
778
+ const client = useClient(), isAudio = assetIsAudio(asset), { src: videoSrc, error } = useMemo(() => {
779
779
  try {
780
780
  const src = (asset == null ? void 0 : asset.playbackId) && getVideoSrc({ client, asset });
781
781
  return src ? { src } : { error: new TypeError("Asset has no playback ID") };
@@ -788,8 +788,12 @@ function VideoPlayer({
788
788
  } catch {
789
789
  return !1;
790
790
  }
791
- }, [videoSrc]), [width, height] = ((_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.aspect_ratio) != null ? _b : "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height), aspectRatio = Math.max(MIN_ASPECT_RATIO, targetAspectRatio);
792
- return /* @__PURE__ */ jsxs(Card, { tone: "transparent", style: { aspectRatio, position: "relative" }, children: [
791
+ }, [videoSrc]), [width, height] = ((_b = (_a = asset == null ? void 0 : asset.data) == null ? void 0 : _a.aspect_ratio) != null ? _b : "16:9").split(":").map(Number), targetAspectRatio = props.forceAspectRatio || (Number.isNaN(width) ? 16 / 9 : width / height);
792
+ let aspectRatio = Math.max(MIN_ASPECT_RATIO, targetAspectRatio);
793
+ return isAudio && (aspectRatio = props.forceAspectRatio ? (
794
+ // Make it wider when forcing aspect ratio to balance with videos' rendering height (audio players overflow a bit)
795
+ props.forceAspectRatio * 1.2
796
+ ) : AUDIO_ASPECT_RATIO), /* @__PURE__ */ jsxs(Card, { tone: "transparent", style: { aspectRatio, position: "relative" }, children: [
793
797
  videoSrc && /* @__PURE__ */ jsxs(Fragment, { children: [
794
798
  /* @__PURE__ */ jsx(
795
799
  MuxPlayer,
@@ -802,9 +806,10 @@ function VideoPlayer({
802
806
  crossOrigin: "anonymous",
803
807
  metadata: {
804
808
  player_name: "Sanity Admin Dashboard",
805
- player_version: "2.3.3",
809
+ player_version: "2.3.5",
806
810
  page_type: "Preview Player"
807
811
  },
812
+ audio: isAudio,
808
813
  style: {
809
814
  height: "100%",
810
815
  width: "100%",
@@ -833,6 +838,10 @@ function VideoPlayer({
833
838
  children
834
839
  ] });
835
840
  }
841
+ function assetIsAudio(asset) {
842
+ var _a;
843
+ return ((_a = asset.data) == null ? void 0 : _a.max_stored_resolution) === "Audio only";
844
+ }
836
845
  function deleteAssetOnMux(client, assetId) {
837
846
  const { dataset } = client.config();
838
847
  return client.request({
@@ -846,8 +855,7 @@ async function deleteAsset({
846
855
  asset,
847
856
  deleteOnMux
848
857
  }) {
849
- if (!(asset != null && asset._id))
850
- return !0;
858
+ if (!(asset != null && asset._id)) return !0;
851
859
  try {
852
860
  await client.delete(asset._id);
853
861
  } catch {
@@ -1038,8 +1046,7 @@ function DeleteDialog({
1038
1046
  state !== "checkingReferences" || referencesLoading || setState(references != null && references.length ? "cantDelete" : "confirm");
1039
1047
  }, [state, references, referencesLoading]);
1040
1048
  async function confirmDelete() {
1041
- if (state !== "confirm")
1042
- return;
1049
+ if (state !== "confirm") return;
1043
1050
  setState("processing_deletion");
1044
1051
  const worked = await deleteAsset({ client, asset, deleteOnMux });
1045
1052
  worked === !0 ? (toast.push({ title: "Successfully deleted video", status: "success" }), succeededDeleting()) : worked === "failed-mux" ? (toast.push({
@@ -1628,7 +1635,25 @@ function VideoInBrowser({
1628
1635
  children: [
1629
1636
  renderVideo ? /* @__PURE__ */ jsx(VideoPlayer, { asset, autoPlay: !0, forceAspectRatio: THUMBNAIL_ASPECT_RATIO }) : /* @__PURE__ */ jsxs(PlayButton, { onClick: () => setRenderVideo(!0), children: [
1630
1637
  /* @__PURE__ */ jsx("div", { "data-play": !0, children: /* @__PURE__ */ jsx(PlayIcon, {}) }),
1631
- /* @__PURE__ */ jsx(VideoThumbnail, { asset })
1638
+ assetIsAudio(asset) ? /* @__PURE__ */ jsx(
1639
+ "div",
1640
+ {
1641
+ style: {
1642
+ aspectRatio: THUMBNAIL_ASPECT_RATIO,
1643
+ display: "flex",
1644
+ alignItems: "center",
1645
+ justifyContent: "center"
1646
+ },
1647
+ children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "3em", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(
1648
+ "path",
1649
+ {
1650
+ fill: "currentColor",
1651
+ style: { opacity: "0.65" },
1652
+ d: "M10.75 19q.95 0 1.6-.65t.65-1.6V13h3v-2h-4v3.875q-.275-.2-.587-.288t-.663-.087q-.95 0-1.6.65t-.65 1.6t.65 1.6t1.6.65M6 22q-.825 0-1.412-.587T4 20V4q0-.825.588-1.412T6 2h8l6 6v12q0 .825-.587 1.413T18 22zm7-13V4H6v16h12V9zM6 4v5zv16z"
1653
+ }
1654
+ ) })
1655
+ }
1656
+ ) : /* @__PURE__ */ jsx(VideoThumbnail, { asset })
1632
1657
  ] }),
1633
1658
  /* @__PURE__ */ jsx(VideoMetadata, { asset }),
1634
1659
  /* @__PURE__ */ jsxs(
@@ -3360,47 +3385,45 @@ const ALL_LANGUAGE_CODES = LanguagesList.getAllCodes().map((code) => ({
3360
3385
  })),
3361
3386
  subtitles: ALL_LANGUAGE_CODES,
3362
3387
  captions: ALL_LANGUAGE_CODES
3363
- }, TRACK_TYPES = [
3364
- { value: "autogenerated", label: "Auto-generated Subtitles" }
3365
- // {value: 'subtitles', label: 'Subtitles'},
3366
- // {value: 'captions', label: 'Closed Captions'},
3367
- ];
3368
- function TrackEditor({
3369
- canAutoGenerate,
3370
- track,
3371
- dispatch
3388
+ };
3389
+ function TextTracksEditor({
3390
+ tracks,
3391
+ dispatch,
3392
+ defaultLang
3372
3393
  }) {
3373
- const { _id: id, type } = track, dispatchTrackAction = (args) => dispatch({ action: "track", id, ...args }), trackTypes = TRACK_TYPES.filter(
3374
- ({ value }) => !(value === "autogenerated" && !canAutoGenerate)
3375
- );
3376
- return trackTypes.length === 0 ? null : /* @__PURE__ */ jsx(Card, { border: !0, padding: 3, radius: 2, style: { position: "relative" }, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3377
- trackTypes.length > 1 && /* @__PURE__ */ jsx(FormField$2, { title: "Auto-generated subtitles", children: /* @__PURE__ */ jsx(Flex, { gap: 3, children: trackTypes.map(({ value, label }) => {
3378
- const inputId = `${id}--type-${value}`;
3379
- return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 2, children: [
3380
- /* @__PURE__ */ jsx(
3381
- Radio,
3382
- {
3383
- checked: type === value,
3384
- name: "track-type",
3385
- onChange: (e) => dispatchTrackAction({
3386
- subAction: "update",
3394
+ const track = tracks[0];
3395
+ return /* @__PURE__ */ jsx(FormField$2, { title: "Auto-generated subtitle or caption", children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
3396
+ /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
3397
+ /* @__PURE__ */ jsx(
3398
+ Checkbox,
3399
+ {
3400
+ id: "include-autogenerated-track",
3401
+ style: { display: "block" },
3402
+ checked: !!(track != null && track.language_code),
3403
+ onChange: () => {
3404
+ dispatch(track ? { action: "track", id: track._id, subAction: "delete" } : {
3405
+ action: "track",
3406
+ id: uuid(),
3407
+ subAction: "add",
3387
3408
  value: {
3388
- type: e.currentTarget.value
3409
+ type: "autogenerated",
3410
+ name: defaultLang || void 0,
3411
+ language_code: defaultLang || void 0
3389
3412
  }
3390
- }),
3391
- value,
3392
- id: inputId
3413
+ });
3393
3414
  }
3394
- ),
3395
- /* @__PURE__ */ jsx(Text, { as: "label", htmlFor: inputId, children: label })
3396
- ] }, value);
3397
- }) }) }),
3398
- /* @__PURE__ */ jsx(
3415
+ }
3416
+ ),
3417
+ /* @__PURE__ */ jsx(Box, { flex: 1, paddingLeft: 3, children: /* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("label", { htmlFor: "checkbox", children: "Generate captions" }) }) })
3418
+ ] }),
3419
+ track && /* @__PURE__ */ jsx(
3399
3420
  Autocomplete,
3400
3421
  {
3401
- id: `${id}--language`,
3422
+ id: "text-tract-editor--language",
3402
3423
  value: track.language_code,
3403
- onChange: (newValue) => dispatchTrackAction({
3424
+ onChange: (newValue) => dispatch({
3425
+ action: "track",
3426
+ id: track._id,
3404
3427
  subAction: "update",
3405
3428
  value: {
3406
3429
  language_code: newValue,
@@ -3423,54 +3446,9 @@ function TrackEditor({
3423
3446
  ")"
3424
3447
  ] }) })
3425
3448
  }
3426
- ),
3427
- /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
3428
- Button,
3429
- {
3430
- icon: TrashIcon,
3431
- tone: "critical",
3432
- mode: "ghost",
3433
- onClick: () => dispatchTrackAction({ subAction: "delete" }),
3434
- text: "Delete"
3435
- }
3436
- ) })
3449
+ )
3437
3450
  ] }) });
3438
3451
  }
3439
- function TextTracksEditor({
3440
- canAutoGenerate,
3441
- tracks,
3442
- dispatch
3443
- }) {
3444
- return TRACK_TYPES.filter(
3445
- ({ value }) => !(value === "autogenerated" && !canAutoGenerate)
3446
- ).length === 0 ? null : /* @__PURE__ */ jsx(
3447
- FormField$2,
3448
- {
3449
- title: "Captions & Subtitles",
3450
- description: "Provide text tracks for video accessibility.",
3451
- children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
3452
- tracks.map((track) => /* @__PURE__ */ jsx(
3453
- TrackEditor,
3454
- {
3455
- canAutoGenerate,
3456
- track,
3457
- dispatch
3458
- },
3459
- track._id
3460
- )),
3461
- /* @__PURE__ */ jsx(
3462
- Button,
3463
- {
3464
- icon: AddIcon,
3465
- onClick: () => dispatch({ action: "track", id: uuid(), subAction: "add" }),
3466
- text: "New caption/subtitle",
3467
- mode: "ghost"
3468
- }
3469
- )
3470
- ] })
3471
- }
3472
- );
3473
- }
3474
3452
  const ENCODING_OPTIONS = [
3475
3453
  { value: "smart", label: "Smart" },
3476
3454
  { value: "baseline", label: "Baseline" }
@@ -3486,26 +3464,25 @@ function UploadConfiguration({
3486
3464
  startUpload,
3487
3465
  onClose
3488
3466
  }) {
3489
- var _a;
3490
3467
  const id = useId(), autoTextTracks = useRef(
3491
- pluginConfig.encoding_tier === "smart" && ((_a = pluginConfig.defaultAutogeneratedSubtitleLangs) == null ? void 0 : _a.map(
3492
- (language_code) => ({
3468
+ pluginConfig.encoding_tier === "smart" && pluginConfig.defaultAutogeneratedSubtitleLang ? [
3469
+ {
3493
3470
  _id: uuid(),
3494
3471
  type: "autogenerated",
3495
- language_code,
3496
- name: LanguagesList.getNativeName(language_code)
3497
- })
3498
- )) || []
3472
+ language_code: pluginConfig.defaultAutogeneratedSubtitleLang,
3473
+ name: LanguagesList.getNativeName(pluginConfig.defaultAutogeneratedSubtitleLang)
3474
+ }
3475
+ ] : []
3499
3476
  ).current, [config, dispatch] = useReducer(
3500
3477
  (prev, action) => {
3501
- var _a2;
3478
+ var _a;
3502
3479
  switch (action.action) {
3503
3480
  case "encoding_tier":
3504
3481
  return action.value === "baseline" ? Object.assign({}, prev, {
3505
3482
  encoding_tier: action.value,
3506
3483
  mp4_support: "none",
3507
3484
  max_resolution_tier: "1080p",
3508
- text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type }) => type !== "autogenerated")
3485
+ text_tracks: (_a = prev.text_tracks) == null ? void 0 : _a.filter(({ type }) => type !== "autogenerated")
3509
3486
  }) : Object.assign({}, prev, {
3510
3487
  encoding_tier: action.value,
3511
3488
  mp4_support: pluginConfig.mp4_support,
@@ -3521,23 +3498,21 @@ function UploadConfiguration({
3521
3498
  const text_tracks = [...prev.text_tracks], target_track_i = text_tracks.findIndex(({ _id: _id2 }) => _id2 === action.id);
3522
3499
  switch (action.subAction) {
3523
3500
  case "add":
3524
- if (target_track_i !== -1)
3525
- break;
3526
- text_tracks.push(
3527
- prev.encoding_tier === "smart" ? { _id: action.id, type: "autogenerated" } : { _id: action.id, type: "subtitles" }
3528
- );
3501
+ if (target_track_i !== -1) break;
3502
+ text_tracks.push({
3503
+ _id: action.id,
3504
+ ...action.value
3505
+ });
3529
3506
  break;
3530
3507
  case "update":
3531
- if (target_track_i === -1)
3532
- break;
3508
+ if (target_track_i === -1) break;
3533
3509
  text_tracks[target_track_i] = {
3534
3510
  ...text_tracks[target_track_i],
3535
3511
  ...action.value
3536
3512
  };
3537
3513
  break;
3538
3514
  case "delete":
3539
- if (target_track_i === -1)
3540
- break;
3515
+ if (target_track_i === -1) break;
3541
3516
  text_tracks.splice(target_track_i, 1);
3542
3517
  break;
3543
3518
  }
@@ -3558,8 +3533,7 @@ function UploadConfiguration({
3558
3533
  ), { disableTextTrackConfig, disableUploadConfig } = pluginConfig, skipConfig = disableTextTrackConfig && disableUploadConfig;
3559
3534
  if (useEffect(() => {
3560
3535
  skipConfig && startUpload(formatUploadConfig(config));
3561
- }, []), skipConfig)
3562
- return null;
3536
+ }, []), skipConfig) return null;
3563
3537
  const maxSupportedResolution = RESOLUTION_TIERS.findIndex(
3564
3538
  (rt) => rt.value === pluginConfig.max_resolution_tier
3565
3539
  );
@@ -3708,15 +3682,15 @@ function UploadConfiguration({
3708
3682
  ] })
3709
3683
  ] }) })
3710
3684
  ] }),
3711
- !disableTextTrackConfig && /* @__PURE__ */ jsx(
3685
+ !disableTextTrackConfig && config.encoding_tier === "smart" && /* @__PURE__ */ jsx(
3712
3686
  TextTracksEditor,
3713
3687
  {
3714
- canAutoGenerate: config.encoding_tier === "smart",
3715
3688
  tracks: config.text_tracks,
3716
- dispatch
3689
+ dispatch,
3690
+ defaultLang: pluginConfig.defaultAutogeneratedSubtitleLang
3717
3691
  }
3718
3692
  ),
3719
- /* @__PURE__ */ jsx(
3693
+ /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(
3720
3694
  Button,
3721
3695
  {
3722
3696
  icon: UploadIcon,
@@ -3724,7 +3698,7 @@ function UploadConfiguration({
3724
3698
  tone: "positive",
3725
3699
  onClick: () => startUpload(formatUploadConfig(config))
3726
3700
  }
3727
- )
3701
+ ) })
3728
3702
  ] })
3729
3703
  }
3730
3704
  );
@@ -3982,8 +3956,7 @@ function Uploader(props) {
3982
3956
  }, []);
3983
3957
  const startUpload = (settings) => {
3984
3958
  const { stagedUpload } = state;
3985
- if (!stagedUpload || uploadRef.current)
3986
- return;
3959
+ if (!stagedUpload || uploadRef.current) return;
3987
3960
  dispatch({ action: "commitUpload" });
3988
3961
  let uploadObservable;
3989
3962
  switch (stagedUpload.type) {
@@ -4206,7 +4179,7 @@ function muxVideoCustomRendering(config) {
4206
4179
  }
4207
4180
  };
4208
4181
  }
4209
- const muxVideo = {
4182
+ const muxVideoSchema = {
4210
4183
  name: "mux.video",
4211
4184
  type: "object",
4212
4185
  title: "Video asset reference",
@@ -4219,6 +4192,122 @@ const muxVideo = {
4219
4192
  to: [{ type: "mux.videoAsset" }]
4220
4193
  }
4221
4194
  ]
4195
+ }, muxTrack = {
4196
+ name: "mux.track",
4197
+ type: "object",
4198
+ fields: [
4199
+ { type: "string", name: "id" },
4200
+ { type: "string", name: "type" },
4201
+ { type: "number", name: "max_width" },
4202
+ { type: "number", name: "max_frame_rate" },
4203
+ { type: "number", name: "duration" },
4204
+ { type: "number", name: "max_height" }
4205
+ ]
4206
+ }, muxPlaybackId = {
4207
+ name: "mux.playbackId",
4208
+ type: "object",
4209
+ fields: [
4210
+ { type: "string", name: "id" },
4211
+ { type: "string", name: "policy" }
4212
+ ]
4213
+ }, muxStaticRenditionFile = {
4214
+ name: "mux.staticRenditionFile",
4215
+ type: "object",
4216
+ fields: [
4217
+ { type: "string", name: "ext" },
4218
+ { type: "string", name: "name" },
4219
+ { type: "number", name: "width" },
4220
+ { type: "number", name: "bitrate" },
4221
+ { type: "number", name: "filesize" },
4222
+ { type: "number", name: "height" }
4223
+ ]
4224
+ }, muxStaticRenditions = {
4225
+ name: "mux.staticRenditions",
4226
+ type: "object",
4227
+ fields: [
4228
+ { type: "string", name: "status" },
4229
+ {
4230
+ name: "files",
4231
+ type: "array",
4232
+ of: [{ type: "mux.staticRenditionFile" }]
4233
+ }
4234
+ ]
4235
+ }, muxAssetData = {
4236
+ name: "mux.assetData",
4237
+ title: "Mux asset data",
4238
+ type: "object",
4239
+ fields: [
4240
+ {
4241
+ type: "string",
4242
+ name: "resolution_tier"
4243
+ },
4244
+ {
4245
+ type: "string",
4246
+ name: "upload_id"
4247
+ },
4248
+ {
4249
+ type: "string",
4250
+ name: "created_at"
4251
+ },
4252
+ {
4253
+ type: "string",
4254
+ name: "id"
4255
+ },
4256
+ {
4257
+ type: "string",
4258
+ name: "status"
4259
+ },
4260
+ {
4261
+ type: "string",
4262
+ name: "max_stored_resolution"
4263
+ },
4264
+ {
4265
+ type: "string",
4266
+ name: "passthrough"
4267
+ },
4268
+ {
4269
+ type: "string",
4270
+ name: "encoding_tier"
4271
+ },
4272
+ {
4273
+ type: "string",
4274
+ name: "master_access"
4275
+ },
4276
+ {
4277
+ type: "string",
4278
+ name: "aspect_ratio"
4279
+ },
4280
+ {
4281
+ type: "number",
4282
+ name: "duration"
4283
+ },
4284
+ {
4285
+ type: "number",
4286
+ name: "max_stored_frame_rate"
4287
+ },
4288
+ {
4289
+ type: "string",
4290
+ name: "mp4_support"
4291
+ },
4292
+ {
4293
+ type: "string",
4294
+ name: "max_resolution_tier"
4295
+ },
4296
+ {
4297
+ name: "tracks",
4298
+ type: "array",
4299
+ of: [{ type: "mux.track" }]
4300
+ },
4301
+ {
4302
+ name: "playback_ids",
4303
+ type: "array",
4304
+ of: [{ type: "mux.playbackId" }]
4305
+ },
4306
+ {
4307
+ name: "static_renditions",
4308
+ type: "mux.staticRenditions"
4309
+ }
4310
+ ]
4222
4311
  }, muxVideoAsset = {
4223
4312
  name: "mux.videoAsset",
4224
4313
  type: "object",
@@ -4243,9 +4332,20 @@ const muxVideo = {
4243
4332
  {
4244
4333
  type: "number",
4245
4334
  name: "thumbTime"
4335
+ },
4336
+ {
4337
+ type: "mux.assetData",
4338
+ name: "data"
4246
4339
  }
4247
4340
  ]
4248
- }, defaultConfig = {
4341
+ }, schemaTypes = [
4342
+ muxTrack,
4343
+ muxPlaybackId,
4344
+ muxStaticRenditionFile,
4345
+ muxStaticRenditions,
4346
+ muxAssetData,
4347
+ muxVideoAsset
4348
+ ], defaultConfig = {
4249
4349
  mp4_support: "none",
4250
4350
  encoding_tier: "smart",
4251
4351
  max_resolution_tier: "1080p",
@@ -4258,9 +4358,9 @@ const muxVideo = {
4258
4358
  name: "mux-input",
4259
4359
  schema: {
4260
4360
  types: [
4261
- muxVideoAsset,
4361
+ ...schemaTypes,
4262
4362
  {
4263
- ...muxVideo,
4363
+ ...muxVideoSchema,
4264
4364
  ...muxVideoCustomRendering(config)
4265
4365
  }
4266
4366
  ]
@@ -4272,4 +4372,4 @@ export {
4272
4372
  defaultConfig,
4273
4373
  muxInput
4274
4374
  };
4275
- //# sourceMappingURL=index.js.map
4375
+ //# sourceMappingURL=index.mjs.map