@remotion/studio 4.0.380 → 4.0.382

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.
@@ -2607,7 +2607,8 @@ var SidebarRenderButton = ({ composition, visible }) => {
2607
2607
  initialHardwareAcceleration: defaults.hardwareAcceleration,
2608
2608
  initialChromeMode: defaults.chromeMode,
2609
2609
  initialMediaCacheSizeInBytes: defaults.mediaCacheSizeInBytes,
2610
- renderDefaults: defaults
2610
+ renderDefaults: defaults,
2611
+ initialDarkMode: defaults.darkMode
2611
2612
  });
2612
2613
  if (isMobileLayout) {
2613
2614
  setSidebarCollapsedState({ left: "collapsed", right: "collapsed" });
@@ -16261,6 +16262,7 @@ var makeRetryPayload = (job) => {
16261
16262
  initialOpenGlRenderer: job.chromiumOptions.gl,
16262
16263
  initialHeadless: job.chromiumOptions.headless,
16263
16264
  initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
16265
+ initialDarkMode: job.chromiumOptions.darkMode,
16264
16266
  defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(job.serializedInputPropsWithCustomSchema),
16265
16267
  inFrameMark: null,
16266
16268
  outFrameMark: null,
@@ -16310,6 +16312,7 @@ var makeRetryPayload = (job) => {
16310
16312
  initialOpenGlRenderer: job.chromiumOptions.gl,
16311
16313
  initialHeadless: job.chromiumOptions.headless,
16312
16314
  initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
16315
+ initialDarkMode: job.chromiumOptions.darkMode,
16313
16316
  defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(job.serializedInputPropsWithCustomSchema),
16314
16317
  initialStillImageFormat: defaults.stillImageFormat,
16315
16318
  inFrameMark: job.startFrame,
@@ -16362,6 +16365,7 @@ var makeRetryPayload = (job) => {
16362
16365
  initialOpenGlRenderer: job.chromiumOptions.gl,
16363
16366
  initialHeadless: job.chromiumOptions.headless,
16364
16367
  initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
16368
+ initialDarkMode: job.chromiumOptions.darkMode,
16365
16369
  defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(job.serializedInputPropsWithCustomSchema),
16366
16370
  inFrameMark: job.startFrame,
16367
16371
  outFrameMark: job.endFrame,
@@ -18059,6 +18063,7 @@ var RenderButton = () => {
18059
18063
  defaultConfigurationAudioCodec: defaults.audioCodec,
18060
18064
  initialEnvVariables: window.process.env,
18061
18065
  initialDisableWebSecurity: defaults.disableWebSecurity,
18066
+ initialDarkMode: defaults.darkMode,
18062
18067
  initialOpenGlRenderer: defaults.openGlRenderer,
18063
18068
  initialHeadless: defaults.headless,
18064
18069
  initialIgnoreCertificateErrors: defaults.ignoreCertificateErrors,
@@ -20767,7 +20772,7 @@ var getTimelineSequenceLayout = ({
20767
20772
  // src/helpers/use-max-media-duration.ts
20768
20773
  import { getVideoMetadata as getVideoMetadata2 } from "@remotion/media-utils";
20769
20774
 
20770
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/misc.js
20775
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/misc.js
20771
20776
  /*!
20772
20777
  * Copyright (c) 2025-present, Vanilagy and contributors
20773
20778
  *
@@ -20869,23 +20874,22 @@ var readSignedExpGolomb = (bitstream) => {
20869
20874
  var toUint8Array = (source) => {
20870
20875
  if (source.constructor === Uint8Array) {
20871
20876
  return source;
20872
- } else if (source instanceof ArrayBuffer) {
20873
- return new Uint8Array(source);
20874
- } else {
20877
+ } else if (ArrayBuffer.isView(source)) {
20875
20878
  return new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
20879
+ } else {
20880
+ return new Uint8Array(source);
20876
20881
  }
20877
20882
  };
20878
20883
  var toDataView = (source) => {
20879
20884
  if (source.constructor === DataView) {
20880
20885
  return source;
20881
- } else if (source instanceof ArrayBuffer) {
20882
- return new DataView(source);
20883
- } else {
20886
+ } else if (ArrayBuffer.isView(source)) {
20884
20887
  return new DataView(source.buffer, source.byteOffset, source.byteLength);
20888
+ } else {
20889
+ return new DataView(source);
20885
20890
  }
20886
20891
  };
20887
- var textDecoder = new TextDecoder;
20888
- var textEncoder = new TextEncoder;
20892
+ var textDecoder = /* @__PURE__ */ new TextDecoder;
20889
20893
  var invertObject = (object) => {
20890
20894
  return Object.fromEntries(Object.entries(object).map(([key4, value]) => [value, key4]));
20891
20895
  };
@@ -20896,7 +20900,7 @@ var COLOR_PRIMARIES_MAP = {
20896
20900
  bt2020: 9,
20897
20901
  smpte432: 12
20898
20902
  };
20899
- var COLOR_PRIMARIES_MAP_INVERSE = invertObject(COLOR_PRIMARIES_MAP);
20903
+ var COLOR_PRIMARIES_MAP_INVERSE = /* @__PURE__ */ invertObject(COLOR_PRIMARIES_MAP);
20900
20904
  var TRANSFER_CHARACTERISTICS_MAP = {
20901
20905
  bt709: 1,
20902
20906
  smpte170m: 6,
@@ -20905,7 +20909,7 @@ var TRANSFER_CHARACTERISTICS_MAP = {
20905
20909
  pq: 16,
20906
20910
  hlg: 18
20907
20911
  };
20908
- var TRANSFER_CHARACTERISTICS_MAP_INVERSE = invertObject(TRANSFER_CHARACTERISTICS_MAP);
20912
+ var TRANSFER_CHARACTERISTICS_MAP_INVERSE = /* @__PURE__ */ invertObject(TRANSFER_CHARACTERISTICS_MAP);
20909
20913
  var MATRIX_COEFFICIENTS_MAP = {
20910
20914
  rgb: 0,
20911
20915
  bt709: 1,
@@ -20913,7 +20917,7 @@ var MATRIX_COEFFICIENTS_MAP = {
20913
20917
  smpte170m: 6,
20914
20918
  "bt2020-ncl": 9
20915
20919
  };
20916
- var MATRIX_COEFFICIENTS_MAP_INVERSE = invertObject(MATRIX_COEFFICIENTS_MAP);
20920
+ var MATRIX_COEFFICIENTS_MAP_INVERSE = /* @__PURE__ */ invertObject(MATRIX_COEFFICIENTS_MAP);
20917
20921
  var isAllowSharedBufferSource = (x) => {
20918
20922
  return x instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && x instanceof SharedArrayBuffer || ArrayBuffer.isView(x);
20919
20923
  };
@@ -21036,9 +21040,13 @@ var clamp = (value, min, max) => {
21036
21040
  return Math.max(min, Math.min(max, value));
21037
21041
  };
21038
21042
  var UNDETERMINED_LANGUAGE = "und";
21039
- var roundToPrecision = (value, digits) => {
21040
- const factor = 10 ** digits;
21041
- return Math.round(value * factor) / factor;
21043
+ var roundIfAlmostInteger = (value) => {
21044
+ const rounded = Math.round(value);
21045
+ if (Math.abs(value / rounded - 1) < 10 * Number.EPSILON) {
21046
+ return rounded;
21047
+ } else {
21048
+ return value;
21049
+ }
21042
21050
  };
21043
21051
  var roundToMultiple = (value, multiple) => {
21044
21052
  return Math.round(value / multiple) * multiple;
@@ -21090,12 +21098,15 @@ var normalizeHeaders = (headers) => {
21090
21098
  }
21091
21099
  return headers;
21092
21100
  };
21093
- var retriedFetch = async (fetchFn, url, requestInit, getRetryDelay) => {
21101
+ var retriedFetch = async (fetchFn, url, requestInit, getRetryDelay, shouldStop) => {
21094
21102
  let attempts = 0;
21095
21103
  while (true) {
21096
21104
  try {
21097
21105
  return await fetchFn(url, requestInit);
21098
21106
  } catch (error) {
21107
+ if (shouldStop()) {
21108
+ throw error;
21109
+ }
21099
21110
  attempts++;
21100
21111
  const retryDelayInSeconds = getRetryDelay(attempts, error, url);
21101
21112
  if (retryDelayInSeconds === null) {
@@ -21108,6 +21119,9 @@ var retriedFetch = async (fetchFn, url, requestInit, getRetryDelay) => {
21108
21119
  if (retryDelayInSeconds > 0) {
21109
21120
  await new Promise((resolve) => setTimeout(resolve, 1000 * retryDelayInSeconds));
21110
21121
  }
21122
+ if (shouldStop()) {
21123
+ throw error;
21124
+ }
21111
21125
  }
21112
21126
  }
21113
21127
  };
@@ -21124,9 +21138,7 @@ var isWebKit = () => {
21124
21138
  if (isWebKitCache !== null) {
21125
21139
  return isWebKitCache;
21126
21140
  }
21127
- const result = !!(typeof navigator !== "undefined" && navigator.vendor?.match(/apple/i));
21128
- isWebKitCache = result;
21129
- return result;
21141
+ return isWebKitCache = !!(typeof navigator !== "undefined" && navigator.vendor?.match(/apple/i));
21130
21142
  };
21131
21143
  var isFirefoxCache = null;
21132
21144
  var isFirefox = () => {
@@ -21135,6 +21147,13 @@ var isFirefox = () => {
21135
21147
  }
21136
21148
  return isFirefoxCache = typeof navigator !== "undefined" && navigator.userAgent?.includes("Firefox");
21137
21149
  };
21150
+ var isChromiumCache = null;
21151
+ var isChromium = () => {
21152
+ if (isChromiumCache !== null) {
21153
+ return isChromiumCache;
21154
+ }
21155
+ return isChromiumCache = !!(typeof navigator !== "undefined" && navigator.vendor?.includes("Google Inc"));
21156
+ };
21138
21157
  var coalesceIndex = (a, b) => {
21139
21158
  return a !== -1 ? a : b;
21140
21159
  };
@@ -21156,7 +21175,7 @@ var isNumber = (x) => {
21156
21175
  return typeof x === "number" && !Number.isNaN(x);
21157
21176
  };
21158
21177
 
21159
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/tags.js
21178
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/metadata.js
21160
21179
  /*!
21161
21180
  * Copyright (c) 2025-present, Vanilagy and contributors
21162
21181
  *
@@ -21198,8 +21217,16 @@ class AttachedFile {
21198
21217
  }
21199
21218
  }
21200
21219
  }
21220
+ var DEFAULT_TRACK_DISPOSITION = {
21221
+ default: true,
21222
+ forced: false,
21223
+ original: false,
21224
+ commentary: false,
21225
+ hearingImpaired: false,
21226
+ visuallyImpaired: false
21227
+ };
21201
21228
 
21202
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/codec.js
21229
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/codec.js
21203
21230
  /*!
21204
21231
  * Copyright (c) 2025-present, Vanilagy and contributors
21205
21232
  *
@@ -21255,18 +21282,19 @@ var AV1_DEFAULT_SUFFIX = ".0.110.01.01.01.0";
21255
21282
  var extractVideoCodecString = (trackInfo) => {
21256
21283
  const { codec, codecDescription, colorSpace, avcCodecInfo, hevcCodecInfo, vp9CodecInfo, av1CodecInfo } = trackInfo;
21257
21284
  if (codec === "avc") {
21285
+ assert(trackInfo.avcType !== null);
21258
21286
  if (avcCodecInfo) {
21259
21287
  const bytes = new Uint8Array([
21260
21288
  avcCodecInfo.avcProfileIndication,
21261
21289
  avcCodecInfo.profileCompatibility,
21262
21290
  avcCodecInfo.avcLevelIndication
21263
21291
  ]);
21264
- return `avc1.${bytesToHexString(bytes)}`;
21292
+ return `avc${trackInfo.avcType}.${bytesToHexString(bytes)}`;
21265
21293
  }
21266
21294
  if (!codecDescription || codecDescription.byteLength < 4) {
21267
21295
  throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");
21268
21296
  }
21269
- return `avc1.${bytesToHexString(codecDescription.subarray(1, 4))}`;
21297
+ return `avc${trackInfo.avcType}.${bytesToHexString(codecDescription.subarray(1, 4))}`;
21270
21298
  } else if (codec === "hevc") {
21271
21299
  let generalProfileSpace;
21272
21300
  let generalProfileIdc;
@@ -21472,7 +21500,7 @@ var parsePcmCodec = (codec) => {
21472
21500
  return { dataType, sampleSize, littleEndian, silentValue };
21473
21501
  };
21474
21502
 
21475
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/codec-data.js
21503
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/codec-data.js
21476
21504
  /*!
21477
21505
  * Copyright (c) 2025-present, Vanilagy and contributors
21478
21506
  *
@@ -21600,46 +21628,160 @@ var extractAvcDecoderConfigurationRecord = (packetData) => {
21600
21628
  return null;
21601
21629
  }
21602
21630
  const spsData = spsUnits[0];
21603
- const bitstream = new Bitstream(removeEmulationPreventionBytes(spsData));
21604
- bitstream.skipBits(1);
21605
- bitstream.skipBits(2);
21606
- const nal_unit_type = bitstream.readBits(5);
21607
- if (nal_unit_type !== 7) {
21608
- console.error("Invalid SPS NAL unit type");
21609
- return null;
21610
- }
21611
- const profile_idc = bitstream.readAlignedByte();
21612
- const constraint_flags = bitstream.readAlignedByte();
21613
- const level_idc = bitstream.readAlignedByte();
21614
- const record = {
21631
+ const spsInfo = parseAvcSps(spsData);
21632
+ assert(spsInfo !== null);
21633
+ const hasExtendedData = spsInfo.profileIdc === 100 || spsInfo.profileIdc === 110 || spsInfo.profileIdc === 122 || spsInfo.profileIdc === 144;
21634
+ return {
21615
21635
  configurationVersion: 1,
21616
- avcProfileIndication: profile_idc,
21617
- profileCompatibility: constraint_flags,
21618
- avcLevelIndication: level_idc,
21636
+ avcProfileIndication: spsInfo.profileIdc,
21637
+ profileCompatibility: spsInfo.constraintFlags,
21638
+ avcLevelIndication: spsInfo.levelIdc,
21619
21639
  lengthSizeMinusOne: 3,
21620
21640
  sequenceParameterSets: spsUnits,
21621
21641
  pictureParameterSets: ppsUnits,
21642
+ chromaFormat: hasExtendedData ? spsInfo.chromaFormatIdc : null,
21643
+ bitDepthLumaMinus8: hasExtendedData ? spsInfo.bitDepthLumaMinus8 : null,
21644
+ bitDepthChromaMinus8: hasExtendedData ? spsInfo.bitDepthChromaMinus8 : null,
21645
+ sequenceParameterSetExt: hasExtendedData ? spsExtUnits : null
21646
+ };
21647
+ } catch (error) {
21648
+ console.error("Error building AVC Decoder Configuration Record:", error);
21649
+ return null;
21650
+ }
21651
+ };
21652
+ var deserializeAvcDecoderConfigurationRecord = (data) => {
21653
+ try {
21654
+ const view = toDataView(data);
21655
+ let offset = 0;
21656
+ const configurationVersion = view.getUint8(offset++);
21657
+ const avcProfileIndication = view.getUint8(offset++);
21658
+ const profileCompatibility = view.getUint8(offset++);
21659
+ const avcLevelIndication = view.getUint8(offset++);
21660
+ const lengthSizeMinusOne = view.getUint8(offset++) & 3;
21661
+ const numOfSequenceParameterSets = view.getUint8(offset++) & 31;
21662
+ const sequenceParameterSets = [];
21663
+ for (let i = 0;i < numOfSequenceParameterSets; i++) {
21664
+ const length = view.getUint16(offset, false);
21665
+ offset += 2;
21666
+ sequenceParameterSets.push(data.subarray(offset, offset + length));
21667
+ offset += length;
21668
+ }
21669
+ const numOfPictureParameterSets = view.getUint8(offset++);
21670
+ const pictureParameterSets = [];
21671
+ for (let i = 0;i < numOfPictureParameterSets; i++) {
21672
+ const length = view.getUint16(offset, false);
21673
+ offset += 2;
21674
+ pictureParameterSets.push(data.subarray(offset, offset + length));
21675
+ offset += length;
21676
+ }
21677
+ const record = {
21678
+ configurationVersion,
21679
+ avcProfileIndication,
21680
+ profileCompatibility,
21681
+ avcLevelIndication,
21682
+ lengthSizeMinusOne,
21683
+ sequenceParameterSets,
21684
+ pictureParameterSets,
21622
21685
  chromaFormat: null,
21623
21686
  bitDepthLumaMinus8: null,
21624
21687
  bitDepthChromaMinus8: null,
21625
21688
  sequenceParameterSetExt: null
21626
21689
  };
21627
- if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 || profile_idc === 144) {
21628
- readExpGolomb(bitstream);
21629
- const chroma_format_idc = readExpGolomb(bitstream);
21630
- if (chroma_format_idc === 3) {
21690
+ if ((avcProfileIndication === 100 || avcProfileIndication === 110 || avcProfileIndication === 122 || avcProfileIndication === 144) && offset + 4 <= data.length) {
21691
+ const chromaFormat = view.getUint8(offset++) & 3;
21692
+ const bitDepthLumaMinus8 = view.getUint8(offset++) & 7;
21693
+ const bitDepthChromaMinus8 = view.getUint8(offset++) & 7;
21694
+ const numOfSequenceParameterSetExt = view.getUint8(offset++);
21695
+ record.chromaFormat = chromaFormat;
21696
+ record.bitDepthLumaMinus8 = bitDepthLumaMinus8;
21697
+ record.bitDepthChromaMinus8 = bitDepthChromaMinus8;
21698
+ const sequenceParameterSetExt = [];
21699
+ for (let i = 0;i < numOfSequenceParameterSetExt; i++) {
21700
+ const length = view.getUint16(offset, false);
21701
+ offset += 2;
21702
+ sequenceParameterSetExt.push(data.subarray(offset, offset + length));
21703
+ offset += length;
21704
+ }
21705
+ record.sequenceParameterSetExt = sequenceParameterSetExt;
21706
+ }
21707
+ return record;
21708
+ } catch (error) {
21709
+ console.error("Error deserializing AVC Decoder Configuration Record:", error);
21710
+ return null;
21711
+ }
21712
+ };
21713
+ var parseAvcSps = (sps) => {
21714
+ try {
21715
+ const bitstream = new Bitstream(removeEmulationPreventionBytes(sps));
21716
+ bitstream.skipBits(1);
21717
+ bitstream.skipBits(2);
21718
+ const nalUnitType = bitstream.readBits(5);
21719
+ if (nalUnitType !== 7) {
21720
+ return null;
21721
+ }
21722
+ const profileIdc = bitstream.readAlignedByte();
21723
+ const constraintFlags = bitstream.readAlignedByte();
21724
+ const levelIdc = bitstream.readAlignedByte();
21725
+ readExpGolomb(bitstream);
21726
+ let chromaFormatIdc = null;
21727
+ let bitDepthLumaMinus8 = null;
21728
+ let bitDepthChromaMinus8 = null;
21729
+ if (profileIdc === 100 || profileIdc === 110 || profileIdc === 122 || profileIdc === 244 || profileIdc === 44 || profileIdc === 83 || profileIdc === 86 || profileIdc === 118 || profileIdc === 128) {
21730
+ chromaFormatIdc = readExpGolomb(bitstream);
21731
+ if (chromaFormatIdc === 3) {
21631
21732
  bitstream.skipBits(1);
21632
21733
  }
21633
- const bit_depth_luma_minus8 = readExpGolomb(bitstream);
21634
- const bit_depth_chroma_minus8 = readExpGolomb(bitstream);
21635
- record.chromaFormat = chroma_format_idc;
21636
- record.bitDepthLumaMinus8 = bit_depth_luma_minus8;
21637
- record.bitDepthChromaMinus8 = bit_depth_chroma_minus8;
21638
- record.sequenceParameterSetExt = spsExtUnits;
21734
+ bitDepthLumaMinus8 = readExpGolomb(bitstream);
21735
+ bitDepthChromaMinus8 = readExpGolomb(bitstream);
21736
+ bitstream.skipBits(1);
21737
+ const seqScalingMatrixPresentFlag = bitstream.readBits(1);
21738
+ if (seqScalingMatrixPresentFlag) {
21739
+ for (let i = 0;i < (chromaFormatIdc !== 3 ? 8 : 12); i++) {
21740
+ const seqScalingListPresentFlag = bitstream.readBits(1);
21741
+ if (seqScalingListPresentFlag) {
21742
+ const sizeOfScalingList = i < 6 ? 16 : 64;
21743
+ let lastScale = 8;
21744
+ let nextScale = 8;
21745
+ for (let j = 0;j < sizeOfScalingList; j++) {
21746
+ if (nextScale !== 0) {
21747
+ const deltaScale = readSignedExpGolomb(bitstream);
21748
+ nextScale = (lastScale + deltaScale + 256) % 256;
21749
+ }
21750
+ lastScale = nextScale === 0 ? lastScale : nextScale;
21751
+ }
21752
+ }
21753
+ }
21754
+ }
21639
21755
  }
21640
- return record;
21756
+ readExpGolomb(bitstream);
21757
+ const picOrderCntType = readExpGolomb(bitstream);
21758
+ if (picOrderCntType === 0) {
21759
+ readExpGolomb(bitstream);
21760
+ } else if (picOrderCntType === 1) {
21761
+ bitstream.skipBits(1);
21762
+ readSignedExpGolomb(bitstream);
21763
+ readSignedExpGolomb(bitstream);
21764
+ const numRefFramesInPicOrderCntCycle = readExpGolomb(bitstream);
21765
+ for (let i = 0;i < numRefFramesInPicOrderCntCycle; i++) {
21766
+ readSignedExpGolomb(bitstream);
21767
+ }
21768
+ }
21769
+ readExpGolomb(bitstream);
21770
+ bitstream.skipBits(1);
21771
+ readExpGolomb(bitstream);
21772
+ readExpGolomb(bitstream);
21773
+ const frameMbsOnlyFlag = bitstream.readBits(1);
21774
+ return {
21775
+ profileIdc,
21776
+ constraintFlags,
21777
+ levelIdc,
21778
+ frameMbsOnlyFlag,
21779
+ chromaFormatIdc,
21780
+ bitDepthLumaMinus8,
21781
+ bitDepthChromaMinus8
21782
+ };
21641
21783
  } catch (error) {
21642
- console.error("Error building AVC Decoder Configuration Record:", error);
21784
+ console.error("Error parsing AVC SPS:", error);
21643
21785
  return null;
21644
21786
  }
21645
21787
  };
@@ -22632,7 +22774,7 @@ var readVorbisComments = (bytes, metadataTags) => {
22632
22774
  }
22633
22775
  };
22634
22776
 
22635
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/demuxer.js
22777
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/demuxer.js
22636
22778
  /*!
22637
22779
  * Copyright (c) 2025-present, Vanilagy and contributors
22638
22780
  *
@@ -22647,7 +22789,7 @@ class Demuxer {
22647
22789
  }
22648
22790
  }
22649
22791
 
22650
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/custom-coder.js
22792
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/custom-coder.js
22651
22793
  /*!
22652
22794
  * Copyright (c) 2025-present, Vanilagy and contributors
22653
22795
  *
@@ -22658,7 +22800,7 @@ class Demuxer {
22658
22800
  var customVideoDecoders = [];
22659
22801
  var customAudioDecoders = [];
22660
22802
 
22661
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/packet.js
22803
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/packet.js
22662
22804
  /*!
22663
22805
  * Copyright (c) 2025-present, Vanilagy and contributors
22664
22806
  *
@@ -22666,7 +22808,7 @@ var customAudioDecoders = [];
22666
22808
  * License, v. 2.0. If a copy of the MPL was not distributed with this
22667
22809
  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
22668
22810
  */
22669
- var PLACEHOLDER_DATA = new Uint8Array(0);
22811
+ var PLACEHOLDER_DATA = /* @__PURE__ */ new Uint8Array(0);
22670
22812
 
22671
22813
  class EncodedPacket {
22672
22814
  constructor(data, type, timestamp, duration, sequenceNumber = -1, byteLength, sideData) {
@@ -22790,7 +22932,7 @@ class EncodedPacket {
22790
22932
  }
22791
22933
  }
22792
22934
 
22793
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/sample.js
22935
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/sample.js
22794
22936
  /*!
22795
22937
  * Copyright (c) 2025-present, Vanilagy and contributors
22796
22938
  *
@@ -23143,12 +23285,14 @@ class VideoSample {
23143
23285
  dx = (canvasWidth - newWidth) / 2;
23144
23286
  dy = (canvasHeight - newHeight) / 2;
23145
23287
  }
23288
+ context.save();
23146
23289
  const aspectRatioChange = rotation % 180 === 0 ? 1 : newWidth / newHeight;
23147
23290
  context.translate(canvasWidth / 2, canvasHeight / 2);
23148
23291
  context.rotate(rotation * Math.PI / 180);
23149
23292
  context.scale(1 / aspectRatioChange, aspectRatioChange);
23150
23293
  context.translate(-canvasWidth / 2, -canvasHeight / 2);
23151
23294
  context.drawImage(this.toCanvasImageSource(), sx, sy, sWidth, sHeight, dx, dy, newWidth, newHeight);
23295
+ context.restore();
23152
23296
  }
23153
23297
  _rotateSourceRegion(sx, sy, sWidth, sHeight, rotation) {
23154
23298
  if (rotation === 90) {
@@ -23238,7 +23382,7 @@ var validateCropRectangle = (crop, prefix) => {
23238
23382
  };
23239
23383
  var AUDIO_SAMPLE_FORMATS = new Set(["f32", "f32-planar", "s16", "s16-planar", "s32", "s32-planar", "u8", "u8-planar"]);
23240
23384
 
23241
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/media-sink.js
23385
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/media-sink.js
23242
23386
  /*!
23243
23387
  * Copyright (c) 2025-present, Vanilagy and contributors
23244
23388
  *
@@ -23798,6 +23942,18 @@ class VideoDecoderWrapper extends DecoderWrapper {
23798
23942
  this.colorQueue.push(frame2);
23799
23943
  }
23800
23944
  };
23945
+ if (codec === "avc" && this.decoderConfig.description && isChromium()) {
23946
+ const record = deserializeAvcDecoderConfigurationRecord(toUint8Array(this.decoderConfig.description));
23947
+ if (record && record.sequenceParameterSets.length > 0) {
23948
+ const sps = parseAvcSps(record.sequenceParameterSets[0]);
23949
+ if (sps && sps.frameMbsOnlyFlag === 0) {
23950
+ this.decoderConfig = {
23951
+ ...this.decoderConfig,
23952
+ hardwareAcceleration: "prefer-software"
23953
+ };
23954
+ }
23955
+ }
23956
+ }
23801
23957
  this.decoder = new VideoDecoder({
23802
23958
  output: (frame2) => {
23803
23959
  try {
@@ -23808,7 +23964,7 @@ class VideoDecoderWrapper extends DecoderWrapper {
23808
23964
  },
23809
23965
  error: onError
23810
23966
  });
23811
- this.decoder.configure(decoderConfig);
23967
+ this.decoder.configure(this.decoderConfig);
23812
23968
  }
23813
23969
  }
23814
23970
  getDecodeQueueSize() {
@@ -24168,7 +24324,7 @@ class VideoSampleSink extends BaseMediaSampleSink {
24168
24324
  }
24169
24325
  }
24170
24326
 
24171
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input-track.js
24327
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/input-track.js
24172
24328
  /*!
24173
24329
  * Copyright (c) 2025-present, Vanilagy and contributors
24174
24330
  *
@@ -24203,6 +24359,9 @@ class InputTrack {
24203
24359
  get timeResolution() {
24204
24360
  return this._backing.getTimeResolution();
24205
24361
  }
24362
+ get disposition() {
24363
+ return this._backing.getDisposition();
24364
+ }
24206
24365
  getFirstTimestamp() {
24207
24366
  return this._backing.getFirstTimestamp();
24208
24367
  }
@@ -24374,7 +24533,7 @@ class InputAudioTrack extends InputTrack {
24374
24533
  }
24375
24534
  }
24376
24535
 
24377
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-misc.js
24536
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-misc.js
24378
24537
  /*!
24379
24538
  * Copyright (c) 2025-present, Vanilagy and contributors
24380
24539
  *
@@ -24392,7 +24551,7 @@ var buildIsobmffMimeType = (info) => {
24392
24551
  return string;
24393
24552
  };
24394
24553
 
24395
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-reader.js
24554
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-reader.js
24396
24555
  /*!
24397
24556
  * Copyright (c) 2025-present, Vanilagy and contributors
24398
24557
  *
@@ -24468,7 +24627,7 @@ var readDataBox = (slice) => {
24468
24627
  }
24469
24628
  };
24470
24629
 
24471
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js
24630
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js
24472
24631
  /*!
24473
24632
  * Copyright (c) 2025-present, Vanilagy and contributors
24474
24633
  *
@@ -24543,6 +24702,7 @@ class IsobmffDemuxer extends Demuxer {
24543
24702
  break;
24544
24703
  this.moovSlice = moovSlice;
24545
24704
  this.readContiguousBoxes(this.moovSlice);
24705
+ this.tracks.sort((a, b) => Number(b.disposition.default) - Number(a.disposition.default));
24546
24706
  for (const track of this.tracks) {
24547
24707
  const previousSegmentDurationsInSeconds = track.editListPreviousSegmentDurations / this.movieTimescale;
24548
24708
  track.editListOffset -= Math.round(previousSegmentDurationsInSeconds * track.timescale);
@@ -24771,6 +24931,9 @@ class IsobmffDemuxer extends Demuxer {
24771
24931
  id: -1,
24772
24932
  demuxer: this,
24773
24933
  inputTrack: null,
24934
+ disposition: {
24935
+ ...DEFAULT_TRACK_DISPOSITION
24936
+ },
24774
24937
  info: null,
24775
24938
  timescale: -1,
24776
24939
  durationInMovieTimescale: -1,
@@ -24812,10 +24975,8 @@ class IsobmffDemuxer extends Demuxer {
24812
24975
  }
24813
24976
  const version = readU8(slice);
24814
24977
  const flags = readU24Be(slice);
24815
- const trackEnabled = (flags & 1) !== 0;
24816
- if (!trackEnabled) {
24817
- break;
24818
- }
24978
+ const trackEnabled = !!(flags & 1);
24979
+ track.disposition.default = trackEnabled;
24819
24980
  if (version === 0) {
24820
24981
  slice.skip(8);
24821
24982
  track.id = readU32Be(slice);
@@ -24931,6 +25092,7 @@ class IsobmffDemuxer extends Demuxer {
24931
25092
  codec: null,
24932
25093
  codecDescription: null,
24933
25094
  colorSpace: null,
25095
+ avcType: null,
24934
25096
  avcCodecInfo: null,
24935
25097
  hevcCodecInfo: null,
24936
25098
  vp9CodecInfo: null,
@@ -24981,8 +25143,9 @@ class IsobmffDemuxer extends Demuxer {
24981
25143
  track.internalCodecId = sampleBoxInfo.name;
24982
25144
  const lowercaseBoxName = sampleBoxInfo.name.toLowerCase();
24983
25145
  if (track.info.type === "video") {
24984
- if (lowercaseBoxName === "avc1") {
25146
+ if (lowercaseBoxName === "avc1" || lowercaseBoxName === "avc3") {
24985
25147
  track.info.codec = "avc";
25148
+ track.info.avcType = lowercaseBoxName === "avc1" ? 1 : 3;
24986
25149
  } else if (lowercaseBoxName === "hvc1" || lowercaseBoxName === "hev1") {
24987
25150
  track.info.codec = "hevc";
24988
25151
  } else if (lowercaseBoxName === "vp08") {
@@ -26271,6 +26434,9 @@ class IsobmffTrackBacking {
26271
26434
  getTimeResolution() {
26272
26435
  return this.internalTrack.timescale;
26273
26436
  }
26437
+ getDisposition() {
26438
+ return this.internalTrack.disposition;
26439
+ }
26274
26440
  async computeDuration() {
26275
26441
  const lastPacket = await this.getPacket(Infinity, { metadataOnly: true });
26276
26442
  return (lastPacket?.timestamp ?? 0) + (lastPacket?.duration ?? 0);
@@ -26299,7 +26465,7 @@ class IsobmffTrackBacking {
26299
26465
  }, -Infinity, Infinity, options);
26300
26466
  }
26301
26467
  mapTimestampIntoTimescale(timestamp) {
26302
- return roundToPrecision(timestamp * this.internalTrack.timescale, 14) + this.internalTrack.editListOffset;
26468
+ return roundIfAlmostInteger(timestamp * this.internalTrack.timescale) + this.internalTrack.editListOffset;
26303
26469
  }
26304
26470
  async getPacket(timestamp, options) {
26305
26471
  const timestampInTimescale = this.mapTimestampIntoTimescale(timestamp);
@@ -26724,7 +26890,7 @@ var sampleTableIsEmpty = (sampleTable) => {
26724
26890
  return sampleTable.sampleSizes.length === 0;
26725
26891
  };
26726
26892
 
26727
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/ebml.js
26893
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/matroska/ebml.js
26728
26894
  /*!
26729
26895
  * Copyright (c) 2025-present, Vanilagy and contributors
26730
26896
  *
@@ -26761,6 +26927,10 @@ var EBMLId;
26761
26927
  EBMLId2[EBMLId2["FlagEnabled"] = 185] = "FlagEnabled";
26762
26928
  EBMLId2[EBMLId2["FlagDefault"] = 136] = "FlagDefault";
26763
26929
  EBMLId2[EBMLId2["FlagForced"] = 21930] = "FlagForced";
26930
+ EBMLId2[EBMLId2["FlagOriginal"] = 21934] = "FlagOriginal";
26931
+ EBMLId2[EBMLId2["FlagHearingImpaired"] = 21931] = "FlagHearingImpaired";
26932
+ EBMLId2[EBMLId2["FlagVisualImpaired"] = 21932] = "FlagVisualImpaired";
26933
+ EBMLId2[EBMLId2["FlagCommentary"] = 21935] = "FlagCommentary";
26764
26934
  EBMLId2[EBMLId2["FlagLacing"] = 156] = "FlagLacing";
26765
26935
  EBMLId2[EBMLId2["Name"] = 21358] = "Name";
26766
26936
  EBMLId2[EBMLId2["Language"] = 2274716] = "Language";
@@ -26909,13 +27079,6 @@ var readUnsignedBigInt = (slice, width) => {
26909
27079
  }
26910
27080
  return value;
26911
27081
  };
26912
- var readSignedInt = (slice, width) => {
26913
- let value = readUnsignedInt(slice, width);
26914
- if (value & 1 << width * 8 - 1) {
26915
- value -= 2 ** (width * 8);
26916
- }
26917
- return value;
26918
- };
26919
27082
  var readElementId = (slice) => {
26920
27083
  const size4 = readVarIntSize(slice);
26921
27084
  if (size4 === null) {
@@ -27042,7 +27205,7 @@ function assertDefinedSize(size4) {
27042
27205
  }
27043
27206
  }
27044
27207
 
27045
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/matroska-misc.js
27208
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/matroska/matroska-misc.js
27046
27209
  /*!
27047
27210
  * Copyright (c) 2025-present, Vanilagy and contributors
27048
27211
  *
@@ -27060,7 +27223,7 @@ var buildMatroskaMimeType = (info) => {
27060
27223
  return string;
27061
27224
  };
27062
27225
 
27063
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js
27226
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js
27064
27227
  /*!
27065
27228
  * Copyright (c) 2025-present, Vanilagy and contributors
27066
27229
  *
@@ -27310,7 +27473,7 @@ class MatroskaDemuxer extends Demuxer {
27310
27473
  this.currentSegment.timestampScale = 1e6;
27311
27474
  this.currentSegment.timestampFactor = 1e9 / 1e6;
27312
27475
  }
27313
- this.currentSegment.tracks.sort((a, b) => Number(b.isDefault) - Number(a.isDefault));
27476
+ this.currentSegment.tracks.sort((a, b) => Number(b.disposition.default) - Number(a.disposition.default));
27314
27477
  const idToTrack = new Map(this.currentSegment.tracks.map((x) => [x.id, x]));
27315
27478
  for (const cuePoint of this.currentSegment.cuePoints) {
27316
27479
  const track = idToTrack.get(cuePoint.trackId);
@@ -27382,17 +27545,12 @@ class MatroskaDemuxer extends Demuxer {
27382
27545
  for (const [, trackData] of cluster.trackData) {
27383
27546
  const track = trackData.track;
27384
27547
  assert(trackData.blocks.length > 0);
27385
- let blockReferencesExist = false;
27386
27548
  let hasLacedBlocks = false;
27387
27549
  for (let i = 0;i < trackData.blocks.length; i++) {
27388
27550
  const block = trackData.blocks[i];
27389
27551
  block.timestamp += cluster.timestamp;
27390
- blockReferencesExist ||= block.referencedTimestamps.length > 0;
27391
27552
  hasLacedBlocks ||= block.lacing !== BlockLacing.None;
27392
27553
  }
27393
- if (blockReferencesExist) {
27394
- trackData.blocks = sortBlocksByReferences(trackData.blocks);
27395
- }
27396
27554
  trackData.presentationTimestamps = trackData.blocks.map((block, i) => ({ timestamp: block.timestamp, blockIndex: i })).sort((a, b) => a.timestamp - b.timestamp);
27397
27555
  for (let i = 0;i < trackData.presentationTimestamps.length; i++) {
27398
27556
  const currentEntry = trackData.presentationTimestamps[i];
@@ -27530,7 +27688,6 @@ class MatroskaDemuxer extends Demuxer {
27530
27688
  timestamp: frameTimestamp,
27531
27689
  duration: frameDuration,
27532
27690
  isKeyFrame: originalBlock.isKeyFrame,
27533
- referencedTimestamps: originalBlock.referencedTimestamps,
27534
27691
  data: frameData,
27535
27692
  lacing: BlockLacing.None,
27536
27693
  decoded: true,
@@ -27659,7 +27816,9 @@ class MatroskaDemuxer extends Demuxer {
27659
27816
  demuxer: this,
27660
27817
  clusterPositionCache: [],
27661
27818
  cuePoints: [],
27662
- isDefault: false,
27819
+ disposition: {
27820
+ ...DEFAULT_TRACK_DISPOSITION
27821
+ },
27663
27822
  inputTrack: null,
27664
27823
  codecId: null,
27665
27824
  codecPrivate: null,
@@ -27807,7 +27966,47 @@ class MatroskaDemuxer extends Demuxer {
27807
27966
  {
27808
27967
  if (!this.currentTrack)
27809
27968
  break;
27810
- this.currentTrack.isDefault = !!readUnsignedInt(slice, size4);
27969
+ this.currentTrack.disposition.default = !!readUnsignedInt(slice, size4);
27970
+ }
27971
+ ;
27972
+ break;
27973
+ case EBMLId.FlagForced:
27974
+ {
27975
+ if (!this.currentTrack)
27976
+ break;
27977
+ this.currentTrack.disposition.forced = !!readUnsignedInt(slice, size4);
27978
+ }
27979
+ ;
27980
+ break;
27981
+ case EBMLId.FlagOriginal:
27982
+ {
27983
+ if (!this.currentTrack)
27984
+ break;
27985
+ this.currentTrack.disposition.original = !!readUnsignedInt(slice, size4);
27986
+ }
27987
+ ;
27988
+ break;
27989
+ case EBMLId.FlagHearingImpaired:
27990
+ {
27991
+ if (!this.currentTrack)
27992
+ break;
27993
+ this.currentTrack.disposition.hearingImpaired = !!readUnsignedInt(slice, size4);
27994
+ }
27995
+ ;
27996
+ break;
27997
+ case EBMLId.FlagVisualImpaired:
27998
+ {
27999
+ if (!this.currentTrack)
28000
+ break;
28001
+ this.currentTrack.disposition.visuallyImpaired = !!readUnsignedInt(slice, size4);
28002
+ }
28003
+ ;
28004
+ break;
28005
+ case EBMLId.FlagCommentary:
28006
+ {
28007
+ if (!this.currentTrack)
28008
+ break;
28009
+ this.currentTrack.disposition.commentary = !!readUnsignedInt(slice, size4);
27811
28010
  }
27812
28011
  ;
27813
28012
  break;
@@ -28070,15 +28269,17 @@ class MatroskaDemuxer extends Demuxer {
28070
28269
  break;
28071
28270
  const relativeTimestamp = readI16Be(slice);
28072
28271
  const flags = readU8(slice);
28073
- const isKeyFrame = !!(flags & 128);
28074
28272
  const lacing = flags >> 1 & 3;
28273
+ let isKeyFrame = !!(flags & 128);
28274
+ if (trackData.track.info?.type === "audio" && trackData.track.info.codec) {
28275
+ isKeyFrame = true;
28276
+ }
28075
28277
  const blockData = readBytes(slice, size4 - (slice.filePos - dataStartPos));
28076
28278
  const hasDecodingInstructions = trackData.track.decodingInstructions.length > 0;
28077
28279
  trackData.blocks.push({
28078
28280
  timestamp: relativeTimestamp,
28079
28281
  duration: 0,
28080
28282
  isKeyFrame,
28081
- referencedTimestamps: [],
28082
28283
  data: blockData,
28083
28284
  lacing,
28084
28285
  decoded: !hasDecodingInstructions,
@@ -28092,12 +28293,7 @@ class MatroskaDemuxer extends Demuxer {
28092
28293
  if (!this.currentCluster)
28093
28294
  break;
28094
28295
  this.readContiguousElements(slice.slice(dataStartPos, size4));
28095
- if (this.currentBlock) {
28096
- for (let i = 0;i < this.currentBlock.referencedTimestamps.length; i++) {
28097
- this.currentBlock.referencedTimestamps[i] += this.currentBlock.timestamp;
28098
- }
28099
- this.currentBlock = null;
28100
- }
28296
+ this.currentBlock = null;
28101
28297
  }
28102
28298
  ;
28103
28299
  break;
@@ -28120,7 +28316,6 @@ class MatroskaDemuxer extends Demuxer {
28120
28316
  timestamp: relativeTimestamp,
28121
28317
  duration: 0,
28122
28318
  isKeyFrame: true,
28123
- referencedTimestamps: [],
28124
28319
  data: blockData,
28125
28320
  lacing,
28126
28321
  decoded: !hasDecodingInstructions,
@@ -28181,8 +28376,6 @@ class MatroskaDemuxer extends Demuxer {
28181
28376
  if (!this.currentBlock)
28182
28377
  break;
28183
28378
  this.currentBlock.isKeyFrame = false;
28184
- const relativeTimestamp = readSignedInt(slice, size4);
28185
- this.currentBlock.referencedTimestamps.push(relativeTimestamp);
28186
28379
  }
28187
28380
  ;
28188
28381
  break;
@@ -28580,6 +28773,9 @@ class MatroskaTrackBacking {
28580
28773
  getTimeResolution() {
28581
28774
  return this.internalTrack.segment.timestampFactor;
28582
28775
  }
28776
+ getDisposition() {
28777
+ return this.internalTrack.disposition;
28778
+ }
28583
28779
  async getFirstPacket(options) {
28584
28780
  return this.performClusterLookup(null, (cluster) => {
28585
28781
  const trackData = cluster.trackData.get(this.internalTrack.id);
@@ -28596,7 +28792,7 @@ class MatroskaTrackBacking {
28596
28792
  }, -Infinity, Infinity, options);
28597
28793
  }
28598
28794
  intoTimescale(timestamp) {
28599
- return roundToPrecision(timestamp * this.internalTrack.segment.timestampFactor, 14);
28795
+ return roundIfAlmostInteger(timestamp * this.internalTrack.segment.timestampFactor);
28600
28796
  }
28601
28797
  async getPacket(timestamp, options) {
28602
28798
  const timestampInTimescale = this.intoTimescale(timestamp);
@@ -28859,6 +29055,7 @@ class MatroskaVideoTrackBacking extends MatroskaTrackBacking {
28859
29055
  codec: this.internalTrack.info.codec,
28860
29056
  codecDescription: this.internalTrack.info.codecDescription,
28861
29057
  colorSpace: this.internalTrack.info.colorSpace,
29058
+ avcType: 1,
28862
29059
  avcCodecInfo: this.internalTrack.info.codec === "avc" && firstPacket ? extractAvcDecoderConfigurationRecord(firstPacket.data) : null,
28863
29060
  hevcCodecInfo: this.internalTrack.info.codec === "hevc" && firstPacket ? extractHevcDecoderConfigurationRecord(firstPacket.data) : null,
28864
29061
  vp9CodecInfo: this.internalTrack.info.codec === "vp9" && firstPacket ? extractVp9CodecInfoFromPacket(firstPacket.data) : null,
@@ -28904,36 +29101,8 @@ class MatroskaAudioTrackBacking extends MatroskaTrackBacking {
28904
29101
  };
28905
29102
  }
28906
29103
  }
28907
- var sortBlocksByReferences = (blocks) => {
28908
- const timestampToBlock = new Map;
28909
- for (let i = 0;i < blocks.length; i++) {
28910
- const block = blocks[i];
28911
- timestampToBlock.set(block.timestamp, block);
28912
- }
28913
- const processedBlocks = new Set;
28914
- const result = [];
28915
- const processBlock = (block) => {
28916
- if (processedBlocks.has(block)) {
28917
- return;
28918
- }
28919
- processedBlocks.add(block);
28920
- for (let j = 0;j < block.referencedTimestamps.length; j++) {
28921
- const timestamp = block.referencedTimestamps[j];
28922
- const otherBlock = timestampToBlock.get(timestamp);
28923
- if (!otherBlock) {
28924
- continue;
28925
- }
28926
- processBlock(otherBlock);
28927
- }
28928
- result.push(block);
28929
- };
28930
- for (let i = 0;i < blocks.length; i++) {
28931
- processBlock(blocks[i]);
28932
- }
28933
- return result;
28934
- };
28935
29104
 
28936
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/shared/mp3-misc.js
29105
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/shared/mp3-misc.js
28937
29106
  /*!
28938
29107
  * Copyright (c) 2025-present, Vanilagy and contributors
28939
29108
  *
@@ -29175,7 +29344,7 @@ var decodeSynchsafe = (synchsafed) => {
29175
29344
  return unsynchsafed;
29176
29345
  };
29177
29346
 
29178
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/id3.js
29347
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/id3.js
29179
29348
  /*!
29180
29349
  * Copyright (c) 2025-present, Vanilagy and contributors
29181
29350
  *
@@ -29875,7 +30044,7 @@ class Id3V2Reader {
29875
30044
  }
29876
30045
  }
29877
30046
 
29878
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/mp3/mp3-reader.js
30047
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/mp3/mp3-reader.js
29879
30048
  /*!
29880
30049
  * Copyright (c) 2025-present, Vanilagy and contributors
29881
30050
  *
@@ -29901,7 +30070,7 @@ var readNextFrameHeader = async (reader, startPos, until) => {
29901
30070
  return null;
29902
30071
  };
29903
30072
 
29904
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js
30073
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js
29905
30074
  /*!
29906
30075
  * Copyright (c) 2025-present, Vanilagy and contributors
29907
30076
  *
@@ -30084,6 +30253,11 @@ class Mp3AudioTrackBacking {
30084
30253
  assert(this.demuxer.firstFrameHeader);
30085
30254
  return this.demuxer.firstFrameHeader.sampleRate;
30086
30255
  }
30256
+ getDisposition() {
30257
+ return {
30258
+ ...DEFAULT_TRACK_DISPOSITION
30259
+ };
30260
+ }
30087
30261
  async getDecoderConfig() {
30088
30262
  assert(this.demuxer.firstFrameHeader);
30089
30263
  return {
@@ -30161,7 +30335,7 @@ class Mp3AudioTrackBacking {
30161
30335
  }
30162
30336
  }
30163
30337
 
30164
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-misc.js
30338
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/ogg/ogg-misc.js
30165
30339
  /*!
30166
30340
  * Copyright (c) 2025-present, Vanilagy and contributors
30167
30341
  *
@@ -30232,7 +30406,7 @@ var buildOggMimeType = (info) => {
30232
30406
  return string;
30233
30407
  };
30234
30408
 
30235
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-reader.js
30409
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/ogg/ogg-reader.js
30236
30410
  /*!
30237
30411
  * Copyright (c) 2025-present, Vanilagy and contributors
30238
30412
  *
@@ -30296,7 +30470,7 @@ var findNextPageHeader = (slice, until) => {
30296
30470
  return false;
30297
30471
  };
30298
30472
 
30299
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-demuxer.js
30473
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/ogg/ogg-demuxer.js
30300
30474
  /*!
30301
30475
  * Copyright (c) 2025-present, Vanilagy and contributors
30302
30476
  *
@@ -30592,6 +30766,11 @@ class OggAudioTrackBacking {
30592
30766
  getLanguageCode() {
30593
30767
  return UNDETERMINED_LANGUAGE;
30594
30768
  }
30769
+ getDisposition() {
30770
+ return {
30771
+ ...DEFAULT_TRACK_DISPOSITION
30772
+ };
30773
+ }
30595
30774
  async getFirstTimestamp() {
30596
30775
  return 0;
30597
30776
  }
@@ -30658,7 +30837,7 @@ class OggAudioTrackBacking {
30658
30837
  if (this.demuxer.reader.fileSize === null) {
30659
30838
  return this.getPacketSequential(timestamp, options);
30660
30839
  }
30661
- const timestampInSamples = roundToPrecision(timestamp * this.internalSampleRate, 14);
30840
+ const timestampInSamples = roundIfAlmostInteger(timestamp * this.internalSampleRate);
30662
30841
  if (timestampInSamples === 0) {
30663
30842
  return this.getFirstPacket(options);
30664
30843
  }
@@ -30862,7 +31041,7 @@ class OggAudioTrackBacking {
30862
31041
  async getPacketSequential(timestamp, options) {
30863
31042
  const release = await this.sequentialScanMutex.acquire();
30864
31043
  try {
30865
- const timestampInSamples = roundToPrecision(timestamp * this.internalSampleRate, 14);
31044
+ const timestampInSamples = roundIfAlmostInteger(timestamp * this.internalSampleRate);
30866
31045
  timestamp = timestampInSamples / this.internalSampleRate;
30867
31046
  const index = binarySearchLessOrEqual(this.sequentialScanCache, timestampInSamples, (x) => x.timestampInSamples);
30868
31047
  let currentPacket;
@@ -30951,7 +31130,7 @@ var findPreviousPacketEndPosition = (pageList, startPage, startSegmentIndex) =>
30951
31130
  return { page: previousPage, segmentIndex: previousPage.lacingValues.length - 1 };
30952
31131
  };
30953
31132
 
30954
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js
31133
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js
30955
31134
  /*!
30956
31135
  * Copyright (c) 2025-present, Vanilagy and contributors
30957
31136
  *
@@ -31297,6 +31476,11 @@ class WaveAudioTrackBacking {
31297
31476
  getLanguageCode() {
31298
31477
  return UNDETERMINED_LANGUAGE;
31299
31478
  }
31479
+ getDisposition() {
31480
+ return {
31481
+ ...DEFAULT_TRACK_DISPOSITION
31482
+ };
31483
+ }
31300
31484
  async getFirstTimestamp() {
31301
31485
  return 0;
31302
31486
  }
@@ -31367,7 +31551,7 @@ class WaveAudioTrackBacking {
31367
31551
  }
31368
31552
  }
31369
31553
 
31370
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/adts/adts-reader.js
31554
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/adts/adts-reader.js
31371
31555
  /*!
31372
31556
  * Copyright (c) 2025-present, Vanilagy and contributors
31373
31557
  *
@@ -31428,7 +31612,7 @@ var readFrameHeader2 = (slice) => {
31428
31612
  };
31429
31613
  };
31430
31614
 
31431
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js
31615
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js
31432
31616
  /*!
31433
31617
  * Copyright (c) 2025-present, Vanilagy and contributors
31434
31618
  *
@@ -31555,6 +31739,11 @@ class AdtsAudioTrackBacking {
31555
31739
  assert(sampleRate !== undefined);
31556
31740
  return sampleRate;
31557
31741
  }
31742
+ getDisposition() {
31743
+ return {
31744
+ ...DEFAULT_TRACK_DISPOSITION
31745
+ };
31746
+ }
31558
31747
  async getDecoderConfig() {
31559
31748
  assert(this.demuxer.firstFrameHeader);
31560
31749
  const bytes = new Uint8Array(3);
@@ -31644,7 +31833,7 @@ class AdtsAudioTrackBacking {
31644
31833
  }
31645
31834
  }
31646
31835
 
31647
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/flac/flac-misc.js
31836
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/flac/flac-misc.js
31648
31837
  /*!
31649
31838
  * Copyright (c) 2025-present, Vanilagy and contributors
31650
31839
  *
@@ -31779,7 +31968,7 @@ var calculateCrc8 = (data) => {
31779
31968
  return crc;
31780
31969
  };
31781
31970
 
31782
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/flac/flac-demuxer.js
31971
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/flac/flac-demuxer.js
31783
31972
  /*!
31784
31973
  * Copyright (c) 2025-present, Vanilagy and contributors
31785
31974
  *
@@ -31942,10 +32131,11 @@ class FlacDemuxer extends Demuxer {
31942
32131
  }
31943
32132
  const nextByte = readU8(slice);
31944
32133
  if (nextByte === 255) {
32134
+ const positionBeforeReading = slice.filePos;
31945
32135
  const byteAfterNextByte = readU8(slice);
31946
32136
  const expected = this.blockingBit === 1 ? 249 : 248;
31947
32137
  if (byteAfterNextByte !== expected) {
31948
- slice.skip(-1);
32138
+ slice.filePos = positionBeforeReading;
31949
32139
  continue;
31950
32140
  }
31951
32141
  slice.skip(-2);
@@ -31955,17 +32145,17 @@ class FlacDemuxer extends Demuxer {
31955
32145
  isFirstPacket: false
31956
32146
  });
31957
32147
  if (!nextFrameHeader) {
31958
- slice.skip(-1);
32148
+ slice.filePos = positionBeforeReading;
31959
32149
  continue;
31960
32150
  }
31961
32151
  if (this.blockingBit === 0) {
31962
32152
  if (nextFrameHeader.num - frameHeader.num !== 1) {
31963
- slice.skip(-1);
32153
+ slice.filePos = positionBeforeReading;
31964
32154
  continue;
31965
32155
  }
31966
32156
  } else {
31967
32157
  if (nextFrameHeader.num - frameHeader.num !== frameHeader.blockSize) {
31968
- slice.skip(-1);
32158
+ slice.filePos = positionBeforeReading;
31969
32159
  continue;
31970
32160
  }
31971
32161
  }
@@ -32105,6 +32295,11 @@ class FlacAudioTrackBacking {
32105
32295
  assert(this.demuxer.audioInfo);
32106
32296
  return this.demuxer.audioInfo.sampleRate;
32107
32297
  }
32298
+ getDisposition() {
32299
+ return {
32300
+ ...DEFAULT_TRACK_DISPOSITION
32301
+ };
32302
+ }
32108
32303
  async getFirstTimestamp() {
32109
32304
  return 0;
32110
32305
  }
@@ -32197,7 +32392,7 @@ class FlacAudioTrackBacking {
32197
32392
  }
32198
32393
  }
32199
32394
 
32200
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input-format.js
32395
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/input-format.js
32201
32396
  /*!
32202
32397
  * Copyright (c) 2025-present, Vanilagy and contributors
32203
32398
  *
@@ -32508,18 +32703,18 @@ class AdtsInputFormat extends InputFormat {
32508
32703
  return "audio/aac";
32509
32704
  }
32510
32705
  }
32511
- var MP4 = new Mp4InputFormat;
32512
- var QTFF = new QuickTimeInputFormat;
32513
- var MATROSKA = new MatroskaInputFormat;
32514
- var WEBM = new WebMInputFormat;
32515
- var MP3 = new Mp3InputFormat;
32516
- var WAVE = new WaveInputFormat;
32517
- var OGG = new OggInputFormat;
32518
- var ADTS = new AdtsInputFormat;
32519
- var FLAC = new FlacInputFormat;
32706
+ var MP4 = /* @__PURE__ */ new Mp4InputFormat;
32707
+ var QTFF = /* @__PURE__ */ new QuickTimeInputFormat;
32708
+ var MATROSKA = /* @__PURE__ */ new MatroskaInputFormat;
32709
+ var WEBM = /* @__PURE__ */ new WebMInputFormat;
32710
+ var MP3 = /* @__PURE__ */ new Mp3InputFormat;
32711
+ var WAVE = /* @__PURE__ */ new WaveInputFormat;
32712
+ var OGG = /* @__PURE__ */ new OggInputFormat;
32713
+ var ADTS = /* @__PURE__ */ new AdtsInputFormat;
32714
+ var FLAC = /* @__PURE__ */ new FlacInputFormat;
32520
32715
  var ALL_FORMATS = [MP4, QTFF, MATROSKA, WEBM, WAVE, OGG, FLAC, MP3, ADTS];
32521
32716
 
32522
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/source.js
32717
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/source.js
32523
32718
  var nodeAlias = (() => ({}));
32524
32719
  /*!
32525
32720
  * Copyright (c) 2025-present, Vanilagy and contributors
@@ -32563,6 +32758,7 @@ var DEFAULT_RETRY_DELAY = (previousAttempts, error, src) => {
32563
32758
  } catch {}
32564
32759
  const isOnline = typeof navigator !== "undefined" && typeof navigator.onLine === "boolean" ? navigator.onLine : true;
32565
32760
  if (isOnline && originOfSrc !== null && originOfSrc !== window.location.origin) {
32761
+ console.warn(`Request will not be retried because a CORS error was suspected due to different origins. You can` + ` modify this behavior by providing your own function for the 'getRetryDelay' option.`);
32566
32762
  return null;
32567
32763
  }
32568
32764
  }
@@ -32608,14 +32804,14 @@ class UrlSource extends Source {
32608
32804
  Range: "bytes=0-"
32609
32805
  },
32610
32806
  signal: abortController.signal
32611
- }), this._getRetryDelay);
32807
+ }), this._getRetryDelay, () => this._disposed);
32612
32808
  if (!response.ok) {
32613
32809
  throw new Error(`Error fetching ${String(this._url)}: ${response.status} ${response.statusText}`);
32614
32810
  }
32615
32811
  let worker;
32616
32812
  let fileSize;
32617
32813
  if (response.status === 206) {
32618
- fileSize = this._getPartialLengthFromRangeResponse(response);
32814
+ fileSize = this._getTotalLengthFromRangeResponse(response);
32619
32815
  worker = this._orchestrator.createWorker(0, Math.min(fileSize, URL_SOURCE_MIN_LOAD_AMOUNT));
32620
32816
  } else {
32621
32817
  const contentLength = response.headers.get("Content-Length");
@@ -32649,7 +32845,7 @@ class UrlSource extends Source {
32649
32845
  Range: `bytes=${worker.currentPos}-`
32650
32846
  },
32651
32847
  signal: abortController.signal
32652
- }), this._getRetryDelay);
32848
+ }), this._getRetryDelay, () => this._disposed);
32653
32849
  }
32654
32850
  assert(response);
32655
32851
  if (!response.ok) {
@@ -32658,11 +32854,6 @@ class UrlSource extends Source {
32658
32854
  if (worker.currentPos > 0 && response.status !== 206) {
32659
32855
  throw new Error("HTTP server did not respond with 206 Partial Content to a range request. To enable efficient media" + " file streaming across a network, please make sure your server supports range requests.");
32660
32856
  }
32661
- const length = this._getPartialLengthFromRangeResponse(response);
32662
- const required = worker.targetPos - worker.currentPos;
32663
- if (length < required) {
32664
- throw new Error(`HTTP response unexpectedly too short: Needed at least ${required} bytes, got only ${length}.`);
32665
- }
32666
32857
  if (!response.body) {
32667
32858
  throw new Error("Missing HTTP response body stream. The used fetch function must provide the response body as a" + " ReadableStream.");
32668
32859
  }
@@ -32677,6 +32868,9 @@ class UrlSource extends Source {
32677
32868
  try {
32678
32869
  readResult = await reader.read();
32679
32870
  } catch (error) {
32871
+ if (this._disposed) {
32872
+ throw error;
32873
+ }
32680
32874
  const retryDelayInSeconds = this._getRetryDelay(1, error, this._url);
32681
32875
  if (retryDelayInSeconds !== null) {
32682
32876
  console.error("Error while reading response stream. Attempting to resume.", error);
@@ -32691,12 +32885,12 @@ class UrlSource extends Source {
32691
32885
  }
32692
32886
  const { done, value } = readResult;
32693
32887
  if (done) {
32694
- this._orchestrator.forgetWorker(worker);
32695
- if (worker.currentPos < worker.targetPos) {
32696
- throw new Error("Response stream reader stopped unexpectedly before all requested data was read.");
32888
+ if (worker.currentPos >= worker.targetPos) {
32889
+ this._orchestrator.forgetWorker(worker);
32890
+ worker.running = false;
32891
+ return;
32697
32892
  }
32698
- worker.running = false;
32699
- return;
32893
+ break;
32700
32894
  }
32701
32895
  this.onread?.(worker.currentPos, worker.currentPos + value.length);
32702
32896
  this._orchestrator.supplyWorkerData(worker, value);
@@ -32707,22 +32901,19 @@ class UrlSource extends Source {
32707
32901
  }
32708
32902
  worker.running = false;
32709
32903
  }
32710
- _getPartialLengthFromRangeResponse(response) {
32904
+ _getTotalLengthFromRangeResponse(response) {
32711
32905
  const contentRange = response.headers.get("Content-Range");
32712
32906
  if (contentRange) {
32713
32907
  const match = /\/(\d+)/.exec(contentRange);
32714
32908
  if (match) {
32715
32909
  return Number(match[1]);
32716
- } else {
32717
- throw new Error(`Invalid Content-Range header: ${contentRange}`);
32718
32910
  }
32911
+ }
32912
+ const contentLength = response.headers.get("Content-Length");
32913
+ if (contentLength) {
32914
+ return Number(contentLength);
32719
32915
  } else {
32720
- const contentLength = response.headers.get("Content-Length");
32721
- if (contentLength) {
32722
- return Number(contentLength);
32723
- } else {
32724
- throw new Error("Partial HTTP response (status 206) must surface either Content-Range or" + " Content-Length header.");
32725
- }
32916
+ throw new Error("Partial HTTP response (status 206) must surface either Content-Range or" + " Content-Length header.");
32726
32917
  }
32727
32918
  }
32728
32919
  _dispose() {
@@ -33061,7 +33252,7 @@ class ReadOrchestrator {
33061
33252
  }
33062
33253
  }
33063
33254
 
33064
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input.js
33255
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/input.js
33065
33256
  /*!
33066
33257
  * Copyright (c) 2025-present, Vanilagy and contributors
33067
33258
  *
@@ -33168,7 +33359,7 @@ class InputDisposedError extends Error {
33168
33359
  }
33169
33360
  }
33170
33361
 
33171
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/reader.js
33362
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/reader.js
33172
33363
  /*!
33173
33364
  * Copyright (c) 2025-present, Vanilagy and contributors
33174
33365
  *
@@ -33386,7 +33577,7 @@ var readAscii = (slice, length) => {
33386
33577
  }
33387
33578
  return str;
33388
33579
  };
33389
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/index.js
33580
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/index.js
33390
33581
  /*!
33391
33582
  * Copyright (c) 2025-present, Vanilagy and contributors
33392
33583
  *
@@ -38417,7 +38608,9 @@ var RenderModalAdvanced = ({
38417
38608
  hardwareAcceleration,
38418
38609
  chromeModeOption,
38419
38610
  setChromeModeOption,
38420
- setHardwareAcceleration
38611
+ setHardwareAcceleration,
38612
+ darkMode,
38613
+ setDarkMode
38421
38614
  }) => {
38422
38615
  const extendedOpenGlOptions = useMemo122(() => {
38423
38616
  return [
@@ -38480,6 +38673,9 @@ var RenderModalAdvanced = ({
38480
38673
  const onUserAgentChanged = useCallback117((e) => {
38481
38674
  setUserAgent(e.target.value);
38482
38675
  }, [setUserAgent]);
38676
+ const onDarkMode = useCallback117((e) => {
38677
+ setDarkMode(e.target.checked);
38678
+ }, [setDarkMode]);
38483
38679
  const onPlayBeepSound = useCallback117((e) => {
38484
38680
  setBeep(e.target.checked);
38485
38681
  }, [setBeep]);
@@ -38909,6 +39105,31 @@ var RenderModalAdvanced = ({
38909
39105
  })
38910
39106
  ]
38911
39107
  }),
39108
+ /* @__PURE__ */ jsxs121("div", {
39109
+ style: optionRow,
39110
+ children: [
39111
+ /* @__PURE__ */ jsxs121("div", {
39112
+ style: label5,
39113
+ children: [
39114
+ "Dark Mode",
39115
+ /* @__PURE__ */ jsx243(Spacing, {
39116
+ x: 0.5
39117
+ }),
39118
+ /* @__PURE__ */ jsx243(OptionExplainerBubble, {
39119
+ id: "darkModeOption"
39120
+ })
39121
+ ]
39122
+ }),
39123
+ /* @__PURE__ */ jsx243("div", {
39124
+ style: rightRow,
39125
+ children: /* @__PURE__ */ jsx243(Checkbox, {
39126
+ checked: darkMode,
39127
+ onChange: onDarkMode,
39128
+ name: "dark-mode"
39129
+ })
39130
+ })
39131
+ ]
39132
+ }),
38912
39133
  /* @__PURE__ */ jsxs121("div", {
38913
39134
  style: optionRow,
38914
39135
  children: [
@@ -40617,6 +40838,7 @@ var RenderModal = ({
40617
40838
  initialEncodingMaxRate,
40618
40839
  initialOffthreadVideoThreads,
40619
40840
  initialMediaCacheSizeInBytes,
40841
+ initialDarkMode,
40620
40842
  initialUserAgent,
40621
40843
  defaultProps,
40622
40844
  inFrameMark,
@@ -40698,6 +40920,7 @@ var RenderModal = ({
40698
40920
  const [beepOnFinish, setBeepOnFinish] = useState80(() => initialBeep);
40699
40921
  const [ignoreCertificateErrors, setIgnoreCertificateErrors] = useState80(() => initialIgnoreCertificateErrors);
40700
40922
  const [multiProcessOnLinux, setChromiumMultiProcessOnLinux] = useState80(() => initialMultiProcessOnLinux);
40923
+ const [darkMode, setDarkMode] = useState80(() => initialDarkMode);
40701
40924
  const [openGlOption, setOpenGlOption] = useState80(() => initialGl ?? "default");
40702
40925
  const [colorSpace, setColorSpace] = useState80(() => initialColorSpace);
40703
40926
  const [userAgent, setUserAgent] = useState80(() => initialUserAgent === null ? null : initialUserAgent.trim() === "" ? null : initialUserAgent);
@@ -40708,7 +40931,8 @@ var RenderModal = ({
40708
40931
  ignoreCertificateErrors,
40709
40932
  gl: openGlOption === "default" ? null : openGlOption,
40710
40933
  userAgent: userAgent === null ? null : userAgent.trim() === "" ? null : userAgent,
40711
- enableMultiProcessOnLinux: multiProcessOnLinux
40934
+ enableMultiProcessOnLinux: multiProcessOnLinux,
40935
+ darkMode
40712
40936
  };
40713
40937
  }, [
40714
40938
  headless,
@@ -40716,7 +40940,8 @@ var RenderModal = ({
40716
40940
  ignoreCertificateErrors,
40717
40941
  openGlOption,
40718
40942
  userAgent,
40719
- multiProcessOnLinux
40943
+ multiProcessOnLinux,
40944
+ darkMode
40720
40945
  ]);
40721
40946
  const [outName, setOutName] = useState80(() => initialOutName);
40722
40947
  const [endFrameOrNull, setEndFrame] = useState80(() => outFrameMark ?? null);
@@ -41585,7 +41810,9 @@ var RenderModal = ({
41585
41810
  hardwareAcceleration,
41586
41811
  setHardwareAcceleration,
41587
41812
  chromeModeOption: chromeMode,
41588
- setChromeModeOption: setChromeMode
41813
+ setChromeModeOption: setChromeMode,
41814
+ darkMode,
41815
+ setDarkMode
41589
41816
  })
41590
41817
  })
41591
41818
  ]
@@ -41737,26 +41964,22 @@ var writeBits = (bytes, start, end, value) => {
41737
41964
  var toUint8Array2 = (source) => {
41738
41965
  if (source.constructor === Uint8Array) {
41739
41966
  return source;
41740
- } else if (source instanceof ArrayBuffer) {
41741
- return new Uint8Array(source);
41742
- } else {
41967
+ } else if (ArrayBuffer.isView(source)) {
41743
41968
  return new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
41969
+ } else {
41970
+ return new Uint8Array(source);
41744
41971
  }
41745
41972
  };
41746
41973
  var toDataView2 = (source) => {
41747
41974
  if (source.constructor === DataView) {
41748
41975
  return source;
41749
- } else if (source instanceof ArrayBuffer) {
41750
- return new DataView(source);
41751
- } else {
41976
+ } else if (ArrayBuffer.isView(source)) {
41752
41977
  return new DataView(source.buffer, source.byteOffset, source.byteLength);
41978
+ } else {
41979
+ return new DataView(source);
41753
41980
  }
41754
41981
  };
41755
- var textDecoder2 = new TextDecoder;
41756
- var textEncoder2 = new TextEncoder;
41757
- var invertObject2 = (object) => {
41758
- return Object.fromEntries(Object.entries(object).map(([key5, value]) => [value, key5]));
41759
- };
41982
+ var textEncoder2 = /* @__PURE__ */ new TextEncoder;
41760
41983
  var COLOR_PRIMARIES_MAP2 = {
41761
41984
  bt709: 1,
41762
41985
  bt470bg: 5,
@@ -41764,7 +41987,6 @@ var COLOR_PRIMARIES_MAP2 = {
41764
41987
  bt2020: 9,
41765
41988
  smpte432: 12
41766
41989
  };
41767
- var COLOR_PRIMARIES_MAP_INVERSE2 = invertObject2(COLOR_PRIMARIES_MAP2);
41768
41990
  var TRANSFER_CHARACTERISTICS_MAP2 = {
41769
41991
  bt709: 1,
41770
41992
  smpte170m: 6,
@@ -41773,7 +41995,6 @@ var TRANSFER_CHARACTERISTICS_MAP2 = {
41773
41995
  pq: 16,
41774
41996
  hlg: 18
41775
41997
  };
41776
- var TRANSFER_CHARACTERISTICS_MAP_INVERSE2 = invertObject2(TRANSFER_CHARACTERISTICS_MAP2);
41777
41998
  var MATRIX_COEFFICIENTS_MAP2 = {
41778
41999
  rgb: 0,
41779
42000
  bt709: 1,
@@ -41781,7 +42002,6 @@ var MATRIX_COEFFICIENTS_MAP2 = {
41781
42002
  smpte170m: 6,
41782
42003
  "bt2020-ncl": 9
41783
42004
  };
41784
- var MATRIX_COEFFICIENTS_MAP_INVERSE2 = invertObject2(MATRIX_COEFFICIENTS_MAP2);
41785
42005
  var colorSpaceIsComplete = (colorSpace) => {
41786
42006
  return !!colorSpace && !!colorSpace.primaries && !!colorSpace.transfer && !!colorSpace.matrix && colorSpace.fullRange !== undefined;
41787
42007
  };
@@ -42034,6 +42254,29 @@ var validateMetadataTags = (tags) => {
42034
42254
  }
42035
42255
  }
42036
42256
  };
42257
+ var validateTrackDisposition = (disposition) => {
42258
+ if (!disposition || typeof disposition !== "object") {
42259
+ throw new TypeError("disposition must be an object.");
42260
+ }
42261
+ if (disposition.default !== undefined && typeof disposition.default !== "boolean") {
42262
+ throw new TypeError("disposition.default must be a boolean.");
42263
+ }
42264
+ if (disposition.forced !== undefined && typeof disposition.forced !== "boolean") {
42265
+ throw new TypeError("disposition.forced must be a boolean.");
42266
+ }
42267
+ if (disposition.original !== undefined && typeof disposition.original !== "boolean") {
42268
+ throw new TypeError("disposition.original must be a boolean.");
42269
+ }
42270
+ if (disposition.commentary !== undefined && typeof disposition.commentary !== "boolean") {
42271
+ throw new TypeError("disposition.commentary must be a boolean.");
42272
+ }
42273
+ if (disposition.hearingImpaired !== undefined && typeof disposition.hearingImpaired !== "boolean") {
42274
+ throw new TypeError("disposition.hearingImpaired must be a boolean.");
42275
+ }
42276
+ if (disposition.visuallyImpaired !== undefined && typeof disposition.visuallyImpaired !== "boolean") {
42277
+ throw new TypeError("disposition.visuallyImpaired must be a boolean.");
42278
+ }
42279
+ };
42037
42280
  /*!
42038
42281
  * Copyright (c) 2025-present, Vanilagy and contributors
42039
42282
  *
@@ -42499,27 +42742,27 @@ class Muxer {
42499
42742
  this.output = output;
42500
42743
  }
42501
42744
  onTrackClose(track) {}
42502
- validateAndNormalizeTimestamp(track, timestampInSeconds, isKeyFrame) {
42745
+ validateAndNormalizeTimestamp(track, timestampInSeconds, isKeyPacket) {
42503
42746
  timestampInSeconds += track.source._timestampOffset;
42504
42747
  let timestampInfo = this.trackTimestampInfo.get(track);
42505
42748
  if (!timestampInfo) {
42506
- if (!isKeyFrame) {
42507
- throw new Error("First frame must be a key frame.");
42749
+ if (!isKeyPacket) {
42750
+ throw new Error("First packet must be a key packet.");
42508
42751
  }
42509
42752
  timestampInfo = {
42510
42753
  maxTimestamp: timestampInSeconds,
42511
- maxTimestampBeforeLastKeyFrame: timestampInSeconds
42754
+ maxTimestampBeforeLastKeyPacket: timestampInSeconds
42512
42755
  };
42513
42756
  this.trackTimestampInfo.set(track, timestampInfo);
42514
42757
  }
42515
42758
  if (timestampInSeconds < 0) {
42516
42759
  throw new Error(`Timestamps must be non-negative (got ${timestampInSeconds}s).`);
42517
42760
  }
42518
- if (isKeyFrame) {
42519
- timestampInfo.maxTimestampBeforeLastKeyFrame = timestampInfo.maxTimestamp;
42761
+ if (isKeyPacket) {
42762
+ timestampInfo.maxTimestampBeforeLastKeyPacket = timestampInfo.maxTimestamp;
42520
42763
  }
42521
- if (timestampInSeconds < timestampInfo.maxTimestampBeforeLastKeyFrame) {
42522
- throw new Error(`Timestamps cannot be smaller than the highest timestamp of the previous GOP (a GOP begins with a key` + ` frame and ends right before the next key frame). Got ${timestampInSeconds}s, but highest timestamp` + ` is ${timestampInfo.maxTimestampBeforeLastKeyFrame}s.`);
42764
+ if (timestampInSeconds < timestampInfo.maxTimestampBeforeLastKeyPacket) {
42765
+ throw new Error(`Timestamps cannot be smaller than the largest timestamp of the previous GOP (a GOP begins with a key` + ` packet and ends right before the next key packet). Got ${timestampInSeconds}s, but largest` + ` timestamp is ${timestampInfo.maxTimestampBeforeLastKeyPacket}s.`);
42523
42766
  }
42524
42767
  timestampInfo.maxTimestamp = Math.max(timestampInfo.maxTimestamp, timestampInSeconds);
42525
42768
  return timestampInSeconds;
@@ -42639,44 +42882,22 @@ var extractAvcDecoderConfigurationRecord2 = (packetData) => {
42639
42882
  return null;
42640
42883
  }
42641
42884
  const spsData = spsUnits[0];
42642
- const bitstream = new Bitstream2(removeEmulationPreventionBytes2(spsData));
42643
- bitstream.skipBits(1);
42644
- bitstream.skipBits(2);
42645
- const nal_unit_type = bitstream.readBits(5);
42646
- if (nal_unit_type !== 7) {
42647
- console.error("Invalid SPS NAL unit type");
42648
- return null;
42649
- }
42650
- const profile_idc = bitstream.readAlignedByte();
42651
- const constraint_flags = bitstream.readAlignedByte();
42652
- const level_idc = bitstream.readAlignedByte();
42653
- const record = {
42885
+ const spsInfo = parseAvcSps2(spsData);
42886
+ assert2(spsInfo !== null);
42887
+ const hasExtendedData = spsInfo.profileIdc === 100 || spsInfo.profileIdc === 110 || spsInfo.profileIdc === 122 || spsInfo.profileIdc === 144;
42888
+ return {
42654
42889
  configurationVersion: 1,
42655
- avcProfileIndication: profile_idc,
42656
- profileCompatibility: constraint_flags,
42657
- avcLevelIndication: level_idc,
42890
+ avcProfileIndication: spsInfo.profileIdc,
42891
+ profileCompatibility: spsInfo.constraintFlags,
42892
+ avcLevelIndication: spsInfo.levelIdc,
42658
42893
  lengthSizeMinusOne: 3,
42659
42894
  sequenceParameterSets: spsUnits,
42660
42895
  pictureParameterSets: ppsUnits,
42661
- chromaFormat: null,
42662
- bitDepthLumaMinus8: null,
42663
- bitDepthChromaMinus8: null,
42664
- sequenceParameterSetExt: null
42896
+ chromaFormat: hasExtendedData ? spsInfo.chromaFormatIdc : null,
42897
+ bitDepthLumaMinus8: hasExtendedData ? spsInfo.bitDepthLumaMinus8 : null,
42898
+ bitDepthChromaMinus8: hasExtendedData ? spsInfo.bitDepthChromaMinus8 : null,
42899
+ sequenceParameterSetExt: hasExtendedData ? spsExtUnits : null
42665
42900
  };
42666
- if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 || profile_idc === 144) {
42667
- readExpGolomb2(bitstream);
42668
- const chroma_format_idc = readExpGolomb2(bitstream);
42669
- if (chroma_format_idc === 3) {
42670
- bitstream.skipBits(1);
42671
- }
42672
- const bit_depth_luma_minus8 = readExpGolomb2(bitstream);
42673
- const bit_depth_chroma_minus8 = readExpGolomb2(bitstream);
42674
- record.chromaFormat = chroma_format_idc;
42675
- record.bitDepthLumaMinus8 = bit_depth_luma_minus8;
42676
- record.bitDepthChromaMinus8 = bit_depth_chroma_minus8;
42677
- record.sequenceParameterSetExt = spsExtUnits;
42678
- }
42679
- return record;
42680
42901
  } catch (error) {
42681
42902
  console.error("Error building AVC Decoder Configuration Record:", error);
42682
42903
  return null;
@@ -42727,6 +42948,81 @@ var serializeAvcDecoderConfigurationRecord = (record) => {
42727
42948
  }
42728
42949
  return new Uint8Array(bytes);
42729
42950
  };
42951
+ var parseAvcSps2 = (sps) => {
42952
+ try {
42953
+ const bitstream = new Bitstream2(removeEmulationPreventionBytes2(sps));
42954
+ bitstream.skipBits(1);
42955
+ bitstream.skipBits(2);
42956
+ const nalUnitType = bitstream.readBits(5);
42957
+ if (nalUnitType !== 7) {
42958
+ return null;
42959
+ }
42960
+ const profileIdc = bitstream.readAlignedByte();
42961
+ const constraintFlags = bitstream.readAlignedByte();
42962
+ const levelIdc = bitstream.readAlignedByte();
42963
+ readExpGolomb2(bitstream);
42964
+ let chromaFormatIdc = null;
42965
+ let bitDepthLumaMinus8 = null;
42966
+ let bitDepthChromaMinus8 = null;
42967
+ if (profileIdc === 100 || profileIdc === 110 || profileIdc === 122 || profileIdc === 244 || profileIdc === 44 || profileIdc === 83 || profileIdc === 86 || profileIdc === 118 || profileIdc === 128) {
42968
+ chromaFormatIdc = readExpGolomb2(bitstream);
42969
+ if (chromaFormatIdc === 3) {
42970
+ bitstream.skipBits(1);
42971
+ }
42972
+ bitDepthLumaMinus8 = readExpGolomb2(bitstream);
42973
+ bitDepthChromaMinus8 = readExpGolomb2(bitstream);
42974
+ bitstream.skipBits(1);
42975
+ const seqScalingMatrixPresentFlag = bitstream.readBits(1);
42976
+ if (seqScalingMatrixPresentFlag) {
42977
+ for (let i = 0;i < (chromaFormatIdc !== 3 ? 8 : 12); i++) {
42978
+ const seqScalingListPresentFlag = bitstream.readBits(1);
42979
+ if (seqScalingListPresentFlag) {
42980
+ const sizeOfScalingList = i < 6 ? 16 : 64;
42981
+ let lastScale = 8;
42982
+ let nextScale = 8;
42983
+ for (let j = 0;j < sizeOfScalingList; j++) {
42984
+ if (nextScale !== 0) {
42985
+ const deltaScale = readSignedExpGolomb2(bitstream);
42986
+ nextScale = (lastScale + deltaScale + 256) % 256;
42987
+ }
42988
+ lastScale = nextScale === 0 ? lastScale : nextScale;
42989
+ }
42990
+ }
42991
+ }
42992
+ }
42993
+ }
42994
+ readExpGolomb2(bitstream);
42995
+ const picOrderCntType = readExpGolomb2(bitstream);
42996
+ if (picOrderCntType === 0) {
42997
+ readExpGolomb2(bitstream);
42998
+ } else if (picOrderCntType === 1) {
42999
+ bitstream.skipBits(1);
43000
+ readSignedExpGolomb2(bitstream);
43001
+ readSignedExpGolomb2(bitstream);
43002
+ const numRefFramesInPicOrderCntCycle = readExpGolomb2(bitstream);
43003
+ for (let i = 0;i < numRefFramesInPicOrderCntCycle; i++) {
43004
+ readSignedExpGolomb2(bitstream);
43005
+ }
43006
+ }
43007
+ readExpGolomb2(bitstream);
43008
+ bitstream.skipBits(1);
43009
+ readExpGolomb2(bitstream);
43010
+ readExpGolomb2(bitstream);
43011
+ const frameMbsOnlyFlag = bitstream.readBits(1);
43012
+ return {
43013
+ profileIdc,
43014
+ constraintFlags,
43015
+ levelIdc,
43016
+ frameMbsOnlyFlag,
43017
+ chromaFormatIdc,
43018
+ bitDepthLumaMinus8,
43019
+ bitDepthChromaMinus8
43020
+ };
43021
+ } catch (error) {
43022
+ console.error("Error parsing AVC SPS:", error);
43023
+ return null;
43024
+ }
43025
+ };
42730
43026
  var extractNalUnitTypeForHevc2 = (data) => {
42731
43027
  return data[0] >> 1 & 63;
42732
43028
  };
@@ -43190,7 +43486,7 @@ var customVideoEncoders = [];
43190
43486
  * License, v. 2.0. If a copy of the MPL was not distributed with this
43191
43487
  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
43192
43488
  */
43193
- var PLACEHOLDER_DATA2 = new Uint8Array(0);
43489
+ var PLACEHOLDER_DATA2 = /* @__PURE__ */ new Uint8Array(0);
43194
43490
 
43195
43491
  class EncodedPacket2 {
43196
43492
  constructor(data, type, timestamp, duration, sequenceNumber = -1, byteLength, sideData) {
@@ -43665,12 +43961,14 @@ class VideoSample2 {
43665
43961
  dx = (canvasWidth - newWidth) / 2;
43666
43962
  dy = (canvasHeight - newHeight) / 2;
43667
43963
  }
43964
+ context.save();
43668
43965
  const aspectRatioChange = rotation % 180 === 0 ? 1 : newWidth / newHeight;
43669
43966
  context.translate(canvasWidth / 2, canvasHeight / 2);
43670
43967
  context.rotate(rotation * Math.PI / 180);
43671
43968
  context.scale(1 / aspectRatioChange, aspectRatioChange);
43672
43969
  context.translate(-canvasWidth / 2, -canvasHeight / 2);
43673
43970
  context.drawImage(this.toCanvasImageSource(), sx, sy, sWidth, sHeight, dx, dy, newWidth, newHeight);
43971
+ context.restore();
43674
43972
  }
43675
43973
  _rotateSourceRegion(sx, sy, sWidth, sHeight, rotation) {
43676
43974
  if (rotation === 90) {
@@ -43844,6 +44142,10 @@ var EBMLId2;
43844
44142
  EBMLId22[EBMLId22["FlagEnabled"] = 185] = "FlagEnabled";
43845
44143
  EBMLId22[EBMLId22["FlagDefault"] = 136] = "FlagDefault";
43846
44144
  EBMLId22[EBMLId22["FlagForced"] = 21930] = "FlagForced";
44145
+ EBMLId22[EBMLId22["FlagOriginal"] = 21934] = "FlagOriginal";
44146
+ EBMLId22[EBMLId22["FlagHearingImpaired"] = 21931] = "FlagHearingImpaired";
44147
+ EBMLId22[EBMLId22["FlagVisualImpaired"] = 21932] = "FlagVisualImpaired";
44148
+ EBMLId22[EBMLId22["FlagCommentary"] = 21935] = "FlagCommentary";
43847
44149
  EBMLId22[EBMLId22["FlagLacing"] = 156] = "FlagLacing";
43848
44150
  EBMLId22[EBMLId22["Name"] = 21358] = "Name";
43849
44151
  EBMLId22[EBMLId22["Language"] = 2274716] = "Language";
@@ -44316,8 +44618,8 @@ class IsobmffBoxWriter {
44316
44618
  }
44317
44619
  }
44318
44620
  }
44319
- var bytes = new Uint8Array(8);
44320
- var view = new DataView(bytes.buffer);
44621
+ var bytes = /* @__PURE__ */ new Uint8Array(8);
44622
+ var view = /* @__PURE__ */ new DataView(bytes.buffer);
44321
44623
  var u8 = (value) => {
44322
44624
  return [(value % 256 + 256) % 256];
44323
44625
  };
@@ -44405,7 +44707,7 @@ var rotationMatrix = (rotationInDegrees) => {
44405
44707
  1
44406
44708
  ];
44407
44709
  };
44408
- var IDENTITY_MATRIX = rotationMatrix(0);
44710
+ var IDENTITY_MATRIX = /* @__PURE__ */ rotationMatrix(0);
44409
44711
  var matrixToBytes = (matrix) => {
44410
44712
  return [
44411
44713
  fixed_16_16(matrix[0]),
@@ -44504,7 +44806,11 @@ var tkhd = (trackData, creationTime) => {
44504
44806
  } else {
44505
44807
  matrix = IDENTITY_MATRIX;
44506
44808
  }
44507
- return fullBox("tkhd", +needsU64, 3, [
44809
+ let flags = 2;
44810
+ if (trackData.track.metadata.disposition?.default !== false) {
44811
+ flags |= 1;
44812
+ }
44813
+ return fullBox("tkhd", +needsU64, flags, [
44508
44814
  u32OrU64(creationTime),
44509
44815
  u32OrU64(creationTime),
44510
44816
  u32(trackData.track.id),
@@ -44603,7 +44909,7 @@ var stbl = (trackData) => {
44603
44909
  var stsd = (trackData) => {
44604
44910
  let sampleDescription;
44605
44911
  if (trackData.type === "video") {
44606
- sampleDescription = videoSampleDescription(VIDEO_CODEC_TO_BOX_NAME[trackData.track.source._codec], trackData);
44912
+ sampleDescription = videoSampleDescription(videoCodecToBoxName(trackData.track.source._codec, trackData.info.decoderConfig.codec), trackData);
44607
44913
  } else if (trackData.type === "audio") {
44608
44914
  const boxName = audioCodecToBoxName(trackData.track.source._codec, trackData.muxer.isQuickTime);
44609
44915
  assert2(boxName);
@@ -45391,12 +45697,19 @@ var dataStringBoxLong = (value) => {
45391
45697
  ...textEncoder2.encode(value)
45392
45698
  ]);
45393
45699
  };
45394
- var VIDEO_CODEC_TO_BOX_NAME = {
45395
- avc: "avc1",
45396
- hevc: "hvc1",
45397
- vp8: "vp08",
45398
- vp9: "vp09",
45399
- av1: "av01"
45700
+ var videoCodecToBoxName = (codec, fullCodecString) => {
45701
+ switch (codec) {
45702
+ case "avc":
45703
+ return fullCodecString.startsWith("avc3") ? "avc3" : "avc1";
45704
+ case "hevc":
45705
+ return "hvc1";
45706
+ case "vp8":
45707
+ return "vp08";
45708
+ case "vp9":
45709
+ return "vp09";
45710
+ case "av1":
45711
+ return "av01";
45712
+ }
45400
45713
  };
45401
45714
  var VIDEO_CODEC_TO_CONFIGURATION_BOX = {
45402
45715
  avc: avcC,
@@ -46676,6 +46989,12 @@ class MatroskaMuxer extends Muxer {
46676
46989
  { id: EBMLId2.TrackNumber, data: trackData.track.id },
46677
46990
  { id: EBMLId2.TrackUID, data: trackData.track.id },
46678
46991
  { id: EBMLId2.TrackType, data: TRACK_TYPE_MAP[trackData.type] },
46992
+ trackData.track.metadata.disposition?.default === false ? { id: EBMLId2.FlagDefault, data: 0 } : null,
46993
+ trackData.track.metadata.disposition?.forced ? { id: EBMLId2.FlagForced, data: 1 } : null,
46994
+ trackData.track.metadata.disposition?.hearingImpaired ? { id: EBMLId2.FlagHearingImpaired, data: 1 } : null,
46995
+ trackData.track.metadata.disposition?.visuallyImpaired ? { id: EBMLId2.FlagVisualImpaired, data: 1 } : null,
46996
+ trackData.track.metadata.disposition?.original ? { id: EBMLId2.FlagOriginal, data: 1 } : null,
46997
+ trackData.track.metadata.disposition?.commentary ? { id: EBMLId2.FlagCommentary, data: 1 } : null,
46679
46998
  { id: EBMLId2.FlagLacing, data: 0 },
46680
46999
  { id: EBMLId2.Language, data: trackData.track.metadata.languageCode ?? UNDETERMINED_LANGUAGE2 },
46681
47000
  { id: EBMLId2.CodecID, data: codecId },
@@ -47756,11 +48075,11 @@ class Quality {
47756
48075
  return Math.round(finalBitrate / 1000) * 1000;
47757
48076
  }
47758
48077
  }
47759
- var QUALITY_VERY_LOW = new Quality(0.3);
47760
- var QUALITY_LOW = new Quality(0.6);
47761
- var QUALITY_MEDIUM = new Quality(1);
47762
- var QUALITY_HIGH = new Quality(2);
47763
- var QUALITY_VERY_HIGH = new Quality(4);
48078
+ var QUALITY_VERY_LOW = /* @__PURE__ */ new Quality(0.3);
48079
+ var QUALITY_LOW = /* @__PURE__ */ new Quality(0.6);
48080
+ var QUALITY_MEDIUM = /* @__PURE__ */ new Quality(1);
48081
+ var QUALITY_HIGH = /* @__PURE__ */ new Quality(2);
48082
+ var QUALITY_VERY_HIGH = /* @__PURE__ */ new Quality(4);
47764
48083
  /*!
47765
48084
  * Copyright (c) 2025-present, Vanilagy and contributors
47766
48085
  *
@@ -48421,6 +48740,9 @@ var validateBaseTrackMetadata = (metadata) => {
48421
48740
  if (metadata.name !== undefined && typeof metadata.name !== "string") {
48422
48741
  throw new TypeError("metadata.name, when provided, must be a string.");
48423
48742
  }
48743
+ if (metadata.disposition !== undefined) {
48744
+ validateTrackDisposition(metadata.disposition);
48745
+ }
48424
48746
  if (metadata.maximumPacketCount !== undefined && (!Number.isInteger(metadata.maximumPacketCount) || metadata.maximumPacketCount < 0)) {
48425
48747
  throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.");
48426
48748
  }
@@ -50798,6 +51120,7 @@ var Modals = ({ readOnlyStudio }) => {
50798
51120
  }),
50799
51121
  modalContextType && canRender && modalContextType.type === "server-render" && /* @__PURE__ */ jsx269(RenderModalWithLoader, {
50800
51122
  initialFrame: modalContextType.initialFrame,
51123
+ initialDarkMode: modalContextType.initialDarkMode,
50801
51124
  compositionId: modalContextType.compositionId,
50802
51125
  initialVideoImageFormat: modalContextType.initialVideoImageFormat,
50803
51126
  initialJpegQuality: modalContextType.initialJpegQuality,