@remotion/lambda-client 4.0.508 → 4.0.510

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/dist/cjs/index.js CHANGED
@@ -61010,7 +61010,7 @@ If this is not correct, provide an override value by setting a number
61010
61010
  to input.params.ContentLength in bytes.
61011
61011
  `);
61012
61012
  }
61013
- this.uploadedParts.sort((a, b) => a.PartNumber - b.PartNumber);
61013
+ this.uploadedParts.sort((a2, b2) => a2.PartNumber - b2.PartNumber);
61014
61014
  const uploadCompleteParams = {
61015
61015
  ...this.params,
61016
61016
  Body: undefined,
@@ -69857,6 +69857,498 @@ var import_client_sts = __toESM(require_dist_cjs81(), 1);
69857
69857
 
69858
69858
  // ../serverless-client/dist/esm/index.mjs
69859
69859
  var tty = __toESM(require("tty"));
69860
+ var NEWTON_ITERATIONS = 4;
69861
+ var NEWTON_MIN_SLOPE = 0.001;
69862
+ var SUBDIVISION_PRECISION = 0.0000001;
69863
+ var SUBDIVISION_MAX_ITERATIONS = 10;
69864
+ var kSplineTableSize = 11;
69865
+ var kSampleStepSize = 1 / (kSplineTableSize - 1);
69866
+ var float32ArraySupported = typeof Float32Array === "function";
69867
+ function a(aA1, aA2) {
69868
+ return 1 - 3 * aA2 + 3 * aA1;
69869
+ }
69870
+ function b(aA1, aA2) {
69871
+ return 3 * aA2 - 6 * aA1;
69872
+ }
69873
+ function c(aA1) {
69874
+ return 3 * aA1;
69875
+ }
69876
+ function calcBezier(aT, aA1, aA2) {
69877
+ return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
69878
+ }
69879
+ function getSlope(aT, aA1, aA2) {
69880
+ return 3 * a(aA1, aA2) * aT * aT + 2 * b(aA1, aA2) * aT + c(aA1);
69881
+ }
69882
+ function binarySubdivide({
69883
+ aX,
69884
+ _aA,
69885
+ _aB,
69886
+ mX1,
69887
+ mX2
69888
+ }) {
69889
+ let currentX;
69890
+ let currentT;
69891
+ let i = 0;
69892
+ let aA = _aA;
69893
+ let aB = _aB;
69894
+ do {
69895
+ currentT = aA + (aB - aA) / 2;
69896
+ currentX = calcBezier(currentT, mX1, mX2) - aX;
69897
+ if (currentX > 0) {
69898
+ aB = currentT;
69899
+ } else {
69900
+ aA = currentT;
69901
+ }
69902
+ } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
69903
+ return currentT;
69904
+ }
69905
+ function newtonRaphsonIterate(aX, _aGuessT, mX1, mX2) {
69906
+ let aGuessT = _aGuessT;
69907
+ for (let i = 0;i < NEWTON_ITERATIONS; ++i) {
69908
+ const currentSlope = getSlope(aGuessT, mX1, mX2);
69909
+ if (currentSlope === 0) {
69910
+ return aGuessT;
69911
+ }
69912
+ const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
69913
+ aGuessT -= currentX / currentSlope;
69914
+ }
69915
+ return aGuessT;
69916
+ }
69917
+ function bezier(mX1, mY1, mX2, mY2) {
69918
+ if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
69919
+ throw new Error("bezier x values must be in [0, 1] range");
69920
+ }
69921
+ const sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
69922
+ if (mX1 !== mY1 || mX2 !== mY2) {
69923
+ for (let i = 0;i < kSplineTableSize; ++i) {
69924
+ sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
69925
+ }
69926
+ }
69927
+ function getTForX(aX) {
69928
+ let intervalStart = 0;
69929
+ let currentSample = 1;
69930
+ const lastSample = kSplineTableSize - 1;
69931
+ for (;currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
69932
+ intervalStart += kSampleStepSize;
69933
+ }
69934
+ --currentSample;
69935
+ const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
69936
+ const guessForT = intervalStart + dist * kSampleStepSize;
69937
+ const initialSlope = getSlope(guessForT, mX1, mX2);
69938
+ if (initialSlope >= NEWTON_MIN_SLOPE) {
69939
+ return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
69940
+ }
69941
+ if (initialSlope === 0) {
69942
+ return guessForT;
69943
+ }
69944
+ return binarySubdivide({
69945
+ aX,
69946
+ _aA: intervalStart,
69947
+ _aB: intervalStart + kSampleStepSize,
69948
+ mX1,
69949
+ mX2
69950
+ });
69951
+ }
69952
+ return function(x) {
69953
+ const clampedX = Math.min(1, Math.max(0, x));
69954
+ if (mX1 === mY1 && mX2 === mY2) {
69955
+ return clampedX;
69956
+ }
69957
+ if (clampedX === 0) {
69958
+ return 0;
69959
+ }
69960
+ if (clampedX === 1) {
69961
+ return 1;
69962
+ }
69963
+ return calcBezier(getTForX(clampedX), mY1, mY2);
69964
+ };
69965
+ }
69966
+ var validateFrame = ({
69967
+ allowFloats,
69968
+ durationInFrames,
69969
+ frame
69970
+ }) => {
69971
+ if (typeof frame === "undefined") {
69972
+ throw new TypeError(`Argument missing for parameter "frame"`);
69973
+ }
69974
+ if (typeof frame !== "number") {
69975
+ throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
69976
+ }
69977
+ if (!Number.isFinite(frame)) {
69978
+ throw new RangeError(`Frame ${frame} is not finite`);
69979
+ }
69980
+ if (frame % 1 !== 0 && !allowFloats) {
69981
+ throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
69982
+ }
69983
+ if (frame < 0 && frame < -durationInFrames) {
69984
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
69985
+ }
69986
+ if (frame > durationInFrames - 1) {
69987
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
69988
+ }
69989
+ };
69990
+ function validateFps(fps, location, isGif) {
69991
+ if (typeof fps !== "number") {
69992
+ throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
69993
+ }
69994
+ if (!Number.isFinite(fps)) {
69995
+ throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
69996
+ }
69997
+ if (isNaN(fps)) {
69998
+ throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
69999
+ }
70000
+ if (fps <= 0) {
70001
+ throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
70002
+ }
70003
+ if (isGif && fps > 50) {
70004
+ 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`);
70005
+ }
70006
+ }
70007
+ var validateSpringDuration = (dur) => {
70008
+ if (typeof dur === "undefined") {
70009
+ return;
70010
+ }
70011
+ if (typeof dur !== "number") {
70012
+ throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof dur}"`);
70013
+ }
70014
+ if (Number.isNaN(dur)) {
70015
+ throw new TypeError('A "duration" of a spring is NaN, which it must not be');
70016
+ }
70017
+ if (!Number.isFinite(dur)) {
70018
+ throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
70019
+ }
70020
+ if (dur <= 0) {
70021
+ throw new TypeError('A "duration" of a spring must be positive, but is ' + dur);
70022
+ }
70023
+ };
70024
+ var defaultSpringConfig = {
70025
+ damping: 10,
70026
+ mass: 1,
70027
+ stiffness: 100,
70028
+ overshootClamping: false
70029
+ };
70030
+ var advanceCache = {};
70031
+ function advance({
70032
+ animation,
70033
+ now,
70034
+ config
70035
+ }) {
70036
+ const { toValue, lastTimestamp, current, velocity } = animation;
70037
+ const deltaTime = Math.min(now - lastTimestamp, 64);
70038
+ if (config.damping <= 0) {
70039
+ throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
70040
+ }
70041
+ const c2 = config.damping;
70042
+ const m = config.mass;
70043
+ const k = config.stiffness;
70044
+ const cacheKey = [
70045
+ toValue,
70046
+ lastTimestamp,
70047
+ current,
70048
+ velocity,
70049
+ c2,
70050
+ m,
70051
+ k,
70052
+ now
70053
+ ].join("-");
70054
+ if (advanceCache[cacheKey]) {
70055
+ return advanceCache[cacheKey];
70056
+ }
70057
+ const v0 = -velocity;
70058
+ const x0 = toValue - current;
70059
+ const zeta = c2 / (2 * Math.sqrt(k * m));
70060
+ const omega0 = Math.sqrt(k / m);
70061
+ const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
70062
+ const t = deltaTime / 1000;
70063
+ const sin1 = Math.sin(omega1 * t);
70064
+ const cos1 = Math.cos(omega1 * t);
70065
+ const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
70066
+ const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
70067
+ const underDampedPosition = toValue - underDampedFrag1;
70068
+ const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
70069
+ const criticallyDampedEnvelope = Math.exp(-omega0 * t);
70070
+ const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
70071
+ const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
70072
+ const animationNode = {
70073
+ toValue,
70074
+ prevPosition: current,
70075
+ lastTimestamp: now,
70076
+ current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
70077
+ velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
70078
+ };
70079
+ advanceCache[cacheKey] = animationNode;
70080
+ return animationNode;
70081
+ }
70082
+ var calculationCache = {};
70083
+ function springCalculation({
70084
+ frame,
70085
+ fps,
70086
+ config = {}
70087
+ }) {
70088
+ const from = 0;
70089
+ const to = 1;
70090
+ const cacheKey = [
70091
+ frame,
70092
+ fps,
70093
+ config.damping,
70094
+ config.mass,
70095
+ config.overshootClamping,
70096
+ config.stiffness
70097
+ ].join("-");
70098
+ if (calculationCache[cacheKey]) {
70099
+ return calculationCache[cacheKey];
70100
+ }
70101
+ let animation = {
70102
+ lastTimestamp: 0,
70103
+ current: from,
70104
+ toValue: to,
70105
+ velocity: 0,
70106
+ prevPosition: 0
70107
+ };
70108
+ const frameClamped = Math.max(0, frame);
70109
+ const unevenRest = frameClamped % 1;
70110
+ for (let f = 0;f <= Math.floor(frameClamped); f++) {
70111
+ if (f === Math.floor(frameClamped)) {
70112
+ f += unevenRest;
70113
+ }
70114
+ const time = f / fps * 1000;
70115
+ animation = advance({
70116
+ animation,
70117
+ now: time,
70118
+ config: {
70119
+ ...defaultSpringConfig,
70120
+ ...config
70121
+ }
70122
+ });
70123
+ }
70124
+ calculationCache[cacheKey] = animation;
70125
+ return animation;
70126
+ }
70127
+ var cache = new Map;
70128
+ function measureSpring({
70129
+ fps,
70130
+ config = {},
70131
+ threshold = 0.005
70132
+ }) {
70133
+ if (typeof threshold !== "number") {
70134
+ throw new TypeError(`threshold must be a number, got ${threshold} of type ${typeof threshold}`);
70135
+ }
70136
+ if (threshold === 0) {
70137
+ return Infinity;
70138
+ }
70139
+ if (threshold === 1) {
70140
+ return 0;
70141
+ }
70142
+ if (isNaN(threshold)) {
70143
+ throw new TypeError("Threshold is NaN");
70144
+ }
70145
+ if (!Number.isFinite(threshold)) {
70146
+ throw new TypeError("Threshold is not finite");
70147
+ }
70148
+ if (threshold < 0) {
70149
+ throw new TypeError("Threshold is below 0");
70150
+ }
70151
+ const cacheKey = [
70152
+ fps,
70153
+ config.damping,
70154
+ config.mass,
70155
+ config.overshootClamping,
70156
+ config.stiffness,
70157
+ threshold
70158
+ ].join("-");
70159
+ if (cache.has(cacheKey)) {
70160
+ return cache.get(cacheKey);
70161
+ }
70162
+ validateFps(fps, "to the measureSpring() function", false);
70163
+ let frame = 0;
70164
+ let finishedFrame = 0;
70165
+ const calc = () => {
70166
+ return springCalculation({
70167
+ fps,
70168
+ frame,
70169
+ config
70170
+ });
70171
+ };
70172
+ let animation = calc();
70173
+ const calcDifference = () => {
70174
+ return Math.abs(animation.current - animation.toValue);
70175
+ };
70176
+ let difference = calcDifference();
70177
+ while (difference >= threshold) {
70178
+ frame++;
70179
+ animation = calc();
70180
+ difference = calcDifference();
70181
+ }
70182
+ finishedFrame = frame;
70183
+ for (let i = 0;i < 20; i++) {
70184
+ frame++;
70185
+ animation = calc();
70186
+ difference = calcDifference();
70187
+ if (difference >= threshold) {
70188
+ i = 0;
70189
+ finishedFrame = frame + 1;
70190
+ }
70191
+ }
70192
+ cache.set(cacheKey, finishedFrame);
70193
+ return finishedFrame;
70194
+ }
70195
+ function spring({
70196
+ frame: passedFrame,
70197
+ fps,
70198
+ config = {},
70199
+ from = 0,
70200
+ to = 1,
70201
+ durationInFrames: passedDurationInFrames,
70202
+ durationRestThreshold,
70203
+ delay = 0,
70204
+ reverse = false
70205
+ }) {
70206
+ validateSpringDuration(passedDurationInFrames);
70207
+ validateFrame({
70208
+ frame: passedFrame,
70209
+ durationInFrames: Infinity,
70210
+ allowFloats: true
70211
+ });
70212
+ validateFps(fps, "to spring()", false);
70213
+ const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
70214
+ const naturalDuration = needsToCalculateNaturalDuration ? measureSpring({
70215
+ fps,
70216
+ config,
70217
+ threshold: durationRestThreshold
70218
+ }) : undefined;
70219
+ const naturalDurationGetter = needsToCalculateNaturalDuration ? {
70220
+ get: () => naturalDuration
70221
+ } : {
70222
+ get: () => {
70223
+ throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
70224
+ }
70225
+ };
70226
+ const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
70227
+ const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
70228
+ const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
70229
+ if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
70230
+ return to;
70231
+ }
70232
+ const spr = springCalculation({
70233
+ fps,
70234
+ frame: durationProcessed,
70235
+ config
70236
+ });
70237
+ const inner = config.overshootClamping ? to >= from ? Math.min(spr.current, to) : Math.max(spr.current, to) : spr.current;
70238
+ const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
70239
+ return interpolated;
70240
+ }
70241
+ var clampUnit = (t) => Math.min(1, Math.max(0, t));
70242
+ var springEasingDurationInFrames = 30;
70243
+
70244
+ class Easing {
70245
+ static step0(n) {
70246
+ return n > 0 ? 1 : 0;
70247
+ }
70248
+ static step1(n) {
70249
+ return n >= 1 ? 1 : 0;
70250
+ }
70251
+ static linear(t) {
70252
+ return t;
70253
+ }
70254
+ static ease(t) {
70255
+ return Easing.bezier(0.42, 0, 1, 1)(t);
70256
+ }
70257
+ static quad(t) {
70258
+ return t * t;
70259
+ }
70260
+ static cubic(t) {
70261
+ return t * t * t;
70262
+ }
70263
+ static poly(n) {
70264
+ return (t) => t ** n;
70265
+ }
70266
+ static sin(t) {
70267
+ return 1 - Math.cos(t * Math.PI / 2);
70268
+ }
70269
+ static circle(t) {
70270
+ const u = clampUnit(t);
70271
+ return 1 - Math.sqrt(1 - u * u);
70272
+ }
70273
+ static exp(t) {
70274
+ return 2 ** (10 * (t - 1));
70275
+ }
70276
+ static elastic(bounciness = 1) {
70277
+ const p = bounciness * Math.PI;
70278
+ return (t) => 1 - Math.cos(t * Math.PI / 2) ** 3 * Math.cos(t * p);
70279
+ }
70280
+ static back(s = 1.70158) {
70281
+ return (t) => t * t * ((s + 1) * t - s);
70282
+ }
70283
+ static spring({
70284
+ allowTail = false,
70285
+ durationRestThreshold,
70286
+ ...config
70287
+ } = {}) {
70288
+ const easing = (t) => {
70289
+ if (t <= 0) {
70290
+ return 0;
70291
+ }
70292
+ if (!allowTail && t >= 1) {
70293
+ return 1;
70294
+ }
70295
+ if (allowTail) {
70296
+ return spring({
70297
+ fps: springEasingDurationInFrames,
70298
+ frame: t * measureSpring({
70299
+ fps: springEasingDurationInFrames,
70300
+ config,
70301
+ threshold: durationRestThreshold
70302
+ }),
70303
+ config
70304
+ });
70305
+ }
70306
+ return spring({
70307
+ fps: springEasingDurationInFrames,
70308
+ frame: t * springEasingDurationInFrames,
70309
+ config,
70310
+ durationInFrames: springEasingDurationInFrames,
70311
+ durationRestThreshold
70312
+ });
70313
+ };
70314
+ return Object.assign(easing, {
70315
+ remotionShouldExtendRight: allowTail
70316
+ });
70317
+ }
70318
+ static bounce(t) {
70319
+ const u = clampUnit(t);
70320
+ if (u < 1 / 2.75) {
70321
+ return 7.5625 * u * u;
70322
+ }
70323
+ if (u < 2 / 2.75) {
70324
+ const t2_ = u - 1.5 / 2.75;
70325
+ return 7.5625 * t2_ * t2_ + 0.75;
70326
+ }
70327
+ if (u < 2.5 / 2.75) {
70328
+ const t2_ = u - 2.25 / 2.75;
70329
+ return 7.5625 * t2_ * t2_ + 0.9375;
70330
+ }
70331
+ const t2 = u - 2.625 / 2.75;
70332
+ return 7.5625 * t2 * t2 + 0.984375;
70333
+ }
70334
+ static bezier(x1, y1, x2, y2) {
70335
+ return bezier(x1, y1, x2, y2);
70336
+ }
70337
+ static in(easing) {
70338
+ return easing;
70339
+ }
70340
+ static out(easing) {
70341
+ return (t) => 1 - easing(1 - t);
70342
+ }
70343
+ static inOut(easing) {
70344
+ return (t) => {
70345
+ if (t < 0.5) {
70346
+ return easing(t * 2) / 2;
70347
+ }
70348
+ return 1 - easing((1 - t) * 2) / 2;
70349
+ };
70350
+ }
70351
+ }
69860
70352
  var normalizeNumber = (value) => {
69861
70353
  return Math.round(value * 1e6) / 1e6;
69862
70354
  };
