hyperframes 0.8.80 → 0.8.81

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.
@@ -63231,6 +63231,16 @@ var init_evenDimensions = __esm({
63231
63231
  }
63232
63232
  });
63233
63233
 
63234
+ // ../engine/src/utils/sdrCaptureColor.ts
63235
+ var SDR_RGB_TO_BT709_FILTER, SDR_CAPTURE_TO_BT709_FILTER;
63236
+ var init_sdrCaptureColor = __esm({
63237
+ "../engine/src/utils/sdrCaptureColor.ts"() {
63238
+ "use strict";
63239
+ SDR_RGB_TO_BT709_FILTER = "scale=out_color_matrix=bt709:out_range=tv:flags=neighbor";
63240
+ SDR_CAPTURE_TO_BT709_FILTER = `scale=in_color_matrix=bt601:in_range=pc:flags=neighbor,format=gbrp,${SDR_RGB_TO_BT709_FILTER}`;
63241
+ }
63242
+ });
63243
+
63234
63244
  // ../engine/src/utils/runFfmpeg.ts
63235
63245
  import { spawn as spawn2 } from "child_process";
63236
63246
  function isExternalFfmpegInterruption(result) {
@@ -63267,21 +63277,20 @@ ${tail}` : windowsMessage;
63267
63277
  ffmpeg stderr (tail):
63268
63278
  ${tail}` : `FFmpeg exited with code ${exitCode}`;
63269
63279
  }
