@remotion/renderer 4.0.195 → 4.0.196
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/ensure-browser.mjs +3931 -0
- package/package.json +10 -10
|
@@ -0,0 +1,3931 @@
|
|
|
1
|
+
import {createRequire} from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __require = createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/debug@4.3.4/node_modules/ms/index.js
|
|
22
|
+
var require_ms = __commonJS((exports, module) => {
|
|
23
|
+
var parse = function(str) {
|
|
24
|
+
str = String(str);
|
|
25
|
+
if (str.length > 100) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
29
|
+
if (!match) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var n = parseFloat(match[1]);
|
|
33
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
34
|
+
switch (type) {
|
|
35
|
+
case "years":
|
|
36
|
+
case "year":
|
|
37
|
+
case "yrs":
|
|
38
|
+
case "yr":
|
|
39
|
+
case "y":
|
|
40
|
+
return n * y;
|
|
41
|
+
case "weeks":
|
|
42
|
+
case "week":
|
|
43
|
+
case "w":
|
|
44
|
+
return n * w;
|
|
45
|
+
case "days":
|
|
46
|
+
case "day":
|
|
47
|
+
case "d":
|
|
48
|
+
return n * d;
|
|
49
|
+
case "hours":
|
|
50
|
+
case "hour":
|
|
51
|
+
case "hrs":
|
|
52
|
+
case "hr":
|
|
53
|
+
case "h":
|
|
54
|
+
return n * h;
|
|
55
|
+
case "minutes":
|
|
56
|
+
case "minute":
|
|
57
|
+
case "mins":
|
|
58
|
+
case "min":
|
|
59
|
+
case "m":
|
|
60
|
+
return n * m;
|
|
61
|
+
case "seconds":
|
|
62
|
+
case "second":
|
|
63
|
+
case "secs":
|
|
64
|
+
case "sec":
|
|
65
|
+
case "s":
|
|
66
|
+
return n * s;
|
|
67
|
+
case "milliseconds":
|
|
68
|
+
case "millisecond":
|
|
69
|
+
case "msecs":
|
|
70
|
+
case "msec":
|
|
71
|
+
case "ms":
|
|
72
|
+
return n;
|
|
73
|
+
default:
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var fmtShort = function(ms) {
|
|
78
|
+
var msAbs = Math.abs(ms);
|
|
79
|
+
if (msAbs >= d) {
|
|
80
|
+
return Math.round(ms / d) + "d";
|
|
81
|
+
}
|
|
82
|
+
if (msAbs >= h) {
|
|
83
|
+
return Math.round(ms / h) + "h";
|
|
84
|
+
}
|
|
85
|
+
if (msAbs >= m) {
|
|
86
|
+
return Math.round(ms / m) + "m";
|
|
87
|
+
}
|
|
88
|
+
if (msAbs >= s) {
|
|
89
|
+
return Math.round(ms / s) + "s";
|
|
90
|
+
}
|
|
91
|
+
return ms + "ms";
|
|
92
|
+
};
|
|
93
|
+
var fmtLong = function(ms) {
|
|
94
|
+
var msAbs = Math.abs(ms);
|
|
95
|
+
if (msAbs >= d) {
|
|
96
|
+
return plural(ms, msAbs, d, "day");
|
|
97
|
+
}
|
|
98
|
+
if (msAbs >= h) {
|
|
99
|
+
return plural(ms, msAbs, h, "hour");
|
|
100
|
+
}
|
|
101
|
+
if (msAbs >= m) {
|
|
102
|
+
return plural(ms, msAbs, m, "minute");
|
|
103
|
+
}
|
|
104
|
+
if (msAbs >= s) {
|
|
105
|
+
return plural(ms, msAbs, s, "second");
|
|
106
|
+
}
|
|
107
|
+
return ms + " ms";
|
|
108
|
+
};
|
|
109
|
+
var plural = function(ms, msAbs, n, name) {
|
|
110
|
+
var isPlural = msAbs >= n * 1.5;
|
|
111
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
112
|
+
};
|
|
113
|
+
var s = 1000;
|
|
114
|
+
var m = s * 60;
|
|
115
|
+
var h = m * 60;
|
|
116
|
+
var d = h * 24;
|
|
117
|
+
var w = d * 7;
|
|
118
|
+
var y = d * 365.25;
|
|
119
|
+
module.exports = function(val, options) {
|
|
120
|
+
options = options || {};
|
|
121
|
+
var type = typeof val;
|
|
122
|
+
if (type === "string" && val.length > 0) {
|
|
123
|
+
return parse(val);
|
|
124
|
+
} else if (type === "number" && isFinite(val)) {
|
|
125
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
126
|
+
}
|
|
127
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// ../../node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js
|
|
132
|
+
var require_common = __commonJS((exports, module) => {
|
|
133
|
+
var setup = function(env) {
|
|
134
|
+
createDebug.debug = createDebug;
|
|
135
|
+
createDebug.default = createDebug;
|
|
136
|
+
createDebug.coerce = coerce;
|
|
137
|
+
createDebug.disable = disable;
|
|
138
|
+
createDebug.enable = enable;
|
|
139
|
+
createDebug.enabled = enabled;
|
|
140
|
+
createDebug.humanize = require_ms();
|
|
141
|
+
createDebug.destroy = destroy;
|
|
142
|
+
Object.keys(env).forEach((key) => {
|
|
143
|
+
createDebug[key] = env[key];
|
|
144
|
+
});
|
|
145
|
+
createDebug.names = [];
|
|
146
|
+
createDebug.skips = [];
|
|
147
|
+
createDebug.formatters = {};
|
|
148
|
+
function selectColor(namespace) {
|
|
149
|
+
let hash = 0;
|
|
150
|
+
for (let i = 0;i < namespace.length; i++) {
|
|
151
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
152
|
+
hash |= 0;
|
|
153
|
+
}
|
|
154
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
155
|
+
}
|
|
156
|
+
createDebug.selectColor = selectColor;
|
|
157
|
+
function createDebug(namespace) {
|
|
158
|
+
let prevTime;
|
|
159
|
+
let enableOverride = null;
|
|
160
|
+
let namespacesCache;
|
|
161
|
+
let enabledCache;
|
|
162
|
+
function debug(...args) {
|
|
163
|
+
if (!debug.enabled) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const self = debug;
|
|
167
|
+
const curr = Number(new Date);
|
|
168
|
+
const ms = curr - (prevTime || curr);
|
|
169
|
+
self.diff = ms;
|
|
170
|
+
self.prev = prevTime;
|
|
171
|
+
self.curr = curr;
|
|
172
|
+
prevTime = curr;
|
|
173
|
+
args[0] = createDebug.coerce(args[0]);
|
|
174
|
+
if (typeof args[0] !== "string") {
|
|
175
|
+
args.unshift("%O");
|
|
176
|
+
}
|
|
177
|
+
let index = 0;
|
|
178
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
179
|
+
if (match === "%%") {
|
|
180
|
+
return "%";
|
|
181
|
+
}
|
|
182
|
+
index++;
|
|
183
|
+
const formatter = createDebug.formatters[format];
|
|
184
|
+
if (typeof formatter === "function") {
|
|
185
|
+
const val = args[index];
|
|
186
|
+
match = formatter.call(self, val);
|
|
187
|
+
args.splice(index, 1);
|
|
188
|
+
index--;
|
|
189
|
+
}
|
|
190
|
+
return match;
|
|
191
|
+
});
|
|
192
|
+
createDebug.formatArgs.call(self, args);
|
|
193
|
+
const logFn = self.log || createDebug.log;
|
|
194
|
+
logFn.apply(self, args);
|
|
195
|
+
}
|
|
196
|
+
debug.namespace = namespace;
|
|
197
|
+
debug.useColors = createDebug.useColors();
|
|
198
|
+
debug.color = createDebug.selectColor(namespace);
|
|
199
|
+
debug.extend = extend;
|
|
200
|
+
debug.destroy = createDebug.destroy;
|
|
201
|
+
Object.defineProperty(debug, "enabled", {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
configurable: false,
|
|
204
|
+
get: () => {
|
|
205
|
+
if (enableOverride !== null) {
|
|
206
|
+
return enableOverride;
|
|
207
|
+
}
|
|
208
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
209
|
+
namespacesCache = createDebug.namespaces;
|
|
210
|
+
enabledCache = createDebug.enabled(namespace);
|
|
211
|
+
}
|
|
212
|
+
return enabledCache;
|
|
213
|
+
},
|
|
214
|
+
set: (v) => {
|
|
215
|
+
enableOverride = v;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
if (typeof createDebug.init === "function") {
|
|
219
|
+
createDebug.init(debug);
|
|
220
|
+
}
|
|
221
|
+
return debug;
|
|
222
|
+
}
|
|
223
|
+
function extend(namespace, delimiter) {
|
|
224
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
225
|
+
newDebug.log = this.log;
|
|
226
|
+
return newDebug;
|
|
227
|
+
}
|
|
228
|
+
function enable(namespaces) {
|
|
229
|
+
createDebug.save(namespaces);
|
|
230
|
+
createDebug.namespaces = namespaces;
|
|
231
|
+
createDebug.names = [];
|
|
232
|
+
createDebug.skips = [];
|
|
233
|
+
let i;
|
|
234
|
+
const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
235
|
+
const len = split.length;
|
|
236
|
+
for (i = 0;i < len; i++) {
|
|
237
|
+
if (!split[i]) {
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
namespaces = split[i].replace(/\*/g, ".*?");
|
|
241
|
+
if (namespaces[0] === "-") {
|
|
242
|
+
createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
|
|
243
|
+
} else {
|
|
244
|
+
createDebug.names.push(new RegExp("^" + namespaces + "$"));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function disable() {
|
|
249
|
+
const namespaces = [
|
|
250
|
+
...createDebug.names.map(toNamespace),
|
|
251
|
+
...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
|
|
252
|
+
].join(",");
|
|
253
|
+
createDebug.enable("");
|
|
254
|
+
return namespaces;
|
|
255
|
+
}
|
|
256
|
+
function enabled(name) {
|
|
257
|
+
if (name[name.length - 1] === "*") {
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
let i;
|
|
261
|
+
let len;
|
|
262
|
+
for (i = 0, len = createDebug.skips.length;i < len; i++) {
|
|
263
|
+
if (createDebug.skips[i].test(name)) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
for (i = 0, len = createDebug.names.length;i < len; i++) {
|
|
268
|
+
if (createDebug.names[i].test(name)) {
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
function toNamespace(regexp) {
|
|
275
|
+
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
276
|
+
}
|
|
277
|
+
function coerce(val) {
|
|
278
|
+
if (val instanceof Error) {
|
|
279
|
+
return val.stack || val.message;
|
|
280
|
+
}
|
|
281
|
+
return val;
|
|
282
|
+
}
|
|
283
|
+
function destroy() {
|
|
284
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
285
|
+
}
|
|
286
|
+
createDebug.enable(createDebug.load());
|
|
287
|
+
return createDebug;
|
|
288
|
+
};
|
|
289
|
+
module.exports = setup;
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// ../../node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js
|
|
293
|
+
var require_browser = __commonJS((exports, module) => {
|
|
294
|
+
var useColors = function() {
|
|
295
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
302
|
+
};
|
|
303
|
+
var formatArgs = function(args) {
|
|
304
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + exports.humanize(this.diff);
|
|
305
|
+
if (!this.useColors) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const c = "color: " + this.color;
|
|
309
|
+
args.splice(1, 0, c, "color: inherit");
|
|
310
|
+
let index = 0;
|
|
311
|
+
let lastC = 0;
|
|
312
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
313
|
+
if (match === "%%") {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
index++;
|
|
317
|
+
if (match === "%c") {
|
|
318
|
+
lastC = index;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
args.splice(lastC, 0, c);
|
|
322
|
+
};
|
|
323
|
+
var save = function(namespaces) {
|
|
324
|
+
try {
|
|
325
|
+
if (namespaces) {
|
|
326
|
+
exports.storage.setItem("debug", namespaces);
|
|
327
|
+
} else {
|
|
328
|
+
exports.storage.removeItem("debug");
|
|
329
|
+
}
|
|
330
|
+
} catch (error) {
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
var load = function() {
|
|
334
|
+
let r;
|
|
335
|
+
try {
|
|
336
|
+
r = exports.storage.getItem("debug");
|
|
337
|
+
} catch (error) {
|
|
338
|
+
}
|
|
339
|
+
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
340
|
+
r = process.env.DEBUG;
|
|
341
|
+
}
|
|
342
|
+
return r;
|
|
343
|
+
};
|
|
344
|
+
var localstorage = function() {
|
|
345
|
+
try {
|
|
346
|
+
return localStorage;
|
|
347
|
+
} catch (error) {
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
exports.formatArgs = formatArgs;
|
|
351
|
+
exports.save = save;
|
|
352
|
+
exports.load = load;
|
|
353
|
+
exports.useColors = useColors;
|
|
354
|
+
exports.storage = localstorage();
|
|
355
|
+
exports.destroy = (() => {
|
|
356
|
+
let warned = false;
|
|
357
|
+
return () => {
|
|
358
|
+
if (!warned) {
|
|
359
|
+
warned = true;
|
|
360
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
})();
|
|
364
|
+
exports.colors = [
|
|
365
|
+
"#0000CC",
|
|
366
|
+
"#0000FF",
|
|
367
|
+
"#0033CC",
|
|
368
|
+
"#0033FF",
|
|
369
|
+
"#0066CC",
|
|
370
|
+
"#0066FF",
|
|
371
|
+
"#0099CC",
|
|
372
|
+
"#0099FF",
|
|
373
|
+
"#00CC00",
|
|
374
|
+
"#00CC33",
|
|
375
|
+
"#00CC66",
|
|
376
|
+
"#00CC99",
|
|
377
|
+
"#00CCCC",
|
|
378
|
+
"#00CCFF",
|
|
379
|
+
"#3300CC",
|
|
380
|
+
"#3300FF",
|
|
381
|
+
"#3333CC",
|
|
382
|
+
"#3333FF",
|
|
383
|
+
"#3366CC",
|
|
384
|
+
"#3366FF",
|
|
385
|
+
"#3399CC",
|
|
386
|
+
"#3399FF",
|
|
387
|
+
"#33CC00",
|
|
388
|
+
"#33CC33",
|
|
389
|
+
"#33CC66",
|
|
390
|
+
"#33CC99",
|
|
391
|
+
"#33CCCC",
|
|
392
|
+
"#33CCFF",
|
|
393
|
+
"#6600CC",
|
|
394
|
+
"#6600FF",
|
|
395
|
+
"#6633CC",
|
|
396
|
+
"#6633FF",
|
|
397
|
+
"#66CC00",
|
|
398
|
+
"#66CC33",
|
|
399
|
+
"#9900CC",
|
|
400
|
+
"#9900FF",
|
|
401
|
+
"#9933CC",
|
|
402
|
+
"#9933FF",
|
|
403
|
+
"#99CC00",
|
|
404
|
+
"#99CC33",
|
|
405
|
+
"#CC0000",
|
|
406
|
+
"#CC0033",
|
|
407
|
+
"#CC0066",
|
|
408
|
+
"#CC0099",
|
|
409
|
+
"#CC00CC",
|
|
410
|
+
"#CC00FF",
|
|
411
|
+
"#CC3300",
|
|
412
|
+
"#CC3333",
|
|
413
|
+
"#CC3366",
|
|
414
|
+
"#CC3399",
|
|
415
|
+
"#CC33CC",
|
|
416
|
+
"#CC33FF",
|
|
417
|
+
"#CC6600",
|
|
418
|
+
"#CC6633",
|
|
419
|
+
"#CC9900",
|
|
420
|
+
"#CC9933",
|
|
421
|
+
"#CCCC00",
|
|
422
|
+
"#CCCC33",
|
|
423
|
+
"#FF0000",
|
|
424
|
+
"#FF0033",
|
|
425
|
+
"#FF0066",
|
|
426
|
+
"#FF0099",
|
|
427
|
+
"#FF00CC",
|
|
428
|
+
"#FF00FF",
|
|
429
|
+
"#FF3300",
|
|
430
|
+
"#FF3333",
|
|
431
|
+
"#FF3366",
|
|
432
|
+
"#FF3399",
|
|
433
|
+
"#FF33CC",
|
|
434
|
+
"#FF33FF",
|
|
435
|
+
"#FF6600",
|
|
436
|
+
"#FF6633",
|
|
437
|
+
"#FF9900",
|
|
438
|
+
"#FF9933",
|
|
439
|
+
"#FFCC00",
|
|
440
|
+
"#FFCC33"
|
|
441
|
+
];
|
|
442
|
+
exports.log = console.debug || console.log || (() => {
|
|
443
|
+
});
|
|
444
|
+
module.exports = require_common()(exports);
|
|
445
|
+
var { formatters } = module.exports;
|
|
446
|
+
formatters.j = function(v) {
|
|
447
|
+
try {
|
|
448
|
+
return JSON.stringify(v);
|
|
449
|
+
} catch (error) {
|
|
450
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/supports-color@7.2.0/node_modules/has-flag/index.js
|
|
456
|
+
var require_has_flag = __commonJS((exports, module) => {
|
|
457
|
+
module.exports = (flag, argv = process.argv) => {
|
|
458
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
459
|
+
const position = argv.indexOf(prefix + flag);
|
|
460
|
+
const terminatorPosition = argv.indexOf("--");
|
|
461
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
462
|
+
};
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/node_modules/supports-color/index.js
|
|
466
|
+
var require_supports_color = __commonJS((exports, module) => {
|
|
467
|
+
var translateLevel = function(level) {
|
|
468
|
+
if (level === 0) {
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
level,
|
|
473
|
+
hasBasic: true,
|
|
474
|
+
has256: level >= 2,
|
|
475
|
+
has16m: level >= 3
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
var supportsColor = function(haveStream, streamIsTTY) {
|
|
479
|
+
if (forceColor === 0) {
|
|
480
|
+
return 0;
|
|
481
|
+
}
|
|
482
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
483
|
+
return 3;
|
|
484
|
+
}
|
|
485
|
+
if (hasFlag("color=256")) {
|
|
486
|
+
return 2;
|
|
487
|
+
}
|
|
488
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
489
|
+
return 0;
|
|
490
|
+
}
|
|
491
|
+
const min = forceColor || 0;
|
|
492
|
+
if (env.TERM === "dumb") {
|
|
493
|
+
return min;
|
|
494
|
+
}
|
|
495
|
+
if (process.platform === "win32") {
|
|
496
|
+
const osRelease = os.release().split(".");
|
|
497
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
498
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
499
|
+
}
|
|
500
|
+
return 1;
|
|
501
|
+
}
|
|
502
|
+
if ("CI" in env) {
|
|
503
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
504
|
+
return 1;
|
|
505
|
+
}
|
|
506
|
+
return min;
|
|
507
|
+
}
|
|
508
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
509
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
510
|
+
}
|
|
511
|
+
if (env.COLORTERM === "truecolor") {
|
|
512
|
+
return 3;
|
|
513
|
+
}
|
|
514
|
+
if ("TERM_PROGRAM" in env) {
|
|
515
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
516
|
+
switch (env.TERM_PROGRAM) {
|
|
517
|
+
case "iTerm.app":
|
|
518
|
+
return version >= 3 ? 3 : 2;
|
|
519
|
+
case "Apple_Terminal":
|
|
520
|
+
return 2;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
524
|
+
return 2;
|
|
525
|
+
}
|
|
526
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
527
|
+
return 1;
|
|
528
|
+
}
|
|
529
|
+
if ("COLORTERM" in env) {
|
|
530
|
+
return 1;
|
|
531
|
+
}
|
|
532
|
+
return min;
|
|
533
|
+
};
|
|
534
|
+
var getSupportLevel = function(stream) {
|
|
535
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
536
|
+
return translateLevel(level);
|
|
537
|
+
};
|
|
538
|
+
var os = __require("os");
|
|
539
|
+
var tty = __require("tty");
|
|
540
|
+
var hasFlag = require_has_flag();
|
|
541
|
+
var { env } = process;
|
|
542
|
+
var forceColor;
|
|
543
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
544
|
+
forceColor = 0;
|
|
545
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
546
|
+
forceColor = 1;
|
|
547
|
+
}
|
|
548
|
+
if ("FORCE_COLOR" in env) {
|
|
549
|
+
if (env.FORCE_COLOR === "true") {
|
|
550
|
+
forceColor = 1;
|
|
551
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
552
|
+
forceColor = 0;
|
|
553
|
+
} else {
|
|
554
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
module.exports = {
|
|
558
|
+
supportsColor: getSupportLevel,
|
|
559
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
560
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
561
|
+
};
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
// ../../node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js
|
|
565
|
+
var require_node = __commonJS((exports, module) => {
|
|
566
|
+
var useColors = function() {
|
|
567
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
568
|
+
};
|
|
569
|
+
var formatArgs = function(args) {
|
|
570
|
+
const { namespace: name, useColors: useColors2 } = this;
|
|
571
|
+
if (useColors2) {
|
|
572
|
+
const c = this.color;
|
|
573
|
+
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
574
|
+
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
575
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
576
|
+
args.push(colorCode + "m+" + exports.humanize(this.diff) + "\x1B[0m");
|
|
577
|
+
} else {
|
|
578
|
+
args[0] = getDate() + name + " " + args[0];
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
var getDate = function() {
|
|
582
|
+
if (exports.inspectOpts.hideDate) {
|
|
583
|
+
return "";
|
|
584
|
+
}
|
|
585
|
+
return new Date().toISOString() + " ";
|
|
586
|
+
};
|
|
587
|
+
var log = function(...args) {
|
|
588
|
+
return process.stderr.write(util.format(...args) + "\n");
|
|
589
|
+
};
|
|
590
|
+
var save = function(namespaces) {
|
|
591
|
+
if (namespaces) {
|
|
592
|
+
process.env.DEBUG = namespaces;
|
|
593
|
+
} else {
|
|
594
|
+
delete process.env.DEBUG;
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
var load = function() {
|
|
598
|
+
return process.env.DEBUG;
|
|
599
|
+
};
|
|
600
|
+
var init = function(debug) {
|
|
601
|
+
debug.inspectOpts = {};
|
|
602
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
603
|
+
for (let i = 0;i < keys.length; i++) {
|
|
604
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
var tty = __require("tty");
|
|
608
|
+
var util = __require("util");
|
|
609
|
+
exports.init = init;
|
|
610
|
+
exports.log = log;
|
|
611
|
+
exports.formatArgs = formatArgs;
|
|
612
|
+
exports.save = save;
|
|
613
|
+
exports.load = load;
|
|
614
|
+
exports.useColors = useColors;
|
|
615
|
+
exports.destroy = util.deprecate(() => {
|
|
616
|
+
}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
617
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
618
|
+
try {
|
|
619
|
+
const supportsColor = require_supports_color();
|
|
620
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
621
|
+
exports.colors = [
|
|
622
|
+
20,
|
|
623
|
+
21,
|
|
624
|
+
26,
|
|
625
|
+
27,
|
|
626
|
+
32,
|
|
627
|
+
33,
|
|
628
|
+
38,
|
|
629
|
+
39,
|
|
630
|
+
40,
|
|
631
|
+
41,
|
|
632
|
+
42,
|
|
633
|
+
43,
|
|
634
|
+
44,
|
|
635
|
+
45,
|
|
636
|
+
56,
|
|
637
|
+
57,
|
|
638
|
+
62,
|
|
639
|
+
63,
|
|
640
|
+
68,
|
|
641
|
+
69,
|
|
642
|
+
74,
|
|
643
|
+
75,
|
|
644
|
+
76,
|
|
645
|
+
77,
|
|
646
|
+
78,
|
|
647
|
+
79,
|
|
648
|
+
80,
|
|
649
|
+
81,
|
|
650
|
+
92,
|
|
651
|
+
93,
|
|
652
|
+
98,
|
|
653
|
+
99,
|
|
654
|
+
112,
|
|
655
|
+
113,
|
|
656
|
+
128,
|
|
657
|
+
129,
|
|
658
|
+
134,
|
|
659
|
+
135,
|
|
660
|
+
148,
|
|
661
|
+
149,
|
|
662
|
+
160,
|
|
663
|
+
161,
|
|
664
|
+
162,
|
|
665
|
+
163,
|
|
666
|
+
164,
|
|
667
|
+
165,
|
|
668
|
+
166,
|
|
669
|
+
167,
|
|
670
|
+
168,
|
|
671
|
+
169,
|
|
672
|
+
170,
|
|
673
|
+
171,
|
|
674
|
+
172,
|
|
675
|
+
173,
|
|
676
|
+
178,
|
|
677
|
+
179,
|
|
678
|
+
184,
|
|
679
|
+
185,
|
|
680
|
+
196,
|
|
681
|
+
197,
|
|
682
|
+
198,
|
|
683
|
+
199,
|
|
684
|
+
200,
|
|
685
|
+
201,
|
|
686
|
+
202,
|
|
687
|
+
203,
|
|
688
|
+
204,
|
|
689
|
+
205,
|
|
690
|
+
206,
|
|
691
|
+
207,
|
|
692
|
+
208,
|
|
693
|
+
209,
|
|
694
|
+
214,
|
|
695
|
+
215,
|
|
696
|
+
220,
|
|
697
|
+
221
|
|
698
|
+
];
|
|
699
|
+
}
|
|
700
|
+
} catch (error) {
|
|
701
|
+
}
|
|
702
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
703
|
+
return /^debug_/i.test(key);
|
|
704
|
+
}).reduce((obj, key) => {
|
|
705
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
706
|
+
return k.toUpperCase();
|
|
707
|
+
});
|
|
708
|
+
let val = process.env[key];
|
|
709
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
710
|
+
val = true;
|
|
711
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
712
|
+
val = false;
|
|
713
|
+
} else if (val === "null") {
|
|
714
|
+
val = null;
|
|
715
|
+
} else {
|
|
716
|
+
val = Number(val);
|
|
717
|
+
}
|
|
718
|
+
obj[prop] = val;
|
|
719
|
+
return obj;
|
|
720
|
+
}, {});
|
|
721
|
+
module.exports = require_common()(exports);
|
|
722
|
+
var { formatters } = module.exports;
|
|
723
|
+
formatters.o = function(v) {
|
|
724
|
+
this.inspectOpts.colors = this.useColors;
|
|
725
|
+
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
726
|
+
};
|
|
727
|
+
formatters.O = function(v) {
|
|
728
|
+
this.inspectOpts.colors = this.useColors;
|
|
729
|
+
return util.inspect(v, this.inspectOpts);
|
|
730
|
+
};
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/extract-zip@2.0.1/node_modules/debug/src/index.js
|
|
734
|
+
var require_src = __commonJS((exports, module) => {
|
|
735
|
+
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
736
|
+
module.exports = require_browser();
|
|
737
|
+
} else {
|
|
738
|
+
module.exports = require_node();
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/once@1.4.0/node_modules/wrappy/wrappy.js
|
|
743
|
+
var require_wrappy = __commonJS((exports, module) => {
|
|
744
|
+
var wrappy = function(fn, cb) {
|
|
745
|
+
if (fn && cb)
|
|
746
|
+
return wrappy(fn)(cb);
|
|
747
|
+
if (typeof fn !== "function")
|
|
748
|
+
throw new TypeError("need wrapper function");
|
|
749
|
+
Object.keys(fn).forEach(function(k) {
|
|
750
|
+
wrapper[k] = fn[k];
|
|
751
|
+
});
|
|
752
|
+
return wrapper;
|
|
753
|
+
function wrapper() {
|
|
754
|
+
var args = new Array(arguments.length);
|
|
755
|
+
for (var i = 0;i < args.length; i++) {
|
|
756
|
+
args[i] = arguments[i];
|
|
757
|
+
}
|
|
758
|
+
var ret = fn.apply(this, args);
|
|
759
|
+
var cb2 = args[args.length - 1];
|
|
760
|
+
if (typeof ret === "function" && ret !== cb2) {
|
|
761
|
+
Object.keys(cb2).forEach(function(k) {
|
|
762
|
+
ret[k] = cb2[k];
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
return ret;
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
module.exports = wrappy;
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/pump@3.0.0/node_modules/once/once.js
|
|
772
|
+
var require_once = __commonJS((exports, module) => {
|
|
773
|
+
var once = function(fn) {
|
|
774
|
+
var f = function() {
|
|
775
|
+
if (f.called)
|
|
776
|
+
return f.value;
|
|
777
|
+
f.called = true;
|
|
778
|
+
return f.value = fn.apply(this, arguments);
|
|
779
|
+
};
|
|
780
|
+
f.called = false;
|
|
781
|
+
return f;
|
|
782
|
+
};
|
|
783
|
+
var onceStrict = function(fn) {
|
|
784
|
+
var f = function() {
|
|
785
|
+
if (f.called)
|
|
786
|
+
throw new Error(f.onceError);
|
|
787
|
+
f.called = true;
|
|
788
|
+
return f.value = fn.apply(this, arguments);
|
|
789
|
+
};
|
|
790
|
+
var name = fn.name || "Function wrapped with `once`";
|
|
791
|
+
f.onceError = name + " shouldn't be called more than once";
|
|
792
|
+
f.called = false;
|
|
793
|
+
return f;
|
|
794
|
+
};
|
|
795
|
+
var wrappy = require_wrappy();
|
|
796
|
+
module.exports = wrappy(once);
|
|
797
|
+
module.exports.strict = wrappy(onceStrict);
|
|
798
|
+
once.proto = once(function() {
|
|
799
|
+
Object.defineProperty(Function.prototype, "once", {
|
|
800
|
+
value: function() {
|
|
801
|
+
return once(this);
|
|
802
|
+
},
|
|
803
|
+
configurable: true
|
|
804
|
+
});
|
|
805
|
+
Object.defineProperty(Function.prototype, "onceStrict", {
|
|
806
|
+
value: function() {
|
|
807
|
+
return onceStrict(this);
|
|
808
|
+
},
|
|
809
|
+
configurable: true
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/pump@3.0.0/node_modules/end-of-stream/index.js
|
|
815
|
+
var require_end_of_stream = __commonJS((exports, module) => {
|
|
816
|
+
var once = require_once();
|
|
817
|
+
var noop = function() {
|
|
818
|
+
};
|
|
819
|
+
var isRequest = function(stream) {
|
|
820
|
+
return stream.setHeader && typeof stream.abort === "function";
|
|
821
|
+
};
|
|
822
|
+
var isChildProcess = function(stream) {
|
|
823
|
+
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
|
|
824
|
+
};
|
|
825
|
+
var eos = function(stream, opts, callback) {
|
|
826
|
+
if (typeof opts === "function")
|
|
827
|
+
return eos(stream, null, opts);
|
|
828
|
+
if (!opts)
|
|
829
|
+
opts = {};
|
|
830
|
+
callback = once(callback || noop);
|
|
831
|
+
var ws = stream._writableState;
|
|
832
|
+
var rs = stream._readableState;
|
|
833
|
+
var readable = opts.readable || opts.readable !== false && stream.readable;
|
|
834
|
+
var writable = opts.writable || opts.writable !== false && stream.writable;
|
|
835
|
+
var cancelled = false;
|
|
836
|
+
var onlegacyfinish = function() {
|
|
837
|
+
if (!stream.writable)
|
|
838
|
+
onfinish();
|
|
839
|
+
};
|
|
840
|
+
var onfinish = function() {
|
|
841
|
+
writable = false;
|
|
842
|
+
if (!readable)
|
|
843
|
+
callback.call(stream);
|
|
844
|
+
};
|
|
845
|
+
var onend = function() {
|
|
846
|
+
readable = false;
|
|
847
|
+
if (!writable)
|
|
848
|
+
callback.call(stream);
|
|
849
|
+
};
|
|
850
|
+
var onexit = function(exitCode) {
|
|
851
|
+
callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
|
|
852
|
+
};
|
|
853
|
+
var onerror = function(err) {
|
|
854
|
+
callback.call(stream, err);
|
|
855
|
+
};
|
|
856
|
+
var onclose = function() {
|
|
857
|
+
process.nextTick(onclosenexttick);
|
|
858
|
+
};
|
|
859
|
+
var onclosenexttick = function() {
|
|
860
|
+
if (cancelled)
|
|
861
|
+
return;
|
|
862
|
+
if (readable && !(rs && (rs.ended && !rs.destroyed)))
|
|
863
|
+
return callback.call(stream, new Error("premature close"));
|
|
864
|
+
if (writable && !(ws && (ws.ended && !ws.destroyed)))
|
|
865
|
+
return callback.call(stream, new Error("premature close"));
|
|
866
|
+
};
|
|
867
|
+
var onrequest = function() {
|
|
868
|
+
stream.req.on("finish", onfinish);
|
|
869
|
+
};
|
|
870
|
+
if (isRequest(stream)) {
|
|
871
|
+
stream.on("complete", onfinish);
|
|
872
|
+
stream.on("abort", onclose);
|
|
873
|
+
if (stream.req)
|
|
874
|
+
onrequest();
|
|
875
|
+
else
|
|
876
|
+
stream.on("request", onrequest);
|
|
877
|
+
} else if (writable && !ws) {
|
|
878
|
+
stream.on("end", onlegacyfinish);
|
|
879
|
+
stream.on("close", onlegacyfinish);
|
|
880
|
+
}
|
|
881
|
+
if (isChildProcess(stream))
|
|
882
|
+
stream.on("exit", onexit);
|
|
883
|
+
stream.on("end", onend);
|
|
884
|
+
stream.on("finish", onfinish);
|
|
885
|
+
if (opts.error !== false)
|
|
886
|
+
stream.on("error", onerror);
|
|
887
|
+
stream.on("close", onclose);
|
|
888
|
+
return function() {
|
|
889
|
+
cancelled = true;
|
|
890
|
+
stream.removeListener("complete", onfinish);
|
|
891
|
+
stream.removeListener("abort", onclose);
|
|
892
|
+
stream.removeListener("request", onrequest);
|
|
893
|
+
if (stream.req)
|
|
894
|
+
stream.req.removeListener("finish", onfinish);
|
|
895
|
+
stream.removeListener("end", onlegacyfinish);
|
|
896
|
+
stream.removeListener("close", onlegacyfinish);
|
|
897
|
+
stream.removeListener("finish", onfinish);
|
|
898
|
+
stream.removeListener("exit", onexit);
|
|
899
|
+
stream.removeListener("end", onend);
|
|
900
|
+
stream.removeListener("error", onerror);
|
|
901
|
+
stream.removeListener("close", onclose);
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
module.exports = eos;
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/get-stream@5.2.0/node_modules/pump/index.js
|
|
908
|
+
var require_pump = __commonJS((exports, module) => {
|
|
909
|
+
var once = require_once();
|
|
910
|
+
var eos = require_end_of_stream();
|
|
911
|
+
var fs = __require("fs");
|
|
912
|
+
var noop = function() {
|
|
913
|
+
};
|
|
914
|
+
var ancient = /^v?\.0/.test(process.version);
|
|
915
|
+
var isFn = function(fn) {
|
|
916
|
+
return typeof fn === "function";
|
|
917
|
+
};
|
|
918
|
+
var isFS = function(stream) {
|
|
919
|
+
if (!ancient)
|
|
920
|
+
return false;
|
|
921
|
+
if (!fs)
|
|
922
|
+
return false;
|
|
923
|
+
return (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close);
|
|
924
|
+
};
|
|
925
|
+
var isRequest = function(stream) {
|
|
926
|
+
return stream.setHeader && isFn(stream.abort);
|
|
927
|
+
};
|
|
928
|
+
var destroyer = function(stream, reading, writing, callback) {
|
|
929
|
+
callback = once(callback);
|
|
930
|
+
var closed = false;
|
|
931
|
+
stream.on("close", function() {
|
|
932
|
+
closed = true;
|
|
933
|
+
});
|
|
934
|
+
eos(stream, { readable: reading, writable: writing }, function(err) {
|
|
935
|
+
if (err)
|
|
936
|
+
return callback(err);
|
|
937
|
+
closed = true;
|
|
938
|
+
callback();
|
|
939
|
+
});
|
|
940
|
+
var destroyed = false;
|
|
941
|
+
return function(err) {
|
|
942
|
+
if (closed)
|
|
943
|
+
return;
|
|
944
|
+
if (destroyed)
|
|
945
|
+
return;
|
|
946
|
+
destroyed = true;
|
|
947
|
+
if (isFS(stream))
|
|
948
|
+
return stream.close(noop);
|
|
949
|
+
if (isRequest(stream))
|
|
950
|
+
return stream.abort();
|
|
951
|
+
if (isFn(stream.destroy))
|
|
952
|
+
return stream.destroy();
|
|
953
|
+
callback(err || new Error("stream was destroyed"));
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
var call = function(fn) {
|
|
957
|
+
fn();
|
|
958
|
+
};
|
|
959
|
+
var pipe = function(from, to) {
|
|
960
|
+
return from.pipe(to);
|
|
961
|
+
};
|
|
962
|
+
var pump = function() {
|
|
963
|
+
var streams = Array.prototype.slice.call(arguments);
|
|
964
|
+
var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop;
|
|
965
|
+
if (Array.isArray(streams[0]))
|
|
966
|
+
streams = streams[0];
|
|
967
|
+
if (streams.length < 2)
|
|
968
|
+
throw new Error("pump requires two streams per minimum");
|
|
969
|
+
var error;
|
|
970
|
+
var destroys = streams.map(function(stream, i) {
|
|
971
|
+
var reading = i < streams.length - 1;
|
|
972
|
+
var writing = i > 0;
|
|
973
|
+
return destroyer(stream, reading, writing, function(err) {
|
|
974
|
+
if (!error)
|
|
975
|
+
error = err;
|
|
976
|
+
if (err)
|
|
977
|
+
destroys.forEach(call);
|
|
978
|
+
if (reading)
|
|
979
|
+
return;
|
|
980
|
+
destroys.forEach(call);
|
|
981
|
+
callback(error);
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
return streams.reduce(pipe);
|
|
985
|
+
};
|
|
986
|
+
module.exports = pump;
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
// ../../node_modules/.pnpm/get-stream@5.2.0/node_modules/get-stream/buffer-stream.js
|
|
990
|
+
var require_buffer_stream = __commonJS((exports, module) => {
|
|
991
|
+
var { PassThrough: PassThroughStream } = __require("stream");
|
|
992
|
+
module.exports = (options) => {
|
|
993
|
+
options = { ...options };
|
|
994
|
+
const { array } = options;
|
|
995
|
+
let { encoding } = options;
|
|
996
|
+
const isBuffer = encoding === "buffer";
|
|
997
|
+
let objectMode = false;
|
|
998
|
+
if (array) {
|
|
999
|
+
objectMode = !(encoding || isBuffer);
|
|
1000
|
+
} else {
|
|
1001
|
+
encoding = encoding || "utf8";
|
|
1002
|
+
}
|
|
1003
|
+
if (isBuffer) {
|
|
1004
|
+
encoding = null;
|
|
1005
|
+
}
|
|
1006
|
+
const stream = new PassThroughStream({ objectMode });
|
|
1007
|
+
if (encoding) {
|
|
1008
|
+
stream.setEncoding(encoding);
|
|
1009
|
+
}
|
|
1010
|
+
let length = 0;
|
|
1011
|
+
const chunks = [];
|
|
1012
|
+
stream.on("data", (chunk) => {
|
|
1013
|
+
chunks.push(chunk);
|
|
1014
|
+
if (objectMode) {
|
|
1015
|
+
length = chunks.length;
|
|
1016
|
+
} else {
|
|
1017
|
+
length += chunk.length;
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
stream.getBufferedValue = () => {
|
|
1021
|
+
if (array) {
|
|
1022
|
+
return chunks;
|
|
1023
|
+
}
|
|
1024
|
+
return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
|
|
1025
|
+
};
|
|
1026
|
+
stream.getBufferedLength = () => length;
|
|
1027
|
+
return stream;
|
|
1028
|
+
};
|
|
1029
|
+
});
|
|
1030
|
+
|
|
1031
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/extract-zip@2.0.1/node_modules/get-stream/index.js
|
|
1032
|
+
var require_get_stream = __commonJS((exports, module) => {
|
|
1033
|
+
async function getStream(inputStream, options) {
|
|
1034
|
+
if (!inputStream) {
|
|
1035
|
+
return Promise.reject(new Error("Expected a stream"));
|
|
1036
|
+
}
|
|
1037
|
+
options = {
|
|
1038
|
+
maxBuffer: Infinity,
|
|
1039
|
+
...options
|
|
1040
|
+
};
|
|
1041
|
+
const { maxBuffer } = options;
|
|
1042
|
+
let stream;
|
|
1043
|
+
await new Promise((resolve, reject) => {
|
|
1044
|
+
const rejectPromise = (error) => {
|
|
1045
|
+
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
1046
|
+
error.bufferedData = stream.getBufferedValue();
|
|
1047
|
+
}
|
|
1048
|
+
reject(error);
|
|
1049
|
+
};
|
|
1050
|
+
stream = pump(inputStream, bufferStream(options), (error) => {
|
|
1051
|
+
if (error) {
|
|
1052
|
+
rejectPromise(error);
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
resolve();
|
|
1056
|
+
});
|
|
1057
|
+
stream.on("data", () => {
|
|
1058
|
+
if (stream.getBufferedLength() > maxBuffer) {
|
|
1059
|
+
rejectPromise(new MaxBufferError);
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
});
|
|
1063
|
+
return stream.getBufferedValue();
|
|
1064
|
+
}
|
|
1065
|
+
var { constants: BufferConstants } = __require("buffer");
|
|
1066
|
+
var pump = require_pump();
|
|
1067
|
+
var bufferStream = require_buffer_stream();
|
|
1068
|
+
|
|
1069
|
+
class MaxBufferError extends Error {
|
|
1070
|
+
constructor() {
|
|
1071
|
+
super("maxBuffer exceeded");
|
|
1072
|
+
this.name = "MaxBufferError";
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
module.exports = getStream;
|
|
1076
|
+
module.exports.default = getStream;
|
|
1077
|
+
module.exports.buffer = (stream, options) => getStream(stream, { ...options, encoding: "buffer" });
|
|
1078
|
+
module.exports.array = (stream, options) => getStream(stream, { ...options, array: true });
|
|
1079
|
+
module.exports.MaxBufferError = MaxBufferError;
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/fd-slicer@1.1.0/node_modules/pend/index.js
|
|
1083
|
+
var require_pend = __commonJS((exports, module) => {
|
|
1084
|
+
var Pend = function() {
|
|
1085
|
+
this.pending = 0;
|
|
1086
|
+
this.max = Infinity;
|
|
1087
|
+
this.listeners = [];
|
|
1088
|
+
this.waiting = [];
|
|
1089
|
+
this.error = null;
|
|
1090
|
+
};
|
|
1091
|
+
var pendHold = function(self) {
|
|
1092
|
+
self.pending += 1;
|
|
1093
|
+
var called = false;
|
|
1094
|
+
return onCb;
|
|
1095
|
+
function onCb(err) {
|
|
1096
|
+
if (called)
|
|
1097
|
+
throw new Error("callback called twice");
|
|
1098
|
+
called = true;
|
|
1099
|
+
self.error = self.error || err;
|
|
1100
|
+
self.pending -= 1;
|
|
1101
|
+
if (self.waiting.length > 0 && self.pending < self.max) {
|
|
1102
|
+
pendGo(self, self.waiting.shift());
|
|
1103
|
+
} else if (self.pending === 0) {
|
|
1104
|
+
var listeners = self.listeners;
|
|
1105
|
+
self.listeners = [];
|
|
1106
|
+
listeners.forEach(cbListener);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
function cbListener(listener) {
|
|
1110
|
+
listener(self.error);
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
var pendGo = function(self, fn) {
|
|
1114
|
+
fn(pendHold(self));
|
|
1115
|
+
};
|
|
1116
|
+
module.exports = Pend;
|
|
1117
|
+
Pend.prototype.go = function(fn) {
|
|
1118
|
+
if (this.pending < this.max) {
|
|
1119
|
+
pendGo(this, fn);
|
|
1120
|
+
} else {
|
|
1121
|
+
this.waiting.push(fn);
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
Pend.prototype.wait = function(cb) {
|
|
1125
|
+
if (this.pending === 0) {
|
|
1126
|
+
cb(this.error);
|
|
1127
|
+
} else {
|
|
1128
|
+
this.listeners.push(cb);
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
Pend.prototype.hold = function() {
|
|
1132
|
+
return pendHold(this);
|
|
1133
|
+
};
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/yauzl@2.10.0/node_modules/fd-slicer/index.js
|
|
1137
|
+
var require_fd_slicer = __commonJS((exports) => {
|
|
1138
|
+
var FdSlicer = function(fd, options) {
|
|
1139
|
+
options = options || {};
|
|
1140
|
+
EventEmitter.call(this);
|
|
1141
|
+
this.fd = fd;
|
|
1142
|
+
this.pend = new Pend;
|
|
1143
|
+
this.pend.max = 1;
|
|
1144
|
+
this.refCount = 0;
|
|
1145
|
+
this.autoClose = !!options.autoClose;
|
|
1146
|
+
};
|
|
1147
|
+
var ReadStream = function(context, options) {
|
|
1148
|
+
options = options || {};
|
|
1149
|
+
Readable.call(this, options);
|
|
1150
|
+
this.context = context;
|
|
1151
|
+
this.context.ref();
|
|
1152
|
+
this.start = options.start || 0;
|
|
1153
|
+
this.endOffset = options.end;
|
|
1154
|
+
this.pos = this.start;
|
|
1155
|
+
this.destroyed = false;
|
|
1156
|
+
};
|
|
1157
|
+
var WriteStream = function(context, options) {
|
|
1158
|
+
options = options || {};
|
|
1159
|
+
Writable.call(this, options);
|
|
1160
|
+
this.context = context;
|
|
1161
|
+
this.context.ref();
|
|
1162
|
+
this.start = options.start || 0;
|
|
1163
|
+
this.endOffset = options.end == null ? Infinity : +options.end;
|
|
1164
|
+
this.bytesWritten = 0;
|
|
1165
|
+
this.pos = this.start;
|
|
1166
|
+
this.destroyed = false;
|
|
1167
|
+
this.on("finish", this.destroy.bind(this));
|
|
1168
|
+
};
|
|
1169
|
+
var BufferSlicer = function(buffer, options) {
|
|
1170
|
+
EventEmitter.call(this);
|
|
1171
|
+
options = options || {};
|
|
1172
|
+
this.refCount = 0;
|
|
1173
|
+
this.buffer = buffer;
|
|
1174
|
+
this.maxChunkSize = options.maxChunkSize || Number.MAX_SAFE_INTEGER;
|
|
1175
|
+
};
|
|
1176
|
+
var createFromBuffer = function(buffer, options) {
|
|
1177
|
+
return new BufferSlicer(buffer, options);
|
|
1178
|
+
};
|
|
1179
|
+
var createFromFd = function(fd, options) {
|
|
1180
|
+
return new FdSlicer(fd, options);
|
|
1181
|
+
};
|
|
1182
|
+
var fs = __require("fs");
|
|
1183
|
+
var util = __require("util");
|
|
1184
|
+
var stream = __require("stream");
|
|
1185
|
+
var Readable = stream.Readable;
|
|
1186
|
+
var Writable = stream.Writable;
|
|
1187
|
+
var PassThrough = stream.PassThrough;
|
|
1188
|
+
var Pend = require_pend();
|
|
1189
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
1190
|
+
exports.createFromBuffer = createFromBuffer;
|
|
1191
|
+
exports.createFromFd = createFromFd;
|
|
1192
|
+
exports.BufferSlicer = BufferSlicer;
|
|
1193
|
+
exports.FdSlicer = FdSlicer;
|
|
1194
|
+
util.inherits(FdSlicer, EventEmitter);
|
|
1195
|
+
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
1196
|
+
var self = this;
|
|
1197
|
+
self.pend.go(function(cb) {
|
|
1198
|
+
fs.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
1199
|
+
cb();
|
|
1200
|
+
callback(err, bytesRead, buffer2);
|
|
1201
|
+
});
|
|
1202
|
+
});
|
|
1203
|
+
};
|
|
1204
|
+
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
1205
|
+
var self = this;
|
|
1206
|
+
self.pend.go(function(cb) {
|
|
1207
|
+
fs.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
|
|
1208
|
+
cb();
|
|
1209
|
+
callback(err, written, buffer2);
|
|
1210
|
+
});
|
|
1211
|
+
});
|
|
1212
|
+
};
|
|
1213
|
+
FdSlicer.prototype.createReadStream = function(options) {
|
|
1214
|
+
return new ReadStream(this, options);
|
|
1215
|
+
};
|
|
1216
|
+
FdSlicer.prototype.createWriteStream = function(options) {
|
|
1217
|
+
return new WriteStream(this, options);
|
|
1218
|
+
};
|
|
1219
|
+
FdSlicer.prototype.ref = function() {
|
|
1220
|
+
this.refCount += 1;
|
|
1221
|
+
};
|
|
1222
|
+
FdSlicer.prototype.unref = function() {
|
|
1223
|
+
var self = this;
|
|
1224
|
+
self.refCount -= 1;
|
|
1225
|
+
if (self.refCount > 0)
|
|
1226
|
+
return;
|
|
1227
|
+
if (self.refCount < 0)
|
|
1228
|
+
throw new Error("invalid unref");
|
|
1229
|
+
if (self.autoClose) {
|
|
1230
|
+
fs.close(self.fd, onCloseDone);
|
|
1231
|
+
}
|
|
1232
|
+
function onCloseDone(err) {
|
|
1233
|
+
if (err) {
|
|
1234
|
+
self.emit("error", err);
|
|
1235
|
+
} else {
|
|
1236
|
+
self.emit("close");
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
util.inherits(ReadStream, Readable);
|
|
1241
|
+
ReadStream.prototype._read = function(n) {
|
|
1242
|
+
var self = this;
|
|
1243
|
+
if (self.destroyed)
|
|
1244
|
+
return;
|
|
1245
|
+
var toRead = Math.min(self._readableState.highWaterMark, n);
|
|
1246
|
+
if (self.endOffset != null) {
|
|
1247
|
+
toRead = Math.min(toRead, self.endOffset - self.pos);
|
|
1248
|
+
}
|
|
1249
|
+
if (toRead <= 0) {
|
|
1250
|
+
self.destroyed = true;
|
|
1251
|
+
self.push(null);
|
|
1252
|
+
self.context.unref();
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
self.context.pend.go(function(cb) {
|
|
1256
|
+
if (self.destroyed)
|
|
1257
|
+
return cb();
|
|
1258
|
+
var buffer = new Buffer(toRead);
|
|
1259
|
+
fs.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
1260
|
+
if (err) {
|
|
1261
|
+
self.destroy(err);
|
|
1262
|
+
} else if (bytesRead === 0) {
|
|
1263
|
+
self.destroyed = true;
|
|
1264
|
+
self.push(null);
|
|
1265
|
+
self.context.unref();
|
|
1266
|
+
} else {
|
|
1267
|
+
self.pos += bytesRead;
|
|
1268
|
+
self.push(buffer.slice(0, bytesRead));
|
|
1269
|
+
}
|
|
1270
|
+
cb();
|
|
1271
|
+
});
|
|
1272
|
+
});
|
|
1273
|
+
};
|
|
1274
|
+
ReadStream.prototype.destroy = function(err) {
|
|
1275
|
+
if (this.destroyed)
|
|
1276
|
+
return;
|
|
1277
|
+
err = err || new Error("stream destroyed");
|
|
1278
|
+
this.destroyed = true;
|
|
1279
|
+
this.emit("error", err);
|
|
1280
|
+
this.context.unref();
|
|
1281
|
+
};
|
|
1282
|
+
util.inherits(WriteStream, Writable);
|
|
1283
|
+
WriteStream.prototype._write = function(buffer, encoding, callback) {
|
|
1284
|
+
var self = this;
|
|
1285
|
+
if (self.destroyed)
|
|
1286
|
+
return;
|
|
1287
|
+
if (self.pos + buffer.length > self.endOffset) {
|
|
1288
|
+
var err = new Error("maximum file length exceeded");
|
|
1289
|
+
err.code = "ETOOBIG";
|
|
1290
|
+
self.destroy();
|
|
1291
|
+
callback(err);
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
self.context.pend.go(function(cb) {
|
|
1295
|
+
if (self.destroyed)
|
|
1296
|
+
return cb();
|
|
1297
|
+
fs.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
|
|
1298
|
+
if (err2) {
|
|
1299
|
+
self.destroy();
|
|
1300
|
+
cb();
|
|
1301
|
+
callback(err2);
|
|
1302
|
+
} else {
|
|
1303
|
+
self.bytesWritten += bytes;
|
|
1304
|
+
self.pos += bytes;
|
|
1305
|
+
self.emit("progress");
|
|
1306
|
+
cb();
|
|
1307
|
+
callback();
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
});
|
|
1311
|
+
};
|
|
1312
|
+
WriteStream.prototype.destroy = function() {
|
|
1313
|
+
if (this.destroyed)
|
|
1314
|
+
return;
|
|
1315
|
+
this.destroyed = true;
|
|
1316
|
+
this.context.unref();
|
|
1317
|
+
};
|
|
1318
|
+
util.inherits(BufferSlicer, EventEmitter);
|
|
1319
|
+
BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
1320
|
+
var end = position + length;
|
|
1321
|
+
var delta = end - this.buffer.length;
|
|
1322
|
+
var written = delta > 0 ? delta : length;
|
|
1323
|
+
this.buffer.copy(buffer, offset, position, end);
|
|
1324
|
+
setImmediate(function() {
|
|
1325
|
+
callback(null, written);
|
|
1326
|
+
});
|
|
1327
|
+
};
|
|
1328
|
+
BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
1329
|
+
buffer.copy(this.buffer, position, offset, offset + length);
|
|
1330
|
+
setImmediate(function() {
|
|
1331
|
+
callback(null, length, buffer);
|
|
1332
|
+
});
|
|
1333
|
+
};
|
|
1334
|
+
BufferSlicer.prototype.createReadStream = function(options) {
|
|
1335
|
+
options = options || {};
|
|
1336
|
+
var readStream = new PassThrough(options);
|
|
1337
|
+
readStream.destroyed = false;
|
|
1338
|
+
readStream.start = options.start || 0;
|
|
1339
|
+
readStream.endOffset = options.end;
|
|
1340
|
+
readStream.pos = readStream.endOffset || this.buffer.length;
|
|
1341
|
+
var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
|
|
1342
|
+
var offset = 0;
|
|
1343
|
+
while (true) {
|
|
1344
|
+
var nextOffset = offset + this.maxChunkSize;
|
|
1345
|
+
if (nextOffset >= entireSlice.length) {
|
|
1346
|
+
if (offset < entireSlice.length) {
|
|
1347
|
+
readStream.write(entireSlice.slice(offset, entireSlice.length));
|
|
1348
|
+
}
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
readStream.write(entireSlice.slice(offset, nextOffset));
|
|
1352
|
+
offset = nextOffset;
|
|
1353
|
+
}
|
|
1354
|
+
readStream.end();
|
|
1355
|
+
readStream.destroy = function() {
|
|
1356
|
+
readStream.destroyed = true;
|
|
1357
|
+
};
|
|
1358
|
+
return readStream;
|
|
1359
|
+
};
|
|
1360
|
+
BufferSlicer.prototype.createWriteStream = function(options) {
|
|
1361
|
+
var bufferSlicer = this;
|
|
1362
|
+
options = options || {};
|
|
1363
|
+
var writeStream = new Writable(options);
|
|
1364
|
+
writeStream.start = options.start || 0;
|
|
1365
|
+
writeStream.endOffset = options.end == null ? this.buffer.length : +options.end;
|
|
1366
|
+
writeStream.bytesWritten = 0;
|
|
1367
|
+
writeStream.pos = writeStream.start;
|
|
1368
|
+
writeStream.destroyed = false;
|
|
1369
|
+
writeStream._write = function(buffer, encoding, callback) {
|
|
1370
|
+
if (writeStream.destroyed)
|
|
1371
|
+
return;
|
|
1372
|
+
var end = writeStream.pos + buffer.length;
|
|
1373
|
+
if (end > writeStream.endOffset) {
|
|
1374
|
+
var err = new Error("maximum file length exceeded");
|
|
1375
|
+
err.code = "ETOOBIG";
|
|
1376
|
+
writeStream.destroyed = true;
|
|
1377
|
+
callback(err);
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
|
|
1381
|
+
writeStream.bytesWritten += buffer.length;
|
|
1382
|
+
writeStream.pos = end;
|
|
1383
|
+
writeStream.emit("progress");
|
|
1384
|
+
callback();
|
|
1385
|
+
};
|
|
1386
|
+
writeStream.destroy = function() {
|
|
1387
|
+
writeStream.destroyed = true;
|
|
1388
|
+
};
|
|
1389
|
+
return writeStream;
|
|
1390
|
+
};
|
|
1391
|
+
BufferSlicer.prototype.ref = function() {
|
|
1392
|
+
this.refCount += 1;
|
|
1393
|
+
};
|
|
1394
|
+
BufferSlicer.prototype.unref = function() {
|
|
1395
|
+
this.refCount -= 1;
|
|
1396
|
+
if (this.refCount < 0) {
|
|
1397
|
+
throw new Error("invalid unref");
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
});
|
|
1401
|
+
|
|
1402
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/yauzl@2.10.0/node_modules/buffer-crc32/index.js
|
|
1403
|
+
var require_buffer_crc32 = __commonJS((exports, module) => {
|
|
1404
|
+
var ensureBuffer = function(input) {
|
|
1405
|
+
if (Buffer2.isBuffer(input)) {
|
|
1406
|
+
return input;
|
|
1407
|
+
}
|
|
1408
|
+
var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
|
|
1409
|
+
if (typeof input === "number") {
|
|
1410
|
+
return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
|
|
1411
|
+
} else if (typeof input === "string") {
|
|
1412
|
+
return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
|
|
1413
|
+
} else {
|
|
1414
|
+
throw new Error("input must be buffer, number, or string, received " + typeof input);
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
var bufferizeInt = function(num) {
|
|
1418
|
+
var tmp = ensureBuffer(4);
|
|
1419
|
+
tmp.writeInt32BE(num, 0);
|
|
1420
|
+
return tmp;
|
|
1421
|
+
};
|
|
1422
|
+
var _crc32 = function(buf, previous) {
|
|
1423
|
+
buf = ensureBuffer(buf);
|
|
1424
|
+
if (Buffer2.isBuffer(previous)) {
|
|
1425
|
+
previous = previous.readUInt32BE(0);
|
|
1426
|
+
}
|
|
1427
|
+
var crc = ~~previous ^ -1;
|
|
1428
|
+
for (var n = 0;n < buf.length; n++) {
|
|
1429
|
+
crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
|
|
1430
|
+
}
|
|
1431
|
+
return crc ^ -1;
|
|
1432
|
+
};
|
|
1433
|
+
var crc32 = function() {
|
|
1434
|
+
return bufferizeInt(_crc32.apply(null, arguments));
|
|
1435
|
+
};
|
|
1436
|
+
var Buffer2 = __require("buffer").Buffer;
|
|
1437
|
+
var CRC_TABLE = [
|
|
1438
|
+
0,
|
|
1439
|
+
1996959894,
|
|
1440
|
+
3993919788,
|
|
1441
|
+
2567524794,
|
|
1442
|
+
124634137,
|
|
1443
|
+
1886057615,
|
|
1444
|
+
3915621685,
|
|
1445
|
+
2657392035,
|
|
1446
|
+
249268274,
|
|
1447
|
+
2044508324,
|
|
1448
|
+
3772115230,
|
|
1449
|
+
2547177864,
|
|
1450
|
+
162941995,
|
|
1451
|
+
2125561021,
|
|
1452
|
+
3887607047,
|
|
1453
|
+
2428444049,
|
|
1454
|
+
498536548,
|
|
1455
|
+
1789927666,
|
|
1456
|
+
4089016648,
|
|
1457
|
+
2227061214,
|
|
1458
|
+
450548861,
|
|
1459
|
+
1843258603,
|
|
1460
|
+
4107580753,
|
|
1461
|
+
2211677639,
|
|
1462
|
+
325883990,
|
|
1463
|
+
1684777152,
|
|
1464
|
+
4251122042,
|
|
1465
|
+
2321926636,
|
|
1466
|
+
335633487,
|
|
1467
|
+
1661365465,
|
|
1468
|
+
4195302755,
|
|
1469
|
+
2366115317,
|
|
1470
|
+
997073096,
|
|
1471
|
+
1281953886,
|
|
1472
|
+
3579855332,
|
|
1473
|
+
2724688242,
|
|
1474
|
+
1006888145,
|
|
1475
|
+
1258607687,
|
|
1476
|
+
3524101629,
|
|
1477
|
+
2768942443,
|
|
1478
|
+
901097722,
|
|
1479
|
+
1119000684,
|
|
1480
|
+
3686517206,
|
|
1481
|
+
2898065728,
|
|
1482
|
+
853044451,
|
|
1483
|
+
1172266101,
|
|
1484
|
+
3705015759,
|
|
1485
|
+
2882616665,
|
|
1486
|
+
651767980,
|
|
1487
|
+
1373503546,
|
|
1488
|
+
3369554304,
|
|
1489
|
+
3218104598,
|
|
1490
|
+
565507253,
|
|
1491
|
+
1454621731,
|
|
1492
|
+
3485111705,
|
|
1493
|
+
3099436303,
|
|
1494
|
+
671266974,
|
|
1495
|
+
1594198024,
|
|
1496
|
+
3322730930,
|
|
1497
|
+
2970347812,
|
|
1498
|
+
795835527,
|
|
1499
|
+
1483230225,
|
|
1500
|
+
3244367275,
|
|
1501
|
+
3060149565,
|
|
1502
|
+
1994146192,
|
|
1503
|
+
31158534,
|
|
1504
|
+
2563907772,
|
|
1505
|
+
4023717930,
|
|
1506
|
+
1907459465,
|
|
1507
|
+
112637215,
|
|
1508
|
+
2680153253,
|
|
1509
|
+
3904427059,
|
|
1510
|
+
2013776290,
|
|
1511
|
+
251722036,
|
|
1512
|
+
2517215374,
|
|
1513
|
+
3775830040,
|
|
1514
|
+
2137656763,
|
|
1515
|
+
141376813,
|
|
1516
|
+
2439277719,
|
|
1517
|
+
3865271297,
|
|
1518
|
+
1802195444,
|
|
1519
|
+
476864866,
|
|
1520
|
+
2238001368,
|
|
1521
|
+
4066508878,
|
|
1522
|
+
1812370925,
|
|
1523
|
+
453092731,
|
|
1524
|
+
2181625025,
|
|
1525
|
+
4111451223,
|
|
1526
|
+
1706088902,
|
|
1527
|
+
314042704,
|
|
1528
|
+
2344532202,
|
|
1529
|
+
4240017532,
|
|
1530
|
+
1658658271,
|
|
1531
|
+
366619977,
|
|
1532
|
+
2362670323,
|
|
1533
|
+
4224994405,
|
|
1534
|
+
1303535960,
|
|
1535
|
+
984961486,
|
|
1536
|
+
2747007092,
|
|
1537
|
+
3569037538,
|
|
1538
|
+
1256170817,
|
|
1539
|
+
1037604311,
|
|
1540
|
+
2765210733,
|
|
1541
|
+
3554079995,
|
|
1542
|
+
1131014506,
|
|
1543
|
+
879679996,
|
|
1544
|
+
2909243462,
|
|
1545
|
+
3663771856,
|
|
1546
|
+
1141124467,
|
|
1547
|
+
855842277,
|
|
1548
|
+
2852801631,
|
|
1549
|
+
3708648649,
|
|
1550
|
+
1342533948,
|
|
1551
|
+
654459306,
|
|
1552
|
+
3188396048,
|
|
1553
|
+
3373015174,
|
|
1554
|
+
1466479909,
|
|
1555
|
+
544179635,
|
|
1556
|
+
3110523913,
|
|
1557
|
+
3462522015,
|
|
1558
|
+
1591671054,
|
|
1559
|
+
702138776,
|
|
1560
|
+
2966460450,
|
|
1561
|
+
3352799412,
|
|
1562
|
+
1504918807,
|
|
1563
|
+
783551873,
|
|
1564
|
+
3082640443,
|
|
1565
|
+
3233442989,
|
|
1566
|
+
3988292384,
|
|
1567
|
+
2596254646,
|
|
1568
|
+
62317068,
|
|
1569
|
+
1957810842,
|
|
1570
|
+
3939845945,
|
|
1571
|
+
2647816111,
|
|
1572
|
+
81470997,
|
|
1573
|
+
1943803523,
|
|
1574
|
+
3814918930,
|
|
1575
|
+
2489596804,
|
|
1576
|
+
225274430,
|
|
1577
|
+
2053790376,
|
|
1578
|
+
3826175755,
|
|
1579
|
+
2466906013,
|
|
1580
|
+
167816743,
|
|
1581
|
+
2097651377,
|
|
1582
|
+
4027552580,
|
|
1583
|
+
2265490386,
|
|
1584
|
+
503444072,
|
|
1585
|
+
1762050814,
|
|
1586
|
+
4150417245,
|
|
1587
|
+
2154129355,
|
|
1588
|
+
426522225,
|
|
1589
|
+
1852507879,
|
|
1590
|
+
4275313526,
|
|
1591
|
+
2312317920,
|
|
1592
|
+
282753626,
|
|
1593
|
+
1742555852,
|
|
1594
|
+
4189708143,
|
|
1595
|
+
2394877945,
|
|
1596
|
+
397917763,
|
|
1597
|
+
1622183637,
|
|
1598
|
+
3604390888,
|
|
1599
|
+
2714866558,
|
|
1600
|
+
953729732,
|
|
1601
|
+
1340076626,
|
|
1602
|
+
3518719985,
|
|
1603
|
+
2797360999,
|
|
1604
|
+
1068828381,
|
|
1605
|
+
1219638859,
|
|
1606
|
+
3624741850,
|
|
1607
|
+
2936675148,
|
|
1608
|
+
906185462,
|
|
1609
|
+
1090812512,
|
|
1610
|
+
3747672003,
|
|
1611
|
+
2825379669,
|
|
1612
|
+
829329135,
|
|
1613
|
+
1181335161,
|
|
1614
|
+
3412177804,
|
|
1615
|
+
3160834842,
|
|
1616
|
+
628085408,
|
|
1617
|
+
1382605366,
|
|
1618
|
+
3423369109,
|
|
1619
|
+
3138078467,
|
|
1620
|
+
570562233,
|
|
1621
|
+
1426400815,
|
|
1622
|
+
3317316542,
|
|
1623
|
+
2998733608,
|
|
1624
|
+
733239954,
|
|
1625
|
+
1555261956,
|
|
1626
|
+
3268935591,
|
|
1627
|
+
3050360625,
|
|
1628
|
+
752459403,
|
|
1629
|
+
1541320221,
|
|
1630
|
+
2607071920,
|
|
1631
|
+
3965973030,
|
|
1632
|
+
1969922972,
|
|
1633
|
+
40735498,
|
|
1634
|
+
2617837225,
|
|
1635
|
+
3943577151,
|
|
1636
|
+
1913087877,
|
|
1637
|
+
83908371,
|
|
1638
|
+
2512341634,
|
|
1639
|
+
3803740692,
|
|
1640
|
+
2075208622,
|
|
1641
|
+
213261112,
|
|
1642
|
+
2463272603,
|
|
1643
|
+
3855990285,
|
|
1644
|
+
2094854071,
|
|
1645
|
+
198958881,
|
|
1646
|
+
2262029012,
|
|
1647
|
+
4057260610,
|
|
1648
|
+
1759359992,
|
|
1649
|
+
534414190,
|
|
1650
|
+
2176718541,
|
|
1651
|
+
4139329115,
|
|
1652
|
+
1873836001,
|
|
1653
|
+
414664567,
|
|
1654
|
+
2282248934,
|
|
1655
|
+
4279200368,
|
|
1656
|
+
1711684554,
|
|
1657
|
+
285281116,
|
|
1658
|
+
2405801727,
|
|
1659
|
+
4167216745,
|
|
1660
|
+
1634467795,
|
|
1661
|
+
376229701,
|
|
1662
|
+
2685067896,
|
|
1663
|
+
3608007406,
|
|
1664
|
+
1308918612,
|
|
1665
|
+
956543938,
|
|
1666
|
+
2808555105,
|
|
1667
|
+
3495958263,
|
|
1668
|
+
1231636301,
|
|
1669
|
+
1047427035,
|
|
1670
|
+
2932959818,
|
|
1671
|
+
3654703836,
|
|
1672
|
+
1088359270,
|
|
1673
|
+
936918000,
|
|
1674
|
+
2847714899,
|
|
1675
|
+
3736837829,
|
|
1676
|
+
1202900863,
|
|
1677
|
+
817233897,
|
|
1678
|
+
3183342108,
|
|
1679
|
+
3401237130,
|
|
1680
|
+
1404277552,
|
|
1681
|
+
615818150,
|
|
1682
|
+
3134207493,
|
|
1683
|
+
3453421203,
|
|
1684
|
+
1423857449,
|
|
1685
|
+
601450431,
|
|
1686
|
+
3009837614,
|
|
1687
|
+
3294710456,
|
|
1688
|
+
1567103746,
|
|
1689
|
+
711928724,
|
|
1690
|
+
3020668471,
|
|
1691
|
+
3272380065,
|
|
1692
|
+
1510334235,
|
|
1693
|
+
755167117
|
|
1694
|
+
];
|
|
1695
|
+
if (typeof Int32Array !== "undefined") {
|
|
1696
|
+
CRC_TABLE = new Int32Array(CRC_TABLE);
|
|
1697
|
+
}
|
|
1698
|
+
crc32.signed = function() {
|
|
1699
|
+
return _crc32.apply(null, arguments);
|
|
1700
|
+
};
|
|
1701
|
+
crc32.unsigned = function() {
|
|
1702
|
+
return _crc32.apply(null, arguments) >>> 0;
|
|
1703
|
+
};
|
|
1704
|
+
module.exports = crc32;
|
|
1705
|
+
});
|
|
1706
|
+
|
|
1707
|
+
// /Users/jonathanburger/remotion/node_modules/.pnpm/extract-zip@2.0.1/node_modules/yauzl/index.js
|
|
1708
|
+
var require_yauzl = __commonJS((exports) => {
|
|
1709
|
+
var open = function(path, options, callback) {
|
|
1710
|
+
if (typeof options === "function") {
|
|
1711
|
+
callback = options;
|
|
1712
|
+
options = null;
|
|
1713
|
+
}
|
|
1714
|
+
if (options == null)
|
|
1715
|
+
options = {};
|
|
1716
|
+
if (options.autoClose == null)
|
|
1717
|
+
options.autoClose = true;
|
|
1718
|
+
if (options.lazyEntries == null)
|
|
1719
|
+
options.lazyEntries = false;
|
|
1720
|
+
if (options.decodeStrings == null)
|
|
1721
|
+
options.decodeStrings = true;
|
|
1722
|
+
if (options.validateEntrySizes == null)
|
|
1723
|
+
options.validateEntrySizes = true;
|
|
1724
|
+
if (options.strictFileNames == null)
|
|
1725
|
+
options.strictFileNames = false;
|
|
1726
|
+
if (callback == null)
|
|
1727
|
+
callback = defaultCallback;
|
|
1728
|
+
fs.open(path, "r", function(err, fd) {
|
|
1729
|
+
if (err)
|
|
1730
|
+
return callback(err);
|
|
1731
|
+
fromFd(fd, options, function(err2, zipfile) {
|
|
1732
|
+
if (err2)
|
|
1733
|
+
fs.close(fd, defaultCallback);
|
|
1734
|
+
callback(err2, zipfile);
|
|
1735
|
+
});
|
|
1736
|
+
});
|
|
1737
|
+
};
|
|
1738
|
+
var fromFd = function(fd, options, callback) {
|
|
1739
|
+
if (typeof options === "function") {
|
|
1740
|
+
callback = options;
|
|
1741
|
+
options = null;
|
|
1742
|
+
}
|
|
1743
|
+
if (options == null)
|
|
1744
|
+
options = {};
|
|
1745
|
+
if (options.autoClose == null)
|
|
1746
|
+
options.autoClose = false;
|
|
1747
|
+
if (options.lazyEntries == null)
|
|
1748
|
+
options.lazyEntries = false;
|
|
1749
|
+
if (options.decodeStrings == null)
|
|
1750
|
+
options.decodeStrings = true;
|
|
1751
|
+
if (options.validateEntrySizes == null)
|
|
1752
|
+
options.validateEntrySizes = true;
|
|
1753
|
+
if (options.strictFileNames == null)
|
|
1754
|
+
options.strictFileNames = false;
|
|
1755
|
+
if (callback == null)
|
|
1756
|
+
callback = defaultCallback;
|
|
1757
|
+
fs.fstat(fd, function(err, stats) {
|
|
1758
|
+
if (err)
|
|
1759
|
+
return callback(err);
|
|
1760
|
+
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
1761
|
+
fromRandomAccessReader(reader, stats.size, options, callback);
|
|
1762
|
+
});
|
|
1763
|
+
};
|
|
1764
|
+
var fromBuffer = function(buffer, options, callback) {
|
|
1765
|
+
if (typeof options === "function") {
|
|
1766
|
+
callback = options;
|
|
1767
|
+
options = null;
|
|
1768
|
+
}
|
|
1769
|
+
if (options == null)
|
|
1770
|
+
options = {};
|
|
1771
|
+
options.autoClose = false;
|
|
1772
|
+
if (options.lazyEntries == null)
|
|
1773
|
+
options.lazyEntries = false;
|
|
1774
|
+
if (options.decodeStrings == null)
|
|
1775
|
+
options.decodeStrings = true;
|
|
1776
|
+
if (options.validateEntrySizes == null)
|
|
1777
|
+
options.validateEntrySizes = true;
|
|
1778
|
+
if (options.strictFileNames == null)
|
|
1779
|
+
options.strictFileNames = false;
|
|
1780
|
+
var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
|
|
1781
|
+
fromRandomAccessReader(reader, buffer.length, options, callback);
|
|
1782
|
+
};
|
|
1783
|
+
var fromRandomAccessReader = function(reader, totalSize, options, callback) {
|
|
1784
|
+
if (typeof options === "function") {
|
|
1785
|
+
callback = options;
|
|
1786
|
+
options = null;
|
|
1787
|
+
}
|
|
1788
|
+
if (options == null)
|
|
1789
|
+
options = {};
|
|
1790
|
+
if (options.autoClose == null)
|
|
1791
|
+
options.autoClose = true;
|
|
1792
|
+
if (options.lazyEntries == null)
|
|
1793
|
+
options.lazyEntries = false;
|
|
1794
|
+
if (options.decodeStrings == null)
|
|
1795
|
+
options.decodeStrings = true;
|
|
1796
|
+
var decodeStrings = !!options.decodeStrings;
|
|
1797
|
+
if (options.validateEntrySizes == null)
|
|
1798
|
+
options.validateEntrySizes = true;
|
|
1799
|
+
if (options.strictFileNames == null)
|
|
1800
|
+
options.strictFileNames = false;
|
|
1801
|
+
if (callback == null)
|
|
1802
|
+
callback = defaultCallback;
|
|
1803
|
+
if (typeof totalSize !== "number")
|
|
1804
|
+
throw new Error("expected totalSize parameter to be a number");
|
|
1805
|
+
if (totalSize > Number.MAX_SAFE_INTEGER) {
|
|
1806
|
+
throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
|
|
1807
|
+
}
|
|
1808
|
+
reader.ref();
|
|
1809
|
+
var eocdrWithoutCommentSize = 22;
|
|
1810
|
+
var maxCommentSize = 65535;
|
|
1811
|
+
var bufferSize = Math.min(eocdrWithoutCommentSize + maxCommentSize, totalSize);
|
|
1812
|
+
var buffer = newBuffer(bufferSize);
|
|
1813
|
+
var bufferReadStart = totalSize - buffer.length;
|
|
1814
|
+
readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
|
|
1815
|
+
if (err)
|
|
1816
|
+
return callback(err);
|
|
1817
|
+
for (var i = bufferSize - eocdrWithoutCommentSize;i >= 0; i -= 1) {
|
|
1818
|
+
if (buffer.readUInt32LE(i) !== 101010256)
|
|
1819
|
+
continue;
|
|
1820
|
+
var eocdrBuffer = buffer.slice(i);
|
|
1821
|
+
var diskNumber = eocdrBuffer.readUInt16LE(4);
|
|
1822
|
+
if (diskNumber !== 0) {
|
|
1823
|
+
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
1824
|
+
}
|
|
1825
|
+
var entryCount = eocdrBuffer.readUInt16LE(10);
|
|
1826
|
+
var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
|
|
1827
|
+
var commentLength = eocdrBuffer.readUInt16LE(20);
|
|
1828
|
+
var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
|
|
1829
|
+
if (commentLength !== expectedCommentLength) {
|
|
1830
|
+
return callback(new Error("invalid comment length. expected: " + expectedCommentLength + ". found: " + commentLength));
|
|
1831
|
+
}
|
|
1832
|
+
var comment = decodeStrings ? decodeBuffer(eocdrBuffer, 22, eocdrBuffer.length, false) : eocdrBuffer.slice(22);
|
|
1833
|
+
if (!(entryCount === 65535 || centralDirectoryOffset === 4294967295)) {
|
|
1834
|
+
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
|
|
1835
|
+
}
|
|
1836
|
+
var zip64EocdlBuffer = newBuffer(20);
|
|
1837
|
+
var zip64EocdlOffset = bufferReadStart + i - zip64EocdlBuffer.length;
|
|
1838
|
+
readAndAssertNoEof(reader, zip64EocdlBuffer, 0, zip64EocdlBuffer.length, zip64EocdlOffset, function(err2) {
|
|
1839
|
+
if (err2)
|
|
1840
|
+
return callback(err2);
|
|
1841
|
+
if (zip64EocdlBuffer.readUInt32LE(0) !== 117853008) {
|
|
1842
|
+
return callback(new Error("invalid zip64 end of central directory locator signature"));
|
|
1843
|
+
}
|
|
1844
|
+
var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
|
|
1845
|
+
var zip64EocdrBuffer = newBuffer(56);
|
|
1846
|
+
readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err3) {
|
|
1847
|
+
if (err3)
|
|
1848
|
+
return callback(err3);
|
|
1849
|
+
if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
|
|
1850
|
+
return callback(new Error("invalid zip64 end of central directory record signature"));
|
|
1851
|
+
}
|
|
1852
|
+
entryCount = readUInt64LE(zip64EocdrBuffer, 32);
|
|
1853
|
+
centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
|
|
1854
|
+
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
|
|
1855
|
+
});
|
|
1856
|
+
});
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
callback(new Error("end of central directory record signature not found"));
|
|
1860
|
+
});
|
|
1861
|
+
};
|
|
1862
|
+
var ZipFile = function(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
|
|
1863
|
+
var self = this;
|
|
1864
|
+
EventEmitter.call(self);
|
|
1865
|
+
self.reader = reader;
|
|
1866
|
+
self.reader.on("error", function(err) {
|
|
1867
|
+
emitError(self, err);
|
|
1868
|
+
});
|
|
1869
|
+
self.reader.once("close", function() {
|
|
1870
|
+
self.emit("close");
|
|
1871
|
+
});
|
|
1872
|
+
self.readEntryCursor = centralDirectoryOffset;
|
|
1873
|
+
self.fileSize = fileSize;
|
|
1874
|
+
self.entryCount = entryCount;
|
|
1875
|
+
self.comment = comment;
|
|
1876
|
+
self.entriesRead = 0;
|
|
1877
|
+
self.autoClose = !!autoClose;
|
|
1878
|
+
self.lazyEntries = !!lazyEntries;
|
|
1879
|
+
self.decodeStrings = !!decodeStrings;
|
|
1880
|
+
self.validateEntrySizes = !!validateEntrySizes;
|
|
1881
|
+
self.strictFileNames = !!strictFileNames;
|
|
1882
|
+
self.isOpen = true;
|
|
1883
|
+
self.emittedError = false;
|
|
1884
|
+
if (!self.lazyEntries)
|
|
1885
|
+
self._readEntry();
|
|
1886
|
+
};
|
|
1887
|
+
var emitErrorAndAutoClose = function(self, err) {
|
|
1888
|
+
if (self.autoClose)
|
|
1889
|
+
self.close();
|
|
1890
|
+
emitError(self, err);
|
|
1891
|
+
};
|
|
1892
|
+
var emitError = function(self, err) {
|
|
1893
|
+
if (self.emittedError)
|
|
1894
|
+
return;
|
|
1895
|
+
self.emittedError = true;
|
|
1896
|
+
self.emit("error", err);
|
|
1897
|
+
};
|
|
1898
|
+
var Entry = function() {
|
|
1899
|
+
};
|
|
1900
|
+
var dosDateTimeToDate = function(date, time) {
|
|
1901
|
+
var day = date & 31;
|
|
1902
|
+
var month = (date >> 5 & 15) - 1;
|
|
1903
|
+
var year = (date >> 9 & 127) + 1980;
|
|
1904
|
+
var millisecond = 0;
|
|
1905
|
+
var second = (time & 31) * 2;
|
|
1906
|
+
var minute = time >> 5 & 63;
|
|
1907
|
+
var hour = time >> 11 & 31;
|
|
1908
|
+
return new Date(year, month, day, hour, minute, second, millisecond);
|
|
1909
|
+
};
|
|
1910
|
+
var validateFileName = function(fileName) {
|
|
1911
|
+
if (fileName.indexOf("\\") !== -1) {
|
|
1912
|
+
return "invalid characters in fileName: " + fileName;
|
|
1913
|
+
}
|
|
1914
|
+
if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
|
|
1915
|
+
return "absolute path: " + fileName;
|
|
1916
|
+
}
|
|
1917
|
+
if (fileName.split("/").indexOf("..") !== -1) {
|
|
1918
|
+
return "invalid relative path: " + fileName;
|
|
1919
|
+
}
|
|
1920
|
+
return null;
|
|
1921
|
+
};
|
|
1922
|
+
var readAndAssertNoEof = function(reader, buffer, offset, length, position, callback) {
|
|
1923
|
+
if (length === 0) {
|
|
1924
|
+
return setImmediate(function() {
|
|
1925
|
+
callback(null, newBuffer(0));
|
|
1926
|
+
});
|
|
1927
|
+
}
|
|
1928
|
+
reader.read(buffer, offset, length, position, function(err, bytesRead) {
|
|
1929
|
+
if (err)
|
|
1930
|
+
return callback(err);
|
|
1931
|
+
if (bytesRead < length) {
|
|
1932
|
+
return callback(new Error("unexpected EOF"));
|
|
1933
|
+
}
|
|
1934
|
+
callback();
|
|
1935
|
+
});
|
|
1936
|
+
};
|
|
1937
|
+
var AssertByteCountStream = function(byteCount) {
|
|
1938
|
+
Transform.call(this);
|
|
1939
|
+
this.actualByteCount = 0;
|
|
1940
|
+
this.expectedByteCount = byteCount;
|
|
1941
|
+
};
|
|
1942
|
+
var RandomAccessReader = function() {
|
|
1943
|
+
EventEmitter.call(this);
|
|
1944
|
+
this.refCount = 0;
|
|
1945
|
+
};
|
|
1946
|
+
var RefUnrefFilter = function(context) {
|
|
1947
|
+
PassThrough.call(this);
|
|
1948
|
+
this.context = context;
|
|
1949
|
+
this.context.ref();
|
|
1950
|
+
this.unreffedYet = false;
|
|
1951
|
+
};
|
|
1952
|
+
var decodeBuffer = function(buffer, start, end, isUtf8) {
|
|
1953
|
+
if (isUtf8) {
|
|
1954
|
+
return buffer.toString("utf8", start, end);
|
|
1955
|
+
} else {
|
|
1956
|
+
var result = "";
|
|
1957
|
+
for (var i = start;i < end; i++) {
|
|
1958
|
+
result += cp437[buffer[i]];
|
|
1959
|
+
}
|
|
1960
|
+
return result;
|
|
1961
|
+
}
|
|
1962
|
+
};
|
|
1963
|
+
var readUInt64LE = function(buffer, offset) {
|
|
1964
|
+
var lower32 = buffer.readUInt32LE(offset);
|
|
1965
|
+
var upper32 = buffer.readUInt32LE(offset + 4);
|
|
1966
|
+
return upper32 * 4294967296 + lower32;
|
|
1967
|
+
};
|
|
1968
|
+
var defaultCallback = function(err) {
|
|
1969
|
+
if (err)
|
|
1970
|
+
throw err;
|
|
1971
|
+
};
|
|
1972
|
+
var fs = __require("fs");
|
|
1973
|
+
var zlib = __require("zlib");
|
|
1974
|
+
var fd_slicer = require_fd_slicer();
|
|
1975
|
+
var crc32 = require_buffer_crc32();
|
|
1976
|
+
var util = __require("util");
|
|
1977
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
1978
|
+
var Transform = __require("stream").Transform;
|
|
1979
|
+
var PassThrough = __require("stream").PassThrough;
|
|
1980
|
+
var Writable = __require("stream").Writable;
|
|
1981
|
+
exports.open = open;
|
|
1982
|
+
exports.fromFd = fromFd;
|
|
1983
|
+
exports.fromBuffer = fromBuffer;
|
|
1984
|
+
exports.fromRandomAccessReader = fromRandomAccessReader;
|
|
1985
|
+
exports.dosDateTimeToDate = dosDateTimeToDate;
|
|
1986
|
+
exports.validateFileName = validateFileName;
|
|
1987
|
+
exports.ZipFile = ZipFile;
|
|
1988
|
+
exports.Entry = Entry;
|
|
1989
|
+
exports.RandomAccessReader = RandomAccessReader;
|
|
1990
|
+
util.inherits(ZipFile, EventEmitter);
|
|
1991
|
+
ZipFile.prototype.close = function() {
|
|
1992
|
+
if (!this.isOpen)
|
|
1993
|
+
return;
|
|
1994
|
+
this.isOpen = false;
|
|
1995
|
+
this.reader.unref();
|
|
1996
|
+
};
|
|
1997
|
+
ZipFile.prototype.readEntry = function() {
|
|
1998
|
+
if (!this.lazyEntries)
|
|
1999
|
+
throw new Error("readEntry() called without lazyEntries:true");
|
|
2000
|
+
this._readEntry();
|
|
2001
|
+
};
|
|
2002
|
+
ZipFile.prototype._readEntry = function() {
|
|
2003
|
+
var self = this;
|
|
2004
|
+
if (self.entryCount === self.entriesRead) {
|
|
2005
|
+
setImmediate(function() {
|
|
2006
|
+
if (self.autoClose)
|
|
2007
|
+
self.close();
|
|
2008
|
+
if (self.emittedError)
|
|
2009
|
+
return;
|
|
2010
|
+
self.emit("end");
|
|
2011
|
+
});
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
if (self.emittedError)
|
|
2015
|
+
return;
|
|
2016
|
+
var buffer = newBuffer(46);
|
|
2017
|
+
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
|
|
2018
|
+
if (err)
|
|
2019
|
+
return emitErrorAndAutoClose(self, err);
|
|
2020
|
+
if (self.emittedError)
|
|
2021
|
+
return;
|
|
2022
|
+
var entry = new Entry;
|
|
2023
|
+
var signature = buffer.readUInt32LE(0);
|
|
2024
|
+
if (signature !== 33639248)
|
|
2025
|
+
return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
|
|
2026
|
+
entry.versionMadeBy = buffer.readUInt16LE(4);
|
|
2027
|
+
entry.versionNeededToExtract = buffer.readUInt16LE(6);
|
|
2028
|
+
entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
|
|
2029
|
+
entry.compressionMethod = buffer.readUInt16LE(10);
|
|
2030
|
+
entry.lastModFileTime = buffer.readUInt16LE(12);
|
|
2031
|
+
entry.lastModFileDate = buffer.readUInt16LE(14);
|
|
2032
|
+
entry.crc32 = buffer.readUInt32LE(16);
|
|
2033
|
+
entry.compressedSize = buffer.readUInt32LE(20);
|
|
2034
|
+
entry.uncompressedSize = buffer.readUInt32LE(24);
|
|
2035
|
+
entry.fileNameLength = buffer.readUInt16LE(28);
|
|
2036
|
+
entry.extraFieldLength = buffer.readUInt16LE(30);
|
|
2037
|
+
entry.fileCommentLength = buffer.readUInt16LE(32);
|
|
2038
|
+
entry.internalFileAttributes = buffer.readUInt16LE(36);
|
|
2039
|
+
entry.externalFileAttributes = buffer.readUInt32LE(38);
|
|
2040
|
+
entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
|
|
2041
|
+
if (entry.generalPurposeBitFlag & 64)
|
|
2042
|
+
return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
|
|
2043
|
+
self.readEntryCursor += 46;
|
|
2044
|
+
buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
|
|
2045
|
+
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err2) {
|
|
2046
|
+
if (err2)
|
|
2047
|
+
return emitErrorAndAutoClose(self, err2);
|
|
2048
|
+
if (self.emittedError)
|
|
2049
|
+
return;
|
|
2050
|
+
var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
|
|
2051
|
+
entry.fileName = self.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf8) : buffer.slice(0, entry.fileNameLength);
|
|
2052
|
+
var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
|
|
2053
|
+
var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart);
|
|
2054
|
+
entry.extraFields = [];
|
|
2055
|
+
var i = 0;
|
|
2056
|
+
while (i < extraFieldBuffer.length - 3) {
|
|
2057
|
+
var headerId = extraFieldBuffer.readUInt16LE(i + 0);
|
|
2058
|
+
var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
|
|
2059
|
+
var dataStart = i + 4;
|
|
2060
|
+
var dataEnd = dataStart + dataSize;
|
|
2061
|
+
if (dataEnd > extraFieldBuffer.length)
|
|
2062
|
+
return emitErrorAndAutoClose(self, new Error("extra field length exceeds extra field buffer size"));
|
|
2063
|
+
var dataBuffer = newBuffer(dataSize);
|
|
2064
|
+
extraFieldBuffer.copy(dataBuffer, 0, dataStart, dataEnd);
|
|
2065
|
+
entry.extraFields.push({
|
|
2066
|
+
id: headerId,
|
|
2067
|
+
data: dataBuffer
|
|
2068
|
+
});
|
|
2069
|
+
i = dataEnd;
|
|
2070
|
+
}
|
|
2071
|
+
entry.fileComment = self.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf8) : buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength);
|
|
2072
|
+
entry.comment = entry.fileComment;
|
|
2073
|
+
self.readEntryCursor += buffer.length;
|
|
2074
|
+
self.entriesRead += 1;
|
|
2075
|
+
if (entry.uncompressedSize === 4294967295 || entry.compressedSize === 4294967295 || entry.relativeOffsetOfLocalHeader === 4294967295) {
|
|
2076
|
+
var zip64EiefBuffer = null;
|
|
2077
|
+
for (var i = 0;i < entry.extraFields.length; i++) {
|
|
2078
|
+
var extraField = entry.extraFields[i];
|
|
2079
|
+
if (extraField.id === 1) {
|
|
2080
|
+
zip64EiefBuffer = extraField.data;
|
|
2081
|
+
break;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
if (zip64EiefBuffer == null) {
|
|
2085
|
+
return emitErrorAndAutoClose(self, new Error("expected zip64 extended information extra field"));
|
|
2086
|
+
}
|
|
2087
|
+
var index = 0;
|
|
2088
|
+
if (entry.uncompressedSize === 4294967295) {
|
|
2089
|
+
if (index + 8 > zip64EiefBuffer.length) {
|
|
2090
|
+
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size"));
|
|
2091
|
+
}
|
|
2092
|
+
entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
2093
|
+
index += 8;
|
|
2094
|
+
}
|
|
2095
|
+
if (entry.compressedSize === 4294967295) {
|
|
2096
|
+
if (index + 8 > zip64EiefBuffer.length) {
|
|
2097
|
+
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size"));
|
|
2098
|
+
}
|
|
2099
|
+
entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
2100
|
+
index += 8;
|
|
2101
|
+
}
|
|
2102
|
+
if (entry.relativeOffsetOfLocalHeader === 4294967295) {
|
|
2103
|
+
if (index + 8 > zip64EiefBuffer.length) {
|
|
2104
|
+
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset"));
|
|
2105
|
+
}
|
|
2106
|
+
entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
|
|
2107
|
+
index += 8;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
if (self.decodeStrings) {
|
|
2111
|
+
for (var i = 0;i < entry.extraFields.length; i++) {
|
|
2112
|
+
var extraField = entry.extraFields[i];
|
|
2113
|
+
if (extraField.id === 28789) {
|
|
2114
|
+
if (extraField.data.length < 6) {
|
|
2115
|
+
continue;
|
|
2116
|
+
}
|
|
2117
|
+
if (extraField.data.readUInt8(0) !== 1) {
|
|
2118
|
+
continue;
|
|
2119
|
+
}
|
|
2120
|
+
var oldNameCrc32 = extraField.data.readUInt32LE(1);
|
|
2121
|
+
if (crc32.unsigned(buffer.slice(0, entry.fileNameLength)) !== oldNameCrc32) {
|
|
2122
|
+
continue;
|
|
2123
|
+
}
|
|
2124
|
+
entry.fileName = decodeBuffer(extraField.data, 5, extraField.data.length, true);
|
|
2125
|
+
break;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
if (self.validateEntrySizes && entry.compressionMethod === 0) {
|
|
2130
|
+
var expectedCompressedSize = entry.uncompressedSize;
|
|
2131
|
+
if (entry.isEncrypted()) {
|
|
2132
|
+
expectedCompressedSize += 12;
|
|
2133
|
+
}
|
|
2134
|
+
if (entry.compressedSize !== expectedCompressedSize) {
|
|
2135
|
+
var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
|
|
2136
|
+
return emitErrorAndAutoClose(self, new Error(msg));
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
if (self.decodeStrings) {
|
|
2140
|
+
if (!self.strictFileNames) {
|
|
2141
|
+
entry.fileName = entry.fileName.replace(/\\/g, "/");
|
|
2142
|
+
}
|
|
2143
|
+
var errorMessage = validateFileName(entry.fileName, self.validateFileNameOptions);
|
|
2144
|
+
if (errorMessage != null)
|
|
2145
|
+
return emitErrorAndAutoClose(self, new Error(errorMessage));
|
|
2146
|
+
}
|
|
2147
|
+
self.emit("entry", entry);
|
|
2148
|
+
if (!self.lazyEntries)
|
|
2149
|
+
self._readEntry();
|
|
2150
|
+
});
|
|
2151
|
+
});
|
|
2152
|
+
};
|
|
2153
|
+
ZipFile.prototype.openReadStream = function(entry, options, callback) {
|
|
2154
|
+
var self = this;
|
|
2155
|
+
var relativeStart = 0;
|
|
2156
|
+
var relativeEnd = entry.compressedSize;
|
|
2157
|
+
if (callback == null) {
|
|
2158
|
+
callback = options;
|
|
2159
|
+
options = {};
|
|
2160
|
+
} else {
|
|
2161
|
+
if (options.decrypt != null) {
|
|
2162
|
+
if (!entry.isEncrypted()) {
|
|
2163
|
+
throw new Error("options.decrypt can only be specified for encrypted entries");
|
|
2164
|
+
}
|
|
2165
|
+
if (options.decrypt !== false)
|
|
2166
|
+
throw new Error("invalid options.decrypt value: " + options.decrypt);
|
|
2167
|
+
if (entry.isCompressed()) {
|
|
2168
|
+
if (options.decompress !== false)
|
|
2169
|
+
throw new Error("entry is encrypted and compressed, and options.decompress !== false");
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
if (options.decompress != null) {
|
|
2173
|
+
if (!entry.isCompressed()) {
|
|
2174
|
+
throw new Error("options.decompress can only be specified for compressed entries");
|
|
2175
|
+
}
|
|
2176
|
+
if (!(options.decompress === false || options.decompress === true)) {
|
|
2177
|
+
throw new Error("invalid options.decompress value: " + options.decompress);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
if (options.start != null || options.end != null) {
|
|
2181
|
+
if (entry.isCompressed() && options.decompress !== false) {
|
|
2182
|
+
throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
|
|
2183
|
+
}
|
|
2184
|
+
if (entry.isEncrypted() && options.decrypt !== false) {
|
|
2185
|
+
throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
if (options.start != null) {
|
|
2189
|
+
relativeStart = options.start;
|
|
2190
|
+
if (relativeStart < 0)
|
|
2191
|
+
throw new Error("options.start < 0");
|
|
2192
|
+
if (relativeStart > entry.compressedSize)
|
|
2193
|
+
throw new Error("options.start > entry.compressedSize");
|
|
2194
|
+
}
|
|
2195
|
+
if (options.end != null) {
|
|
2196
|
+
relativeEnd = options.end;
|
|
2197
|
+
if (relativeEnd < 0)
|
|
2198
|
+
throw new Error("options.end < 0");
|
|
2199
|
+
if (relativeEnd > entry.compressedSize)
|
|
2200
|
+
throw new Error("options.end > entry.compressedSize");
|
|
2201
|
+
if (relativeEnd < relativeStart)
|
|
2202
|
+
throw new Error("options.end < options.start");
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
if (!self.isOpen)
|
|
2206
|
+
return callback(new Error("closed"));
|
|
2207
|
+
if (entry.isEncrypted()) {
|
|
2208
|
+
if (options.decrypt !== false)
|
|
2209
|
+
return callback(new Error("entry is encrypted, and options.decrypt !== false"));
|
|
2210
|
+
}
|
|
2211
|
+
self.reader.ref();
|
|
2212
|
+
var buffer = newBuffer(30);
|
|
2213
|
+
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
|
|
2214
|
+
try {
|
|
2215
|
+
if (err)
|
|
2216
|
+
return callback(err);
|
|
2217
|
+
var signature = buffer.readUInt32LE(0);
|
|
2218
|
+
if (signature !== 67324752) {
|
|
2219
|
+
return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
|
|
2220
|
+
}
|
|
2221
|
+
var fileNameLength = buffer.readUInt16LE(26);
|
|
2222
|
+
var extraFieldLength = buffer.readUInt16LE(28);
|
|
2223
|
+
var localFileHeaderEnd = entry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength;
|
|
2224
|
+
var decompress;
|
|
2225
|
+
if (entry.compressionMethod === 0) {
|
|
2226
|
+
decompress = false;
|
|
2227
|
+
} else if (entry.compressionMethod === 8) {
|
|
2228
|
+
decompress = options.decompress != null ? options.decompress : true;
|
|
2229
|
+
} else {
|
|
2230
|
+
return callback(new Error("unsupported compression method: " + entry.compressionMethod));
|
|
2231
|
+
}
|
|
2232
|
+
var fileDataStart = localFileHeaderEnd;
|
|
2233
|
+
var fileDataEnd = fileDataStart + entry.compressedSize;
|
|
2234
|
+
if (entry.compressedSize !== 0) {
|
|
2235
|
+
if (fileDataEnd > self.fileSize) {
|
|
2236
|
+
return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
var readStream = self.reader.createReadStream({
|
|
2240
|
+
start: fileDataStart + relativeStart,
|
|
2241
|
+
end: fileDataStart + relativeEnd
|
|
2242
|
+
});
|
|
2243
|
+
var endpointStream = readStream;
|
|
2244
|
+
if (decompress) {
|
|
2245
|
+
var destroyed = false;
|
|
2246
|
+
var inflateFilter = zlib.createInflateRaw();
|
|
2247
|
+
readStream.on("error", function(err2) {
|
|
2248
|
+
setImmediate(function() {
|
|
2249
|
+
if (!destroyed)
|
|
2250
|
+
inflateFilter.emit("error", err2);
|
|
2251
|
+
});
|
|
2252
|
+
});
|
|
2253
|
+
readStream.pipe(inflateFilter);
|
|
2254
|
+
if (self.validateEntrySizes) {
|
|
2255
|
+
endpointStream = new AssertByteCountStream(entry.uncompressedSize);
|
|
2256
|
+
inflateFilter.on("error", function(err2) {
|
|
2257
|
+
setImmediate(function() {
|
|
2258
|
+
if (!destroyed)
|
|
2259
|
+
endpointStream.emit("error", err2);
|
|
2260
|
+
});
|
|
2261
|
+
});
|
|
2262
|
+
inflateFilter.pipe(endpointStream);
|
|
2263
|
+
} else {
|
|
2264
|
+
endpointStream = inflateFilter;
|
|
2265
|
+
}
|
|
2266
|
+
endpointStream.destroy = function() {
|
|
2267
|
+
destroyed = true;
|
|
2268
|
+
if (inflateFilter !== endpointStream)
|
|
2269
|
+
inflateFilter.unpipe(endpointStream);
|
|
2270
|
+
readStream.unpipe(inflateFilter);
|
|
2271
|
+
readStream.destroy();
|
|
2272
|
+
};
|
|
2273
|
+
}
|
|
2274
|
+
callback(null, endpointStream);
|
|
2275
|
+
} finally {
|
|
2276
|
+
self.reader.unref();
|
|
2277
|
+
}
|
|
2278
|
+
});
|
|
2279
|
+
};
|
|
2280
|
+
Entry.prototype.getLastModDate = function() {
|
|
2281
|
+
return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime);
|
|
2282
|
+
};
|
|
2283
|
+
Entry.prototype.isEncrypted = function() {
|
|
2284
|
+
return (this.generalPurposeBitFlag & 1) !== 0;
|
|
2285
|
+
};
|
|
2286
|
+
Entry.prototype.isCompressed = function() {
|
|
2287
|
+
return this.compressionMethod === 8;
|
|
2288
|
+
};
|
|
2289
|
+
util.inherits(AssertByteCountStream, Transform);
|
|
2290
|
+
AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
|
|
2291
|
+
this.actualByteCount += chunk.length;
|
|
2292
|
+
if (this.actualByteCount > this.expectedByteCount) {
|
|
2293
|
+
var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
|
|
2294
|
+
return cb(new Error(msg));
|
|
2295
|
+
}
|
|
2296
|
+
cb(null, chunk);
|
|
2297
|
+
};
|
|
2298
|
+
AssertByteCountStream.prototype._flush = function(cb) {
|
|
2299
|
+
if (this.actualByteCount < this.expectedByteCount) {
|
|
2300
|
+
var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
|
|
2301
|
+
return cb(new Error(msg));
|
|
2302
|
+
}
|
|
2303
|
+
cb();
|
|
2304
|
+
};
|
|
2305
|
+
util.inherits(RandomAccessReader, EventEmitter);
|
|
2306
|
+
RandomAccessReader.prototype.ref = function() {
|
|
2307
|
+
this.refCount += 1;
|
|
2308
|
+
};
|
|
2309
|
+
RandomAccessReader.prototype.unref = function() {
|
|
2310
|
+
var self = this;
|
|
2311
|
+
self.refCount -= 1;
|
|
2312
|
+
if (self.refCount > 0)
|
|
2313
|
+
return;
|
|
2314
|
+
if (self.refCount < 0)
|
|
2315
|
+
throw new Error("invalid unref");
|
|
2316
|
+
self.close(onCloseDone);
|
|
2317
|
+
function onCloseDone(err) {
|
|
2318
|
+
if (err)
|
|
2319
|
+
return self.emit("error", err);
|
|
2320
|
+
self.emit("close");
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
RandomAccessReader.prototype.createReadStream = function(options) {
|
|
2324
|
+
var start = options.start;
|
|
2325
|
+
var end = options.end;
|
|
2326
|
+
if (start === end) {
|
|
2327
|
+
var emptyStream = new PassThrough;
|
|
2328
|
+
setImmediate(function() {
|
|
2329
|
+
emptyStream.end();
|
|
2330
|
+
});
|
|
2331
|
+
return emptyStream;
|
|
2332
|
+
}
|
|
2333
|
+
var stream = this._readStreamForRange(start, end);
|
|
2334
|
+
var destroyed = false;
|
|
2335
|
+
var refUnrefFilter = new RefUnrefFilter(this);
|
|
2336
|
+
stream.on("error", function(err) {
|
|
2337
|
+
setImmediate(function() {
|
|
2338
|
+
if (!destroyed)
|
|
2339
|
+
refUnrefFilter.emit("error", err);
|
|
2340
|
+
});
|
|
2341
|
+
});
|
|
2342
|
+
refUnrefFilter.destroy = function() {
|
|
2343
|
+
stream.unpipe(refUnrefFilter);
|
|
2344
|
+
refUnrefFilter.unref();
|
|
2345
|
+
stream.destroy();
|
|
2346
|
+
};
|
|
2347
|
+
var byteCounter = new AssertByteCountStream(end - start);
|
|
2348
|
+
refUnrefFilter.on("error", function(err) {
|
|
2349
|
+
setImmediate(function() {
|
|
2350
|
+
if (!destroyed)
|
|
2351
|
+
byteCounter.emit("error", err);
|
|
2352
|
+
});
|
|
2353
|
+
});
|
|
2354
|
+
byteCounter.destroy = function() {
|
|
2355
|
+
destroyed = true;
|
|
2356
|
+
refUnrefFilter.unpipe(byteCounter);
|
|
2357
|
+
refUnrefFilter.destroy();
|
|
2358
|
+
};
|
|
2359
|
+
return stream.pipe(refUnrefFilter).pipe(byteCounter);
|
|
2360
|
+
};
|
|
2361
|
+
RandomAccessReader.prototype._readStreamForRange = function(start, end) {
|
|
2362
|
+
throw new Error("not implemented");
|
|
2363
|
+
};
|
|
2364
|
+
RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
|
|
2365
|
+
var readStream = this.createReadStream({ start: position, end: position + length });
|
|
2366
|
+
var writeStream = new Writable;
|
|
2367
|
+
var written = 0;
|
|
2368
|
+
writeStream._write = function(chunk, encoding, cb) {
|
|
2369
|
+
chunk.copy(buffer, offset + written, 0, chunk.length);
|
|
2370
|
+
written += chunk.length;
|
|
2371
|
+
cb();
|
|
2372
|
+
};
|
|
2373
|
+
writeStream.on("finish", callback);
|
|
2374
|
+
readStream.on("error", function(error) {
|
|
2375
|
+
callback(error);
|
|
2376
|
+
});
|
|
2377
|
+
readStream.pipe(writeStream);
|
|
2378
|
+
};
|
|
2379
|
+
RandomAccessReader.prototype.close = function(callback) {
|
|
2380
|
+
setImmediate(callback);
|
|
2381
|
+
};
|
|
2382
|
+
util.inherits(RefUnrefFilter, PassThrough);
|
|
2383
|
+
RefUnrefFilter.prototype._flush = function(cb) {
|
|
2384
|
+
this.unref();
|
|
2385
|
+
cb();
|
|
2386
|
+
};
|
|
2387
|
+
RefUnrefFilter.prototype.unref = function(cb) {
|
|
2388
|
+
if (this.unreffedYet)
|
|
2389
|
+
return;
|
|
2390
|
+
this.unreffedYet = true;
|
|
2391
|
+
this.context.unref();
|
|
2392
|
+
};
|
|
2393
|
+
var cp437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
|
|
2394
|
+
var newBuffer;
|
|
2395
|
+
if (typeof Buffer.allocUnsafe === "function") {
|
|
2396
|
+
newBuffer = function(len) {
|
|
2397
|
+
return Buffer.allocUnsafe(len);
|
|
2398
|
+
};
|
|
2399
|
+
} else {
|
|
2400
|
+
newBuffer = function(len) {
|
|
2401
|
+
return new Buffer(len);
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
});
|
|
2405
|
+
|
|
2406
|
+
// /Users/jonathanburger/remotion/packages/renderer/node_modules/extract-zip/index.js
|
|
2407
|
+
var require_extract_zip = __commonJS((exports, module) => {
|
|
2408
|
+
var debug = require_src()("extract-zip");
|
|
2409
|
+
var { createWriteStream, promises: fs } = __require("fs");
|
|
2410
|
+
var getStream = require_get_stream();
|
|
2411
|
+
var path = __require("path");
|
|
2412
|
+
var { promisify } = __require("util");
|
|
2413
|
+
var stream = __require("stream");
|
|
2414
|
+
var yauzl = require_yauzl();
|
|
2415
|
+
var openZip = promisify(yauzl.open);
|
|
2416
|
+
var pipeline = promisify(stream.pipeline);
|
|
2417
|
+
|
|
2418
|
+
class Extractor {
|
|
2419
|
+
constructor(zipPath, opts) {
|
|
2420
|
+
this.zipPath = zipPath;
|
|
2421
|
+
this.opts = opts;
|
|
2422
|
+
}
|
|
2423
|
+
async extract() {
|
|
2424
|
+
debug("opening", this.zipPath, "with opts", this.opts);
|
|
2425
|
+
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
2426
|
+
this.canceled = false;
|
|
2427
|
+
return new Promise((resolve, reject) => {
|
|
2428
|
+
this.zipfile.on("error", (err) => {
|
|
2429
|
+
this.canceled = true;
|
|
2430
|
+
reject(err);
|
|
2431
|
+
});
|
|
2432
|
+
this.zipfile.readEntry();
|
|
2433
|
+
this.zipfile.on("close", () => {
|
|
2434
|
+
if (!this.canceled) {
|
|
2435
|
+
debug("zip extraction complete");
|
|
2436
|
+
resolve();
|
|
2437
|
+
}
|
|
2438
|
+
});
|
|
2439
|
+
this.zipfile.on("entry", async (entry) => {
|
|
2440
|
+
if (this.canceled) {
|
|
2441
|
+
debug("skipping entry", entry.fileName, { cancelled: this.canceled });
|
|
2442
|
+
return;
|
|
2443
|
+
}
|
|
2444
|
+
debug("zipfile entry", entry.fileName);
|
|
2445
|
+
if (entry.fileName.startsWith("__MACOSX/")) {
|
|
2446
|
+
this.zipfile.readEntry();
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
const destDir = path.dirname(path.join(this.opts.dir, entry.fileName));
|
|
2450
|
+
try {
|
|
2451
|
+
await fs.mkdir(destDir, { recursive: true });
|
|
2452
|
+
const canonicalDestDir = await fs.realpath(destDir);
|
|
2453
|
+
const relativeDestDir = path.relative(this.opts.dir, canonicalDestDir);
|
|
2454
|
+
if (relativeDestDir.split(path.sep).includes("..")) {
|
|
2455
|
+
throw new Error(`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`);
|
|
2456
|
+
}
|
|
2457
|
+
await this.extractEntry(entry);
|
|
2458
|
+
debug("finished processing", entry.fileName);
|
|
2459
|
+
this.zipfile.readEntry();
|
|
2460
|
+
} catch (err) {
|
|
2461
|
+
this.canceled = true;
|
|
2462
|
+
this.zipfile.close();
|
|
2463
|
+
reject(err);
|
|
2464
|
+
}
|
|
2465
|
+
});
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
async extractEntry(entry) {
|
|
2469
|
+
if (this.canceled) {
|
|
2470
|
+
debug("skipping entry extraction", entry.fileName, { cancelled: this.canceled });
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2473
|
+
if (this.opts.onEntry) {
|
|
2474
|
+
this.opts.onEntry(entry, this.zipfile);
|
|
2475
|
+
}
|
|
2476
|
+
const dest = path.join(this.opts.dir, entry.fileName);
|
|
2477
|
+
const mode = entry.externalFileAttributes >> 16 & 65535;
|
|
2478
|
+
const IFMT = 61440;
|
|
2479
|
+
const IFDIR = 16384;
|
|
2480
|
+
const IFLNK = 40960;
|
|
2481
|
+
const symlink = (mode & IFMT) === IFLNK;
|
|
2482
|
+
let isDir = (mode & IFMT) === IFDIR;
|
|
2483
|
+
if (!isDir && entry.fileName.endsWith("/")) {
|
|
2484
|
+
isDir = true;
|
|
2485
|
+
}
|
|
2486
|
+
const madeBy = entry.versionMadeBy >> 8;
|
|
2487
|
+
if (!isDir)
|
|
2488
|
+
isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
|
2489
|
+
debug("extracting entry", { filename: entry.fileName, isDir, isSymlink: symlink });
|
|
2490
|
+
const procMode = this.getExtractedMode(mode, isDir) & 511;
|
|
2491
|
+
const destDir = isDir ? dest : path.dirname(dest);
|
|
2492
|
+
const mkdirOptions = { recursive: true };
|
|
2493
|
+
if (isDir) {
|
|
2494
|
+
mkdirOptions.mode = procMode;
|
|
2495
|
+
}
|
|
2496
|
+
debug("mkdir", { dir: destDir, ...mkdirOptions });
|
|
2497
|
+
await fs.mkdir(destDir, mkdirOptions);
|
|
2498
|
+
if (isDir)
|
|
2499
|
+
return;
|
|
2500
|
+
debug("opening read stream", dest);
|
|
2501
|
+
const readStream = await promisify(this.zipfile.openReadStream.bind(this.zipfile))(entry);
|
|
2502
|
+
if (symlink) {
|
|
2503
|
+
const link = await getStream(readStream);
|
|
2504
|
+
debug("creating symlink", link, dest);
|
|
2505
|
+
await fs.symlink(link, dest);
|
|
2506
|
+
} else {
|
|
2507
|
+
await pipeline(readStream, createWriteStream(dest, { mode: procMode }));
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
getExtractedMode(entryMode, isDir) {
|
|
2511
|
+
let mode = entryMode;
|
|
2512
|
+
if (mode === 0) {
|
|
2513
|
+
if (isDir) {
|
|
2514
|
+
if (this.opts.defaultDirMode) {
|
|
2515
|
+
mode = parseInt(this.opts.defaultDirMode, 10);
|
|
2516
|
+
}
|
|
2517
|
+
if (!mode) {
|
|
2518
|
+
mode = 493;
|
|
2519
|
+
}
|
|
2520
|
+
} else {
|
|
2521
|
+
if (this.opts.defaultFileMode) {
|
|
2522
|
+
mode = parseInt(this.opts.defaultFileMode, 10);
|
|
2523
|
+
}
|
|
2524
|
+
if (!mode) {
|
|
2525
|
+
mode = 420;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
return mode;
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
module.exports = async function(zipPath, opts) {
|
|
2533
|
+
debug("creating target directory", opts.dir);
|
|
2534
|
+
if (!path.isAbsolute(opts.dir)) {
|
|
2535
|
+
throw new Error("Target directory is expected to be absolute");
|
|
2536
|
+
}
|
|
2537
|
+
await fs.mkdir(opts.dir, { recursive: true });
|
|
2538
|
+
opts.dir = await fs.realpath(opts.dir);
|
|
2539
|
+
return new Extractor(zipPath, opts).extract();
|
|
2540
|
+
};
|
|
2541
|
+
});
|
|
2542
|
+
|
|
2543
|
+
// src/ensure-browser.ts
|
|
2544
|
+
import fs5 from "fs";
|
|
2545
|
+
|
|
2546
|
+
// src/browser/BrowserFetcher.ts
|
|
2547
|
+
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
2548
|
+
import * as fs3 from "node:fs";
|
|
2549
|
+
import * as os from "node:os";
|
|
2550
|
+
import * as path3 from "node:path";
|
|
2551
|
+
import {promisify} from "node:util";
|
|
2552
|
+
|
|
2553
|
+
// src/assets/download-file.ts
|
|
2554
|
+
import {createWriteStream} from "node:fs";
|
|
2555
|
+
|
|
2556
|
+
// src/ensure-output-directory.ts
|
|
2557
|
+
import fs from "node:fs";
|
|
2558
|
+
import path from "node:path";
|
|
2559
|
+
var ensureOutputDirectory = (outputLocation) => {
|
|
2560
|
+
const dirName = path.dirname(outputLocation);
|
|
2561
|
+
if (!fs.existsSync(dirName)) {
|
|
2562
|
+
fs.mkdirSync(dirName, {
|
|
2563
|
+
recursive: true
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
};
|
|
2567
|
+
|
|
2568
|
+
// src/chalk/is-color-supported.ts
|
|
2569
|
+
import * as tty from "tty";
|
|
2570
|
+
var isColorSupported = () => {
|
|
2571
|
+
const env = process.env || {};
|
|
2572
|
+
const isForceDisabled = "NO_COLOR" in env;
|
|
2573
|
+
if (isForceDisabled) {
|
|
2574
|
+
return false;
|
|
2575
|
+
}
|
|
2576
|
+
const isForced = "FORCE_COLOR" in env;
|
|
2577
|
+
if (isForced) {
|
|
2578
|
+
return true;
|
|
2579
|
+
}
|
|
2580
|
+
const isWindows = process.platform === "win32";
|
|
2581
|
+
const isCompatibleTerminal = tty?.isatty?.(1) && env.TERM && env.TERM !== "dumb";
|
|
2582
|
+
const isCI = "CI" in env && (("GITHUB_ACTIONS" in env) || ("GITLAB_CI" in env) || ("CIRCLECI" in env));
|
|
2583
|
+
return isWindows || isCompatibleTerminal || isCI;
|
|
2584
|
+
};
|
|
2585
|
+
|
|
2586
|
+
// src/chalk/index.ts
|
|
2587
|
+
var chalk = (() => {
|
|
2588
|
+
const colors = {
|
|
2589
|
+
enabled: () => isColorSupported(),
|
|
2590
|
+
visible: true,
|
|
2591
|
+
styles: {},
|
|
2592
|
+
keys: {}
|
|
2593
|
+
};
|
|
2594
|
+
const ansi = (st) => {
|
|
2595
|
+
const open = `\x1B[${st.codes[0]}m`;
|
|
2596
|
+
const close = `\x1B[${st.codes[1]}m`;
|
|
2597
|
+
const regex = new RegExp(`\\u001b\\[${st.codes[1]}m`, "g");
|
|
2598
|
+
st.wrap = (input, newline) => {
|
|
2599
|
+
if (input.includes(close))
|
|
2600
|
+
input = input.replace(regex, close + open);
|
|
2601
|
+
const output = open + input + close;
|
|
2602
|
+
return newline ? output.replace(/\r*\n/g, `${close}\$&${open}`) : output;
|
|
2603
|
+
};
|
|
2604
|
+
return st;
|
|
2605
|
+
};
|
|
2606
|
+
const wrap = (sty, input, newline) => {
|
|
2607
|
+
return sty.wrap?.(input, newline);
|
|
2608
|
+
};
|
|
2609
|
+
const style = (input, stack) => {
|
|
2610
|
+
if (input === "" || input === null || input === undefined)
|
|
2611
|
+
return "";
|
|
2612
|
+
if (colors.enabled() === false)
|
|
2613
|
+
return input;
|
|
2614
|
+
if (colors.visible === false)
|
|
2615
|
+
return "";
|
|
2616
|
+
let str = String(input);
|
|
2617
|
+
const nl = str.includes("\n");
|
|
2618
|
+
let n = stack.length;
|
|
2619
|
+
while (n-- > 0)
|
|
2620
|
+
str = wrap(colors.styles[stack[n]], str, nl);
|
|
2621
|
+
return str;
|
|
2622
|
+
};
|
|
2623
|
+
const define = (name, codes, type) => {
|
|
2624
|
+
colors.styles[name] = ansi({ name, codes });
|
|
2625
|
+
const keys = colors.keys[type] || (colors.keys[type] = []);
|
|
2626
|
+
keys.push(name);
|
|
2627
|
+
Reflect.defineProperty(colors, name, {
|
|
2628
|
+
configurable: true,
|
|
2629
|
+
enumerable: true,
|
|
2630
|
+
set(value) {
|
|
2631
|
+
colors.alias?.(name, value);
|
|
2632
|
+
},
|
|
2633
|
+
get() {
|
|
2634
|
+
const color = (input) => style(input, color.stack);
|
|
2635
|
+
Reflect.setPrototypeOf(color, colors);
|
|
2636
|
+
color.stack = this.stack ? this.stack.concat(name) : [name];
|
|
2637
|
+
return color;
|
|
2638
|
+
}
|
|
2639
|
+
});
|
|
2640
|
+
};
|
|
2641
|
+
define("reset", [0, 0], "modifier");
|
|
2642
|
+
define("bold", [1, 22], "modifier");
|
|
2643
|
+
define("dim", [2, 22], "modifier");
|
|
2644
|
+
define("italic", [3, 23], "modifier");
|
|
2645
|
+
define("underline", [4, 24], "modifier");
|
|
2646
|
+
define("inverse", [7, 27], "modifier");
|
|
2647
|
+
define("hidden", [8, 28], "modifier");
|
|
2648
|
+
define("strikethrough", [9, 29], "modifier");
|
|
2649
|
+
define("black", [30, 39], "color");
|
|
2650
|
+
define("red", [31, 39], "color");
|
|
2651
|
+
define("green", [32, 39], "color");
|
|
2652
|
+
define("yellow", [33, 39], "color");
|
|
2653
|
+
define("blue", [34, 39], "color");
|
|
2654
|
+
define("magenta", [35, 39], "color");
|
|
2655
|
+
define("cyan", [36, 39], "color");
|
|
2656
|
+
define("white", [37, 39], "color");
|
|
2657
|
+
define("gray", [90, 39], "color");
|
|
2658
|
+
define("grey", [90, 39], "color");
|
|
2659
|
+
define("bgBlack", [40, 49], "bg");
|
|
2660
|
+
define("bgRed", [41, 49], "bg");
|
|
2661
|
+
define("bgGreen", [42, 49], "bg");
|
|
2662
|
+
define("bgYellow", [43, 49], "bg");
|
|
2663
|
+
define("bgBlue", [44, 49], "bg");
|
|
2664
|
+
define("bgMagenta", [45, 49], "bg");
|
|
2665
|
+
define("bgWhite", [47, 49], "bg");
|
|
2666
|
+
define("blackBright", [90, 39], "bright");
|
|
2667
|
+
define("redBright", [91, 39], "bright");
|
|
2668
|
+
define("greenBright", [92, 39], "bright");
|
|
2669
|
+
define("yellowBright", [93, 39], "bright");
|
|
2670
|
+
define("blueBright", [94, 39], "bright");
|
|
2671
|
+
define("magentaBright", [95, 39], "bright");
|
|
2672
|
+
define("whiteBright", [97, 39], "bright");
|
|
2673
|
+
define("bgBlackBright", [100, 49], "bgBright");
|
|
2674
|
+
define("bgRedBright", [101, 49], "bgBright");
|
|
2675
|
+
define("bgGreenBright", [102, 49], "bgBright");
|
|
2676
|
+
define("bgYellowBright", [103, 49], "bgBright");
|
|
2677
|
+
define("bgBlueBright", [104, 49], "bgBright");
|
|
2678
|
+
define("bgMagentaBright", [105, 49], "bgBright");
|
|
2679
|
+
define("bgWhiteBright", [107, 49], "bgBright");
|
|
2680
|
+
colors.alias = (name, color) => {
|
|
2681
|
+
const fn = colors[color];
|
|
2682
|
+
if (typeof fn !== "function") {
|
|
2683
|
+
throw new TypeError("Expected alias to be the name of an existing color (string) or a function");
|
|
2684
|
+
}
|
|
2685
|
+
if (!fn.stack) {
|
|
2686
|
+
Reflect.defineProperty(fn, "name", { value: name });
|
|
2687
|
+
colors.styles[name] = fn;
|
|
2688
|
+
fn.stack = [name];
|
|
2689
|
+
}
|
|
2690
|
+
Reflect.defineProperty(colors, name, {
|
|
2691
|
+
configurable: true,
|
|
2692
|
+
enumerable: true,
|
|
2693
|
+
set(value) {
|
|
2694
|
+
colors.alias?.(name, value);
|
|
2695
|
+
},
|
|
2696
|
+
get() {
|
|
2697
|
+
const col = (input) => style(input, col.stack);
|
|
2698
|
+
Reflect.setPrototypeOf(col, colors);
|
|
2699
|
+
col.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
|
|
2700
|
+
return col;
|
|
2701
|
+
}
|
|
2702
|
+
});
|
|
2703
|
+
};
|
|
2704
|
+
return colors;
|
|
2705
|
+
})();
|
|
2706
|
+
|
|
2707
|
+
// src/log-level.ts
|
|
2708
|
+
var logLevels = ["verbose", "info", "warn", "error"];
|
|
2709
|
+
var getNumberForLogLevel = (level) => {
|
|
2710
|
+
return logLevels.indexOf(level);
|
|
2711
|
+
};
|
|
2712
|
+
var isEqualOrBelowLogLevel = (currentLevel, level) => {
|
|
2713
|
+
return getNumberForLogLevel(currentLevel) <= getNumberForLogLevel(level);
|
|
2714
|
+
};
|
|
2715
|
+
|
|
2716
|
+
// src/repro.ts
|
|
2717
|
+
var reproWriteInstance = null;
|
|
2718
|
+
var getReproWriter = () => {
|
|
2719
|
+
if (!reproWriteInstance) {
|
|
2720
|
+
throw new Error("reproWriteInstance is not initialized");
|
|
2721
|
+
}
|
|
2722
|
+
return reproWriteInstance;
|
|
2723
|
+
};
|
|
2724
|
+
var writeInRepro = (level, ...args) => {
|
|
2725
|
+
if (isReproEnabled()) {
|
|
2726
|
+
getReproWriter().writeLine(level, ...args);
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
var shouldRepro = false;
|
|
2730
|
+
var isReproEnabled = () => shouldRepro;
|
|
2731
|
+
|
|
2732
|
+
// src/truthy.ts
|
|
2733
|
+
function truthy(value) {
|
|
2734
|
+
return Boolean(value);
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
// src/logger.ts
|
|
2738
|
+
var INDENT_TOKEN = chalk.gray("\u2502");
|
|
2739
|
+
var verboseTag = (str) => {
|
|
2740
|
+
return isColorSupported() ? chalk.bgBlack(` ${str} `) : `[${str}]`;
|
|
2741
|
+
};
|
|
2742
|
+
var Log = {
|
|
2743
|
+
verbose: (options, ...args) => {
|
|
2744
|
+
writeInRepro("verbose", ...args);
|
|
2745
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "verbose")) {
|
|
2746
|
+
return console.log(...[
|
|
2747
|
+
options.indent ? INDENT_TOKEN : null,
|
|
2748
|
+
options.tag ? verboseTag(options.tag) : null
|
|
2749
|
+
].filter(truthy).concat(args.map((a) => chalk.gray(a))));
|
|
2750
|
+
}
|
|
2751
|
+
},
|
|
2752
|
+
info: (options, ...args) => {
|
|
2753
|
+
writeInRepro("info", ...args);
|
|
2754
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "info")) {
|
|
2755
|
+
return console.log(...[options.indent ? INDENT_TOKEN : null].filter(truthy).concat(args));
|
|
2756
|
+
}
|
|
2757
|
+
},
|
|
2758
|
+
warn: (options, ...args) => {
|
|
2759
|
+
writeInRepro("warn", ...args);
|
|
2760
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "warn")) {
|
|
2761
|
+
return console.warn(...[options.indent ? chalk.yellow(INDENT_TOKEN) : null].filter(truthy).concat(args.map((a) => chalk.yellow(a))));
|
|
2762
|
+
}
|
|
2763
|
+
},
|
|
2764
|
+
error: (options, ...args) => {
|
|
2765
|
+
writeInRepro("error", ...args);
|
|
2766
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "error")) {
|
|
2767
|
+
return console.error(...[
|
|
2768
|
+
options.indent ? INDENT_TOKEN : null,
|
|
2769
|
+
options.tag ? verboseTag(options.tag) : null
|
|
2770
|
+
].filter(truthy).concat(args.map((a) => chalk.red(a))));
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
};
|
|
2774
|
+
|
|
2775
|
+
// src/assets/read-file.ts
|
|
2776
|
+
import https from "https";
|
|
2777
|
+
import http from "node:http";
|
|
2778
|
+
|
|
2779
|
+
// src/redirect-status-codes.ts
|
|
2780
|
+
var redirectStatusCodes = [301, 302, 303, 307, 308];
|
|
2781
|
+
|
|
2782
|
+
// src/assets/read-file.ts
|
|
2783
|
+
var getClient = (url) => {
|
|
2784
|
+
if (url.startsWith("https://")) {
|
|
2785
|
+
return https.get;
|
|
2786
|
+
}
|
|
2787
|
+
if (url.startsWith("http://")) {
|
|
2788
|
+
return http.get;
|
|
2789
|
+
}
|
|
2790
|
+
throw new Error(`Can only download URLs starting with http:// or https://, got "${url}"`);
|
|
2791
|
+
};
|
|
2792
|
+
var readFileWithoutRedirect = (url) => {
|
|
2793
|
+
return new Promise((resolve, reject) => {
|
|
2794
|
+
const client = getClient(url);
|
|
2795
|
+
client(url, typeof Bun === "undefined" ? {
|
|
2796
|
+
headers: {
|
|
2797
|
+
"user-agent": "Mozilla/5.0 (@remotion/renderer - https://remotion.dev)"
|
|
2798
|
+
}
|
|
2799
|
+
} : {}, (res) => {
|
|
2800
|
+
resolve(res);
|
|
2801
|
+
}).on("error", (err) => {
|
|
2802
|
+
return reject(err);
|
|
2803
|
+
});
|
|
2804
|
+
});
|
|
2805
|
+
};
|
|
2806
|
+
var readFile = async (url, redirectsSoFar = 0) => {
|
|
2807
|
+
if (redirectsSoFar > 10) {
|
|
2808
|
+
throw new Error(`Too many redirects while downloading ${url}`);
|
|
2809
|
+
}
|
|
2810
|
+
const file = await readFileWithoutRedirect(url);
|
|
2811
|
+
if (redirectStatusCodes.includes(file.statusCode)) {
|
|
2812
|
+
if (!file.headers.location) {
|
|
2813
|
+
throw new Error(`Received a status code ${file.statusCode} but no "Location" header while calling ${file.headers.location}`);
|
|
2814
|
+
}
|
|
2815
|
+
const { origin } = new URL(url);
|
|
2816
|
+
const redirectUrl = new URL(file.headers.location, origin).toString();
|
|
2817
|
+
return readFile(redirectUrl, redirectsSoFar + 1);
|
|
2818
|
+
}
|
|
2819
|
+
if (file.statusCode >= 400) {
|
|
2820
|
+
const body = await tryToObtainBody(file);
|
|
2821
|
+
throw new Error([
|
|
2822
|
+
`Received a status code of ${file.statusCode} while downloading file ${url}.`,
|
|
2823
|
+
body ? `The response body was:` : null,
|
|
2824
|
+
body ? `---` : null,
|
|
2825
|
+
body ? body : null,
|
|
2826
|
+
body ? `---` : null
|
|
2827
|
+
].filter(truthy).join("\n"));
|
|
2828
|
+
}
|
|
2829
|
+
return file;
|
|
2830
|
+
};
|
|
2831
|
+
var tryToObtainBody = async (file) => {
|
|
2832
|
+
const success = new Promise((resolve) => {
|
|
2833
|
+
let data = "";
|
|
2834
|
+
file.on("data", (chunk) => {
|
|
2835
|
+
data += chunk;
|
|
2836
|
+
});
|
|
2837
|
+
file.on("end", () => {
|
|
2838
|
+
resolve(data);
|
|
2839
|
+
});
|
|
2840
|
+
file.on("error", () => resolve(data));
|
|
2841
|
+
});
|
|
2842
|
+
let timeout = null;
|
|
2843
|
+
const body = await Promise.race([
|
|
2844
|
+
success,
|
|
2845
|
+
new Promise((resolve) => {
|
|
2846
|
+
timeout = setTimeout(() => {
|
|
2847
|
+
resolve(null);
|
|
2848
|
+
}, 5000);
|
|
2849
|
+
})
|
|
2850
|
+
]);
|
|
2851
|
+
if (timeout) {
|
|
2852
|
+
clearTimeout(timeout);
|
|
2853
|
+
}
|
|
2854
|
+
return body;
|
|
2855
|
+
};
|
|
2856
|
+
|
|
2857
|
+
// src/assets/download-file.ts
|
|
2858
|
+
var incorrectContentLengthToken = "Download finished with";
|
|
2859
|
+
var downloadFileWithoutRetries = ({ onProgress, url, to: toFn }) => {
|
|
2860
|
+
return new Promise((resolve, reject) => {
|
|
2861
|
+
let rejected = false;
|
|
2862
|
+
let resolved = false;
|
|
2863
|
+
let timeout;
|
|
2864
|
+
const resolveAndFlag = (val) => {
|
|
2865
|
+
resolved = true;
|
|
2866
|
+
resolve(val);
|
|
2867
|
+
if (timeout) {
|
|
2868
|
+
clearTimeout(timeout);
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
const rejectAndFlag = (err) => {
|
|
2872
|
+
if (timeout) {
|
|
2873
|
+
clearTimeout(timeout);
|
|
2874
|
+
}
|
|
2875
|
+
reject(err);
|
|
2876
|
+
rejected = true;
|
|
2877
|
+
};
|
|
2878
|
+
const refreshTimeout = () => {
|
|
2879
|
+
if (timeout) {
|
|
2880
|
+
clearTimeout(timeout);
|
|
2881
|
+
}
|
|
2882
|
+
timeout = setTimeout(() => {
|
|
2883
|
+
if (resolved) {
|
|
2884
|
+
return;
|
|
2885
|
+
}
|
|
2886
|
+
rejectAndFlag(new Error(`Tried to download file ${url}, but the server sent no data for 20 seconds`));
|
|
2887
|
+
}, 20000);
|
|
2888
|
+
};
|
|
2889
|
+
refreshTimeout();
|
|
2890
|
+
readFile(url).then((res) => {
|
|
2891
|
+
const contentDisposition = res.headers["content-disposition"] ?? null;
|
|
2892
|
+
const contentType = res.headers["content-type"] ?? null;
|
|
2893
|
+
const to = toFn(contentDisposition, contentType);
|
|
2894
|
+
ensureOutputDirectory(to);
|
|
2895
|
+
const sizeHeader = res.headers["content-length"];
|
|
2896
|
+
const totalSize = typeof sizeHeader === "undefined" ? null : Number(sizeHeader);
|
|
2897
|
+
const writeStream = createWriteStream(to);
|
|
2898
|
+
let downloaded = 0;
|
|
2899
|
+
writeStream.on("close", () => {
|
|
2900
|
+
if (rejected) {
|
|
2901
|
+
return;
|
|
2902
|
+
}
|
|
2903
|
+
onProgress?.({
|
|
2904
|
+
downloaded,
|
|
2905
|
+
percent: 1,
|
|
2906
|
+
totalSize: downloaded
|
|
2907
|
+
});
|
|
2908
|
+
refreshTimeout();
|
|
2909
|
+
return resolveAndFlag({ sizeInBytes: downloaded, to });
|
|
2910
|
+
});
|
|
2911
|
+
writeStream.on("error", (err) => rejectAndFlag(err));
|
|
2912
|
+
res.on("error", (err) => rejectAndFlag(err));
|
|
2913
|
+
res.pipe(writeStream).on("error", (err) => rejectAndFlag(err));
|
|
2914
|
+
res.on("data", (d) => {
|
|
2915
|
+
refreshTimeout();
|
|
2916
|
+
downloaded += d.length;
|
|
2917
|
+
refreshTimeout();
|
|
2918
|
+
onProgress?.({
|
|
2919
|
+
downloaded,
|
|
2920
|
+
percent: totalSize === null ? null : downloaded / totalSize,
|
|
2921
|
+
totalSize
|
|
2922
|
+
});
|
|
2923
|
+
});
|
|
2924
|
+
res.on("close", () => {
|
|
2925
|
+
if (totalSize !== null && downloaded !== totalSize) {
|
|
2926
|
+
rejectAndFlag(new Error(`${incorrectContentLengthToken} ${downloaded} bytes, but expected ${totalSize} bytes from 'Content-Length'.`));
|
|
2927
|
+
}
|
|
2928
|
+
writeStream.close();
|
|
2929
|
+
});
|
|
2930
|
+
}).catch((err) => {
|
|
2931
|
+
rejectAndFlag(err);
|
|
2932
|
+
});
|
|
2933
|
+
});
|
|
2934
|
+
};
|
|
2935
|
+
var downloadFile = async (options, retries = 2, attempt = 1) => {
|
|
2936
|
+
try {
|
|
2937
|
+
const res = await downloadFileWithoutRetries(options);
|
|
2938
|
+
return res;
|
|
2939
|
+
} catch (err) {
|
|
2940
|
+
const { message } = err;
|
|
2941
|
+
if (message === "aborted" || message.includes("ECONNRESET") || message.includes(incorrectContentLengthToken) || message.includes("503") || message.includes("502") || message.includes("504") || message.includes("500")) {
|
|
2942
|
+
if (retries === 0) {
|
|
2943
|
+
throw err;
|
|
2944
|
+
}
|
|
2945
|
+
Log.warn({ indent: options.indent, logLevel: options.logLevel }, `Downloading ${options.url} failed (will retry): ${message}`);
|
|
2946
|
+
const backoffInSeconds = (attempt + 1) ** 2;
|
|
2947
|
+
await new Promise((resolve) => {
|
|
2948
|
+
setTimeout(() => resolve(), backoffInSeconds * 1000);
|
|
2949
|
+
});
|
|
2950
|
+
return downloadFile(options, retries - 1, attempt + 1);
|
|
2951
|
+
}
|
|
2952
|
+
throw err;
|
|
2953
|
+
}
|
|
2954
|
+
};
|
|
2955
|
+
|
|
2956
|
+
// src/compositor/make-file-executable.ts
|
|
2957
|
+
import {accessSync, chmodSync, constants, statSync} from "node:fs";
|
|
2958
|
+
var hasPermissions = (p) => {
|
|
2959
|
+
if (process.platform !== "linux" && process.platform !== "darwin") {
|
|
2960
|
+
try {
|
|
2961
|
+
accessSync(p, constants.X_OK);
|
|
2962
|
+
return true;
|
|
2963
|
+
} catch {
|
|
2964
|
+
return false;
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
const stats = statSync(p);
|
|
2968
|
+
const { mode } = stats;
|
|
2969
|
+
const othersHaveExecutePermission = Boolean(mode & 1);
|
|
2970
|
+
if (othersHaveExecutePermission) {
|
|
2971
|
+
return true;
|
|
2972
|
+
}
|
|
2973
|
+
if (!process.getuid || !process.getgid) {
|
|
2974
|
+
throw new Error("Cannot check permissions on Linux without process.getuid and process.getgid");
|
|
2975
|
+
}
|
|
2976
|
+
const uid = process.getuid();
|
|
2977
|
+
const gid = process.getgid();
|
|
2978
|
+
const isOwner = uid === stats.uid;
|
|
2979
|
+
const isGroup = gid === stats.gid;
|
|
2980
|
+
const ownerHasExecutePermission = Boolean(mode & 64);
|
|
2981
|
+
const groupHasExecutePermission = Boolean(mode & 8);
|
|
2982
|
+
const canExecute = isOwner && ownerHasExecutePermission || isGroup && groupHasExecutePermission;
|
|
2983
|
+
return canExecute;
|
|
2984
|
+
};
|
|
2985
|
+
var makeFileExecutableIfItIsNot = (path2) => {
|
|
2986
|
+
const hasPermissionsResult = hasPermissions(path2);
|
|
2987
|
+
if (!hasPermissionsResult) {
|
|
2988
|
+
chmodSync(path2, 493);
|
|
2989
|
+
}
|
|
2990
|
+
};
|
|
2991
|
+
|
|
2992
|
+
// src/browser/get-download-destination.ts
|
|
2993
|
+
import fs2 from "node:fs";
|
|
2994
|
+
import path2 from "node:path";
|
|
2995
|
+
var getDownloadsCacheDir = () => {
|
|
2996
|
+
const cwd = process.cwd();
|
|
2997
|
+
let dir = cwd;
|
|
2998
|
+
for (;; ) {
|
|
2999
|
+
try {
|
|
3000
|
+
if (fs2.statSync(path2.join(dir, "package.json")).isFile()) {
|
|
3001
|
+
break;
|
|
3002
|
+
}
|
|
3003
|
+
} catch (e) {
|
|
3004
|
+
}
|
|
3005
|
+
const parent = path2.dirname(dir);
|
|
3006
|
+
if (dir === parent) {
|
|
3007
|
+
dir = undefined;
|
|
3008
|
+
break;
|
|
3009
|
+
}
|
|
3010
|
+
dir = parent;
|
|
3011
|
+
}
|
|
3012
|
+
if (!dir) {
|
|
3013
|
+
return path2.resolve(cwd, ".remotion");
|
|
3014
|
+
}
|
|
3015
|
+
if (process.versions.pnp === "1") {
|
|
3016
|
+
return path2.resolve(dir, ".pnp/.remotion");
|
|
3017
|
+
}
|
|
3018
|
+
if (process.versions.pnp === "3") {
|
|
3019
|
+
return path2.resolve(dir, ".yarn/.remotion");
|
|
3020
|
+
}
|
|
3021
|
+
return path2.resolve(dir, "node_modules/.remotion");
|
|
3022
|
+
};
|
|
3023
|
+
|
|
3024
|
+
// src/browser/BrowserFetcher.ts
|
|
3025
|
+
var getChromeDownloadUrl = function({
|
|
3026
|
+
platform: platform2,
|
|
3027
|
+
version: version2
|
|
3028
|
+
}) {
|
|
3029
|
+
if (platform2 === "linux-arm64") {
|
|
3030
|
+
return `https://playwright.azureedge.net/builds/chromium/${version2 ?? PLAYWRIGHT_VERSION}/chromium-linux-arm64.zip`;
|
|
3031
|
+
}
|
|
3032
|
+
return `https://storage.googleapis.com/chrome-for-testing-public/${version2 ?? TESTED_VERSION}/${platform2}/chrome-headless-shell-${platform2}.zip`;
|
|
3033
|
+
};
|
|
3034
|
+
var existsAsync = function(filePath) {
|
|
3035
|
+
return new Promise((resolve2) => {
|
|
3036
|
+
fs3.access(filePath, (err) => {
|
|
3037
|
+
return resolve2(!err);
|
|
3038
|
+
});
|
|
3039
|
+
});
|
|
3040
|
+
};
|
|
3041
|
+
var TESTED_VERSION = "123.0.6312.86";
|
|
3042
|
+
var PLAYWRIGHT_VERSION = "1105";
|
|
3043
|
+
var mkdirAsync = fs3.promises.mkdir;
|
|
3044
|
+
var unlinkAsync = promisify(fs3.unlink.bind(fs3));
|
|
3045
|
+
var getPlatform = () => {
|
|
3046
|
+
const platform2 = os.platform();
|
|
3047
|
+
switch (platform2) {
|
|
3048
|
+
case "darwin":
|
|
3049
|
+
return os.arch() === "arm64" ? "mac-arm64" : "mac-x64";
|
|
3050
|
+
case "linux":
|
|
3051
|
+
return os.arch() === "arm64" ? "linux-arm64" : "linux64";
|
|
3052
|
+
case "win32":
|
|
3053
|
+
return "win64";
|
|
3054
|
+
default:
|
|
3055
|
+
throw new Error("Unsupported platform: " + platform2);
|
|
3056
|
+
}
|
|
3057
|
+
};
|
|
3058
|
+
var destination = "chrome-headless-shell";
|
|
3059
|
+
var getDownloadsFolder = () => {
|
|
3060
|
+
return path3.join(getDownloadsCacheDir(), destination);
|
|
3061
|
+
};
|
|
3062
|
+
var downloadBrowser = async ({
|
|
3063
|
+
logLevel,
|
|
3064
|
+
indent,
|
|
3065
|
+
onProgress,
|
|
3066
|
+
version: version2
|
|
3067
|
+
}) => {
|
|
3068
|
+
const platform2 = getPlatform();
|
|
3069
|
+
const downloadURL = getChromeDownloadUrl({ platform: platform2, version: version2 });
|
|
3070
|
+
const fileName = downloadURL.split("/").pop();
|
|
3071
|
+
if (!fileName) {
|
|
3072
|
+
throw new Error(`A malformed download URL was found: ${downloadURL}.`);
|
|
3073
|
+
}
|
|
3074
|
+
const downloadsFolder = getDownloadsFolder();
|
|
3075
|
+
const archivePath = path3.join(downloadsFolder, fileName);
|
|
3076
|
+
const outputPath = getFolderPath(downloadsFolder, platform2);
|
|
3077
|
+
if (await existsAsync(outputPath)) {
|
|
3078
|
+
return getRevisionInfo();
|
|
3079
|
+
}
|
|
3080
|
+
if (!await existsAsync(downloadsFolder)) {
|
|
3081
|
+
await mkdirAsync(downloadsFolder, {
|
|
3082
|
+
recursive: true
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
if (os.platform() !== "darwin" && os.platform() !== "linux" && os.arch() === "arm64") {
|
|
3086
|
+
throw new Error([
|
|
3087
|
+
"Chrome Headless Shell is not available for Windows for arm64 architecture."
|
|
3088
|
+
].join("\n"));
|
|
3089
|
+
}
|
|
3090
|
+
try {
|
|
3091
|
+
await downloadFile({
|
|
3092
|
+
url: downloadURL,
|
|
3093
|
+
to: () => archivePath,
|
|
3094
|
+
onProgress: (progress) => {
|
|
3095
|
+
if (progress.totalSize === null || progress.percent === null) {
|
|
3096
|
+
throw new Error("Expected totalSize and percent to be defined");
|
|
3097
|
+
}
|
|
3098
|
+
onProgress({
|
|
3099
|
+
downloadedBytes: progress.downloaded,
|
|
3100
|
+
totalSizeInBytes: progress.totalSize,
|
|
3101
|
+
percent: progress.percent
|
|
3102
|
+
});
|
|
3103
|
+
},
|
|
3104
|
+
indent,
|
|
3105
|
+
logLevel
|
|
3106
|
+
});
|
|
3107
|
+
Log.info({ indent, logLevel });
|
|
3108
|
+
await import_extract_zip.default(archivePath, { dir: outputPath });
|
|
3109
|
+
const chromePath = path3.join(outputPath, "chrome-linux", "chrome");
|
|
3110
|
+
const chromeHeadlessShellPath = path3.join(outputPath, "chrome-linux", "chrome-headless-shell");
|
|
3111
|
+
if (fs3.existsSync(chromePath)) {
|
|
3112
|
+
fs3.renameSync(chromePath, chromeHeadlessShellPath);
|
|
3113
|
+
}
|
|
3114
|
+
const chromeLinuxFolder = path3.join(outputPath, "chrome-linux");
|
|
3115
|
+
if (fs3.existsSync(chromeLinuxFolder)) {
|
|
3116
|
+
fs3.renameSync(chromeLinuxFolder, path3.join(outputPath, "chrome-headless-shell-linux-arm64"));
|
|
3117
|
+
}
|
|
3118
|
+
} finally {
|
|
3119
|
+
if (await existsAsync(archivePath)) {
|
|
3120
|
+
await unlinkAsync(archivePath);
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
const revisionInfo = getRevisionInfo();
|
|
3124
|
+
makeFileExecutableIfItIsNot(revisionInfo.executablePath);
|
|
3125
|
+
return revisionInfo;
|
|
3126
|
+
};
|
|
3127
|
+
var getFolderPath = (downloadsFolder, platform2) => {
|
|
3128
|
+
return path3.resolve(downloadsFolder, platform2);
|
|
3129
|
+
};
|
|
3130
|
+
var getExecutablePath = () => {
|
|
3131
|
+
const downloadsFolder = getDownloadsFolder();
|
|
3132
|
+
const platform2 = getPlatform();
|
|
3133
|
+
const folderPath = getFolderPath(downloadsFolder, platform2);
|
|
3134
|
+
return path3.join(folderPath, `chrome-headless-shell-${platform2}`, platform2 === "win64" ? "chrome-headless-shell.exe" : "chrome-headless-shell");
|
|
3135
|
+
};
|
|
3136
|
+
var getRevisionInfo = () => {
|
|
3137
|
+
const executablePath = getExecutablePath();
|
|
3138
|
+
const downloadsFolder = getDownloadsFolder();
|
|
3139
|
+
const platform2 = getPlatform();
|
|
3140
|
+
const folderPath = getFolderPath(downloadsFolder, platform2);
|
|
3141
|
+
const url = getChromeDownloadUrl({ platform: platform2, version: null });
|
|
3142
|
+
const local = fs3.existsSync(folderPath);
|
|
3143
|
+
return {
|
|
3144
|
+
executablePath,
|
|
3145
|
+
folderPath,
|
|
3146
|
+
local,
|
|
3147
|
+
url
|
|
3148
|
+
};
|
|
3149
|
+
};
|
|
3150
|
+
|
|
3151
|
+
// src/to-megabytes.ts
|
|
3152
|
+
function toMegabytes(bytes) {
|
|
3153
|
+
const mb = bytes / 1024 / 1024;
|
|
3154
|
+
return `${Math.round(mb * 10) / 10} Mb`;
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
// src/browser/browser-download-progress-bar.ts
|
|
3158
|
+
var defaultBrowserDownloadProgress = ({
|
|
3159
|
+
indent,
|
|
3160
|
+
logLevel,
|
|
3161
|
+
api
|
|
3162
|
+
}) => () => {
|
|
3163
|
+
Log.info({ indent, logLevel }, "No local browser could be found.");
|
|
3164
|
+
Log.info({ indent, logLevel }, "Downloading Chrome Headless Shell https://www.remotion.dev/docs/miscellaneous/chrome-headless-shell");
|
|
3165
|
+
Log.info({ indent, logLevel }, `Customize this behavior by adding a onBrowserDownload function to ${api}.`);
|
|
3166
|
+
return {
|
|
3167
|
+
onProgress: (progress) => {
|
|
3168
|
+
let lastProgress = 0;
|
|
3169
|
+
if (progress.downloadedBytes > lastProgress + 1e7) {
|
|
3170
|
+
lastProgress = progress.downloadedBytes;
|
|
3171
|
+
Log.info({ indent, logLevel }, `Downloading Chrome Headless Shell - ${toMegabytes(progress.downloadedBytes)}/${toMegabytes(progress.totalSizeInBytes)}`);
|
|
3172
|
+
}
|
|
3173
|
+
},
|
|
3174
|
+
version: null
|
|
3175
|
+
};
|
|
3176
|
+
};
|
|
3177
|
+
|
|
3178
|
+
// src/get-local-browser.ts
|
|
3179
|
+
import fs4 from "fs";
|
|
3180
|
+
import {homedir} from "node:os";
|
|
3181
|
+
|
|
3182
|
+
// /Users/jonathanburger/remotion/packages/renderer/node_modules/remotion/dist/esm/no-react.mjs
|
|
3183
|
+
var interpolate = function(input, inputRange, outputRange, options) {
|
|
3184
|
+
if (typeof input === "undefined") {
|
|
3185
|
+
throw new Error("input can not be undefined");
|
|
3186
|
+
}
|
|
3187
|
+
if (typeof inputRange === "undefined") {
|
|
3188
|
+
throw new Error("inputRange can not be undefined");
|
|
3189
|
+
}
|
|
3190
|
+
if (typeof outputRange === "undefined") {
|
|
3191
|
+
throw new Error("outputRange can not be undefined");
|
|
3192
|
+
}
|
|
3193
|
+
if (inputRange.length !== outputRange.length) {
|
|
3194
|
+
throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
|
|
3195
|
+
}
|
|
3196
|
+
checkInfiniteRange("inputRange", inputRange);
|
|
3197
|
+
checkInfiniteRange("outputRange", outputRange);
|
|
3198
|
+
checkValidInputRange(inputRange);
|
|
3199
|
+
const easing = options?.easing ?? ((num) => num);
|
|
3200
|
+
let extrapolateLeft = "extend";
|
|
3201
|
+
if (options?.extrapolateLeft !== undefined) {
|
|
3202
|
+
extrapolateLeft = options.extrapolateLeft;
|
|
3203
|
+
}
|
|
3204
|
+
let extrapolateRight = "extend";
|
|
3205
|
+
if (options?.extrapolateRight !== undefined) {
|
|
3206
|
+
extrapolateRight = options.extrapolateRight;
|
|
3207
|
+
}
|
|
3208
|
+
if (typeof input !== "number") {
|
|
3209
|
+
throw new TypeError("Cannot interpolate an input which is not a number");
|
|
3210
|
+
}
|
|
3211
|
+
const range = findRange(input, inputRange);
|
|
3212
|
+
return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
|
|
3213
|
+
easing,
|
|
3214
|
+
extrapolateLeft,
|
|
3215
|
+
extrapolateRight
|
|
3216
|
+
});
|
|
3217
|
+
};
|
|
3218
|
+
var truthy4 = function(value) {
|
|
3219
|
+
return Boolean(value);
|
|
3220
|
+
};
|
|
3221
|
+
var processColor = function(color) {
|
|
3222
|
+
const normalizedColor = normalizeColor(color);
|
|
3223
|
+
return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
|
|
3224
|
+
};
|
|
3225
|
+
var validateDimension = function(amount, nameOfProp, location) {
|
|
3226
|
+
if (typeof amount !== "number") {
|
|
3227
|
+
throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
|
|
3228
|
+
}
|
|
3229
|
+
if (isNaN(amount)) {
|
|
3230
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`);
|
|
3231
|
+
}
|
|
3232
|
+
if (!Number.isFinite(amount)) {
|
|
3233
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`);
|
|
3234
|
+
}
|
|
3235
|
+
if (amount % 1 !== 0) {
|
|
3236
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`);
|
|
3237
|
+
}
|
|
3238
|
+
if (amount <= 0) {
|
|
3239
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`);
|
|
3240
|
+
}
|
|
3241
|
+
};
|
|
3242
|
+
var validateDurationInFrames = function(durationInFrames, options) {
|
|
3243
|
+
const { allowFloats, component } = options;
|
|
3244
|
+
if (typeof durationInFrames === "undefined") {
|
|
3245
|
+
throw new Error(`The "durationInFrames" prop ${component} is missing.`);
|
|
3246
|
+
}
|
|
3247
|
+
if (typeof durationInFrames !== "number") {
|
|
3248
|
+
throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
|
|
3249
|
+
}
|
|
3250
|
+
if (durationInFrames <= 0) {
|
|
3251
|
+
throw new TypeError(`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`);
|
|
3252
|
+
}
|
|
3253
|
+
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
3254
|
+
throw new TypeError(`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`);
|
|
3255
|
+
}
|
|
3256
|
+
if (!Number.isFinite(durationInFrames)) {
|
|
3257
|
+
throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
|
|
3258
|
+
}
|
|
3259
|
+
};
|
|
3260
|
+
var validateFps = function(fps, location, isGif) {
|
|
3261
|
+
if (typeof fps !== "number") {
|
|
3262
|
+
throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
|
|
3263
|
+
}
|
|
3264
|
+
if (!Number.isFinite(fps)) {
|
|
3265
|
+
throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
|
|
3266
|
+
}
|
|
3267
|
+
if (isNaN(fps)) {
|
|
3268
|
+
throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
|
|
3269
|
+
}
|
|
3270
|
+
if (fps <= 0) {
|
|
3271
|
+
throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
|
|
3272
|
+
}
|
|
3273
|
+
if (isGif && fps > 50) {
|
|
3274
|
+
throw new TypeError(`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`);
|
|
3275
|
+
}
|
|
3276
|
+
};
|
|
3277
|
+
var interpolateFunction = function(input, inputRange, outputRange, options) {
|
|
3278
|
+
const { extrapolateLeft, extrapolateRight, easing } = options;
|
|
3279
|
+
let result = input;
|
|
3280
|
+
const [inputMin, inputMax] = inputRange;
|
|
3281
|
+
const [outputMin, outputMax] = outputRange;
|
|
3282
|
+
if (result < inputMin) {
|
|
3283
|
+
if (extrapolateLeft === "identity") {
|
|
3284
|
+
return result;
|
|
3285
|
+
}
|
|
3286
|
+
if (extrapolateLeft === "clamp") {
|
|
3287
|
+
result = inputMin;
|
|
3288
|
+
} else if (extrapolateLeft === "wrap") {
|
|
3289
|
+
const range = inputMax - inputMin;
|
|
3290
|
+
result = ((result - inputMin) % range + range) % range + inputMin;
|
|
3291
|
+
} else if (extrapolateLeft === "extend") {
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
if (result > inputMax) {
|
|
3295
|
+
if (extrapolateRight === "identity") {
|
|
3296
|
+
return result;
|
|
3297
|
+
}
|
|
3298
|
+
if (extrapolateRight === "clamp") {
|
|
3299
|
+
result = inputMax;
|
|
3300
|
+
} else if (extrapolateRight === "wrap") {
|
|
3301
|
+
const range = inputMax - inputMin;
|
|
3302
|
+
result = ((result - inputMin) % range + range) % range + inputMin;
|
|
3303
|
+
} else if (extrapolateRight === "extend") {
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
if (outputMin === outputMax) {
|
|
3307
|
+
return outputMin;
|
|
3308
|
+
}
|
|
3309
|
+
result = (result - inputMin) / (inputMax - inputMin);
|
|
3310
|
+
result = easing(result);
|
|
3311
|
+
result = result * (outputMax - outputMin) + outputMin;
|
|
3312
|
+
return result;
|
|
3313
|
+
};
|
|
3314
|
+
var findRange = function(input, inputRange) {
|
|
3315
|
+
let i;
|
|
3316
|
+
for (i = 1;i < inputRange.length - 1; ++i) {
|
|
3317
|
+
if (inputRange[i] >= input) {
|
|
3318
|
+
break;
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
return i - 1;
|
|
3322
|
+
};
|
|
3323
|
+
var checkValidInputRange = function(arr) {
|
|
3324
|
+
for (let i = 1;i < arr.length; ++i) {
|
|
3325
|
+
if (!(arr[i] > arr[i - 1])) {
|
|
3326
|
+
throw new Error(`inputRange must be strictly monotonically increasing but got [${arr.join(",")}]`);
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
};
|
|
3330
|
+
var checkInfiniteRange = function(name, arr) {
|
|
3331
|
+
if (arr.length < 2) {
|
|
3332
|
+
throw new Error(name + " must have at least 2 elements");
|
|
3333
|
+
}
|
|
3334
|
+
for (const element of arr) {
|
|
3335
|
+
if (typeof element !== "number") {
|
|
3336
|
+
throw new Error(`${name} must contain only numbers`);
|
|
3337
|
+
}
|
|
3338
|
+
if (!Number.isFinite(element)) {
|
|
3339
|
+
throw new Error(`${name} must contain only finite numbers, but got [${arr.join(",")}]`);
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
};
|
|
3343
|
+
if (typeof window !== "undefined") {
|
|
3344
|
+
window.remotion_renderReady = false;
|
|
3345
|
+
}
|
|
3346
|
+
if (typeof window !== "undefined") {
|
|
3347
|
+
window.remotion_delayRenderTimeouts = {};
|
|
3348
|
+
}
|
|
3349
|
+
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
3350
|
+
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
3351
|
+
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
3352
|
+
var problematicCharacters = {
|
|
3353
|
+
"%3A": ":",
|
|
3354
|
+
"%2F": "/",
|
|
3355
|
+
"%3F": "?",
|
|
3356
|
+
"%23": "#",
|
|
3357
|
+
"%5B": "[",
|
|
3358
|
+
"%5D": "]",
|
|
3359
|
+
"%40": "@",
|
|
3360
|
+
"%21": "!",
|
|
3361
|
+
"%24": "$",
|
|
3362
|
+
"%26": "&",
|
|
3363
|
+
"%27": "'",
|
|
3364
|
+
"%28": "(",
|
|
3365
|
+
"%29": ")",
|
|
3366
|
+
"%2A": "*",
|
|
3367
|
+
"%2B": "+",
|
|
3368
|
+
"%2C": ",",
|
|
3369
|
+
"%3B": ";"
|
|
3370
|
+
};
|
|
3371
|
+
var didWarn = {};
|
|
3372
|
+
var warnOnce = (message) => {
|
|
3373
|
+
if (didWarn[message]) {
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3376
|
+
console.warn(message);
|
|
3377
|
+
didWarn[message] = true;
|
|
3378
|
+
};
|
|
3379
|
+
var includesHexOfUnsafeChar = (path4) => {
|
|
3380
|
+
for (const key of Object.keys(problematicCharacters)) {
|
|
3381
|
+
if (path4.includes(key)) {
|
|
3382
|
+
return { containsHex: true, hexCode: key };
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
return { containsHex: false };
|
|
3386
|
+
};
|
|
3387
|
+
var trimLeadingSlash = (path4) => {
|
|
3388
|
+
if (path4.startsWith("/")) {
|
|
3389
|
+
return trimLeadingSlash(path4.substring(1));
|
|
3390
|
+
}
|
|
3391
|
+
return path4;
|
|
3392
|
+
};
|
|
3393
|
+
var inner = (path4) => {
|
|
3394
|
+
if (typeof window !== "undefined" && window.remotion_staticBase) {
|
|
3395
|
+
if (path4.startsWith(window.remotion_staticBase)) {
|
|
3396
|
+
throw new Error(`The value "${path4}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`);
|
|
3397
|
+
}
|
|
3398
|
+
return `${window.remotion_staticBase}/${trimLeadingSlash(path4)}`;
|
|
3399
|
+
}
|
|
3400
|
+
return `/${trimLeadingSlash(path4)}`;
|
|
3401
|
+
};
|
|
3402
|
+
var encodeBySplitting = (path4) => {
|
|
3403
|
+
const splitBySlash = path4.split("/");
|
|
3404
|
+
const encodedArray = splitBySlash.map((element) => {
|
|
3405
|
+
return encodeURIComponent(element);
|
|
3406
|
+
});
|
|
3407
|
+
const merged = encodedArray.join("/");
|
|
3408
|
+
return merged;
|
|
3409
|
+
};
|
|
3410
|
+
var staticFile = (path4) => {
|
|
3411
|
+
if (path4.startsWith("http://") || path4.startsWith("https://")) {
|
|
3412
|
+
throw new TypeError(`staticFile() does not support remote URLs - got "${path4}". Instead, pass the URL without wrapping it in staticFile(). See: https://remotion.dev/docs/staticfile-remote-urls`);
|
|
3413
|
+
}
|
|
3414
|
+
if (path4.startsWith("..") || path4.startsWith("./")) {
|
|
3415
|
+
throw new TypeError(`staticFile() does not support relative paths - got "${path4}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
3416
|
+
}
|
|
3417
|
+
if (path4.startsWith("/Users") || path4.startsWith("/home") || path4.startsWith("/tmp") || path4.startsWith("/etc") || path4.startsWith("/opt") || path4.startsWith("/var") || path4.startsWith("C:") || path4.startsWith("D:") || path4.startsWith("E:")) {
|
|
3418
|
+
throw new TypeError(`staticFile() does not support absolute paths - got "${path4}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
3419
|
+
}
|
|
3420
|
+
if (path4.startsWith("public/")) {
|
|
3421
|
+
throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${path4}". See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
3422
|
+
}
|
|
3423
|
+
const includesHex = includesHexOfUnsafeChar(path4);
|
|
3424
|
+
if (includesHex.containsHex) {
|
|
3425
|
+
warnOnce(`WARNING: You seem to pass an already encoded path (path contains ${includesHex.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);
|
|
3426
|
+
}
|
|
3427
|
+
const preprocessed = encodeBySplitting(path4);
|
|
3428
|
+
const preparsed = inner(preprocessed);
|
|
3429
|
+
if (!preparsed.startsWith("/")) {
|
|
3430
|
+
return `/${preparsed}`;
|
|
3431
|
+
}
|
|
3432
|
+
return preparsed;
|
|
3433
|
+
};
|
|
3434
|
+
var DATE_TOKEN = "remotion-date:";
|
|
3435
|
+
var FILE_TOKEN = "remotion-file:";
|
|
3436
|
+
var serializeJSONWithDate = ({
|
|
3437
|
+
data,
|
|
3438
|
+
indent,
|
|
3439
|
+
staticBase
|
|
3440
|
+
}) => {
|
|
3441
|
+
let customDateUsed = false;
|
|
3442
|
+
let customFileUsed = false;
|
|
3443
|
+
let mapUsed = false;
|
|
3444
|
+
let setUsed = false;
|
|
3445
|
+
try {
|
|
3446
|
+
const serializedString = JSON.stringify(data, function(key, value) {
|
|
3447
|
+
const item = this[key];
|
|
3448
|
+
if (item instanceof Date) {
|
|
3449
|
+
customDateUsed = true;
|
|
3450
|
+
return `${DATE_TOKEN}${item.toISOString()}`;
|
|
3451
|
+
}
|
|
3452
|
+
if (item instanceof Map) {
|
|
3453
|
+
mapUsed = true;
|
|
3454
|
+
return value;
|
|
3455
|
+
}
|
|
3456
|
+
if (item instanceof Set) {
|
|
3457
|
+
setUsed = true;
|
|
3458
|
+
return value;
|
|
3459
|
+
}
|
|
3460
|
+
if (typeof item === "string" && staticBase !== null && item.startsWith(staticBase)) {
|
|
3461
|
+
customFileUsed = true;
|
|
3462
|
+
return `${FILE_TOKEN}${item.replace(staticBase + "/", "")}`;
|
|
3463
|
+
}
|
|
3464
|
+
return value;
|
|
3465
|
+
}, indent);
|
|
3466
|
+
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
3467
|
+
} catch (err) {
|
|
3468
|
+
throw new Error("Could not serialize the passed input props to JSON: " + err.message);
|
|
3469
|
+
}
|
|
3470
|
+
};
|
|
3471
|
+
var deserializeJSONWithCustomFields = (data) => {
|
|
3472
|
+
return JSON.parse(data, (_, value) => {
|
|
3473
|
+
if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
|
|
3474
|
+
return new Date(value.replace(DATE_TOKEN, ""));
|
|
3475
|
+
}
|
|
3476
|
+
if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
|
|
3477
|
+
return staticFile(value.replace(FILE_TOKEN, ""));
|
|
3478
|
+
}
|
|
3479
|
+
return value;
|
|
3480
|
+
});
|
|
3481
|
+
};
|
|
3482
|
+
var call = function(...args) {
|
|
3483
|
+
return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
|
|
3484
|
+
};
|
|
3485
|
+
var getMatchers = function() {
|
|
3486
|
+
const cachedMatchers = {
|
|
3487
|
+
rgb: undefined,
|
|
3488
|
+
rgba: undefined,
|
|
3489
|
+
hsl: undefined,
|
|
3490
|
+
hsla: undefined,
|
|
3491
|
+
hex3: undefined,
|
|
3492
|
+
hex4: undefined,
|
|
3493
|
+
hex5: undefined,
|
|
3494
|
+
hex6: undefined,
|
|
3495
|
+
hex8: undefined
|
|
3496
|
+
};
|
|
3497
|
+
if (cachedMatchers.rgb === undefined) {
|
|
3498
|
+
cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
|
|
3499
|
+
cachedMatchers.rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
3500
|
+
cachedMatchers.hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
|
3501
|
+
cachedMatchers.hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
|
3502
|
+
cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3503
|
+
cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3504
|
+
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
3505
|
+
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
3506
|
+
}
|
|
3507
|
+
return cachedMatchers;
|
|
3508
|
+
};
|
|
3509
|
+
var hue2rgb = function(p, q, t) {
|
|
3510
|
+
if (t < 0) {
|
|
3511
|
+
t += 1;
|
|
3512
|
+
}
|
|
3513
|
+
if (t > 1) {
|
|
3514
|
+
t -= 1;
|
|
3515
|
+
}
|
|
3516
|
+
if (t < 1 / 6) {
|
|
3517
|
+
return p + (q - p) * 6 * t;
|
|
3518
|
+
}
|
|
3519
|
+
if (t < 1 / 2) {
|
|
3520
|
+
return q;
|
|
3521
|
+
}
|
|
3522
|
+
if (t < 2 / 3) {
|
|
3523
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
3524
|
+
}
|
|
3525
|
+
return p;
|
|
3526
|
+
};
|
|
3527
|
+
var hslToRgb = function(h, s, l) {
|
|
3528
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
3529
|
+
const p = 2 * l - q;
|
|
3530
|
+
const r = hue2rgb(p, q, h + 1 / 3);
|
|
3531
|
+
const g = hue2rgb(p, q, h);
|
|
3532
|
+
const b = hue2rgb(p, q, h - 1 / 3);
|
|
3533
|
+
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
|
3534
|
+
};
|
|
3535
|
+
var parse255 = function(str) {
|
|
3536
|
+
const int = Number.parseInt(str, 10);
|
|
3537
|
+
if (int < 0) {
|
|
3538
|
+
return 0;
|
|
3539
|
+
}
|
|
3540
|
+
if (int > 255) {
|
|
3541
|
+
return 255;
|
|
3542
|
+
}
|
|
3543
|
+
return int;
|
|
3544
|
+
};
|
|
3545
|
+
var parse360 = function(str) {
|
|
3546
|
+
const int = Number.parseFloat(str);
|
|
3547
|
+
return (int % 360 + 360) % 360 / 360;
|
|
3548
|
+
};
|
|
3549
|
+
var parse1 = function(str) {
|
|
3550
|
+
const num = Number.parseFloat(str);
|
|
3551
|
+
if (num < 0) {
|
|
3552
|
+
return 0;
|
|
3553
|
+
}
|
|
3554
|
+
if (num > 1) {
|
|
3555
|
+
return 255;
|
|
3556
|
+
}
|
|
3557
|
+
return Math.round(num * 255);
|
|
3558
|
+
};
|
|
3559
|
+
var parsePercentage = function(str) {
|
|
3560
|
+
const int = Number.parseFloat(str);
|
|
3561
|
+
if (int < 0) {
|
|
3562
|
+
return 0;
|
|
3563
|
+
}
|
|
3564
|
+
if (int > 100) {
|
|
3565
|
+
return 1;
|
|
3566
|
+
}
|
|
3567
|
+
return int / 100;
|
|
3568
|
+
};
|
|
3569
|
+
var normalizeColor = function(color) {
|
|
3570
|
+
const matchers = getMatchers();
|
|
3571
|
+
let match;
|
|
3572
|
+
if (matchers.hex6) {
|
|
3573
|
+
if (match = matchers.hex6.exec(color)) {
|
|
3574
|
+
return Number.parseInt(match[1] + "ff", 16) >>> 0;
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
if (colorNames[color] !== undefined) {
|
|
3578
|
+
return colorNames[color];
|
|
3579
|
+
}
|
|
3580
|
+
if (matchers.rgb) {
|
|
3581
|
+
if (match = matchers.rgb.exec(color)) {
|
|
3582
|
+
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0;
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
if (matchers.rgba) {
|
|
3586
|
+
if (match = matchers.rgba.exec(color)) {
|
|
3587
|
+
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
if (matchers.hex3) {
|
|
3591
|
+
if (match = matchers.hex3.exec(color)) {
|
|
3592
|
+
return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", 16) >>> 0;
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
if (matchers.hex8) {
|
|
3596
|
+
if (match = matchers.hex8.exec(color)) {
|
|
3597
|
+
return Number.parseInt(match[1], 16) >>> 0;
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
if (matchers.hex4) {
|
|
3601
|
+
if (match = matchers.hex4.exec(color)) {
|
|
3602
|
+
return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3605
|
+
if (matchers.hsl) {
|
|
3606
|
+
if (match = matchers.hsl.exec(color)) {
|
|
3607
|
+
return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 255) >>> 0;
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
if (matchers.hsla) {
|
|
3611
|
+
if (match = matchers.hsla.exec(color)) {
|
|
3612
|
+
return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
throw new Error(`invalid color string ${color} provided`);
|
|
3616
|
+
};
|
|
3617
|
+
var NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
3618
|
+
var PERCENTAGE = NUMBER + "%";
|
|
3619
|
+
var colorNames = {
|
|
3620
|
+
transparent: 0,
|
|
3621
|
+
aliceblue: 4042850303,
|
|
3622
|
+
antiquewhite: 4209760255,
|
|
3623
|
+
aqua: 16777215,
|
|
3624
|
+
aquamarine: 2147472639,
|
|
3625
|
+
azure: 4043309055,
|
|
3626
|
+
beige: 4126530815,
|
|
3627
|
+
bisque: 4293182719,
|
|
3628
|
+
black: 255,
|
|
3629
|
+
blanchedalmond: 4293643775,
|
|
3630
|
+
blue: 65535,
|
|
3631
|
+
blueviolet: 2318131967,
|
|
3632
|
+
brown: 2771004159,
|
|
3633
|
+
burlywood: 3736635391,
|
|
3634
|
+
burntsienna: 3934150143,
|
|
3635
|
+
cadetblue: 1604231423,
|
|
3636
|
+
chartreuse: 2147418367,
|
|
3637
|
+
chocolate: 3530104575,
|
|
3638
|
+
coral: 4286533887,
|
|
3639
|
+
cornflowerblue: 1687547391,
|
|
3640
|
+
cornsilk: 4294499583,
|
|
3641
|
+
crimson: 3692313855,
|
|
3642
|
+
cyan: 16777215,
|
|
3643
|
+
darkblue: 35839,
|
|
3644
|
+
darkcyan: 9145343,
|
|
3645
|
+
darkgoldenrod: 3095792639,
|
|
3646
|
+
darkgray: 2846468607,
|
|
3647
|
+
darkgreen: 6553855,
|
|
3648
|
+
darkgrey: 2846468607,
|
|
3649
|
+
darkkhaki: 3182914559,
|
|
3650
|
+
darkmagenta: 2332068863,
|
|
3651
|
+
darkolivegreen: 1433087999,
|
|
3652
|
+
darkorange: 4287365375,
|
|
3653
|
+
darkorchid: 2570243327,
|
|
3654
|
+
darkred: 2332033279,
|
|
3655
|
+
darksalmon: 3918953215,
|
|
3656
|
+
darkseagreen: 2411499519,
|
|
3657
|
+
darkslateblue: 1211993087,
|
|
3658
|
+
darkslategray: 793726975,
|
|
3659
|
+
darkslategrey: 793726975,
|
|
3660
|
+
darkturquoise: 13554175,
|
|
3661
|
+
darkviolet: 2483082239,
|
|
3662
|
+
deeppink: 4279538687,
|
|
3663
|
+
deepskyblue: 12582911,
|
|
3664
|
+
dimgray: 1768516095,
|
|
3665
|
+
dimgrey: 1768516095,
|
|
3666
|
+
dodgerblue: 512819199,
|
|
3667
|
+
firebrick: 2988581631,
|
|
3668
|
+
floralwhite: 4294635775,
|
|
3669
|
+
forestgreen: 579543807,
|
|
3670
|
+
fuchsia: 4278255615,
|
|
3671
|
+
gainsboro: 3705462015,
|
|
3672
|
+
ghostwhite: 4177068031,
|
|
3673
|
+
gold: 4292280575,
|
|
3674
|
+
goldenrod: 3668254975,
|
|
3675
|
+
gray: 2155905279,
|
|
3676
|
+
green: 8388863,
|
|
3677
|
+
greenyellow: 2919182335,
|
|
3678
|
+
grey: 2155905279,
|
|
3679
|
+
honeydew: 4043305215,
|
|
3680
|
+
hotpink: 4285117695,
|
|
3681
|
+
indianred: 3445382399,
|
|
3682
|
+
indigo: 1258324735,
|
|
3683
|
+
ivory: 4294963455,
|
|
3684
|
+
khaki: 4041641215,
|
|
3685
|
+
lavender: 3873897215,
|
|
3686
|
+
lavenderblush: 4293981695,
|
|
3687
|
+
lawngreen: 2096890111,
|
|
3688
|
+
lemonchiffon: 4294626815,
|
|
3689
|
+
lightblue: 2916673279,
|
|
3690
|
+
lightcoral: 4034953471,
|
|
3691
|
+
lightcyan: 3774873599,
|
|
3692
|
+
lightgoldenrodyellow: 4210742015,
|
|
3693
|
+
lightgray: 3553874943,
|
|
3694
|
+
lightgreen: 2431553791,
|
|
3695
|
+
lightgrey: 3553874943,
|
|
3696
|
+
lightpink: 4290167295,
|
|
3697
|
+
lightsalmon: 4288707327,
|
|
3698
|
+
lightseagreen: 548580095,
|
|
3699
|
+
lightskyblue: 2278488831,
|
|
3700
|
+
lightslategray: 2005441023,
|
|
3701
|
+
lightslategrey: 2005441023,
|
|
3702
|
+
lightsteelblue: 2965692159,
|
|
3703
|
+
lightyellow: 4294959359,
|
|
3704
|
+
lime: 16711935,
|
|
3705
|
+
limegreen: 852308735,
|
|
3706
|
+
linen: 4210091775,
|
|
3707
|
+
magenta: 4278255615,
|
|
3708
|
+
maroon: 2147483903,
|
|
3709
|
+
mediumaquamarine: 1724754687,
|
|
3710
|
+
mediumblue: 52735,
|
|
3711
|
+
mediumorchid: 3126187007,
|
|
3712
|
+
mediumpurple: 2473647103,
|
|
3713
|
+
mediumseagreen: 1018393087,
|
|
3714
|
+
mediumslateblue: 2070474495,
|
|
3715
|
+
mediumspringgreen: 16423679,
|
|
3716
|
+
mediumturquoise: 1221709055,
|
|
3717
|
+
mediumvioletred: 3340076543,
|
|
3718
|
+
midnightblue: 421097727,
|
|
3719
|
+
mintcream: 4127193855,
|
|
3720
|
+
mistyrose: 4293190143,
|
|
3721
|
+
moccasin: 4293178879,
|
|
3722
|
+
navajowhite: 4292783615,
|
|
3723
|
+
navy: 33023,
|
|
3724
|
+
oldlace: 4260751103,
|
|
3725
|
+
olive: 2155872511,
|
|
3726
|
+
olivedrab: 1804477439,
|
|
3727
|
+
orange: 4289003775,
|
|
3728
|
+
orangered: 4282712319,
|
|
3729
|
+
orchid: 3664828159,
|
|
3730
|
+
palegoldenrod: 4008225535,
|
|
3731
|
+
palegreen: 2566625535,
|
|
3732
|
+
paleturquoise: 2951671551,
|
|
3733
|
+
palevioletred: 3681588223,
|
|
3734
|
+
papayawhip: 4293907967,
|
|
3735
|
+
peachpuff: 4292524543,
|
|
3736
|
+
peru: 3448061951,
|
|
3737
|
+
pink: 4290825215,
|
|
3738
|
+
plum: 3718307327,
|
|
3739
|
+
powderblue: 2967529215,
|
|
3740
|
+
purple: 2147516671,
|
|
3741
|
+
rebeccapurple: 1714657791,
|
|
3742
|
+
red: 4278190335,
|
|
3743
|
+
rosybrown: 3163525119,
|
|
3744
|
+
royalblue: 1097458175,
|
|
3745
|
+
saddlebrown: 2336560127,
|
|
3746
|
+
salmon: 4202722047,
|
|
3747
|
+
sandybrown: 4104413439,
|
|
3748
|
+
seagreen: 780883967,
|
|
3749
|
+
seashell: 4294307583,
|
|
3750
|
+
sienna: 2689740287,
|
|
3751
|
+
silver: 3233857791,
|
|
3752
|
+
skyblue: 2278484991,
|
|
3753
|
+
slateblue: 1784335871,
|
|
3754
|
+
slategray: 1887473919,
|
|
3755
|
+
slategrey: 1887473919,
|
|
3756
|
+
snow: 4294638335,
|
|
3757
|
+
springgreen: 16744447,
|
|
3758
|
+
steelblue: 1182971135,
|
|
3759
|
+
tan: 3535047935,
|
|
3760
|
+
teal: 8421631,
|
|
3761
|
+
thistle: 3636451583,
|
|
3762
|
+
tomato: 4284696575,
|
|
3763
|
+
turquoise: 1088475391,
|
|
3764
|
+
violet: 4001558271,
|
|
3765
|
+
wheat: 4125012991,
|
|
3766
|
+
white: 4294967295,
|
|
3767
|
+
whitesmoke: 4126537215,
|
|
3768
|
+
yellow: 4294902015,
|
|
3769
|
+
yellowgreen: 2597139199
|
|
3770
|
+
};
|
|
3771
|
+
var ENABLE_V5_BREAKING_CHANGES = false;
|
|
3772
|
+
var validateFrame = ({
|
|
3773
|
+
allowFloats,
|
|
3774
|
+
durationInFrames,
|
|
3775
|
+
frame
|
|
3776
|
+
}) => {
|
|
3777
|
+
if (typeof frame === "undefined") {
|
|
3778
|
+
throw new TypeError(`Argument missing for parameter "frame"`);
|
|
3779
|
+
}
|
|
3780
|
+
if (typeof frame !== "number") {
|
|
3781
|
+
throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
|
3782
|
+
}
|
|
3783
|
+
if (!Number.isFinite(frame)) {
|
|
3784
|
+
throw new RangeError(`Frame ${frame} is not finite`);
|
|
3785
|
+
}
|
|
3786
|
+
if (frame % 1 !== 0 && !allowFloats) {
|
|
3787
|
+
throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
|
3788
|
+
}
|
|
3789
|
+
if (frame < 0 && frame < -durationInFrames) {
|
|
3790
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
|
|
3791
|
+
}
|
|
3792
|
+
if (frame > durationInFrames - 1) {
|
|
3793
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
3794
|
+
}
|
|
3795
|
+
};
|
|
3796
|
+
var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
3797
|
+
if (!defaultProps) {
|
|
3798
|
+
return;
|
|
3799
|
+
}
|
|
3800
|
+
if (typeof defaultProps !== "object") {
|
|
3801
|
+
throw new Error(`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`);
|
|
3802
|
+
}
|
|
3803
|
+
if (Array.isArray(defaultProps)) {
|
|
3804
|
+
throw new Error(`"${name}" must be an object, an array was passed ${compositionId ? `for composition "${compositionId}"` : ""}`);
|
|
3805
|
+
}
|
|
3806
|
+
};
|
|
3807
|
+
var getExpectedMediaFrameUncorrected = ({
|
|
3808
|
+
frame,
|
|
3809
|
+
playbackRate,
|
|
3810
|
+
startFrom
|
|
3811
|
+
}) => {
|
|
3812
|
+
return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
3813
|
+
};
|
|
3814
|
+
var getAbsoluteSrc = (relativeSrc) => {
|
|
3815
|
+
if (typeof window === "undefined") {
|
|
3816
|
+
return relativeSrc;
|
|
3817
|
+
}
|
|
3818
|
+
return new URL(relativeSrc, window.origin).href;
|
|
3819
|
+
};
|
|
3820
|
+
var getOffthreadVideoSource = ({
|
|
3821
|
+
src,
|
|
3822
|
+
transparent,
|
|
3823
|
+
currentTime,
|
|
3824
|
+
toneMapped
|
|
3825
|
+
}) => {
|
|
3826
|
+
return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}&toneMapped=${String(toneMapped)}`;
|
|
3827
|
+
};
|
|
3828
|
+
var NoReactInternals = {
|
|
3829
|
+
processColor,
|
|
3830
|
+
truthy: truthy4,
|
|
3831
|
+
validateFps,
|
|
3832
|
+
validateDimension,
|
|
3833
|
+
validateDurationInFrames,
|
|
3834
|
+
validateDefaultAndInputProps,
|
|
3835
|
+
validateFrame,
|
|
3836
|
+
serializeJSONWithDate,
|
|
3837
|
+
bundleName: "bundle.js",
|
|
3838
|
+
bundleMapName: "bundle.js.map",
|
|
3839
|
+
deserializeJSONWithCustomFields,
|
|
3840
|
+
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
3841
|
+
DELAY_RENDER_RETRY_TOKEN,
|
|
3842
|
+
DELAY_RENDER_ATTEMPT_TOKEN: DELAY_RENDER_RETRIES_LEFT,
|
|
3843
|
+
getOffthreadVideoSource,
|
|
3844
|
+
getExpectedMediaFrameUncorrected,
|
|
3845
|
+
ENABLE_V5_BREAKING_CHANGES,
|
|
3846
|
+
MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES ? 18 : 16,
|
|
3847
|
+
MIN_BUN_VERSION: ENABLE_V5_BREAKING_CHANGES ? "1.1.3" : "1.0.3",
|
|
3848
|
+
colorNames,
|
|
3849
|
+
DATE_TOKEN,
|
|
3850
|
+
FILE_TOKEN
|
|
3851
|
+
};
|
|
3852
|
+
|
|
3853
|
+
// src/get-local-browser.ts
|
|
3854
|
+
var getSearchPathsForProduct = () => {
|
|
3855
|
+
if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES) {
|
|
3856
|
+
return [];
|
|
3857
|
+
}
|
|
3858
|
+
return [
|
|
3859
|
+
process.env.PUPPETEER_EXECUTABLE_PATH ?? null,
|
|
3860
|
+
process.platform === "darwin" ? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" : null,
|
|
3861
|
+
process.platform === "linux" ? "/usr/bin/google-chrome" : null,
|
|
3862
|
+
process.platform === "linux" ? "/usr/bin/chromium-browser" : null,
|
|
3863
|
+
process.platform === "linux" ? "/usr/bin/chromium" : null,
|
|
3864
|
+
process.platform === "linux" ? "/app/.apt/usr/bin/google-chrome-stable" : null,
|
|
3865
|
+
process.platform === "win32" ? "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" : null,
|
|
3866
|
+
process.platform === "win32" ? "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" : null,
|
|
3867
|
+
process.platform === "win32" ? homedir() + "\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe" : null,
|
|
3868
|
+
process.platform === "win32" ? "C:\\Program Files\\Google\\Chrome SxS\\Application\\chrome.exe" : null,
|
|
3869
|
+
process.platform === "win32" ? "C:\\Program Files (x86)\\Google\\Chrome SxS\\Application\\chrome.exe" : null,
|
|
3870
|
+
process.platform === "win32" ? homedir() + "\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe" : null
|
|
3871
|
+
].filter(Boolean);
|
|
3872
|
+
};
|
|
3873
|
+
var getLocalBrowser = () => {
|
|
3874
|
+
for (const p of getSearchPathsForProduct()) {
|
|
3875
|
+
if (fs4.existsSync(p)) {
|
|
3876
|
+
return p;
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
return null;
|
|
3880
|
+
};
|
|
3881
|
+
|
|
3882
|
+
// src/ensure-browser.ts
|
|
3883
|
+
var internalEnsureBrowser = async ({
|
|
3884
|
+
indent,
|
|
3885
|
+
logLevel,
|
|
3886
|
+
browserExecutable,
|
|
3887
|
+
onBrowserDownload
|
|
3888
|
+
}) => {
|
|
3889
|
+
const status = getBrowserStatus(browserExecutable);
|
|
3890
|
+
if (status.type === "no-browser") {
|
|
3891
|
+
const { onProgress, version: version2 } = onBrowserDownload();
|
|
3892
|
+
await downloadBrowser({ indent, logLevel, onProgress, version: version2 });
|
|
3893
|
+
}
|
|
3894
|
+
const newStatus = getBrowserStatus(browserExecutable);
|
|
3895
|
+
return newStatus;
|
|
3896
|
+
};
|
|
3897
|
+
var getBrowserStatus = (browserExecutable) => {
|
|
3898
|
+
if (browserExecutable) {
|
|
3899
|
+
if (!fs5.existsSync(browserExecutable)) {
|
|
3900
|
+
throw new Error(`"browserExecutable" was specified as '${browserExecutable}' but the path doesn't exist. Pass "null" for "browserExecutable" to download a browser automatically.`);
|
|
3901
|
+
}
|
|
3902
|
+
return { path: browserExecutable, type: "user-defined-path" };
|
|
3903
|
+
}
|
|
3904
|
+
const localBrowser = getLocalBrowser();
|
|
3905
|
+
if (localBrowser !== null) {
|
|
3906
|
+
return { path: localBrowser, type: "local-browser" };
|
|
3907
|
+
}
|
|
3908
|
+
const revision = getRevisionInfo();
|
|
3909
|
+
if (revision.local && fs5.existsSync(revision.executablePath)) {
|
|
3910
|
+
return { path: revision.executablePath, type: "local-puppeteer-browser" };
|
|
3911
|
+
}
|
|
3912
|
+
return { type: "no-browser" };
|
|
3913
|
+
};
|
|
3914
|
+
var ensureBrowser = (options) => {
|
|
3915
|
+
const indent = false;
|
|
3916
|
+
const logLevel = options?.logLevel ?? "info";
|
|
3917
|
+
return internalEnsureBrowser({
|
|
3918
|
+
browserExecutable: options?.browserExecutable ?? null,
|
|
3919
|
+
indent,
|
|
3920
|
+
logLevel: options?.logLevel ?? "info",
|
|
3921
|
+
onBrowserDownload: options?.onBrowserDownload ?? defaultBrowserDownloadProgress({
|
|
3922
|
+
api: "ensureBrowser()",
|
|
3923
|
+
indent: false,
|
|
3924
|
+
logLevel
|
|
3925
|
+
})
|
|
3926
|
+
});
|
|
3927
|
+
};
|
|
3928
|
+
export {
|
|
3929
|
+
internalEnsureBrowser,
|
|
3930
|
+
ensureBrowser
|
|
3931
|
+
};
|