@@ -69927,10 +70419,13 @@ var transformOriginCenter = { value: 50, unit: "%" };
69927
70419
  var stringifyNumber = (value) => {
69928
70420
  return String(normalizeNumber(value));
69929
70421
  };
70422
+
70423
+ class UnsupportedStringInterpolationValueError extends TypeError {
70424
+ }
69930
70425
  var parseStringInterpolationComponent = (component, value) => {
69931
70426
  const match = cssNumberRegex.exec(component);
69932
70427
  if (match === null) {
69933
- throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not a supported scale, translate, or rotate value`);
70428
+ throw new UnsupportedStringInterpolationValueError(`Cannot interpolate "${value}" because "${component}" is not a supported scale, translate, or rotate value`);
69934
70429
  }
69935
70430
  const unit = match[2] ?? null;
69936
70431
  const numberValue = Number(match[1]);
@@ -70397,6 +70892,52 @@ var interpolateString = ({
70397
70892
  axisRotation: hasAxisRotation
70398
70893
  });
70399
70894
  };
70895
+ var interpolateDiscreteString = ({
70896
+ input,
70897
+ inputRange,
70898
+ outputRange,
70899
+ options
70900
+ }) => {
70901
+ if (inputRange.length === 1) {
70902
+ return outputRange[0];
70903
+ }
70904
+ for (let segmentIndex = 0;segmentIndex < inputRange.length - 1; segmentIndex++) {
70905
+ if (resolveEasingForSegment({
70906
+ easing: options?.easing,
70907
+ segmentIndex
70908
+ }) !== Easing.step1) {
70909
+ throw new TypeError("Non-numeric strings can only be interpolated using Easing.step1");
70910
+ }
70911
+ }
70912
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
70913
+ const inputMin = inputRange[0];
70914
+ const inputMax = inputRange[inputRange.length - 1];
70915
+ let resolvedInput = posterizedInput;
70916
+ if (resolvedInput < inputMin) {
70917
+ if (options?.extrapolateLeft === "identity") {
70918
+ throw new TypeError('extrapolateLeft: "identity" is not supported for non-numeric strings');
70919
+ }
70920
+ if (options?.extrapolateLeft === "wrap") {
70921
+ const wrapRange = inputMax - inputMin;
70922
+ resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
70923
+ } else {
70924
+ return outputRange[0];
70925
+ }
70926
+ }
70927
+ if (resolvedInput > inputMax) {
70928
+ if (options?.extrapolateRight === "identity") {
70929
+ throw new TypeError('extrapolateRight: "identity" is not supported for non-numeric strings');
70930
+ }
70931
+ if (options?.extrapolateRight === "wrap") {
70932
+ const wrapRange = inputMax - inputMin;
70933
+ resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
70934
+ } else {
70935
+ return outputRange[outputRange.length - 1];
70936
+ }
70937
+ }
70938
+ const range = findRange(resolvedInput, inputRange);
70939
+ return resolvedInput >= inputRange[range + 1] ? outputRange[range + 1] : outputRange[range];
70940
+ };
70400
70941
  var validateTupleOutputRange = (outputRange) => {
70401
70942
  const dimensions = outputRange[0]?.length;
70402
70943
  if (dimensions === undefined) {
@@ -70511,7 +71052,30 @@ function interpolate(input, inputRange, outputRange, options) {
70511
71052
  if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
70512
71053
  throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
70513
71054
  }
70514
- return interpolateString({ input, inputRange, outputRange, options });
71055
+ try {
71056
+ return interpolateString({ input, inputRange, outputRange, options });
71057
+ } catch (error) {
71058
+ if (!outputRange.every((output) => typeof output === "string")) {
71059
+ throw error;
71060
+ }
71061
+ const hasNonNumericString = outputRange.some((output) => {
71062
+ try {
71063
+ parseStringInterpolationValue(output);
71064
+ return false;
71065
+ } catch (parseError) {
71066
+ return parseError instanceof UnsupportedStringInterpolationValueError;
71067
+ }
71068
+ });
71069
+ if (!hasNonNumericString) {
71070
+ throw error;
71071
+ }
71072
+ return interpolateDiscreteString({
71073
+ input,
71074
+ inputRange,
71075
+ outputRange,
71076
+ options
71077
+ });
71078
+ }
70515
71079
  }
70516
71080
  if (outputRange.every((output) => Array.isArray(output))) {
70517
71081
  return interpolateTuple({ input, inputRange, outputRange, options });
@@ -70522,8 +71086,8 @@ function interpolate(input, inputRange, outputRange, options) {
70522
71086
  checkInfiniteRange("outputRange", outputRange);
70523
71087
  return interpolateNumber({ input, inputRange, outputRange, options });
70524
71088
  }
70525
- function mulberry32(a) {
70526
- let t = a + 1831565813;
71089
+ function mulberry32(a2) {
71090
+ let t = a2 + 1831565813;
70527
71091
  t = Math.imul(t ^ t >>> 15, t | 1);
70528
71092
  t ^= t + Math.imul(t ^ t >>> 7, t | 61);
70529
71093
  return ((t ^ t >>> 14) >>> 0) / 4294967296;
@@ -71012,8 +71576,8 @@ function hslToRgb(h, s, l) {
71012
71576
  const p = 2 * l - q;
71013
71577
  const r = hue2rgb(p, q, h + 1 / 3);
71014
71578
  const g = hue2rgb(p, q, h);
71015
- const b = hue2rgb(p, q, h - 1 / 3);
71016
- return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
71579
+ const b2 = hue2rgb(p, q, h - 1 / 3);
71580
+ return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b2 * 255) << 8;
71017
71581
  }
71018
71582
  function parse255(str) {
71019
71583
  const int = Number.parseInt(str, 10);
@@ -71077,25 +71641,25 @@ function parseModernAlpha(str) {
71077
71641
  }
71078
71642
  return Math.max(0, Math.min(1, Number.parseFloat(str)));
71079
71643
  }
71080
- function linearToSrgb(c) {
71081
- if (c <= 0.0031308)
71082
- return 12.92 * c;
71083
- return 1.055 * c ** (1 / 2.4) - 0.055;
71644
+ function linearToSrgb(c2) {
71645
+ if (c2 <= 0.0031308)
71646
+ return 12.92 * c2;
71647
+ return 1.055 * c2 ** (1 / 2.4) - 0.055;
71084
71648
  }
71085
71649
  function clamp01(v) {
71086
71650
  return Math.max(0, Math.min(1, v));
71087
71651
  }
71088
- function rgbFloatToInt(r, g, b, alpha) {
71652
+ function rgbFloatToInt(r, g, b2, alpha) {
71089
71653
  const ri = Math.round(clamp01(r) * 255);
71090
71654
  const gi = Math.round(clamp01(g) * 255);
71091
- const bi = Math.round(clamp01(b) * 255);
71655
+ const bi = Math.round(clamp01(b2) * 255);
71092
71656
  const ai = Math.round(clamp01(alpha) * 255);
71093
71657
  return (ri << 24 | gi << 16 | bi << 8 | ai) >>> 0;
71094
71658
  }
71095
- function oklabToSrgb(L, a, b) {
71096
- const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
71097
- const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
71098
- const s_ = L - 0.0894841775 * a - 1.291485548 * b;
71659
+ function oklabToSrgb(L, a2, b2) {
71660
+ const l_ = L + 0.3963377774 * a2 + 0.2158037573 * b2;
71661
+ const m_ = L - 0.1055613458 * a2 - 0.0638541728 * b2;
71662
+ const s_ = L - 0.0894841775 * a2 - 1.291485548 * b2;
71099
71663
  const l = l_ * l_ * l_;
71100
71664
  const m = m_ * m_ * m_;
71101
71665
  const s = s_ * s_ * s_;
@@ -71104,15 +71668,15 @@ function oklabToSrgb(L, a, b) {
71104
71668
  const bLin = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
71105
71669
  return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
71106
71670
  }
71107
- function labToSrgb(L, a, b) {
71671
+ function labToSrgb(L, a2, b2) {
71108
71672
  const epsilon = 216 / 24389;
71109
71673
  const kappa = 24389 / 27;
71110
71674
  const Xn = 0.95047;
71111
71675
  const Yn = 1;
71112
71676
  const Zn = 1.08883;
71113
71677
  const fy = (L + 16) / 116;
71114
- const fx = a / 500 + fy;
71115
- const fz = fy - b / 200;
71678
+ const fx = a2 / 500 + fy;
71679
+ const fz = fy - b2 / 200;
71116
71680
  const fx3 = fx * fx * fx;
71117
71681
  const fz3 = fz * fz * fz;
71118
71682
  const xr = fx3 > epsilon ? fx3 : (116 * fx - 16) / kappa;
@@ -71344,27 +71908,27 @@ function normalizeColor(color) {
71344
71908
  const H = parseHueAngle(match[3]);
71345
71909
  const alpha = parseModernAlpha(match[4]);
71346
71910
  const hRad = H * Math.PI / 180;
71347
- const [r, g, b] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
71348
- return rgbFloatToInt(r, g, b, alpha);
71911
+ const [r, g, b2] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
71912
+ return rgbFloatToInt(r, g, b2, alpha);
71349
71913
  }
71350
71914
  }
71351
71915
  if (matchers.oklab) {
71352
71916
  if (match = matchers.oklab.exec(color)) {
71353
71917
  const L = parseModernComponent(match[1], 1);
71354
- const a = parseModernComponent(match[2], 0.4);
71355
- const b = parseModernComponent(match[3], 0.4);
71918
+ const a2 = parseModernComponent(match[2], 0.4);
71919
+ const b2 = parseModernComponent(match[3], 0.4);
71356
71920
  const alpha = parseModernAlpha(match[4]);
71357
- const [r, g, bl] = oklabToSrgb(L, a, b);
71921
+ const [r, g, bl] = oklabToSrgb(L, a2, b2);
71358
71922
  return rgbFloatToInt(r, g, bl, alpha);
71359
71923
  }
71360
71924
  }
71361
71925
  if (matchers.lab) {
71362
71926
  if (match = matchers.lab.exec(color)) {
71363
71927
  const L = parseModernComponent(match[1], 100);
71364
- const a = parseModernComponent(match[2], 125);
71365
- const b = parseModernComponent(match[3], 125);
71928
+ const a2 = parseModernComponent(match[2], 125);
71929
+ const b2 = parseModernComponent(match[3], 125);
71366
71930
  const alpha = parseModernAlpha(match[4]);
71367
- const [r, g, bl] = labToSrgb(L, a, b);
71931
+ const [r, g, bl] = labToSrgb(L, a2, b2);
71368
71932
  return rgbFloatToInt(r, g, bl, alpha);
71369
71933
  }
71370
71934
  }
@@ -71443,30 +72007,6 @@ var serializeScaleValue = ([x, y, z]) => {
71443
72007
  return `${normalizedX} ${normalizedY} ${normalizedZ}`;
71444
72008
  };
71445
72009
  var ENABLE_V5_BREAKING_CHANGES = false;
71446
- var validateFrame = ({
71447
- allowFloats,
71448
- durationInFrames,
71449
- frame
71450
- }) => {
71451
- if (typeof frame === "undefined") {
71452
- throw new TypeError(`Argument missing for parameter "frame"`);
71453
- }
71454
- if (typeof frame !== "number") {
71455
- throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
71456
- }
71457
- if (!Number.isFinite(frame)) {
71458
- throw new RangeError(`Frame ${frame} is not finite`);
71459
- }
71460
- if (frame % 1 !== 0 && !allowFloats) {
71461
- throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
71462
- }
71463
- if (frame < 0 && frame < -durationInFrames) {
71464
- throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
71465
- }
71466
- if (frame > durationInFrames - 1) {
71467
- throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
71468
- }
71469
- };
71470
72010
  var validCodecs = [
71471
72011
  "h264",
71472
72012
  "h265",
@@ -71538,23 +72078,6 @@ function validateDurationInFrames(durationInFrames, options) {
71538
72078
  throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
71539
72079
  }
71540
72080
  }
71541
- function validateFps(fps, location, isGif) {
71542
- if (typeof fps !== "number") {
71543
- throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
71544
- }
71545
- if (!Number.isFinite(fps)) {
71546
- throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
71547
- }
71548
- if (isNaN(fps)) {
71549
- throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
71550
- }
71551
- if (fps <= 0) {
71552
- throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
71553
- }
71554
- if (isGif && fps > 50) {
71555
- 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`);
71556
- }
71557
- }
71558
72081
  var getExpectedMediaFrameUncorrected = ({
71559
72082
  frame,
71560
72083
  playbackRate,
@@ -71675,7 +72198,7 @@ var validateDownloadBehavior = (downloadBehavior) => {
71675
72198
  }
71676
72199
  }
71677
72200
  };
