sanity-plugin-mux-input 2.3.2 → 2.3.4
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/lib/index.cjs +81 -167
- package/lib/index.cjs.map +1 -1
- package/lib/index.esm.js +81 -168
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +81 -168
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/VideoPlayer.tsx +1 -2
package/lib/index.cjs
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
mod
|
|
20
20
|
));
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
22
|
-
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"), compact = require("lodash/compact.js"), toLower = require("lodash/toLower.js"), trim = require("lodash/trim.js"), uniq = require("lodash/uniq.js"), words = require("lodash/words.js"), styledComponents = require("styled-components"), uuid = require("@sanity/uuid"), rxjs = require("rxjs"), operators = require("rxjs/operators"), suspendReact = require("suspend-react"), MuxPlayer = require("@mux/mux-player-react"), desk = require("sanity/desk"), router = require("sanity/router"), isNumber = require("lodash/isNumber.js"), isString = require("lodash/isString.js"), reactRx = require("react-rx"), useSWR = require("swr"), scrollIntoView = require("scroll-into-view-if-needed"),
|
|
22
|
+
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"), compact = require("lodash/compact.js"), toLower = require("lodash/toLower.js"), trim = require("lodash/trim.js"), uniq = require("lodash/uniq.js"), words = require("lodash/words.js"), styledComponents = require("styled-components"), uuid = require("@sanity/uuid"), rxjs = require("rxjs"), operators = require("rxjs/operators"), suspendReact = require("suspend-react"), MuxPlayer = require("@mux/mux-player-react"), desk = require("sanity/desk"), router = require("sanity/router"), isNumber = require("lodash/isNumber.js"), isString = require("lodash/isString.js"), reactRx = require("react-rx"), useSWR = require("swr"), scrollIntoView = require("scroll-into-view-if-needed"), upchunk = require("@mux/upchunk"), reactIs = require("react-is"), LanguagesList = require("iso-639-1");
|
|
23
23
|
function _interopDefaultCompat(e) {
|
|
24
24
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
25
25
|
}
|
|
@@ -143,7 +143,7 @@ function accumulateIntermediateState(currentState, pageResult) {
|
|
|
143
143
|
...currentData,
|
|
144
144
|
...("data" in pageResult && pageResult.data || []).filter(
|
|
145
145
|
// De-duplicate assets for safety
|
|
146
|
-
(asset) => !currentData.some((
|
|
146
|
+
(asset) => !currentData.some((a2) => a2.id === asset.id)
|
|
147
147
|
)
|
|
148
148
|
],
|
|
149
149
|
error: "error" in pageResult ? pageResult.error : (
|
|
@@ -190,7 +190,7 @@ function useMuxAssets({ secrets, enabled }) {
|
|
|
190
190
|
return () => subscription.unsubscribe();
|
|
191
191
|
}, [enabled]), state;
|
|
192
192
|
}
|
|
193
|
-
const name
|
|
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, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
|
|
194
194
|
const { error, isLoading, value } = sanity.useDocumentValues(
|
|
195
195
|
muxSecretsDocumentId,
|
|
196
196
|
path$1
|
|
@@ -217,7 +217,7 @@ function useImportMuxAssets() {
|
|
|
217
217
|
}), [assetsInSanity, assetsInSanityLoading] = useAssetsInSanity(documentStore), secretDocumentValues = useSecretsDocumentValues(), hasSecrets = !!((_a = secretDocumentValues.value.secrets) != null && _a.secretKey), [importError, setImportError] = React.useState(), [importState, setImportState] = React.useState("closed"), dialogOpen = importState !== "closed", muxAssets = useMuxAssets({
|
|
218
218
|
secrets: secretDocumentValues.value.secrets,
|
|
219
219
|
enabled: hasSecrets && dialogOpen
|
|
220
|
-
}), missingAssets = React.useMemo(() => assetsInSanity && muxAssets.data ? muxAssets.data.filter((
|
|
220
|
+
}), missingAssets = React.useMemo(() => assetsInSanity && muxAssets.data ? muxAssets.data.filter((a2) => !assetExistsInSanity(a2, assetsInSanity)) : void 0, [assetsInSanity, muxAssets.data]), [selectedAssets, setSelectedAssets] = React.useState([]), closeDialog = () => {
|
|
221
221
|
importState !== "importing" && setImportState("closed");
|
|
222
222
|
}, openDialog = () => {
|
|
223
223
|
importState === "closed" && setImportState("idle");
|
|
@@ -653,9 +653,9 @@ function ImportVideosDialog(props) {
|
|
|
653
653
|
{
|
|
654
654
|
asset,
|
|
655
655
|
selectAsset: (selected) => {
|
|
656
|
-
selected ? props.setSelectedAssets([...props.selectedAssets, asset]) : props.setSelectedAssets(props.selectedAssets.filter((
|
|
656
|
+
selected ? props.setSelectedAssets([...props.selectedAssets, asset]) : props.setSelectedAssets(props.selectedAssets.filter((a2) => a2.id !== asset.id));
|
|
657
657
|
},
|
|
658
|
-
selected: props.selectedAssets.some((
|
|
658
|
+
selected: props.selectedAssets.some((a2) => a2.id === asset.id)
|
|
659
659
|
},
|
|
660
660
|
asset.id
|
|
661
661
|
))
|
|
@@ -682,17 +682,17 @@ function SelectSortOptions(props) {
|
|
|
682
682
|
{
|
|
683
683
|
button: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { text: "Sort", icon: icons.SortIcon, mode: "bleed", padding: 3, style: { cursor: "pointer" } }),
|
|
684
684
|
id,
|
|
685
|
-
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: Object.entries(ASSET_SORT_OPTIONS).map(([
|
|
685
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: Object.entries(ASSET_SORT_OPTIONS).map(([type, { label }]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
686
686
|
ui.MenuItem,
|
|
687
687
|
{
|
|
688
688
|
"data-as": "button",
|
|
689
|
-
onClick: () => props.setSort(
|
|
689
|
+
onClick: () => props.setSort(type),
|
|
690
690
|
padding: 3,
|
|
691
691
|
tone: "default",
|
|
692
692
|
text: label,
|
|
693
|
-
pressed:
|
|
693
|
+
pressed: type === props.sort
|
|
694
694
|
},
|
|
695
|
-
|
|
695
|
+
type
|
|
696
696
|
)) }),
|
|
697
697
|
popover: CONTEXT_MENU_POPOVER_PROPS
|
|
698
698
|
}
|
|
@@ -711,11 +711,11 @@ const SpinnerBox = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
711
711
|
}
|
|
712
712
|
);
|
|
713
713
|
function FormField(props) {
|
|
714
|
-
const { children, title, description
|
|
714
|
+
const { children, title, description, inputId } = props;
|
|
715
715
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 1, children: [
|
|
716
716
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, paddingY: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
717
717
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: inputId, weight: "semibold", size: 1, children: title || /* @__PURE__ */ jsxRuntime.jsx("em", { children: "Untitled" }) }),
|
|
718
|
-
|
|
718
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: description })
|
|
719
719
|
] }) }) }),
|
|
720
720
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children })
|
|
721
721
|
] });
|
|
@@ -768,132 +768,6 @@ function getVideoSrc({ asset, client }) {
|
|
|
768
768
|
}
|
|
769
769
|
return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
|
|
770
770
|
}
|
|
771
|
-
var name = "sanity-plugin-mux-input", version = "2.3.2", description = "An input component that integrates Sanity Studio with Mux video encoding/hosting service.", keywords = [
|
|
772
|
-
"sanity",
|
|
773
|
-
"video",
|
|
774
|
-
"mux",
|
|
775
|
-
"input",
|
|
776
|
-
"plugin",
|
|
777
|
-
"sanity-plugin",
|
|
778
|
-
"media"
|
|
779
|
-
], homepage = "https://github.com/sanity-io/sanity-plugin-mux-input#readme", bugs = {
|
|
780
|
-
url: "https://github.com/sanity-io/sanity-plugin-mux-input/issues"
|
|
781
|
-
}, repository = {
|
|
782
|
-
type: "git",
|
|
783
|
-
url: "git@github.com:sanity-io/sanity-plugin-mux-input.git"
|
|
784
|
-
}, license = "MIT", author = "Sanity.io <hello@sanity.io>", sideEffects = !1, type = "module", exports$1 = {
|
|
785
|
-
".": {
|
|
786
|
-
source: "./src/_exports/index.ts",
|
|
787
|
-
import: "./lib/index.js",
|
|
788
|
-
require: "./lib/index.cjs",
|
|
789
|
-
default: "./lib/index.js"
|
|
790
|
-
},
|
|
791
|
-
"./package.json": "./package.json"
|
|
792
|
-
}, main = "./lib/index.cjs", module$1 = "./lib/index.esm.js", source = "./src/_exports/index.ts", types = "./lib/index.d.ts", files = [
|
|
793
|
-
"src",
|
|
794
|
-
"lib",
|
|
795
|
-
"sanity.json",
|
|
796
|
-
"v2-incompatible.js"
|
|
797
|
-
], scripts = {
|
|
798
|
-
build: "run-s clean && pkg-utils build --strict && pkg-utils --strict",
|
|
799
|
-
clean: "rimraf lib",
|
|
800
|
-
dev: "plugin-kit link-watch",
|
|
801
|
-
format: "prettier --write --cache --ignore-unknown .",
|
|
802
|
-
"link-watch": "plugin-kit link-watch",
|
|
803
|
-
lint: "eslint .",
|
|
804
|
-
prepare: "husky install || true",
|
|
805
|
-
prepublishOnly: "run-s build",
|
|
806
|
-
test: "npm run lint && npm run type-check && npm run build",
|
|
807
|
-
"type-check": "tsc --noEmit",
|
|
808
|
-
watch: "pkg-utils watch --strict"
|
|
809
|
-
}, dependencies = {
|
|
810
|
-
"@mux/mux-player-react": "^2.4.1",
|
|
811
|
-
"@mux/upchunk": "^3.3.2",
|
|
812
|
-
"@sanity/icons": "^2.11.7",
|
|
813
|
-
"@sanity/incompatible-plugin": "^1.0.4",
|
|
814
|
-
"@sanity/ui": "^2.1.0",
|
|
815
|
-
"@sanity/uuid": "^3.0.2",
|
|
816
|
-
"iso-639-1": "^3.1.2",
|
|
817
|
-
"jsonwebtoken-esm": "^1.0.5",
|
|
818
|
-
lodash: "^4.17.21",
|
|
819
|
-
"react-rx": "^2.1.3",
|
|
820
|
-
rxjs: "^7.8.1",
|
|
821
|
-
"scroll-into-view-if-needed": "^3.1.0",
|
|
822
|
-
"suspend-react": "^0.1.3",
|
|
823
|
-
swr: "^2.2.5",
|
|
824
|
-
"type-fest": "^4.10.2",
|
|
825
|
-
"use-error-boundary": "^2.0.6"
|
|
826
|
-
}, devDependencies = {
|
|
827
|
-
"@commitlint/cli": "^19.2.1",
|
|
828
|
-
"@commitlint/config-conventional": "^19.1.0",
|
|
829
|
-
"@sanity/client": "^6.15.11",
|
|
830
|
-
"@sanity/pkg-utils": "^6.0.1",
|
|
831
|
-
"@sanity/plugin-kit": "^3.1.10",
|
|
832
|
-
"@sanity/semantic-release-preset": "^4.1.7",
|
|
833
|
-
"@sanity/vision": "^3.36.4",
|
|
834
|
-
"@types/lodash": "^4.17.0",
|
|
835
|
-
"@types/react": "^18.2.74",
|
|
836
|
-
"@types/react-is": "^18.2.4",
|
|
837
|
-
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
838
|
-
"@typescript-eslint/parser": "^7.6.0",
|
|
839
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
840
|
-
eslint: "^8.57.0",
|
|
841
|
-
"eslint-config-prettier": "^9.1.0",
|
|
842
|
-
"eslint-config-sanity": "^7.1.2",
|
|
843
|
-
"eslint-plugin-import": "^2.29.1",
|
|
844
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
845
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
846
|
-
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
847
|
-
husky: "^9.0.11",
|
|
848
|
-
"lint-staged": "^15.2.2",
|
|
849
|
-
"npm-run-all2": "^5.0.0",
|
|
850
|
-
prettier: "^3.2.5",
|
|
851
|
-
"prettier-plugin-packagejson": "^2.4.14",
|
|
852
|
-
react: "^18.2.0",
|
|
853
|
-
"react-dom": "^18.2.0",
|
|
854
|
-
"react-is": "^18.2.0",
|
|
855
|
-
rimraf: "^5.0.5",
|
|
856
|
-
sanity: "^3.36.4",
|
|
857
|
-
"semantic-release": "^23.0.7",
|
|
858
|
-
"styled-components": "^6.1.8",
|
|
859
|
-
typescript: "5.4.2",
|
|
860
|
-
yalc: "1.0.0-pre.53"
|
|
861
|
-
}, peerDependencies = {
|
|
862
|
-
react: "^18",
|
|
863
|
-
"react-is": "^18",
|
|
864
|
-
sanity: "^3",
|
|
865
|
-
"styled-components": "^6"
|
|
866
|
-
}, engines = {
|
|
867
|
-
node: ">=14"
|
|
868
|
-
}, publishConfig = {
|
|
869
|
-
access: "public",
|
|
870
|
-
provenance: !0
|
|
871
|
-
}, sanityExchangeUrl = "https://www.sanity.io/plugins/sanity-plugin-mux-input", pluginPkg = {
|
|
872
|
-
name,
|
|
873
|
-
version,
|
|
874
|
-
description,
|
|
875
|
-
keywords,
|
|
876
|
-
homepage,
|
|
877
|
-
bugs,
|
|
878
|
-
repository,
|
|
879
|
-
license,
|
|
880
|
-
author,
|
|
881
|
-
sideEffects,
|
|
882
|
-
type,
|
|
883
|
-
exports: exports$1,
|
|
884
|
-
main,
|
|
885
|
-
module: module$1,
|
|
886
|
-
source,
|
|
887
|
-
types,
|
|
888
|
-
files,
|
|
889
|
-
scripts,
|
|
890
|
-
dependencies,
|
|
891
|
-
devDependencies,
|
|
892
|
-
peerDependencies,
|
|
893
|
-
engines,
|
|
894
|
-
publishConfig,
|
|
895
|
-
sanityExchangeUrl
|
|
896
|
-
};
|
|
897
771
|
function VideoPlayer({
|
|
898
772
|
asset,
|
|
899
773
|
children,
|
|
@@ -927,7 +801,7 @@ function VideoPlayer({
|
|
|
927
801
|
crossOrigin: "anonymous",
|
|
928
802
|
metadata: {
|
|
929
803
|
player_name: "Sanity Admin Dashboard",
|
|
930
|
-
player_version:
|
|
804
|
+
player_version: "2.3.4",
|
|
931
805
|
page_type: "Preview Player"
|
|
932
806
|
},
|
|
933
807
|
style: {
|
|
@@ -1804,7 +1678,7 @@ function VideoInBrowser({
|
|
|
1804
1678
|
}
|
|
1805
1679
|
function VideosBrowser({ onSelect }) {
|
|
1806
1680
|
const { assets, isLoading, searchQuery, setSearchQuery, setSort, sort } = useAssets(), [editedAsset, setEditedAsset] = React.useState(null), freshEditedAsset = React.useMemo(
|
|
1807
|
-
() => assets.find((
|
|
1681
|
+
() => assets.find((a2) => a2._id === (editedAsset == null ? void 0 : editedAsset._id)) || editedAsset,
|
|
1808
1682
|
[editedAsset, assets]
|
|
1809
1683
|
), placement = onSelect ? "input" : "tool";
|
|
1810
1684
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2056,7 +1930,7 @@ const useSecretsFormState = (secrets) => React.useReducer(reducer, secrets, init
|
|
|
2056
1930
|
"r"
|
|
2057
1931
|
];
|
|
2058
1932
|
function MuxLogo({ height = 26 }) {
|
|
2059
|
-
const id = React.useId(), [titleId,
|
|
1933
|
+
const id = React.useId(), [titleId, a2, b, c2, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = React.useMemo(
|
|
2060
1934
|
() => ids.map((field) => `${id}-${field}`),
|
|
2061
1935
|
[id]
|
|
2062
1936
|
);
|
|
@@ -2075,7 +1949,7 @@ function MuxLogo({ height = 26 }) {
|
|
|
2075
1949
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2076
1950
|
"linearGradient",
|
|
2077
1951
|
{
|
|
2078
|
-
id:
|
|
1952
|
+
id: c2,
|
|
2079
1953
|
spreadMethod: "pad",
|
|
2080
1954
|
gradientTransform: "matrix(528.38055 0 0 -528.38055 63.801 159.5)",
|
|
2081
1955
|
gradientUnits: "userSpaceOnUse",
|
|
@@ -2457,7 +2331,7 @@ function MuxLogo({ height = 26 }) {
|
|
|
2457
2331
|
]
|
|
2458
2332
|
}
|
|
2459
2333
|
),
|
|
2460
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id:
|
|
2334
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: a2, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
|
|
2461
2335
|
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: b, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M423.64 242h164.999V77H423.64Z" }) }),
|
|
2462
2336
|
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: e, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
|
|
2463
2337
|
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: f, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M311.3 242h93.031V77H311.3Z" }) }),
|
|
@@ -2465,7 +2339,7 @@ function MuxLogo({ height = 26 }) {
|
|
|
2465
2339
|
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: n, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 319h657.706V0H0Z" }) }),
|
|
2466
2340
|
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: o, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M69.067 242H169.12V141.947H69.067Z" }) })
|
|
2467
2341
|
] }),
|
|
2468
|
-
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: `url(#${
|
|
2342
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: `url(#${a2})`, transform: "matrix(1.33333 0 0 -1.33333 0 425.333)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2469
2343
|
"g",
|
|
2470
2344
|
{
|
|
2471
2345
|
style: {
|
|
@@ -2476,7 +2350,7 @@ function MuxLogo({ height = 26 }) {
|
|
|
2476
2350
|
"path",
|
|
2477
2351
|
{
|
|
2478
2352
|
style: {
|
|
2479
|
-
fill: `url(#${
|
|
2353
|
+
fill: `url(#${c2})`,
|
|
2480
2354
|
stroke: "none"
|
|
2481
2355
|
},
|
|
2482
2356
|
d: "M558.674 82.142c6.855-6.855 17.969-6.855 24.824 0 6.854 6.855 6.854 17.969 0 24.823L453.605 236.858c-6.855 6.855-17.969 6.855-24.824 0s-6.855-17.969 0-24.823z"
|
|
@@ -2790,9 +2664,49 @@ function ConfigureApi({ secrets, setDialogState }) {
|
|
|
2790
2664
|
}
|
|
2791
2665
|
);
|
|
2792
2666
|
}
|
|
2793
|
-
var ConfigureApi$1 = React.memo(ConfigureApi)
|
|
2667
|
+
var ConfigureApi$1 = React.memo(ConfigureApi), c = function(r) {
|
|
2668
|
+
var t, e;
|
|
2669
|
+
function n(t2) {
|
|
2670
|
+
var e2;
|
|
2671
|
+
return (e2 = r.call(this, t2) || this).state = { hasError: !1, error: null }, e2;
|
|
2672
|
+
}
|
|
2673
|
+
e = r, (t = n).prototype = Object.create(e.prototype), t.prototype.constructor = t, t.__proto__ = e, n.getDerivedStateFromError = function(r2) {
|
|
2674
|
+
return { hasError: !0, error: r2 };
|
|
2675
|
+
};
|
|
2676
|
+
var o = n.prototype;
|
|
2677
|
+
return o.componentDidCatch = function(r2, t2) {
|
|
2678
|
+
return this.props.onDidCatch(r2, t2);
|
|
2679
|
+
}, o.render = function() {
|
|
2680
|
+
var r2 = this.state, t2 = this.props, e2 = t2.render, n2 = t2.children, o2 = t2.renderError;
|
|
2681
|
+
return r2.hasError ? o2 ? o2({ error: r2.error }) : null : e2 ? e2() : n2 || null;
|
|
2682
|
+
}, n;
|
|
2683
|
+
}(React.PureComponent), u = function(r, t) {
|
|
2684
|
+
switch (t.type) {
|
|
2685
|
+
case "catch":
|
|
2686
|
+
return { didCatch: !0, error: t.error };
|
|
2687
|
+
case "reset":
|
|
2688
|
+
return { didCatch: !1, error: null };
|
|
2689
|
+
default:
|
|
2690
|
+
return r;
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
2693
|
+
function a(t) {
|
|
2694
|
+
var a2 = React.useReducer(u, { didCatch: !1, error: null }), i = a2[0], d = a2[1], h = React.useRef(null);
|
|
2695
|
+
function l() {
|
|
2696
|
+
return e = function(r, e2) {
|
|
2697
|
+
d({ type: "catch", error: r }), t && t.onDidCatch && t.onDidCatch(r, e2);
|
|
2698
|
+
}, function(t2) {
|
|
2699
|
+
return React__default.default.createElement(c, { onDidCatch: e, children: t2.children, render: t2.render, renderError: t2.renderError });
|
|
2700
|
+
};
|
|
2701
|
+
var e;
|
|
2702
|
+
}
|
|
2703
|
+
var p, s = React.useCallback(function() {
|
|
2704
|
+
h.current = l(), d({ type: "reset" });
|
|
2705
|
+
}, []);
|
|
2706
|
+
return { ErrorBoundary: (p = h.current, p !== null ? p : (h.current = l(), h.current)), didCatch: i.didCatch, error: i.error, reset: s };
|
|
2707
|
+
}
|
|
2794
2708
|
function ErrorBoundaryCard(props) {
|
|
2795
|
-
const { children, schemaType } = props, { push: pushToast } = ui.useToast(), errorRef = React.useRef(null), { ErrorBoundary, didCatch, error, reset } =
|
|
2709
|
+
const { children, schemaType } = props, { push: pushToast } = ui.useToast(), errorRef = React.useRef(null), { ErrorBoundary, didCatch, error, reset } = a({
|
|
2796
2710
|
onDidCatch: (err, errorInfo) => {
|
|
2797
2711
|
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 != null && errorInfo.componentStack && (console.groupCollapsed("errorInfo.componentStack"), console.log(errorInfo.componentStack), console.groupEnd()), console.groupEnd(), pushToast({
|
|
2798
2712
|
status: "error",
|
|
@@ -2820,12 +2734,12 @@ function ErrorBoundaryCard(props) {
|
|
|
2820
2734
|
});
|
|
2821
2735
|
}
|
|
2822
2736
|
}), handleRetry = React.useCallback(() => {
|
|
2823
|
-
suspendReact.clear([name
|
|
2737
|
+
suspendReact.clear([name]), reset();
|
|
2824
2738
|
}, [reset]);
|
|
2825
2739
|
return didCatch ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { ref: errorRef, paddingX: [2, 3, 4, 4], height: "fill", shadow: 1, overflow: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "flex-start", align: "center", height: "fill", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { columns: 1, gap: [2, 3, 4, 4], children: [
|
|
2826
2740
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { as: "h1", children: [
|
|
2827
2741
|
"The ",
|
|
2828
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { children: name
|
|
2742
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: name }),
|
|
2829
2743
|
" plugin crashed"
|
|
2830
2744
|
] }),
|
|
2831
2745
|
(error == null ? void 0 : error.message) && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 3, tone: "critical", shadow: 1, radius: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: error.message }) }),
|
|
@@ -2868,11 +2782,11 @@ function Onboard(props) {
|
|
|
2868
2782
|
}
|
|
2869
2783
|
) }) });
|
|
2870
2784
|
}
|
|
2871
|
-
function createUpChunkObservable(uuid2, uploadUrl2,
|
|
2785
|
+
function createUpChunkObservable(uuid2, uploadUrl2, source) {
|
|
2872
2786
|
return new rxjs.Observable((subscriber) => {
|
|
2873
2787
|
const upchunk$1 = upchunk.UpChunk.createUpload({
|
|
2874
2788
|
endpoint: uploadUrl2,
|
|
2875
|
-
file:
|
|
2789
|
+
file: source,
|
|
2876
2790
|
dynamicChunkSize: !0
|
|
2877
2791
|
// changes the chunk size based on network speeds
|
|
2878
2792
|
}), successHandler = () => {
|
|
@@ -3066,8 +2980,8 @@ function isValidUrl(url) {
|
|
|
3066
2980
|
}
|
|
3067
2981
|
}
|
|
3068
2982
|
function extractDroppedFiles(dataTransfer) {
|
|
3069
|
-
const
|
|
3070
|
-
return
|
|
2983
|
+
const files = Array.from(dataTransfer.files || []), items = Array.from(dataTransfer.items || []);
|
|
2984
|
+
return files && files.length > 0 ? Promise.resolve(files) : normalizeItems(items).then((arr) => arr.flat());
|
|
3071
2985
|
}
|
|
3072
2986
|
function normalizeItems(items) {
|
|
3073
2987
|
return Promise.all(
|
|
@@ -3438,12 +3352,12 @@ function formatBytes(bytes, si = !1, dp = 1) {
|
|
|
3438
3352
|
if (Math.abs(bytes) < thresh)
|
|
3439
3353
|
return bytes + " B";
|
|
3440
3354
|
const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
3441
|
-
let
|
|
3355
|
+
let u2 = -1;
|
|
3442
3356
|
const r = 10 ** dp;
|
|
3443
3357
|
do
|
|
3444
|
-
bytes /= thresh, ++
|
|
3445
|
-
while (Math.round(Math.abs(bytes) * r) / r >= thresh &&
|
|
3446
|
-
return bytes.toFixed(dp) + " " + units[
|
|
3358
|
+
bytes /= thresh, ++u2;
|
|
3359
|
+
while (Math.round(Math.abs(bytes) * r) / r >= thresh && u2 < units.length - 1);
|
|
3360
|
+
return bytes.toFixed(dp) + " " + units[u2];
|
|
3447
3361
|
}
|
|
3448
3362
|
const SUPPORTED_MUX_LANGUAGES = [
|
|
3449
3363
|
{ label: "English", code: "en", state: "Stable" },
|
|
@@ -3495,7 +3409,7 @@ function TrackEditor({
|
|
|
3495
3409
|
track,
|
|
3496
3410
|
dispatch
|
|
3497
3411
|
}) {
|
|
3498
|
-
const { _id: id, type
|
|
3412
|
+
const { _id: id, type } = track, dispatchTrackAction = (args) => dispatch({ action: "track", id, ...args }), trackTypes = TRACK_TYPES.filter(
|
|
3499
3413
|
({ value }) => !(value === "autogenerated" && !canAutoGenerate)
|
|
3500
3414
|
);
|
|
3501
3415
|
return trackTypes.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { border: !0, padding: 3, radius: 2, style: { position: "relative" }, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
@@ -3505,7 +3419,7 @@ function TrackEditor({
|
|
|
3505
3419
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3506
3420
|
ui.Radio,
|
|
3507
3421
|
{
|
|
3508
|
-
checked:
|
|
3422
|
+
checked: type === value,
|
|
3509
3423
|
name: "track-type",
|
|
3510
3424
|
onChange: (e) => dispatchTrackAction({
|
|
3511
3425
|
subAction: "update",
|
|
@@ -3630,7 +3544,7 @@ function UploadConfiguration({
|
|
|
3630
3544
|
encoding_tier: action.value,
|
|
3631
3545
|
mp4_support: "none",
|
|
3632
3546
|
max_resolution_tier: "1080p",
|
|
3633
|
-
text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type
|
|
3547
|
+
text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type }) => type !== "autogenerated")
|
|
3634
3548
|
}) : Object.assign({}, prev, {
|
|
3635
3549
|
encoding_tier: action.value,
|
|
3636
3550
|
mp4_support: pluginConfig.mp4_support,
|
|
@@ -4071,7 +3985,7 @@ function Uploader(props) {
|
|
|
4071
3985
|
case "commitUpload":
|
|
4072
3986
|
return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
|
|
4073
3987
|
case "progressInfo": {
|
|
4074
|
-
const { type
|
|
3988
|
+
const { type, action: _, ...payload } = action;
|
|
4075
3989
|
return Object.assign({}, prev, {
|
|
4076
3990
|
uploadStatus: {
|
|
4077
3991
|
...prev.uploadStatus,
|
|
@@ -4160,10 +4074,10 @@ function Uploader(props) {
|
|
|
4160
4074
|
complete: () => dispatch({ action: "complete" }),
|
|
4161
4075
|
error: (error) => dispatch({ action: "error", error })
|
|
4162
4076
|
});
|
|
4163
|
-
}, handleUpload = (
|
|
4077
|
+
}, handleUpload = (files) => {
|
|
4164
4078
|
dispatch({
|
|
4165
4079
|
action: "stageUpload",
|
|
4166
|
-
input: { type: "file", files
|
|
4080
|
+
input: { type: "file", files }
|
|
4167
4081
|
});
|
|
4168
4082
|
}, handlePaste = (event) => {
|
|
4169
4083
|
event.preventDefault(), event.stopPropagation();
|
|
@@ -4174,10 +4088,10 @@ function Uploader(props) {
|
|
|
4174
4088
|
}
|
|
4175
4089
|
dispatch({ action: "stageUpload", input: { type: "url", url } });
|
|
4176
4090
|
}, handleDrop = (event) => {
|
|
4177
|
-
setDragState(null), event.preventDefault(), event.stopPropagation(), extractDroppedFiles(event.nativeEvent.dataTransfer).then((
|
|
4091
|
+
setDragState(null), event.preventDefault(), event.stopPropagation(), extractDroppedFiles(event.nativeEvent.dataTransfer).then((files) => {
|
|
4178
4092
|
dispatch({
|
|
4179
4093
|
action: "stageUpload",
|
|
4180
|
-
input: { type: "file", files
|
|
4094
|
+
input: { type: "file", files }
|
|
4181
4095
|
});
|
|
4182
4096
|
});
|
|
4183
4097
|
}, handleDragOver = (event) => {
|
|
@@ -4185,8 +4099,8 @@ function Uploader(props) {
|
|
|
4185
4099
|
}, handleDragEnter = (event) => {
|
|
4186
4100
|
var _a2, _b;
|
|
4187
4101
|
event.stopPropagation(), dragEnteredEls.current.push(event.target);
|
|
4188
|
-
const
|
|
4189
|
-
setDragState(
|
|
4102
|
+
const type = (_b = (_a2 = event.dataTransfer.items) == null ? void 0 : _a2[0]) == null ? void 0 : _b.type;
|
|
4103
|
+
setDragState(type != null && type.startsWith("video/") ? "valid" : "invalid");
|
|
4190
4104
|
}, handleDragLeave = (event) => {
|
|
4191
4105
|
event.stopPropagation();
|
|
4192
4106
|
const idx = dragEnteredEls.current.indexOf(event.target);
|