@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.
@@ -2602,7 +2602,8 @@ var SidebarRenderButton = ({ composition, visible }) => {
2602
2602
  initialHardwareAcceleration: defaults.hardwareAcceleration,
2603
2603
  initialChromeMode: defaults.chromeMode,
2604
2604
  initialMediaCacheSizeInBytes: defaults.mediaCacheSizeInBytes,
2605
- renderDefaults: defaults
2605
+ renderDefaults: defaults,
2606
+ initialDarkMode: defaults.darkMode
2606
2607
  });
2607
2608
  if (isMobileLayout) {
2608
2609
  setSidebarCollapsedState({ left: "collapsed", right: "collapsed" });
@@ -15981,6 +15982,7 @@ var makeRetryPayload = (job) => {
15981
15982
  initialOpenGlRenderer: job.chromiumOptions.gl,
15982
15983
  initialHeadless: job.chromiumOptions.headless,
15983
15984
  initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
15985
+ initialDarkMode: job.chromiumOptions.darkMode,
15984
15986
  defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(job.serializedInputPropsWithCustomSchema),
15985
15987
  inFrameMark: null,
15986
15988
  outFrameMark: null,
@@ -16030,6 +16032,7 @@ var makeRetryPayload = (job) => {
16030
16032
  initialOpenGlRenderer: job.chromiumOptions.gl,
16031
16033
  initialHeadless: job.chromiumOptions.headless,
16032
16034
  initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
16035
+ initialDarkMode: job.chromiumOptions.darkMode,
16033
16036
  defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(job.serializedInputPropsWithCustomSchema),
16034
16037
  initialStillImageFormat: defaults.stillImageFormat,
16035
16038
  inFrameMark: job.startFrame,
@@ -16082,6 +16085,7 @@ var makeRetryPayload = (job) => {
16082
16085
  initialOpenGlRenderer: job.chromiumOptions.gl,
16083
16086
  initialHeadless: job.chromiumOptions.headless,
16084
16087
  initialIgnoreCertificateErrors: job.chromiumOptions.ignoreCertificateErrors,
16088
+ initialDarkMode: job.chromiumOptions.darkMode,
16085
16089
  defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(job.serializedInputPropsWithCustomSchema),
16086
16090
  inFrameMark: job.startFrame,
16087
16091
  outFrameMark: job.endFrame,
@@ -17779,6 +17783,7 @@ var RenderButton = () => {
17779
17783
  defaultConfigurationAudioCodec: defaults.audioCodec,
17780
17784
  initialEnvVariables: window.process.env,
17781
17785
  initialDisableWebSecurity: defaults.disableWebSecurity,
17786
+ initialDarkMode: defaults.darkMode,
17782
17787
  initialOpenGlRenderer: defaults.openGlRenderer,
17783
17788
  initialHeadless: defaults.headless,
17784
17789
  initialIgnoreCertificateErrors: defaults.ignoreCertificateErrors,
@@ -20487,7 +20492,7 @@ var getTimelineSequenceLayout = ({
20487
20492
  // src/helpers/use-max-media-duration.ts
20488
20493
  import { getVideoMetadata as getVideoMetadata2 } from "@remotion/media-utils";
20489
20494
 
20490
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/misc.js
20495
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/misc.js
20491
20496
  /*!
20492
20497
  * Copyright (c) 2025-present, Vanilagy and contributors
20493
20498
  *
@@ -20589,23 +20594,22 @@ var readSignedExpGolomb = (bitstream) => {
20589
20594
  var toUint8Array = (source) => {
20590
20595
  if (source.constructor === Uint8Array) {
20591
20596
  return source;
20592
- } else if (source instanceof ArrayBuffer) {
20593
- return new Uint8Array(source);
20594
- } else {
20597
+ } else if (ArrayBuffer.isView(source)) {
20595
20598
  return new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
20599
+ } else {
20600
+ return new Uint8Array(source);
20596
20601
  }
20597
20602
  };
20598
20603
  var toDataView = (source) => {
20599
20604
  if (source.constructor === DataView) {
20600
20605
  return source;
20601
- } else if (source instanceof ArrayBuffer) {
20602
- return new DataView(source);
20603
- } else {
20606
+ } else if (ArrayBuffer.isView(source)) {
20604
20607
  return new DataView(source.buffer, source.byteOffset, source.byteLength);
20608
+ } else {
20609
+ return new DataView(source);
20605
20610
  }
20606
20611
  };
20607
- var textDecoder = new TextDecoder;
20608
- var textEncoder = new TextEncoder;
20612
+ var textDecoder = /* @__PURE__ */ new TextDecoder;
20609
20613
  var invertObject = (object) => {
20610
20614
  return Object.fromEntries(Object.entries(object).map(([key4, value]) => [value, key4]));
20611
20615
  };
@@ -20616,7 +20620,7 @@ var COLOR_PRIMARIES_MAP = {
20616
20620
  bt2020: 9,
20617
20621
  smpte432: 12
20618
20622
  };
20619
- var COLOR_PRIMARIES_MAP_INVERSE = invertObject(COLOR_PRIMARIES_MAP);
20623
+ var COLOR_PRIMARIES_MAP_INVERSE = /* @__PURE__ */ invertObject(COLOR_PRIMARIES_MAP);
20620
20624
  var TRANSFER_CHARACTERISTICS_MAP = {
20621
20625
  bt709: 1,
20622
20626
  smpte170m: 6,
@@ -20625,7 +20629,7 @@ var TRANSFER_CHARACTERISTICS_MAP = {
20625
20629
  pq: 16,
20626
20630
  hlg: 18
20627
20631
  };
20628
- var TRANSFER_CHARACTERISTICS_MAP_INVERSE = invertObject(TRANSFER_CHARACTERISTICS_MAP);
20632
+ var TRANSFER_CHARACTERISTICS_MAP_INVERSE = /* @__PURE__ */ invertObject(TRANSFER_CHARACTERISTICS_MAP);
20629
20633
  var MATRIX_COEFFICIENTS_MAP = {
20630
20634
  rgb: 0,
20631
20635
  bt709: 1,
@@ -20633,7 +20637,7 @@ var MATRIX_COEFFICIENTS_MAP = {
20633
20637
  smpte170m: 6,
20634
20638
  "bt2020-ncl": 9
20635
20639
  };
20636
- var MATRIX_COEFFICIENTS_MAP_INVERSE = invertObject(MATRIX_COEFFICIENTS_MAP);
20640
+ var MATRIX_COEFFICIENTS_MAP_INVERSE = /* @__PURE__ */ invertObject(MATRIX_COEFFICIENTS_MAP);
20637
20641
  var isAllowSharedBufferSource = (x) => {
20638
20642
  return x instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && x instanceof SharedArrayBuffer || ArrayBuffer.isView(x);
20639
20643
  };
@@ -20756,9 +20760,13 @@ var clamp = (value, min, max) => {
20756
20760
  return Math.max(min, Math.min(max, value));
20757
20761
  };
20758
20762
  var UNDETERMINED_LANGUAGE = "und";
20759
- var roundToPrecision = (value, digits) => {
20760
- const factor = 10 ** digits;
20761
- return Math.round(value * factor) / factor;
20763
+ var roundIfAlmostInteger = (value) => {
20764
+ const rounded = Math.round(value);
20765
+ if (Math.abs(value / rounded - 1) < 10 * Number.EPSILON) {
20766
+ return rounded;
20767
+ } else {
20768
+ return value;
20769
+ }
20762
20770
  };
20763
20771
  var roundToMultiple = (value, multiple) => {
20764
20772
  return Math.round(value / multiple) * multiple;
@@ -20810,12 +20818,15 @@ var normalizeHeaders = (headers) => {
20810
20818
  }
20811
20819
  return headers;
20812
20820
  };
20813
- var retriedFetch = async (fetchFn, url, requestInit, getRetryDelay) => {
20821
+ var retriedFetch = async (fetchFn, url, requestInit, getRetryDelay, shouldStop) => {
20814
20822
  let attempts = 0;
20815
20823
  while (true) {
20816
20824
  try {
20817
20825
  return await fetchFn(url, requestInit);
20818
20826
  } catch (error) {
20827
+ if (shouldStop()) {
20828
+ throw error;
20829
+ }
20819
20830
  attempts++;
20820
20831
  const retryDelayInSeconds = getRetryDelay(attempts, error, url);
20821
20832
  if (retryDelayInSeconds === null) {
@@ -20828,6 +20839,9 @@ var retriedFetch = async (fetchFn, url, requestInit, getRetryDelay) => {
20828
20839
  if (retryDelayInSeconds > 0) {
20829
20840
  await new Promise((resolve) => setTimeout(resolve, 1000 * retryDelayInSeconds));
20830
20841
  }
20842
+ if (shouldStop()) {
20843
+ throw error;
20844
+ }
20831
20845
  }
20832
20846
  }
20833
20847
  };
@@ -20844,9 +20858,7 @@ var isWebKit = () => {
20844
20858
  if (isWebKitCache !== null) {
20845
20859
  return isWebKitCache;
20846
20860
  }
20847
- const result = !!(typeof navigator !== "undefined" && navigator.vendor?.match(/apple/i));
20848
- isWebKitCache = result;
20849
- return result;
20861
+ return isWebKitCache = !!(typeof navigator !== "undefined" && navigator.vendor?.match(/apple/i));
20850
20862
  };
20851
20863
  var isFirefoxCache = null;
20852
20864
  var isFirefox = () => {
@@ -20855,6 +20867,13 @@ var isFirefox = () => {
20855
20867
  }
20856
20868
  return isFirefoxCache = typeof navigator !== "undefined" && navigator.userAgent?.includes("Firefox");
20857
20869
  };
20870
+ var isChromiumCache = null;
20871
+ var isChromium = () => {
20872
+ if (isChromiumCache !== null) {
20873
+ return isChromiumCache;
20874
+ }
20875
+ return isChromiumCache = !!(typeof navigator !== "undefined" && navigator.vendor?.includes("Google Inc"));
20876
+ };
20858
20877
  var coalesceIndex = (a, b) => {
20859
20878
  return a !== -1 ? a : b;
20860
20879
  };
@@ -20876,7 +20895,7 @@ var isNumber = (x) => {
20876
20895
  return typeof x === "number" && !Number.isNaN(x);
20877
20896
  };
20878
20897
 
20879
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/tags.js
20898
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/metadata.js
20880
20899
  /*!
20881
20900
  * Copyright (c) 2025-present, Vanilagy and contributors
20882
20901
  *
@@ -20918,8 +20937,16 @@ class AttachedFile {
20918
20937
  }
20919
20938
  }
20920
20939
  }
20940
+ var DEFAULT_TRACK_DISPOSITION = {
20941
+ default: true,
20942
+ forced: false,
20943
+ original: false,
20944
+ commentary: false,
20945
+ hearingImpaired: false,
20946
+ visuallyImpaired: false
20947
+ };
20921
20948
 
20922
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/codec.js
20949
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/codec.js
20923
20950
  /*!
20924
20951
  * Copyright (c) 2025-present, Vanilagy and contributors
20925
20952
  *
@@ -20975,18 +21002,19 @@ var AV1_DEFAULT_SUFFIX = ".0.110.01.01.01.0";
20975
21002
  var extractVideoCodecString = (trackInfo) => {
20976
21003
  const { codec, codecDescription, colorSpace, avcCodecInfo, hevcCodecInfo, vp9CodecInfo, av1CodecInfo } = trackInfo;
20977
21004
  if (codec === "avc") {
21005
+ assert(trackInfo.avcType !== null);
20978
21006
  if (avcCodecInfo) {
20979
21007
  const bytes = new Uint8Array([
20980
21008
  avcCodecInfo.avcProfileIndication,
20981
21009
  avcCodecInfo.profileCompatibility,
20982
21010
  avcCodecInfo.avcLevelIndication
20983
21011
  ]);
20984
- return `avc1.${bytesToHexString(bytes)}`;
21012
+ return `avc${trackInfo.avcType}.${bytesToHexString(bytes)}`;
20985
21013
  }
20986
21014
  if (!codecDescription || codecDescription.byteLength < 4) {
20987
21015
  throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");
20988
21016
  }
20989
- return `avc1.${bytesToHexString(codecDescription.subarray(1, 4))}`;
21017
+ return `avc${trackInfo.avcType}.${bytesToHexString(codecDescription.subarray(1, 4))}`;
20990
21018
  } else if (codec === "hevc") {
20991
21019
  let generalProfileSpace;
20992
21020
  let generalProfileIdc;
@@ -21192,7 +21220,7 @@ var parsePcmCodec = (codec) => {
21192
21220
  return { dataType, sampleSize, littleEndian, silentValue };
21193
21221
  };
21194
21222
 
21195
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/codec-data.js
21223
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/codec-data.js
21196
21224
  /*!
21197
21225
  * Copyright (c) 2025-present, Vanilagy and contributors
21198
21226
  *
@@ -21320,46 +21348,160 @@ var extractAvcDecoderConfigurationRecord = (packetData) => {
21320
21348
  return null;
21321
21349
  }
21322
21350
  const spsData = spsUnits[0];
21323
- const bitstream = new Bitstream(removeEmulationPreventionBytes(spsData));
21324
- bitstream.skipBits(1);
21325
- bitstream.skipBits(2);
21326
- const nal_unit_type = bitstream.readBits(5);
21327
- if (nal_unit_type !== 7) {
21328
- console.error("Invalid SPS NAL unit type");
21329
- return null;
21330
- }
21331
- const profile_idc = bitstream.readAlignedByte();
21332
- const constraint_flags = bitstream.readAlignedByte();
21333
- const level_idc = bitstream.readAlignedByte();
21334
- const record = {
21351
+ const spsInfo = parseAvcSps(spsData);
21352
+ assert(spsInfo !== null);
21353
+ const hasExtendedData = spsInfo.profileIdc === 100 || spsInfo.profileIdc === 110 || spsInfo.profileIdc === 122 || spsInfo.profileIdc === 144;
21354
+ return {
21335
21355
  configurationVersion: 1,
21336
- avcProfileIndication: profile_idc,
21337
- profileCompatibility: constraint_flags,
21338
- avcLevelIndication: level_idc,
21356
+ avcProfileIndication: spsInfo.profileIdc,
21357
+ profileCompatibility: spsInfo.constraintFlags,
21358
+ avcLevelIndication: spsInfo.levelIdc,
21339
21359
  lengthSizeMinusOne: 3,
21340
21360
  sequenceParameterSets: spsUnits,
21341
21361
  pictureParameterSets: ppsUnits,
21362
+ chromaFormat: hasExtendedData ? spsInfo.chromaFormatIdc : null,
21363
+ bitDepthLumaMinus8: hasExtendedData ? spsInfo.bitDepthLumaMinus8 : null,
21364
+ bitDepthChromaMinus8: hasExtendedData ? spsInfo.bitDepthChromaMinus8 : null,
21365
+ sequenceParameterSetExt: hasExtendedData ? spsExtUnits : null
21366
+ };
21367
+ } catch (error) {
21368
+ console.error("Error building AVC Decoder Configuration Record:", error);
21369
+ return null;
21370
+ }
21371
+ };
21372
+ var deserializeAvcDecoderConfigurationRecord = (data) => {
21373
+ try {
21374
+ const view = toDataView(data);
21375
+ let offset = 0;
21376
+ const configurationVersion = view.getUint8(offset++);
21377
+ const avcProfileIndication = view.getUint8(offset++);
21378
+ const profileCompatibility = view.getUint8(offset++);
21379
+ const avcLevelIndication = view.getUint8(offset++);
21380
+ const lengthSizeMinusOne = view.getUint8(offset++) & 3;
21381
+ const numOfSequenceParameterSets = view.getUint8(offset++) & 31;
21382
+ const sequenceParameterSets = [];
21383
+ for (let i = 0;i < numOfSequenceParameterSets; i++) {
21384
+ const length = view.getUint16(offset, false);
21385
+ offset += 2;
21386
+ sequenceParameterSets.push(data.subarray(offset, offset + length));
21387
+ offset += length;
21388
+ }
21389
+ const numOfPictureParameterSets = view.getUint8(offset++);
21390
+ const pictureParameterSets = [];
21391
+ for (let i = 0;i < numOfPictureParameterSets; i++) {
21392
+ const length = view.getUint16(offset, false);
21393
+ offset += 2;
21394
+ pictureParameterSets.push(data.subarray(offset, offset + length));
21395
+ offset += length;
21396
+ }
21397
+ const record = {
21398
+ configurationVersion,
21399
+ avcProfileIndication,
21400
+ profileCompatibility,
21401
+ avcLevelIndication,
21402
+ lengthSizeMinusOne,
21403
+ sequenceParameterSets,
21404
+ pictureParameterSets,
21342
21405
  chromaFormat: null,
21343
21406
  bitDepthLumaMinus8: null,
21344
21407
  bitDepthChromaMinus8: null,
21345
21408
  sequenceParameterSetExt: null
21346
21409
  };
21347
- if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 || profile_idc === 144) {
21348
- readExpGolomb(bitstream);
21349
- const chroma_format_idc = readExpGolomb(bitstream);
21350
- if (chroma_format_idc === 3) {
21410
+ if ((avcProfileIndication === 100 || avcProfileIndication === 110 || avcProfileIndication === 122 || avcProfileIndication === 144) && offset + 4 <= data.length) {
21411
+ const chromaFormat = view.getUint8(offset++) & 3;
21412
+ const bitDepthLumaMinus8 = view.getUint8(offset++) & 7;
21413
+ const bitDepthChromaMinus8 = view.getUint8(offset++) & 7;
21414
+ const numOfSequenceParameterSetExt = view.getUint8(offset++);
21415
+ record.chromaFormat = chromaFormat;
21416
+ record.bitDepthLumaMinus8 = bitDepthLumaMinus8;
21417
+ record.bitDepthChromaMinus8 = bitDepthChromaMinus8;
21418
+ const sequenceParameterSetExt = [];
21419
+ for (let i = 0;i < numOfSequenceParameterSetExt; i++) {
21420
+ const length = view.getUint16(offset, false);
21421
+ offset += 2;
21422
+ sequenceParameterSetExt.push(data.subarray(offset, offset + length));
21423
+ offset += length;
21424
+ }
21425
+ record.sequenceParameterSetExt = sequenceParameterSetExt;
21426
+ }
21427
+ return record;
21428
+ } catch (error) {
21429
+ console.error("Error deserializing AVC Decoder Configuration Record:", error);
21430
+ return null;
21431
+ }
21432
+ };
21433
+ var parseAvcSps = (sps) => {
21434
+ try {
21435
+ const bitstream = new Bitstream(removeEmulationPreventionBytes(sps));
21436
+ bitstream.skipBits(1);
21437
+ bitstream.skipBits(2);
21438
+ const nalUnitType = bitstream.readBits(5);
21439
+ if (nalUnitType !== 7) {
21440
+ return null;
21441
+ }
21442
+ const profileIdc = bitstream.readAlignedByte();
21443
+ const constraintFlags = bitstream.readAlignedByte();
21444
+ const levelIdc = bitstream.readAlignedByte();
21445
+ readExpGolomb(bitstream);
21446
+ let chromaFormatIdc = null;
21447
+ let bitDepthLumaMinus8 = null;
21448
+ let bitDepthChromaMinus8 = null;
21449
+ if (profileIdc === 100 || profileIdc === 110 || profileIdc === 122 || profileIdc === 244 || profileIdc === 44 || profileIdc === 83 || profileIdc === 86 || profileIdc === 118 || profileIdc === 128) {
21450
+ chromaFormatIdc = readExpGolomb(bitstream);
21451
+ if (chromaFormatIdc === 3) {
21351
21452
  bitstream.skipBits(1);
21352
21453
  }
21353
- const bit_depth_luma_minus8 = readExpGolomb(bitstream);
21354
- const bit_depth_chroma_minus8 = readExpGolomb(bitstream);
21355
- record.chromaFormat = chroma_format_idc;
21356
- record.bitDepthLumaMinus8 = bit_depth_luma_minus8;
21357
- record.bitDepthChromaMinus8 = bit_depth_chroma_minus8;
21358
- record.sequenceParameterSetExt = spsExtUnits;
21454
+ bitDepthLumaMinus8 = readExpGolomb(bitstream);
21455
+ bitDepthChromaMinus8 = readExpGolomb(bitstream);
21456
+ bitstream.skipBits(1);
21457
+ const seqScalingMatrixPresentFlag = bitstream.readBits(1);
21458
+ if (seqScalingMatrixPresentFlag) {
21459
+ for (let i = 0;i < (chromaFormatIdc !== 3 ? 8 : 12); i++) {
21460
+ const seqScalingListPresentFlag = bitstream.readBits(1);
21461
+ if (seqScalingListPresentFlag) {
21462
+ const sizeOfScalingList = i < 6 ? 16 : 64;
21463
+ let lastScale = 8;
21464
+ let nextScale = 8;
21465
+ for (let j = 0;j < sizeOfScalingList; j++) {
21466
+ if (nextScale !== 0) {
21467
+ const deltaScale = readSignedExpGolomb(bitstream);
21468
+ nextScale = (lastScale + deltaScale + 256) % 256;
21469
+ }
21470
+ lastScale = nextScale === 0 ? lastScale : nextScale;
21471
+ }
21472
+ }
21473
+ }
21474
+ }
21359
21475
  }
21360
- return record;
21476
+ readExpGolomb(bitstream);
21477
+ const picOrderCntType = readExpGolomb(bitstream);
21478
+ if (picOrderCntType === 0) {
21479
+ readExpGolomb(bitstream);
21480
+ } else if (picOrderCntType === 1) {
21481
+ bitstream.skipBits(1);
21482
+ readSignedExpGolomb(bitstream);
21483
+ readSignedExpGolomb(bitstream);
21484
+ const numRefFramesInPicOrderCntCycle = readExpGolomb(bitstream);
21485
+ for (let i = 0;i < numRefFramesInPicOrderCntCycle; i++) {
21486
+ readSignedExpGolomb(bitstream);
21487
+ }
21488
+ }
21489
+ readExpGolomb(bitstream);
21490
+ bitstream.skipBits(1);
21491
+ readExpGolomb(bitstream);
21492
+ readExpGolomb(bitstream);
21493
+ const frameMbsOnlyFlag = bitstream.readBits(1);
21494
+ return {
21495
+ profileIdc,
21496
+ constraintFlags,
21497
+ levelIdc,
21498
+ frameMbsOnlyFlag,
21499
+ chromaFormatIdc,
21500
+ bitDepthLumaMinus8,
21501
+ bitDepthChromaMinus8
21502
+ };
21361
21503
  } catch (error) {
21362
- console.error("Error building AVC Decoder Configuration Record:", error);
21504
+ console.error("Error parsing AVC SPS:", error);
21363
21505
  return null;
21364
21506
  }
21365
21507
  };
@@ -22352,7 +22494,7 @@ var readVorbisComments = (bytes, metadataTags) => {
22352
22494
  }
22353
22495
  };
22354
22496
 
22355
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/demuxer.js
22497
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/demuxer.js
22356
22498
  /*!
22357
22499
  * Copyright (c) 2025-present, Vanilagy and contributors
22358
22500
  *
@@ -22367,7 +22509,7 @@ class Demuxer {
22367
22509
  }
22368
22510
  }
22369
22511
 
22370
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/custom-coder.js
22512
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/custom-coder.js
22371
22513
  /*!
22372
22514
  * Copyright (c) 2025-present, Vanilagy and contributors
22373
22515
  *
@@ -22378,7 +22520,7 @@ class Demuxer {
22378
22520
  var customVideoDecoders = [];
22379
22521
  var customAudioDecoders = [];
22380
22522
 
22381
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/packet.js
22523
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/packet.js
22382
22524
  /*!
22383
22525
  * Copyright (c) 2025-present, Vanilagy and contributors
22384
22526
  *
@@ -22386,7 +22528,7 @@ var customAudioDecoders = [];
22386
22528
  * License, v. 2.0. If a copy of the MPL was not distributed with this
22387
22529
  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
22388
22530
  */
22389
- var PLACEHOLDER_DATA = new Uint8Array(0);
22531
+ var PLACEHOLDER_DATA = /* @__PURE__ */ new Uint8Array(0);
22390
22532
 
22391
22533
  class EncodedPacket {
22392
22534
  constructor(data, type, timestamp, duration, sequenceNumber = -1, byteLength, sideData) {
@@ -22510,7 +22652,7 @@ class EncodedPacket {
22510
22652
  }
22511
22653
  }
22512
22654
 
22513
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/sample.js
22655
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/sample.js
22514
22656
  /*!
22515
22657
  * Copyright (c) 2025-present, Vanilagy and contributors
22516
22658
  *
@@ -22863,12 +23005,14 @@ class VideoSample {
22863
23005
  dx = (canvasWidth - newWidth) / 2;
22864
23006
  dy = (canvasHeight - newHeight) / 2;
22865
23007
  }
23008
+ context.save();
22866
23009
  const aspectRatioChange = rotation % 180 === 0 ? 1 : newWidth / newHeight;
22867
23010
  context.translate(canvasWidth / 2, canvasHeight / 2);
22868
23011
  context.rotate(rotation * Math.PI / 180);
22869
23012
  context.scale(1 / aspectRatioChange, aspectRatioChange);
22870
23013
  context.translate(-canvasWidth / 2, -canvasHeight / 2);
22871
23014
  context.drawImage(this.toCanvasImageSource(), sx, sy, sWidth, sHeight, dx, dy, newWidth, newHeight);
23015
+ context.restore();
22872
23016
  }
22873
23017
  _rotateSourceRegion(sx, sy, sWidth, sHeight, rotation) {
22874
23018
  if (rotation === 90) {
@@ -22958,7 +23102,7 @@ var validateCropRectangle = (crop, prefix) => {
22958
23102
  };
22959
23103
  var AUDIO_SAMPLE_FORMATS = new Set(["f32", "f32-planar", "s16", "s16-planar", "s32", "s32-planar", "u8", "u8-planar"]);
22960
23104
 
22961
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/media-sink.js
23105
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/media-sink.js
22962
23106
  /*!
22963
23107
  * Copyright (c) 2025-present, Vanilagy and contributors
22964
23108
  *
@@ -23518,6 +23662,18 @@ class VideoDecoderWrapper extends DecoderWrapper {
23518
23662
  this.colorQueue.push(frame2);
23519
23663
  }
23520
23664
  };
23665
+ if (codec === "avc" && this.decoderConfig.description && isChromium()) {
23666
+ const record = deserializeAvcDecoderConfigurationRecord(toUint8Array(this.decoderConfig.description));
23667
+ if (record && record.sequenceParameterSets.length > 0) {
23668
+ const sps = parseAvcSps(record.sequenceParameterSets[0]);
23669
+ if (sps && sps.frameMbsOnlyFlag === 0) {
23670
+ this.decoderConfig = {
23671
+ ...this.decoderConfig,
23672
+ hardwareAcceleration: "prefer-software"
23673
+ };
23674
+ }
23675
+ }
23676
+ }
23521
23677
  this.decoder = new VideoDecoder({
23522
23678
  output: (frame2) => {
23523
23679
  try {
@@ -23528,7 +23684,7 @@ class VideoDecoderWrapper extends DecoderWrapper {
23528
23684
  },
23529
23685
  error: onError
23530
23686
  });
23531
- this.decoder.configure(decoderConfig);
23687
+ this.decoder.configure(this.decoderConfig);
23532
23688
  }
23533
23689
  }
23534
23690
  getDecodeQueueSize() {
@@ -23888,7 +24044,7 @@ class VideoSampleSink extends BaseMediaSampleSink {
23888
24044
  }
23889
24045
  }
23890
24046
 
23891
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input-track.js
24047
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/input-track.js
23892
24048
  /*!
23893
24049
  * Copyright (c) 2025-present, Vanilagy and contributors
23894
24050
  *
@@ -23923,6 +24079,9 @@ class InputTrack {
23923
24079
  get timeResolution() {
23924
24080
  return this._backing.getTimeResolution();
23925
24081
  }
24082
+ get disposition() {
24083
+ return this._backing.getDisposition();
24084
+ }
23926
24085
  getFirstTimestamp() {
23927
24086
  return this._backing.getFirstTimestamp();
23928
24087
  }
@@ -24094,7 +24253,7 @@ class InputAudioTrack extends InputTrack {
24094
24253
  }
24095
24254
  }
24096
24255
 
24097
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-misc.js
24256
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-misc.js
24098
24257
  /*!
24099
24258
  * Copyright (c) 2025-present, Vanilagy and contributors
24100
24259
  *
@@ -24112,7 +24271,7 @@ var buildIsobmffMimeType = (info) => {
24112
24271
  return string;
24113
24272
  };
24114
24273
 
24115
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-reader.js
24274
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-reader.js
24116
24275
  /*!
24117
24276
  * Copyright (c) 2025-present, Vanilagy and contributors
24118
24277
  *
@@ -24188,7 +24347,7 @@ var readDataBox = (slice) => {
24188
24347
  }
24189
24348
  };
24190
24349
 
24191
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js
24350
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js
24192
24351
  /*!
24193
24352
  * Copyright (c) 2025-present, Vanilagy and contributors
24194
24353
  *
@@ -24263,6 +24422,7 @@ class IsobmffDemuxer extends Demuxer {
24263
24422
  break;
24264
24423
  this.moovSlice = moovSlice;
24265
24424
  this.readContiguousBoxes(this.moovSlice);
24425
+ this.tracks.sort((a, b) => Number(b.disposition.default) - Number(a.disposition.default));
24266
24426
  for (const track of this.tracks) {
24267
24427
  const previousSegmentDurationsInSeconds = track.editListPreviousSegmentDurations / this.movieTimescale;
24268
24428
  track.editListOffset -= Math.round(previousSegmentDurationsInSeconds * track.timescale);
@@ -24491,6 +24651,9 @@ class IsobmffDemuxer extends Demuxer {
24491
24651
  id: -1,
24492
24652
  demuxer: this,
24493
24653
  inputTrack: null,
24654
+ disposition: {
24655
+ ...DEFAULT_TRACK_DISPOSITION
24656
+ },
24494
24657
  info: null,
24495
24658
  timescale: -1,
24496
24659
  durationInMovieTimescale: -1,
@@ -24532,10 +24695,8 @@ class IsobmffDemuxer extends Demuxer {
24532
24695
  }
24533
24696
  const version = readU8(slice);
24534
24697
  const flags = readU24Be(slice);
24535
- const trackEnabled = (flags & 1) !== 0;
24536
- if (!trackEnabled) {
24537
- break;
24538
- }
24698
+ const trackEnabled = !!(flags & 1);
24699
+ track.disposition.default = trackEnabled;
24539
24700
  if (version === 0) {
24540
24701
  slice.skip(8);
24541
24702
  track.id = readU32Be(slice);
@@ -24651,6 +24812,7 @@ class IsobmffDemuxer extends Demuxer {
24651
24812
  codec: null,
24652
24813
  codecDescription: null,
24653
24814
  colorSpace: null,
24815
+ avcType: null,
24654
24816
  avcCodecInfo: null,
24655
24817
  hevcCodecInfo: null,
24656
24818
  vp9CodecInfo: null,
@@ -24701,8 +24863,9 @@ class IsobmffDemuxer extends Demuxer {
24701
24863
  track.internalCodecId = sampleBoxInfo.name;
24702
24864
  const lowercaseBoxName = sampleBoxInfo.name.toLowerCase();
24703
24865
  if (track.info.type === "video") {
24704
- if (lowercaseBoxName === "avc1") {
24866
+ if (lowercaseBoxName === "avc1" || lowercaseBoxName === "avc3") {
24705
24867
  track.info.codec = "avc";
24868
+ track.info.avcType = lowercaseBoxName === "avc1" ? 1 : 3;
24706
24869
  } else if (lowercaseBoxName === "hvc1" || lowercaseBoxName === "hev1") {
24707
24870
  track.info.codec = "hevc";
24708
24871
  } else if (lowercaseBoxName === "vp08") {
@@ -25991,6 +26154,9 @@ class IsobmffTrackBacking {
25991
26154
  getTimeResolution() {
25992
26155
  return this.internalTrack.timescale;
25993
26156
  }
26157
+ getDisposition() {
26158
+ return this.internalTrack.disposition;
26159
+ }
25994
26160
  async computeDuration() {
25995
26161
  const lastPacket = await this.getPacket(Infinity, { metadataOnly: true });
25996
26162
  return (lastPacket?.timestamp ?? 0) + (lastPacket?.duration ?? 0);
@@ -26019,7 +26185,7 @@ class IsobmffTrackBacking {
26019
26185
  }, -Infinity, Infinity, options);
26020
26186
  }
26021
26187
  mapTimestampIntoTimescale(timestamp) {
26022
- return roundToPrecision(timestamp * this.internalTrack.timescale, 14) + this.internalTrack.editListOffset;
26188
+ return roundIfAlmostInteger(timestamp * this.internalTrack.timescale) + this.internalTrack.editListOffset;
26023
26189
  }
26024
26190
  async getPacket(timestamp, options) {
26025
26191
  const timestampInTimescale = this.mapTimestampIntoTimescale(timestamp);
@@ -26444,7 +26610,7 @@ var sampleTableIsEmpty = (sampleTable) => {
26444
26610
  return sampleTable.sampleSizes.length === 0;
26445
26611
  };
26446
26612
 
26447
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/ebml.js
26613
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/matroska/ebml.js
26448
26614
  /*!
26449
26615
  * Copyright (c) 2025-present, Vanilagy and contributors
26450
26616
  *
@@ -26481,6 +26647,10 @@ var EBMLId;
26481
26647
  EBMLId2[EBMLId2["FlagEnabled"] = 185] = "FlagEnabled";
26482
26648
  EBMLId2[EBMLId2["FlagDefault"] = 136] = "FlagDefault";
26483
26649
  EBMLId2[EBMLId2["FlagForced"] = 21930] = "FlagForced";
26650
+ EBMLId2[EBMLId2["FlagOriginal"] = 21934] = "FlagOriginal";
26651
+ EBMLId2[EBMLId2["FlagHearingImpaired"] = 21931] = "FlagHearingImpaired";
26652
+ EBMLId2[EBMLId2["FlagVisualImpaired"] = 21932] = "FlagVisualImpaired";
26653
+ EBMLId2[EBMLId2["FlagCommentary"] = 21935] = "FlagCommentary";
26484
26654
  EBMLId2[EBMLId2["FlagLacing"] = 156] = "FlagLacing";
26485
26655
  EBMLId2[EBMLId2["Name"] = 21358] = "Name";
26486
26656
  EBMLId2[EBMLId2["Language"] = 2274716] = "Language";
@@ -26629,13 +26799,6 @@ var readUnsignedBigInt = (slice, width) => {
26629
26799
  }
26630
26800
  return value;
26631
26801
  };
26632
- var readSignedInt = (slice, width) => {
26633
- let value = readUnsignedInt(slice, width);
26634
- if (value & 1 << width * 8 - 1) {
26635
- value -= 2 ** (width * 8);
26636
- }
26637
- return value;
26638
- };
26639
26802
  var readElementId = (slice) => {
26640
26803
  const size4 = readVarIntSize(slice);
26641
26804
  if (size4 === null) {
@@ -26762,7 +26925,7 @@ function assertDefinedSize(size4) {
26762
26925
  }
26763
26926
  }
26764
26927
 
26765
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/matroska-misc.js
26928
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/matroska/matroska-misc.js
26766
26929
  /*!
26767
26930
  * Copyright (c) 2025-present, Vanilagy and contributors
26768
26931
  *
@@ -26780,7 +26943,7 @@ var buildMatroskaMimeType = (info) => {
26780
26943
  return string;
26781
26944
  };
26782
26945
 
26783
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js
26946
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js
26784
26947
  /*!
26785
26948
  * Copyright (c) 2025-present, Vanilagy and contributors
26786
26949
  *
@@ -27030,7 +27193,7 @@ class MatroskaDemuxer extends Demuxer {
27030
27193
  this.currentSegment.timestampScale = 1e6;
27031
27194
  this.currentSegment.timestampFactor = 1e9 / 1e6;
27032
27195
  }
27033
- this.currentSegment.tracks.sort((a, b) => Number(b.isDefault) - Number(a.isDefault));
27196
+ this.currentSegment.tracks.sort((a, b) => Number(b.disposition.default) - Number(a.disposition.default));
27034
27197
  const idToTrack = new Map(this.currentSegment.tracks.map((x) => [x.id, x]));
27035
27198
  for (const cuePoint of this.currentSegment.cuePoints) {
27036
27199
  const track = idToTrack.get(cuePoint.trackId);
@@ -27102,17 +27265,12 @@ class MatroskaDemuxer extends Demuxer {
27102
27265
  for (const [, trackData] of cluster.trackData) {
27103
27266
  const track = trackData.track;
27104
27267
  assert(trackData.blocks.length > 0);
27105
- let blockReferencesExist = false;
27106
27268
  let hasLacedBlocks = false;
27107
27269
  for (let i = 0;i < trackData.blocks.length; i++) {
27108
27270
  const block = trackData.blocks[i];
27109
27271
  block.timestamp += cluster.timestamp;
27110
- blockReferencesExist ||= block.referencedTimestamps.length > 0;
27111
27272
  hasLacedBlocks ||= block.lacing !== BlockLacing.None;
27112
27273
  }
27113
- if (blockReferencesExist) {
27114
- trackData.blocks = sortBlocksByReferences(trackData.blocks);
27115
- }
27116
27274
  trackData.presentationTimestamps = trackData.blocks.map((block, i) => ({ timestamp: block.timestamp, blockIndex: i })).sort((a, b) => a.timestamp - b.timestamp);
27117
27275
  for (let i = 0;i < trackData.presentationTimestamps.length; i++) {
27118
27276
  const currentEntry = trackData.presentationTimestamps[i];
@@ -27250,7 +27408,6 @@ class MatroskaDemuxer extends Demuxer {
27250
27408
  timestamp: frameTimestamp,
27251
27409
  duration: frameDuration,
27252
27410
  isKeyFrame: originalBlock.isKeyFrame,
27253
- referencedTimestamps: originalBlock.referencedTimestamps,
27254
27411
  data: frameData,
27255
27412
  lacing: BlockLacing.None,
27256
27413
  decoded: true,
@@ -27379,7 +27536,9 @@ class MatroskaDemuxer extends Demuxer {
27379
27536
  demuxer: this,
27380
27537
  clusterPositionCache: [],
27381
27538
  cuePoints: [],
27382
- isDefault: false,
27539
+ disposition: {
27540
+ ...DEFAULT_TRACK_DISPOSITION
27541
+ },
27383
27542
  inputTrack: null,
27384
27543
  codecId: null,
27385
27544
  codecPrivate: null,
@@ -27527,7 +27686,47 @@ class MatroskaDemuxer extends Demuxer {
27527
27686
  {
27528
27687
  if (!this.currentTrack)
27529
27688
  break;
27530
- this.currentTrack.isDefault = !!readUnsignedInt(slice, size4);
27689
+ this.currentTrack.disposition.default = !!readUnsignedInt(slice, size4);
27690
+ }
27691
+ ;
27692
+ break;
27693
+ case EBMLId.FlagForced:
27694
+ {
27695
+ if (!this.currentTrack)
27696
+ break;
27697
+ this.currentTrack.disposition.forced = !!readUnsignedInt(slice, size4);
27698
+ }
27699
+ ;
27700
+ break;
27701
+ case EBMLId.FlagOriginal:
27702
+ {
27703
+ if (!this.currentTrack)
27704
+ break;
27705
+ this.currentTrack.disposition.original = !!readUnsignedInt(slice, size4);
27706
+ }
27707
+ ;
27708
+ break;
27709
+ case EBMLId.FlagHearingImpaired:
27710
+ {
27711
+ if (!this.currentTrack)
27712
+ break;
27713
+ this.currentTrack.disposition.hearingImpaired = !!readUnsignedInt(slice, size4);
27714
+ }
27715
+ ;
27716
+ break;
27717
+ case EBMLId.FlagVisualImpaired:
27718
+ {
27719
+ if (!this.currentTrack)
27720
+ break;
27721
+ this.currentTrack.disposition.visuallyImpaired = !!readUnsignedInt(slice, size4);
27722
+ }
27723
+ ;
27724
+ break;
27725
+ case EBMLId.FlagCommentary:
27726
+ {
27727
+ if (!this.currentTrack)
27728
+ break;
27729
+ this.currentTrack.disposition.commentary = !!readUnsignedInt(slice, size4);
27531
27730
  }
27532
27731
  ;
27533
27732
  break;
@@ -27790,15 +27989,17 @@ class MatroskaDemuxer extends Demuxer {
27790
27989
  break;
27791
27990
  const relativeTimestamp = readI16Be(slice);
27792
27991
  const flags = readU8(slice);
27793
- const isKeyFrame = !!(flags & 128);
27794
27992
  const lacing = flags >> 1 & 3;
27993
+ let isKeyFrame = !!(flags & 128);
27994
+ if (trackData.track.info?.type === "audio" && trackData.track.info.codec) {
27995
+ isKeyFrame = true;
27996
+ }
27795
27997
  const blockData = readBytes(slice, size4 - (slice.filePos - dataStartPos));
27796
27998
  const hasDecodingInstructions = trackData.track.decodingInstructions.length > 0;
27797
27999
  trackData.blocks.push({
27798
28000
  timestamp: relativeTimestamp,
27799
28001
  duration: 0,
27800
28002
  isKeyFrame,
27801
- referencedTimestamps: [],
27802
28003
  data: blockData,
27803
28004
  lacing,
27804
28005
  decoded: !hasDecodingInstructions,
@@ -27812,12 +28013,7 @@ class MatroskaDemuxer extends Demuxer {
27812
28013
  if (!this.currentCluster)
27813
28014
  break;
27814
28015
  this.readContiguousElements(slice.slice(dataStartPos, size4));
27815
- if (this.currentBlock) {
27816
- for (let i = 0;i < this.currentBlock.referencedTimestamps.length; i++) {
27817
- this.currentBlock.referencedTimestamps[i] += this.currentBlock.timestamp;
27818
- }
27819
- this.currentBlock = null;
27820
- }
28016
+ this.currentBlock = null;
27821
28017
  }
27822
28018
  ;
27823
28019
  break;
@@ -27840,7 +28036,6 @@ class MatroskaDemuxer extends Demuxer {
27840
28036
  timestamp: relativeTimestamp,
27841
28037
  duration: 0,
27842
28038
  isKeyFrame: true,
27843
- referencedTimestamps: [],
27844
28039
  data: blockData,
27845
28040
  lacing,
27846
28041
  decoded: !hasDecodingInstructions,
@@ -27901,8 +28096,6 @@ class MatroskaDemuxer extends Demuxer {
27901
28096
  if (!this.currentBlock)
27902
28097
  break;
27903
28098
  this.currentBlock.isKeyFrame = false;
27904
- const relativeTimestamp = readSignedInt(slice, size4);
27905
- this.currentBlock.referencedTimestamps.push(relativeTimestamp);
27906
28099
  }
27907
28100
  ;
27908
28101
  break;
@@ -28300,6 +28493,9 @@ class MatroskaTrackBacking {
28300
28493
  getTimeResolution() {
28301
28494
  return this.internalTrack.segment.timestampFactor;
28302
28495
  }
28496
+ getDisposition() {
28497
+ return this.internalTrack.disposition;
28498
+ }
28303
28499
  async getFirstPacket(options) {
28304
28500
  return this.performClusterLookup(null, (cluster) => {
28305
28501
  const trackData = cluster.trackData.get(this.internalTrack.id);
@@ -28316,7 +28512,7 @@ class MatroskaTrackBacking {
28316
28512
  }, -Infinity, Infinity, options);
28317
28513
  }
28318
28514
  intoTimescale(timestamp) {
28319
- return roundToPrecision(timestamp * this.internalTrack.segment.timestampFactor, 14);
28515
+ return roundIfAlmostInteger(timestamp * this.internalTrack.segment.timestampFactor);
28320
28516
  }
28321
28517
  async getPacket(timestamp, options) {
28322
28518
  const timestampInTimescale = this.intoTimescale(timestamp);
@@ -28579,6 +28775,7 @@ class MatroskaVideoTrackBacking extends MatroskaTrackBacking {
28579
28775
  codec: this.internalTrack.info.codec,
28580
28776
  codecDescription: this.internalTrack.info.codecDescription,
28581
28777
  colorSpace: this.internalTrack.info.colorSpace,
28778
+ avcType: 1,
28582
28779
  avcCodecInfo: this.internalTrack.info.codec === "avc" && firstPacket ? extractAvcDecoderConfigurationRecord(firstPacket.data) : null,
28583
28780
  hevcCodecInfo: this.internalTrack.info.codec === "hevc" && firstPacket ? extractHevcDecoderConfigurationRecord(firstPacket.data) : null,
28584
28781
  vp9CodecInfo: this.internalTrack.info.codec === "vp9" && firstPacket ? extractVp9CodecInfoFromPacket(firstPacket.data) : null,
@@ -28624,36 +28821,8 @@ class MatroskaAudioTrackBacking extends MatroskaTrackBacking {
28624
28821
  };
28625
28822
  }
28626
28823
  }
28627
- var sortBlocksByReferences = (blocks) => {
28628
- const timestampToBlock = new Map;
28629
- for (let i = 0;i < blocks.length; i++) {
28630
- const block = blocks[i];
28631
- timestampToBlock.set(block.timestamp, block);
28632
- }
28633
- const processedBlocks = new Set;
28634
- const result = [];
28635
- const processBlock = (block) => {
28636
- if (processedBlocks.has(block)) {
28637
- return;
28638
- }
28639
- processedBlocks.add(block);
28640
- for (let j = 0;j < block.referencedTimestamps.length; j++) {
28641
- const timestamp = block.referencedTimestamps[j];
28642
- const otherBlock = timestampToBlock.get(timestamp);
28643
- if (!otherBlock) {
28644
- continue;
28645
- }
28646
- processBlock(otherBlock);
28647
- }
28648
- result.push(block);
28649
- };
28650
- for (let i = 0;i < blocks.length; i++) {
28651
- processBlock(blocks[i]);
28652
- }
28653
- return result;
28654
- };
28655
28824
 
28656
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/shared/mp3-misc.js
28825
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/shared/mp3-misc.js
28657
28826
  /*!
28658
28827
  * Copyright (c) 2025-present, Vanilagy and contributors
28659
28828
  *
@@ -28895,7 +29064,7 @@ var decodeSynchsafe = (synchsafed) => {
28895
29064
  return unsynchsafed;
28896
29065
  };
28897
29066
 
28898
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/id3.js
29067
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/id3.js
28899
29068
  /*!
28900
29069
  * Copyright (c) 2025-present, Vanilagy and contributors
28901
29070
  *
@@ -29595,7 +29764,7 @@ class Id3V2Reader {
29595
29764
  }
29596
29765
  }
29597
29766
 
29598
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/mp3/mp3-reader.js
29767
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/mp3/mp3-reader.js
29599
29768
  /*!
29600
29769
  * Copyright (c) 2025-present, Vanilagy and contributors
29601
29770
  *
@@ -29621,7 +29790,7 @@ var readNextFrameHeader = async (reader, startPos, until) => {
29621
29790
  return null;
29622
29791
  };
29623
29792
 
29624
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js
29793
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js
29625
29794
  /*!
29626
29795
  * Copyright (c) 2025-present, Vanilagy and contributors
29627
29796
  *
@@ -29804,6 +29973,11 @@ class Mp3AudioTrackBacking {
29804
29973
  assert(this.demuxer.firstFrameHeader);
29805
29974
  return this.demuxer.firstFrameHeader.sampleRate;
29806
29975
  }
29976
+ getDisposition() {
29977
+ return {
29978
+ ...DEFAULT_TRACK_DISPOSITION
29979
+ };
29980
+ }
29807
29981
  async getDecoderConfig() {
29808
29982
  assert(this.demuxer.firstFrameHeader);
29809
29983
  return {
@@ -29881,7 +30055,7 @@ class Mp3AudioTrackBacking {
29881
30055
  }
29882
30056
  }
29883
30057
 
29884
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-misc.js
30058
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/ogg/ogg-misc.js
29885
30059
  /*!
29886
30060
  * Copyright (c) 2025-present, Vanilagy and contributors
29887
30061
  *
@@ -29952,7 +30126,7 @@ var buildOggMimeType = (info) => {
29952
30126
  return string;
29953
30127
  };
29954
30128
 
29955
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-reader.js
30129
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/ogg/ogg-reader.js
29956
30130
  /*!
29957
30131
  * Copyright (c) 2025-present, Vanilagy and contributors
29958
30132
  *
@@ -30016,7 +30190,7 @@ var findNextPageHeader = (slice, until) => {
30016
30190
  return false;
30017
30191
  };
30018
30192
 
30019
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/ogg/ogg-demuxer.js
30193
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/ogg/ogg-demuxer.js
30020
30194
  /*!
30021
30195
  * Copyright (c) 2025-present, Vanilagy and contributors
30022
30196
  *
@@ -30312,6 +30486,11 @@ class OggAudioTrackBacking {
30312
30486
  getLanguageCode() {
30313
30487
  return UNDETERMINED_LANGUAGE;
30314
30488
  }
30489
+ getDisposition() {
30490
+ return {
30491
+ ...DEFAULT_TRACK_DISPOSITION
30492
+ };
30493
+ }
30315
30494
  async getFirstTimestamp() {
30316
30495
  return 0;
30317
30496
  }
@@ -30378,7 +30557,7 @@ class OggAudioTrackBacking {
30378
30557
  if (this.demuxer.reader.fileSize === null) {
30379
30558
  return this.getPacketSequential(timestamp, options);
30380
30559
  }
30381
- const timestampInSamples = roundToPrecision(timestamp * this.internalSampleRate, 14);
30560
+ const timestampInSamples = roundIfAlmostInteger(timestamp * this.internalSampleRate);
30382
30561
  if (timestampInSamples === 0) {
30383
30562
  return this.getFirstPacket(options);
30384
30563
  }
@@ -30582,7 +30761,7 @@ class OggAudioTrackBacking {
30582
30761
  async getPacketSequential(timestamp, options) {
30583
30762
  const release = await this.sequentialScanMutex.acquire();
30584
30763
  try {
30585
- const timestampInSamples = roundToPrecision(timestamp * this.internalSampleRate, 14);
30764
+ const timestampInSamples = roundIfAlmostInteger(timestamp * this.internalSampleRate);
30586
30765
  timestamp = timestampInSamples / this.internalSampleRate;
30587
30766
  const index = binarySearchLessOrEqual(this.sequentialScanCache, timestampInSamples, (x) => x.timestampInSamples);
30588
30767
  let currentPacket;
@@ -30671,7 +30850,7 @@ var findPreviousPacketEndPosition = (pageList, startPage, startSegmentIndex) =>
30671
30850
  return { page: previousPage, segmentIndex: previousPage.lacingValues.length - 1 };
30672
30851
  };
30673
30852
 
30674
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js
30853
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js
30675
30854
  /*!
30676
30855
  * Copyright (c) 2025-present, Vanilagy and contributors
30677
30856
  *
@@ -31017,6 +31196,11 @@ class WaveAudioTrackBacking {
31017
31196
  getLanguageCode() {
31018
31197
  return UNDETERMINED_LANGUAGE;
31019
31198
  }
31199
+ getDisposition() {
31200
+ return {
31201
+ ...DEFAULT_TRACK_DISPOSITION
31202
+ };
31203
+ }
31020
31204
  async getFirstTimestamp() {
31021
31205
  return 0;
31022
31206
  }
@@ -31087,7 +31271,7 @@ class WaveAudioTrackBacking {
31087
31271
  }
31088
31272
  }
31089
31273
 
31090
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/adts/adts-reader.js
31274
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/adts/adts-reader.js
31091
31275
  /*!
31092
31276
  * Copyright (c) 2025-present, Vanilagy and contributors
31093
31277
  *
@@ -31148,7 +31332,7 @@ var readFrameHeader2 = (slice) => {
31148
31332
  };
31149
31333
  };
31150
31334
 
31151
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js
31335
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js
31152
31336
  /*!
31153
31337
  * Copyright (c) 2025-present, Vanilagy and contributors
31154
31338
  *
@@ -31275,6 +31459,11 @@ class AdtsAudioTrackBacking {
31275
31459
  assert(sampleRate !== undefined);
31276
31460
  return sampleRate;
31277
31461
  }
31462
+ getDisposition() {
31463
+ return {
31464
+ ...DEFAULT_TRACK_DISPOSITION
31465
+ };
31466
+ }
31278
31467
  async getDecoderConfig() {
31279
31468
  assert(this.demuxer.firstFrameHeader);
31280
31469
  const bytes = new Uint8Array(3);
@@ -31364,7 +31553,7 @@ class AdtsAudioTrackBacking {
31364
31553
  }
31365
31554
  }
31366
31555
 
31367
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/flac/flac-misc.js
31556
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/flac/flac-misc.js
31368
31557
  /*!
31369
31558
  * Copyright (c) 2025-present, Vanilagy and contributors
31370
31559
  *
@@ -31499,7 +31688,7 @@ var calculateCrc8 = (data) => {
31499
31688
  return crc;
31500
31689
  };
31501
31690
 
31502
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/flac/flac-demuxer.js
31691
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/flac/flac-demuxer.js
31503
31692
  /*!
31504
31693
  * Copyright (c) 2025-present, Vanilagy and contributors
31505
31694
  *
@@ -31662,10 +31851,11 @@ class FlacDemuxer extends Demuxer {
31662
31851
  }
31663
31852
  const nextByte = readU8(slice);
31664
31853
  if (nextByte === 255) {
31854
+ const positionBeforeReading = slice.filePos;
31665
31855
  const byteAfterNextByte = readU8(slice);
31666
31856
  const expected = this.blockingBit === 1 ? 249 : 248;
31667
31857
  if (byteAfterNextByte !== expected) {
31668
- slice.skip(-1);
31858
+ slice.filePos = positionBeforeReading;
31669
31859
  continue;
31670
31860
  }
31671
31861
  slice.skip(-2);
@@ -31675,17 +31865,17 @@ class FlacDemuxer extends Demuxer {
31675
31865
  isFirstPacket: false
31676
31866
  });
31677
31867
  if (!nextFrameHeader) {
31678
- slice.skip(-1);
31868
+ slice.filePos = positionBeforeReading;
31679
31869
  continue;
31680
31870
  }
31681
31871
  if (this.blockingBit === 0) {
31682
31872
  if (nextFrameHeader.num - frameHeader.num !== 1) {
31683
- slice.skip(-1);
31873
+ slice.filePos = positionBeforeReading;
31684
31874
  continue;
31685
31875
  }
31686
31876
  } else {
31687
31877
  if (nextFrameHeader.num - frameHeader.num !== frameHeader.blockSize) {
31688
- slice.skip(-1);
31878
+ slice.filePos = positionBeforeReading;
31689
31879
  continue;
31690
31880
  }
31691
31881
  }
@@ -31825,6 +32015,11 @@ class FlacAudioTrackBacking {
31825
32015
  assert(this.demuxer.audioInfo);
31826
32016
  return this.demuxer.audioInfo.sampleRate;
31827
32017
  }
32018
+ getDisposition() {
32019
+ return {
32020
+ ...DEFAULT_TRACK_DISPOSITION
32021
+ };
32022
+ }
31828
32023
  async getFirstTimestamp() {
31829
32024
  return 0;
31830
32025
  }
@@ -31917,7 +32112,7 @@ class FlacAudioTrackBacking {
31917
32112
  }
31918
32113
  }
31919
32114
 
31920
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input-format.js
32115
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/input-format.js
31921
32116
  /*!
31922
32117
  * Copyright (c) 2025-present, Vanilagy and contributors
31923
32118
  *
@@ -32228,18 +32423,18 @@ class AdtsInputFormat extends InputFormat {
32228
32423
  return "audio/aac";
32229
32424
  }
32230
32425
  }
32231
- var MP4 = new Mp4InputFormat;
32232
- var QTFF = new QuickTimeInputFormat;
32233
- var MATROSKA = new MatroskaInputFormat;
32234
- var WEBM = new WebMInputFormat;
32235
- var MP3 = new Mp3InputFormat;
32236
- var WAVE = new WaveInputFormat;
32237
- var OGG = new OggInputFormat;
32238
- var ADTS = new AdtsInputFormat;
32239
- var FLAC = new FlacInputFormat;
32426
+ var MP4 = /* @__PURE__ */ new Mp4InputFormat;
32427
+ var QTFF = /* @__PURE__ */ new QuickTimeInputFormat;
32428
+ var MATROSKA = /* @__PURE__ */ new MatroskaInputFormat;
32429
+ var WEBM = /* @__PURE__ */ new WebMInputFormat;
32430
+ var MP3 = /* @__PURE__ */ new Mp3InputFormat;
32431
+ var WAVE = /* @__PURE__ */ new WaveInputFormat;
32432
+ var OGG = /* @__PURE__ */ new OggInputFormat;
32433
+ var ADTS = /* @__PURE__ */ new AdtsInputFormat;
32434
+ var FLAC = /* @__PURE__ */ new FlacInputFormat;
32240
32435
  var ALL_FORMATS = [MP4, QTFF, MATROSKA, WEBM, WAVE, OGG, FLAC, MP3, ADTS];
32241
32436
 
32242
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/source.js
32437
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/source.js
32243
32438
  var nodeAlias = (() => ({}));
32244
32439
  /*!
32245
32440
  * Copyright (c) 2025-present, Vanilagy and contributors
@@ -32283,6 +32478,7 @@ var DEFAULT_RETRY_DELAY = (previousAttempts, error, src) => {
32283
32478
  } catch {}
32284
32479
  const isOnline = typeof navigator !== "undefined" && typeof navigator.onLine === "boolean" ? navigator.onLine : true;
32285
32480
  if (isOnline && originOfSrc !== null && originOfSrc !== window.location.origin) {
32481
+ 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.`);
32286
32482
  return null;
32287
32483
  }
32288
32484
  }
@@ -32328,14 +32524,14 @@ class UrlSource extends Source {
32328
32524
  Range: "bytes=0-"
32329
32525
  },
32330
32526
  signal: abortController.signal
32331
- }), this._getRetryDelay);
32527
+ }), this._getRetryDelay, () => this._disposed);
32332
32528
  if (!response.ok) {
32333
32529
  throw new Error(`Error fetching ${String(this._url)}: ${response.status} ${response.statusText}`);
32334
32530
  }
32335
32531
  let worker;
32336
32532
  let fileSize;
32337
32533
  if (response.status === 206) {
32338
- fileSize = this._getPartialLengthFromRangeResponse(response);
32534
+ fileSize = this._getTotalLengthFromRangeResponse(response);
32339
32535
  worker = this._orchestrator.createWorker(0, Math.min(fileSize, URL_SOURCE_MIN_LOAD_AMOUNT));
32340
32536
  } else {
32341
32537
  const contentLength = response.headers.get("Content-Length");
@@ -32369,7 +32565,7 @@ class UrlSource extends Source {
32369
32565
  Range: `bytes=${worker.currentPos}-`
32370
32566
  },
32371
32567
  signal: abortController.signal
32372
- }), this._getRetryDelay);
32568
+ }), this._getRetryDelay, () => this._disposed);
32373
32569
  }
32374
32570
  assert(response);
32375
32571
  if (!response.ok) {
@@ -32378,11 +32574,6 @@ class UrlSource extends Source {
32378
32574
  if (worker.currentPos > 0 && response.status !== 206) {
32379
32575
  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.");
32380
32576
  }
32381
- const length = this._getPartialLengthFromRangeResponse(response);
32382
- const required = worker.targetPos - worker.currentPos;
32383
- if (length < required) {
32384
- throw new Error(`HTTP response unexpectedly too short: Needed at least ${required} bytes, got only ${length}.`);
32385
- }
32386
32577
  if (!response.body) {
32387
32578
  throw new Error("Missing HTTP response body stream. The used fetch function must provide the response body as a" + " ReadableStream.");
32388
32579
  }
@@ -32397,6 +32588,9 @@ class UrlSource extends Source {
32397
32588
  try {
32398
32589
  readResult = await reader.read();
32399
32590
  } catch (error) {
32591
+ if (this._disposed) {
32592
+ throw error;
32593
+ }
32400
32594
  const retryDelayInSeconds = this._getRetryDelay(1, error, this._url);
32401
32595
  if (retryDelayInSeconds !== null) {
32402
32596
  console.error("Error while reading response stream. Attempting to resume.", error);
@@ -32411,12 +32605,12 @@ class UrlSource extends Source {
32411
32605
  }
32412
32606
  const { done, value } = readResult;
32413
32607
  if (done) {
32414
- this._orchestrator.forgetWorker(worker);
32415
- if (worker.currentPos < worker.targetPos) {
32416
- throw new Error("Response stream reader stopped unexpectedly before all requested data was read.");
32608
+ if (worker.currentPos >= worker.targetPos) {
32609
+ this._orchestrator.forgetWorker(worker);
32610
+ worker.running = false;
32611
+ return;
32417
32612
  }
32418
- worker.running = false;
32419
- return;
32613
+ break;
32420
32614
  }
32421
32615
  this.onread?.(worker.currentPos, worker.currentPos + value.length);
32422
32616
  this._orchestrator.supplyWorkerData(worker, value);
@@ -32427,22 +32621,19 @@ class UrlSource extends Source {
32427
32621
  }
32428
32622
  worker.running = false;
32429
32623
  }
32430
- _getPartialLengthFromRangeResponse(response) {
32624
+ _getTotalLengthFromRangeResponse(response) {
32431
32625
  const contentRange = response.headers.get("Content-Range");
32432
32626
  if (contentRange) {
32433
32627
  const match = /\/(\d+)/.exec(contentRange);
32434
32628
  if (match) {
32435
32629
  return Number(match[1]);
32436
- } else {
32437
- throw new Error(`Invalid Content-Range header: ${contentRange}`);
32438
32630
  }
32631
+ }
32632
+ const contentLength = response.headers.get("Content-Length");
32633
+ if (contentLength) {
32634
+ return Number(contentLength);
32439
32635
  } else {
32440
- const contentLength = response.headers.get("Content-Length");
32441
- if (contentLength) {
32442
- return Number(contentLength);
32443
- } else {
32444
- throw new Error("Partial HTTP response (status 206) must surface either Content-Range or" + " Content-Length header.");
32445
- }
32636
+ throw new Error("Partial HTTP response (status 206) must surface either Content-Range or" + " Content-Length header.");
32446
32637
  }
32447
32638
  }
32448
32639
  _dispose() {
@@ -32781,7 +32972,7 @@ class ReadOrchestrator {
32781
32972
  }
32782
32973
  }
32783
32974
 
32784
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/input.js
32975
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/input.js
32785
32976
  /*!
32786
32977
  * Copyright (c) 2025-present, Vanilagy and contributors
32787
32978
  *
@@ -32888,7 +33079,7 @@ class InputDisposedError extends Error {
32888
33079
  }
32889
33080
  }
32890
33081
 
32891
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/reader.js
33082
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/reader.js
32892
33083
  /*!
32893
33084
  * Copyright (c) 2025-present, Vanilagy and contributors
32894
33085
  *
@@ -33106,7 +33297,7 @@ var readAscii = (slice, length) => {
33106
33297
  }
33107
33298
  return str;
33108
33299
  };
33109
- // ../../node_modules/.bun/mediabunny@1.24.5/node_modules/mediabunny/dist/modules/src/index.js
33300
+ // ../../node_modules/.bun/mediabunny@1.25.3/node_modules/mediabunny/dist/modules/src/index.js
33110
33301
  /*!
33111
33302
  * Copyright (c) 2025-present, Vanilagy and contributors
33112
33303
  *
@@ -38137,7 +38328,9 @@ var RenderModalAdvanced = ({
38137
38328
  hardwareAcceleration,
38138
38329
  chromeModeOption,
38139
38330
  setChromeModeOption,
38140
- setHardwareAcceleration
38331
+ setHardwareAcceleration,
38332
+ darkMode,
38333
+ setDarkMode
38141
38334
  }) => {
38142
38335
  const extendedOpenGlOptions = useMemo122(() => {
38143
38336
  return [
@@ -38200,6 +38393,9 @@ var RenderModalAdvanced = ({
38200
38393
  const onUserAgentChanged = useCallback116((e) => {
38201
38394
  setUserAgent(e.target.value);
38202
38395
  }, [setUserAgent]);
38396
+ const onDarkMode = useCallback116((e) => {
38397
+ setDarkMode(e.target.checked);
38398
+ }, [setDarkMode]);
38203
38399
  const onPlayBeepSound = useCallback116((e) => {
38204
38400
  setBeep(e.target.checked);
38205
38401
  }, [setBeep]);
@@ -38629,6 +38825,31 @@ var RenderModalAdvanced = ({
38629
38825
  })
38630
38826
  ]
38631
38827
  }),
38828
+ /* @__PURE__ */ jsxs121("div", {
38829
+ style: optionRow,
38830
+ children: [
38831
+ /* @__PURE__ */ jsxs121("div", {
38832
+ style: label5,
38833
+ children: [
38834
+ "Dark Mode",
38835
+ /* @__PURE__ */ jsx242(Spacing, {
38836
+ x: 0.5
38837
+ }),
38838
+ /* @__PURE__ */ jsx242(OptionExplainerBubble, {
38839
+ id: "darkModeOption"
38840
+ })
38841
+ ]
38842
+ }),
38843
+ /* @__PURE__ */ jsx242("div", {
38844
+ style: rightRow,
38845
+ children: /* @__PURE__ */ jsx242(Checkbox, {
38846
+ checked: darkMode,
38847
+ onChange: onDarkMode,
38848
+ name: "dark-mode"
38849
+ })
38850
+ })
38851
+ ]
38852
+ }),
38632
38853
  /* @__PURE__ */ jsxs121("div", {
38633
38854
  style: optionRow,
38634
38855
  children: [
@@ -40337,6 +40558,7 @@ var RenderModal = ({
40337
40558
  initialEncodingMaxRate,
40338
40559
  initialOffthreadVideoThreads,
40339
40560
  initialMediaCacheSizeInBytes,
40561
+ initialDarkMode,
40340
40562
  initialUserAgent,
40341
40563
  defaultProps,
40342
40564
  inFrameMark,
@@ -40418,6 +40640,7 @@ var RenderModal = ({
40418
40640
  const [beepOnFinish, setBeepOnFinish] = useState79(() => initialBeep);
40419
40641
  const [ignoreCertificateErrors, setIgnoreCertificateErrors] = useState79(() => initialIgnoreCertificateErrors);
40420
40642
  const [multiProcessOnLinux, setChromiumMultiProcessOnLinux] = useState79(() => initialMultiProcessOnLinux);
40643
+ const [darkMode, setDarkMode] = useState79(() => initialDarkMode);
40421
40644
  const [openGlOption, setOpenGlOption] = useState79(() => initialGl ?? "default");
40422
40645
  const [colorSpace, setColorSpace] = useState79(() => initialColorSpace);
40423
40646
  const [userAgent, setUserAgent] = useState79(() => initialUserAgent === null ? null : initialUserAgent.trim() === "" ? null : initialUserAgent);
@@ -40428,7 +40651,8 @@ var RenderModal = ({
40428
40651
  ignoreCertificateErrors,
40429
40652
  gl: openGlOption === "default" ? null : openGlOption,
40430
40653
  userAgent: userAgent === null ? null : userAgent.trim() === "" ? null : userAgent,
40431
- enableMultiProcessOnLinux: multiProcessOnLinux
40654
+ enableMultiProcessOnLinux: multiProcessOnLinux,
40655
+ darkMode
40432
40656
  };
40433
40657
  }, [
40434
40658
  headless,
@@ -40436,7 +40660,8 @@ var RenderModal = ({
40436
40660
  ignoreCertificateErrors,
40437
40661
  openGlOption,
40438
40662
  userAgent,
40439
- multiProcessOnLinux
40663
+ multiProcessOnLinux,
40664
+ darkMode
40440
40665
  ]);
40441
40666
  const [outName, setOutName] = useState79(() => initialOutName);
40442
40667
  const [endFrameOrNull, setEndFrame] = useState79(() => outFrameMark ?? null);
@@ -41305,7 +41530,9 @@ var RenderModal = ({
41305
41530
  hardwareAcceleration,
41306
41531
  setHardwareAcceleration,
41307
41532
  chromeModeOption: chromeMode,
41308
- setChromeModeOption: setChromeMode
41533
+ setChromeModeOption: setChromeMode,
41534
+ darkMode,
41535
+ setDarkMode
41309
41536
  })
41310
41537
  })
41311
41538
  ]
@@ -41457,26 +41684,22 @@ var writeBits = (bytes, start, end, value) => {
41457
41684
  var toUint8Array2 = (source) => {
41458
41685
  if (source.constructor === Uint8Array) {
41459
41686
  return source;
41460
- } else if (source instanceof ArrayBuffer) {
41461
- return new Uint8Array(source);
41462
- } else {
41687
+ } else if (ArrayBuffer.isView(source)) {
41463
41688
  return new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
41689
+ } else {
41690
+ return new Uint8Array(source);
41464
41691
  }
41465
41692
  };
41466
41693
  var toDataView2 = (source) => {
41467
41694
  if (source.constructor === DataView) {
41468
41695
  return source;
41469
- } else if (source instanceof ArrayBuffer) {
41470
- return new DataView(source);
41471
- } else {
41696
+ } else if (ArrayBuffer.isView(source)) {
41472
41697
  return new DataView(source.buffer, source.byteOffset, source.byteLength);
41698
+ } else {
41699
+ return new DataView(source);
41473
41700
  }
41474
41701
  };
41475
- var textDecoder2 = new TextDecoder;
41476
- var textEncoder2 = new TextEncoder;
41477
- var invertObject2 = (object) => {
41478
- return Object.fromEntries(Object.entries(object).map(([key5, value]) => [value, key5]));
41479
- };
41702
+ var textEncoder2 = /* @__PURE__ */ new TextEncoder;
41480
41703
  var COLOR_PRIMARIES_MAP2 = {
41481
41704
  bt709: 1,
41482
41705
  bt470bg: 5,
@@ -41484,7 +41707,6 @@ var COLOR_PRIMARIES_MAP2 = {
41484
41707
  bt2020: 9,
41485
41708
  smpte432: 12
41486
41709
  };
41487
- var COLOR_PRIMARIES_MAP_INVERSE2 = invertObject2(COLOR_PRIMARIES_MAP2);
41488
41710
  var TRANSFER_CHARACTERISTICS_MAP2 = {
41489
41711
  bt709: 1,
41490
41712
  smpte170m: 6,
@@ -41493,7 +41715,6 @@ var TRANSFER_CHARACTERISTICS_MAP2 = {
41493
41715
  pq: 16,
41494
41716
  hlg: 18
41495
41717
  };
41496
- var TRANSFER_CHARACTERISTICS_MAP_INVERSE2 = invertObject2(TRANSFER_CHARACTERISTICS_MAP2);
41497
41718
  var MATRIX_COEFFICIENTS_MAP2 = {
41498
41719
  rgb: 0,
41499
41720
  bt709: 1,
@@ -41501,7 +41722,6 @@ var MATRIX_COEFFICIENTS_MAP2 = {
41501
41722
  smpte170m: 6,
41502
41723
  "bt2020-ncl": 9
41503
41724
  };
41504
- var MATRIX_COEFFICIENTS_MAP_INVERSE2 = invertObject2(MATRIX_COEFFICIENTS_MAP2);
41505
41725
  var colorSpaceIsComplete = (colorSpace) => {
41506
41726
  return !!colorSpace && !!colorSpace.primaries && !!colorSpace.transfer && !!colorSpace.matrix && colorSpace.fullRange !== undefined;
41507
41727
  };
@@ -41754,6 +41974,29 @@ var validateMetadataTags = (tags) => {
41754
41974
  }
41755
41975
  }
41756
41976
  };
41977
+ var validateTrackDisposition = (disposition) => {
41978
+ if (!disposition || typeof disposition !== "object") {
41979
+ throw new TypeError("disposition must be an object.");
41980
+ }
41981
+ if (disposition.default !== undefined && typeof disposition.default !== "boolean") {
41982
+ throw new TypeError("disposition.default must be a boolean.");
41983
+ }
41984
+ if (disposition.forced !== undefined && typeof disposition.forced !== "boolean") {
41985
+ throw new TypeError("disposition.forced must be a boolean.");
41986
+ }
41987
+ if (disposition.original !== undefined && typeof disposition.original !== "boolean") {
41988
+ throw new TypeError("disposition.original must be a boolean.");
41989
+ }
41990
+ if (disposition.commentary !== undefined && typeof disposition.commentary !== "boolean") {
41991
+ throw new TypeError("disposition.commentary must be a boolean.");
41992
+ }
41993
+ if (disposition.hearingImpaired !== undefined && typeof disposition.hearingImpaired !== "boolean") {
41994
+ throw new TypeError("disposition.hearingImpaired must be a boolean.");
41995
+ }
41996
+ if (disposition.visuallyImpaired !== undefined && typeof disposition.visuallyImpaired !== "boolean") {
41997
+ throw new TypeError("disposition.visuallyImpaired must be a boolean.");
41998
+ }
41999
+ };
41757
42000
  /*!
41758
42001
  * Copyright (c) 2025-present, Vanilagy and contributors
41759
42002
  *
@@ -42219,27 +42462,27 @@ class Muxer {
42219
42462
  this.output = output;
42220
42463
  }
42221
42464
  onTrackClose(track) {}
42222
- validateAndNormalizeTimestamp(track, timestampInSeconds, isKeyFrame) {
42465
+ validateAndNormalizeTimestamp(track, timestampInSeconds, isKeyPacket) {
42223
42466
  timestampInSeconds += track.source._timestampOffset;
42224
42467
  let timestampInfo = this.trackTimestampInfo.get(track);
42225
42468
  if (!timestampInfo) {
42226
- if (!isKeyFrame) {
42227
- throw new Error("First frame must be a key frame.");
42469
+ if (!isKeyPacket) {
42470
+ throw new Error("First packet must be a key packet.");
42228
42471
  }
42229
42472
  timestampInfo = {
42230
42473
  maxTimestamp: timestampInSeconds,
42231
- maxTimestampBeforeLastKeyFrame: timestampInSeconds
42474
+ maxTimestampBeforeLastKeyPacket: timestampInSeconds
42232
42475
  };
42233
42476
  this.trackTimestampInfo.set(track, timestampInfo);
42234
42477
  }
42235
42478
  if (timestampInSeconds < 0) {
42236
42479
  throw new Error(`Timestamps must be non-negative (got ${timestampInSeconds}s).`);
42237
42480
  }
42238
- if (isKeyFrame) {
42239
- timestampInfo.maxTimestampBeforeLastKeyFrame = timestampInfo.maxTimestamp;
42481
+ if (isKeyPacket) {
42482
+ timestampInfo.maxTimestampBeforeLastKeyPacket = timestampInfo.maxTimestamp;
42240
42483
  }
42241
- if (timestampInSeconds < timestampInfo.maxTimestampBeforeLastKeyFrame) {
42242
- 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.`);
42484
+ if (timestampInSeconds < timestampInfo.maxTimestampBeforeLastKeyPacket) {
42485
+ 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.`);
42243
42486
  }
42244
42487
  timestampInfo.maxTimestamp = Math.max(timestampInfo.maxTimestamp, timestampInSeconds);
42245
42488
  return timestampInSeconds;
@@ -42359,44 +42602,22 @@ var extractAvcDecoderConfigurationRecord2 = (packetData) => {
42359
42602
  return null;
42360
42603
  }
42361
42604
  const spsData = spsUnits[0];
42362
- const bitstream = new Bitstream2(removeEmulationPreventionBytes2(spsData));
42363
- bitstream.skipBits(1);
42364
- bitstream.skipBits(2);
42365
- const nal_unit_type = bitstream.readBits(5);
42366
- if (nal_unit_type !== 7) {
42367
- console.error("Invalid SPS NAL unit type");
42368
- return null;
42369
- }
42370
- const profile_idc = bitstream.readAlignedByte();
42371
- const constraint_flags = bitstream.readAlignedByte();
42372
- const level_idc = bitstream.readAlignedByte();
42373
- const record = {
42605
+ const spsInfo = parseAvcSps2(spsData);
42606
+ assert2(spsInfo !== null);
42607
+ const hasExtendedData = spsInfo.profileIdc === 100 || spsInfo.profileIdc === 110 || spsInfo.profileIdc === 122 || spsInfo.profileIdc === 144;
42608
+ return {
42374
42609
  configurationVersion: 1,
42375
- avcProfileIndication: profile_idc,
42376
- profileCompatibility: constraint_flags,
42377
- avcLevelIndication: level_idc,
42610
+ avcProfileIndication: spsInfo.profileIdc,
42611
+ profileCompatibility: spsInfo.constraintFlags,
42612
+ avcLevelIndication: spsInfo.levelIdc,
42378
42613
  lengthSizeMinusOne: 3,
42379
42614
  sequenceParameterSets: spsUnits,
42380
42615
  pictureParameterSets: ppsUnits,
42381
- chromaFormat: null,
42382
- bitDepthLumaMinus8: null,
42383
- bitDepthChromaMinus8: null,
42384
- sequenceParameterSetExt: null
42616
+ chromaFormat: hasExtendedData ? spsInfo.chromaFormatIdc : null,
42617
+ bitDepthLumaMinus8: hasExtendedData ? spsInfo.bitDepthLumaMinus8 : null,
42618
+ bitDepthChromaMinus8: hasExtendedData ? spsInfo.bitDepthChromaMinus8 : null,
42619
+ sequenceParameterSetExt: hasExtendedData ? spsExtUnits : null
42385
42620
  };
42386
- if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 || profile_idc === 144) {
42387
- readExpGolomb2(bitstream);
42388
- const chroma_format_idc = readExpGolomb2(bitstream);
42389
- if (chroma_format_idc === 3) {
42390
- bitstream.skipBits(1);
42391
- }
42392
- const bit_depth_luma_minus8 = readExpGolomb2(bitstream);
42393
- const bit_depth_chroma_minus8 = readExpGolomb2(bitstream);
42394
- record.chromaFormat = chroma_format_idc;
42395
- record.bitDepthLumaMinus8 = bit_depth_luma_minus8;
42396
- record.bitDepthChromaMinus8 = bit_depth_chroma_minus8;
42397
- record.sequenceParameterSetExt = spsExtUnits;
42398
- }
42399
- return record;
42400
42621
  } catch (error) {
42401
42622
  console.error("Error building AVC Decoder Configuration Record:", error);
42402
42623
  return null;
@@ -42447,6 +42668,81 @@ var serializeAvcDecoderConfigurationRecord = (record) => {
42447
42668
  }
42448
42669
  return new Uint8Array(bytes);
42449
42670
  };
42671
+ var parseAvcSps2 = (sps) => {
42672
+ try {
42673
+ const bitstream = new Bitstream2(removeEmulationPreventionBytes2(sps));
42674
+ bitstream.skipBits(1);
42675
+ bitstream.skipBits(2);
42676
+ const nalUnitType = bitstream.readBits(5);
42677
+ if (nalUnitType !== 7) {
42678
+ return null;
42679
+ }
42680
+ const profileIdc = bitstream.readAlignedByte();
42681
+ const constraintFlags = bitstream.readAlignedByte();
42682
+ const levelIdc = bitstream.readAlignedByte();
42683
+ readExpGolomb2(bitstream);
42684
+ let chromaFormatIdc = null;
42685
+ let bitDepthLumaMinus8 = null;
42686
+ let bitDepthChromaMinus8 = null;
42687
+ if (profileIdc === 100 || profileIdc === 110 || profileIdc === 122 || profileIdc === 244 || profileIdc === 44 || profileIdc === 83 || profileIdc === 86 || profileIdc === 118 || profileIdc === 128) {
42688
+ chromaFormatIdc = readExpGolomb2(bitstream);
42689
+ if (chromaFormatIdc === 3) {
42690
+ bitstream.skipBits(1);
42691
+ }
42692
+ bitDepthLumaMinus8 = readExpGolomb2(bitstream);
42693
+ bitDepthChromaMinus8 = readExpGolomb2(bitstream);
42694
+ bitstream.skipBits(1);
42695
+ const seqScalingMatrixPresentFlag = bitstream.readBits(1);
42696
+ if (seqScalingMatrixPresentFlag) {
42697
+ for (let i = 0;i < (chromaFormatIdc !== 3 ? 8 : 12); i++) {
42698
+ const seqScalingListPresentFlag = bitstream.readBits(1);
42699
+ if (seqScalingListPresentFlag) {
42700
+ const sizeOfScalingList = i < 6 ? 16 : 64;
42701
+ let lastScale = 8;
42702
+ let nextScale = 8;
42703
+ for (let j = 0;j < sizeOfScalingList; j++) {
42704
+ if (nextScale !== 0) {
42705
+ const deltaScale = readSignedExpGolomb2(bitstream);
42706
+ nextScale = (lastScale + deltaScale + 256) % 256;
42707
+ }
42708
+ lastScale = nextScale === 0 ? lastScale : nextScale;
42709
+ }
42710
+ }
42711
+ }
42712
+ }
42713
+ }
42714
+ readExpGolomb2(bitstream);
42715
+ const picOrderCntType = readExpGolomb2(bitstream);
42716
+ if (picOrderCntType === 0) {
42717
+ readExpGolomb2(bitstream);
42718
+ } else if (picOrderCntType === 1) {
42719
+ bitstream.skipBits(1);
42720
+ readSignedExpGolomb2(bitstream);
42721
+ readSignedExpGolomb2(bitstream);
42722
+ const numRefFramesInPicOrderCntCycle = readExpGolomb2(bitstream);
42723
+ for (let i = 0;i < numRefFramesInPicOrderCntCycle; i++) {
42724
+ readSignedExpGolomb2(bitstream);
42725
+ }
42726
+ }
42727
+ readExpGolomb2(bitstream);
42728
+ bitstream.skipBits(1);
42729
+ readExpGolomb2(bitstream);
42730
+ readExpGolomb2(bitstream);
42731
+ const frameMbsOnlyFlag = bitstream.readBits(1);
42732
+ return {
42733
+ profileIdc,
42734
+ constraintFlags,
42735
+ levelIdc,
42736
+ frameMbsOnlyFlag,
42737
+ chromaFormatIdc,
42738
+ bitDepthLumaMinus8,
42739
+ bitDepthChromaMinus8
42740
+ };
42741
+ } catch (error) {
42742
+ console.error("Error parsing AVC SPS:", error);
42743
+ return null;
42744
+ }
42745
+ };
42450
42746
  var extractNalUnitTypeForHevc2 = (data) => {
42451
42747
  return data[0] >> 1 & 63;
42452
42748
  };
@@ -42910,7 +43206,7 @@ var customVideoEncoders = [];
42910
43206
  * License, v. 2.0. If a copy of the MPL was not distributed with this
42911
43207
  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
42912
43208
  */
42913
- var PLACEHOLDER_DATA2 = new Uint8Array(0);
43209
+ var PLACEHOLDER_DATA2 = /* @__PURE__ */ new Uint8Array(0);
42914
43210
 
42915
43211
  class EncodedPacket2 {
42916
43212
  constructor(data, type, timestamp, duration, sequenceNumber = -1, byteLength, sideData) {
@@ -43385,12 +43681,14 @@ class VideoSample2 {
43385
43681
  dx = (canvasWidth - newWidth) / 2;
43386
43682
  dy = (canvasHeight - newHeight) / 2;
43387
43683
  }
43684
+ context.save();
43388
43685
  const aspectRatioChange = rotation % 180 === 0 ? 1 : newWidth / newHeight;
43389
43686
  context.translate(canvasWidth / 2, canvasHeight / 2);
43390
43687
  context.rotate(rotation * Math.PI / 180);
43391
43688
  context.scale(1 / aspectRatioChange, aspectRatioChange);
43392
43689
  context.translate(-canvasWidth / 2, -canvasHeight / 2);
43393
43690
  context.drawImage(this.toCanvasImageSource(), sx, sy, sWidth, sHeight, dx, dy, newWidth, newHeight);
43691
+ context.restore();
43394
43692
  }
43395
43693
  _rotateSourceRegion(sx, sy, sWidth, sHeight, rotation) {
43396
43694
  if (rotation === 90) {
@@ -43564,6 +43862,10 @@ var EBMLId2;
43564
43862
  EBMLId22[EBMLId22["FlagEnabled"] = 185] = "FlagEnabled";
43565
43863
  EBMLId22[EBMLId22["FlagDefault"] = 136] = "FlagDefault";
43566
43864
  EBMLId22[EBMLId22["FlagForced"] = 21930] = "FlagForced";
43865
+ EBMLId22[EBMLId22["FlagOriginal"] = 21934] = "FlagOriginal";
43866
+ EBMLId22[EBMLId22["FlagHearingImpaired"] = 21931] = "FlagHearingImpaired";
43867
+ EBMLId22[EBMLId22["FlagVisualImpaired"] = 21932] = "FlagVisualImpaired";
43868
+ EBMLId22[EBMLId22["FlagCommentary"] = 21935] = "FlagCommentary";
43567
43869
  EBMLId22[EBMLId22["FlagLacing"] = 156] = "FlagLacing";
43568
43870
  EBMLId22[EBMLId22["Name"] = 21358] = "Name";
43569
43871
  EBMLId22[EBMLId22["Language"] = 2274716] = "Language";
@@ -44036,8 +44338,8 @@ class IsobmffBoxWriter {
44036
44338
  }
44037
44339
  }
44038
44340
  }
44039
- var bytes = new Uint8Array(8);
44040
- var view = new DataView(bytes.buffer);
44341
+ var bytes = /* @__PURE__ */ new Uint8Array(8);
44342
+ var view = /* @__PURE__ */ new DataView(bytes.buffer);
44041
44343
  var u8 = (value) => {
44042
44344
  return [(value % 256 + 256) % 256];
44043
44345
  };
@@ -44125,7 +44427,7 @@ var rotationMatrix = (rotationInDegrees) => {
44125
44427
  1
44126
44428
  ];
44127
44429
  };
44128
- var IDENTITY_MATRIX = rotationMatrix(0);
44430
+ var IDENTITY_MATRIX = /* @__PURE__ */ rotationMatrix(0);
44129
44431
  var matrixToBytes = (matrix) => {
44130
44432
  return [
44131
44433
  fixed_16_16(matrix[0]),
@@ -44224,7 +44526,11 @@ var tkhd = (trackData, creationTime) => {
44224
44526
  } else {
44225
44527
  matrix = IDENTITY_MATRIX;
44226
44528
  }
44227
- return fullBox("tkhd", +needsU64, 3, [
44529
+ let flags = 2;
44530
+ if (trackData.track.metadata.disposition?.default !== false) {
44531
+ flags |= 1;
44532
+ }
44533
+ return fullBox("tkhd", +needsU64, flags, [
44228
44534
  u32OrU64(creationTime),
44229
44535
  u32OrU64(creationTime),
44230
44536
  u32(trackData.track.id),
@@ -44323,7 +44629,7 @@ var stbl = (trackData) => {
44323
44629
  var stsd = (trackData) => {
44324
44630
  let sampleDescription;
44325
44631
  if (trackData.type === "video") {
44326
- sampleDescription = videoSampleDescription(VIDEO_CODEC_TO_BOX_NAME[trackData.track.source._codec], trackData);
44632
+ sampleDescription = videoSampleDescription(videoCodecToBoxName(trackData.track.source._codec, trackData.info.decoderConfig.codec), trackData);
44327
44633
  } else if (trackData.type === "audio") {
44328
44634
  const boxName = audioCodecToBoxName(trackData.track.source._codec, trackData.muxer.isQuickTime);
44329
44635
  assert2(boxName);
@@ -45111,12 +45417,19 @@ var dataStringBoxLong = (value) => {
45111
45417
  ...textEncoder2.encode(value)
45112
45418
  ]);
45113
45419
  };
45114
- var VIDEO_CODEC_TO_BOX_NAME = {
45115
- avc: "avc1",
45116
- hevc: "hvc1",
45117
- vp8: "vp08",
45118
- vp9: "vp09",
45119
- av1: "av01"
45420
+ var videoCodecToBoxName = (codec, fullCodecString) => {
45421
+ switch (codec) {
45422
+ case "avc":
45423
+ return fullCodecString.startsWith("avc3") ? "avc3" : "avc1";
45424
+ case "hevc":
45425
+ return "hvc1";
45426
+ case "vp8":
45427
+ return "vp08";
45428
+ case "vp9":
45429
+ return "vp09";
45430
+ case "av1":
45431
+ return "av01";
45432
+ }
45120
45433
  };
45121
45434
  var VIDEO_CODEC_TO_CONFIGURATION_BOX = {
45122
45435
  avc: avcC,
@@ -46396,6 +46709,12 @@ class MatroskaMuxer extends Muxer {
46396
46709
  { id: EBMLId2.TrackNumber, data: trackData.track.id },
46397
46710
  { id: EBMLId2.TrackUID, data: trackData.track.id },
46398
46711
  { id: EBMLId2.TrackType, data: TRACK_TYPE_MAP[trackData.type] },
46712
+ trackData.track.metadata.disposition?.default === false ? { id: EBMLId2.FlagDefault, data: 0 } : null,
46713
+ trackData.track.metadata.disposition?.forced ? { id: EBMLId2.FlagForced, data: 1 } : null,
46714
+ trackData.track.metadata.disposition?.hearingImpaired ? { id: EBMLId2.FlagHearingImpaired, data: 1 } : null,
46715
+ trackData.track.metadata.disposition?.visuallyImpaired ? { id: EBMLId2.FlagVisualImpaired, data: 1 } : null,
46716
+ trackData.track.metadata.disposition?.original ? { id: EBMLId2.FlagOriginal, data: 1 } : null,
46717
+ trackData.track.metadata.disposition?.commentary ? { id: EBMLId2.FlagCommentary, data: 1 } : null,
46399
46718
  { id: EBMLId2.FlagLacing, data: 0 },
46400
46719
  { id: EBMLId2.Language, data: trackData.track.metadata.languageCode ?? UNDETERMINED_LANGUAGE2 },
46401
46720
  { id: EBMLId2.CodecID, data: codecId },
@@ -47476,11 +47795,11 @@ class Quality {
47476
47795
  return Math.round(finalBitrate / 1000) * 1000;
47477
47796
  }
47478
47797
  }
47479
- var QUALITY_VERY_LOW = new Quality(0.3);
47480
- var QUALITY_LOW = new Quality(0.6);
47481
- var QUALITY_MEDIUM = new Quality(1);
47482
- var QUALITY_HIGH = new Quality(2);
47483
- var QUALITY_VERY_HIGH = new Quality(4);
47798
+ var QUALITY_VERY_LOW = /* @__PURE__ */ new Quality(0.3);
47799
+ var QUALITY_LOW = /* @__PURE__ */ new Quality(0.6);
47800
+ var QUALITY_MEDIUM = /* @__PURE__ */ new Quality(1);
47801
+ var QUALITY_HIGH = /* @__PURE__ */ new Quality(2);
47802
+ var QUALITY_VERY_HIGH = /* @__PURE__ */ new Quality(4);
47484
47803
  /*!
47485
47804
  * Copyright (c) 2025-present, Vanilagy and contributors
47486
47805
  *
@@ -48141,6 +48460,9 @@ var validateBaseTrackMetadata = (metadata) => {
48141
48460
  if (metadata.name !== undefined && typeof metadata.name !== "string") {
48142
48461
  throw new TypeError("metadata.name, when provided, must be a string.");
48143
48462
  }
48463
+ if (metadata.disposition !== undefined) {
48464
+ validateTrackDisposition(metadata.disposition);
48465
+ }
48144
48466
  if (metadata.maximumPacketCount !== undefined && (!Number.isInteger(metadata.maximumPacketCount) || metadata.maximumPacketCount < 0)) {
48145
48467
  throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.");
48146
48468
  }
@@ -50518,6 +50840,7 @@ var Modals = ({ readOnlyStudio }) => {
50518
50840
  }),
50519
50841
  modalContextType && canRender && modalContextType.type === "server-render" && /* @__PURE__ */ jsx268(RenderModalWithLoader, {
50520
50842
  initialFrame: modalContextType.initialFrame,
50843
+ initialDarkMode: modalContextType.initialDarkMode,
50521
50844
  compositionId: modalContextType.compositionId,
50522
50845
  initialVideoImageFormat: modalContextType.initialVideoImageFormat,
50523
50846
  initialJpegQuality: modalContextType.initialJpegQuality,