63270
- async function runFfmpeg(args, opts) {
63271
- const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
63280
+ function spawnFfmpeg(args) {
63272
63281
  const ffmpeg = spawn2(getFfmpegBinary(), args, { windowsHide: true });
63273
63282
  trackChildProcess(ffmpeg);
63274
- const managed = new ManagedChildProcess(ffmpeg, {
63275
- signal: opts?.signal,
63276
- deadlineAtMs: Date.now() + timeout,
63277
- onStderr: opts?.onStderr
63278
- });
63279
- const outcome = await managed.wait();
63283
+ return ffmpeg;
63284
+ }
63285
+ function succeeded(outcome) {
63286
+ return outcome.reason === "exit" && outcome.exitCode === 0;
63287
+ }
63288
+ function toResult(outcome, stderr = outcome.stderr) {
63280
63289
  const result = {
63281
- success: outcome.reason === "exit" && outcome.exitCode === 0,
63290
+ success: succeeded(outcome),
63282
63291
  exitCode: outcome.exitCode,
63283
63292
  signal: outcome.signal,
63284
- stderr: outcome.stderr,
63293
+ stderr,
63285
63294
  durationMs: outcome.durationMs,
63286
63295
  terminationReason: outcome.reason,
63287
63296
  error: outcome.error
@@ -63291,6 +63300,43 @@ async function runFfmpeg(args, opts) {
63291
63300
  }
63292
63301
  return result;
63293
63302
  }
63303
+ async function runFfmpeg(args, opts) {
63304
+ const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
63305
+ const managed = new ManagedChildProcess(spawnFfmpeg(args), {
63306
+ signal: opts?.signal,
63307
+ deadlineAtMs: Date.now() + timeout,
63308
+ onStderr: opts?.onStderr
63309
+ });
63310
+ return toResult(await managed.wait());
63311
+ }
63312
+ async function runFfmpegPipeline(producerArgs, consumerArgs, opts) {
63313
+ const deadlineAtMs = Date.now() + (opts?.timeout ?? DEFAULT_TIMEOUT);
63314
+ const producer = spawnFfmpeg(producerArgs);
63315
+ const consumer = spawnFfmpeg(consumerArgs);
63316
+ consumer.stdin?.on("error", () => {
63317
+ });
63318
+ for (const event of ["close", "error"]) {
63319
+ consumer.once(event, () => producer.stdout?.destroy());
63320
+ producer.once(event, () => consumer.stdin?.end());
63321
+ }
63322
+ if (consumer.stdin) producer.stdout?.pipe(consumer.stdin);
63323
+ const settleOrder = [];
63324
+ const outcomes = await Promise.all(
63325
+ [producer, consumer].map(
63326
+ (child) => new ManagedChildProcess(child, {
63327
+ signal: opts?.signal,
63328
+ deadlineAtMs,
63329
+ onStderr: opts?.onStderr
63330
+ }).wait().then((outcome) => {
63331
+ settleOrder.push(outcome);
63332
+ return outcome;
63333
+ })
63334
+ )
63335
+ );
63336
+ const reported = settleOrder.find((outcome) => !succeeded(outcome)) ?? outcomes[1];
63337
+ const stderr = [...outcomes.filter((outcome) => outcome !== reported), reported].map((outcome) => outcome.stderr).join("");
63338
+ return toResult(reported, stderr);
63339
+ }
63294
63340
  var FFMPEG_SIGTERM_EXIT_LINE, DEFAULT_TIMEOUT, DEFAULT_STDERR_TAIL_LINES;
63295
63341
  var init_runFfmpeg = __esm({
63296
63342
  "../engine/src/utils/runFfmpeg.ts"() {
@@ -63696,6 +63742,8 @@ async function extractMediaMetadata(filePath) {
63696
63742
  isVFR,
63697
63743
  hasAlpha,
63698
63744
  colorSpace,
63745
+ colorRange: videoStream.color_range,
63746
+ pixelFormat,
63699
63747
  frames
63700
63748
  };
63701
63749
  })();
@@ -64239,23 +64287,20 @@ function buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder = null) {
64239
64287
  "tv"
64240
64288
  );
64241
64289
  }
64290
+ const sdrFilter = options.hdr ? void 0 : SDR_CAPTURE_TO_BT709_FILTER;
64291
+ const captureFilter = sdrFilter ?? "scale=in_range=pc:out_range=tv";
64242
64292
  if (gpuEncoder === "vaapi") {
64243
64293
  const vfIdx = args.indexOf("-vf");
64244
64294
  if (vfIdx !== -1) {
64245
- args[vfIdx + 1] = `scale=in_range=pc:out_range=tv,${args[vfIdx + 1]}`;
64295
+ args[vfIdx + 1] = `${captureFilter},${args[vfIdx + 1]}`;
64246
64296
  }
64247
64297
  } else if (shouldUseGpu) {
64248
- const vf = withEvenDimensionPad("", pixelFormat, options.width, options.height);
64298
+ const vf = withEvenDimensionPad(sdrFilter ?? "", pixelFormat, options.width, options.height);
64249
64299
  if (vf) args.push("-vf", vf);
64250
64300
  } else {
64251
64301
  args.push(
64252
64302
  "-vf",
64253
- withEvenDimensionPad(
64254
- "scale=in_range=pc:out_range=tv",
64255
- pixelFormat,
64256
- options.width,
64257
- options.height
64258
- )
64303
+ withEvenDimensionPad(captureFilter, pixelFormat, options.width, options.height)
64259
64304
  );
64260
64305
  }
64261
64306
  args.push("-video_track_timescale", "90000");
@@ -64625,6 +64670,7 @@ var init_chunkEncoder = __esm({
64625
64670
  init_gpuEncoder();
64626
64671
  init_hdr();
64627
64672
  init_evenDimensions();
64673
+ init_sdrCaptureColor();
64628
64674
  init_runFfmpeg();
64629
64675
  init_ffprobe();
64630
64676
  init_dist2();
@@ -64917,25 +64963,15 @@ function buildStreamingArgs(options, outputPath, gpuEncoder = null) {
64917
64963
  "tv"
64918
64964
  );
64919
64965
  }
64920
- if (options.rawInputFormat) {
64966
+ const sdrFilter = options.rawInputFormat ? SDR_RGB_TO_BT709_FILTER : SDR_CAPTURE_TO_BT709_FILTER;
64967
+ if (options.rawInputFormat && options.hdr) {
64921
64968
  } else if (gpuEncoder === "vaapi") {
64922
64969
  const vfIdx = args.indexOf("-vf");
64923
64970
  if (vfIdx !== -1) {
64924
- args[vfIdx + 1] = `scale=in_range=pc:out_range=tv,${args[vfIdx + 1]}`;
64971
+ args[vfIdx + 1] = `${sdrFilter},${args[vfIdx + 1]}`;
64925
64972
  }
64926
- } else if (shouldUseGpu) {
64927
- const vf = withEvenDimensionPad("", pixelFormat, options.width, options.height);
64928
- if (vf) args.push("-vf", vf);
64929
64973
  } else {
64930
- args.push(
64931
- "-vf",
64932
- withEvenDimensionPad(
64933
- "scale=in_range=pc:out_range=tv",
64934
- pixelFormat,
64935
- options.width,
64936
- options.height
64937
- )
64938
- );
64974
+ args.push("-vf", withEvenDimensionPad(sdrFilter, pixelFormat, options.width, options.height));
64939
64975
  }
64940
64976
  args.push("-video_track_timescale", "90000");
64941
64977
  }
@@ -65100,6 +65136,7 @@ var init_streamingEncoder = __esm({
65100
65136
  init_ffmpegBinaries();
65101
65137
  init_hdr();
65102
65138
  init_evenDimensions();
65139
+ init_sdrCaptureColor();
65103
65140
  init_config();
65104
65141
  init_dist2();
65105
65142
  init_vp9Options();
@@ -79783,7 +79820,7 @@ var init_extractionCache = __esm({
79783
79820
  init_extractedFrameIndex();
79784
79821
  COMPLETE_SENTINEL = ".hf-complete";
79785
79822
  GC_MARKER = ".hf-last-gc";
79786
- SCHEMA_PREFIX = "hfcache-v4-";
79823
+ SCHEMA_PREFIX = "hfcache-v5-";
79787
79824
  KEY_HEX_CHARS = 16;
79788
79825
  CACHE_GENERATION_PREFIX = "hfcache-v";
79789
79826
  }
@@ -80131,6 +80168,21 @@ function parseImageElements(html) {
80131
80168
  }
80132
80169
  return images;
80133
80170
  }
80171
+ function chromeGuessForUntaggedMatrix(metadata) {
80172
+ const matrix = metadata.colorSpace?.colorSpace;
80173
+ if (matrix && matrix !== "unknown") return [];
80174
+ const hd = metadata.height >= 720 && !CHROME_BT601_UNTAGGED_CODECS.has(metadata.videoCodec);
80175
+ return [`setparams=colorspace=${hd ? "bt709" : "smpte170m"}`];
80176
+ }
80177
+ function restoreSourceColourFilter(metadata) {
80178
+ const tags = [
80179
+ ["range", metadata.colorRange],
80180
+ ["colorspace", metadata.colorSpace?.colorSpace],
80181
+ ["color_primaries", metadata.colorSpace?.colorPrimaries],
80182
+ ["color_trc", metadata.colorSpace?.colorTransfer]
80183
+ ].filter(([, value]) => value && value !== "unknown" && value !== "reserved");
80184
+ return tags.length > 0 ? [`setparams=${tags.map(([key2, value]) => `${key2}=${value}`).join(":")}`] : [];
80185
+ }
80134
80186
  async function extractVideoFramesRange(videoPath, videoId, startTime, duration, options, signal, config, outputDirOverride) {
80135
80187
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
80136
80188
  const { outputDir, quality = 95 } = options;
@@ -80192,14 +80244,37 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
80192
80244
  if (options.toneMapHdrToSdr && isHdr && !isMacOS) {
80193
80245
  vfFilters.push(HDR_TO_SDR_TONEMAP_FILTER);
80194
80246
  }
80195
- if (vfFilters.length > 0) args.push("-vf", vfFilters.join(","));
80196
- if (!options.finalFrameOnly && metadata.isVFR) {
80197
- args.push("-fps_mode", "cfr", "-r", ffmpegFps);
80247
+ if (!isHdr && !options.sdrToHdrTransfer) {
80248
+ vfFilters.push(...chromeGuessForUntaggedMatrix(metadata), SDR_CANVAS_PASSTHROUGH_FILTER);
80249
+ if (format === "jpg") vfFilters.push(SDR_JPEG_AS_BT601_FULL_RANGE_FILTER);
80250
+ }
80251
+ const encodeArgs = ["-q:v", format === "jpg" ? String(Math.ceil((100 - quality) / 3)) : "0"];
80252
+ if (format === "png") encodeArgs.push("-compression_level", "1");
80253
+ encodeArgs.push("-y", outputPattern);
80254
+ const runOptions = { signal, timeout: ffmpegProcessTimeout };
80255
+ const resampleVfrToCfr = !options.finalFrameOnly && metadata.isVFR;
80256
+ if (resampleVfrToCfr) args.push("-fps_mode", "cfr", "-r", ffmpegFps);
80257
+ let processResult;
80258
+ if (resampleVfrToCfr && vfFilters.length > 0 && !isHdr && NUT_RAW_PIXEL_FORMATS.has(metadata.pixelFormat ?? "")) {
80259
+ processResult = await runFfmpegPipeline(
80260
+ [...args, "-an", "-sn", "-dn", "-c:v", "rawvideo", "-f", "nut", "pipe:1"],
80261
+ [
80262
+ "-f",
80263
+ "nut",
80264
+ "-i",
80265
+ "pipe:0",
80266
+ "-vf",
80267
+ [...restoreSourceColourFilter(metadata), ...vfFilters].join(","),
80268
+ "-fps_mode",
80269
+ "passthrough",
80270
+ ...encodeArgs
80271
+ ],
80272
+ runOptions
80273
+ );
80274
+ } else {
80275
+ if (vfFilters.length > 0) args.push("-vf", vfFilters.join(","));
80276
+ processResult = await runFfmpeg([...args, ...encodeArgs], runOptions);
80198
80277
  }
80199
- args.push("-q:v", format === "jpg" ? String(Math.ceil((100 - quality) / 3)) : "0");
80200
- if (format === "png") args.push("-compression_level", "1");
80201
- args.push("-y", outputPattern);
80202
- const processResult = await runFfmpeg(args, { signal, timeout: ffmpegProcessTimeout });
80203
80278
  if (processResult.failureReason === "external_interruption") {
80204
80279
  throw new VideoSourceExtractionError(
80205
80280
  "external_interruption",
@@ -81162,7 +81237,7 @@ function createFrameLookupTable(videos, extracted, fps) {
81162
81237
  }
81163
81238
  return table;
81164
81239
  }
81165
- var VIDEO_FRAME_FORMATS, EXTRACT_CACHE_MIN_AGE_MS, GC_STALENESS_MS, SDR_TO_HDR_COLORSPACE_FILTER, HDR_TO_SDR_TONEMAP_FILTER, HDR_TO_SDR_TRANSFORM_KEY, VideoSourceExtractionError, TRANSIENT_FFMPEG_SPAWN_CODES, FINAL_FRAME_LOGICAL_DURATION_SECONDS, ALPHA_CAPABLE_CODECS, FrameLookupTable;
81240
+ var VIDEO_FRAME_FORMATS, EXTRACT_CACHE_MIN_AGE_MS, GC_STALENESS_MS, SDR_TO_HDR_COLORSPACE_FILTER, HDR_TO_SDR_TONEMAP_FILTER, HDR_TO_SDR_TRANSFORM_KEY, SDR_CANVAS_PASSTHROUGH_FILTER, SDR_JPEG_AS_BT601_FULL_RANGE_FILTER, VideoSourceExtractionError, CHROME_BT601_UNTAGGED_CODECS, NUT_RAW_PIXEL_FORMATS, TRANSIENT_FFMPEG_SPAWN_CODES, FINAL_FRAME_LOGICAL_DURATION_SECONDS, ALPHA_CAPABLE_CODECS, FrameLookupTable;
81166
81241
  var init_videoFrameExtractor = __esm({
81167
81242
  "../engine/src/services/videoFrameExtractor.ts"() {
81168
81243
  "use strict";
@@ -81185,6 +81260,8 @@ var init_videoFrameExtractor = __esm({
81185
81260
  SDR_TO_HDR_COLORSPACE_FILTER = "colorspace=all=bt2020:iall=bt709:range=tv";
81186
81261
  HDR_TO_SDR_TONEMAP_FILTER = "zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:r=tv";
81187
81262
  HDR_TO_SDR_TRANSFORM_KEY = "hdr2sdr-hable-bt709";
81263
+ SDR_CANVAS_PASSTHROUGH_FILTER = "setparams=color_primaries=bt709:color_trc=iec61966-2-1";
81264
+ SDR_JPEG_AS_BT601_FULL_RANGE_FILTER = "scale=flags=neighbor,format=gbrp,scale=out_color_matrix=bt601:out_range=pc:flags=neighbor,format=yuv420p";
81188
81265
  VideoSourceExtractionError = class extends Error {
81189
81266
  constructor(kind, retryable, message, diagnostic = message) {
81190
81267
  super(message);
@@ -81198,6 +81275,47 @@ var init_videoFrameExtractor = __esm({
81198
81275
  diagnostic;
81199
81276
  hyperframesVideoSourceExtractionError = true;
81200
81277
  };
81278
+ CHROME_BT601_UNTAGGED_CODECS = /* @__PURE__ */ new Set(["vp9", "av1"]);
81279
+ NUT_RAW_PIXEL_FORMATS = /* @__PURE__ */ new Set([
81280
+ "yuv420p",
81281
+ "yuvj420p",
81282
+ "yuv422p",
81283
+ "yuvj422p",
81284
+ "yuv444p",
81285
+ "yuvj444p",
81286
+ "yuva420p",
81287
+ "yuva444p",
81288
+ "yuv440p",
81289
+ "yuv411p",
81290
+ "yuv410p",
81291
+ "yuva422p",
81292
+ "yuv420p10le",
81293
+ "yuv422p10le",
81294
+ "yuv444p10le",
81295
+ "yuva420p10le",
81296
+ "yuva444p10le",
81297
+ "yuv420p12le",
81298
+ "nv12",
81299
+ "nv21",
81300
+ "yuyv422",
81301
+ "uyvy422",
81302
+ "gray",
81303
+ "gray10le",
81304
+ "ya8",
81305
+ "gbrp",
81306
+ "gbrap",
81307
+ "gbrp10le",
81308
+ "gbrp12le",
81309
+ "gbrap10le",
81310
+ "rgb24",
81311
+ "bgr24",
81312
+ "rgba",
81313
+ "bgra",
81314
+ "argb",
81315
+ "abgr",
81316
+ "rgb48le",
81317
+ "rgba64le"
81318
+ ]);
81201
81319
  TRANSIENT_FFMPEG_SPAWN_CODES = /* @__PURE__ */ new Set(["EAGAIN", "EMFILE", "ENFILE"]);
81202
81320
  FINAL_FRAME_LOGICAL_DURATION_SECONDS = 1e-6;
81203
81321
  ALPHA_CAPABLE_CODECS = /* @__PURE__ */ new Set(["vp9", "vp8", "prores"]);
@@ -104619,8 +104737,8 @@ async function runFontLocalize(io, localize) {
104619
104737
  }
104620
104738
 
104621
104739
  // src/version.ts
104622
- var VERSION = true ? "0.8.80" : "0.0.0-dev";
104623
- var PRODUCER_VERSION = true ? "0.8.80" : "0.0.0-dev";
104740
+ var VERSION = true ? "0.8.81" : "0.0.0-dev";
104741
+ var PRODUCER_VERSION = true ? "0.8.81" : "0.0.0-dev";
104624
104742
 
104625
104743
  // src/fontLocalizeCli.ts
104626
104744
  async function readStdin() {
@@ -1,4 +1,4 @@
1
- "use strict";var HyperframesPlayer=(()=>{var Re=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Sn=Object.prototype.hasOwnProperty;var Tn=(n,e)=>{for(var t in e)Re(n,t,{get:e[t],enumerable:!0})},xn=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of En(e))!Sn.call(n,r)&&r!==t&&Re(n,r,{get:()=>e[r],enumerable:!(i=An(e,r))||i.enumerable});return n};var wn=n=>xn(Re({},"__esModule",{value:!0}),n);var ar={};Tn(ar,{HyperframesPlayer:()=>we,SPEED_PRESETS:()=>Ie,formatSpeed:()=>V,formatTime:()=>oe});function pt(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function U(n){return typeof n=="object"&&n!==null}function ft(n){return U(n)&&typeof n.getDuration=="function"}function ht(n){return U(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var L="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.80/dist/hyperframe.runtime.iife.js";function H(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function Rn(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=H(e.getAttribute("data-width")),i=H(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var re=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),r=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(pt({hasRuntime:i,hasTimelines:r,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let a=this._resolvePlaybackDurationAdapter(t);if(a&&a.getDuration()>0){this.stop();let s=Rn(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||U(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=L,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!U(t))return null;let i=Object.keys(t);if(i.length===0)return null;let r=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=r&&r in t?r:i[i.length-1],a=t[o];return ht(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(ft(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var bt=`
1
+ "use strict";var HyperframesPlayer=(()=>{var Re=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Sn=Object.prototype.hasOwnProperty;var Tn=(n,e)=>{for(var t in e)Re(n,t,{get:e[t],enumerable:!0})},xn=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of En(e))!Sn.call(n,r)&&r!==t&&Re(n,r,{get:()=>e[r],enumerable:!(i=An(e,r))||i.enumerable});return n};var wn=n=>xn(Re({},"__esModule",{value:!0}),n);var ar={};Tn(ar,{HyperframesPlayer:()=>we,SPEED_PRESETS:()=>Ie,formatSpeed:()=>V,formatTime:()=>oe});function pt(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function U(n){return typeof n=="object"&&n!==null}function ft(n){return U(n)&&typeof n.getDuration=="function"}function ht(n){return U(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var L="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.81/dist/hyperframe.runtime.iife.js";function H(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function Rn(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=H(e.getAttribute("data-width")),i=H(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var re=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),r=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(pt({hasRuntime:i,hasTimelines:r,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let a=this._resolvePlaybackDurationAdapter(t);if(a&&a.getDuration()>0){this.stop();let s=Rn(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||U(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=L,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!U(t))return null;let i=Object.keys(t);if(i.length===0)return null;let r=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=r&&r in t?r:i[i.length-1],a=t[o];return ht(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(ft(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var bt=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -0,0 +1,10 @@
1
+ import assert from "node:assert/strict";
2
+ import { realpathSync } from "node:fs";
3
+ import { homedir, tmpdir, userInfo } from "node:os";
4
+ import { sep } from "node:path";
5
+ import { test } from "node:test";
6
+
7
+ test("the skills test run has a home folder of its own, not the user's", () => {
8
+ assert.ok(realpathSync(homedir()).startsWith(realpathSync(tmpdir()) + sep));
9
+ assert.notEqual(homedir(), userInfo().homedir);
10
+ });
@@ -1,4 +1,4 @@
1
- var Se=Object.defineProperty;var Le=(r,i,e)=>i in r?Se(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var l=(r,i,e)=>Le(r,typeof i!="symbol"?i+"":i,e);import{r as pe,i as De,a as w,b as me,c as Me,d as xe,s as Pe,e as fe,F as _e}from"./index-CsG24Jub.js";function ke(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function $(r){return typeof r=="object"&&r!==null}function Ie(r){return $(r)&&typeof r.getDuration=="function"}function Oe(r){return $(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function Ne(r){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(r))throw new Error(`Invalid HyperFrames runtime version: ${r}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${r}/dist/hyperframe.runtime.iife.js`}const U=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Ne("0.0.0-dev");function V(r){if(r===null)return null;const i=Number.parseInt(r,10);return Number.isFinite(i)&&i>0?i:null}function Fe(r){const i=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!i)return null;const e=V(i.getAttribute("data-width")),t=V(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class He{constructor(i,e){l(this,"_interval",null);l(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const s=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(ke({hasRuntime:s,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!s)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const c=Fe(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:c});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||$(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const s=t.createElement("script");s.src=U,(t.head||t.documentElement).appendChild(s),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,c;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!$(e))return null;const t=Object.keys(e);if(t.length===0)return null;const s=(c=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:c.getAttribute("data-composition-id"),n=s&&s in e?s:t[t.length-1],o=e[n];return Oe(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(Ie(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Ue=`
1
+ var Se=Object.defineProperty;var Le=(r,i,e)=>i in r?Se(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var l=(r,i,e)=>Le(r,typeof i!="symbol"?i+"":i,e);import{r as pe,i as De,a as w,b as me,c as Me,d as xe,s as Pe,e as fe,F as _e}from"./index-hNVM9Pd2.js";function ke(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function $(r){return typeof r=="object"&&r!==null}function Ie(r){return $(r)&&typeof r.getDuration=="function"}function Oe(r){return $(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function Ne(r){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(r))throw new Error(`Invalid HyperFrames runtime version: ${r}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${r}/dist/hyperframe.runtime.iife.js`}const U=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Ne("0.0.0-dev");function V(r){if(r===null)return null;const i=Number.parseInt(r,10);return Number.isFinite(i)&&i>0?i:null}function Fe(r){const i=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!i)return null;const e=V(i.getAttribute("data-width")),t=V(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class He{constructor(i,e){l(this,"_interval",null);l(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const s=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(ke({hasRuntime:s,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!s)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const c=Fe(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:c});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||$(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const s=t.createElement("script");s.src=U,(t.head||t.documentElement).appendChild(s),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,c;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!$(e))return null;const t=Object.keys(e);if(t.length===0)return null;const s=(c=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:c.getAttribute("data-composition-id"),n=s&&s in e?s:t[t.length-1],o=e[n];return Oe(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(Ie(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Ue=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -1 +1 @@
1
- import{g as P}from"./index-CsG24Jub.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
1
+ import{g as P}from"./index-hNVM9Pd2.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-CsG24Jub.js";/*!
1
+ import{n as Qi}from"./index-hNVM9Pd2.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public