71678
- var VERSION = "4.0.508";
72201
+ var VERSION = "4.0.510";
71679
72202
  var isColorSupported = () => {
71680
72203
  const env = process.env || {};
71681
72204
  const isForceDisabled = "NO_COLOR" in env;
@@ -71844,17 +72367,17 @@ var Log = {
71844
72367
  return [
71845
72368
  options.indent ? INDENT_TOKEN : null,
71846
72369
  options.tag ? verboseTag(options.tag) : null
71847
- ].filter(truthy2).concat(args.map((a) => {
72370
+ ].filter(truthy2).concat(args.map((a2) => {
71848
72371
  if (logLevel === "warn") {
71849
- return chalk.yellow(a);
72372
+ return chalk.yellow(a2);
71850
72373
  }
71851
72374
  if (logLevel === "error") {
71852
- return chalk.red(a);
72375
+ return chalk.red(a2);
71853
72376
  }
71854
72377
  if (logLevel === "verbose" || logLevel === "trace") {
71855
- return chalk.gray(a);
72378
+ return chalk.gray(a2);
71856
72379
  }
71857
- return a;
72380
+ return a2;
71858
72381
  }));
71859
72382
  },
71860
72383
  trace: (options, ...args) => {
@@ -72142,7 +72665,7 @@ var calculateBillingDuration = ({
72142
72665
  functionsInvoked,
72143
72666
  elapsedTimeOfUnfinishedChunks
72144
72667
  }) => {
72145
- const completedChunksDuration = timings.map((p) => Math.max(0, p.rendered - p.start) + OVERHEAD_TIME_PER_LAMBDA).reduce((a, b) => a + b, 0);
72668
+ const completedChunksDuration = timings.map((p) => Math.max(0, p.rendered - p.start) + OVERHEAD_TIME_PER_LAMBDA).reduce((a2, b2) => a2 + b2, 0);
72146
72669
  const unfinished = Math.max(0, functionsInvoked - timings.length);
72147
72670
  return completedChunksDuration + unfinished * elapsedTimeOfUnfinishedChunks;
72148
72671
  };
@@ -72189,7 +72712,7 @@ var calculateChunkTimes = ({
72189
72712
  const parsedTimings = timings;
72190
72713
  const absoluteTime = getAbsoluteTime(parsedTimings);
72191
72714
  if (type === "combined-time-for-cost-calculation") {
72192
- const totalEncodingTimings = parsedTimings.map((p) => Math.max(0, p.rendered - p.start)).reduce((a, b) => a + b, 0);
72715
+ const totalEncodingTimings = parsedTimings.map((p) => Math.max(0, p.rendered - p.start)).reduce((a2, b2) => a2 + b2, 0);
72193
72716
  return totalEncodingTimings + absoluteTime;
72194
72717
  }
72195
72718
  if (type === "absolute-time") {
@@ -72199,10 +72722,11 @@ var calculateChunkTimes = ({
72199
72722
  };
72200
72723
  var checkBucketListing = async ({
72201
72724
  bucketName,
72202
- region
72725
+ region,
72726
+ dnsSuffix
72203
72727
  }) => {
72204
72728
  try {
72205
- const res = await fetch(`https://${bucketName}.s3.${region}.amazonaws.com/`);
72729
+ const res = await fetch(`https://${bucketName}.s3.${region}.${dnsSuffix}/`);
72206
72730
  if (res.status === 200) {
72207
72731
  console.warn(`Warning: Your bucket ${bucketName} allows public listing of its contents. See https://remotion.dev/docs/lambda/bucket-security for how to fix this.`);
72208
72732
  }
@@ -72219,7 +72743,7 @@ var internalGetOrCreateBucket = async (params) => {
72219
72743
  requestHandler: params.requestHandler
72220
72744
  });
72221
72745
  if (remotionBuckets.length > 1) {
72222
- throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${params.region}) starting with "${params.providerSpecifics.getBucketPrefix()}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
72746
+ throw new Error(`You have multiple buckets (${remotionBuckets.map((b2) => b2.name)}) in your S3 region (${params.region}) starting with "${params.providerSpecifics.getBucketPrefix()}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
72223
72747
  }
72224
72748
  const { enableFolderExpiry, region } = params;
72225
72749
  if (remotionBuckets.length === 1) {
@@ -72232,7 +72756,11 @@ var internalGetOrCreateBucket = async (params) => {
72232
72756
  forcePathStyle: params.forcePathStyle,
72233
72757
  requestHandler: params.requestHandler
72234
72758
  });
72235
- await checkBucketListing({ bucketName: existingBucketName, region });
72759
+ await checkBucketListing({
72760
+ bucketName: existingBucketName,
72761
+ region,
72762
+ dnsSuffix: params.providerSpecifics.getServiceDnsSuffix(region)
72763
+ });
72236
72764
  return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
72237
72765
  }
72238
72766
  const bucketName = makeBucketName(params.region, params.providerSpecifics);
@@ -72308,7 +72836,7 @@ var getNeedsToUpload = ({
72308
72836
  }) => {
72309
72837
  const MARGIN = 5000 + MAX_WEBHOOK_CUSTOM_DATA_SIZE;
72310
72838
  const MAX_INLINE_PAYLOAD_SIZE = (type === "still" ? providerSpecifics.getMaxStillInlinePayloadSize() : providerSpecifics.getMaxNonInlinePayloadSizePerFunction()) - MARGIN;
72311
- const sizesAlreadyUsed = sizes.reduce((a, b) => a + b);
72839
+ const sizesAlreadyUsed = sizes.reduce((a2, b2) => a2 + b2);
72312
72840
  if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
72313
72841
  console.warn(`Warning: The props are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(sizesAlreadyUsed / 1024)}KB) in size. Uploading them to ${providerSpecifics.serverStorageProductName()} to circumvent AWS Lambda payload size, which may lead to slowdown.`);
72314
72842
  return true;
@@ -73089,22 +73617,22 @@ var findOutputFileInBucket = async ({
73089
73617
  throw err;
73090
73618
  }
73091
73619
  };
73092
- var display = (accrued) => {
73620
+ var display = (accrued, currency) => {
73093
73621
  if (accrued < 0.001) {
73094
- return "<$0.001";
73622
+ return `<${currency === "CNY" ? "¥" : "$"}0.001`;
73095
73623
  }
73096
73624
  return new Intl.NumberFormat("en-US", {
73097
- currency: "USD",
73625
+ currency,
73098
73626
  style: "currency",
73099
73627
  currencyDisplay: "narrowSymbol",
73100
73628
  minimumFractionDigits: 3
73101
73629
  }).format(accrued);
73102
73630
  };
73103
- var formatCostsInfo = (accrued) => {
73631
+ var formatCostsInfo = (accrued, currency = "USD") => {
73104
73632
  return {
73105
73633
  accruedSoFar: accrued,
73106
- displayCost: display(accrued),
73107
- currency: "USD",
73634
+ displayCost: display(accrued, currency),
73635
+ currency,
73108
73636
  disclaimer: "Estimated cost only. Does not include charges for other AWS services."
73109
73637
  };
73110
73638
  };
@@ -73192,7 +73720,7 @@ var getOverallProgress = ({
73192
73720
  Boolean(invokedLambda),
73193
73721
  Boolean(visitedServeUrl),
73194
73722
  Boolean(gotComposition)
73195
- ].reduce((a, b) => Number(a) + Number(b), 0) / 3;
73723
+ ].reduce((a2, b2) => Number(a2) + Number(b2), 0) / 3;
73196
73724
  return evaluationProgress * weights.evaluating + encoding * weights.encoding + invoking * weights.invoking + frames * weights.frames + combining * weights.combining;
73197
73725
  };
73198
73726
  var MAX_MISSING_CHUNKS = 5;
@@ -73339,6 +73867,7 @@ var getProgress = async ({
73339
73867
  functionName,
73340
73868
  requestHandler
73341
73869
  }) => {
73870
+ const billingCurrency = providerSpecifics.getBillingCurrency(region);
73342
73871
  const overallProgress = await getOverallProgressFromStorage({
73343
73872
  renderId,
73344
73873
  bucketName,
@@ -73434,7 +73963,7 @@ var getProgress = async ({
73434
73963
  timeToCombine: overallProgress.timeToCombine
73435
73964
  },
73436
73965
  timeToRenderFrames: overallProgress.timeToRenderFrames,
73437
- costs: formatCostsInfo(0),
73966
+ costs: formatCostsInfo(0, billingCurrency),
73438
73967
  renderId,
73439
73968
  renderMetadata,
73440
73969
  bucket: bucketName,
@@ -73490,7 +74019,7 @@ var getProgress = async ({
73490
74019
  const allChunks = (overallProgress.chunks ?? []).length / chunkMultiplier === (renderMetadata.totalChunks ?? Infinity);
73491
74020
  const frameCount = NoReactAPIs.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame).length;
73492
74021
  const missingChunks = new Array(renderMetadata.totalChunks).fill(true).map((_, i) => i).filter((index) => {
73493
- return typeof (overallProgress.chunks ?? []).find((c) => c === index) === "undefined";
74022
+ return typeof (overallProgress.chunks ?? []).find((c2) => c2 === index) === "undefined";
73494
74023
  });
73495
74024
  const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 && missingChunks && missingChunks.length > 0;
73496
74025
  const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
@@ -73528,7 +74057,7 @@ var getProgress = async ({
73528
74057
  filesDeleted: 0,
73529
74058
  minFilesToDelete: 0
73530
74059
  },
73531
- costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar) : formatCostsInfo(0),
74060
+ costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar, billingCurrency) : formatCostsInfo(0, billingCurrency),
73532
74061
  currentTime: now,
73533
74062
  done: true,
73534
74063
  encodingStatus: {
@@ -73586,7 +74115,7 @@ var getProgress = async ({
73586
74115
  timeToCombine: overallProgress.timeToCombine
73587
74116
  },
73588
74117
  timeToRenderFrames: overallProgress.timeToRenderFrames,
73589
- costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar) : formatCostsInfo(0),
74118
+ costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar, billingCurrency) : formatCostsInfo(0, billingCurrency),
73590
74119
  renderId,
73591
74120
  renderMetadata,
73592
74121
  bucket: bucketName,
@@ -73968,6 +74497,51 @@ function getStsClient(region, requestHandler) {
73968
74497
  // src/aws-provider.ts
73969
74498
  var import_node_events = require("node:events");
73970
74499
 
74500
+ // src/aws-region-metadata.ts
74501
+ var regionPartitions = {
74502
+ "af-south-1": "aws",
74503
+ "ap-east-1": "aws",
74504
+ "ap-northeast-1": "aws",
74505
+ "ap-northeast-2": "aws",
74506
+ "ap-northeast-3": "aws",
74507
+ "ap-south-1": "aws",
74508
+ "ap-southeast-1": "aws",
74509
+ "ap-southeast-2": "aws",
74510
+ "ap-southeast-4": "aws",
74511
+ "ap-southeast-5": "aws",
74512
+ "ca-central-1": "aws",
74513
+ "cn-north-1": "aws-cn",
74514
+ "cn-northwest-1": "aws-cn",
74515
+ "eu-central-1": "aws",
74516
+ "eu-central-2": "aws",
74517
+ "eu-north-1": "aws",
74518
+ "eu-south-1": "aws",
74519
+ "eu-west-1": "aws",
74520
+ "eu-west-2": "aws",
74521
+ "eu-west-3": "aws",
74522
+ "sa-east-1": "aws",
74523
+ "us-east-1": "aws",
74524
+ "us-east-2": "aws",
74525
+ "us-west-1": "aws",
74526
+ "us-west-2": "aws"
74527
+ };
74528
+ var partitionMetadata = {
74529
+ aws: {
74530
+ partition: "aws",
74531
+ dnsSuffix: "amazonaws.com",
74532
+ consoleDomain: "console.aws.amazon.com",
74533
+ billingCurrency: "USD"
74534
+ },
74535
+ "aws-cn": {
74536
+ partition: "aws-cn",
74537
+ dnsSuffix: "amazonaws.com.cn",
74538
+ consoleDomain: "console.amazonaws.cn",
74539
+ billingCurrency: "CNY"
74540
+ }
74541
+ };
74542
+ var getAwsPartitionMetadata = (partition) => partitionMetadata[partition];
74543
+ var getAwsRegionMetadata = (region) => getAwsPartitionMetadata(regionPartitions[region]);
74544
+
73971
74545
  // src/bucket-exists.ts
73972
74546
  var import_client_s32 = __toESM(require_dist_cjs79(), 1);
73973
74547
 
@@ -74115,7 +74689,8 @@ var callLambdaWithStreamingWithoutRetry = async ({
74115
74689
  }
74116
74690
  if (event.InvokeComplete) {
74117
74691
  if (event.InvokeComplete.ErrorCode) {
74118
- const logs = `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-3600~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40requestId*2c*20*40message*0a*7c*20filter*20*40requestId*20like*20*${res.$metadata.requestId}*22*0a*7c*20sort*20*40timestamp*20asc~source~(~'*2faws*2flambda*2f${functionName}))`;
74692
+ const { consoleDomain } = getAwsRegionMetadata(region);
74693
+ const logs = `https://${region}.${consoleDomain}/cloudwatch/home?region=${region}#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-3600~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40requestId*2c*20*40message*0a*7c*20filter*20*40requestId*20like*20*${res.$metadata.requestId}*22*0a*7c*20sort*20*40timestamp*20asc~source~(~'*2faws*2flambda*2f${functionName}))`;
74119
74694
  if (event.InvokeComplete.ErrorCode === "Unhandled") {
74120
74695
  throw new Error(`Lambda function ${functionName} failed with an unhandled error: ${event.InvokeComplete.ErrorDetails} See ${logs} to see the logs of this invocation.`);
74121
74696
  }
@@ -74212,7 +74787,8 @@ var convertToServeUrlImplementation = ({
74212
74787
  if (urlOrId.startsWith("http://") || urlOrId.startsWith("https://")) {
74213
74788
  return urlOrId;
74214
74789
  }
74215
- return `https://${bucketName}.s3.${region}.amazonaws.com/sites/${urlOrId}/index.html`;
74790
+ const { dnsSuffix } = getAwsRegionMetadata(region);
74791
+ return `https://${bucketName}.s3.${region}.${dnsSuffix}/sites/${urlOrId}/index.html`;
74216
74792
  };
74217
74793
 
74218
74794
  // src/create-bucket.ts
@@ -74258,6 +74834,7 @@ var createBucket = async ({ region, bucketName, forcePathStyle, requestHandler }
74258
74834
  }
74259
74835
  let usedBucketPolicy = false;
74260
74836
  try {
74837
+ const { partition } = getAwsRegionMetadata(region);
74261
74838
  const policy = JSON.stringify({
74262
74839
  Version: "2012-10-17",
74263
74840
  Statement: [
@@ -74266,7 +74843,7 @@ var createBucket = async ({ region, bucketName, forcePathStyle, requestHandler }
74266
74843
  Effect: "Allow",
74267
74844
  Principal: "*",
74268
74845
  Action: "s3:GetObject",
74269
- Resource: `arn:aws:s3:::${bucketName}/*`
74846
+ Resource: `arn:${partition}:s3:::${bucketName}/*`
74270
74847
  }
74271
74848
  ]
74272
74849
  });
@@ -74336,6 +74913,16 @@ var deleteFunction = async ({
74336
74913
 
74337
74914
  // src/price-per-1s.ts
74338
74915
  var pricing = {
74916
+ "cn-north-1": {
74917
+ "Lambda Requests": { price: "0.00000136" },
74918
+ "Lambda Duration-ARM": { price: "0.000090800" },
74919
+ "Lambda Storage-Duration-ARM": { price: "0.0000002303" }
74920
+ },
74921
+ "cn-northwest-1": {
74922
+ "Lambda Requests": { price: "0.00000136" },
74923
+ "Lambda Duration-ARM": { price: "0.000090800" },
74924
+ "Lambda Storage-Duration-ARM": { price: "0.0000002049" }
74925
+ },
74339
74926
  "af-south-1": {
74340
74927
  "Lambda Duration-Provisioned": {
74341
74928
  rateCode: "X7CK6KFXNWY9RF6Z.JRTCKXETXF.6YS6EN2CT7",
@@ -75144,6 +75731,8 @@ var AWS_REGIONS = [
75144
75731
  "ap-southeast-4",
75145
75732
  "ap-southeast-5",
75146
75733
  "ca-central-1",
75734
+ "cn-north-1",
75735
+ "cn-northwest-1",
75147
75736
  "sa-east-1"
75148
75737
  ];
75149
75738
 
@@ -75247,7 +75836,8 @@ var cloudWatchUrlWithQuery = ({
75247
75836
  functionNameToUse,
75248
75837
  query
75249
75838
  }) => {
75250
- return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionNameToUse}/log-events$3FfilterPattern$3D${encodeAwsUrlParams(query)}`;
75839
+ const { consoleDomain } = getAwsRegionMetadata(region);
75840
+ return `https://${region}.${consoleDomain}/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionNameToUse}/log-events$3FfilterPattern$3D${encodeAwsUrlParams(query)}`;
75251
75841
  };
75252
75842
  var getCloudwatchMethodUrl = ({
75253
75843
  region,
@@ -75264,7 +75854,8 @@ var getLambdaInsightsUrl = ({
75264
75854
  region,
75265
75855
  functionName
75266
75856
  }) => {
75267
- return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#lambda-insights:functions/${functionName}`;
75857
+ const { consoleDomain } = getAwsRegionMetadata(region);
75858
+ return `https://${region}.${consoleDomain}/cloudwatch/home?region=${region}#lambda-insights:functions/${functionName}`;
75268
75859
  };
75269
75860
  var getCloudwatchRendererUrl = ({ region, functionName, renderId, rendererFunctionName, chunk }) => {
75270
75861
  const functionNameToUse = rendererFunctionName ?? functionName;
@@ -75276,14 +75867,31 @@ var getS3RenderUrl = ({
75276
75867
  region,
75277
75868
  bucketName
75278
75869
  }) => {
75279
- return `https://s3.console.aws.amazon.com/s3/buckets/${bucketName}?region=${region}&prefix=renders/${renderId}/`;
75870
+ const { consoleDomain, partition } = getAwsRegionMetadata(region);
75871
+ const consoleHost = partition === "aws" ? `s3.${consoleDomain}` : `${region}.${consoleDomain}`;
75872
+ return `https://${consoleHost}/s3/buckets/${bucketName}?region=${region}&prefix=renders/${renderId}/`;
75280
75873
  };
75281
75874
  var getProgressJsonUrl = ({
75282
75875
  region,
75283
75876
  bucketName,
75284
75877
  renderId
75285
75878
  }) => {
75286
- return `https://${region}.console.aws.amazon.com/s3/object/${bucketName}?region=${region}&bucketType=general&prefix=renders/${renderId}/progress.json`;
75879
+ const { consoleDomain } = getAwsRegionMetadata(region);
75880
+ return `https://${region}.${consoleDomain}/s3/object/${bucketName}?region=${region}&bucketType=general&prefix=renders/${renderId}/progress.json`;
75881
+ };
75882
+ var getLambdaFunctionUrl = ({
75883
+ region,
75884
+ functionName
75885
+ }) => {
75886
+ const { consoleDomain } = getAwsRegionMetadata(region);
75887
+ return `https://${region}.${consoleDomain}/lambda/home#/functions/${functionName}?tab=code`;
75888
+ };
75889
+ var getS3BucketUrl = ({
75890
+ region,
75891
+ bucketName
75892
+ }) => {
75893
+ const { consoleDomain } = getAwsRegionMetadata(region);
75894
+ return `https://${region}.${consoleDomain}/s3/buckets/${bucketName}/?region=${region}`;
75287
75895
  };
75288
75896
 
75289
75897
  // src/get-buckets.ts
@@ -75316,11 +75924,11 @@ var getRemotionBuckets = async ({
75316
75924
  if (!Buckets) {
75317
75925
  return [];
75318
75926
  }
75319
- const remotionBuckets = Buckets.filter((b) => {
75927
+ const remotionBuckets = Buckets.filter((b2) => {
75320
75928
  if (forceBucketName) {
75321
- return b.Name === forceBucketName;
75929
+ return b2.Name === forceBucketName;
75322
75930
  }
75323
- return b.Name?.startsWith(REMOTION_BUCKET_PREFIX);
75931
+ return b2.Name?.startsWith(REMOTION_BUCKET_PREFIX);
75324
75932
  });
75325
75933
  const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
75326
75934
  const { region: parsedRegion } = parseBucketName(bucket.Name);
@@ -75350,7 +75958,7 @@ var getRemotionBuckets = async ({
75350
75958
  name: bucket.Name,
75351
75959
  region: locations[i]
75352
75960
  };
75353
- }).filter((b) => b.region);
75961
+ }).filter((b2) => b2.region);
75354
75962
  return bucketsWithLocation.filter((bucket) => {
75355
75963
  return bucket.region === region;
75356
75964
  });
@@ -75473,8 +76081,9 @@ var getOutputUrlFromMetadata = ({
75473
76081
  customCredentials,
75474
76082
  bucketNamePrefix: REMOTION_BUCKET_PREFIX
75475
76083
  });
76084
+ const { dnsSuffix } = getAwsRegionMetadata(currentRegion);
75476
76085
  return {
75477
- url: `https://s3.${currentRegion}.amazonaws.com/${renderBucketName}/${key}`,
76086
+ url: `https://s3.${currentRegion}.${dnsSuffix}/${renderBucketName}/${key}`,
75478
76087
  key
75479
76088
  };
75480
76089
  };
@@ -75974,6 +76583,9 @@ var awsImplementation = {
75974
76583
  return MAX_EPHEMERAL_STORAGE_IN_MB;
75975
76584
  },
75976
76585
  estimatePrice,
76586
+ getBillingCurrency: (region) => getAwsRegionMetadata(region).billingCurrency,
76587
+ getRendererFunctionTransport: (region) => getAwsRegionMetadata(region).partition === "aws-cn" ? "s3" : "response-streaming",
76588
+ getServiceDnsSuffix: (region) => getAwsRegionMetadata(region).dnsSuffix,
75977
76589
  getLoggingUrlForMethod: getCloudwatchMethodUrl,
75978
76590
  getLoggingUrlForRendererFunction: getCloudwatchRendererUrl,
75979
76591
  isFlakyError,
@@ -76109,8 +76721,8 @@ var internalDeleteRender = async (input) => {
76109
76721
  });
76110
76722
  let totalSize = 0;
76111
76723
  while (files.length > 0) {
76112
- totalSize += files.reduce((a, b) => {
76113
- return a + (b.Size ?? 0);
76724
+ totalSize += files.reduce((a2, b2) => {
76725
+ return a2 + (b2.Size ?? 0);
76114
76726
  }, 0);
76115
76727
  await cleanItems({
76116
76728
  list: files.map((f) => f.Key),
@@ -76153,7 +76765,8 @@ var makeS3ServeUrl = ({
76153
76765
  subFolder,
76154
76766
  region
76155
76767
  }) => {
76156
- return `https://${bucketName}.s3.${region}.amazonaws.com/${subFolder}/index.html`;
76768
+ const { dnsSuffix } = getAwsRegionMetadata(region);
76769
+ return `https://${bucketName}.s3.${region}.${dnsSuffix}/${subFolder}/index.html`;
76157
76770
  };
76158
76771
 
76159
76772
  // src/get-sites.ts
@@ -76515,7 +77128,7 @@ var makeLambdaRenderStillPayload = async ({
76515
77128
  offthreadVideoCacheSizeInBytes,
76516
77129
  deleteAfter,
76517
77130
  type: ServerlessRoutines.still,
76518
- streamed: true,
77131
+ streamed: awsImplementation.getRendererFunctionTransport(region) === "response-streaming",
76519
77132
  forcePathStyle,
76520
77133
  licenseKey: licenseKey ?? null,
76521
77134
  offthreadVideoThreads: offthreadVideoThreads ?? null,
@@ -76653,7 +77266,7 @@ var innerRenderStillOnLambda = async (input) => {
76653
77266
  const { functionName, region, onInit } = input;
76654
77267
  try {
76655
77268
  const payload = await makeLambdaRenderStillPayload(input);
76656
- const res = await new Promise((resolve, reject) => {
77269
+ const res = payload.streamed ? await new Promise((resolve, reject) => {
76657
77270
  awsImplementation.callFunctionStreaming({
76658
77271
  functionName,
76659
77272
  type: ServerlessRoutines.still,
@@ -76691,7 +77304,27 @@ var innerRenderStillOnLambda = async (input) => {
76691
77304
  }).catch((err) => {
76692
77305
  reject(err);
76693
77306
  });
77307
+ }) : await awsImplementation.callFunctionSync({
77308
+ functionName,
77309
+ type: ServerlessRoutines.still,
77310
+ payload,
77311
+ region,
77312
+ timeoutInTest: 120000,
77313
+ requestHandler: input.requestHandler
76694
77314
  });
77315
+ if (!payload.streamed) {
77316
+ onInit?.({
77317
+ renderId: res.renderId,
77318
+ cloudWatchLogs: getCloudwatchMethodUrl({
77319
+ functionName,
77320
+ method: ServerlessRoutines.still,
77321
+ region,
77322
+ rendererFunctionName: null,
77323
+ renderId: res.renderId
77324
+ }),
77325
+ lambdaInsightsUrl: getLambdaInsightsUrl({ functionName, region })
77326
+ });
77327
+ }
76695
77328
  return {
76696
77329
  estimatedPrice: res.estimatedPrice,
76697
77330
  url: res.output,
@@ -77200,6 +77833,8 @@ var LambdaClientInternals = {
77200
77833
  parseJsonOrThrowSource,
77201
77834
  getCloudwatchMethodUrl,
77202
77835
  getCloudwatchRendererUrl,
77836
+ getLambdaFunctionUrl,
77837
+ getS3BucketUrl,
77203
77838
  MAX_EPHEMERAL_STORAGE_IN_MB,
77204
77839
  parseFunctionName,
77205
77840
  isFlakyError,
@@ -77228,5 +77863,7 @@ var LambdaClientInternals = {
77228
77863
  cleanItems,
77229
77864
  makeLambdaRenderStillPayload,
77230
77865
  getRenderProgressPayload,
77231
- innerSpeculateFunctionName
77866
+ innerSpeculateFunctionName,
77867
+ getAwsPartitionMetadata,
77868
+ getAwsRegionMetadata
77232
77869
  };