sanity-plugin-mux-input 1.2.0-main.3 → 1.2.0-main.6
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/esm/index.js +3874 -226
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts +2 -3
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +8 -8
- package/lib/cjs/Input.832bb406.js +0 -3585
- package/lib/cjs/Input.832bb406.js.map +0 -1
- package/lib/cjs/Input.f632a169.js +0 -410
- package/lib/cjs/Input.f632a169.js.map +0 -1
- package/lib/cjs/Preview.3e13819d.js +0 -53
- package/lib/cjs/Preview.3e13819d.js.map +0 -1
- package/lib/cjs/index.js +0 -381
- package/lib/cjs/index.js.map +0 -1
- package/lib/esm/Input.8f661c56.js +0 -3582
- package/lib/esm/Input.8f661c56.js.map +0 -1
- package/lib/esm/Input.e91a8018.js +0 -407
- package/lib/esm/Input.e91a8018.js.map +0 -1
- package/lib/esm/Preview.0ca0dc85.js +0 -53
- package/lib/esm/Preview.0ca0dc85.js.map +0 -1
package/lib/esm/index.js
CHANGED
|
@@ -1,83 +1,3740 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import $
|
|
5
|
-
import {
|
|
6
|
-
import $
|
|
7
|
-
import {clear as $
|
|
8
|
-
import {useErrorBoundary as $
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import $lAnAG$swchelperssrc_object_spreadmjs from "@swc/helpers/src/_object_spread.mjs";
|
|
2
|
+
import {jsx as $lAnAG$jsx, jsxs as $lAnAG$jsxs, Fragment as $lAnAG$Fragment} from "react/jsx-runtime";
|
|
3
|
+
import $lAnAG$react, {Suspense as $lAnAG$Suspense, useRef as $lAnAG$useRef, useCallback as $lAnAG$useCallback, memo as $lAnAG$memo, useState as $lAnAG$useState, useMemo as $lAnAG$useMemo, Component as $lAnAG$Component, useEffect as $lAnAG$useEffect, useLayoutEffect as $lAnAG$useLayoutEffect, isValidElement as $lAnAG$isValidElement, createElement as $lAnAG$createElement, forwardRef as $lAnAG$forwardRef, useReducer as $lAnAG$useReducer} from "react";
|
|
4
|
+
import {createPlugin as $lAnAG$createPlugin, useClient as $lAnAG$useClient, isReference as $lAnAG$isReference, useProjectId as $lAnAG$useProjectId, useDataset as $lAnAG$useDataset, defineField as $lAnAG$defineField, isObjectSchemaType as $lAnAG$isObjectSchemaType} from "sanity";
|
|
5
|
+
import {useToast as $lAnAG$useToast, Flex as $lAnAG$Flex, Inline as $lAnAG$Inline, Button as $lAnAG$Button, Card as $lAnAG$Card, Grid as $lAnAG$Grid, Heading as $lAnAG$Heading, Text as $lAnAG$Text, Dialog as $lAnAG$Dialog, useClickOutside as $lAnAG$useClickOutside, MenuButton as $lAnAG$MenuButton, Menu as $lAnAG$Menu, MenuItem as $lAnAG$MenuItem, Stack as $lAnAG$Stack, Box as $lAnAG$Box, Checkbox as $lAnAG$Checkbox, Spinner as $lAnAG$Spinner, Code as $lAnAG$Code, Tooltip as $lAnAG$Tooltip, Popover as $lAnAG$Popover, Label as $lAnAG$Label, MenuDivider as $lAnAG$MenuDivider, rem as $lAnAG$rem, TextInput as $lAnAG$TextInput} from "@sanity/ui";
|
|
6
|
+
import $lAnAG$scrollintoviewifneeded from "scroll-into-view-if-needed";
|
|
7
|
+
import {clear as $lAnAG$clear, suspend as $lAnAG$suspend, preload as $lAnAG$preload} from "suspend-react";
|
|
8
|
+
import {useErrorBoundary as $lAnAG$useErrorBoundary} from "use-error-boundary";
|
|
9
|
+
import $lAnAG$swchelperssrc_object_spread_propsmjs from "@swc/helpers/src/_object_spread_props.mjs";
|
|
10
|
+
import {useDocumentValues as $lAnAG$useDocumentValues, MediaPreview as $lAnAG$MediaPreview, LinearProgress as $lAnAG$LinearProgress, SanityDefaultPreview as $lAnAG$SanityDefaultPreview} from "sanity/_unstable";
|
|
11
|
+
import $lAnAG$swr from "swr";
|
|
12
|
+
import $lAnAG$swchelperssrc_define_propertymjs from "@swc/helpers/src/_define_property.mjs";
|
|
13
|
+
import {Subject as $lAnAG$Subject, concat as $lAnAG$concat, of as $lAnAG$of, throwError as $lAnAG$throwError, defer as $lAnAG$defer, from as $lAnAG$from, Observable as $lAnAG$Observable} from "rxjs";
|
|
14
|
+
import {takeUntil as $lAnAG$takeUntil, tap as $lAnAG$tap, switchMap as $lAnAG$switchMap, mergeMap as $lAnAG$mergeMap, catchError as $lAnAG$catchError, mergeMapTo as $lAnAG$mergeMapTo} from "rxjs/operators";
|
|
15
|
+
import {PatchEvent as $lAnAG$PatchEvent, setIfMissing as $lAnAG$setIfMissing, set as $lAnAG$set, unset as $lAnAG$unset} from "sanity/form";
|
|
16
|
+
import {uuid as $lAnAG$uuid} from "@sanity/uuid";
|
|
17
|
+
import {createUpload as $lAnAG$createUpload} from "@mux/upchunk";
|
|
18
|
+
import {useId as $lAnAG$useId} from "@reach/auto-id";
|
|
19
|
+
import {EllipsisVerticalIcon as $lAnAG$EllipsisVerticalIcon, TrashIcon as $lAnAG$TrashIcon, DownloadIcon as $lAnAG$DownloadIcon, LockIcon as $lAnAG$LockIcon, UnknownIcon as $lAnAG$UnknownIcon, EditIcon as $lAnAG$EditIcon, UploadIcon as $lAnAG$UploadIcon, SearchIcon as $lAnAG$SearchIcon, PlugIcon as $lAnAG$PlugIcon, ResetIcon as $lAnAG$ResetIcon, DocumentVideoIcon as $lAnAG$DocumentVideoIcon} from "@sanity/icons";
|
|
20
|
+
import {animate as $lAnAG$animate} from "motion";
|
|
21
|
+
import $lAnAG$styledcomponents, {css as $lAnAG$css} from "styled-components";
|
|
22
|
+
import {getDevicePixelRatio as $lAnAG$getDevicePixelRatio} from "use-device-pixel-ratio";
|
|
23
|
+
import {sign as $lAnAG$sign} from "jsonwebtoken-esm";
|
|
24
|
+
import {generatePlayerInitTime as $lAnAG$generatePlayerInitTime, initialize as $lAnAG$initialize} from "@mux/playback-core";
|
|
25
|
+
import {MediaController as $lAnAG$MediaController, MediaLoadingIndicator as $lAnAG$MediaLoadingIndicator, MediaPlayButton as $lAnAG$MediaPlayButton, MediaControlBar as $lAnAG$MediaControlBar, MediaMuteButton as $lAnAG$MediaMuteButton, MediaTimeDisplay as $lAnAG$MediaTimeDisplay, MediaTimeRange as $lAnAG$MediaTimeRange, MediaDurationDisplay as $lAnAG$MediaDurationDisplay, MediaFullscreenButton as $lAnAG$MediaFullscreenButton, MediaPosterImage as $lAnAG$MediaPosterImage} from "media-chrome/dist/react";
|
|
26
|
+
import $lAnAG$swchelperssrc_object_without_propertiesmjs from "@swc/helpers/src/_object_without_properties.mjs";
|
|
27
|
+
import {isValidElementType as $lAnAG$isValidElementType} from "react-is";
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const $81deebaa2da6d866$export$a8ff84c12d48cfa6 = "mux-input";
|
|
40
|
+
const $81deebaa2da6d866$export$13cdb654d47e0703 = "sanity-plugin-mux-input";
|
|
41
|
+
const $81deebaa2da6d866$export$64952397958089dd = "secrets.mux";
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
function $3e1e9b96ff4a93b5$var$ErrorBoundaryCard(props) {
|
|
45
|
+
const { children: children , schemaType: schemaType } = props;
|
|
46
|
+
const { push: pushToast } = (0, $lAnAG$useToast)();
|
|
47
|
+
const errorRef = (0, $lAnAG$useRef)(null);
|
|
48
|
+
const { ErrorBoundary: ErrorBoundary , didCatch: didCatch , error: error , reset: reset } = (0, $lAnAG$useErrorBoundary)({
|
|
49
|
+
onDidCatch: (err, errorInfo)=>{
|
|
50
|
+
console.group(err.toString());
|
|
51
|
+
console.groupCollapsed("console.error");
|
|
52
|
+
console.error(err);
|
|
53
|
+
console.groupEnd();
|
|
54
|
+
if (err.stack) {
|
|
55
|
+
console.groupCollapsed("error.stack");
|
|
56
|
+
console.log(err.stack);
|
|
57
|
+
console.groupEnd();
|
|
58
|
+
}
|
|
59
|
+
if (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack) {
|
|
60
|
+
console.groupCollapsed("errorInfo.componentStack");
|
|
61
|
+
console.log(errorInfo.componentStack);
|
|
62
|
+
console.groupEnd();
|
|
63
|
+
}
|
|
64
|
+
console.groupEnd();
|
|
65
|
+
pushToast({
|
|
66
|
+
status: "error",
|
|
67
|
+
title: "Plugin crashed",
|
|
68
|
+
description: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
69
|
+
align: "center",
|
|
70
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Inline), {
|
|
71
|
+
space: 1,
|
|
72
|
+
children: [
|
|
73
|
+
"An error happened while rendering",
|
|
74
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
75
|
+
padding: 1,
|
|
76
|
+
fontSize: 1,
|
|
77
|
+
style: {
|
|
78
|
+
transform: "translateY(1px)"
|
|
79
|
+
},
|
|
80
|
+
mode: "ghost",
|
|
81
|
+
text: schemaType.title,
|
|
82
|
+
onClick: ()=>{
|
|
83
|
+
if (errorRef.current) (0, $lAnAG$scrollintoviewifneeded)(errorRef.current, {
|
|
84
|
+
behavior: "smooth",
|
|
85
|
+
scrollMode: "if-needed",
|
|
86
|
+
block: "center"
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const handleRetry = (0, $lAnAG$useCallback)(()=>{
|
|
97
|
+
// Purge request cache before retrying, otherwise the cached errors will rethrow
|
|
98
|
+
(0, $lAnAG$clear)([
|
|
99
|
+
(0, $81deebaa2da6d866$export$a8ff84c12d48cfa6)
|
|
100
|
+
]);
|
|
101
|
+
reset();
|
|
102
|
+
}, [
|
|
103
|
+
reset
|
|
104
|
+
]);
|
|
105
|
+
if (didCatch) return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
106
|
+
ref: errorRef,
|
|
107
|
+
paddingX: [
|
|
108
|
+
2,
|
|
109
|
+
3,
|
|
110
|
+
4,
|
|
111
|
+
4
|
|
112
|
+
],
|
|
113
|
+
height: "fill",
|
|
114
|
+
shadow: 1,
|
|
115
|
+
overflow: "auto",
|
|
116
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
117
|
+
justify: "flex-start",
|
|
118
|
+
align: "center",
|
|
119
|
+
height: "fill",
|
|
120
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Grid), {
|
|
121
|
+
columns: 1,
|
|
122
|
+
gap: [
|
|
123
|
+
2,
|
|
124
|
+
3,
|
|
125
|
+
4,
|
|
126
|
+
4
|
|
127
|
+
],
|
|
128
|
+
children: [
|
|
129
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Heading), {
|
|
130
|
+
as: "h1",
|
|
131
|
+
children: [
|
|
132
|
+
"The ",
|
|
133
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("code", {
|
|
134
|
+
children: (0, $81deebaa2da6d866$export$a8ff84c12d48cfa6)
|
|
135
|
+
}),
|
|
136
|
+
" plugin crashed"
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
(error === null || error === void 0 ? void 0 : error.message) && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
140
|
+
padding: 3,
|
|
141
|
+
tone: "critical",
|
|
142
|
+
shadow: 1,
|
|
143
|
+
radius: 2,
|
|
144
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
145
|
+
children: error.message
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Inline), {
|
|
149
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
150
|
+
onClick: handleRetry,
|
|
151
|
+
text: "Retry"
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)(ErrorBoundary, {
|
|
159
|
+
children: children
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
var $3e1e9b96ff4a93b5$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $lAnAG$memo)($3e1e9b96ff4a93b5$var$ErrorBoundaryCard);
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
const $04b76def1942462e$var$path = [
|
|
173
|
+
"assetId",
|
|
174
|
+
"data",
|
|
175
|
+
"playbackId",
|
|
176
|
+
"status",
|
|
177
|
+
"thumbTime",
|
|
178
|
+
"filename"
|
|
179
|
+
];
|
|
180
|
+
const $04b76def1942462e$export$e11a382d55e07f75 = (asset)=>(0, $lAnAG$useDocumentValues)((0, $lAnAG$isReference)(asset) ? asset._ref : "", $04b76def1942462e$var$path);
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
function $bcf12693a12c12c4$export$573903f1c655c034() {
|
|
185
|
+
return (0, $lAnAG$useState)(false);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
const $658b60878501f8ec$export$fd270df25d7dbb88 = (asset)=>{
|
|
193
|
+
var ref3, ref1;
|
|
194
|
+
const client = (0, $lAnAG$useClient)();
|
|
195
|
+
const projectId = (0, $lAnAG$useProjectId)();
|
|
196
|
+
const dataset = (0, $lAnAG$useDataset)();
|
|
197
|
+
const shouldFetch = (0, $lAnAG$useMemo)(()=>{
|
|
198
|
+
var ref, ref2;
|
|
199
|
+
return !!(asset === null || asset === void 0 ? void 0 : asset.assetId) && ((asset === null || asset === void 0 ? void 0 : asset.status) === "preparing" || (asset === null || asset === void 0 ? void 0 : (ref = asset.data) === null || ref === void 0 ? void 0 : (ref2 = ref.static_renditions) === null || ref2 === void 0 ? void 0 : ref2.status) === "preparing");
|
|
200
|
+
}, [
|
|
201
|
+
asset === null || asset === void 0 ? void 0 : asset.assetId,
|
|
202
|
+
asset === null || asset === void 0 ? void 0 : (ref3 = asset.data) === null || ref3 === void 0 ? void 0 : (ref1 = ref3.static_renditions) === null || ref1 === void 0 ? void 0 : ref1.status,
|
|
203
|
+
asset === null || asset === void 0 ? void 0 : asset.status
|
|
204
|
+
]);
|
|
205
|
+
return (0, $lAnAG$swr)(shouldFetch ? `/${projectId}/addons/mux/assets/${dataset}/data/${asset === null || asset === void 0 ? void 0 : asset.assetId}` : null, async ()=>{
|
|
206
|
+
const { data: data } = await client.request({
|
|
207
|
+
url: `/addons/mux/assets/${dataset}/data/${asset.assetId}`,
|
|
208
|
+
withCredentials: true,
|
|
209
|
+
method: "GET"
|
|
210
|
+
});
|
|
211
|
+
client.patch(asset._id).set({
|
|
212
|
+
status: data.status,
|
|
213
|
+
data: data
|
|
214
|
+
}).commit({
|
|
215
|
+
returnDocuments: false
|
|
216
|
+
});
|
|
217
|
+
}, {
|
|
218
|
+
refreshInterval: 2000,
|
|
219
|
+
refreshWhenHidden: true,
|
|
220
|
+
dedupingInterval: 1000
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
const $264222da7614d565$var$path = [
|
|
229
|
+
"token",
|
|
230
|
+
"secretKey",
|
|
231
|
+
"enableSignedUrls",
|
|
232
|
+
"signingKeyId",
|
|
233
|
+
"signingKeyPrivate"
|
|
234
|
+
];
|
|
235
|
+
const $264222da7614d565$export$4c2801830a129eb = ()=>{
|
|
236
|
+
const { error: error , isLoading: isLoading , value: value } = (0, $lAnAG$useDocumentValues)((0, $81deebaa2da6d866$export$64952397958089dd), $264222da7614d565$var$path);
|
|
237
|
+
const cache = (0, $lAnAG$useMemo)(()=>{
|
|
238
|
+
const exists = Boolean(value);
|
|
239
|
+
const secrets = {
|
|
240
|
+
token: (value === null || value === void 0 ? void 0 : value.token) || null,
|
|
241
|
+
secretKey: (value === null || value === void 0 ? void 0 : value.secretKey) || null,
|
|
242
|
+
enableSignedUrls: (value === null || value === void 0 ? void 0 : value.enableSignedUrls) || false,
|
|
243
|
+
signingKeyId: (value === null || value === void 0 ? void 0 : value.signingKeyId) || null,
|
|
244
|
+
signingKeyPrivate: (value === null || value === void 0 ? void 0 : value.signingKeyPrivate) || null
|
|
245
|
+
};
|
|
246
|
+
return {
|
|
247
|
+
isInitialSetup: !exists,
|
|
248
|
+
needsSetup: !(secrets === null || secrets === void 0 ? void 0 : secrets.token) || !(secrets === null || secrets === void 0 ? void 0 : secrets.secretKey),
|
|
249
|
+
secrets: secrets
|
|
250
|
+
};
|
|
251
|
+
}, [
|
|
252
|
+
value
|
|
253
|
+
]);
|
|
254
|
+
return {
|
|
255
|
+
error: error,
|
|
256
|
+
isLoading: isLoading,
|
|
257
|
+
value: cache
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
function $7bedbd2b641d54d8$export$ad6eab20b4b3876f(uuid, uploadUrl, source) {
|
|
276
|
+
return new (0, $lAnAG$Observable)((subscriber)=>{
|
|
277
|
+
const upchunk = $lAnAG$createUpload({
|
|
278
|
+
endpoint: uploadUrl,
|
|
279
|
+
file: source,
|
|
280
|
+
chunkSize: 30720
|
|
281
|
+
});
|
|
282
|
+
const successHandler = ()=>{
|
|
283
|
+
subscriber.next({
|
|
284
|
+
type: "success",
|
|
285
|
+
id: uuid
|
|
286
|
+
});
|
|
287
|
+
subscriber.complete();
|
|
288
|
+
};
|
|
289
|
+
const errorHandler = (data)=>subscriber.error(new Error(data.detail.message));
|
|
290
|
+
const progressHandler = (data)=>{
|
|
291
|
+
return subscriber.next({
|
|
292
|
+
type: "progress",
|
|
293
|
+
percent: data.detail
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
const offlineHandler = ()=>{
|
|
297
|
+
upchunk.pause();
|
|
298
|
+
subscriber.next({
|
|
299
|
+
type: "pause",
|
|
300
|
+
id: uuid
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
const onlineHandler = ()=>{
|
|
304
|
+
upchunk.resume();
|
|
305
|
+
subscriber.next({
|
|
306
|
+
type: "resume",
|
|
307
|
+
id: uuid
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
upchunk.on("success", successHandler);
|
|
311
|
+
upchunk.on("error", errorHandler);
|
|
312
|
+
upchunk.on("progress", progressHandler);
|
|
313
|
+
upchunk.on("offline", offlineHandler);
|
|
314
|
+
upchunk.on("online", onlineHandler);
|
|
315
|
+
return ()=>upchunk.abort();
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
function $fb3009e6005435d0$export$df987b50509121ea(client, assetId) {
|
|
321
|
+
const { dataset: dataset } = client.config();
|
|
322
|
+
return client.request({
|
|
323
|
+
url: `/addons/mux/assets/${dataset}/${assetId}`,
|
|
324
|
+
withCredentials: true,
|
|
325
|
+
method: "DELETE"
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
function $fb3009e6005435d0$export$da446a5ee2572b7(client, assetId) {
|
|
329
|
+
const { dataset: dataset } = client.config();
|
|
330
|
+
return client.request({
|
|
331
|
+
url: `/addons/mux/assets/${dataset}/data/${assetId}`,
|
|
332
|
+
withCredentials: true,
|
|
333
|
+
method: "GET"
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
function $467babf025eab28e$export$f16c6d66b9790f06(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate) {
|
|
340
|
+
const doc = {
|
|
341
|
+
_id: "secrets.mux",
|
|
342
|
+
_type: "mux.apiKey",
|
|
343
|
+
token: token,
|
|
344
|
+
secretKey: secretKey,
|
|
345
|
+
enableSignedUrls: enableSignedUrls,
|
|
346
|
+
signingKeyId: signingKeyId,
|
|
347
|
+
signingKeyPrivate: signingKeyPrivate
|
|
348
|
+
};
|
|
349
|
+
return client.createOrReplace(doc);
|
|
350
|
+
}
|
|
351
|
+
function $467babf025eab28e$export$21cc0cab779cfac1(client) {
|
|
352
|
+
const { dataset: dataset } = client.config();
|
|
353
|
+
return client.request({
|
|
354
|
+
url: `/addons/mux/signing-keys/${dataset}`,
|
|
355
|
+
withCredentials: true,
|
|
356
|
+
method: "POST"
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function $467babf025eab28e$export$3a1df1322191b3ef(client) {
|
|
360
|
+
const { dataset: dataset } = client.config();
|
|
361
|
+
return client.request({
|
|
362
|
+
url: `/addons/mux/secrets/${dataset}/test`,
|
|
363
|
+
withCredentials: true,
|
|
364
|
+
method: "GET"
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
async function $467babf025eab28e$export$f5836111430d17bc(client, signingKeyId, signingKeyPrivate) {
|
|
368
|
+
if (!(signingKeyId && signingKeyPrivate)) return false;
|
|
369
|
+
const { dataset: dataset } = client.config();
|
|
370
|
+
try {
|
|
371
|
+
const res = await client.request({
|
|
372
|
+
url: `/addons/mux/signing-keys/${dataset}/${signingKeyId}`,
|
|
373
|
+
withCredentials: true,
|
|
374
|
+
method: "GET"
|
|
375
|
+
});
|
|
376
|
+
//
|
|
377
|
+
// if this signing key is valid it will return { data: { id: 'xxxx' } }
|
|
378
|
+
//
|
|
379
|
+
return !!(res.data && res.data.id);
|
|
380
|
+
} catch (e) {
|
|
381
|
+
console.error("Error fetching signingKeyId", signingKeyId, "assuming it is not valid");
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function $467babf025eab28e$export$7d1f83854429bc73(client) {
|
|
386
|
+
const { dataset: dataset } = client.config();
|
|
387
|
+
return (0, $lAnAG$defer)(()=>client.observable.request({
|
|
388
|
+
url: `/addons/mux/secrets/${dataset}/test`,
|
|
389
|
+
withCredentials: true,
|
|
390
|
+
method: "GET"
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
function $96f24671e0303f47$export$5130fb4c263997a4(client, uuid) {
|
|
396
|
+
return client.observable.request({
|
|
397
|
+
url: `/addons/mux/uploads/${client.clientConfig.dataset}/${uuid}`,
|
|
398
|
+
withCredentials: true,
|
|
399
|
+
method: "DELETE"
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function $96f24671e0303f47$export$f35af194eb27b25f(config, client, url, options = {}) {
|
|
403
|
+
return $96f24671e0303f47$var$testUrl(url).pipe((0, $lAnAG$switchMap)((validUrl)=>{
|
|
404
|
+
return (0, $lAnAG$concat)((0, $lAnAG$of)({
|
|
405
|
+
type: "url",
|
|
406
|
+
url: validUrl
|
|
407
|
+
}), (0, $467babf025eab28e$export$7d1f83854429bc73)(client).pipe((0, $lAnAG$switchMap)((json)=>{
|
|
408
|
+
if (!json || !json.status) return (0, $lAnAG$throwError)(new Error("Invalid credentials"));
|
|
409
|
+
const uuid = (0, $lAnAG$uuid)();
|
|
410
|
+
const { enableSignedUrls: enableSignedUrls } = options;
|
|
411
|
+
const muxBody = {
|
|
412
|
+
input: validUrl,
|
|
413
|
+
playback_policy: [
|
|
414
|
+
enableSignedUrls ? "signed" : "public"
|
|
415
|
+
],
|
|
416
|
+
mp4_support: config.mp4_support
|
|
417
|
+
};
|
|
418
|
+
const query = {
|
|
419
|
+
muxBody: JSON.stringify(muxBody),
|
|
420
|
+
filename: validUrl.split("/").slice(-1)[0]
|
|
421
|
+
};
|
|
422
|
+
const dataset = client.clientConfig.dataset;
|
|
423
|
+
return (0, $lAnAG$defer)(()=>client.observable.request({
|
|
424
|
+
url: `/addons/mux/assets/${dataset}`,
|
|
425
|
+
withCredentials: true,
|
|
426
|
+
method: "POST",
|
|
427
|
+
headers: {
|
|
428
|
+
"MUX-Proxy-UUID": uuid,
|
|
429
|
+
"Content-Type": "application/json"
|
|
430
|
+
},
|
|
431
|
+
query: query
|
|
432
|
+
})).pipe((0, $lAnAG$mergeMap)((result)=>{
|
|
433
|
+
const asset = result && result.results && result.results[0] && result.results[0].document || null;
|
|
434
|
+
if (!asset) return (0, $lAnAG$throwError)(new Error("No asset document returned"));
|
|
435
|
+
return (0, $lAnAG$of)({
|
|
436
|
+
type: "success",
|
|
437
|
+
id: uuid,
|
|
438
|
+
asset: asset
|
|
439
|
+
});
|
|
440
|
+
}));
|
|
441
|
+
})));
|
|
442
|
+
}));
|
|
443
|
+
}
|
|
444
|
+
function $96f24671e0303f47$export$a5575dbeeffdad98(config, client, file, options = {}) {
|
|
445
|
+
return $96f24671e0303f47$var$testFile(file).pipe((0, $lAnAG$switchMap)((fileOptions)=>{
|
|
446
|
+
return (0, $lAnAG$concat)((0, $lAnAG$of)({
|
|
447
|
+
type: "file",
|
|
448
|
+
file: fileOptions
|
|
449
|
+
}), (0, $467babf025eab28e$export$7d1f83854429bc73)(client).pipe((0, $lAnAG$switchMap)((json)=>{
|
|
450
|
+
if (!json || !json.status) return (0, $lAnAG$throwError)(new Error("Invalid credentials"));
|
|
451
|
+
const uuid = (0, $lAnAG$uuid)();
|
|
452
|
+
const { enableSignedUrls: enableSignedUrls } = options;
|
|
453
|
+
const body = {
|
|
454
|
+
mp4_support: config.mp4_support,
|
|
455
|
+
playback_policy: [
|
|
456
|
+
enableSignedUrls ? "signed" : "public"
|
|
457
|
+
]
|
|
458
|
+
};
|
|
459
|
+
return (0, $lAnAG$concat)((0, $lAnAG$of)({
|
|
460
|
+
type: "uuid",
|
|
461
|
+
uuid: uuid
|
|
462
|
+
}), (0, $lAnAG$defer)(()=>client.observable.request({
|
|
463
|
+
url: `/addons/mux/uploads/${client.clientConfig.dataset}`,
|
|
464
|
+
withCredentials: true,
|
|
465
|
+
method: "POST",
|
|
466
|
+
headers: {
|
|
467
|
+
"MUX-Proxy-UUID": uuid,
|
|
468
|
+
"Content-Type": "application/json"
|
|
469
|
+
},
|
|
470
|
+
body: body
|
|
471
|
+
})).pipe((0, $lAnAG$mergeMap)((result)=>{
|
|
472
|
+
return (0, $7bedbd2b641d54d8$export$ad6eab20b4b3876f)(uuid, result.upload.url, file).pipe(// eslint-disable-next-line no-warning-comments
|
|
473
|
+
// @TODO type the observable events
|
|
474
|
+
// eslint-disable-next-line max-nested-callbacks
|
|
475
|
+
(0, $lAnAG$mergeMap)((event)=>{
|
|
476
|
+
if (event.type !== "success") return (0, $lAnAG$of)(event);
|
|
477
|
+
return (0, $lAnAG$from)($96f24671e0303f47$var$updateAssetDocumentFromUpload(client, uuid)).pipe(// eslint-disable-next-line max-nested-callbacks
|
|
478
|
+
(0, $lAnAG$mergeMap)((doc)=>(0, $lAnAG$of)((0, $lAnAG$swchelperssrc_object_spread_propsmjs)((0, $lAnAG$swchelperssrc_object_spreadmjs)({}, event), {
|
|
479
|
+
asset: doc
|
|
480
|
+
}))));
|
|
481
|
+
}), // eslint-disable-next-line max-nested-callbacks
|
|
482
|
+
(0, $lAnAG$catchError)((err)=>{
|
|
483
|
+
// Delete asset document
|
|
484
|
+
return $96f24671e0303f47$export$5130fb4c263997a4(client, uuid).pipe((0, $lAnAG$mergeMapTo)((0, $lAnAG$throwError)(err)));
|
|
485
|
+
}));
|
|
486
|
+
})));
|
|
487
|
+
})));
|
|
488
|
+
}));
|
|
489
|
+
}
|
|
490
|
+
function $96f24671e0303f47$export$38276c014c550f86(client, assetId) {
|
|
491
|
+
const { dataset: dataset } = client.config();
|
|
492
|
+
return client.request({
|
|
493
|
+
url: `/addons/mux/uploads/${dataset}/${assetId}`,
|
|
494
|
+
withCredentials: true,
|
|
495
|
+
method: "GET"
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
function $96f24671e0303f47$var$pollUpload(client, uuid) {
|
|
499
|
+
const maxTries = 10;
|
|
500
|
+
let pollInterval;
|
|
501
|
+
let tries = 0;
|
|
502
|
+
let assetId;
|
|
503
|
+
let upload;
|
|
504
|
+
return new Promise((resolve, reject)=>{
|
|
505
|
+
pollInterval = setInterval(async ()=>{
|
|
506
|
+
try {
|
|
507
|
+
upload = await $96f24671e0303f47$export$38276c014c550f86(client, uuid);
|
|
508
|
+
} catch (err) {
|
|
509
|
+
reject(err);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
assetId = upload && upload.data && upload.data.asset_id;
|
|
513
|
+
if (assetId) {
|
|
514
|
+
clearInterval(pollInterval);
|
|
515
|
+
resolve(upload);
|
|
516
|
+
}
|
|
517
|
+
if (tries > maxTries) {
|
|
518
|
+
clearInterval(pollInterval);
|
|
519
|
+
reject(new Error("Upload did not finish"));
|
|
520
|
+
}
|
|
521
|
+
tries++;
|
|
522
|
+
}, 2000);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
async function $96f24671e0303f47$var$updateAssetDocumentFromUpload(client, uuid) {
|
|
526
|
+
let upload;
|
|
527
|
+
let asset;
|
|
528
|
+
try {
|
|
529
|
+
upload = await $96f24671e0303f47$var$pollUpload(client, uuid);
|
|
530
|
+
} catch (err) {
|
|
531
|
+
return Promise.reject(err);
|
|
532
|
+
}
|
|
533
|
+
try {
|
|
534
|
+
asset = await (0, $fb3009e6005435d0$export$da446a5ee2572b7)(client, upload.data.asset_id);
|
|
535
|
+
} catch (err1) {
|
|
536
|
+
return Promise.reject(err1);
|
|
537
|
+
}
|
|
538
|
+
const doc = {
|
|
539
|
+
_id: uuid,
|
|
540
|
+
_type: "mux.videoAsset",
|
|
541
|
+
status: asset.data.status,
|
|
542
|
+
data: asset.data,
|
|
543
|
+
assetId: asset.data.id,
|
|
544
|
+
playbackId: asset.data.playback_ids[0].id,
|
|
545
|
+
uploadId: upload.data.id
|
|
546
|
+
};
|
|
547
|
+
return client.createOrReplace(doc).then(()=>{
|
|
548
|
+
return doc;
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
function $96f24671e0303f47$var$testFile(file) {
|
|
552
|
+
if (typeof window !== "undefined" && file instanceof window.File) {
|
|
553
|
+
const fileOptions = $96f24671e0303f47$var$optionsFromFile({}, file);
|
|
554
|
+
return (0, $lAnAG$of)(fileOptions);
|
|
555
|
+
}
|
|
556
|
+
return (0, $lAnAG$throwError)(new Error("Invalid file"));
|
|
557
|
+
}
|
|
558
|
+
function $96f24671e0303f47$var$testUrl(url) {
|
|
559
|
+
const error = new Error("Invalid URL");
|
|
560
|
+
if (typeof url !== "string") return (0, $lAnAG$throwError)(error);
|
|
561
|
+
let parsed;
|
|
562
|
+
try {
|
|
563
|
+
parsed = new URL(url);
|
|
564
|
+
} catch (err) {
|
|
565
|
+
return (0, $lAnAG$throwError)(error);
|
|
566
|
+
}
|
|
567
|
+
if (parsed && !parsed.protocol.match(/http:|https:/)) return (0, $lAnAG$throwError)(error);
|
|
568
|
+
return (0, $lAnAG$of)(url);
|
|
569
|
+
}
|
|
570
|
+
function $96f24671e0303f47$var$optionsFromFile(opts, file) {
|
|
571
|
+
if (typeof window === "undefined" || !(file instanceof window.File)) return opts;
|
|
572
|
+
return {
|
|
573
|
+
name: opts.preserveFilename === false ? undefined : file.name,
|
|
574
|
+
type: file.type
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
function $4e510dd53b714187$export$73f6d6d8d794f645(dataTransfer) {
|
|
580
|
+
const files = Array.from(dataTransfer.files || []);
|
|
581
|
+
const items = Array.from(dataTransfer.items || []);
|
|
582
|
+
if (files && files.length > 0) return Promise.resolve(files);
|
|
583
|
+
return $4e510dd53b714187$var$normalizeItems(items).then((arr)=>arr.flat());
|
|
584
|
+
}
|
|
585
|
+
function $4e510dd53b714187$var$normalizeItems(items) {
|
|
586
|
+
return Promise.all(items.map((item)=>{
|
|
587
|
+
// directory
|
|
588
|
+
if (item.kind === "file" && item.webkitGetAsEntry) {
|
|
589
|
+
let entry;
|
|
590
|
+
// Edge throws
|
|
591
|
+
try {
|
|
592
|
+
entry = item.webkitGetAsEntry();
|
|
593
|
+
} catch (err) {
|
|
594
|
+
return [
|
|
595
|
+
item.getAsFile()
|
|
596
|
+
];
|
|
597
|
+
}
|
|
598
|
+
if (!entry) return [];
|
|
599
|
+
return entry.isDirectory ? $4e510dd53b714187$var$walk(entry) : [
|
|
600
|
+
item.getAsFile()
|
|
601
|
+
];
|
|
602
|
+
}
|
|
603
|
+
// file
|
|
604
|
+
if (item.kind === "file") {
|
|
605
|
+
const file = item.getAsFile();
|
|
606
|
+
return Promise.resolve(file ? [
|
|
607
|
+
file
|
|
608
|
+
] : []);
|
|
609
|
+
}
|
|
610
|
+
// others
|
|
611
|
+
return new Promise((resolve)=>item.getAsString(resolve)).then((str)=>str ? [
|
|
612
|
+
new File([
|
|
613
|
+
str
|
|
614
|
+
], "unknown.txt", {
|
|
615
|
+
type: item.type
|
|
616
|
+
})
|
|
617
|
+
] : []);
|
|
618
|
+
}));
|
|
619
|
+
}
|
|
620
|
+
function $4e510dd53b714187$var$isFile(entry) {
|
|
621
|
+
return entry.isFile;
|
|
622
|
+
}
|
|
623
|
+
function $4e510dd53b714187$var$isDirectory(entry) {
|
|
624
|
+
return entry.isDirectory;
|
|
625
|
+
}
|
|
626
|
+
function $4e510dd53b714187$var$walk(entry) {
|
|
627
|
+
if ($4e510dd53b714187$var$isFile(entry)) return new Promise((resolve)=>entry.file(resolve)).then((file)=>[
|
|
628
|
+
file
|
|
629
|
+
]);
|
|
630
|
+
if ($4e510dd53b714187$var$isDirectory(entry)) {
|
|
631
|
+
const dir = entry.createReader();
|
|
632
|
+
return new Promise((resolve)=>dir.readEntries(resolve)).then((entries)=>entries.filter((entr)=>!entr.name.startsWith("."))).then((entries)=>Promise.all(entries.map($4e510dd53b714187$var$walk)).then((arr)=>arr.flat()));
|
|
633
|
+
}
|
|
634
|
+
return Promise.resolve([]);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
const $3208be7e9a7ca648$export$9c7ae676ac45430a = "secrets.mux";
|
|
670
|
+
function $3208be7e9a7ca648$export$e6f48a1ef9de02f7(client) {
|
|
671
|
+
const { projectId: projectId , dataset: dataset } = client.config();
|
|
672
|
+
return (0, $lAnAG$suspend)(async ()=>{
|
|
673
|
+
const data = await client.fetch(/* groq */ `*[_id == $_id][0]{
|
|
674
|
+
token,
|
|
675
|
+
secretKey,
|
|
676
|
+
enableSignedUrls,
|
|
677
|
+
signingKeyId,
|
|
678
|
+
signingKeyPrivate
|
|
679
|
+
}`, {
|
|
680
|
+
_id: $3208be7e9a7ca648$export$9c7ae676ac45430a
|
|
681
|
+
});
|
|
682
|
+
return {
|
|
683
|
+
token: (data === null || data === void 0 ? void 0 : data.token) || null,
|
|
684
|
+
secretKey: (data === null || data === void 0 ? void 0 : data.secretKey) || null,
|
|
685
|
+
enableSignedUrls: Boolean(data === null || data === void 0 ? void 0 : data.enableSignedUrls) || false,
|
|
686
|
+
signingKeyId: (data === null || data === void 0 ? void 0 : data.signingKeyId) || null,
|
|
687
|
+
signingKeyPrivate: (data === null || data === void 0 ? void 0 : data.signingKeyPrivate) || null
|
|
688
|
+
};
|
|
689
|
+
}, [
|
|
690
|
+
(0, $81deebaa2da6d866$export$13cdb654d47e0703),
|
|
691
|
+
$3208be7e9a7ca648$export$9c7ae676ac45430a,
|
|
692
|
+
projectId,
|
|
693
|
+
dataset
|
|
694
|
+
]);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
function $df808f32f86dd2c3$export$87b96baf1080652a(client, playbackId, aud, payload) {
|
|
699
|
+
const { signingKeyId: signingKeyId , signingKeyPrivate: signingKeyPrivate } = (0, $3208be7e9a7ca648$export$e6f48a1ef9de02f7)(client);
|
|
700
|
+
if (!signingKeyId) throw new TypeError("Missing signingKeyId");
|
|
701
|
+
if (!signingKeyPrivate) throw new TypeError("Missing signingKeyPrivate");
|
|
702
|
+
/*
|
|
703
|
+
const {sign}: {sign: typeof import('jsonwebtoken-esm/sign')['default']} = suspend(async () => {
|
|
704
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
705
|
+
const {default: sign} = await import('jsonwebtoken-esm/sign')
|
|
706
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
707
|
+
return {sign: (payload: any, secret: any, options: any) => sign(payload, secret, options)}
|
|
708
|
+
}, ['sanity-plugin-mux-input', 'jsonwebtoken-esm/sign'])
|
|
709
|
+
// */ return (0, $lAnAG$sign)(payload ? JSON.parse(JSON.stringify(payload, (_, v)=>v !== null && v !== void 0 ? v : undefined)) : {}, atob(signingKeyPrivate), {
|
|
710
|
+
algorithm: "RS256",
|
|
711
|
+
keyid: signingKeyId,
|
|
712
|
+
audience: aud,
|
|
713
|
+
subject: playbackId,
|
|
714
|
+
noTimestamp: true,
|
|
715
|
+
expiresIn: "12h"
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
function $b87ee69f3b2fe2f8$export$bdfa34d24bb44333(asset) {
|
|
721
|
+
if (!(asset === null || asset === void 0 ? void 0 : asset.playbackId)) {
|
|
722
|
+
console.error("Asset is missing a playbackId", {
|
|
723
|
+
asset: asset
|
|
724
|
+
});
|
|
725
|
+
throw new TypeError(`Missing playbackId`);
|
|
726
|
+
}
|
|
727
|
+
return asset.playbackId;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
function $53c0557e92647bc3$export$f7d2546fac75bbd(asset) {
|
|
732
|
+
var ref, ref1, ref2;
|
|
733
|
+
var ref3;
|
|
734
|
+
return (ref3 = (ref = asset.data) === null || ref === void 0 ? void 0 : (ref1 = ref.playback_ids) === null || ref1 === void 0 ? void 0 : (ref2 = ref1[0]) === null || ref2 === void 0 ? void 0 : ref2.policy) !== null && ref3 !== void 0 ? ref3 : "public";
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
function $c8304e4048a0619d$export$6adb108e2a577699({ asset: asset , client: client , height: height , width: width , start: start = asset.thumbTime ? Math.max(0, asset.thumbTime - 2.5) : 0 , end: end = start + 5 , fps: fps = 15 }) {
|
|
739
|
+
const params = {
|
|
740
|
+
height: height,
|
|
741
|
+
width: width,
|
|
742
|
+
start: start,
|
|
743
|
+
end: end,
|
|
744
|
+
fps: fps
|
|
745
|
+
};
|
|
746
|
+
const playbackId = (0, $b87ee69f3b2fe2f8$export$bdfa34d24bb44333)(asset);
|
|
747
|
+
let searchParams = new URLSearchParams(JSON.parse(JSON.stringify(params, (_, v)=>v !== null && v !== void 0 ? v : undefined)));
|
|
748
|
+
if ((0, $53c0557e92647bc3$export$f7d2546fac75bbd)(asset) === "signed") {
|
|
749
|
+
const token = (0, $df808f32f86dd2c3$export$87b96baf1080652a)(client, playbackId, "g", params);
|
|
750
|
+
searchParams = new URLSearchParams({
|
|
751
|
+
token: token
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
return `https://image.mux.com/${playbackId}/animated.gif?${searchParams}`;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
function $649e715c42156121$export$8081e7a11b9f1345({ asset: asset , client: client , fit_mode: fit_mode , height: height , time: time = asset.thumbTime , width: width }) {
|
|
763
|
+
const params = {
|
|
764
|
+
fit_mode: fit_mode,
|
|
765
|
+
height: height,
|
|
766
|
+
time: time,
|
|
767
|
+
width: width
|
|
768
|
+
};
|
|
769
|
+
const playbackId = (0, $b87ee69f3b2fe2f8$export$bdfa34d24bb44333)(asset);
|
|
770
|
+
let searchParams = new URLSearchParams(JSON.parse(JSON.stringify(params, (_, v)=>v !== null && v !== void 0 ? v : undefined)));
|
|
771
|
+
if ((0, $53c0557e92647bc3$export$f7d2546fac75bbd)(asset) === "signed") {
|
|
772
|
+
const token = (0, $df808f32f86dd2c3$export$87b96baf1080652a)(client, playbackId, "t", params);
|
|
773
|
+
searchParams = new URLSearchParams({
|
|
774
|
+
token: token
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
return `https://image.mux.com/${playbackId}/thumbnail.png?${searchParams}`;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
let $6d61ace35324696d$var$_ = (t5)=>t5, $6d61ace35324696d$var$t, $6d61ace35324696d$var$t1, $6d61ace35324696d$var$t2, $6d61ace35324696d$var$t3, $6d61ace35324696d$var$t4;
|
|
782
|
+
const $6d61ace35324696d$var$mediaDimensions = {
|
|
783
|
+
aspect: 16 / 9
|
|
784
|
+
};
|
|
785
|
+
const $6d61ace35324696d$var$ImageLoader = /*#__PURE__*/ (0, $lAnAG$memo)(function ImageLoader({ alt: alt , src: src , height: height , width: width , aspectRatio: aspectRatio }) {
|
|
786
|
+
(0, $lAnAG$suspend)(async ()=>{
|
|
787
|
+
const img = new Image(width, height);
|
|
788
|
+
img.decoding = "async";
|
|
789
|
+
img.src = src;
|
|
790
|
+
await img.decode();
|
|
791
|
+
}, [
|
|
792
|
+
"sanity-plugin-mux-input",
|
|
793
|
+
"image",
|
|
794
|
+
src
|
|
795
|
+
]);
|
|
796
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)("img", {
|
|
797
|
+
alt: alt,
|
|
798
|
+
src: src,
|
|
799
|
+
height: height,
|
|
800
|
+
width: width,
|
|
801
|
+
style: {
|
|
802
|
+
aspectRatio: aspectRatio
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
const $6d61ace35324696d$var$VideoMediaPreview = (0, $lAnAG$styledcomponents)((0, $lAnAG$MediaPreview))($6d61ace35324696d$var$t || ($6d61ace35324696d$var$t = $6d61ace35324696d$var$_`
|
|
807
|
+
img {
|
|
808
|
+
object-fit: cover;
|
|
809
|
+
}
|
|
810
|
+
`));
|
|
811
|
+
const $6d61ace35324696d$var$VideoMediaPreviewSignedSubtitle = ({ solo: solo })=>{
|
|
812
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Inline), {
|
|
813
|
+
space: 1,
|
|
814
|
+
style: {
|
|
815
|
+
marginTop: solo ? "-1.35em" : undefined,
|
|
816
|
+
marginBottom: solo ? undefined : "0.35rem"
|
|
817
|
+
},
|
|
818
|
+
children: [
|
|
819
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$LockIcon), {}),
|
|
820
|
+
"Signed playback policy"
|
|
821
|
+
]
|
|
822
|
+
});
|
|
823
|
+
};
|
|
824
|
+
const $6d61ace35324696d$var$PosterImage = ({ asset: asset , height: height , width: width , showTip: showTip })=>{
|
|
825
|
+
const client = (0, $lAnAG$useClient)();
|
|
826
|
+
const src = (0, $649e715c42156121$export$8081e7a11b9f1345)({
|
|
827
|
+
asset: asset,
|
|
828
|
+
client: client,
|
|
829
|
+
height: height,
|
|
830
|
+
width: width,
|
|
831
|
+
fit_mode: "smartcrop"
|
|
832
|
+
});
|
|
833
|
+
const subtitle = (0, $lAnAG$useMemo)(()=>showTip && (0, $53c0557e92647bc3$export$f7d2546fac75bbd)(asset) === "signed" ? /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$VideoMediaPreviewSignedSubtitle, {
|
|
834
|
+
solo: true
|
|
835
|
+
}) : undefined, [
|
|
836
|
+
asset,
|
|
837
|
+
showTip
|
|
838
|
+
]);
|
|
839
|
+
// eslint-disable-next-line no-warning-comments
|
|
840
|
+
// @TODO support setting the alt text in the schema, like how we deal with images
|
|
841
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$VideoMediaPreview, {
|
|
842
|
+
mediaDimensions: $6d61ace35324696d$var$mediaDimensions,
|
|
843
|
+
subtitle: subtitle,
|
|
844
|
+
title: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Fragment), {
|
|
845
|
+
children: null
|
|
846
|
+
}),
|
|
847
|
+
media: /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$ImageLoader, {
|
|
848
|
+
alt: "",
|
|
849
|
+
src: src,
|
|
850
|
+
height: height,
|
|
851
|
+
width: width
|
|
852
|
+
})
|
|
853
|
+
});
|
|
854
|
+
};
|
|
855
|
+
const $6d61ace35324696d$export$bd4b73f15688a160 = /*#__PURE__*/ (0, $lAnAG$memo)(function VideoThumbnail({ asset: asset , width: width , showTip: showTip }) {
|
|
856
|
+
const { ErrorBoundary: ErrorBoundary , didCatch: didCatch , error: error } = (0, $lAnAG$useErrorBoundary)();
|
|
857
|
+
const height = Math.round(width * 9 / 16);
|
|
858
|
+
const subtitle = (0, $lAnAG$useMemo)(()=>showTip && (0, $53c0557e92647bc3$export$f7d2546fac75bbd)(asset) === "signed" ? /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$VideoMediaPreviewSignedSubtitle, {}) : undefined, [
|
|
859
|
+
showTip,
|
|
860
|
+
asset
|
|
861
|
+
]);
|
|
862
|
+
if (didCatch) return /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$VideoMediaPreview, {
|
|
863
|
+
subtitle: error.message,
|
|
864
|
+
mediaDimensions: $6d61ace35324696d$var$mediaDimensions,
|
|
865
|
+
title: "Error when loading thumbnail",
|
|
866
|
+
media: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
867
|
+
radius: 2,
|
|
868
|
+
height: "fill",
|
|
869
|
+
style: {
|
|
870
|
+
position: "relative",
|
|
871
|
+
width: "100%"
|
|
872
|
+
},
|
|
873
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
874
|
+
style: {
|
|
875
|
+
display: "flex",
|
|
876
|
+
justifyContent: "center",
|
|
877
|
+
alignItems: "center",
|
|
878
|
+
position: "absolute",
|
|
879
|
+
top: 0,
|
|
880
|
+
left: 0,
|
|
881
|
+
right: 0,
|
|
882
|
+
bottom: 0
|
|
883
|
+
},
|
|
884
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$UnknownIcon), {})
|
|
885
|
+
})
|
|
886
|
+
})
|
|
887
|
+
});
|
|
888
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)(ErrorBoundary, {
|
|
889
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Suspense), {
|
|
890
|
+
fallback: /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$VideoMediaPreview, {
|
|
891
|
+
isPlaceholder: true,
|
|
892
|
+
title: "Loading thumbnail...",
|
|
893
|
+
subtitle: subtitle,
|
|
894
|
+
mediaDimensions: $6d61ace35324696d$var$mediaDimensions
|
|
895
|
+
}),
|
|
896
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$PosterImage, {
|
|
897
|
+
showTip: showTip,
|
|
898
|
+
asset: asset,
|
|
899
|
+
height: height,
|
|
900
|
+
width: width
|
|
901
|
+
})
|
|
902
|
+
})
|
|
903
|
+
});
|
|
904
|
+
});
|
|
905
|
+
const $6d61ace35324696d$var$AnimatedVideoMediaPreview = (0, $lAnAG$styledcomponents)((0, $lAnAG$MediaPreview))($6d61ace35324696d$var$t1 || ($6d61ace35324696d$var$t1 = $6d61ace35324696d$var$_`
|
|
906
|
+
img {
|
|
907
|
+
object-fit: contain;
|
|
908
|
+
}
|
|
909
|
+
`));
|
|
910
|
+
const $6d61ace35324696d$var$AnimatedPosterImage = ({ asset: asset , width: width })=>{
|
|
911
|
+
const client = (0, $lAnAG$useClient)();
|
|
912
|
+
const src = (0, $c8304e4048a0619d$export$6adb108e2a577699)({
|
|
913
|
+
asset: asset,
|
|
914
|
+
client: client,
|
|
915
|
+
width: width
|
|
916
|
+
});
|
|
917
|
+
// eslint-disable-next-line no-warning-comments
|
|
918
|
+
// @TODO support setting the alt text in the schema, like how we deal with images
|
|
919
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$AnimatedVideoMediaPreview, {
|
|
920
|
+
withBorder: false,
|
|
921
|
+
mediaDimensions: $6d61ace35324696d$var$mediaDimensions,
|
|
922
|
+
media: /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$ImageLoader, {
|
|
923
|
+
alt: "",
|
|
924
|
+
src: src,
|
|
925
|
+
width: width,
|
|
926
|
+
aspectRatio: "16:9"
|
|
927
|
+
})
|
|
928
|
+
});
|
|
929
|
+
};
|
|
930
|
+
const $6d61ace35324696d$export$357b57aa2db6117e = /*#__PURE__*/ (0, $lAnAG$memo)(function AnimatedVideoThumbnail({ asset: asset , width: width }) {
|
|
931
|
+
const { ErrorBoundary: ErrorBoundary , didCatch: didCatch } = (0, $lAnAG$useErrorBoundary)();
|
|
932
|
+
if (didCatch) return null;
|
|
933
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)(ErrorBoundary, {
|
|
934
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Suspense), {
|
|
935
|
+
fallback: /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$FancyBackdrop, {
|
|
936
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$VideoMediaPreview, {
|
|
937
|
+
mediaDimensions: $6d61ace35324696d$var$mediaDimensions,
|
|
938
|
+
withBorder: false,
|
|
939
|
+
media: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Spinner), {
|
|
940
|
+
muted: true
|
|
941
|
+
})
|
|
942
|
+
})
|
|
943
|
+
}),
|
|
944
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
945
|
+
height: "fill",
|
|
946
|
+
tone: "transparent",
|
|
947
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)($6d61ace35324696d$var$AnimatedPosterImage, {
|
|
948
|
+
asset: asset,
|
|
949
|
+
width: width
|
|
950
|
+
})
|
|
951
|
+
})
|
|
952
|
+
})
|
|
953
|
+
});
|
|
954
|
+
});
|
|
955
|
+
const $6d61ace35324696d$var$FancyBackdrop = (0, $lAnAG$styledcomponents)((0, $lAnAG$Box))($6d61ace35324696d$var$t2 || ($6d61ace35324696d$var$t2 = $6d61ace35324696d$var$_`
|
|
956
|
+
backdrop-filter: blur(8px) brightness(0.5) saturate(2);
|
|
957
|
+
mix-blend-mode: color-dodge;
|
|
958
|
+
`));
|
|
959
|
+
const $6d61ace35324696d$export$e20c438ffc62921 = (0, $lAnAG$styledcomponents)((0, $lAnAG$Grid))($6d61ace35324696d$var$t3 || ($6d61ace35324696d$var$t3 = $6d61ace35324696d$var$_`
|
|
960
|
+
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
|
961
|
+
`));
|
|
962
|
+
const $6d61ace35324696d$export$7431cee690d58bc9 = (0, $lAnAG$styledcomponents)((0, $lAnAG$Card))($6d61ace35324696d$var$t4 || ($6d61ace35324696d$var$t4 = $6d61ace35324696d$var$_`
|
|
963
|
+
border-top: 1px solid var(--card-border-color);
|
|
964
|
+
position: sticky;
|
|
965
|
+
bottom: 0;
|
|
966
|
+
z-index: 200;
|
|
967
|
+
`));
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
let $2fdb71a9c6d7e845$var$_ = (t2)=>t2, $2fdb71a9c6d7e845$var$t, $2fdb71a9c6d7e845$var$t1;
|
|
971
|
+
function $2fdb71a9c6d7e845$var$AssetActionsMenu(props) {
|
|
972
|
+
const { asset: asset } = props;
|
|
973
|
+
const id = (0, $lAnAG$useId)();
|
|
974
|
+
const [dialogState, setDialogState] = (0, $lAnAG$useState)();
|
|
975
|
+
const [open, setOpen] = (0, $lAnAG$useState)(false);
|
|
976
|
+
const [menuElement, setMenuRef] = (0, $lAnAG$useState)(null);
|
|
977
|
+
const handleDelete = (0, $lAnAG$useCallback)(()=>setDialogState("confirm-delete"), []);
|
|
978
|
+
const handleClick = (0, $lAnAG$useCallback)(()=>{
|
|
979
|
+
setDialogState(false);
|
|
980
|
+
setOpen(true);
|
|
981
|
+
}, [
|
|
982
|
+
setDialogState
|
|
983
|
+
]);
|
|
984
|
+
const handleClose = (0, $lAnAG$useCallback)(()=>{
|
|
985
|
+
setDialogState(false);
|
|
986
|
+
setOpen(false);
|
|
987
|
+
}, [
|
|
988
|
+
setDialogState
|
|
989
|
+
]);
|
|
990
|
+
(0, $lAnAG$useEffect)(()=>{
|
|
991
|
+
if (open && dialogState) setOpen(false);
|
|
992
|
+
}, [
|
|
993
|
+
dialogState,
|
|
994
|
+
open
|
|
995
|
+
]);
|
|
996
|
+
(0, $lAnAG$useClickOutside)((0, $lAnAG$useCallback)(()=>setOpen(false), []), [
|
|
997
|
+
menuElement
|
|
998
|
+
]);
|
|
999
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Fragment), {
|
|
1000
|
+
children: [
|
|
1001
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MenuButton), {
|
|
1002
|
+
id: `${id}-asset-menu`,
|
|
1003
|
+
button: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
1004
|
+
icon: (0, $lAnAG$EllipsisVerticalIcon),
|
|
1005
|
+
mode: "ghost",
|
|
1006
|
+
onClick: handleClick,
|
|
1007
|
+
padding: 2
|
|
1008
|
+
}),
|
|
1009
|
+
menu: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Menu), {
|
|
1010
|
+
ref: setMenuRef,
|
|
1011
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MenuItem), {
|
|
1012
|
+
tone: "critical",
|
|
1013
|
+
icon: (0, $lAnAG$TrashIcon),
|
|
1014
|
+
text: "Delete",
|
|
1015
|
+
onClick: handleDelete
|
|
1016
|
+
})
|
|
1017
|
+
}),
|
|
1018
|
+
portal: true,
|
|
1019
|
+
placement: "right"
|
|
1020
|
+
}),
|
|
1021
|
+
dialogState === "confirm-delete" && /*#__PURE__*/ (0, $lAnAG$jsx)($2fdb71a9c6d7e845$var$DeleteDialog, {
|
|
1022
|
+
asset: asset,
|
|
1023
|
+
onClose: handleClose
|
|
1024
|
+
})
|
|
1025
|
+
]
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function $2fdb71a9c6d7e845$var$DeleteDialog(props) {
|
|
1029
|
+
const { asset: asset , onClose: onClose } = props;
|
|
1030
|
+
const client = (0, $lAnAG$useClient)();
|
|
1031
|
+
const { push: pushToast } = (0, $lAnAG$useToast)();
|
|
1032
|
+
const [deleting, setDeleting] = (0, $lAnAG$useState)(false);
|
|
1033
|
+
const [deleteOnMux, setDeleteOnMux] = (0, $lAnAG$useState)(false);
|
|
1034
|
+
const id = (0, $lAnAG$useId)();
|
|
1035
|
+
const noPaddingOnStack = true;
|
|
1036
|
+
const width = 200 * (0, $lAnAG$getDevicePixelRatio)({
|
|
1037
|
+
maxDpr: 2
|
|
1038
|
+
});
|
|
1039
|
+
const handleDelete = (0, $lAnAG$useCallback)(async ()=>{
|
|
1040
|
+
setDeleting(true);
|
|
1041
|
+
try {
|
|
1042
|
+
var ref, ref1, ref2;
|
|
1043
|
+
if (asset === null || asset === void 0 ? void 0 : asset._id) await client.delete(asset._id);
|
|
1044
|
+
if (deleteOnMux && (asset === null || asset === void 0 ? void 0 : asset.assetId)) await (0, $fb3009e6005435d0$export$df987b50509121ea)(client, asset.assetId);
|
|
1045
|
+
(ref = document.querySelector(`[data-id="${asset._id}"]`)) === null || ref === void 0 ? void 0 : (ref1 = ref.parentElement) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.setAttribute) === null || ref2 === void 0 ? void 0 : ref2.call(ref1, "hidden", "true");
|
|
1046
|
+
} catch (err) {
|
|
1047
|
+
console.error("Failed during delete", err);
|
|
1048
|
+
pushToast({
|
|
1049
|
+
closable: true,
|
|
1050
|
+
description: err.message,
|
|
1051
|
+
duration: 5000,
|
|
1052
|
+
title: "Uncaught error",
|
|
1053
|
+
status: "error"
|
|
1054
|
+
});
|
|
1055
|
+
} finally{
|
|
1056
|
+
setDeleting(false);
|
|
1057
|
+
onClose();
|
|
1058
|
+
}
|
|
1059
|
+
}, [
|
|
1060
|
+
asset._id,
|
|
1061
|
+
asset.assetId,
|
|
1062
|
+
client,
|
|
1063
|
+
deleteOnMux,
|
|
1064
|
+
onClose,
|
|
1065
|
+
pushToast
|
|
1066
|
+
]);
|
|
1067
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Dialog), {
|
|
1068
|
+
onClose: onClose,
|
|
1069
|
+
id: `${id}-confirm-delete`,
|
|
1070
|
+
header: "Delete video",
|
|
1071
|
+
footer: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Grid), {
|
|
1072
|
+
padding: 2,
|
|
1073
|
+
gap: 2,
|
|
1074
|
+
columns: 2,
|
|
1075
|
+
children: [
|
|
1076
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
1077
|
+
mode: "bleed",
|
|
1078
|
+
text: "Cancel",
|
|
1079
|
+
onClick: onClose
|
|
1080
|
+
}),
|
|
1081
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
1082
|
+
text: "Delete",
|
|
1083
|
+
tone: "critical",
|
|
1084
|
+
icon: (0, $lAnAG$TrashIcon),
|
|
1085
|
+
onClick: handleDelete,
|
|
1086
|
+
loading: deleting
|
|
1087
|
+
})
|
|
1088
|
+
]
|
|
1089
|
+
}),
|
|
1090
|
+
// __unstable_autoFocus
|
|
1091
|
+
width: 1,
|
|
1092
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Stack), {
|
|
1093
|
+
paddingX: noPaddingOnStack ? 0 : [
|
|
1094
|
+
2,
|
|
1095
|
+
3,
|
|
1096
|
+
4
|
|
1097
|
+
],
|
|
1098
|
+
paddingY: noPaddingOnStack ? 0 : [
|
|
1099
|
+
3,
|
|
1100
|
+
3,
|
|
1101
|
+
3,
|
|
1102
|
+
4
|
|
1103
|
+
],
|
|
1104
|
+
space: 1,
|
|
1105
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
1106
|
+
paddingX: [
|
|
1107
|
+
2,
|
|
1108
|
+
3,
|
|
1109
|
+
4
|
|
1110
|
+
],
|
|
1111
|
+
paddingY: [
|
|
1112
|
+
3,
|
|
1113
|
+
3,
|
|
1114
|
+
3,
|
|
1115
|
+
4
|
|
1116
|
+
],
|
|
1117
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Grid), {
|
|
1118
|
+
columns: 3,
|
|
1119
|
+
gap: 3,
|
|
1120
|
+
children: [
|
|
1121
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
1122
|
+
style: {
|
|
1123
|
+
gridColumn: "span 2"
|
|
1124
|
+
},
|
|
1125
|
+
align: "center",
|
|
1126
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
1127
|
+
padding: 4,
|
|
1128
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
1129
|
+
space: 4,
|
|
1130
|
+
children: [
|
|
1131
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
1132
|
+
align: "center",
|
|
1133
|
+
as: "label",
|
|
1134
|
+
children: [
|
|
1135
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Checkbox), {
|
|
1136
|
+
checked: deleteOnMux,
|
|
1137
|
+
onChange: ()=>setDeleteOnMux((prev)=>!prev)
|
|
1138
|
+
}),
|
|
1139
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
1140
|
+
style: {
|
|
1141
|
+
margin: "0 10px"
|
|
1142
|
+
},
|
|
1143
|
+
children: "Delete asset on Mux"
|
|
1144
|
+
})
|
|
1145
|
+
]
|
|
1146
|
+
}),
|
|
1147
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
1148
|
+
align: "center",
|
|
1149
|
+
as: "label",
|
|
1150
|
+
children: [
|
|
1151
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Checkbox), {
|
|
1152
|
+
disabled: true,
|
|
1153
|
+
checked: true
|
|
1154
|
+
}),
|
|
1155
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
1156
|
+
style: {
|
|
1157
|
+
margin: "0 10px"
|
|
1158
|
+
},
|
|
1159
|
+
children: "Delete video from dataset"
|
|
1160
|
+
})
|
|
1161
|
+
]
|
|
1162
|
+
})
|
|
1163
|
+
]
|
|
1164
|
+
})
|
|
1165
|
+
})
|
|
1166
|
+
}),
|
|
1167
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$bd4b73f15688a160), {
|
|
1168
|
+
asset: asset,
|
|
1169
|
+
width: width,
|
|
1170
|
+
showTip: true
|
|
1171
|
+
})
|
|
1172
|
+
]
|
|
1173
|
+
})
|
|
1174
|
+
})
|
|
1175
|
+
})
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
function $2fdb71a9c6d7e845$export$2e2bcd8739ae039({ assets: assets , isLoading: isLoading , isLastPage: isLastPage , onSelect: onSelect , onLoadMore: onLoadMore }) {
|
|
1179
|
+
const handleClick = (0, $lAnAG$useCallback)((event)=>onSelect(event.currentTarget.dataset.id), [
|
|
1180
|
+
onSelect
|
|
1181
|
+
]);
|
|
1182
|
+
const handleKeyPress = (0, $lAnAG$useCallback)((event)=>{
|
|
1183
|
+
if (event.key === "Enter") onSelect(event.currentTarget.dataset.id);
|
|
1184
|
+
}, [
|
|
1185
|
+
onSelect
|
|
1186
|
+
]);
|
|
1187
|
+
const width = 200 * (0, $lAnAG$getDevicePixelRatio)({
|
|
1188
|
+
maxDpr: 2
|
|
1189
|
+
});
|
|
1190
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Fragment), {
|
|
1191
|
+
children: [
|
|
1192
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Box), {
|
|
1193
|
+
padding: 4,
|
|
1194
|
+
children: [
|
|
1195
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$e20c438ffc62921), {
|
|
1196
|
+
gap: 2,
|
|
1197
|
+
children: assets.map((asset)=>/*#__PURE__*/ (0, $lAnAG$jsx)($2fdb71a9c6d7e845$var$VideoSourceItem, {
|
|
1198
|
+
asset: asset,
|
|
1199
|
+
onClick: handleClick,
|
|
1200
|
+
onKeyPress: handleKeyPress,
|
|
1201
|
+
width: width
|
|
1202
|
+
}, asset._id))
|
|
1203
|
+
}),
|
|
1204
|
+
isLoading && assets.length === 0 && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
1205
|
+
justify: "center",
|
|
1206
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Spinner), {
|
|
1207
|
+
muted: true
|
|
1208
|
+
})
|
|
1209
|
+
}),
|
|
1210
|
+
!isLoading && assets.length === 0 && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
1211
|
+
align: "center",
|
|
1212
|
+
muted: true,
|
|
1213
|
+
children: "No videos"
|
|
1214
|
+
})
|
|
1215
|
+
]
|
|
1216
|
+
}),
|
|
1217
|
+
assets.length > 0 && !isLastPage && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$7431cee690d58bc9), {
|
|
1218
|
+
tone: "default",
|
|
1219
|
+
padding: 4,
|
|
1220
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
1221
|
+
direction: "column",
|
|
1222
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
1223
|
+
type: "button",
|
|
1224
|
+
icon: (0, $lAnAG$DownloadIcon),
|
|
1225
|
+
loading: isLoading,
|
|
1226
|
+
onClick: onLoadMore,
|
|
1227
|
+
text: "Load more",
|
|
1228
|
+
tone: "primary"
|
|
1229
|
+
})
|
|
1230
|
+
})
|
|
1231
|
+
})
|
|
1232
|
+
]
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
const $2fdb71a9c6d7e845$var$_VideoSourceItem = ({ asset: asset , onClick: onClick , onKeyPress: onKeyPress , width: width })=>{
|
|
1236
|
+
const [hover, setHover] = (0, $lAnAG$useState)(null);
|
|
1237
|
+
const ref = (0, $lAnAG$useRef)(null);
|
|
1238
|
+
(0, $lAnAG$useLayoutEffect)(()=>{
|
|
1239
|
+
if (!ref.current || hover === null) return;
|
|
1240
|
+
if (hover) (0, $lAnAG$animate)(ref.current, {
|
|
1241
|
+
opacity: 1
|
|
1242
|
+
});
|
|
1243
|
+
else (0, $lAnAG$animate)(ref.current, {
|
|
1244
|
+
opacity: 0
|
|
1245
|
+
});
|
|
1246
|
+
}, [
|
|
1247
|
+
hover
|
|
1248
|
+
]);
|
|
1249
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Box), {
|
|
1250
|
+
height: "fill",
|
|
1251
|
+
style: {
|
|
1252
|
+
position: "relative"
|
|
1253
|
+
},
|
|
1254
|
+
children: [
|
|
1255
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Card), {
|
|
1256
|
+
as: "button",
|
|
1257
|
+
"data-id": asset._id,
|
|
1258
|
+
onClick: onClick,
|
|
1259
|
+
onKeyPress: onKeyPress,
|
|
1260
|
+
tabIndex: 0,
|
|
1261
|
+
radius: 2,
|
|
1262
|
+
padding: 1,
|
|
1263
|
+
style: {
|
|
1264
|
+
lineHeight: 0,
|
|
1265
|
+
position: "relative"
|
|
1266
|
+
},
|
|
1267
|
+
__unstable_focusRing: true,
|
|
1268
|
+
onMouseEnter: ()=>setHover(true),
|
|
1269
|
+
onMouseLeave: ()=>setHover(false),
|
|
1270
|
+
children: [
|
|
1271
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$bd4b73f15688a160), {
|
|
1272
|
+
asset: asset,
|
|
1273
|
+
width: width,
|
|
1274
|
+
showTip: true
|
|
1275
|
+
}),
|
|
1276
|
+
(asset === null || asset === void 0 ? void 0 : asset.playbackId) && /*#__PURE__*/ (0, $lAnAG$jsx)($2fdb71a9c6d7e845$var$AnimateWrapper, {
|
|
1277
|
+
tone: "transparent",
|
|
1278
|
+
ref: ref,
|
|
1279
|
+
margin: 1,
|
|
1280
|
+
radius: 1,
|
|
1281
|
+
children: hover !== null && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$357b57aa2db6117e), {
|
|
1282
|
+
asset: asset,
|
|
1283
|
+
width: width
|
|
1284
|
+
})
|
|
1285
|
+
})
|
|
1286
|
+
]
|
|
1287
|
+
}),
|
|
1288
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)($2fdb71a9c6d7e845$var$ActionsAssetsContainer, {
|
|
1289
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)($2fdb71a9c6d7e845$var$AssetActionsMenu, {
|
|
1290
|
+
asset: asset
|
|
1291
|
+
})
|
|
1292
|
+
})
|
|
1293
|
+
]
|
|
1294
|
+
});
|
|
1295
|
+
};
|
|
1296
|
+
const $2fdb71a9c6d7e845$var$VideoSourceItem = /*#__PURE__*/ (0, $lAnAG$memo)($2fdb71a9c6d7e845$var$_VideoSourceItem);
|
|
1297
|
+
const $2fdb71a9c6d7e845$var$AnimateWrapper = (0, $lAnAG$styledcomponents)((0, $lAnAG$Card))($2fdb71a9c6d7e845$var$t || ($2fdb71a9c6d7e845$var$t = $2fdb71a9c6d7e845$var$_`
|
|
1298
|
+
position: absolute;
|
|
1299
|
+
top: 0;
|
|
1300
|
+
left: 0;
|
|
1301
|
+
right: 0;
|
|
1302
|
+
bottom: 0;
|
|
1303
|
+
will-change: opacity;
|
|
1304
|
+
background: transparent;
|
|
1305
|
+
opacity: 0;
|
|
1306
|
+
pointer-events: none;
|
|
1307
|
+
`));
|
|
1308
|
+
const $2fdb71a9c6d7e845$var$ActionsAssetsContainer = (0, $lAnAG$styledcomponents).div($2fdb71a9c6d7e845$var$t1 || ($2fdb71a9c6d7e845$var$t1 = $2fdb71a9c6d7e845$var$_`
|
|
1309
|
+
box-sizing: border-box;
|
|
1310
|
+
position: absolute;
|
|
1311
|
+
z-index: 300;
|
|
1312
|
+
opacity: 0;
|
|
1313
|
+
top: 7px;
|
|
1314
|
+
right: 7px;
|
|
1315
|
+
|
|
1316
|
+
button:hover + &,
|
|
1317
|
+
button:focus-visible + &,
|
|
1318
|
+
&:hover,
|
|
1319
|
+
&:focus-visible {
|
|
1320
|
+
opacity: 1;
|
|
1321
|
+
}
|
|
1322
|
+
`));
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
const $e7b68ee0bd37004d$var$PER_PAGE = 20;
|
|
1326
|
+
function $e7b68ee0bd37004d$var$createQuery(start = 0, end = $e7b68ee0bd37004d$var$PER_PAGE) {
|
|
1327
|
+
return /* groq */ `*[_type == "mux.videoAsset"] | order(_updatedAt desc) [${start}...${end}]`;
|
|
1328
|
+
}
|
|
1329
|
+
function $e7b68ee0bd37004d$export$2e2bcd8739ae039({ asset: asset , onChange: onChange , setDialogState: setDialogState }) {
|
|
1330
|
+
const client = (0, $lAnAG$useClient)();
|
|
1331
|
+
const pageNoRef = (0, $lAnAG$useRef)(0);
|
|
1332
|
+
const [isLastPage, setLastPage] = (0, $lAnAG$useState)(false);
|
|
1333
|
+
const [isLoading, setLoading] = (0, $lAnAG$useState)(false);
|
|
1334
|
+
const [assets, setAssets] = (0, $lAnAG$useState)([]);
|
|
1335
|
+
const fetchPage = (0, $lAnAG$useCallback)((pageNo)=>{
|
|
1336
|
+
const start = pageNo * $e7b68ee0bd37004d$var$PER_PAGE;
|
|
1337
|
+
const end = start + $e7b68ee0bd37004d$var$PER_PAGE;
|
|
1338
|
+
setLoading(true);
|
|
1339
|
+
return client.fetch($e7b68ee0bd37004d$var$createQuery(start, end)).then((result)=>{
|
|
1340
|
+
setLastPage(result.length < $e7b68ee0bd37004d$var$PER_PAGE);
|
|
1341
|
+
setAssets((prev)=>prev.concat(result));
|
|
1342
|
+
}).finally(()=>setLoading(false));
|
|
1343
|
+
}, [
|
|
1344
|
+
client
|
|
1345
|
+
]);
|
|
1346
|
+
const handleSelect = (0, $lAnAG$useCallback)((id)=>{
|
|
1347
|
+
const selected = assets.find((doc)=>doc._id === id);
|
|
1348
|
+
if (!selected) throw new TypeError(`Failed to find video asset with id: ${id}`);
|
|
1349
|
+
onChange((0, $lAnAG$PatchEvent).from([
|
|
1350
|
+
(0, $lAnAG$setIfMissing)({
|
|
1351
|
+
asset: {}
|
|
1352
|
+
}),
|
|
1353
|
+
(0, $lAnAG$set)({
|
|
1354
|
+
_type: "reference",
|
|
1355
|
+
_weak: true,
|
|
1356
|
+
_ref: selected._id
|
|
1357
|
+
}, [
|
|
1358
|
+
"asset"
|
|
1359
|
+
]),
|
|
1360
|
+
]));
|
|
1361
|
+
setDialogState(false);
|
|
1362
|
+
}, [
|
|
1363
|
+
assets,
|
|
1364
|
+
onChange,
|
|
1365
|
+
setDialogState
|
|
1366
|
+
]);
|
|
1367
|
+
const handleLoadMore = (0, $lAnAG$useCallback)(()=>{
|
|
1368
|
+
fetchPage(++pageNoRef.current);
|
|
1369
|
+
}, [
|
|
1370
|
+
fetchPage
|
|
1371
|
+
]);
|
|
1372
|
+
(0, $lAnAG$useEffect)(()=>void fetchPage(pageNoRef.current), [
|
|
1373
|
+
fetchPage
|
|
1374
|
+
]);
|
|
1375
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $2fdb71a9c6d7e845$export$2e2bcd8739ae039), {
|
|
1376
|
+
onSelect: handleSelect,
|
|
1377
|
+
assets: assets,
|
|
1378
|
+
isLastPage: isLastPage,
|
|
1379
|
+
isLoading: isLoading,
|
|
1380
|
+
onLoadMore: handleLoadMore
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
function $99b7c7e884102d35$export$2e2bcd8739ae039({ setDialogState: setDialogState , asset: asset , onChange: onChange }) {
|
|
1386
|
+
const id = `InputBrowser${(0, $lAnAG$useId)()}`;
|
|
1387
|
+
const handleClose = (0, $lAnAG$useCallback)(()=>setDialogState(false), [
|
|
1388
|
+
setDialogState
|
|
1389
|
+
]);
|
|
1390
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Dialog), {
|
|
1391
|
+
scheme: "dark",
|
|
1392
|
+
__unstable_autoFocus: true,
|
|
1393
|
+
header: "Select video",
|
|
1394
|
+
id: id,
|
|
1395
|
+
onClose: handleClose,
|
|
1396
|
+
width: 2,
|
|
1397
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $e7b68ee0bd37004d$export$2e2bcd8739ae039), {
|
|
1398
|
+
asset: asset,
|
|
1399
|
+
onChange: onChange,
|
|
1400
|
+
setDialogState: setDialogState
|
|
1401
|
+
})
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
const $fda2d5de96370890$export$b07ce35d92a46f4b = (asset, onChange)=>{
|
|
1417
|
+
const client = (0, $lAnAG$useClient)();
|
|
1418
|
+
return (0, $lAnAG$useCallback)(()=>{
|
|
1419
|
+
if (!asset) return;
|
|
1420
|
+
onChange((0, $lAnAG$PatchEvent).from((0, $lAnAG$unset)()));
|
|
1421
|
+
if (asset.assetId) (0, $fb3009e6005435d0$export$df987b50509121ea)(client, asset.assetId);
|
|
1422
|
+
if (asset._id) client.delete(asset._id);
|
|
1423
|
+
}, [
|
|
1424
|
+
asset,
|
|
1425
|
+
client,
|
|
1426
|
+
onChange
|
|
1427
|
+
]);
|
|
1428
|
+
};
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
function $e9846f201e1be8a8$export$b704b622b4125987({ asset: asset , client: client }) {
|
|
1435
|
+
const playbackId = (0, $b87ee69f3b2fe2f8$export$bdfa34d24bb44333)(asset);
|
|
1436
|
+
const searchParams = new URLSearchParams();
|
|
1437
|
+
if ((0, $53c0557e92647bc3$export$f7d2546fac75bbd)(asset) === "signed") {
|
|
1438
|
+
const token = (0, $df808f32f86dd2c3$export$87b96baf1080652a)(client, playbackId, "v");
|
|
1439
|
+
searchParams.set("token", token);
|
|
1440
|
+
}
|
|
1441
|
+
return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
function $4d6a0d0f92115a45$export$2e2bcd8739ae039({ asset: asset , getCurrentTime: getCurrentTime , setDialogState: setDialogState }) {
|
|
1455
|
+
const client = (0, $lAnAG$useClient)();
|
|
1456
|
+
const dialogId = `EditThumbnailDialog${(0, $lAnAG$useId)()}`;
|
|
1457
|
+
const nextTime = (0, $lAnAG$useMemo)(()=>getCurrentTime(), [
|
|
1458
|
+
getCurrentTime
|
|
1459
|
+
]);
|
|
1460
|
+
const assetWithNewThumbnail = (0, $lAnAG$useMemo)(()=>(0, $lAnAG$swchelperssrc_object_spread_propsmjs)((0, $lAnAG$swchelperssrc_object_spreadmjs)({}, asset), {
|
|
1461
|
+
thumbTime: nextTime
|
|
1462
|
+
}), [
|
|
1463
|
+
asset,
|
|
1464
|
+
nextTime
|
|
1465
|
+
]);
|
|
1466
|
+
const [saving, setSaving] = (0, $lAnAG$useState)(false);
|
|
1467
|
+
const [error, setError] = (0, $lAnAG$useState)(null);
|
|
1468
|
+
const handleSave = (0, $lAnAG$useCallback)(()=>{
|
|
1469
|
+
setSaving(true);
|
|
1470
|
+
client.patch(asset._id).set({
|
|
1471
|
+
thumbTime: nextTime
|
|
1472
|
+
}).commit({
|
|
1473
|
+
returnDocuments: false
|
|
1474
|
+
}).then(()=>void setDialogState(false)).catch(setError).finally(()=>void setSaving(false));
|
|
1475
|
+
}, [
|
|
1476
|
+
client,
|
|
1477
|
+
asset._id,
|
|
1478
|
+
nextTime,
|
|
1479
|
+
setDialogState
|
|
1480
|
+
]);
|
|
1481
|
+
const width = 300 * (0, $lAnAG$getDevicePixelRatio)({
|
|
1482
|
+
maxDpr: 2
|
|
1483
|
+
});
|
|
1484
|
+
if (error) // eslint-disable-next-line no-warning-comments
|
|
1485
|
+
// @TODO handle errors more gracefully
|
|
1486
|
+
throw error;
|
|
1487
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Dialog), {
|
|
1488
|
+
id: dialogId,
|
|
1489
|
+
header: "Edit thumbnail",
|
|
1490
|
+
onClose: ()=>setDialogState(false),
|
|
1491
|
+
footer: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Stack), {
|
|
1492
|
+
padding: 3,
|
|
1493
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
1494
|
+
mode: "ghost",
|
|
1495
|
+
tone: "primary",
|
|
1496
|
+
loading: saving,
|
|
1497
|
+
onClick: handleSave,
|
|
1498
|
+
text: "Set new thumbnail"
|
|
1499
|
+
}, "thumbnail")
|
|
1500
|
+
}),
|
|
1501
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
1502
|
+
space: 3,
|
|
1503
|
+
padding: 3,
|
|
1504
|
+
children: [
|
|
1505
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
1506
|
+
space: 2,
|
|
1507
|
+
children: [
|
|
1508
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
1509
|
+
size: 1,
|
|
1510
|
+
weight: "semibold",
|
|
1511
|
+
children: "Current:"
|
|
1512
|
+
}),
|
|
1513
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$bd4b73f15688a160), {
|
|
1514
|
+
asset: asset,
|
|
1515
|
+
width: width
|
|
1516
|
+
})
|
|
1517
|
+
]
|
|
1518
|
+
}),
|
|
1519
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
1520
|
+
space: 2,
|
|
1521
|
+
children: [
|
|
1522
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
1523
|
+
size: 1,
|
|
1524
|
+
weight: "semibold",
|
|
1525
|
+
children: "New:"
|
|
1526
|
+
}),
|
|
1527
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$bd4b73f15688a160), {
|
|
1528
|
+
asset: assetWithNewThumbnail,
|
|
1529
|
+
width: width
|
|
1530
|
+
})
|
|
1531
|
+
]
|
|
1532
|
+
})
|
|
1533
|
+
]
|
|
1534
|
+
})
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
function $6f38a47dc6ab3643$export$445f1a1fda135dc9({ asset: asset , client: client }) {
|
|
1550
|
+
const playbackId = (0, $b87ee69f3b2fe2f8$export$bdfa34d24bb44333)(asset);
|
|
1551
|
+
const searchParams = new URLSearchParams();
|
|
1552
|
+
if ((0, $53c0557e92647bc3$export$f7d2546fac75bbd)(asset) === "signed") {
|
|
1553
|
+
const token = (0, $df808f32f86dd2c3$export$87b96baf1080652a)(client, playbackId, "s");
|
|
1554
|
+
searchParams.set("token", token);
|
|
1555
|
+
}
|
|
1556
|
+
return `https://image.mux.com/${playbackId}/storyboard.vtt?${searchParams}`;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
let $00f86bf1e98fabe5$var$_ = (t3)=>t3, $00f86bf1e98fabe5$var$t, $00f86bf1e98fabe5$var$t1, $00f86bf1e98fabe5$var$t2;
|
|
1561
|
+
const $00f86bf1e98fabe5$export$b302ef9d8310f71 = (0, $lAnAG$styledcomponents)((0, $lAnAG$Card))($00f86bf1e98fabe5$var$t || ($00f86bf1e98fabe5$var$t = $00f86bf1e98fabe5$var$_`
|
|
1562
|
+
position: relative;
|
|
1563
|
+
min-height: 150px;
|
|
1564
|
+
aspect-ratio: 16 / 9;
|
|
1565
|
+
overflow: hidden;
|
|
1566
|
+
border-radius: 1px;
|
|
1567
|
+
media-airplay-button[media-airplay-unavailable] {
|
|
1568
|
+
display: none;
|
|
1569
|
+
}
|
|
1570
|
+
media-volume-range[media-volume-unavailable] {
|
|
1571
|
+
display: none;
|
|
1572
|
+
}
|
|
1573
|
+
media-pip-button[media-pip-unavailable] {
|
|
1574
|
+
display: none;
|
|
1575
|
+
}
|
|
1576
|
+
media-controller {
|
|
1577
|
+
--media-control-background: transparent;
|
|
1578
|
+
--media-control-hover-background: transparent;
|
|
1579
|
+
--media-range-track-background-color: rgba(255, 255, 255, 0.5);
|
|
1580
|
+
--media-range-track-border-radius: 3px;
|
|
1581
|
+
width: 100%;
|
|
1582
|
+
height: 100%;
|
|
1583
|
+
background-color: transparent;
|
|
1584
|
+
}
|
|
1585
|
+
media-control-bar {
|
|
1586
|
+
--media-button-icon-width: 18px;
|
|
1587
|
+
--media-preview-time-margin: 0px;
|
|
1588
|
+
}
|
|
1589
|
+
media-control-bar:not([slot]) :is([role='button'], [role='switch'], button) {
|
|
1590
|
+
height: 44px;
|
|
1591
|
+
}
|
|
1592
|
+
.size-extra-small media-control-bar [role='button'],
|
|
1593
|
+
.size-extra-small media-control-bar [role='switch'] {
|
|
1594
|
+
height: auto;
|
|
1595
|
+
padding: 4.4% 3.2%;
|
|
1596
|
+
}
|
|
1597
|
+
.mxp-spacer {
|
|
1598
|
+
flex-grow: 1;
|
|
1599
|
+
height: 100%;
|
|
1600
|
+
background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
|
|
1601
|
+
}
|
|
1602
|
+
media-controller::part(vertical-layer) {
|
|
1603
|
+
transition: background-color 1s;
|
|
1604
|
+
}
|
|
1605
|
+
media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
|
|
1606
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
1607
|
+
transition: background-color 0.25s;
|
|
1608
|
+
}
|
|
1609
|
+
.mxp-center-controls {
|
|
1610
|
+
--media-background-color: transparent;
|
|
1611
|
+
--media-button-icon-width: 100%;
|
|
1612
|
+
--media-button-icon-height: auto;
|
|
1613
|
+
pointer-events: none;
|
|
1614
|
+
width: 100%;
|
|
1615
|
+
display: flex;
|
|
1616
|
+
flex-flow: row;
|
|
1617
|
+
align-items: center;
|
|
1618
|
+
justify-content: center;
|
|
1619
|
+
}
|
|
1620
|
+
.mxp-center-controls media-play-button {
|
|
1621
|
+
--media-control-background: transparent;
|
|
1622
|
+
--media-control-hover-background: transparent;
|
|
1623
|
+
padding: 0;
|
|
1624
|
+
width: max(27px, min(9%, 90px));
|
|
1625
|
+
}
|
|
1626
|
+
.mxp-center-controls media-seek-backward-button,
|
|
1627
|
+
.mxp-center-controls media-seek-forward-button {
|
|
1628
|
+
--media-control-background: transparent;
|
|
1629
|
+
--media-control-hover-background: transparent;
|
|
1630
|
+
padding: 0;
|
|
1631
|
+
margin: 0 10%;
|
|
1632
|
+
width: min(7%, 70px);
|
|
1633
|
+
}
|
|
1634
|
+
media-loading-indicator {
|
|
1635
|
+
--media-loading-icon-width: 100%;
|
|
1636
|
+
--media-button-icon-height: auto;
|
|
1637
|
+
pointer-events: none;
|
|
1638
|
+
position: absolute;
|
|
1639
|
+
width: min(15%, 150px);
|
|
1640
|
+
display: flex;
|
|
1641
|
+
flex-flow: row;
|
|
1642
|
+
align-items: center;
|
|
1643
|
+
justify-content: center;
|
|
1644
|
+
}
|
|
1645
|
+
/* Intentionally don't target the div for transition but the children
|
|
1646
|
+
of the div. Prevents messing with media-chrome's autohide feature. */
|
|
1647
|
+
media-loading-indicator + div * {
|
|
1648
|
+
transition: opacity 0.15s;
|
|
1649
|
+
opacity: 1;
|
|
1650
|
+
}
|
|
1651
|
+
media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
|
|
1652
|
+
opacity: 0;
|
|
1653
|
+
transition-delay: 400ms;
|
|
1654
|
+
}
|
|
1655
|
+
media-volume-range {
|
|
1656
|
+
width: min(100%, 100px);
|
|
1657
|
+
}
|
|
1658
|
+
media-time-display {
|
|
1659
|
+
white-space: nowrap;
|
|
1660
|
+
}
|
|
1661
|
+
:is(media-time-display, media-text-display, media-playback-rate-button) {
|
|
1662
|
+
color: inherit;
|
|
1663
|
+
}
|
|
1664
|
+
media-controller:fullscreen media-control-bar[slot='top-chrome'] {
|
|
1665
|
+
/* Hide menus and buttons that trigger modals when in full-screen */
|
|
1666
|
+
display: none;
|
|
1667
|
+
}
|
|
1668
|
+
video {
|
|
1669
|
+
background: transparent;
|
|
1670
|
+
}
|
|
1671
|
+
media-controller:not(:fullscreen) video {
|
|
1672
|
+
aspect-ratio: 16 / 9;
|
|
1673
|
+
}
|
|
1674
|
+
media-controller:not(:-webkit-full-screen) video {
|
|
1675
|
+
aspect-ratio: 16 / 9;
|
|
1676
|
+
}
|
|
1677
|
+
`));
|
|
1678
|
+
const $00f86bf1e98fabe5$export$ec21f2fe322b745c = (0, $lAnAG$styledcomponents).div($00f86bf1e98fabe5$var$t1 || ($00f86bf1e98fabe5$var$t1 = $00f86bf1e98fabe5$var$_`
|
|
1679
|
+
&& {
|
|
1680
|
+
--media-background-color: transparent;
|
|
1681
|
+
--media-button-icon-width: 100%;
|
|
1682
|
+
--media-button-icon-height: auto;
|
|
1683
|
+
pointer-events: none;
|
|
1684
|
+
width: 100%;
|
|
1685
|
+
display: flex;
|
|
1686
|
+
flex-flow: row;
|
|
1687
|
+
align-items: center;
|
|
1688
|
+
justify-content: center;
|
|
1689
|
+
media-play-button {
|
|
1690
|
+
--media-control-background: transparent;
|
|
1691
|
+
--media-control-hover-background: transparent;
|
|
1692
|
+
padding: 0;
|
|
1693
|
+
width: max(27px, min(9%, 90px));
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
`));
|
|
1697
|
+
const $00f86bf1e98fabe5$export$fa0cb91fe5adf3c5 = (0, $lAnAG$styledcomponents)((0, $lAnAG$MediaControlBar))($00f86bf1e98fabe5$var$t2 || ($00f86bf1e98fabe5$var$t2 = $00f86bf1e98fabe5$var$_`
|
|
1698
|
+
justify-content: flex-end;
|
|
1699
|
+
button {
|
|
1700
|
+
height: auto;
|
|
1701
|
+
}
|
|
1702
|
+
`));
|
|
1703
|
+
function $00f86bf1e98fabe5$export$5ebdf79245c1c64a({ asset: asset }) {
|
|
1704
|
+
const client = (0, $lAnAG$useClient)();
|
|
1705
|
+
const ref = (0, $lAnAG$useRef)(null);
|
|
1706
|
+
const src = (0, $lAnAG$useMemo)(()=>(0, $649e715c42156121$export$8081e7a11b9f1345)({
|
|
1707
|
+
client: client,
|
|
1708
|
+
asset: asset,
|
|
1709
|
+
width: 1920,
|
|
1710
|
+
height: 1080
|
|
1711
|
+
}), [
|
|
1712
|
+
client,
|
|
1713
|
+
asset
|
|
1714
|
+
]);
|
|
1715
|
+
(0, $lAnAG$useEffect)(()=>{
|
|
1716
|
+
if (ref.current) {
|
|
1717
|
+
var ref1;
|
|
1718
|
+
const style = document.createElement("style");
|
|
1719
|
+
style.innerHTML = "img { object-fit: contain; }";
|
|
1720
|
+
if ((ref1 = ref.current) === null || ref1 === void 0 ? void 0 : ref1.shadowRoot) ref.current.shadowRoot.appendChild(style);
|
|
1721
|
+
}
|
|
1722
|
+
}, []);
|
|
1723
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaPosterImage), {
|
|
1724
|
+
ref: ref,
|
|
1725
|
+
slot: "poster",
|
|
1726
|
+
src: src
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
function $00f86bf1e98fabe5$export$95073c0c4bf2add1({ asset: asset }) {
|
|
1730
|
+
const client = (0, $lAnAG$useClient)();
|
|
1731
|
+
// Why useState instead of useMemo? Because we really really only want to run it exactly once and useMemo doesn't make that guarantee
|
|
1732
|
+
const [src] = (0, $lAnAG$useState)(()=>(0, $6f38a47dc6ab3643$export$445f1a1fda135dc9)({
|
|
1733
|
+
asset: asset,
|
|
1734
|
+
client: client
|
|
1735
|
+
}));
|
|
1736
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)("track", {
|
|
1737
|
+
label: "thumbnails",
|
|
1738
|
+
default: true,
|
|
1739
|
+
kind: "metadata",
|
|
1740
|
+
src: src
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
let $92e84bb25450e8d6$var$_ = (t4)=>t4, $92e84bb25450e8d6$var$t, $92e84bb25450e8d6$var$t1, $92e84bb25450e8d6$var$t2, $92e84bb25450e8d6$var$t3;
|
|
1751
|
+
const $92e84bb25450e8d6$export$6aa22a823032b784 = (0, $lAnAG$styledcomponents)((0, $lAnAG$Card))($92e84bb25450e8d6$var$t || ($92e84bb25450e8d6$var$t = $92e84bb25450e8d6$var$_`
|
|
1752
|
+
min-height: 82px;
|
|
1753
|
+
box-sizing: border-box;
|
|
1754
|
+
`));
|
|
1755
|
+
const $92e84bb25450e8d6$export$245cfede9308c835 = (0, $lAnAG$styledcomponents)((0, $lAnAG$Flex))($92e84bb25450e8d6$var$t1 || ($92e84bb25450e8d6$var$t1 = $92e84bb25450e8d6$var$_`
|
|
1756
|
+
text-overflow: ellipsis;
|
|
1757
|
+
overflow: hidden;
|
|
1758
|
+
`));
|
|
1759
|
+
const $92e84bb25450e8d6$export$e3b4754a92ccf466 = (0, $lAnAG$styledcomponents)((0, $lAnAG$Stack))($92e84bb25450e8d6$var$t2 || ($92e84bb25450e8d6$var$t2 = $92e84bb25450e8d6$var$_`
|
|
1760
|
+
position: relative;
|
|
1761
|
+
width: 60%;
|
|
1762
|
+
`));
|
|
1763
|
+
const $92e84bb25450e8d6$export$bedb6b8ab184f038 = (0, $lAnAG$styledcomponents)((0, $lAnAG$Code))($92e84bb25450e8d6$var$t3 || ($92e84bb25450e8d6$var$t3 = $92e84bb25450e8d6$var$_`
|
|
1764
|
+
position: relative;
|
|
1765
|
+
width: 100%;
|
|
1766
|
+
|
|
1767
|
+
code {
|
|
1768
|
+
overflow: hidden;
|
|
1769
|
+
text-overflow: ellipsis;
|
|
1770
|
+
position: relative;
|
|
1771
|
+
max-width: 200px;
|
|
1772
|
+
}
|
|
1773
|
+
`));
|
|
1774
|
+
const $92e84bb25450e8d6$export$98a3886347b629fb = ({ progress: progress = 100 , onCancel: onCancel , filename: filename , text: text = "Uploading" })=>{
|
|
1775
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)($92e84bb25450e8d6$export$6aa22a823032b784, {
|
|
1776
|
+
tone: "primary",
|
|
1777
|
+
padding: 4,
|
|
1778
|
+
border: true,
|
|
1779
|
+
height: "fill",
|
|
1780
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)($92e84bb25450e8d6$export$245cfede9308c835, {
|
|
1781
|
+
align: "center",
|
|
1782
|
+
justify: "space-between",
|
|
1783
|
+
height: "fill",
|
|
1784
|
+
direction: "row",
|
|
1785
|
+
gap: 2,
|
|
1786
|
+
children: [
|
|
1787
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)($92e84bb25450e8d6$export$e3b4754a92ccf466, {
|
|
1788
|
+
children: [
|
|
1789
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
1790
|
+
justify: "center",
|
|
1791
|
+
gap: [
|
|
1792
|
+
3,
|
|
1793
|
+
3,
|
|
1794
|
+
2,
|
|
1795
|
+
2
|
|
1796
|
+
],
|
|
1797
|
+
direction: [
|
|
1798
|
+
"column",
|
|
1799
|
+
"column",
|
|
1800
|
+
"row"
|
|
1801
|
+
],
|
|
1802
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
1803
|
+
size: 1,
|
|
1804
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Inline), {
|
|
1805
|
+
space: 2,
|
|
1806
|
+
children: [
|
|
1807
|
+
text,
|
|
1808
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)($92e84bb25450e8d6$export$bedb6b8ab184f038, {
|
|
1809
|
+
size: 1,
|
|
1810
|
+
children: filename ? filename : "..."
|
|
1811
|
+
})
|
|
1812
|
+
]
|
|
1813
|
+
})
|
|
1814
|
+
})
|
|
1815
|
+
}),
|
|
1816
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
1817
|
+
marginTop: 3,
|
|
1818
|
+
radius: 5,
|
|
1819
|
+
shadow: 1,
|
|
1820
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$LinearProgress), {
|
|
1821
|
+
value: progress
|
|
1822
|
+
})
|
|
1823
|
+
})
|
|
1824
|
+
]
|
|
1825
|
+
}),
|
|
1826
|
+
onCancel ? /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
1827
|
+
fontSize: 2,
|
|
1828
|
+
text: "Cancel upload",
|
|
1829
|
+
mode: "ghost",
|
|
1830
|
+
tone: "critical",
|
|
1831
|
+
onClick: onCancel
|
|
1832
|
+
}) : null
|
|
1833
|
+
]
|
|
1834
|
+
})
|
|
1835
|
+
});
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
const $a094825b464048a2$var$MuxVideo = ({ asset: asset , buttons: buttons , readOnly: readOnly , onChange: onChange , dialogState: dialogState , setDialogState: setDialogState })=>{
|
|
1840
|
+
var ref8, ref1, ref2, ref3;
|
|
1841
|
+
const client = (0, $lAnAG$useClient)();
|
|
1842
|
+
const isLoading = (0, $lAnAG$useMemo)(()=>{
|
|
1843
|
+
if ((asset === null || asset === void 0 ? void 0 : asset.status) === "preparing") return "Preparing the video";
|
|
1844
|
+
if ((asset === null || asset === void 0 ? void 0 : asset.status) === "waiting_for_upload") return "Waiting for upload to start";
|
|
1845
|
+
if ((asset === null || asset === void 0 ? void 0 : asset.status) === "waiting") return "Processing upload";
|
|
1846
|
+
if ((asset === null || asset === void 0 ? void 0 : asset.status) === "ready") return false;
|
|
1847
|
+
if (typeof (asset === null || asset === void 0 ? void 0 : asset.status) === "undefined") return false;
|
|
1848
|
+
return true;
|
|
1849
|
+
}, [
|
|
1850
|
+
asset
|
|
1851
|
+
]);
|
|
1852
|
+
const isPreparingStaticRenditions = (0, $lAnAG$useMemo)(()=>{
|
|
1853
|
+
var ref, ref5, ref6, ref7;
|
|
1854
|
+
if ((asset === null || asset === void 0 ? void 0 : (ref = asset.data) === null || ref === void 0 ? void 0 : (ref5 = ref.static_renditions) === null || ref5 === void 0 ? void 0 : ref5.status) === "preparing") return true;
|
|
1855
|
+
if ((asset === null || asset === void 0 ? void 0 : (ref6 = asset.data) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.static_renditions) === null || ref7 === void 0 ? void 0 : ref7.status) === "ready") return false;
|
|
1856
|
+
return false;
|
|
1857
|
+
}, [
|
|
1858
|
+
asset === null || asset === void 0 ? void 0 : (ref8 = asset.data) === null || ref8 === void 0 ? void 0 : (ref1 = ref8.static_renditions) === null || ref1 === void 0 ? void 0 : ref1.status
|
|
1859
|
+
]);
|
|
1860
|
+
const videoSrc = (0, $lAnAG$useMemo)(()=>asset.playbackId && (0, $e9846f201e1be8a8$export$b704b622b4125987)({
|
|
1861
|
+
client: client,
|
|
1862
|
+
asset: asset
|
|
1863
|
+
}), [
|
|
1864
|
+
asset,
|
|
1865
|
+
client
|
|
1866
|
+
]);
|
|
1867
|
+
const [error, setError] = (0, $lAnAG$useState)(null);
|
|
1868
|
+
const handleError = (0, $lAnAG$useCallback)((event)=>setError(event.currentTarget.error), []);
|
|
1869
|
+
const playRef = (0, $lAnAG$useRef)(null);
|
|
1870
|
+
const muteRef = (0, $lAnAG$useRef)(null);
|
|
1871
|
+
const video = (0, $lAnAG$useRef)(null);
|
|
1872
|
+
var ref4;
|
|
1873
|
+
const getCurrentTime = (0, $lAnAG$useCallback)(()=>{
|
|
1874
|
+
var ref;
|
|
1875
|
+
return (ref4 = (ref = video.current) === null || ref === void 0 ? void 0 : ref.currentTime) !== null && ref4 !== void 0 ? ref4 : 0;
|
|
1876
|
+
}, [
|
|
1877
|
+
video
|
|
1878
|
+
]);
|
|
1879
|
+
const handleCancelUpload = (0, $fda2d5de96370890$export$b07ce35d92a46f4b)(asset, onChange);
|
|
1880
|
+
(0, $lAnAG$useEffect)(()=>{
|
|
1881
|
+
var ref, ref9;
|
|
1882
|
+
const style = document.createElement("style");
|
|
1883
|
+
style.innerHTML = "button svg { vertical-align: middle; }";
|
|
1884
|
+
if ((ref = playRef.current) === null || ref === void 0 ? void 0 : ref.shadowRoot) playRef.current.shadowRoot.appendChild(style);
|
|
1885
|
+
if (muteRef === null || muteRef === void 0 ? void 0 : (ref9 = muteRef.current) === null || ref9 === void 0 ? void 0 : ref9.shadowRoot) muteRef.current.shadowRoot.appendChild(style.cloneNode(true));
|
|
1886
|
+
}, []);
|
|
1887
|
+
const [playerInitTime] = (0, $lAnAG$useState)(()=>(0, $lAnAG$generatePlayerInitTime)());
|
|
1888
|
+
const playbackEngineRef = (0, $lAnAG$useRef)(undefined);
|
|
1889
|
+
(0, $lAnAG$useEffect)(()=>{
|
|
1890
|
+
if (isLoading || !videoSrc) return;
|
|
1891
|
+
const nextPlaybackEngineRef = (0, $lAnAG$initialize)({
|
|
1892
|
+
src: videoSrc,
|
|
1893
|
+
playerInitTime: playerInitTime,
|
|
1894
|
+
playerSoftwareName: "sanity-plugin-mux-input",
|
|
1895
|
+
playerSoftwareVersion: "dev-preview"
|
|
1896
|
+
}, video.current, playbackEngineRef.current);
|
|
1897
|
+
playbackEngineRef.current = nextPlaybackEngineRef;
|
|
1898
|
+
}, [
|
|
1899
|
+
videoSrc,
|
|
1900
|
+
isLoading,
|
|
1901
|
+
playerInitTime
|
|
1902
|
+
]);
|
|
1903
|
+
(0, $lAnAG$useEffect)(()=>{
|
|
1904
|
+
if ((asset === null || asset === void 0 ? void 0 : asset.status) === "errored") {
|
|
1905
|
+
var ref, ref10, ref11;
|
|
1906
|
+
handleCancelUpload();
|
|
1907
|
+
// eslint-disable-next-line no-warning-comments
|
|
1908
|
+
// @TODO use better error handling
|
|
1909
|
+
throw new Error((ref = asset.data) === null || ref === void 0 ? void 0 : (ref10 = ref.errors) === null || ref10 === void 0 ? void 0 : (ref11 = ref10.messages) === null || ref11 === void 0 ? void 0 : ref11.join(" "));
|
|
1910
|
+
}
|
|
1911
|
+
}, [
|
|
1912
|
+
(ref2 = asset.data) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.errors) === null || ref3 === void 0 ? void 0 : ref3.messages,
|
|
1913
|
+
asset === null || asset === void 0 ? void 0 : asset.status,
|
|
1914
|
+
handleCancelUpload
|
|
1915
|
+
]);
|
|
1916
|
+
if (error) // @TODO better error handling
|
|
1917
|
+
throw error;
|
|
1918
|
+
if (!asset || !asset.status) return null;
|
|
1919
|
+
if (isLoading) return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $92e84bb25450e8d6$export$98a3886347b629fb), {
|
|
1920
|
+
progress: 100,
|
|
1921
|
+
filename: asset === null || asset === void 0 ? void 0 : asset.filename,
|
|
1922
|
+
text: isLoading !== true && isLoading || "Waiting for Mux to complete the file",
|
|
1923
|
+
onCancel: readOnly ? undefined : ()=>handleCancelUpload()
|
|
1924
|
+
});
|
|
1925
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Fragment), {
|
|
1926
|
+
children: [
|
|
1927
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $00f86bf1e98fabe5$export$b302ef9d8310f71), {
|
|
1928
|
+
shadow: 1,
|
|
1929
|
+
tone: "transparent",
|
|
1930
|
+
scheme: "dark",
|
|
1931
|
+
children: [
|
|
1932
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$MediaController), {
|
|
1933
|
+
children: [
|
|
1934
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("video", {
|
|
1935
|
+
playsInline: true,
|
|
1936
|
+
ref: video,
|
|
1937
|
+
onError: handleError,
|
|
1938
|
+
slot: "media",
|
|
1939
|
+
preload: "metadata",
|
|
1940
|
+
crossOrigin: "anonomous",
|
|
1941
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $00f86bf1e98fabe5$export$95073c0c4bf2add1), {
|
|
1942
|
+
asset: asset
|
|
1943
|
+
})
|
|
1944
|
+
}),
|
|
1945
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $00f86bf1e98fabe5$export$5ebdf79245c1c64a), {
|
|
1946
|
+
asset: asset
|
|
1947
|
+
}),
|
|
1948
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaLoadingIndicator), {
|
|
1949
|
+
slot: "centered-chrome",
|
|
1950
|
+
noAutoHide: true
|
|
1951
|
+
}),
|
|
1952
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $00f86bf1e98fabe5$export$ec21f2fe322b745c), {
|
|
1953
|
+
slot: "centered-chrome",
|
|
1954
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaPlayButton), {})
|
|
1955
|
+
}),
|
|
1956
|
+
buttons && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $00f86bf1e98fabe5$export$fa0cb91fe5adf3c5), {
|
|
1957
|
+
slot: "top-chrome",
|
|
1958
|
+
children: buttons
|
|
1959
|
+
}),
|
|
1960
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$MediaControlBar), {
|
|
1961
|
+
children: [
|
|
1962
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaMuteButton), {}),
|
|
1963
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaTimeDisplay), {}),
|
|
1964
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaTimeRange), {}),
|
|
1965
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaDurationDisplay), {}),
|
|
1966
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MediaFullscreenButton), {})
|
|
1967
|
+
]
|
|
1968
|
+
})
|
|
1969
|
+
]
|
|
1970
|
+
}),
|
|
1971
|
+
isPreparingStaticRenditions && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
1972
|
+
padding: 2,
|
|
1973
|
+
radius: 1,
|
|
1974
|
+
style: {
|
|
1975
|
+
background: "var(--card-fg-color)",
|
|
1976
|
+
position: "absolute",
|
|
1977
|
+
top: "0.5em",
|
|
1978
|
+
left: "0.5em"
|
|
1979
|
+
},
|
|
1980
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
1981
|
+
size: 1,
|
|
1982
|
+
style: {
|
|
1983
|
+
color: "var(--card-bg-color)"
|
|
1984
|
+
},
|
|
1985
|
+
children: "MUX is preparing static renditions, please stand by"
|
|
1986
|
+
})
|
|
1987
|
+
})
|
|
1988
|
+
]
|
|
1989
|
+
}),
|
|
1990
|
+
dialogState === "edit-thumbnail" && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $4d6a0d0f92115a45$export$2e2bcd8739ae039), {
|
|
1991
|
+
asset: asset,
|
|
1992
|
+
getCurrentTime: getCurrentTime,
|
|
1993
|
+
setDialogState: setDialogState
|
|
1994
|
+
})
|
|
1995
|
+
]
|
|
1996
|
+
});
|
|
1997
|
+
};
|
|
1998
|
+
var $a094825b464048a2$export$2e2bcd8739ae039 = $a094825b464048a2$var$MuxVideo;
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
|
|
2002
|
+
|
|
2003
|
+
|
|
2004
|
+
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
function $55e2ea4991872d02$export$a79bcc1dc439e294(border) {
|
|
2019
|
+
return `inset 0 0 0 ${border.width}px ${border.color}`;
|
|
2020
|
+
}
|
|
2021
|
+
function $55e2ea4991872d02$export$c339ddc20364daad(opts) {
|
|
2022
|
+
const { base: base , border: border , focusRing: focusRing } = opts;
|
|
2023
|
+
const focusRingOutsetWidth = focusRing.offset + focusRing.width;
|
|
2024
|
+
const focusRingInsetWidth = 0 - focusRing.offset;
|
|
2025
|
+
const bgColor = base ? base.bg : "var(--card-bg-color)";
|
|
2026
|
+
return [
|
|
2027
|
+
focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
|
|
2028
|
+
border && $55e2ea4991872d02$export$a79bcc1dc439e294(border),
|
|
2029
|
+
focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
|
|
2030
|
+
focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`,
|
|
2031
|
+
].filter(Boolean).join(",");
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
let $48af3f13188cf083$var$_ = (t1)=>t1, $48af3f13188cf083$var$t;
|
|
2036
|
+
const $48af3f13188cf083$export$de1df6cdafc19206 = (0, $lAnAG$styledcomponents)((0, $lAnAG$MenuItem))(({ theme: theme })=>{
|
|
2037
|
+
const { focusRing: focusRing } = theme.sanity;
|
|
2038
|
+
const base = theme.sanity.color.base;
|
|
2039
|
+
const border = {
|
|
2040
|
+
width: 1,
|
|
2041
|
+
color: "var(--card-border-color)"
|
|
2042
|
+
};
|
|
2043
|
+
return (0, $lAnAG$css)($48af3f13188cf083$var$t || ($48af3f13188cf083$var$t = $48af3f13188cf083$var$_`
|
|
2044
|
+
position: relative;
|
|
2045
|
+
|
|
2046
|
+
&:not([data-disabled='true']) {
|
|
2047
|
+
&:focus-within {
|
|
2048
|
+
box-shadow: ${0};
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
& input {
|
|
2053
|
+
overflow: hidden;
|
|
2054
|
+
top: 0;
|
|
2055
|
+
left: 0;
|
|
2056
|
+
width: 100%;
|
|
2057
|
+
height: 100%;
|
|
2058
|
+
position: absolute;
|
|
2059
|
+
min-width: 0;
|
|
2060
|
+
display: block;
|
|
2061
|
+
appearance: none;
|
|
2062
|
+
padding: 0;
|
|
2063
|
+
margin: 0;
|
|
2064
|
+
border: 0;
|
|
2065
|
+
opacity: 0;
|
|
2066
|
+
}
|
|
2067
|
+
`), (0, $55e2ea4991872d02$export$c339ddc20364daad)({
|
|
2068
|
+
base: base,
|
|
2069
|
+
border: border,
|
|
2070
|
+
focusRing: focusRing
|
|
2071
|
+
}));
|
|
2072
|
+
});
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
var $adafc56722526c81$export$c1c647ae58701638 = /*#__PURE__*/ (0, $lAnAG$react).forwardRef(function FileInputMenuItem(props, forwardedRef) {
|
|
2076
|
+
const { icon: icon , id: idProp , accept: accept , capture: capture , fontSize: fontSize , multiple: multiple , onSelect: onSelect , padding: padding = 3 , space: space = 3 , textAlign: textAlign , text: text , disabled: disabled } = props, rest = (0, $lAnAG$swchelperssrc_object_without_propertiesmjs)(props, [
|
|
2077
|
+
"icon",
|
|
2078
|
+
"id",
|
|
2079
|
+
"accept",
|
|
2080
|
+
"capture",
|
|
2081
|
+
"fontSize",
|
|
2082
|
+
"multiple",
|
|
2083
|
+
"onSelect",
|
|
2084
|
+
"padding",
|
|
2085
|
+
"space",
|
|
2086
|
+
"textAlign",
|
|
2087
|
+
"text",
|
|
2088
|
+
"disabled"
|
|
2089
|
+
]);
|
|
2090
|
+
const id = (0, $lAnAG$useId)(idProp);
|
|
2091
|
+
const handleChange = (0, $lAnAG$react).useCallback((event)=>{
|
|
2092
|
+
if (onSelect && event.target.files) onSelect(Array.from(event.target.files));
|
|
2093
|
+
}, [
|
|
2094
|
+
onSelect
|
|
2095
|
+
]);
|
|
2096
|
+
const content = /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
2097
|
+
align: "center",
|
|
2098
|
+
justify: "flex-start",
|
|
2099
|
+
padding: padding,
|
|
2100
|
+
children: [
|
|
2101
|
+
icon && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
2102
|
+
marginRight: text ? space : undefined,
|
|
2103
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Text), {
|
|
2104
|
+
size: fontSize,
|
|
2105
|
+
children: [
|
|
2106
|
+
/*#__PURE__*/ (0, $lAnAG$isValidElement)(icon) && icon,
|
|
2107
|
+
(0, $lAnAG$isValidElementType)(icon) && /*#__PURE__*/ (0, $lAnAG$createElement)(icon)
|
|
2108
|
+
]
|
|
2109
|
+
})
|
|
2110
|
+
}),
|
|
2111
|
+
text && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
2112
|
+
align: textAlign,
|
|
2113
|
+
size: fontSize,
|
|
2114
|
+
textOverflow: "ellipsis",
|
|
2115
|
+
children: text
|
|
2116
|
+
})
|
|
2117
|
+
]
|
|
2118
|
+
});
|
|
2119
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $48af3f13188cf083$export$de1df6cdafc19206), (0, $lAnAG$swchelperssrc_object_spread_propsmjs)((0, $lAnAG$swchelperssrc_object_spreadmjs)({}, rest), {
|
|
2120
|
+
htmlFor: id,
|
|
2121
|
+
padding: 0,
|
|
2122
|
+
fontSize: 2,
|
|
2123
|
+
disabled: disabled,
|
|
2124
|
+
ref: forwardedRef,
|
|
2125
|
+
children: [
|
|
2126
|
+
content,
|
|
2127
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("input", {
|
|
2128
|
+
"data-testid": "file-button-input",
|
|
2129
|
+
accept: accept,
|
|
2130
|
+
capture: capture,
|
|
2131
|
+
id: id,
|
|
2132
|
+
multiple: multiple,
|
|
2133
|
+
onChange: handleChange,
|
|
2134
|
+
type: "file",
|
|
2135
|
+
value: "",
|
|
2136
|
+
disabled: disabled
|
|
2137
|
+
})
|
|
2138
|
+
]
|
|
2139
|
+
}));
|
|
2140
|
+
});
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
let $98a04f731a506f7d$var$_ = (t2)=>t2, $98a04f731a506f7d$var$t, $98a04f731a506f7d$var$t1;
|
|
2144
|
+
const $98a04f731a506f7d$var$LockCard = (0, $lAnAG$styledcomponents)((0, $lAnAG$Card))($98a04f731a506f7d$var$t || ($98a04f731a506f7d$var$t = $98a04f731a506f7d$var$_`
|
|
2145
|
+
position: absolute;
|
|
2146
|
+
top: 0;
|
|
2147
|
+
left: 0;
|
|
2148
|
+
opacity: 0.6;
|
|
2149
|
+
mix-blend-mode: screen;
|
|
2150
|
+
background: transparent;
|
|
2151
|
+
`));
|
|
2152
|
+
const $98a04f731a506f7d$var$LockButton = (0, $lAnAG$styledcomponents)((0, $lAnAG$Button))($98a04f731a506f7d$var$t1 || ($98a04f731a506f7d$var$t1 = $98a04f731a506f7d$var$_`
|
|
2153
|
+
background: transparent;
|
|
2154
|
+
color: white;
|
|
2155
|
+
`));
|
|
2156
|
+
function $98a04f731a506f7d$var$PlayerActionsMenu(props) {
|
|
2157
|
+
const { asset: asset , readOnly: readOnly , dialogState: dialogState , setDialogState: setDialogState , onChange: onChange , onUpload: onUpload } = props;
|
|
2158
|
+
const [open, setOpen] = (0, $lAnAG$useState)(false);
|
|
2159
|
+
const [menuElement, setMenuRef] = (0, $lAnAG$useState)(null);
|
|
2160
|
+
const isSigned = (0, $lAnAG$useMemo)(()=>(0, $53c0557e92647bc3$export$f7d2546fac75bbd)(asset) === "signed", [
|
|
2161
|
+
asset
|
|
2162
|
+
]);
|
|
2163
|
+
const onReset = (0, $lAnAG$useCallback)(()=>onChange((0, $lAnAG$PatchEvent).from((0, $lAnAG$unset)([]))), [
|
|
2164
|
+
onChange
|
|
2165
|
+
]);
|
|
2166
|
+
(0, $lAnAG$useEffect)(()=>{
|
|
2167
|
+
if (open && dialogState) setOpen(false);
|
|
2168
|
+
}, [
|
|
2169
|
+
dialogState,
|
|
2170
|
+
open
|
|
2171
|
+
]);
|
|
2172
|
+
(0, $lAnAG$useClickOutside)((0, $lAnAG$useCallback)(()=>setOpen(false), []), [
|
|
2173
|
+
menuElement
|
|
2174
|
+
]);
|
|
2175
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Inline), {
|
|
2176
|
+
space: 1,
|
|
2177
|
+
padding: 2,
|
|
2178
|
+
children: [
|
|
2179
|
+
isSigned && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Tooltip), {
|
|
2180
|
+
content: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
2181
|
+
padding: 2,
|
|
2182
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
2183
|
+
muted: true,
|
|
2184
|
+
size: 1,
|
|
2185
|
+
children: "Signed playback policy"
|
|
2186
|
+
})
|
|
2187
|
+
}),
|
|
2188
|
+
placement: "right",
|
|
2189
|
+
portal: true,
|
|
2190
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)($98a04f731a506f7d$var$LockCard, {
|
|
2191
|
+
radius: 2,
|
|
2192
|
+
margin: 2,
|
|
2193
|
+
scheme: "dark",
|
|
2194
|
+
tone: "positive",
|
|
2195
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)($98a04f731a506f7d$var$LockButton, {
|
|
2196
|
+
icon: (0, $lAnAG$LockIcon),
|
|
2197
|
+
mode: "bleed",
|
|
2198
|
+
tone: "positive"
|
|
2199
|
+
})
|
|
2200
|
+
})
|
|
2201
|
+
}),
|
|
2202
|
+
!readOnly && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
2203
|
+
icon: (0, $lAnAG$EditIcon),
|
|
2204
|
+
mode: "ghost",
|
|
2205
|
+
onClick: ()=>setDialogState("edit-thumbnail")
|
|
2206
|
+
}),
|
|
2207
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Popover), {
|
|
2208
|
+
content: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Menu), {
|
|
2209
|
+
ref: setMenuRef,
|
|
2210
|
+
children: [
|
|
2211
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
2212
|
+
padding: 2,
|
|
2213
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Label), {
|
|
2214
|
+
muted: true,
|
|
2215
|
+
size: 1,
|
|
2216
|
+
children: "Replace"
|
|
2217
|
+
})
|
|
2218
|
+
}),
|
|
2219
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $adafc56722526c81$export$c1c647ae58701638), {
|
|
2220
|
+
accept: "video/*",
|
|
2221
|
+
icon: (0, $lAnAG$UploadIcon),
|
|
2222
|
+
mode: "bleed",
|
|
2223
|
+
onSelect: onUpload,
|
|
2224
|
+
text: "Upload",
|
|
2225
|
+
disabled: readOnly,
|
|
2226
|
+
fontSize: 2
|
|
2227
|
+
}),
|
|
2228
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MenuItem), {
|
|
2229
|
+
icon: (0, $lAnAG$SearchIcon),
|
|
2230
|
+
text: "Browse",
|
|
2231
|
+
onClick: ()=>setDialogState("select-video")
|
|
2232
|
+
}),
|
|
2233
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MenuDivider), {}),
|
|
2234
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MenuItem), {
|
|
2235
|
+
icon: (0, $lAnAG$PlugIcon),
|
|
2236
|
+
text: "Configure API",
|
|
2237
|
+
onClick: ()=>setDialogState("secrets")
|
|
2238
|
+
}),
|
|
2239
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MenuDivider), {}),
|
|
2240
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$MenuItem), {
|
|
2241
|
+
tone: "critical",
|
|
2242
|
+
icon: (0, $lAnAG$ResetIcon),
|
|
2243
|
+
text: "Clear field",
|
|
2244
|
+
onClick: onReset,
|
|
2245
|
+
disabled: readOnly
|
|
2246
|
+
})
|
|
2247
|
+
]
|
|
2248
|
+
}),
|
|
2249
|
+
portal: true,
|
|
2250
|
+
open: open,
|
|
2251
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
2252
|
+
icon: (0, $lAnAG$EllipsisVerticalIcon),
|
|
2253
|
+
mode: "ghost",
|
|
2254
|
+
onClick: ()=>{
|
|
2255
|
+
setDialogState(false);
|
|
2256
|
+
setOpen(true);
|
|
2257
|
+
}
|
|
2258
|
+
})
|
|
2259
|
+
})
|
|
2260
|
+
]
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
var $98a04f731a506f7d$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $lAnAG$memo)($98a04f731a506f7d$var$PlayerActionsMenu);
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
let $40c930d0837024bb$var$_ = (t1)=>t1, $40c930d0837024bb$var$t;
|
|
2274
|
+
function $40c930d0837024bb$export$ed320981107bc6bd(component) {
|
|
2275
|
+
return (0, $lAnAG$styledcomponents)(component)((props)=>{
|
|
2276
|
+
const border = {
|
|
2277
|
+
width: props.$border ? 1 : 0,
|
|
2278
|
+
color: "var(--card-border-color)"
|
|
2279
|
+
};
|
|
2280
|
+
return (0, $lAnAG$css)($40c930d0837024bb$var$t || ($40c930d0837024bb$var$t = $40c930d0837024bb$var$_`
|
|
2281
|
+
--card-focus-box-shadow: ${0};
|
|
2282
|
+
|
|
2283
|
+
border-radius: ${0};
|
|
2284
|
+
outline: none;
|
|
2285
|
+
box-shadow: var(--card-focus-box-shadow);
|
|
2286
|
+
|
|
2287
|
+
&:focus {
|
|
2288
|
+
--card-focus-box-shadow: ${0};
|
|
2289
|
+
}
|
|
2290
|
+
`), (0, $55e2ea4991872d02$export$a79bcc1dc439e294)(border), (0, $lAnAG$rem)(props.theme.sanity.radius[1]), (0, $55e2ea4991872d02$export$c339ddc20364daad)({
|
|
2291
|
+
base: props.theme.sanity.color.base,
|
|
2292
|
+
border: border,
|
|
2293
|
+
focusRing: props.theme.sanity.focusRing
|
|
2294
|
+
}));
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
let $a6ee8243b0fcaa21$var$_ = (t1)=>t1, $a6ee8243b0fcaa21$var$t;
|
|
2302
|
+
const $a6ee8243b0fcaa21$var$ctrlKey = 17;
|
|
2303
|
+
const $a6ee8243b0fcaa21$var$cmdKey = 91;
|
|
2304
|
+
const $a6ee8243b0fcaa21$var$UploadCardWithFocusRing = (0, $40c930d0837024bb$export$ed320981107bc6bd)((0, $lAnAG$Card));
|
|
2305
|
+
const $a6ee8243b0fcaa21$export$88f8ee83ae881d58 = /*#__PURE__*/ (0, $lAnAG$forwardRef)(({ children: children , tone: tone , onPaste: onPaste , onFocus: onFocus , onBlur: onBlur , onDrop: onDrop , onDragEnter: onDragEnter , onDragLeave: onDragLeave , onDragOver: onDragOver }, forwardedRef)=>{
|
|
2306
|
+
const ctrlDown = (0, $lAnAG$useRef)(false);
|
|
2307
|
+
const inputRef = (0, $lAnAG$useRef)(null);
|
|
2308
|
+
const handleKeyDown = (0, $lAnAG$useCallback)((event)=>{
|
|
2309
|
+
if (event.keyCode == $a6ee8243b0fcaa21$var$ctrlKey || event.keyCode == $a6ee8243b0fcaa21$var$cmdKey) ctrlDown.current = true;
|
|
2310
|
+
const vKey = 86;
|
|
2311
|
+
if (ctrlDown.current && event.keyCode == vKey) inputRef.current.focus();
|
|
2312
|
+
}, []);
|
|
2313
|
+
const handleKeyUp = (0, $lAnAG$useCallback)((event)=>{
|
|
2314
|
+
if (event.keyCode == $a6ee8243b0fcaa21$var$ctrlKey || event.keyCode == $a6ee8243b0fcaa21$var$cmdKey) ctrlDown.current = false;
|
|
2315
|
+
}, []);
|
|
2316
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)($a6ee8243b0fcaa21$var$UploadCardWithFocusRing, {
|
|
2317
|
+
tone: tone,
|
|
2318
|
+
height: "fill",
|
|
2319
|
+
ref: forwardedRef,
|
|
2320
|
+
padding: 0,
|
|
2321
|
+
radius: 2,
|
|
2322
|
+
shadow: 0,
|
|
2323
|
+
tabIndex: 0,
|
|
2324
|
+
onKeyDown: handleKeyDown,
|
|
2325
|
+
onKeyUp: handleKeyUp,
|
|
2326
|
+
onPaste: onPaste,
|
|
2327
|
+
onFocus: onFocus,
|
|
2328
|
+
onBlur: onBlur,
|
|
2329
|
+
onDrop: onDrop,
|
|
2330
|
+
onDragEnter: onDragEnter,
|
|
2331
|
+
onDragLeave: onDragLeave,
|
|
2332
|
+
onDragOver: onDragOver,
|
|
2333
|
+
children: [
|
|
2334
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)($a6ee8243b0fcaa21$var$HiddenInput, {
|
|
2335
|
+
ref: inputRef,
|
|
2336
|
+
onPaste: onPaste
|
|
2337
|
+
}),
|
|
2338
|
+
children
|
|
2339
|
+
]
|
|
2340
|
+
});
|
|
2341
|
+
});
|
|
2342
|
+
const $a6ee8243b0fcaa21$var$HiddenInput = (0, $lAnAG$styledcomponents).input.attrs({
|
|
2343
|
+
type: "text"
|
|
2344
|
+
})($a6ee8243b0fcaa21$var$t || ($a6ee8243b0fcaa21$var$t = $a6ee8243b0fcaa21$var$_`
|
|
2345
|
+
position: absolute;
|
|
2346
|
+
border: 0;
|
|
2347
|
+
color: white;
|
|
2348
|
+
opacity: 0;
|
|
2349
|
+
|
|
2350
|
+
&:focus {
|
|
2351
|
+
outline: none;
|
|
2352
|
+
}
|
|
2353
|
+
`));
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
let $fbf1730dec25840b$var$_ = (t2)=>t2, $fbf1730dec25840b$var$t, $fbf1730dec25840b$var$t1;
|
|
2370
|
+
const $fbf1730dec25840b$var$HiddenInput = (0, $lAnAG$styledcomponents).input($fbf1730dec25840b$var$t || ($fbf1730dec25840b$var$t = $fbf1730dec25840b$var$_`
|
|
2371
|
+
overflow: hidden;
|
|
2372
|
+
width: 0.1px;
|
|
2373
|
+
height: 0.1px;
|
|
2374
|
+
opacity: 0;
|
|
2375
|
+
position: absolute;
|
|
2376
|
+
z-index: -1;
|
|
2377
|
+
`));
|
|
2378
|
+
const $fbf1730dec25840b$var$Label = (0, $lAnAG$styledcomponents).label($fbf1730dec25840b$var$t1 || ($fbf1730dec25840b$var$t1 = $fbf1730dec25840b$var$_`
|
|
2379
|
+
position: relative;
|
|
2380
|
+
`));
|
|
2381
|
+
var $fbf1730dec25840b$export$c6c4e824471beee6 = (_param)=>{
|
|
2382
|
+
var { onSelect: onSelect } = _param, props = (0, $lAnAG$swchelperssrc_object_without_propertiesmjs)(_param, [
|
|
2383
|
+
"onSelect"
|
|
2384
|
+
]);
|
|
2385
|
+
const inputId = `FileSelect${(0, $lAnAG$useId)()}`;
|
|
2386
|
+
const inputRef = (0, $lAnAG$useRef)(null);
|
|
2387
|
+
const handleSelect = (0, $lAnAG$useCallback)((event)=>{
|
|
2388
|
+
if (onSelect) onSelect(event.target.files);
|
|
2389
|
+
}, [
|
|
2390
|
+
onSelect
|
|
2391
|
+
]);
|
|
2392
|
+
const handleButtonClick = (0, $lAnAG$useCallback)(()=>{
|
|
2393
|
+
var ref;
|
|
2394
|
+
return (ref = inputRef.current) === null || ref === void 0 ? void 0 : ref.click();
|
|
2395
|
+
}, []);
|
|
2396
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)($fbf1730dec25840b$var$Label, {
|
|
2397
|
+
htmlFor: inputId,
|
|
2398
|
+
children: [
|
|
2399
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)($fbf1730dec25840b$var$HiddenInput, {
|
|
2400
|
+
accept: "video/*",
|
|
2401
|
+
ref: inputRef,
|
|
2402
|
+
tabIndex: 0,
|
|
2403
|
+
type: "file",
|
|
2404
|
+
id: inputId,
|
|
2405
|
+
onChange: handleSelect,
|
|
2406
|
+
value: ""
|
|
2407
|
+
}),
|
|
2408
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), (0, $lAnAG$swchelperssrc_object_spreadmjs)({
|
|
2409
|
+
onClick: handleButtonClick,
|
|
2410
|
+
mode: "default",
|
|
2411
|
+
tone: "primary",
|
|
2412
|
+
style: {
|
|
2413
|
+
width: "100%"
|
|
2414
|
+
}
|
|
2415
|
+
}, props))
|
|
2416
|
+
]
|
|
2417
|
+
});
|
|
2418
|
+
};
|
|
2419
|
+
|
|
2420
|
+
|
|
2421
|
+
let $0ded6eeffc56fdb2$var$_ = (t2)=>t2, $0ded6eeffc56fdb2$var$t, $0ded6eeffc56fdb2$var$t1;
|
|
2422
|
+
const $0ded6eeffc56fdb2$var$UploadCard = (0, $lAnAG$styledcomponents)((0, $lAnAG$Card))($0ded6eeffc56fdb2$var$t || ($0ded6eeffc56fdb2$var$t = $0ded6eeffc56fdb2$var$_`
|
|
2423
|
+
&& {
|
|
2424
|
+
border-style: dashed;
|
|
2425
|
+
}
|
|
2426
|
+
`));
|
|
2427
|
+
const $0ded6eeffc56fdb2$var$ConfigureApiBox = (0, $lAnAG$styledcomponents)((0, $lAnAG$Box))($0ded6eeffc56fdb2$var$t1 || ($0ded6eeffc56fdb2$var$t1 = $0ded6eeffc56fdb2$var$_`
|
|
2428
|
+
position: absolute;
|
|
2429
|
+
top: 0;
|
|
2430
|
+
right: 0;
|
|
2431
|
+
`));
|
|
2432
|
+
function $0ded6eeffc56fdb2$export$2e2bcd8739ae039(props) {
|
|
2433
|
+
const { setDialogState: setDialogState , readOnly: readOnly , onSelect: onSelect , hovering: hovering , needsSetup: needsSetup } = props;
|
|
2434
|
+
const handleBrowse = (0, $lAnAG$useCallback)(()=>setDialogState("select-video"), [
|
|
2435
|
+
setDialogState
|
|
2436
|
+
]);
|
|
2437
|
+
const handleConfigureApi = (0, $lAnAG$useCallback)(()=>setDialogState("secrets"), [
|
|
2438
|
+
setDialogState
|
|
2439
|
+
]);
|
|
2440
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
2441
|
+
style: {
|
|
2442
|
+
padding: 1,
|
|
2443
|
+
position: "relative"
|
|
2444
|
+
},
|
|
2445
|
+
height: "stretch",
|
|
2446
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)($0ded6eeffc56fdb2$var$UploadCard, {
|
|
2447
|
+
sizing: "border",
|
|
2448
|
+
height: "fill",
|
|
2449
|
+
tone: readOnly ? "transparent" : "inherit",
|
|
2450
|
+
border: true,
|
|
2451
|
+
padding: 3,
|
|
2452
|
+
style: hovering ? {
|
|
2453
|
+
borderColor: "transparent"
|
|
2454
|
+
} : undefined,
|
|
2455
|
+
children: [
|
|
2456
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)($0ded6eeffc56fdb2$var$ConfigureApiBox, {
|
|
2457
|
+
padding: 3,
|
|
2458
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
2459
|
+
padding: 3,
|
|
2460
|
+
radius: 3,
|
|
2461
|
+
tone: needsSetup ? "critical" : undefined,
|
|
2462
|
+
onClick: handleConfigureApi,
|
|
2463
|
+
icon: (0, $lAnAG$PlugIcon),
|
|
2464
|
+
mode: "bleed"
|
|
2465
|
+
})
|
|
2466
|
+
}),
|
|
2467
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
2468
|
+
align: "center",
|
|
2469
|
+
justify: "space-between",
|
|
2470
|
+
gap: 4,
|
|
2471
|
+
direction: [
|
|
2472
|
+
"column",
|
|
2473
|
+
"column",
|
|
2474
|
+
"row"
|
|
2475
|
+
],
|
|
2476
|
+
paddingY: [
|
|
2477
|
+
2,
|
|
2478
|
+
2,
|
|
2479
|
+
0
|
|
2480
|
+
],
|
|
2481
|
+
sizing: "border",
|
|
2482
|
+
height: "fill",
|
|
2483
|
+
children: [
|
|
2484
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
2485
|
+
align: "center",
|
|
2486
|
+
justify: "center",
|
|
2487
|
+
gap: 2,
|
|
2488
|
+
flex: 1,
|
|
2489
|
+
children: [
|
|
2490
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
2491
|
+
justify: "center",
|
|
2492
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
2493
|
+
muted: true,
|
|
2494
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$DocumentVideoIcon), {})
|
|
2495
|
+
})
|
|
2496
|
+
}),
|
|
2497
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
2498
|
+
justify: "center",
|
|
2499
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
2500
|
+
size: 1,
|
|
2501
|
+
muted: true,
|
|
2502
|
+
children: "Drag video or paste URL here"
|
|
2503
|
+
})
|
|
2504
|
+
})
|
|
2505
|
+
]
|
|
2506
|
+
}),
|
|
2507
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Inline), {
|
|
2508
|
+
space: 2,
|
|
2509
|
+
children: [
|
|
2510
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $fbf1730dec25840b$export$c6c4e824471beee6), {
|
|
2511
|
+
mode: "ghost",
|
|
2512
|
+
tone: "default",
|
|
2513
|
+
icon: (0, $lAnAG$UploadIcon),
|
|
2514
|
+
text: "Upload",
|
|
2515
|
+
onSelect: onSelect
|
|
2516
|
+
}),
|
|
2517
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
2518
|
+
mode: "ghost",
|
|
2519
|
+
icon: (0, $lAnAG$SearchIcon),
|
|
2520
|
+
text: "Select",
|
|
2521
|
+
onClick: handleBrowse
|
|
2522
|
+
})
|
|
2523
|
+
]
|
|
2524
|
+
})
|
|
2525
|
+
]
|
|
2526
|
+
})
|
|
2527
|
+
]
|
|
2528
|
+
})
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
|
|
2533
|
+
|
|
2534
|
+
class $1e6f849e3fcd818c$var$MuxVideoInputUploader extends (0, $lAnAG$Component) {
|
|
2535
|
+
componentWillUnmount() {
|
|
2536
|
+
this.unSubscribeToUpload();
|
|
2537
|
+
}
|
|
2538
|
+
componentDidMount() {
|
|
2539
|
+
const events$ = new (0, $lAnAG$Subject)();
|
|
2540
|
+
this.onCancelUploadButtonClick$ = events$.asObservable();
|
|
2541
|
+
this.handleCancelUploadButtonClick = (event)=>events$.next(event);
|
|
2542
|
+
}
|
|
2543
|
+
unSubscribeToUpload() {
|
|
2544
|
+
if (this.upload && !this.upload.closed) this.upload.unsubscribe();
|
|
2545
|
+
}
|
|
2546
|
+
render() {
|
|
2547
|
+
var ref;
|
|
2548
|
+
if (this.state.uploadProgress !== null) return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $92e84bb25450e8d6$export$98a3886347b629fb), {
|
|
2549
|
+
onCancel: this.handleCancelUploadButtonClick,
|
|
2550
|
+
progress: this.state.uploadProgress,
|
|
2551
|
+
filename: ((ref = this.state.fileInfo) === null || ref === void 0 ? void 0 : ref.name) || this.state.url
|
|
2552
|
+
});
|
|
2553
|
+
if (this.state.error) // @TODO better error handling
|
|
2554
|
+
throw this.state.error;
|
|
2555
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Fragment), {
|
|
2556
|
+
children: [
|
|
2557
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $a6ee8243b0fcaa21$export$88f8ee83ae881d58), {
|
|
2558
|
+
tone: this.state.isDraggingOver && (this.state.invalidPaste || this.state.invalidFile) ? "critical" : this.state.isDraggingOver ? "positive" : undefined,
|
|
2559
|
+
onBlur: this.props.onBlur,
|
|
2560
|
+
onFocus: this.props.onFocus,
|
|
2561
|
+
onDrop: this.handleDrop,
|
|
2562
|
+
onDragOver: this.handleDragOver,
|
|
2563
|
+
onDragLeave: this.handleDragLeave,
|
|
2564
|
+
onDragEnter: this.handleDragEnter,
|
|
2565
|
+
onPaste: this.handlePaste,
|
|
2566
|
+
ref: this.container,
|
|
2567
|
+
children: this.props.asset ? /*#__PURE__*/ (0, $lAnAG$jsx)((0, $a094825b464048a2$export$2e2bcd8739ae039), {
|
|
2568
|
+
readOnly: this.props.readOnly,
|
|
2569
|
+
asset: this.props.asset,
|
|
2570
|
+
onChange: this.props.onChange,
|
|
2571
|
+
dialogState: this.props.dialogState,
|
|
2572
|
+
setDialogState: this.props.setDialogState,
|
|
2573
|
+
buttons: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $98a04f731a506f7d$export$2e2bcd8739ae039), {
|
|
2574
|
+
asset: this.props.asset,
|
|
2575
|
+
dialogState: this.props.dialogState,
|
|
2576
|
+
setDialogState: this.props.setDialogState,
|
|
2577
|
+
onChange: this.props.onChange,
|
|
2578
|
+
onUpload: this.onUpload,
|
|
2579
|
+
readOnly: this.props.readOnly
|
|
2580
|
+
})
|
|
2581
|
+
}) : /*#__PURE__*/ (0, $lAnAG$jsx)((0, $0ded6eeffc56fdb2$export$2e2bcd8739ae039), {
|
|
2582
|
+
hovering: this.state.isDraggingOver,
|
|
2583
|
+
onSelect: this.onUpload,
|
|
2584
|
+
readOnly: this.props.readOnly,
|
|
2585
|
+
setDialogState: this.props.setDialogState,
|
|
2586
|
+
needsSetup: this.props.needsSetup
|
|
2587
|
+
})
|
|
2588
|
+
}),
|
|
2589
|
+
this.props.dialogState === "select-video" && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $99b7c7e884102d35$export$2e2bcd8739ae039), {
|
|
2590
|
+
asset: this.props.asset,
|
|
2591
|
+
onChange: this.props.onChange,
|
|
2592
|
+
setDialogState: this.props.setDialogState
|
|
2593
|
+
})
|
|
2594
|
+
]
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
constructor(...args){
|
|
2598
|
+
super(...args);
|
|
2599
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "state", {
|
|
2600
|
+
isDraggingOver: false,
|
|
2601
|
+
invalidPaste: false,
|
|
2602
|
+
invalidFile: false,
|
|
2603
|
+
uploadProgress: null,
|
|
2604
|
+
fileInfo: null,
|
|
2605
|
+
uuid: null,
|
|
2606
|
+
error: null,
|
|
2607
|
+
url: null
|
|
2608
|
+
});
|
|
2609
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "dragEnteredEls", []);
|
|
2610
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "ctrlDown", false);
|
|
2611
|
+
// eslint-disable-next-line no-warning-comments
|
|
2612
|
+
// @TODO add proper typings for the return values of uploadFile and uploadUrl
|
|
2613
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "upload", null);
|
|
2614
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "container", /*#__PURE__*/ (0, $lAnAG$react).createRef());
|
|
2615
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handleProgress", (evt)=>{
|
|
2616
|
+
this.setState({
|
|
2617
|
+
uploadProgress: evt.percent
|
|
2618
|
+
});
|
|
2619
|
+
});
|
|
2620
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "onUpload", (files)=>{
|
|
2621
|
+
this.setState({
|
|
2622
|
+
uploadProgress: 0,
|
|
2623
|
+
fileInfo: null,
|
|
2624
|
+
uuid: null
|
|
2625
|
+
});
|
|
2626
|
+
this.upload = (0, $96f24671e0303f47$export$a5575dbeeffdad98)(this.props.config, this.props.client, files[0], {
|
|
2627
|
+
enableSignedUrls: this.props.secrets.enableSignedUrls
|
|
2628
|
+
}).pipe((0, $lAnAG$takeUntil)(this.onCancelUploadButtonClick$.pipe((0, $lAnAG$tap)(()=>{
|
|
2629
|
+
if (this.state.uuid) this.props.client.delete(this.state.uuid);
|
|
2630
|
+
})))).subscribe({
|
|
2631
|
+
complete: ()=>{
|
|
2632
|
+
this.setState({
|
|
2633
|
+
error: null,
|
|
2634
|
+
uploadProgress: null,
|
|
2635
|
+
uuid: null
|
|
2636
|
+
});
|
|
2637
|
+
},
|
|
2638
|
+
next: (event)=>{
|
|
2639
|
+
this.handleUploadEvent(event);
|
|
2640
|
+
},
|
|
2641
|
+
error: (err)=>{
|
|
2642
|
+
this.setState({
|
|
2643
|
+
error: err,
|
|
2644
|
+
uploadProgress: null,
|
|
2645
|
+
uuid: null
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
});
|
|
2649
|
+
});
|
|
2650
|
+
// eslint-disable-next-line no-warning-comments
|
|
2651
|
+
// @TODO add proper typings for the Observable events
|
|
2652
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handleUploadEvent", (event)=>{
|
|
2653
|
+
switch(event.type){
|
|
2654
|
+
case "success":
|
|
2655
|
+
return this.handleUploadSuccess(event.asset);
|
|
2656
|
+
case "progress":
|
|
2657
|
+
return this.handleProgress(event);
|
|
2658
|
+
case "file":
|
|
2659
|
+
return this.setState({
|
|
2660
|
+
fileInfo: event.file
|
|
2661
|
+
});
|
|
2662
|
+
case "uuid":
|
|
2663
|
+
// Means we created a mux.videoAsset document with an uuid
|
|
2664
|
+
return this.setState({
|
|
2665
|
+
uuid: event.uuid
|
|
2666
|
+
});
|
|
2667
|
+
case "url":
|
|
2668
|
+
return this.setState({
|
|
2669
|
+
url: event.url,
|
|
2670
|
+
uploadProgress: 100
|
|
2671
|
+
});
|
|
2672
|
+
default:
|
|
2673
|
+
return null;
|
|
2674
|
+
}
|
|
2675
|
+
});
|
|
2676
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handleUploadSuccess", (asset)=>{
|
|
2677
|
+
this.setState({
|
|
2678
|
+
uploadProgress: 100
|
|
2679
|
+
});
|
|
2680
|
+
this.props.onChange((0, $lAnAG$PatchEvent).from([
|
|
2681
|
+
(0, $lAnAG$setIfMissing)({
|
|
2682
|
+
asset: {}
|
|
2683
|
+
}),
|
|
2684
|
+
(0, $lAnAG$set)({
|
|
2685
|
+
_type: "reference",
|
|
2686
|
+
_weak: true,
|
|
2687
|
+
_ref: asset._id
|
|
2688
|
+
}, [
|
|
2689
|
+
"asset"
|
|
2690
|
+
]),
|
|
2691
|
+
]));
|
|
2692
|
+
});
|
|
2693
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handlePaste", (event)=>{
|
|
2694
|
+
const clipboardData = event.clipboardData || window.clipboardData;
|
|
2695
|
+
const url = clipboardData.getData("text");
|
|
2696
|
+
const options = {
|
|
2697
|
+
enableSignedUrls: this.props.secrets.enableSignedUrls
|
|
2698
|
+
};
|
|
2699
|
+
this.upload = (0, $96f24671e0303f47$export$f35af194eb27b25f)(this.props.config, this.props.client, url, options).subscribe({
|
|
2700
|
+
complete: ()=>{
|
|
2701
|
+
this.setState({
|
|
2702
|
+
error: null,
|
|
2703
|
+
uploadProgress: null,
|
|
2704
|
+
url: null
|
|
2705
|
+
});
|
|
2706
|
+
},
|
|
2707
|
+
next: (sEvent)=>{
|
|
2708
|
+
this.handleUploadEvent(sEvent);
|
|
2709
|
+
},
|
|
2710
|
+
error: (err)=>{
|
|
2711
|
+
let error;
|
|
2712
|
+
// Don't output error dialog when just invalid url
|
|
2713
|
+
if (!err.message.toLowerCase().match("invalid url")) error = err;
|
|
2714
|
+
this.setState({
|
|
2715
|
+
invalidPaste: true,
|
|
2716
|
+
error: error
|
|
2717
|
+
}, ()=>{
|
|
2718
|
+
setTimeout(()=>{
|
|
2719
|
+
this.setState({
|
|
2720
|
+
invalidPaste: false,
|
|
2721
|
+
uploadProgress: null
|
|
2722
|
+
});
|
|
2723
|
+
}, 2000);
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
});
|
|
2727
|
+
});
|
|
2728
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handleDrop", (event)=>{
|
|
2729
|
+
this.setState({
|
|
2730
|
+
isDraggingOver: false
|
|
2731
|
+
});
|
|
2732
|
+
event.preventDefault();
|
|
2733
|
+
event.stopPropagation();
|
|
2734
|
+
(0, $4e510dd53b714187$export$73f6d6d8d794f645)(event.nativeEvent.dataTransfer).then((files)=>{
|
|
2735
|
+
if (files) // eslint-disable-next-line no-warning-comments
|
|
2736
|
+
// @TODO fix the typing on files
|
|
2737
|
+
this.onUpload(files);
|
|
2738
|
+
});
|
|
2739
|
+
});
|
|
2740
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handleDragOver", (event)=>{
|
|
2741
|
+
event.preventDefault();
|
|
2742
|
+
event.stopPropagation();
|
|
2743
|
+
});
|
|
2744
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handleDragEnter", (event)=>{
|
|
2745
|
+
var ref, ref1;
|
|
2746
|
+
event.stopPropagation();
|
|
2747
|
+
this.dragEnteredEls.push(event.target);
|
|
2748
|
+
this.setState({
|
|
2749
|
+
isDraggingOver: true
|
|
2750
|
+
});
|
|
2751
|
+
const type = (ref = event.dataTransfer.items) === null || ref === void 0 ? void 0 : (ref1 = ref[0]) === null || ref1 === void 0 ? void 0 : ref1.type;
|
|
2752
|
+
this.setState({
|
|
2753
|
+
invalidFile: !type.startsWith("video/")
|
|
2754
|
+
});
|
|
2755
|
+
});
|
|
2756
|
+
(0, $lAnAG$swchelperssrc_define_propertymjs)(this, "handleDragLeave", (event)=>{
|
|
2757
|
+
event.stopPropagation();
|
|
2758
|
+
const idx = this.dragEnteredEls.indexOf(event.target);
|
|
2759
|
+
if (idx > -1) this.dragEnteredEls.splice(idx, 1);
|
|
2760
|
+
if (this.dragEnteredEls.length === 0) this.setState({
|
|
2761
|
+
isDraggingOver: false
|
|
2762
|
+
});
|
|
2763
|
+
});
|
|
31
2764
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
2765
|
+
}
|
|
2766
|
+
var $1e6f849e3fcd818c$export$2e2bcd8739ae039 = $1e6f849e3fcd818c$var$MuxVideoInputUploader;
|
|
2767
|
+
|
|
2768
|
+
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
const $93b38f02837bfd52$export$e1d4ef4fde5dbdf2 = (client, secrets)=>{
|
|
2778
|
+
return (0, $lAnAG$useCallback)(async ({ token: token , secretKey: secretKey , enableSignedUrls: enableSignedUrls })=>{
|
|
2779
|
+
let { signingKeyId: signingKeyId , signingKeyPrivate: signingKeyPrivate } = secrets;
|
|
2780
|
+
try {
|
|
2781
|
+
await (0, $467babf025eab28e$export$f16c6d66b9790f06)(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate);
|
|
2782
|
+
const valid = await (0, $467babf025eab28e$export$3a1df1322191b3ef)(client);
|
|
2783
|
+
if (!(valid === null || valid === void 0 ? void 0 : valid.status) && token && secretKey) throw new Error("Invalid secrets");
|
|
2784
|
+
} catch (err) {
|
|
2785
|
+
console.error("Error while trying to save secrets:", err);
|
|
2786
|
+
throw err;
|
|
2787
|
+
}
|
|
2788
|
+
if (enableSignedUrls) {
|
|
2789
|
+
const hasValidSigningKeys = await (0, $467babf025eab28e$export$f5836111430d17bc)(client, signingKeyId, signingKeyPrivate);
|
|
2790
|
+
if (!hasValidSigningKeys) try {
|
|
2791
|
+
const { data: data } = await (0, $467babf025eab28e$export$21cc0cab779cfac1)(client);
|
|
2792
|
+
signingKeyId = data.id;
|
|
2793
|
+
signingKeyPrivate = data.private_key;
|
|
2794
|
+
await (0, $467babf025eab28e$export$f16c6d66b9790f06)(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate);
|
|
2795
|
+
} catch (err) {
|
|
2796
|
+
// eslint-disable-next-line no-console
|
|
2797
|
+
console.log("Error while creating and saving signing key:", err.message);
|
|
2798
|
+
throw err;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
return {
|
|
2802
|
+
token: token,
|
|
2803
|
+
secretKey: secretKey,
|
|
2804
|
+
enableSignedUrls: enableSignedUrls,
|
|
2805
|
+
signingKeyId: signingKeyId,
|
|
2806
|
+
signingKeyPrivate: signingKeyPrivate
|
|
2807
|
+
};
|
|
2808
|
+
}, [
|
|
2809
|
+
client,
|
|
2810
|
+
secrets
|
|
2811
|
+
]);
|
|
2812
|
+
};
|
|
2813
|
+
|
|
2814
|
+
|
|
2815
|
+
|
|
2816
|
+
|
|
2817
|
+
|
|
2818
|
+
function $2009a875dc2b1e38$var$init({ token: token , secretKey: secretKey , enableSignedUrls: enableSignedUrls }) {
|
|
2819
|
+
return {
|
|
2820
|
+
submitting: false,
|
|
2821
|
+
error: null,
|
|
2822
|
+
// Form inputs don't set the state back to null when clearing a field, but uses empty strings
|
|
2823
|
+
// This ensures the `dirty` check works correctly
|
|
2824
|
+
token: token !== null && token !== void 0 ? token : "",
|
|
2825
|
+
secretKey: secretKey !== null && secretKey !== void 0 ? secretKey : "",
|
|
2826
|
+
enableSignedUrls: enableSignedUrls !== null && enableSignedUrls !== void 0 ? enableSignedUrls : false
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
function $2009a875dc2b1e38$var$reducer(state, action) {
|
|
2830
|
+
switch(action === null || action === void 0 ? void 0 : action.type){
|
|
2831
|
+
case "submit":
|
|
2832
|
+
return (0, $lAnAG$swchelperssrc_object_spread_propsmjs)((0, $lAnAG$swchelperssrc_object_spreadmjs)({}, state), {
|
|
2833
|
+
submitting: true,
|
|
2834
|
+
error: null
|
|
2835
|
+
});
|
|
2836
|
+
case "error":
|
|
2837
|
+
return (0, $lAnAG$swchelperssrc_object_spread_propsmjs)((0, $lAnAG$swchelperssrc_object_spreadmjs)({}, state), {
|
|
2838
|
+
submitting: false,
|
|
2839
|
+
error: action.payload
|
|
2840
|
+
});
|
|
2841
|
+
case "reset":
|
|
2842
|
+
return $2009a875dc2b1e38$var$init(action.payload);
|
|
2843
|
+
case "change":
|
|
2844
|
+
return (0, $lAnAG$swchelperssrc_object_spread_propsmjs)((0, $lAnAG$swchelperssrc_object_spreadmjs)({}, state), {
|
|
2845
|
+
[action.payload.name]: action.payload.value
|
|
2846
|
+
});
|
|
2847
|
+
default:
|
|
2848
|
+
throw new Error(`Unknown action type: ${action === null || action === void 0 ? void 0 : action.type}`);
|
|
39
2849
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
2850
|
+
}
|
|
2851
|
+
const $2009a875dc2b1e38$export$e24a74f4fce2446c = (secrets)=>(0, $lAnAG$useReducer)($2009a875dc2b1e38$var$reducer, secrets, $2009a875dc2b1e38$var$init);
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
|
|
2856
|
+
|
|
2857
|
+
|
|
2858
|
+
|
|
2859
|
+
|
|
2860
|
+
|
|
2861
|
+
|
|
2862
|
+
// Mapping ids to ensure filter refs are unique, otherwise all Logo instances are hidden if the first SVG is hidden, due to how SVGs deal with relative links and ids
|
|
2863
|
+
const $e5db4a7ae122bbf8$var$ids = [
|
|
2864
|
+
"title",
|
|
2865
|
+
"a",
|
|
2866
|
+
"b",
|
|
2867
|
+
"c",
|
|
2868
|
+
"d",
|
|
2869
|
+
"e",
|
|
2870
|
+
"f",
|
|
2871
|
+
"g",
|
|
2872
|
+
"h",
|
|
2873
|
+
"i",
|
|
2874
|
+
"j",
|
|
2875
|
+
"k",
|
|
2876
|
+
"l",
|
|
2877
|
+
"m",
|
|
2878
|
+
"n",
|
|
2879
|
+
"o",
|
|
2880
|
+
"p",
|
|
2881
|
+
"q",
|
|
2882
|
+
"r",
|
|
2883
|
+
];
|
|
2884
|
+
function $e5db4a7ae122bbf8$export$2e2bcd8739ae039({ height: height = 26 }) {
|
|
2885
|
+
const id = (0, $lAnAG$useId)();
|
|
2886
|
+
const [titleId, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = (0, $lAnAG$useMemo)(()=>$e5db4a7ae122bbf8$var$ids.map((field)=>`${id}-${field}`), [
|
|
2887
|
+
id
|
|
2888
|
+
]);
|
|
2889
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)("svg", {
|
|
2890
|
+
"aria-labelledby": titleId,
|
|
2891
|
+
role: "img",
|
|
2892
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2893
|
+
xmlSpace: "preserve",
|
|
2894
|
+
viewBox: "92.08878326416016 102.66712188720703 692.76123046875 219.99948120117188",
|
|
2895
|
+
style: {
|
|
2896
|
+
height: `${height}px`
|
|
2897
|
+
},
|
|
2898
|
+
children: [
|
|
2899
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("title", {
|
|
2900
|
+
id: titleId,
|
|
2901
|
+
children: "Mux Logo"
|
|
2902
|
+
}),
|
|
2903
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("defs", {
|
|
2904
|
+
children: [
|
|
2905
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
2906
|
+
id: c,
|
|
2907
|
+
spreadMethod: "pad",
|
|
2908
|
+
gradientTransform: "matrix(528.38055 0 0 -528.38055 63.801 159.5)",
|
|
2909
|
+
gradientUnits: "userSpaceOnUse",
|
|
2910
|
+
y2: 0,
|
|
2911
|
+
x2: 1,
|
|
2912
|
+
y1: 0,
|
|
2913
|
+
x1: 0,
|
|
2914
|
+
children: [
|
|
2915
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
2916
|
+
offset: 0,
|
|
2917
|
+
style: {
|
|
2918
|
+
stopOpacity: 1,
|
|
2919
|
+
stopColor: "#ff4e00"
|
|
2920
|
+
}
|
|
2921
|
+
}),
|
|
2922
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
2923
|
+
offset: 1,
|
|
2924
|
+
style: {
|
|
2925
|
+
stopOpacity: 1,
|
|
2926
|
+
stopColor: "#ff1791"
|
|
2927
|
+
}
|
|
2928
|
+
})
|
|
2929
|
+
]
|
|
2930
|
+
}),
|
|
2931
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
2932
|
+
id: d,
|
|
2933
|
+
spreadMethod: "pad",
|
|
2934
|
+
gradientTransform: "matrix(523.66766 0 0 -523.66766 67.897 159.5)",
|
|
2935
|
+
gradientUnits: "userSpaceOnUse",
|
|
2936
|
+
y2: 0,
|
|
2937
|
+
x2: 1,
|
|
2938
|
+
y1: 0,
|
|
2939
|
+
x1: 0,
|
|
2940
|
+
children: [
|
|
2941
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
2942
|
+
offset: 0,
|
|
2943
|
+
style: {
|
|
2944
|
+
stopOpacity: 1,
|
|
2945
|
+
stopColor: "#ff4e00"
|
|
2946
|
+
}
|
|
2947
|
+
}),
|
|
2948
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
2949
|
+
offset: 1,
|
|
2950
|
+
style: {
|
|
2951
|
+
stopOpacity: 1,
|
|
2952
|
+
stopColor: "#ff1791"
|
|
2953
|
+
}
|
|
2954
|
+
})
|
|
2955
|
+
]
|
|
2956
|
+
}),
|
|
2957
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
2958
|
+
id: g,
|
|
2959
|
+
spreadMethod: "pad",
|
|
2960
|
+
gradientTransform: "rotate(180 296.075 79.75) scale(524.84045)",
|
|
2961
|
+
gradientUnits: "userSpaceOnUse",
|
|
2962
|
+
y2: 0,
|
|
2963
|
+
x2: 1,
|
|
2964
|
+
y1: 0,
|
|
2965
|
+
x1: 0,
|
|
2966
|
+
children: [
|
|
2967
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
2968
|
+
offset: 0,
|
|
2969
|
+
style: {
|
|
2970
|
+
stopOpacity: 1,
|
|
2971
|
+
stopColor: "#ff4e00"
|
|
2972
|
+
}
|
|
2973
|
+
}),
|
|
2974
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
2975
|
+
offset: 1,
|
|
2976
|
+
style: {
|
|
2977
|
+
stopOpacity: 1,
|
|
2978
|
+
stopColor: "#ff1791"
|
|
2979
|
+
}
|
|
2980
|
+
})
|
|
2981
|
+
]
|
|
2982
|
+
}),
|
|
2983
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
2984
|
+
id: i,
|
|
2985
|
+
spreadMethod: "pad",
|
|
2986
|
+
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
|
|
2987
|
+
gradientUnits: "userSpaceOnUse",
|
|
2988
|
+
y2: 0,
|
|
2989
|
+
x2: 1,
|
|
2990
|
+
y1: 0,
|
|
2991
|
+
x1: 0,
|
|
2992
|
+
children: [
|
|
2993
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
2994
|
+
offset: 0,
|
|
2995
|
+
style: {
|
|
2996
|
+
stopOpacity: 1,
|
|
2997
|
+
stopColor: "#ff4e00"
|
|
2998
|
+
}
|
|
2999
|
+
}),
|
|
3000
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3001
|
+
offset: 1,
|
|
3002
|
+
style: {
|
|
3003
|
+
stopOpacity: 1,
|
|
3004
|
+
stopColor: "#ff1791"
|
|
3005
|
+
}
|
|
3006
|
+
})
|
|
3007
|
+
]
|
|
3008
|
+
}),
|
|
3009
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
3010
|
+
id: j,
|
|
3011
|
+
spreadMethod: "pad",
|
|
3012
|
+
gradientTransform: "matrix(523.08514 0 0 -523.08514 67.897 224.446)",
|
|
3013
|
+
gradientUnits: "userSpaceOnUse",
|
|
3014
|
+
y2: 0,
|
|
3015
|
+
x2: 1,
|
|
3016
|
+
y1: 0,
|
|
3017
|
+
x1: 0,
|
|
3018
|
+
children: [
|
|
3019
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3020
|
+
offset: 0,
|
|
3021
|
+
style: {
|
|
3022
|
+
stopOpacity: 1,
|
|
3023
|
+
stopColor: "#ff4e00"
|
|
3024
|
+
}
|
|
3025
|
+
}),
|
|
3026
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3027
|
+
offset: 1,
|
|
3028
|
+
style: {
|
|
3029
|
+
stopOpacity: 1,
|
|
3030
|
+
stopColor: "#ff1791"
|
|
3031
|
+
}
|
|
3032
|
+
})
|
|
3033
|
+
]
|
|
3034
|
+
}),
|
|
3035
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
3036
|
+
id: k,
|
|
3037
|
+
spreadMethod: "pad",
|
|
3038
|
+
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 94.553)",
|
|
3039
|
+
gradientUnits: "userSpaceOnUse",
|
|
3040
|
+
y2: 0,
|
|
3041
|
+
x2: 1,
|
|
3042
|
+
y1: 0,
|
|
3043
|
+
x1: 0,
|
|
3044
|
+
children: [
|
|
3045
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3046
|
+
offset: 0,
|
|
3047
|
+
style: {
|
|
3048
|
+
stopOpacity: 1,
|
|
3049
|
+
stopColor: "#ff4e00"
|
|
3050
|
+
}
|
|
3051
|
+
}),
|
|
3052
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3053
|
+
offset: 1,
|
|
3054
|
+
style: {
|
|
3055
|
+
stopOpacity: 1,
|
|
3056
|
+
stopColor: "#ff1791"
|
|
3057
|
+
}
|
|
3058
|
+
})
|
|
3059
|
+
]
|
|
3060
|
+
}),
|
|
3061
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
3062
|
+
id: l,
|
|
3063
|
+
spreadMethod: "pad",
|
|
3064
|
+
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
|
|
3065
|
+
gradientUnits: "userSpaceOnUse",
|
|
3066
|
+
y2: 0,
|
|
3067
|
+
x2: 1,
|
|
3068
|
+
y1: 0,
|
|
3069
|
+
x1: 0,
|
|
3070
|
+
children: [
|
|
3071
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3072
|
+
offset: 0,
|
|
3073
|
+
style: {
|
|
3074
|
+
stopOpacity: 1,
|
|
3075
|
+
stopColor: "#ff4e00"
|
|
3076
|
+
}
|
|
3077
|
+
}),
|
|
3078
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3079
|
+
offset: 1,
|
|
3080
|
+
style: {
|
|
3081
|
+
stopOpacity: 1,
|
|
3082
|
+
stopColor: "#ff1791"
|
|
3083
|
+
}
|
|
3084
|
+
})
|
|
3085
|
+
]
|
|
3086
|
+
}),
|
|
3087
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
3088
|
+
id: m,
|
|
3089
|
+
spreadMethod: "pad",
|
|
3090
|
+
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 94.554)",
|
|
3091
|
+
gradientUnits: "userSpaceOnUse",
|
|
3092
|
+
y2: 0,
|
|
3093
|
+
x2: 1,
|
|
3094
|
+
y1: 0,
|
|
3095
|
+
x1: 0,
|
|
3096
|
+
children: [
|
|
3097
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3098
|
+
offset: 0,
|
|
3099
|
+
style: {
|
|
3100
|
+
stopOpacity: 1,
|
|
3101
|
+
stopColor: "#ff4e00"
|
|
3102
|
+
}
|
|
3103
|
+
}),
|
|
3104
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3105
|
+
offset: 1,
|
|
3106
|
+
style: {
|
|
3107
|
+
stopOpacity: 1,
|
|
3108
|
+
stopColor: "#ff1791"
|
|
3109
|
+
}
|
|
3110
|
+
})
|
|
3111
|
+
]
|
|
3112
|
+
}),
|
|
3113
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
3114
|
+
id: p,
|
|
3115
|
+
spreadMethod: "pad",
|
|
3116
|
+
gradientTransform: "matrix(521.97632 0 0 -521.97632 69.067 191.973)",
|
|
3117
|
+
gradientUnits: "userSpaceOnUse",
|
|
3118
|
+
y2: 0,
|
|
3119
|
+
x2: 1,
|
|
3120
|
+
y1: 0,
|
|
3121
|
+
x1: 0,
|
|
3122
|
+
children: [
|
|
3123
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3124
|
+
offset: 0,
|
|
3125
|
+
style: {
|
|
3126
|
+
stopOpacity: 1,
|
|
3127
|
+
stopColor: "#ff4e00"
|
|
3128
|
+
}
|
|
3129
|
+
}),
|
|
3130
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3131
|
+
offset: 1,
|
|
3132
|
+
style: {
|
|
3133
|
+
stopOpacity: 1,
|
|
3134
|
+
stopColor: "#ff1791"
|
|
3135
|
+
}
|
|
3136
|
+
})
|
|
3137
|
+
]
|
|
3138
|
+
}),
|
|
3139
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
3140
|
+
id: q,
|
|
3141
|
+
spreadMethod: "pad",
|
|
3142
|
+
gradientTransform: "matrix(523.09039 0 0 -523.09039 67.312 191.973)",
|
|
3143
|
+
gradientUnits: "userSpaceOnUse",
|
|
3144
|
+
y2: 0,
|
|
3145
|
+
x2: 1,
|
|
3146
|
+
y1: 0,
|
|
3147
|
+
x1: 0,
|
|
3148
|
+
children: [
|
|
3149
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3150
|
+
offset: 0,
|
|
3151
|
+
style: {
|
|
3152
|
+
stopOpacity: 1,
|
|
3153
|
+
stopColor: "#ff4e00"
|
|
3154
|
+
}
|
|
3155
|
+
}),
|
|
3156
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3157
|
+
offset: 1,
|
|
3158
|
+
style: {
|
|
3159
|
+
stopOpacity: 1,
|
|
3160
|
+
stopColor: "#ff1791"
|
|
3161
|
+
}
|
|
3162
|
+
})
|
|
3163
|
+
]
|
|
3164
|
+
}),
|
|
3165
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("linearGradient", {
|
|
3166
|
+
id: r,
|
|
3167
|
+
spreadMethod: "pad",
|
|
3168
|
+
gradientTransform: "matrix(524.84045 0 0 -524.84045 63.801 159.5)",
|
|
3169
|
+
gradientUnits: "userSpaceOnUse",
|
|
3170
|
+
y2: 0,
|
|
3171
|
+
x2: 1,
|
|
3172
|
+
y1: 0,
|
|
3173
|
+
x1: 0,
|
|
3174
|
+
children: [
|
|
3175
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3176
|
+
offset: 0,
|
|
3177
|
+
style: {
|
|
3178
|
+
stopOpacity: 1,
|
|
3179
|
+
stopColor: "#ff4e00"
|
|
3180
|
+
}
|
|
3181
|
+
}),
|
|
3182
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("stop", {
|
|
3183
|
+
offset: 1,
|
|
3184
|
+
style: {
|
|
3185
|
+
stopOpacity: 1,
|
|
3186
|
+
stopColor: "#ff1791"
|
|
3187
|
+
}
|
|
3188
|
+
})
|
|
3189
|
+
]
|
|
3190
|
+
}),
|
|
3191
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("clipPath", {
|
|
3192
|
+
id: a,
|
|
3193
|
+
clipPathUnits: "userSpaceOnUse",
|
|
3194
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3195
|
+
d: "M0 319h657.706V0H0Z"
|
|
3196
|
+
})
|
|
3197
|
+
}),
|
|
3198
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("clipPath", {
|
|
3199
|
+
id: b,
|
|
3200
|
+
clipPathUnits: "userSpaceOnUse",
|
|
3201
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3202
|
+
d: "M423.64 242h164.999V77H423.64Z"
|
|
3203
|
+
})
|
|
3204
|
+
}),
|
|
3205
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("clipPath", {
|
|
3206
|
+
id: e,
|
|
3207
|
+
clipPathUnits: "userSpaceOnUse",
|
|
3208
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3209
|
+
d: "M0 319h657.706V0H0Z"
|
|
3210
|
+
})
|
|
3211
|
+
}),
|
|
3212
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("clipPath", {
|
|
3213
|
+
id: f,
|
|
3214
|
+
clipPathUnits: "userSpaceOnUse",
|
|
3215
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3216
|
+
d: "M311.3 242h93.031V77H311.3Z"
|
|
3217
|
+
})
|
|
3218
|
+
}),
|
|
3219
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("clipPath", {
|
|
3220
|
+
id: h,
|
|
3221
|
+
clipPathUnits: "userSpaceOnUse",
|
|
3222
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3223
|
+
d: "M198.96 242h35.106V77H198.96Z"
|
|
3224
|
+
})
|
|
3225
|
+
}),
|
|
3226
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("clipPath", {
|
|
3227
|
+
id: n,
|
|
3228
|
+
clipPathUnits: "userSpaceOnUse",
|
|
3229
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3230
|
+
d: "M0 319h657.706V0H0Z"
|
|
3231
|
+
})
|
|
3232
|
+
}),
|
|
3233
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("clipPath", {
|
|
3234
|
+
id: o,
|
|
3235
|
+
clipPathUnits: "userSpaceOnUse",
|
|
3236
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3237
|
+
d: "M69.067 242H169.12V141.947H69.067Z"
|
|
3238
|
+
})
|
|
3239
|
+
})
|
|
3240
|
+
]
|
|
3241
|
+
}),
|
|
3242
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("g", {
|
|
3243
|
+
clipPath: `url(#${a})`,
|
|
3244
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)",
|
|
3245
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("g", {
|
|
3246
|
+
style: {
|
|
3247
|
+
opacity: 0.69999701
|
|
3248
|
+
},
|
|
3249
|
+
clipPath: `url(#${b})`,
|
|
3250
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3251
|
+
style: {
|
|
3252
|
+
fill: `url(#${c})`,
|
|
3253
|
+
stroke: "none"
|
|
3254
|
+
},
|
|
3255
|
+
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"
|
|
3256
|
+
})
|
|
3257
|
+
})
|
|
3258
|
+
}),
|
|
3259
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3260
|
+
style: {
|
|
3261
|
+
fill: `url(#${d})`,
|
|
3262
|
+
stroke: "none"
|
|
3263
|
+
},
|
|
3264
|
+
d: "M558.674 236.858 428.781 106.966c-6.855-6.855-6.855-17.969 0-24.825 6.855-6.854 17.969-6.854 24.823 0l129.894 129.894c6.854 6.855 6.854 17.968 0 24.823A17.498 17.498 0 0 1 571.086 242a17.495 17.495 0 0 1-12.412-5.142",
|
|
3265
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
3266
|
+
}),
|
|
3267
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)("g", {
|
|
3268
|
+
clipPath: `url(#${e})`,
|
|
3269
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)",
|
|
3270
|
+
children: [
|
|
3271
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("g", {
|
|
3272
|
+
style: {
|
|
3273
|
+
opacity: 0.69999701
|
|
3274
|
+
},
|
|
3275
|
+
clipPath: `url(#${f})`,
|
|
3276
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3277
|
+
style: {
|
|
3278
|
+
fill: `url(#${g})`,
|
|
3279
|
+
stroke: "none"
|
|
3280
|
+
},
|
|
3281
|
+
d: "M328.853 112.107c22.297 0 40.372 18.075 40.372 40.372v71.315c0 10.054 7.505 18.206 17.554 18.206 10.048 0 17.552-8.152 17.552-18.206v-71.315c0-41.686-33.793-75.479-75.478-75.479-9.694 0-17.553 7.859-17.553 17.554 0 9.694 7.859 17.553 17.553 17.553"
|
|
3282
|
+
})
|
|
3283
|
+
}),
|
|
3284
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("g", {
|
|
3285
|
+
style: {
|
|
3286
|
+
opacity: 0.69999701
|
|
3287
|
+
},
|
|
3288
|
+
clipPath: `url(#${h})`,
|
|
3289
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3290
|
+
style: {
|
|
3291
|
+
fill: `url(#${i})`,
|
|
3292
|
+
stroke: "none"
|
|
3293
|
+
},
|
|
3294
|
+
d: "M216.513 242c-10.049 0-17.553-8.152-17.553-18.206V95.206c0-10.054 7.504-18.206 17.553-18.206 10.048 0 17.553 8.152 17.553 18.206v128.588c0 10.054-7.505 18.206-17.553 18.206"
|
|
3295
|
+
})
|
|
3296
|
+
})
|
|
3297
|
+
]
|
|
3298
|
+
}),
|
|
3299
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3300
|
+
style: {
|
|
3301
|
+
fill: `url(#${j})`,
|
|
3302
|
+
stroke: "none"
|
|
3303
|
+
},
|
|
3304
|
+
d: "M369.225 224.447c0-9.694 7.859-17.553 17.553-17.553 9.695 0 17.553 7.859 17.553 17.553s-7.858 17.552-17.553 17.552c-9.694 0-17.553-7.858-17.553-17.552",
|
|
3305
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
3306
|
+
}),
|
|
3307
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3308
|
+
style: {
|
|
3309
|
+
fill: `url(#${k})`,
|
|
3310
|
+
stroke: "none"
|
|
3311
|
+
},
|
|
3312
|
+
d: "M553.532 94.554c0-9.695 7.859-17.554 17.553-17.554 9.695 0 17.554 7.859 17.554 17.554 0 9.694-7.859 17.552-17.554 17.552-9.694 0-17.553-7.858-17.553-17.552",
|
|
3313
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
3314
|
+
}),
|
|
3315
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3316
|
+
style: {
|
|
3317
|
+
fill: `url(#${l})`,
|
|
3318
|
+
stroke: "none"
|
|
3319
|
+
},
|
|
3320
|
+
d: "M69.067 223.794V95.206C69.067 85.152 76.571 77 86.62 77c10.048 0 17.553 8.152 17.553 18.206v128.588c0 10.055-7.505 18.205-17.553 18.205-10.049 0-17.553-8.15-17.553-18.205",
|
|
3321
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
3322
|
+
}),
|
|
3323
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3324
|
+
style: {
|
|
3325
|
+
fill: `url(#${m})`,
|
|
3326
|
+
stroke: "none"
|
|
3327
|
+
},
|
|
3328
|
+
d: "M198.96 94.554c0-9.695 7.859-17.554 17.553-17.554 9.695 0 17.554 7.859 17.554 17.554 0 9.694-7.859 17.553-17.554 17.553-9.694 0-17.553-7.859-17.553-17.553",
|
|
3329
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
3330
|
+
}),
|
|
3331
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("g", {
|
|
3332
|
+
clipPath: `url(#${n})`,
|
|
3333
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)",
|
|
3334
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("g", {
|
|
3335
|
+
style: {
|
|
3336
|
+
opacity: 0.69999701
|
|
3337
|
+
},
|
|
3338
|
+
clipPath: `url(#${o})`,
|
|
3339
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3340
|
+
style: {
|
|
3341
|
+
fill: `url(#${p})`,
|
|
3342
|
+
stroke: "none"
|
|
3343
|
+
},
|
|
3344
|
+
d: "M139.155 147.088c6.855-6.855 17.969-6.855 24.824 0s6.855 17.969 0 24.824l-64.947 64.946c-6.855 6.855-17.969 6.855-24.824 0s-6.855-17.969 0-24.823z"
|
|
3345
|
+
})
|
|
3346
|
+
})
|
|
3347
|
+
}),
|
|
3348
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3349
|
+
style: {
|
|
3350
|
+
fill: `url(#${q})`,
|
|
3351
|
+
stroke: "none"
|
|
3352
|
+
},
|
|
3353
|
+
d: "m204.101 236.858-64.947-64.946c-6.854-6.855-6.854-17.969 0-24.824 6.856-6.855 17.97-6.855 24.824 0l64.947 64.947c6.855 6.855 6.855 17.968 0 24.823A17.495 17.495 0 0 1 216.513 242a17.498 17.498 0 0 1-12.412-5.142",
|
|
3354
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
3355
|
+
}),
|
|
3356
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("path", {
|
|
3357
|
+
style: {
|
|
3358
|
+
fill: `url(#${r})`,
|
|
3359
|
+
stroke: "none"
|
|
3360
|
+
},
|
|
3361
|
+
d: "M253.374 223.794v-71.315c0-41.685 33.793-75.479 75.479-75.479 9.695 0 17.553 7.859 17.553 17.554 0 9.694-7.858 17.553-17.553 17.553-22.297 0-40.372 18.075-40.372 40.372v71.315c0 10.055-7.505 18.205-17.554 18.205s-17.553-8.15-17.553-18.205",
|
|
3362
|
+
transform: "matrix(1.33333 0 0 -1.33333 0 425.333)"
|
|
3363
|
+
})
|
|
3364
|
+
]
|
|
3365
|
+
});
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
|
|
3369
|
+
let $caae83a439f13a20$var$_ = (t1)=>t1, $caae83a439f13a20$var$t;
|
|
3370
|
+
const $caae83a439f13a20$var$Logo = (0, $lAnAG$styledcomponents).span($caae83a439f13a20$var$t || ($caae83a439f13a20$var$t = $caae83a439f13a20$var$_`
|
|
3371
|
+
display: inline-block;
|
|
3372
|
+
height: 0.8em;
|
|
3373
|
+
margin-right: 1em;
|
|
3374
|
+
transform: translate(0.3em, -0.2em);
|
|
3375
|
+
`));
|
|
3376
|
+
const $caae83a439f13a20$export$8b251419efc915eb = ()=>/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Fragment), {
|
|
3377
|
+
children: [
|
|
3378
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)($caae83a439f13a20$var$Logo, {
|
|
3379
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $e5db4a7ae122bbf8$export$2e2bcd8739ae039), {
|
|
3380
|
+
height: 13
|
|
3381
|
+
})
|
|
3382
|
+
}),
|
|
3383
|
+
"API Credentials"
|
|
3384
|
+
]
|
|
3385
|
+
});
|
|
3386
|
+
|
|
3387
|
+
|
|
44
3388
|
|
|
45
|
-
parcelRequire.register = function register(id, init) {
|
|
46
|
-
$parcel$inits[id] = init;
|
|
47
|
-
};
|
|
48
3389
|
|
|
49
|
-
|
|
3390
|
+
|
|
3391
|
+
function $040fe68d1b0334ea$var$FormField(props) {
|
|
3392
|
+
const { children: children , title: title , description: description , inputId: inputId } = props;
|
|
3393
|
+
return /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
3394
|
+
space: 1,
|
|
3395
|
+
children: [
|
|
3396
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
3397
|
+
align: "flex-end",
|
|
3398
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
3399
|
+
flex: 1,
|
|
3400
|
+
paddingY: 2,
|
|
3401
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Stack), {
|
|
3402
|
+
space: 2,
|
|
3403
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
3404
|
+
children: [
|
|
3405
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
3406
|
+
as: "label",
|
|
3407
|
+
htmlFor: inputId,
|
|
3408
|
+
weight: "semibold",
|
|
3409
|
+
size: 1,
|
|
3410
|
+
children: title || /*#__PURE__*/ (0, $lAnAG$jsx)("em", {
|
|
3411
|
+
children: "Untitled"
|
|
3412
|
+
})
|
|
3413
|
+
}),
|
|
3414
|
+
description && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
3415
|
+
muted: true,
|
|
3416
|
+
size: 1,
|
|
3417
|
+
children: description
|
|
3418
|
+
})
|
|
3419
|
+
]
|
|
3420
|
+
})
|
|
3421
|
+
})
|
|
3422
|
+
})
|
|
3423
|
+
}),
|
|
3424
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("div", {
|
|
3425
|
+
children: children
|
|
3426
|
+
})
|
|
3427
|
+
]
|
|
3428
|
+
});
|
|
50
3429
|
}
|
|
51
|
-
|
|
3430
|
+
var $040fe68d1b0334ea$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $lAnAG$memo)($040fe68d1b0334ea$var$FormField);
|
|
52
3431
|
|
|
53
|
-
$parcel$export(module.exports, "name", () => $9171e222faf8652c$export$a8ff84c12d48cfa6);
|
|
54
|
-
$parcel$export(module.exports, "cacheNs", () => $9171e222faf8652c$export$13cdb654d47e0703);
|
|
55
|
-
$parcel$export(module.exports, "muxSecretsDocumentId", () => $9171e222faf8652c$export$64952397958089dd);
|
|
56
|
-
const $9171e222faf8652c$export$a8ff84c12d48cfa6 = "mux-input";
|
|
57
|
-
const $9171e222faf8652c$export$13cdb654d47e0703 = "sanity-plugin-mux-input";
|
|
58
|
-
const $9171e222faf8652c$export$64952397958089dd = "secrets.mux";
|
|
59
3432
|
|
|
60
|
-
|
|
3433
|
+
const $f56cae7201fafa6f$var$fieldNames = [
|
|
3434
|
+
"token",
|
|
3435
|
+
"secretKey",
|
|
3436
|
+
"enableSignedUrls"
|
|
3437
|
+
];
|
|
3438
|
+
function $f56cae7201fafa6f$var$ConfigureApi({ secrets: secrets , setDialogState: setDialogState }) {
|
|
3439
|
+
const client = (0, $lAnAG$useClient)();
|
|
3440
|
+
const [state, dispatch] = (0, $2009a875dc2b1e38$export$e24a74f4fce2446c)(secrets);
|
|
3441
|
+
const hasSecretsInitially = (0, $lAnAG$useMemo)(()=>secrets.token && secrets.secretKey, [
|
|
3442
|
+
secrets
|
|
3443
|
+
]);
|
|
3444
|
+
const handleClose = (0, $lAnAG$useCallback)(()=>setDialogState(false), [
|
|
3445
|
+
setDialogState
|
|
3446
|
+
]);
|
|
3447
|
+
const dirty = (0, $lAnAG$useMemo)(()=>secrets.token !== state.token || secrets.secretKey !== state.secretKey || secrets.enableSignedUrls !== state.enableSignedUrls, [
|
|
3448
|
+
secrets,
|
|
3449
|
+
state
|
|
3450
|
+
]);
|
|
3451
|
+
const id = `ConfigureApi${(0, $lAnAG$useId)()}`;
|
|
3452
|
+
const [tokenId, secretKeyId, enableSignedUrlsId] = (0, $lAnAG$useMemo)(()=>$f56cae7201fafa6f$var$fieldNames.map((field)=>`${id}-${field}`), [
|
|
3453
|
+
id
|
|
3454
|
+
]);
|
|
3455
|
+
const firstField = (0, $lAnAG$useRef)(null);
|
|
3456
|
+
const handleSaveSecrets = (0, $93b38f02837bfd52$export$e1d4ef4fde5dbdf2)(client, secrets);
|
|
3457
|
+
const saving = (0, $lAnAG$useRef)(false);
|
|
3458
|
+
const handleSubmit = (0, $lAnAG$useCallback)((event)=>{
|
|
3459
|
+
event.preventDefault();
|
|
3460
|
+
if (!saving.current && event.currentTarget.reportValidity()) {
|
|
3461
|
+
saving.current = true;
|
|
3462
|
+
dispatch({
|
|
3463
|
+
type: "submit"
|
|
3464
|
+
});
|
|
3465
|
+
const { token: token , secretKey: secretKey , enableSignedUrls: enableSignedUrls } = state;
|
|
3466
|
+
handleSaveSecrets({
|
|
3467
|
+
token: token,
|
|
3468
|
+
secretKey: secretKey,
|
|
3469
|
+
enableSignedUrls: enableSignedUrls
|
|
3470
|
+
}).then((savedSecrets)=>{
|
|
3471
|
+
const { projectId: projectId , dataset: dataset } = client.config();
|
|
3472
|
+
(0, $lAnAG$clear)([
|
|
3473
|
+
(0, $81deebaa2da6d866$export$13cdb654d47e0703),
|
|
3474
|
+
(0, $3208be7e9a7ca648$export$9c7ae676ac45430a),
|
|
3475
|
+
projectId,
|
|
3476
|
+
dataset
|
|
3477
|
+
]);
|
|
3478
|
+
(0, $lAnAG$preload)(()=>Promise.resolve(savedSecrets), [
|
|
3479
|
+
(0, $81deebaa2da6d866$export$13cdb654d47e0703),
|
|
3480
|
+
(0, $3208be7e9a7ca648$export$9c7ae676ac45430a),
|
|
3481
|
+
projectId,
|
|
3482
|
+
dataset
|
|
3483
|
+
]);
|
|
3484
|
+
setDialogState(false);
|
|
3485
|
+
}).catch((err)=>dispatch({
|
|
3486
|
+
type: "error",
|
|
3487
|
+
payload: err.message
|
|
3488
|
+
})).finally(()=>{
|
|
3489
|
+
saving.current = false;
|
|
3490
|
+
});
|
|
3491
|
+
}
|
|
3492
|
+
}, [
|
|
3493
|
+
client,
|
|
3494
|
+
dispatch,
|
|
3495
|
+
handleSaveSecrets,
|
|
3496
|
+
setDialogState,
|
|
3497
|
+
state
|
|
3498
|
+
]);
|
|
3499
|
+
const handleChangeToken = (0, $lAnAG$useCallback)((event)=>{
|
|
3500
|
+
dispatch({
|
|
3501
|
+
type: "change",
|
|
3502
|
+
payload: {
|
|
3503
|
+
name: "token",
|
|
3504
|
+
value: event.currentTarget.value
|
|
3505
|
+
}
|
|
3506
|
+
});
|
|
3507
|
+
}, [
|
|
3508
|
+
dispatch
|
|
3509
|
+
]);
|
|
3510
|
+
const handleChangeSecretKey = (0, $lAnAG$useCallback)((event)=>{
|
|
3511
|
+
dispatch({
|
|
3512
|
+
type: "change",
|
|
3513
|
+
payload: {
|
|
3514
|
+
name: "secretKey",
|
|
3515
|
+
value: event.currentTarget.value
|
|
3516
|
+
}
|
|
3517
|
+
});
|
|
3518
|
+
}, [
|
|
3519
|
+
dispatch
|
|
3520
|
+
]);
|
|
3521
|
+
const handleChangeEnableSignedUrls = (0, $lAnAG$useCallback)((event)=>{
|
|
3522
|
+
dispatch({
|
|
3523
|
+
type: "change",
|
|
3524
|
+
payload: {
|
|
3525
|
+
name: "enableSignedUrls",
|
|
3526
|
+
value: event.currentTarget.checked
|
|
3527
|
+
}
|
|
3528
|
+
});
|
|
3529
|
+
}, [
|
|
3530
|
+
dispatch
|
|
3531
|
+
]);
|
|
3532
|
+
(0, $lAnAG$useEffect)(()=>{
|
|
3533
|
+
if (firstField.current) firstField.current.focus();
|
|
3534
|
+
}, [
|
|
3535
|
+
firstField
|
|
3536
|
+
]);
|
|
3537
|
+
var _token, _secretKey;
|
|
3538
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Dialog), {
|
|
3539
|
+
id: id,
|
|
3540
|
+
onClose: handleClose,
|
|
3541
|
+
header: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $caae83a439f13a20$export$8b251419efc915eb), {}),
|
|
3542
|
+
width: 0,
|
|
3543
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
3544
|
+
padding: 4,
|
|
3545
|
+
style: {
|
|
3546
|
+
position: "relative"
|
|
3547
|
+
},
|
|
3548
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("form", {
|
|
3549
|
+
onSubmit: handleSubmit,
|
|
3550
|
+
noValidate: true,
|
|
3551
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
3552
|
+
space: 4,
|
|
3553
|
+
children: [
|
|
3554
|
+
!hasSecretsInitially && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
3555
|
+
padding: [
|
|
3556
|
+
3,
|
|
3557
|
+
3,
|
|
3558
|
+
3
|
|
3559
|
+
],
|
|
3560
|
+
radius: 2,
|
|
3561
|
+
shadow: 1,
|
|
3562
|
+
tone: "primary",
|
|
3563
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
3564
|
+
space: 3,
|
|
3565
|
+
children: [
|
|
3566
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Text), {
|
|
3567
|
+
size: 1,
|
|
3568
|
+
children: [
|
|
3569
|
+
"To set up a new access token, go to your",
|
|
3570
|
+
" ",
|
|
3571
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("a", {
|
|
3572
|
+
href: "https://dashboard.mux.com/settings/access-tokens",
|
|
3573
|
+
target: "_blank",
|
|
3574
|
+
rel: "noreferrer noopener",
|
|
3575
|
+
children: "account on mux.com"
|
|
3576
|
+
}),
|
|
3577
|
+
"."
|
|
3578
|
+
]
|
|
3579
|
+
}),
|
|
3580
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Text), {
|
|
3581
|
+
size: 1,
|
|
3582
|
+
children: [
|
|
3583
|
+
"The access token needs permissions: ",
|
|
3584
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("strong", {
|
|
3585
|
+
children: "Mux Video "
|
|
3586
|
+
}),
|
|
3587
|
+
"(Full Access) and ",
|
|
3588
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("strong", {
|
|
3589
|
+
children: "Mux Data"
|
|
3590
|
+
}),
|
|
3591
|
+
" (Read)",
|
|
3592
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("br", {}),
|
|
3593
|
+
"The credentials will be stored safely in a hidden document only available to editors."
|
|
3594
|
+
]
|
|
3595
|
+
})
|
|
3596
|
+
]
|
|
3597
|
+
})
|
|
3598
|
+
}),
|
|
3599
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $040fe68d1b0334ea$export$2e2bcd8739ae039), {
|
|
3600
|
+
title: "Access Token",
|
|
3601
|
+
inputId: tokenId,
|
|
3602
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$TextInput), {
|
|
3603
|
+
id: tokenId,
|
|
3604
|
+
ref: firstField,
|
|
3605
|
+
onChange: handleChangeToken,
|
|
3606
|
+
type: "text",
|
|
3607
|
+
value: (_token = state.token) !== null && _token !== void 0 ? _token : "",
|
|
3608
|
+
required: !!state.secretKey || state.enableSignedUrls
|
|
3609
|
+
})
|
|
3610
|
+
}),
|
|
3611
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $040fe68d1b0334ea$export$2e2bcd8739ae039), {
|
|
3612
|
+
title: "Secret Key",
|
|
3613
|
+
inputId: secretKeyId,
|
|
3614
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$TextInput), {
|
|
3615
|
+
id: secretKeyId,
|
|
3616
|
+
onChange: handleChangeSecretKey,
|
|
3617
|
+
type: "text",
|
|
3618
|
+
value: (_secretKey = state.secretKey) !== null && _secretKey !== void 0 ? _secretKey : "",
|
|
3619
|
+
required: !!state.token || state.enableSignedUrls
|
|
3620
|
+
})
|
|
3621
|
+
}),
|
|
3622
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
3623
|
+
space: 4,
|
|
3624
|
+
children: [
|
|
3625
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
3626
|
+
align: "center",
|
|
3627
|
+
children: [
|
|
3628
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Checkbox), {
|
|
3629
|
+
id: enableSignedUrlsId,
|
|
3630
|
+
onChange: handleChangeEnableSignedUrls,
|
|
3631
|
+
checked: state.enableSignedUrls,
|
|
3632
|
+
style: {
|
|
3633
|
+
display: "block"
|
|
3634
|
+
}
|
|
3635
|
+
}),
|
|
3636
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
3637
|
+
flex: 1,
|
|
3638
|
+
paddingLeft: 3,
|
|
3639
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
3640
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("label", {
|
|
3641
|
+
htmlFor: enableSignedUrlsId,
|
|
3642
|
+
children: "Enable Signed Urls"
|
|
3643
|
+
})
|
|
3644
|
+
})
|
|
3645
|
+
})
|
|
3646
|
+
]
|
|
3647
|
+
}),
|
|
3648
|
+
secrets.signingKeyId && state.enableSignedUrls ? /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
3649
|
+
padding: [
|
|
3650
|
+
3,
|
|
3651
|
+
3,
|
|
3652
|
+
3
|
|
3653
|
+
],
|
|
3654
|
+
radius: 2,
|
|
3655
|
+
shadow: 1,
|
|
3656
|
+
tone: "caution",
|
|
3657
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Stack), {
|
|
3658
|
+
space: 3,
|
|
3659
|
+
children: [
|
|
3660
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
3661
|
+
size: 1,
|
|
3662
|
+
children: "The signing key ID that Sanity will use is:"
|
|
3663
|
+
}),
|
|
3664
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Code), {
|
|
3665
|
+
size: 1,
|
|
3666
|
+
children: secrets.signingKeyId
|
|
3667
|
+
}),
|
|
3668
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Text), {
|
|
3669
|
+
size: 1,
|
|
3670
|
+
children: [
|
|
3671
|
+
"This key is only used for previewing content in the Sanity UI.",
|
|
3672
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)("br", {}),
|
|
3673
|
+
"You should generate a different key to use in your application server."
|
|
3674
|
+
]
|
|
3675
|
+
})
|
|
3676
|
+
]
|
|
3677
|
+
})
|
|
3678
|
+
}) : null
|
|
3679
|
+
]
|
|
3680
|
+
}),
|
|
3681
|
+
/*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Inline), {
|
|
3682
|
+
space: 2,
|
|
3683
|
+
children: [
|
|
3684
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
3685
|
+
text: "Save",
|
|
3686
|
+
disabled: !dirty,
|
|
3687
|
+
loading: state.submitting,
|
|
3688
|
+
tone: "primary",
|
|
3689
|
+
mode: "default",
|
|
3690
|
+
type: "submit"
|
|
3691
|
+
}),
|
|
3692
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
3693
|
+
disabled: state.submitting,
|
|
3694
|
+
text: "Cancel",
|
|
3695
|
+
mode: "bleed",
|
|
3696
|
+
onClick: handleClose
|
|
3697
|
+
})
|
|
3698
|
+
]
|
|
3699
|
+
}),
|
|
3700
|
+
state.error && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
3701
|
+
padding: [
|
|
3702
|
+
3,
|
|
3703
|
+
3,
|
|
3704
|
+
3
|
|
3705
|
+
],
|
|
3706
|
+
radius: 2,
|
|
3707
|
+
shadow: 1,
|
|
3708
|
+
tone: "critical",
|
|
3709
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
3710
|
+
children: state.error
|
|
3711
|
+
})
|
|
3712
|
+
})
|
|
3713
|
+
]
|
|
3714
|
+
})
|
|
3715
|
+
})
|
|
3716
|
+
})
|
|
3717
|
+
});
|
|
3718
|
+
}
|
|
3719
|
+
var $f56cae7201fafa6f$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $lAnAG$memo)($f56cae7201fafa6f$var$ConfigureApi);
|
|
61
3720
|
|
|
62
|
-
parcelRequire.register("bhKR6", function(module, exports) {
|
|
63
3721
|
|
|
64
|
-
$parcel$export(module.exports, "AspectRatioCard", () => $7c28b65b046419e6$export$f0c88bc5a320387d);
|
|
65
|
-
$parcel$export(module.exports, "InputFallback", () => $7c28b65b046419e6$export$18fe723e8683ca03);
|
|
66
3722
|
|
|
67
3723
|
|
|
68
3724
|
|
|
69
3725
|
|
|
70
|
-
|
|
3726
|
+
let $c4f1ad5e2af7bb16$var$_ = (t1)=>t1, $c4f1ad5e2af7bb16$var$t;
|
|
3727
|
+
const $c4f1ad5e2af7bb16$export$f0c88bc5a320387d = (0, $lAnAG$styledcomponents)((0, $lAnAG$Card))($c4f1ad5e2af7bb16$var$t || ($c4f1ad5e2af7bb16$var$t = $c4f1ad5e2af7bb16$var$_`
|
|
71
3728
|
aspect-ratio: 16 / 9;
|
|
72
3729
|
position: relative;
|
|
73
3730
|
width: 100%;
|
|
74
|
-
|
|
75
|
-
const $
|
|
76
|
-
return /*#__PURE__*/ (0, $
|
|
3731
|
+
`));
|
|
3732
|
+
const $c4f1ad5e2af7bb16$export$18fe723e8683ca03 = ()=>{
|
|
3733
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)("div", {
|
|
77
3734
|
style: {
|
|
78
3735
|
padding: 1
|
|
79
3736
|
},
|
|
80
|
-
children: /*#__PURE__*/ (0, $
|
|
3737
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
81
3738
|
shadow: 1,
|
|
82
3739
|
sizing: "border",
|
|
83
3740
|
style: {
|
|
@@ -85,18 +3742,18 @@ const $7c28b65b046419e6$export$18fe723e8683ca03 = ()=>{
|
|
|
85
3742
|
width: "100%",
|
|
86
3743
|
borderRadius: "1px"
|
|
87
3744
|
},
|
|
88
|
-
children: /*#__PURE__*/ (0, $
|
|
3745
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Flex), {
|
|
89
3746
|
align: "center",
|
|
90
3747
|
direction: "column",
|
|
91
3748
|
height: "fill",
|
|
92
3749
|
justify: "center",
|
|
93
3750
|
children: [
|
|
94
|
-
/*#__PURE__*/ (0, $
|
|
3751
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Spinner), {
|
|
95
3752
|
muted: true
|
|
96
3753
|
}),
|
|
97
|
-
/*#__PURE__*/ (0, $
|
|
3754
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Box), {
|
|
98
3755
|
marginTop: 3,
|
|
99
|
-
children: /*#__PURE__*/ (0, $
|
|
3756
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Text), {
|
|
100
3757
|
align: "center",
|
|
101
3758
|
muted: true,
|
|
102
3759
|
size: 1,
|
|
@@ -109,157 +3766,156 @@ const $7c28b65b046419e6$export$18fe723e8683ca03 = ()=>{
|
|
|
109
3766
|
});
|
|
110
3767
|
};
|
|
111
3768
|
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
parcelRequire.register("lHC3x", function(module, exports) {
|
|
115
|
-
module.exports = import("./Input.8f661c56.js").then(()=>parcelRequire("5LV0W"));
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
parcelRequire.register("23nr7", function(module, exports) {
|
|
120
|
-
module.exports = import("./Preview.0ca0dc85.js").then(()=>parcelRequire("4SN9U"));
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
|
|
125
3769
|
|
|
126
3770
|
|
|
127
3771
|
|
|
128
3772
|
|
|
129
3773
|
|
|
130
3774
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
function $8154a59bf072c7a1$var$ErrorBoundaryCard(props) {
|
|
136
|
-
const { children: children , schemaType: schemaType } = props;
|
|
137
|
-
const { push: pushToast } = (0, $7XdDa$useToast)();
|
|
138
|
-
const errorRef = (0, $7XdDa$useRef)(null);
|
|
139
|
-
const { ErrorBoundary: ErrorBoundary , didCatch: didCatch , error: error , reset: reset } = (0, $7XdDa$useErrorBoundary)({
|
|
140
|
-
onDidCatch: (err, errorInfo)=>{
|
|
141
|
-
console.group(err.toString());
|
|
142
|
-
console.groupCollapsed("console.error");
|
|
143
|
-
console.error(err);
|
|
144
|
-
console.groupEnd();
|
|
145
|
-
if (err.stack) {
|
|
146
|
-
console.groupCollapsed("error.stack");
|
|
147
|
-
console.log(err.stack);
|
|
148
|
-
console.groupEnd();
|
|
149
|
-
}
|
|
150
|
-
if (errorInfo?.componentStack) {
|
|
151
|
-
console.groupCollapsed("errorInfo.componentStack");
|
|
152
|
-
console.log(errorInfo.componentStack);
|
|
153
|
-
console.groupEnd();
|
|
154
|
-
}
|
|
155
|
-
console.groupEnd();
|
|
156
|
-
pushToast({
|
|
157
|
-
status: "error",
|
|
158
|
-
title: "Plugin crashed",
|
|
159
|
-
description: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Flex), {
|
|
160
|
-
align: "center",
|
|
161
|
-
children: /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Inline), {
|
|
162
|
-
space: 1,
|
|
163
|
-
children: [
|
|
164
|
-
"An error happened while rendering",
|
|
165
|
-
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Button), {
|
|
166
|
-
padding: 1,
|
|
167
|
-
fontSize: 1,
|
|
168
|
-
style: {
|
|
169
|
-
transform: "translateY(1px)"
|
|
170
|
-
},
|
|
171
|
-
mode: "ghost",
|
|
172
|
-
text: schemaType.title,
|
|
173
|
-
onClick: ()=>{
|
|
174
|
-
if (errorRef.current) (0, $7XdDa$scrollintoviewifneeded)(errorRef.current, {
|
|
175
|
-
behavior: "smooth",
|
|
176
|
-
scrollMode: "if-needed",
|
|
177
|
-
block: "center"
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
]
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
const handleRetry = (0, $7XdDa$useCallback)(()=>{
|
|
188
|
-
// Purge request cache before retrying, otherwise the cached errors will rethrow
|
|
189
|
-
(0, $7XdDa$clear)([
|
|
190
|
-
(0, $jH2rf.name)
|
|
191
|
-
]);
|
|
192
|
-
reset();
|
|
193
|
-
}, [
|
|
194
|
-
reset
|
|
3775
|
+
function $430a7fbe93b73361$export$2e2bcd8739ae039(props) {
|
|
3776
|
+
const { setDialogState: setDialogState } = props;
|
|
3777
|
+
const handleOpen = (0, $lAnAG$useCallback)(()=>setDialogState("secrets"), [
|
|
3778
|
+
setDialogState
|
|
195
3779
|
]);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
height: "fill",
|
|
211
|
-
children: /*#__PURE__*/ (0, $7XdDa$jsxs)((0, $7XdDa$Grid), {
|
|
212
|
-
columns: 1,
|
|
213
|
-
gap: [
|
|
3780
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Fragment), {
|
|
3781
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("div", {
|
|
3782
|
+
style: {
|
|
3783
|
+
padding: 2
|
|
3784
|
+
},
|
|
3785
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Card), {
|
|
3786
|
+
display: "flex",
|
|
3787
|
+
sizing: "border",
|
|
3788
|
+
style: {
|
|
3789
|
+
aspectRatio: "16/9",
|
|
3790
|
+
width: "100%",
|
|
3791
|
+
boxShadow: "var(--card-bg-color) 0 0 0 2px"
|
|
3792
|
+
},
|
|
3793
|
+
paddingX: [
|
|
214
3794
|
2,
|
|
215
3795
|
3,
|
|
216
3796
|
4,
|
|
217
3797
|
4
|
|
218
3798
|
],
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
3799
|
+
radius: 1,
|
|
3800
|
+
tone: "transparent",
|
|
3801
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Flex), {
|
|
3802
|
+
justify: "flex-start",
|
|
3803
|
+
align: "center",
|
|
3804
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Grid), {
|
|
3805
|
+
columns: 1,
|
|
3806
|
+
gap: [
|
|
3807
|
+
2,
|
|
3808
|
+
3,
|
|
3809
|
+
4,
|
|
3810
|
+
4
|
|
3811
|
+
],
|
|
222
3812
|
children: [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
children: (0, $
|
|
3813
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Inline), {
|
|
3814
|
+
paddingY: 1,
|
|
3815
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)("div", {
|
|
3816
|
+
style: {
|
|
3817
|
+
height: "32px"
|
|
3818
|
+
},
|
|
3819
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $e5db4a7ae122bbf8$export$2e2bcd8739ae039), {})
|
|
3820
|
+
})
|
|
226
3821
|
}),
|
|
227
|
-
|
|
3822
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Inline), {
|
|
3823
|
+
paddingY: 1,
|
|
3824
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Heading), {
|
|
3825
|
+
size: [
|
|
3826
|
+
0,
|
|
3827
|
+
1,
|
|
3828
|
+
2,
|
|
3829
|
+
2
|
|
3830
|
+
],
|
|
3831
|
+
children: "Upload and preview videos directly from your studio."
|
|
3832
|
+
})
|
|
3833
|
+
}),
|
|
3834
|
+
/*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Inline), {
|
|
3835
|
+
paddingY: 1,
|
|
3836
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Button), {
|
|
3837
|
+
mode: "ghost",
|
|
3838
|
+
icon: (0, $lAnAG$PlugIcon),
|
|
3839
|
+
text: "Configure API",
|
|
3840
|
+
onClick: handleOpen
|
|
3841
|
+
})
|
|
3842
|
+
})
|
|
228
3843
|
]
|
|
229
|
-
}),
|
|
230
|
-
error?.message && /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Card), {
|
|
231
|
-
padding: 3,
|
|
232
|
-
tone: "critical",
|
|
233
|
-
shadow: 1,
|
|
234
|
-
radius: 2,
|
|
235
|
-
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Text), {
|
|
236
|
-
children: error.message
|
|
237
|
-
})
|
|
238
|
-
}),
|
|
239
|
-
/*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Inline), {
|
|
240
|
-
children: /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Button), {
|
|
241
|
-
onClick: handleRetry,
|
|
242
|
-
text: "Retry"
|
|
243
|
-
})
|
|
244
3844
|
})
|
|
245
|
-
|
|
3845
|
+
})
|
|
246
3846
|
})
|
|
247
3847
|
})
|
|
248
3848
|
});
|
|
249
|
-
return /*#__PURE__*/ (0, $7XdDa$jsx)(ErrorBoundary, {
|
|
250
|
-
children: children
|
|
251
|
-
});
|
|
252
3849
|
}
|
|
253
|
-
var $8154a59bf072c7a1$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $7XdDa$memo)($8154a59bf072c7a1$var$ErrorBoundaryCard);
|
|
254
3850
|
|
|
255
3851
|
|
|
3852
|
+
const $b33ab17c95965f41$var$Input = (props)=>{
|
|
3853
|
+
var ref;
|
|
3854
|
+
const client = (0, $lAnAG$useClient)();
|
|
3855
|
+
const secretDocumentValues = (0, $264222da7614d565$export$4c2801830a129eb)();
|
|
3856
|
+
const assetDocumentValues = (0, $04b76def1942462e$export$e11a382d55e07f75)((ref = props.value) === null || ref === void 0 ? void 0 : ref.asset);
|
|
3857
|
+
const poll = (0, $658b60878501f8ec$export$fd270df25d7dbb88)(props.readOnly ? undefined : (assetDocumentValues === null || assetDocumentValues === void 0 ? void 0 : assetDocumentValues.value) || undefined);
|
|
3858
|
+
const [dialogState, setDialogState] = (0, $bcf12693a12c12c4$export$573903f1c655c034)();
|
|
3859
|
+
const error = secretDocumentValues.error || assetDocumentValues.error || poll.error /*||
|
|
3860
|
+
// @TODO move errored logic to Uploader, where handleRemoveVideo can be called
|
|
3861
|
+
(assetDocumentValues.value?.status === 'errored'
|
|
3862
|
+
? new Error(assetDocumentValues.value.data?.errors?.messages?.join(' '))
|
|
3863
|
+
: undefined)
|
|
3864
|
+
// */ ;
|
|
3865
|
+
if (error) // @TODO deal with it more gracefully
|
|
3866
|
+
throw error;
|
|
3867
|
+
const isLoading = secretDocumentValues.isLoading || assetDocumentValues.isLoading;
|
|
3868
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Fragment), {
|
|
3869
|
+
children: isLoading ? /*#__PURE__*/ (0, $lAnAG$jsx)((0, $c4f1ad5e2af7bb16$export$18fe723e8683ca03), {}) : /*#__PURE__*/ (0, $lAnAG$jsxs)((0, $lAnAG$Fragment), {
|
|
3870
|
+
children: [
|
|
3871
|
+
secretDocumentValues.value.needsSetup && !assetDocumentValues.value ? /*#__PURE__*/ (0, $lAnAG$jsx)((0, $430a7fbe93b73361$export$2e2bcd8739ae039), {
|
|
3872
|
+
setDialogState: setDialogState
|
|
3873
|
+
}) : /*#__PURE__*/ (0, $lAnAG$jsx)((0, $1e6f849e3fcd818c$export$2e2bcd8739ae039), (0, $lAnAG$swchelperssrc_object_spread_propsmjs)((0, $lAnAG$swchelperssrc_object_spreadmjs)({}, props), {
|
|
3874
|
+
client: client,
|
|
3875
|
+
secrets: secretDocumentValues.value.secrets,
|
|
3876
|
+
asset: assetDocumentValues.value,
|
|
3877
|
+
dialogState: dialogState,
|
|
3878
|
+
setDialogState: setDialogState,
|
|
3879
|
+
needsSetup: secretDocumentValues.value.needsSetup
|
|
3880
|
+
})),
|
|
3881
|
+
dialogState === "secrets" && /*#__PURE__*/ (0, $lAnAG$jsx)((0, $f56cae7201fafa6f$export$2e2bcd8739ae039), {
|
|
3882
|
+
setDialogState: setDialogState,
|
|
3883
|
+
secrets: secretDocumentValues.value.secrets
|
|
3884
|
+
})
|
|
3885
|
+
]
|
|
3886
|
+
})
|
|
3887
|
+
});
|
|
3888
|
+
};
|
|
3889
|
+
var $b33ab17c95965f41$export$2e2bcd8739ae039 = /*#__PURE__*/ (0, $lAnAG$memo)($b33ab17c95965f41$var$Input);
|
|
3890
|
+
|
|
3891
|
+
|
|
3892
|
+
|
|
3893
|
+
|
|
3894
|
+
|
|
3895
|
+
|
|
3896
|
+
|
|
3897
|
+
|
|
3898
|
+
const $1b4ce7c673943125$var$MuxVideoPreview = ({ value: value })=>{
|
|
3899
|
+
const assetDocumentValues = (0, $04b76def1942462e$export$e11a382d55e07f75)(value === null || value === void 0 ? void 0 : value.asset);
|
|
3900
|
+
if (assetDocumentValues.value) return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $6d61ace35324696d$export$bd4b73f15688a160), {
|
|
3901
|
+
asset: assetDocumentValues.value,
|
|
3902
|
+
width: 640
|
|
3903
|
+
});
|
|
3904
|
+
// @ts-expect-error
|
|
3905
|
+
const { filename: filename , playbackId: playbackId , status: status } = value !== null && value !== void 0 ? value : {};
|
|
3906
|
+
return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$SanityDefaultPreview), {
|
|
3907
|
+
title: filename || playbackId || "",
|
|
3908
|
+
subtitle: status ? `status: ${status}` : null
|
|
3909
|
+
});
|
|
3910
|
+
};
|
|
3911
|
+
var $1b4ce7c673943125$export$2e2bcd8739ae039 = $1b4ce7c673943125$var$MuxVideoPreview;
|
|
3912
|
+
|
|
256
3913
|
|
|
257
|
-
var $bhKR6 = parcelRequire("bhKR6");
|
|
258
3914
|
|
|
259
3915
|
|
|
260
|
-
const $
|
|
261
|
-
const $
|
|
262
|
-
name: $
|
|
3916
|
+
const $9a91a87f33c5ed01$export$a8ff84c12d48cfa6 = "mux.videoAsset";
|
|
3917
|
+
const $9a91a87f33c5ed01$var$videoAsset = (0, $lAnAG$defineField)({
|
|
3918
|
+
name: $9a91a87f33c5ed01$export$a8ff84c12d48cfa6,
|
|
263
3919
|
type: "object",
|
|
264
3920
|
title: "Video asset",
|
|
265
3921
|
fields: [
|
|
@@ -285,12 +3941,12 @@ const $f681eaa25394cd39$var$videoAsset = (0, $7XdDa$defineField)({
|
|
|
285
3941
|
},
|
|
286
3942
|
]
|
|
287
3943
|
});
|
|
288
|
-
var $
|
|
3944
|
+
var $9a91a87f33c5ed01$export$2e2bcd8739ae039 = $9a91a87f33c5ed01$var$videoAsset;
|
|
289
3945
|
|
|
290
3946
|
|
|
291
|
-
const $
|
|
292
|
-
const $
|
|
293
|
-
name: $
|
|
3947
|
+
const $86940ae5710607ea$export$a8ff84c12d48cfa6 = "mux.video";
|
|
3948
|
+
const $86940ae5710607ea$var$video = (0, $lAnAG$defineField)({
|
|
3949
|
+
name: $86940ae5710607ea$export$a8ff84c12d48cfa6,
|
|
294
3950
|
type: "object",
|
|
295
3951
|
title: "Video asset reference",
|
|
296
3952
|
fields: [
|
|
@@ -301,74 +3957,66 @@ const $f1b1fbcaa59b00cb$var$video = (0, $7XdDa$defineField)({
|
|
|
301
3957
|
weak: true,
|
|
302
3958
|
to: [
|
|
303
3959
|
{
|
|
304
|
-
type: (0, $
|
|
3960
|
+
type: (0, $9a91a87f33c5ed01$export$a8ff84c12d48cfa6)
|
|
305
3961
|
}
|
|
306
3962
|
]
|
|
307
3963
|
},
|
|
308
3964
|
]
|
|
309
3965
|
});
|
|
310
|
-
var $
|
|
3966
|
+
var $86940ae5710607ea$export$2e2bcd8739ae039 = $86940ae5710607ea$var$video;
|
|
311
3967
|
|
|
312
3968
|
|
|
313
3969
|
|
|
314
3970
|
|
|
315
3971
|
|
|
316
|
-
function $
|
|
317
|
-
|
|
3972
|
+
function $14740df9237d9771$export$c8119cbbd1c84da1(props) {
|
|
3973
|
+
var ref;
|
|
3974
|
+
return (0, $lAnAG$isObjectSchemaType)(props.schemaType) && ((ref = props.schemaType.type) === null || ref === void 0 ? void 0 : ref.name) === (0, $86940ae5710607ea$export$a8ff84c12d48cfa6);
|
|
318
3975
|
}
|
|
319
|
-
function $
|
|
320
|
-
|
|
3976
|
+
function $14740df9237d9771$export$3542974c36e4d83f(props) {
|
|
3977
|
+
var ref;
|
|
3978
|
+
return ((ref = props.schemaType.type) === null || ref === void 0 ? void 0 : ref.name) === (0, $86940ae5710607ea$export$a8ff84c12d48cfa6);
|
|
321
3979
|
}
|
|
322
3980
|
|
|
323
3981
|
|
|
324
|
-
|
|
325
|
-
const $357f50a17451fe9f$export$f5b8910cec6cf069 = /*#__PURE__*/ (0, $7XdDa$lazy)(()=>(parcelRequire("lHC3x")));
|
|
326
|
-
|
|
327
|
-
const $357f50a17451fe9f$export$133773870222880f = /*#__PURE__*/ (0, $7XdDa$lazy)(()=>(parcelRequire("23nr7")));
|
|
328
|
-
const $357f50a17451fe9f$export$f84bd70098573c5c = {
|
|
3982
|
+
const $e87f05e20e5b8474$export$f84bd70098573c5c = {
|
|
329
3983
|
mp4_support: "none"
|
|
330
3984
|
};
|
|
331
|
-
const $
|
|
332
|
-
const config = {
|
|
333
|
-
...$357f50a17451fe9f$export$f84bd70098573c5c,
|
|
334
|
-
...userConfig
|
|
335
|
-
};
|
|
3985
|
+
const $e87f05e20e5b8474$export$4d2e76c338bb9fbd = (0, $lAnAG$createPlugin)((userConfig)=>{
|
|
3986
|
+
const config = (0, $lAnAG$swchelperssrc_object_spreadmjs)({}, $e87f05e20e5b8474$export$f84bd70098573c5c, userConfig);
|
|
336
3987
|
return {
|
|
337
3988
|
name: "mux-input",
|
|
338
3989
|
form: {
|
|
339
3990
|
renderInput (props, next) {
|
|
340
|
-
if ((0, $
|
|
341
|
-
children: /*#__PURE__*/ (0, $
|
|
3991
|
+
if ((0, $14740df9237d9771$export$c8119cbbd1c84da1)(props)) return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $c4f1ad5e2af7bb16$export$f0c88bc5a320387d), {
|
|
3992
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $3e1e9b96ff4a93b5$export$2e2bcd8739ae039), {
|
|
342
3993
|
schemaType: props.schemaType,
|
|
343
|
-
children: /*#__PURE__*/ (0, $
|
|
344
|
-
fallback: /*#__PURE__*/ (0, $
|
|
345
|
-
children: /*#__PURE__*/ (0, $
|
|
346
|
-
config: config
|
|
347
|
-
|
|
348
|
-
})
|
|
3994
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $lAnAG$Suspense), {
|
|
3995
|
+
fallback: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $c4f1ad5e2af7bb16$export$18fe723e8683ca03), {}),
|
|
3996
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $b33ab17c95965f41$export$2e2bcd8739ae039), (0, $lAnAG$swchelperssrc_object_spreadmjs)({
|
|
3997
|
+
config: config
|
|
3998
|
+
}, props))
|
|
349
3999
|
})
|
|
350
4000
|
})
|
|
351
4001
|
});
|
|
352
4002
|
return next(props);
|
|
353
4003
|
},
|
|
354
4004
|
renderPreview (props, next) {
|
|
355
|
-
if ((0, $
|
|
356
|
-
children: /*#__PURE__*/ (0, $
|
|
357
|
-
...props
|
|
358
|
-
})
|
|
4005
|
+
if ((0, $14740df9237d9771$export$3542974c36e4d83f)(props)) return /*#__PURE__*/ (0, $lAnAG$jsx)((0, $c4f1ad5e2af7bb16$export$f0c88bc5a320387d), {
|
|
4006
|
+
children: /*#__PURE__*/ (0, $lAnAG$jsx)((0, $1b4ce7c673943125$export$2e2bcd8739ae039), (0, $lAnAG$swchelperssrc_object_spreadmjs)({}, props))
|
|
359
4007
|
});
|
|
360
4008
|
return next(props);
|
|
361
4009
|
}
|
|
362
4010
|
},
|
|
363
4011
|
schema: {
|
|
364
4012
|
types: [
|
|
365
|
-
(0, $
|
|
366
|
-
(0, $
|
|
4013
|
+
(0, $86940ae5710607ea$export$2e2bcd8739ae039),
|
|
4014
|
+
(0, $9a91a87f33c5ed01$export$2e2bcd8739ae039)
|
|
367
4015
|
]
|
|
368
4016
|
}
|
|
369
4017
|
};
|
|
370
4018
|
});
|
|
371
4019
|
|
|
372
4020
|
|
|
373
|
-
export {$
|
|
4021
|
+
export {$e87f05e20e5b8474$export$f84bd70098573c5c as defaultConfig, $e87f05e20e5b8474$export$4d2e76c338bb9fbd as muxInput, $b33ab17c95965f41$export$2e2bcd8739ae039 as Input, $1b4ce7c673943125$export$2e2bcd8739ae039 as Preview};
|
|
374
4022
|
//# sourceMappingURL=index.js.map
|