hyperframes 0.7.84 → 0.7.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ var VERSION;
50
50
  var init_version = __esm({
51
51
  "src/version.ts"() {
52
52
  "use strict";
53
- VERSION = true ? "0.7.84" : "0.0.0-dev";
53
+ VERSION = true ? "0.7.85" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -74701,6 +74701,9 @@ function decodeUrlPathVariants2(path2) {
74701
74701
  function isRemoteOrInlineUrl(url) {
74702
74702
  return /^(https?:|data:|blob:|\/\/|#)/i.test(url);
74703
74703
  }
74704
+ function hasUnresolvedTemplatingToken(url) {
74705
+ return /<<[^<>]+>>|\{\{[^{}]+\}\}|\$\{[^{}]+\}/.test(url);
74706
+ }
74704
74707
  function cleanAssetUrl(url) {
74705
74708
  return url.trim().split(/[?#]/, 1)[0] ?? "";
74706
74709
  }
@@ -78415,7 +78418,9 @@ function collectLocalVideoCandidates(projectDir, htmlSources) {
78415
78418
  const re2 = new RegExp(videoSrcRe.source, videoSrcRe.flags);
78416
78419
  let match;
78417
78420
  while ((match = re2.exec(scannable)) !== null) {
78418
- const src = cleanAssetUrl(match[1] ?? "");
78421
+ const rawSrc = match[1] ?? "";
78422
+ if (hasUnresolvedTemplatingToken(rawSrc)) continue;
78423
+ const src = cleanAssetUrl(rawSrc);
78419
78424
  if (!src) continue;
78420
78425
  if (isRemoteOrInlineUrl(src)) continue;
78421
78426
  if (/^__[A-Z_]+__$/.test(src)) continue;
@@ -78641,6 +78646,7 @@ function lintAudioSrcNotFound(projectDir, htmlSources) {
78641
78646
  const src = match[1];
78642
78647
  if (/^(https?:|data:|blob:)/i.test(src)) continue;
78643
78648
  if (/^__[A-Z_]+__$/.test(src)) continue;
78649
+ if (hasUnresolvedTemplatingToken(src)) continue;
78644
78650
  const rootRelative = compSrcPath ? rewriteAssetPath(compSrcPath, src) : src;
78645
78651
  if (!resolveLocalAssetCandidates(projectDir, rootRelative).some(existsSync11)) {
78646
78652
  missingSrcs.push(src);
@@ -78669,6 +78675,7 @@ function lintMissingLocalAsset(projectDir, htmlSources) {
78669
78675
  while ((match = re2.exec(scannable)) !== null) {
78670
78676
  const tagName19 = (match[1] ?? "").toLowerCase();
78671
78677
  const rawSrc = match[2] ?? "";
78678
+ if (hasUnresolvedTemplatingToken(rawSrc)) continue;
78672
78679
  const src = cleanAssetUrl(rawSrc);
78673
78680
  if (!src) continue;
78674
78681
  if (isRemoteOrInlineUrl(src)) continue;
@@ -78704,6 +78711,7 @@ function lintTextureMaskAssetNotFound(projectDir, htmlSources) {
78704
78711
  const pattern = new RegExp(MASK_IMAGE_URL_RE.source, MASK_IMAGE_URL_RE.flags);
78705
78712
  while ((match = pattern.exec(cssSource.content)) !== null) {
78706
78713
  const rawUrl = match[1] ?? match[2] ?? match[3] ?? "";
78714
+ if (hasUnresolvedTemplatingToken(rawUrl)) continue;
78707
78715
  const url = cleanAssetUrl(rawUrl);
78708
78716
  if (!url || isRemoteOrInlineUrl(url)) continue;
78709
78717
  if (/^__[A-Z_]+__$/.test(url)) continue;
@@ -78811,6 +78819,7 @@ function lintMissingOrEmptySubComposition(projectDir, rootHtml) {
78811
78819
  const srcPath = (match[1] ?? "").trim();
78812
78820
  if (!srcPath) continue;
78813
78821
  if (/^__[A-Z_]+__$/.test(srcPath)) continue;
78822
+ if (hasUnresolvedTemplatingToken(srcPath)) continue;
78814
78823
  const filePath = resolve8(projectDir, srcPath);
78815
78824
  if (visited.has(filePath)) continue;
78816
78825
  visited.add(filePath);
@@ -131167,7 +131176,7 @@ var init_init = __esm({
131167
131176
  console.log(
131168
131177
  ` ${c.dim('"Using /hyperframes, create a 15-second intro about [your topic]"')}`
131169
131178
  );
131170
- console.log(` ${c.dim("More patterns: hyperframes.heygen.com/guides/prompting")}`);
131179
+ console.log(` ${c.dim("More patterns: hyperframes.heygen.com/prompting/overview")}`);
131171
131180
  console.log();
131172
131181
  console.log(` ${c.accent("4.")} Preview in the browser:`);
131173
131182
  console.log(` ${c.accent(`cd ${name2}`)} && ${c.accent("npm run dev")}`);
@@ -190296,6 +190305,20 @@ function svgContentHashSlug(svgSource, isLogo) {
190296
190305
  const hash2 = createHash18("sha1").update(svgSource).digest("hex").slice(0, 8);
190297
190306
  return isLogo ? `logo-${hash2}` : `svg-${hash2}`;
190298
190307
  }
190308
+ function toStandaloneSvg(outerHTML) {
190309
+ const open3 = outerHTML.match(/<svg\b[^>]*>/i);
190310
+ if (!open3) return outerHTML;
190311
+ const original = open3[0];
190312
+ let tag = original;
190313
+ const add2 = [];
190314
+ if (!/\sxmlns\s*=/i.test(tag)) add2.push('xmlns="http://www.w3.org/2000/svg"');
190315
+ if (/\sxlink:[a-z-]+\s*=/i.test(outerHTML) && !/\sxmlns:xlink\s*=/i.test(tag)) {
190316
+ add2.push('xmlns:xlink="http://www.w3.org/1999/xlink"');
190317
+ }
190318
+ if (!add2.length) return outerHTML;
190319
+ tag = tag.replace(/^<svg\b/i, `<svg ${add2.join(" ")}`);
190320
+ return outerHTML.replace(original, tag);
190321
+ }
190299
190322
  async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks) {
190300
190323
  const assetsDir = join109(outputDir, "assets");
190301
190324
  mkdirSync53(assetsDir, { recursive: true });
@@ -190306,7 +190329,8 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
190306
190329
  for (let i2 = 0; i2 < tokens.svgs.length && i2 < 30; i2++) {
190307
190330
  const svg = tokens.svgs[i2];
190308
190331
  if (!svg.outerHTML || svg.outerHTML.length < 50) continue;
190309
- const slug = svgContentHashSlug(svg.outerHTML, !!svg.isLogo);
190332
+ const svgFile = toStandaloneSvg(svg.outerHTML);
190333
+ const slug = svgContentHashSlug(svgFile, !!svg.isLogo);
190310
190334
  let finalSlug = slug;
190311
190335
  let suffix = 2;
190312
190336
  while (usedSvgNames.has(finalSlug)) {
@@ -190317,7 +190341,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
190317
190341
  const name = `${finalSlug}.svg`;
190318
190342
  const localPath = `assets/svgs/${name}`;
190319
190343
  try {
190320
- writeFileSync45(join109(outputDir, localPath), svg.outerHTML, "utf-8");
190344
+ writeFileSync45(join109(outputDir, localPath), svgFile, "utf-8");
190321
190345
  assets.push({ url: "", localPath, type: "svg" });
190322
190346
  } catch {
190323
190347
  }
@@ -193304,10 +193328,50 @@ var init_scaffolding = __esm({
193304
193328
  // src/capture/screenshotCapture.ts
193305
193329
  var screenshotCapture_exports = {};
193306
193330
  __export(screenshotCapture_exports, {
193307
- captureScrollScreenshots: () => captureScrollScreenshots
193331
+ MAX_PLATE_HEIGHT_PX: () => MAX_PLATE_HEIGHT_PX,
193332
+ captureFullPagePlate: () => captureFullPagePlate,
193333
+ captureScrollScreenshots: () => captureScrollScreenshots,
193334
+ pngHeight: () => pngHeight
193308
193335
  });
193309
193336
  import { writeFileSync as writeFileSync50, mkdirSync as mkdirSync56 } from "fs";
193310
193337
  import { join as join117 } from "path";
193338
+ function pngHeight(buf) {
193339
+ if (buf.length < 24) return null;
193340
+ if (buf[12] !== 73 || buf[13] !== 72 || buf[14] !== 68 || buf[15] !== 82) return null;
193341
+ return (buf[20] << 24 | buf[21] << 16 | buf[22] << 8 | buf[23]) >>> 0;
193342
+ }
193343
+ async function captureFullPagePlate(page, screenshotsDir) {
193344
+ await page.evaluate(
193345
+ `document.querySelectorAll('*').forEach((el) => {
193346
+ const p = getComputedStyle(el).position;
193347
+ if (p === 'fixed' || p === 'sticky') {
193348
+ el.setAttribute('data-hf-plate-position', el.style.position || '');
193349
+ el.style.position = 'static';
193350
+ }
193351
+ })`
193352
+ );
193353
+ try {
193354
+ const docHeight = await page.evaluate(
193355
+ `Math.max(document.body.scrollHeight, document.documentElement.scrollHeight)`
193356
+ );
193357
+ if (docHeight > MAX_PLATE_HEIGHT_PX) return null;
193358
+ const buffer = await page.screenshot({ type: "png", fullPage: true });
193359
+ const produced = pngHeight(buffer);
193360
+ if (produced != null && produced > MAX_PLATE_HEIGHT_PX) return null;
193361
+ writeFileSync50(join117(screenshotsDir, "full-page.png"), buffer);
193362
+ return "screenshots/full-page.png";
193363
+ } finally {
193364
+ try {
193365
+ await page.evaluate(
193366
+ `document.querySelectorAll('[data-hf-plate-position]').forEach((el) => {
193367
+ el.style.position = el.getAttribute('data-hf-plate-position');
193368
+ el.removeAttribute('data-hf-plate-position');
193369
+ })`
193370
+ );
193371
+ } catch {
193372
+ }
193373
+ }
193374
+ }
193311
193375
  async function captureScrollScreenshots(page, outputDir) {
193312
193376
  const screenshotsDir = join117(outputDir, "screenshots");
193313
193377
  mkdirSync56(screenshotsDir, { recursive: true });
@@ -193408,13 +193472,17 @@ async function captureScrollScreenshots(page, outputDir) {
193408
193472
  }
193409
193473
  await page.evaluate(`window.scrollTo(0, 0)`);
193410
193474
  await new Promise((r2) => setTimeout(r2, 200));
193475
+ const plate = await captureFullPagePlate(page, screenshotsDir);
193476
+ if (plate) filePaths.push(plate);
193411
193477
  } catch {
193412
193478
  }
193413
193479
  return filePaths;
193414
193480
  }
193481
+ var MAX_PLATE_HEIGHT_PX;
193415
193482
  var init_screenshotCapture = __esm({
193416
193483
  "src/capture/screenshotCapture.ts"() {
193417
193484
  "use strict";
193485
+ MAX_PLATE_HEIGHT_PX = 16384;
193418
193486
  }
193419
193487
  });
193420
193488
 
@@ -1,4 +1,4 @@
1
- "use strict";var HyperframesPlayer=(()=>{var J=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Xe=(i,e)=>{for(var t in e)J(i,t,{get:e[t],enumerable:!0})},Ze=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qe(e))!Ye.call(i,n)&&n!==t&&J(i,n,{get:()=>e[n],enumerable:!(r=Ge(e,n))||r.enumerable});return i};var Qe=i=>Ze(J({},"__esModule",{value:!0}),i);var Lt={};Xe(Lt,{HyperframesPlayer:()=>Q,SPEED_PRESETS:()=>te,formatSpeed:()=>N,formatTime:()=>$});function ye(i){return i.hasRuntime||i.runtimeInjected?!1:!!(i.hasNestedCompositions||i.hasTimelines&&i.attempts>=5)}function I(i){return typeof i=="object"&&i!==null}function Ee(i){return I(i)&&typeof i.getDuration=="function"}function Se(i){return I(i)&&typeof i.duration=="function"&&typeof i.time=="function"&&typeof i.seek=="function"&&typeof i.play=="function"&&typeof i.pause=="function"}var Je="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.7.84/dist/hyperframe.runtime.iife.js";function D(i){if(i===null)return null;let e=Number.parseInt(i,10);return Number.isFinite(e)&&e>0?e:null}function Ke(i){let e=i?.querySelector("[data-composition-id][data-width][data-height]")??i?.querySelector("[data-width][data-height]");if(!e)return null;let t=D(e.getAttribute("data-width")),r=D(e.getAttribute("data-height"));return t!==null&&r!==null?{width:t,height:r}:null}var j=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 r=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(ye({hasRuntime:r,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;let s=this._resolvePlaybackDurationAdapter(t);if(s&&s.getDuration()>0){this.stop();let l=Ke(this._iframe.contentDocument);this._callbacks.onReady({duration:s.getDuration(),adapter:s,compositionSize:l});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||I(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=Je,(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(!I(t))return null;let r=Object.keys(t);if(r.length===0)return null;let n=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=n&&n in t?n:r[r.length-1],s=t[o];return Se(s)?s:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(Ee(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let r=this._resolveDirectTimelineAdapterFromWindow(e);return r?{kind:"direct-timeline",timeline:r,getDuration:()=>r.duration()}:null}};var Te=`
1
+ "use strict";var HyperframesPlayer=(()=>{var J=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Xe=(i,e)=>{for(var t in e)J(i,t,{get:e[t],enumerable:!0})},Ze=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qe(e))!Ye.call(i,n)&&n!==t&&J(i,n,{get:()=>e[n],enumerable:!(r=Ge(e,n))||r.enumerable});return i};var Qe=i=>Ze(J({},"__esModule",{value:!0}),i);var Lt={};Xe(Lt,{HyperframesPlayer:()=>Q,SPEED_PRESETS:()=>te,formatSpeed:()=>N,formatTime:()=>$});function ye(i){return i.hasRuntime||i.runtimeInjected?!1:!!(i.hasNestedCompositions||i.hasTimelines&&i.attempts>=5)}function I(i){return typeof i=="object"&&i!==null}function Ee(i){return I(i)&&typeof i.getDuration=="function"}function Se(i){return I(i)&&typeof i.duration=="function"&&typeof i.time=="function"&&typeof i.seek=="function"&&typeof i.play=="function"&&typeof i.pause=="function"}var Je="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.7.85/dist/hyperframe.runtime.iife.js";function D(i){if(i===null)return null;let e=Number.parseInt(i,10);return Number.isFinite(e)&&e>0?e:null}function Ke(i){let e=i?.querySelector("[data-composition-id][data-width][data-height]")??i?.querySelector("[data-width][data-height]");if(!e)return null;let t=D(e.getAttribute("data-width")),r=D(e.getAttribute("data-height"));return t!==null&&r!==null?{width:t,height:r}:null}var j=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 r=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(ye({hasRuntime:r,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;let s=this._resolvePlaybackDurationAdapter(t);if(s&&s.getDuration()>0){this.stop();let l=Ke(this._iframe.contentDocument);this._callbacks.onReady({duration:s.getDuration(),adapter:s,compositionSize:l});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||I(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=Je,(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(!I(t))return null;let r=Object.keys(t);if(r.length===0)return null;let n=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=n&&n in t?n:r[r.length-1],s=t[o];return Se(s)?s:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(Ee(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let r=this._resolveDirectTimelineAdapterFromWindow(e);return r?{kind:"direct-timeline",timeline:r,getDuration:()=>r.duration()}:null}};var Te=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -1,6 +1,6 @@
1
1
  # Route: music-to-video
2
2
 
3
- - **Input:** A music track, or a video whose audio becomes the track, with no narration or website capture. User images or videos are optional.
3
+ - **Input:** A music track, a video whose audio becomes the track, or a track generated from a mood brief — with no narration or website capture. User images or videos are optional, so a complete video needs zero supplied assets.
4
4
  - **Output:** A beat-synced MP4 driven by a deterministic beat/energy map (`audiomap.json`). It may become a lyric video, slideshow, visualizer, or kinetic promo without changing pipelines.
5
5
  - **Triggers:** "make a video for this song", "beat-synced video", "lyric video", "music visualizer", "kinetic promo to this beat".
6
6
 
@@ -1,4 +1,4 @@
1
- var ce=Object.defineProperty;var pe=(r,t,e)=>t in r?ce(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var c=(r,t,e)=>pe(r,typeof t!="symbol"?t+"":t,e);import{r as ne,i as me,a as fe}from"./index-C3J3fmFc.js";function _e(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function F(r){return typeof r=="object"&&r!==null}function ge(r){return F(r)&&typeof r.getDuration=="function"}function ye(r){return F(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function ve(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 be=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:ve("0.0.0-dev");function H(r){if(r===null)return null;const t=Number.parseInt(r,10);return Number.isFinite(t)&&t>0?t:null}function we(r){const t=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!t)return null;const e=H(t.getAttribute("data-width")),i=H(t.getAttribute("data-height"));return e!==null&&i!==null?{width:e,height:i}:null}class Ae{constructor(t,e){c(this,"_interval",null);c(this,"_runtimeInjected",!1);this._iframe=t,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let t=0;this._interval=setInterval(()=>{var e;t++;try{const i=this._iframe.contentWindow;if(!i)return;const s=!!(i.__hf||i.__player),o=!!(i.__timelines&&Object.keys(i.__timelines).length>0),d=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(_e({hasRuntime:s,hasTimelines:o,hasNestedCompositions:d,runtimeInjected:this._runtimeInjected,attempts:t})){this._injectRuntime();return}if(this._runtimeInjected&&!s)return;const a=this._resolvePlaybackDurationAdapter(i);if(a&&a.getDuration()>0){this.stop();const h=we(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:h});return}}catch{}t>=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 t=this._iframe.contentWindow;return t?this._resolveDirectTimelineAdapterFromWindow(t):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(t){return this._resolveDirectTimelineAdapterFromWindow(t)}hasRuntimeBridge(t){return Reflect.get(t,"__hf")!==void 0||F(Reflect.get(t,"__player"))}_injectRuntime(){var t,e;this._runtimeInjected=!0;try{const i=this._iframe.contentDocument;if(!i)return;const s=i.createElement("script");s.src=be,(i.head||i.documentElement).appendChild(s),(e=(t=this._callbacks).onRuntimeInjected)==null||e.call(t)}catch{}}_resolveDirectTimelineAdapterFromWindow(t){var a,h;if(this.hasRuntimeBridge(t))return null;const e=Reflect.get(t,"__timelines");if(!F(e))return null;const i=Object.keys(e);if(i.length===0)return null;const s=(h=(a=this._iframe.contentDocument)==null?void 0:a.querySelector("[data-composition-id]"))==null?void 0:h.getAttribute("data-composition-id"),o=s&&s in e?s:i[i.length-1],d=e[o];return ye(d)?d:null}_resolvePlaybackDurationAdapter(t){const e=Reflect.get(t,"__player");if(ge(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const i=this._resolveDirectTimelineAdapterFromWindow(t);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}}const Ee=`
1
+ var ce=Object.defineProperty;var pe=(r,t,e)=>t in r?ce(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var c=(r,t,e)=>pe(r,typeof t!="symbol"?t+"":t,e);import{r as ne,i as me,a as fe}from"./index-DloBOPGY.js";function _e(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function F(r){return typeof r=="object"&&r!==null}function ge(r){return F(r)&&typeof r.getDuration=="function"}function ye(r){return F(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function ve(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 be=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:ve("0.0.0-dev");function H(r){if(r===null)return null;const t=Number.parseInt(r,10);return Number.isFinite(t)&&t>0?t:null}function we(r){const t=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!t)return null;const e=H(t.getAttribute("data-width")),i=H(t.getAttribute("data-height"));return e!==null&&i!==null?{width:e,height:i}:null}class Ae{constructor(t,e){c(this,"_interval",null);c(this,"_runtimeInjected",!1);this._iframe=t,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let t=0;this._interval=setInterval(()=>{var e;t++;try{const i=this._iframe.contentWindow;if(!i)return;const s=!!(i.__hf||i.__player),o=!!(i.__timelines&&Object.keys(i.__timelines).length>0),d=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(_e({hasRuntime:s,hasTimelines:o,hasNestedCompositions:d,runtimeInjected:this._runtimeInjected,attempts:t})){this._injectRuntime();return}if(this._runtimeInjected&&!s)return;const a=this._resolvePlaybackDurationAdapter(i);if(a&&a.getDuration()>0){this.stop();const h=we(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:h});return}}catch{}t>=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 t=this._iframe.contentWindow;return t?this._resolveDirectTimelineAdapterFromWindow(t):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(t){return this._resolveDirectTimelineAdapterFromWindow(t)}hasRuntimeBridge(t){return Reflect.get(t,"__hf")!==void 0||F(Reflect.get(t,"__player"))}_injectRuntime(){var t,e;this._runtimeInjected=!0;try{const i=this._iframe.contentDocument;if(!i)return;const s=i.createElement("script");s.src=be,(i.head||i.documentElement).appendChild(s),(e=(t=this._callbacks).onRuntimeInjected)==null||e.call(t)}catch{}}_resolveDirectTimelineAdapterFromWindow(t){var a,h;if(this.hasRuntimeBridge(t))return null;const e=Reflect.get(t,"__timelines");if(!F(e))return null;const i=Object.keys(e);if(i.length===0)return null;const s=(h=(a=this._iframe.contentDocument)==null?void 0:a.querySelector("[data-composition-id]"))==null?void 0:h.getAttribute("data-composition-id"),o=s&&s in e?s:i[i.length-1],d=e[o];return ye(d)?d:null}_resolvePlaybackDurationAdapter(t){const e=Reflect.get(t,"__player");if(ge(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const i=this._resolveDirectTimelineAdapterFromWindow(t);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}}const Ee=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-C3J3fmFc.js";/*!
1
+ import{n as Qi}from"./index-DloBOPGY.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
@@ -1 +1 @@
1
- import{g as P}from"./index-C3J3fmFc.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-DloBOPGY.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};