hyperframes 0.8.151 → 0.8.153
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/{add-QKZZG7A2.js → add-D7GZM6ZS.js} +14 -14
- package/dist/{animatedGifPrep-YQDPYGOD.js → animatedGifPrep-IBLDIJXC.js} +9 -9
- package/dist/api.js +15 -15
- package/dist/{asset-3Q737Y4H.js → asset-ACZRQU2Z.js} +2 -2
- package/dist/{assetCataloger-BTHEBJJB.js → assetCataloger-Y3OELLLW.js} +4 -4
- package/dist/{auth-XL7EU3SO.js → auth-LFWML3XJ.js} +1 -1
- package/dist/{autoUpdate-PJFLTQ3U.js → autoUpdate-7IUGQXOV.js} +2 -2
- package/dist/{backgroundChecks-T5TIR5WK.js → backgroundChecks-XI364BNX.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-NFLVIDB4.js → batchRender-6TD4XSIP.js} +5 -5
- package/dist/{beats-JU4GZ26R.js → beats-FZGQ3HLR.js} +14 -14
- package/dist/{benchmark-7U2YWLTW.js → benchmark-3YEKSYMP.js} +10 -10
- package/dist/{browser-D57UPYDA.js → browser-R5PKLYZD.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-26MXQOZG.js → bundleWithLocalizedFonts-QX5HV7LC.js} +2 -2
- package/dist/{capture-LT252COQ.js → capture-MTHXUEC2.js} +19 -19
- package/dist/{capture-47BV25G3.js → capture-R7QSBEPW.js} +2 -2
- package/dist/{catalog-BEZXOV4O.js → catalog-K2TRGCXO.js} +14 -14
- package/dist/{catch-up-KVV5X6BF.js → catch-up-WCSN4K4A.js} +4 -4
- package/dist/{check-6KQ433E6.js → check-N4EFKWC3.js} +294 -66
- package/dist/{checkBrowser-PRDR6XBY.js → checkBrowser-73SOMDG3.js} +75 -45
- package/dist/{chunk-IZPN423R.js → chunk-2F6LWCSF.js} +11 -6
- package/dist/{chunk-TCWMDCBX.js → chunk-2X3UJ4Q3.js} +2 -2
- package/dist/{chunk-YZTVHRJ2.js → chunk-2XEBNYG5.js} +1 -1
- package/dist/chunk-3DMR7RF6.js +24 -0
- package/dist/{chunk-APDLWWFG.js → chunk-3VGU2SH7.js} +1 -1
- package/dist/{chunk-OZ4K46OV.js → chunk-4IRCZWND.js} +2 -2
- package/dist/{chunk-4PKQEKAI.js → chunk-4OVLWS2K.js} +2 -2
- package/dist/{chunk-DHPFXAUF.js → chunk-57GN6KWT.js} +17 -3
- package/dist/{chunk-374QQGBQ.js → chunk-5CS4T6C6.js} +63 -12
- package/dist/{chunk-FLVI7FHU.js → chunk-5DD45SJZ.js} +1 -1
- package/dist/{chunk-BRF3O35X.js → chunk-5FS4HCHN.js} +109 -31
- package/dist/{chunk-DIOBKUBV.js → chunk-5OKZRXLT.js} +2 -2
- package/dist/{chunk-POEEDPJI.js → chunk-5ZGSN5YK.js} +1 -1
- package/dist/{chunk-FJWEYVEM.js → chunk-7FYFEXD2.js} +658 -198
- package/dist/{chunk-L3N7RJHS.js → chunk-7NKLNOHW.js} +3 -3
- package/dist/{chunk-O3DUX6P2.js → chunk-AA67UBB2.js} +4 -4
- package/dist/{chunk-IZ7L6V76.js → chunk-AUK5QCRH.js} +1 -1
- package/dist/{chunk-YEBKEWKB.js → chunk-BD3XH4A7.js} +1 -1
- package/dist/{chunk-XXPYZBZ3.js → chunk-C6TPGUWD.js} +2 -2
- package/dist/{chunk-ZD3RDNZI.js → chunk-CBMZYOWC.js} +1 -1
- package/dist/{chunk-ZGCRVM5M.js → chunk-DAKXCEE3.js} +4 -4
- package/dist/{chunk-AIJS74LG.js → chunk-FFDC5OWV.js} +8 -2
- package/dist/{chunk-DMKI64EZ.js → chunk-FSZAFCU7.js} +1 -1
- package/dist/{chunk-OSAH7S5M.js → chunk-FZC4UM4G.js} +1 -1
- package/dist/{chunk-QBYHNRHU.js → chunk-GV7I3ZSQ.js} +2 -2
- package/dist/{chunk-N3I6RAOR.js → chunk-GXPD7J53.js} +11 -11
- package/dist/{chunk-N4IXP3MY.js → chunk-HGAOO43L.js} +3 -3
- package/dist/{chunk-QF7AE3DB.js → chunk-J5LEAKUA.js} +1 -1
- package/dist/{chunk-PUIELIFA.js → chunk-JBUIS5DN.js} +1 -1
- package/dist/{chunk-KXX6NLOT.js → chunk-JQ57FAYN.js} +1 -1
- package/dist/{chunk-RRBKEHST.js → chunk-KFBEMIMD.js} +54 -6
- package/dist/{chunk-RYL6ZIJP.js → chunk-OIONMNWN.js} +18 -11
- package/dist/{chunk-KQGWP4KH.js → chunk-OSASJLU4.js} +1 -1
- package/dist/{chunk-3ZPFRDEJ.js → chunk-PVGDU7SE.js} +4 -4
- package/dist/{chunk-XGLNQDLN.js → chunk-PXOFFSO3.js} +1 -1
- package/dist/{chunk-IP73NMQT.js → chunk-QBFHVMOI.js} +10 -10
- package/dist/{chunk-IPDS2SWI.js → chunk-R6WCSVCE.js} +1 -1
- package/dist/{chunk-XYHBVSWD.js → chunk-RCWSM7IQ.js} +2 -2
- package/dist/{chunk-4YZYYP7V.js → chunk-SUVIGBHS.js} +3 -3
- package/dist/{chunk-L6RIMCMG.js → chunk-T2Y2WC5I.js} +3 -3
- package/dist/{chunk-QLGBNGXC.js → chunk-TCJM3KF2.js} +2 -2
- package/dist/{chunk-XKKBIFE5.js → chunk-TQUTAWUR.js} +7 -7
- package/dist/{chunk-HVXRYMGQ.js → chunk-TXWPPBIW.js} +1 -1
- package/dist/{chunk-2PSPARWP.js → chunk-TYXH3EKP.js} +4 -0
- package/dist/{chunk-FMNVTKX2.js → chunk-U3BCDVZO.js} +1 -1
- package/dist/{chunk-RJRGR5KF.js → chunk-UNOALNYO.js} +9 -9
- package/dist/{chunk-3SVC7SW4.js → chunk-V6UUZGP6.js} +7 -3
- package/dist/{chunk-LFNQDTSH.js → chunk-VYKPBRCB.js} +63 -12
- package/dist/{chunk-S22FKF6G.js → chunk-WNCGJFTZ.js} +2 -2
- package/dist/{chunk-XNDXENJQ.js → chunk-WQMTHPTK.js} +3 -3
- package/dist/{chunk-4LE27ST4.js → chunk-XQYLUY2F.js} +2 -2
- package/dist/chunk-XSEGMQYA.js +30 -0
- package/dist/{chunk-35PWWBGZ.js → chunk-YI6OBVWQ.js} +1 -1
- package/dist/{chunk-GNTVYF7E.js → chunk-YOEGUBBY.js} +5 -5
- package/dist/{chunk-FAIYEIZ4.js → chunk-YYMJEQ4D.js} +1 -1
- package/dist/{chunk-LKQS72D5.js → chunk-Z6CSYA7U.js} +1 -1
- package/dist/{chunk-XQKVEQNY.js → chunk-ZDEEHQ2Y.js} +2 -2
- package/dist/chunk-ZQMYD22O.js +215 -0
- package/dist/{clean-RLTHFTQA.js → clean-TLMZ6GVY.js} +52 -31
- package/dist/cli.js +53 -53
- package/dist/{cloud-Q5TGBTW3.js → cloud-XFIRM6YE.js} +4 -4
- package/dist/{cloudrun-4UZF74MV.js → cloudrun-OUGI5NN4.js} +6 -6
- package/dist/{compare-Q5UNR2V4.js → compare-OKSXYO3L.js} +30 -30
- package/dist/{compiler-ZXT27Z62.js → compiler-WHUQZITN.js} +6 -6
- package/dist/{component-H734P32V.js → component-3II4YXAD.js} +3 -3
- package/dist/{compositions-YEHDSTDR.js → compositions-RL75WQS6.js} +13 -13
- package/dist/{delete-LDBMPWRT.js → delete-4FM24SJ2.js} +2 -2
- package/dist/{deterministicFonts-C5JQLCTS.js → deterministicFonts-EOMDR6ZF.js} +3 -3
- package/dist/{dist-RGE4QASU.js → dist-2YYJYYPY.js} +3 -3
- package/dist/{dist-7JXLFD6U.js → dist-NUSNSGME.js} +4 -4
- package/dist/{doctor-XNJFIWJ7.js → doctor-Q5WYRIVP.js} +11 -11
- package/dist/{events-G6UFLNXR.js → events-CPZTSXAX.js} +2 -2
- package/dist/{events-UKCPUWMH.js → events-J5VJAKGT.js} +3 -3
- package/dist/{feedback-CK3KZ7DE.js → feedback-U64DIKAF.js} +8 -8
- package/dist/{figma-3D5C737B.js → figma-GUHWRHJO.js} +3 -3
- package/dist/fontLocalizeCli.js +12 -12
- package/dist/{get-QGTQUWFT.js → get-XDQJPF7G.js} +2 -2
- package/dist/{gpuPolicy-G5QAQDYF.js → gpuPolicy-7SIPG5BM.js} +9 -9
- package/dist/{grade-compare-XIHOM62P.js → grade-compare-WWW2F3NY.js} +30 -30
- package/dist/{gsapParserAcorn-VXZ3ZIF2.js → gsapParserAcorn-7NCK2LVT.js} +2 -2
- package/dist/{help-U5UBXT52.js → help-3UJYI7LC.js} +1 -1
- package/dist/{history-5J73QZSA.js → history-VQSM5L6N.js} +77 -205
- package/dist/hyperframe-runtime.js +4 -0
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +4 -0
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-RJHQQQUP.js → info-NMDUH7N5.js} +9 -9
- package/dist/{init-M6UQOYYC.js → init-D753VPPZ.js} +24 -24
- package/dist/{inspect-PRQWDBTP.js → inspect-KEE27DQN.js} +31 -31
- package/dist/{installer-ZL7UKYK5.js → installer-QCHUXV6E.js} +7 -7
- package/dist/{keyframes-VMUJYTCQ.js → keyframes-EP44YDZW.js} +227 -82
- package/dist/{lambda-ON42DRQD.js → lambda-Q5FTNY4J.js} +7 -7
- package/dist/{layout-QKBFVDVY.js → layout-LATG5CZV.js} +31 -31
- package/dist/{lint-ZQHHL2SV.js → lint-TQDQFJKW.js} +9 -9
- package/dist/{lintProject-3Z6OJCSO.js → lintProject-XQWXJYSC.js} +3 -3
- package/dist/{list-YBRKIWGF.js → list-O44ENRGS.js} +2 -2
- package/dist/{login-4B2YXGLB.js → login-EKFN5PZP.js} +4 -4
- package/dist/{media-treatment-5C5EJAAP.js → media-treatment-LPT4GYAE.js} +12 -12
- package/dist/{models-R7ZDWBJ6.js → models-CRYHY4KH.js} +12 -12
- package/dist/{motionShot-ZHESZNUL.js → motionShot-BS3DB666.js} +28 -15
- package/dist/{normalize-audio-EVWZVTBM.js → normalize-audio-7X445LLJ.js} +6 -6
- package/dist/{open-TV6HT4UT.js → open-JA7FN5F5.js} +4 -4
- package/dist/{parakeetRunner-YVVF4CG6.js → parakeetRunner-AFUTDANA.js} +12 -12
- package/dist/{pipeline-ETR5SEBS.js → pipeline-3TQHAQOJ.js} +9 -9
- package/dist/{play-C6WONRZV.js → play-UUJAXFCJ.js} +24 -24
- package/dist/{present-RANXTVPA.js → present-EBP6YMCJ.js} +20 -20
- package/dist/{preview-KF6UMBT2.js → preview-PVJDLZDU.js} +19 -19
- package/dist/{producer-CY2GXBWN.js → producer-HE23BPEU.js} +1 -1
- package/dist/{projectConfig-KPXCNMBM.js → projectConfig-EX35BZLA.js} +9 -9
- package/dist/{publication-Y36N4A7E.js → publication-OUGS3P7W.js} +4 -4
- package/dist/{publish-RCQJO35C.js → publish-UUFZR6QT.js} +12 -12
- package/dist/{remove-background-3ZMXVWLB.js → remove-background-P5M42CA5.js} +10 -10
- package/dist/{render-WUSTRMUD.js → render-AWFQGD4T.js} +5 -5
- package/dist/{render-PTNEFO5U.js → render-BJMONGDL.js} +10 -10
- package/dist/{render-FKVRCDT2.js → render-YSD2SRBL.js} +57 -22
- package/dist/{render-batch-AQHU2JWZ.js → render-batch-6UN3HT5A.js} +5 -5
- package/dist/renderSetupWorker.js +3 -3
- package/dist/{resolver-L5BDZJKU.js → resolver-O6ZENVYP.js} +6 -6
- package/dist/{sherpa-3S3ISG7G.js → sherpa-RWHRDO53.js} +11 -11
- package/dist/skills/hyperframes-cli/SKILL.md +3 -0
- package/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +5 -1
- package/dist/{skills-X4WQEKNF.js → skills-KC6IGXDU.js} +5 -5
- package/dist/{skillsUpdateCheck-UYCVHDZ6.js → skillsUpdateCheck-7C4TD7EL.js} +3 -3
- package/dist/{snapshot-YEYHQEZQ.js → snapshot-SNZL5GPC.js} +118 -41
- package/dist/{src-OLBDPEG6.js → src-KKS6QEHB.js} +11 -11
- package/dist/{src-2NN2WB6X.js → src-YMUDUVXQ.js} +8 -8
- package/dist/{staticProjectServer-7H35NMWB.js → staticProjectServer-XOCIQ3FV.js} +20 -20
- package/dist/studio/assets/{hyperframes-player-DJt8E7k4.js → hyperframes-player-Cn6V2ZaK.js} +1 -1
- package/dist/studio/assets/{index-DgbLblGR.js → index-CEGNvZnK.js} +1 -1
- package/dist/studio/assets/{index-DWIHrAY2.js → index-CaaXbGyk.js} +1 -1
- package/dist/studio/assets/{index-BGks9KLI.js → index-Cwpnr4DV.js} +132 -132
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-HGM2A5I3.js → studio-api-NUNUZQ5I.js} +30 -16
- package/dist/{studioServer-M6XFL7N6.js → studioServer-FBY3YWZH.js} +43 -43
- package/dist/{synthesize-22B7L5GX.js → synthesize-W2M7QGDV.js} +6 -5
- package/dist/{telemetry-KVCZKVTE.js → telemetry-KNSTX3E2.js} +3 -3
- package/dist/{timeline-VYYKZR4V.js → timeline-6I5LGPP6.js} +20 -20
- package/dist/{tokens-B5NFFL55.js → tokens-MY4GOQ53.js} +2 -2
- package/dist/{transcribe-SBETOIWI.js → transcribe-56WECC4Y.js} +10 -10
- package/dist/{transcribe-WNFRYZAC.js → transcribe-ISCPZLQZ.js} +16 -16
- package/dist/{tts-QSAQZVEZ.js → tts-RE227GFP.js} +1 -1
- package/dist/{updateCheck-5MM2DFUC.js → updateCheck-FAG4T4AV.js} +2 -2
- package/dist/{upgrade-LWID54R3.js → upgrade-5QCPW55B.js} +2 -2
- package/dist/{urlDownloader-CVLNXFDG.js → urlDownloader-FGSJGUM7.js} +8 -8
- package/dist/{validate-V4CGQ6OF.js → validate-WC3FUSUF.js} +25 -25
- package/dist/{video-VJB2KRSS.js → video-DOFSWSSR.js} +9 -9
- package/package.json +1 -1
- package/dist/chunk-WBLXWOYK.js +0 -15
- package/dist/{screenshotCapture-TEUIWXWN.js → screenshotCapture-3JXXUZND.js} +3 -3
|
@@ -5,28 +5,29 @@ var require = __hf_createRequire(import.meta.url);
|
|
|
5
5
|
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
Refusal,
|
|
9
|
+
endTurn,
|
|
10
|
+
historyDeps,
|
|
11
|
+
lastTurnParts,
|
|
12
|
+
withOwner,
|
|
13
|
+
withReader,
|
|
14
|
+
writeTurn
|
|
15
|
+
} from "./chunk-ZQMYD22O.js";
|
|
16
|
+
import {
|
|
9
17
|
HistoryBusyError,
|
|
10
18
|
HistoryIdError,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./chunk-FJWEYVEM.js";
|
|
16
|
-
import "./chunk-AIJS74LG.js";
|
|
17
|
-
import {
|
|
18
|
-
resolveProject
|
|
19
|
-
} from "./chunk-KXX6NLOT.js";
|
|
19
|
+
START
|
|
20
|
+
} from "./chunk-7FYFEXD2.js";
|
|
21
|
+
import "./chunk-FFDC5OWV.js";
|
|
22
|
+
import "./chunk-JQ57FAYN.js";
|
|
20
23
|
import "./chunk-K2FLNJVB.js";
|
|
21
24
|
import {
|
|
22
|
-
AmbiguousPreviewServerError
|
|
23
|
-
findPreviewServerForProject,
|
|
24
|
-
studioApiUrl
|
|
25
|
+
AmbiguousPreviewServerError
|
|
25
26
|
} from "./chunk-DQBY7FRR.js";
|
|
26
27
|
import {
|
|
27
28
|
trackHistoryAction
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-CBMZYOWC.js";
|
|
30
|
+
import "./chunk-AUK5QCRH.js";
|
|
30
31
|
import "./chunk-VWG7OQKU.js";
|
|
31
32
|
import "./chunk-XBSPQ52S.js";
|
|
32
33
|
import {
|
|
@@ -40,12 +41,12 @@ import "./chunk-ZTZA4UWZ.js";
|
|
|
40
41
|
import "./chunk-EOOEC32M.js";
|
|
41
42
|
import {
|
|
42
43
|
withMeta
|
|
43
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-YI6OBVWQ.js";
|
|
44
45
|
import "./chunk-K4WIOZFP.js";
|
|
45
46
|
import "./chunk-XUXGIA7H.js";
|
|
46
47
|
import "./chunk-WERLJGIC.js";
|
|
47
48
|
import "./chunk-ISN5GRYI.js";
|
|
48
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-2X3UJ4Q3.js";
|
|
49
50
|
import "./chunk-EOVYQ3IG.js";
|
|
50
51
|
import "./chunk-AMKC3AXA.js";
|
|
51
52
|
import "./chunk-JYVGYKXG.js";
|
|
@@ -57,183 +58,9 @@ import "./chunk-M2WBOQ2Q.js";
|
|
|
57
58
|
|
|
58
59
|
// src/commands/history.ts
|
|
59
60
|
import { spawnSync } from "child_process";
|
|
60
|
-
import { mkdirSync
|
|
61
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "fs";
|
|
61
62
|
import { tmpdir } from "os";
|
|
62
|
-
import { dirname as dirname2, join as join2 } from "path";
|
|
63
|
-
|
|
64
|
-
// src/utils/historyOwner.ts
|
|
65
|
-
import { randomUUID } from "crypto";
|
|
66
|
-
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
|
|
67
63
|
import { dirname, join } from "path";
|
|
68
|
-
var historyDeps = {
|
|
69
|
-
historyRoot: DEFAULT_HISTORY_ROOT,
|
|
70
|
-
findServer: (projectDir) => findPreviewServerForProject(projectDir),
|
|
71
|
-
/** A turn with no write for this long has ended, through a preview or not. */
|
|
72
|
-
turnIdleMs: MAX_WINDOW_IDLE_MS,
|
|
73
|
-
ownerWaitMs: void 0,
|
|
74
|
-
now: () => Date.now()
|
|
75
|
-
};
|
|
76
|
-
var Refusal = class extends Error {
|
|
77
|
-
};
|
|
78
|
-
var turnFile = (dir) => join(dir, ".hyperframes", "history-turn.json");
|
|
79
|
-
function readTurn(dir) {
|
|
80
|
-
try {
|
|
81
|
-
const turn = JSON.parse(readFileSync(turnFile(dir), "utf-8"));
|
|
82
|
-
return typeof turn.lastWriteAt === "number" ? { ...turn, parts: turn.parts ?? [] } : null;
|
|
83
|
-
} catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function writeTurn(dir, turn) {
|
|
88
|
-
if (!turn) return rmSync(turnFile(dir), { force: true });
|
|
89
|
-
mkdirSync(dirname(turnFile(dir)), { recursive: true });
|
|
90
|
-
writeFileSync(turnFile(dir), JSON.stringify(turn));
|
|
91
|
-
}
|
|
92
|
-
var lastTurnsFile = (dir) => join(dir, ".hyperframes", "history-turns.json");
|
|
93
|
-
function readLastTurns(dir) {
|
|
94
|
-
try {
|
|
95
|
-
const turns = JSON.parse(readFileSync(lastTurnsFile(dir), "utf-8"));
|
|
96
|
-
return turns && typeof turns === "object" ? turns : {};
|
|
97
|
-
} catch {
|
|
98
|
-
return {};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function lastTurnParts(dir, name) {
|
|
102
|
-
return readLastTurns(dir)[name] ?? null;
|
|
103
|
-
}
|
|
104
|
-
var samePart = (a, b) => a.who.kind === b.who.kind && a.who.name === b.who.name && a.label === b.label && a.startedAt === b.startedAt;
|
|
105
|
-
async function endTurn(owner, turn, dir) {
|
|
106
|
-
const entry = await owner.end(turn.id);
|
|
107
|
-
const cut = (await owner.list()).filter((other) => samePart(other, entry ?? turn));
|
|
108
|
-
const own = entry ? [entry.id] : [];
|
|
109
|
-
const parts = [.../* @__PURE__ */ new Set([...turn.parts, ...cut.map((part) => part.id), ...own])];
|
|
110
|
-
const draft = `${lastTurnsFile(dir)}.${process.pid}.tmp`;
|
|
111
|
-
mkdirSync(dirname(draft), { recursive: true });
|
|
112
|
-
writeFileSync(draft, JSON.stringify({ ...readLastTurns(dir), [turn.who.name]: parts }));
|
|
113
|
-
renameSync(draft, lastTurnsFile(dir));
|
|
114
|
-
writeTurn(dir, null);
|
|
115
|
-
return { entry, parts };
|
|
116
|
-
}
|
|
117
|
-
function previewOwner(route) {
|
|
118
|
-
const call = async (path, body) => {
|
|
119
|
-
const init = body && {
|
|
120
|
-
method: "POST",
|
|
121
|
-
headers: { "content-type": "application/json" },
|
|
122
|
-
body: JSON.stringify(body)
|
|
123
|
-
};
|
|
124
|
-
const response = await fetch(route(path), init);
|
|
125
|
-
if (response.ok) return response;
|
|
126
|
-
const error = await response.json().catch(() => null);
|
|
127
|
-
throw new Refusal(error?.error ?? `The preview answered ${response.status}.`);
|
|
128
|
-
};
|
|
129
|
-
const json = async (path, body) => (await call(path, body)).json();
|
|
130
|
-
const list = async () => (await json("")).entries;
|
|
131
|
-
return {
|
|
132
|
-
via: "preview",
|
|
133
|
-
list,
|
|
134
|
-
peek: async (point) => (await json(`/peek/${encodeURIComponent(point)}`)).files,
|
|
135
|
-
blob: async (hash) => Buffer.from(await (await call(`/blob/${hash}`)).arrayBuffer()),
|
|
136
|
-
undo: (id, who, mode) => json("/undo", { entryId: id, who, mode }),
|
|
137
|
-
restore: (point, who) => json("/restore", { point, who }),
|
|
138
|
-
pin: async (id, pinned) => void await json("/pin", { entryId: id, pinned }),
|
|
139
|
-
begin: async (who, label) => {
|
|
140
|
-
const opened = await json("/window", { who, label, idleMs: historyDeps.turnIdleMs });
|
|
141
|
-
return { id: opened.windowId, startedAt: opened.startedAt ?? historyDeps.now() };
|
|
142
|
-
},
|
|
143
|
-
// A preview restarted since begin committed the window on its way down.
|
|
144
|
-
end: (id) => json(`/window/${id}/close`, {}).then((closed) => closed.entry).catch(async () => (await list()).find((entry) => entry.id === id) ?? null),
|
|
145
|
-
close: async () => {
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
async function directOwner(projectDir, turn) {
|
|
150
|
-
const history = await openProjectHistory({
|
|
151
|
-
projectDir,
|
|
152
|
-
historyRoot: historyDeps.historyRoot,
|
|
153
|
-
now: () => historyDeps.now(),
|
|
154
|
-
pruneGoneProjectsBudgetMs: 1e3,
|
|
155
|
-
ownerWaitMs: historyDeps.ownerWaitMs,
|
|
156
|
-
// A turn begun through a preview that has since stopped is still the agent's, until its idle limit.
|
|
157
|
-
...turn && {
|
|
158
|
-
closedWindow: {
|
|
159
|
-
id: turn.id,
|
|
160
|
-
who: turn.who,
|
|
161
|
-
label: turn.label,
|
|
162
|
-
startedAt: turn.startedAt,
|
|
163
|
-
lastWriteAt: turn.lastWriteAt,
|
|
164
|
-
idleMs: historyDeps.turnIdleMs
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
return {
|
|
169
|
-
via: "direct",
|
|
170
|
-
list: async () => history.list(),
|
|
171
|
-
peek: async (point) => history.peek(point),
|
|
172
|
-
blob: (hash) => history.readBlob(hash),
|
|
173
|
-
undo: (id, who, mode) => history.undo(id, { who, ...mode && { mode } }),
|
|
174
|
-
restore: (point, who) => history.restore(point, who),
|
|
175
|
-
pin: async (id, pinned) => history.pin(id, pinned),
|
|
176
|
-
// Opening filed every earlier write; the turn's own writes are filed to it when the next open passes it.
|
|
177
|
-
begin: async () => ({ id: randomUUID(), startedAt: historyDeps.now() }),
|
|
178
|
-
end: async (id) => history.list().find((entry) => entry.id === id) ?? null,
|
|
179
|
-
close: () => history.close()
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
async function connect(projectDir, turn) {
|
|
183
|
-
const server = await historyDeps.findServer(projectDir);
|
|
184
|
-
if (server) {
|
|
185
|
-
const route = (path) => studioApiUrl(server, `history${path}`);
|
|
186
|
-
const status = await fetch(route("")).then(
|
|
187
|
-
(response) => response.status,
|
|
188
|
-
() => 404
|
|
189
|
-
);
|
|
190
|
-
if (status !== 404) return previewOwner(route);
|
|
191
|
-
}
|
|
192
|
-
return directOwner(projectDir, turn);
|
|
193
|
-
}
|
|
194
|
-
async function withOwner(dir, task) {
|
|
195
|
-
const { dir: projectDir } = resolveProject(dir);
|
|
196
|
-
const turn = readTurn(projectDir);
|
|
197
|
-
const owner = await connect(projectDir, turn);
|
|
198
|
-
try {
|
|
199
|
-
return await task(owner, turn, projectDir);
|
|
200
|
-
} finally {
|
|
201
|
-
const direct = owner.via === "direct" && turn;
|
|
202
|
-
let kept;
|
|
203
|
-
try {
|
|
204
|
-
kept = direct ? (await owner.list()).find((entry) => entry.id === turn.id) : void 0;
|
|
205
|
-
} finally {
|
|
206
|
-
await owner.close();
|
|
207
|
-
}
|
|
208
|
-
if (direct && readTurn(projectDir)?.id === turn.id) {
|
|
209
|
-
const lastWriteAt = kept ? kept.endedAt : turn.lastWriteAt;
|
|
210
|
-
const parts = kept ? [...turn.parts, kept.id] : turn.parts;
|
|
211
|
-
writeTurn(projectDir, { ...turn, via: "direct", id: randomUUID(), lastWriteAt, parts });
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
async function withReader(dir, task) {
|
|
216
|
-
try {
|
|
217
|
-
return await withOwner(dir, (owner) => task(owner));
|
|
218
|
-
} catch (error) {
|
|
219
|
-
if (!(error instanceof HistoryBusyError)) throw error;
|
|
220
|
-
}
|
|
221
|
-
const view = readProjectHistory({
|
|
222
|
-
projectDir: resolveProject(dir).dir,
|
|
223
|
-
historyRoot: historyDeps.historyRoot
|
|
224
|
-
});
|
|
225
|
-
return task({
|
|
226
|
-
via: "direct",
|
|
227
|
-
list: async () => view.list(),
|
|
228
|
-
peek: async (point) => view.peek(point),
|
|
229
|
-
// The owner may have pruned a blob since its log was read.
|
|
230
|
-
blob: (hash) => view.readBlob(hash).catch((error) => {
|
|
231
|
-
throw error.code === "ENOENT" ? new Refusal("That point is no longer kept") : error;
|
|
232
|
-
})
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// src/commands/history.ts
|
|
237
64
|
var examples = [
|
|
238
65
|
[
|
|
239
66
|
"What changed since your last turn, and who changed it",
|
|
@@ -260,6 +87,25 @@ function lastIndex(items, match) {
|
|
|
260
87
|
for (let index = items.length - 1; index >= 0; index -= 1) if (match(items[index])) return index;
|
|
261
88
|
return -1;
|
|
262
89
|
}
|
|
90
|
+
async function latestWrite(owner, turn) {
|
|
91
|
+
const entries = await owner.list();
|
|
92
|
+
return entries.reduce((latest, entry) => {
|
|
93
|
+
const same = entry.id === turn.id || turn.parts.includes(entry.id) || entry.who.kind === turn.who.kind && entry.who.name === turn.who.name && entry.label === turn.label && entry.startedAt === turn.startedAt;
|
|
94
|
+
return same ? Math.max(latest, entry.endedAt) : latest;
|
|
95
|
+
}, turn.lastWriteAt);
|
|
96
|
+
}
|
|
97
|
+
async function releaseOpenTurn(owner, turn, who, exclusive, projectDir) {
|
|
98
|
+
if (!turn) return;
|
|
99
|
+
if (owner.via !== "direct") {
|
|
100
|
+
if (!exclusive || turn.who.name === who.name) await endTurn(owner, turn, projectDir);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const latest = await latestWrite(owner, turn);
|
|
104
|
+
const live = historyDeps.now() - latest <= historyDeps.turnIdleMs;
|
|
105
|
+
if (exclusive && live && turn.who.name !== who.name)
|
|
106
|
+
throw new Refusal(`${turn.who.name}'s turn is open; it has to end before yours begins`);
|
|
107
|
+
await endTurn(owner, turn, projectDir);
|
|
108
|
+
}
|
|
263
109
|
function entryOf(entries, ref) {
|
|
264
110
|
const found = entries.filter((entry) => entry.id.startsWith(ref));
|
|
265
111
|
if (found.length === 1) return found[0];
|
|
@@ -297,6 +143,12 @@ function ago(at) {
|
|
|
297
143
|
if (seconds < 86400) return `${Math.round(seconds / 3600)}h ago`;
|
|
298
144
|
return `${Math.round(seconds / 86400)}d ago`;
|
|
299
145
|
}
|
|
146
|
+
function endedTurnText(entry, parts) {
|
|
147
|
+
const earlier = parts.length - (entry ? 1 : 0);
|
|
148
|
+
const text = entry ? line(entry) : earlier ? "Nothing changed since this turn's last command." : "Nothing changed in this turn.";
|
|
149
|
+
return earlier ? `${text}
|
|
150
|
+
(+${earlier} earlier part${earlier > 1 ? "s" : ""})` : text;
|
|
151
|
+
}
|
|
300
152
|
function line(entry) {
|
|
301
153
|
const paths = entry.files.map((file) => file.path);
|
|
302
154
|
const files = paths.slice(0, 2).join(", ") + (paths.length > 2 ? ` +${paths.length - 2}` : "");
|
|
@@ -318,7 +170,7 @@ function print(json, data, text) {
|
|
|
318
170
|
console.log(json ? JSON.stringify(withMeta(data), null, 2) : text);
|
|
319
171
|
}
|
|
320
172
|
async function textDiff(reader, entry) {
|
|
321
|
-
const work = mkdtempSync(
|
|
173
|
+
const work = mkdtempSync(join(tmpdir(), "hf-history-diff-"));
|
|
322
174
|
try {
|
|
323
175
|
const out = [];
|
|
324
176
|
for (const file of entry.files) {
|
|
@@ -330,9 +182,9 @@ async function textDiff(reader, entry) {
|
|
|
330
182
|
continue;
|
|
331
183
|
}
|
|
332
184
|
const [a, b] = ["a", "b"].map((side, index) => {
|
|
333
|
-
const path =
|
|
334
|
-
|
|
335
|
-
|
|
185
|
+
const path = join(side, file.path);
|
|
186
|
+
mkdirSync(dirname(join(work, path)), { recursive: true });
|
|
187
|
+
writeFileSync(join(work, path), sides[index]);
|
|
336
188
|
return path;
|
|
337
189
|
});
|
|
338
190
|
const diff = spawnSync("git", ["diff", "--no-index", "--no-color", "--no-prefix", a, b], {
|
|
@@ -344,7 +196,7 @@ async function textDiff(reader, entry) {
|
|
|
344
196
|
}
|
|
345
197
|
return out.join("\n");
|
|
346
198
|
} finally {
|
|
347
|
-
|
|
199
|
+
rmSync(work, { recursive: true, force: true });
|
|
348
200
|
}
|
|
349
201
|
}
|
|
350
202
|
function conflictText(entry, newer, files, again) {
|
|
@@ -537,11 +389,23 @@ ${diff ?? marks.join("\n")}`
|
|
|
537
389
|
begin: () => sub(
|
|
538
390
|
"begin",
|
|
539
391
|
"Start a turn: your writes until `end` become one entry under your name",
|
|
540
|
-
{
|
|
392
|
+
{
|
|
393
|
+
who: { type: "string", required: true },
|
|
394
|
+
label: { type: "string", required: true },
|
|
395
|
+
exclusive: {
|
|
396
|
+
type: "boolean",
|
|
397
|
+
default: false,
|
|
398
|
+
description: "Refuse while another agent's turn is open, instead of ending it"
|
|
399
|
+
}
|
|
400
|
+
},
|
|
541
401
|
(args) => withOwner2("begin", args.dir, async (owner, turn, projectDir) => {
|
|
542
|
-
if (turn) await endTurn(owner, turn, projectDir);
|
|
543
402
|
const who = whoOf(args.who);
|
|
544
|
-
|
|
403
|
+
await releaseOpenTurn(owner, turn, who, args.exclusive, projectDir);
|
|
404
|
+
const { id, startedAt } = await owner.begin(
|
|
405
|
+
who,
|
|
406
|
+
args.label,
|
|
407
|
+
args.exclusive && owner.via === "preview"
|
|
408
|
+
);
|
|
545
409
|
writeTurn(projectDir, {
|
|
546
410
|
via: owner.via,
|
|
547
411
|
id,
|
|
@@ -557,17 +421,25 @@ ${diff ?? marks.join("\n")}`
|
|
|
557
421
|
end: () => sub(
|
|
558
422
|
"end",
|
|
559
423
|
"End your turn and print its entry",
|
|
560
|
-
{
|
|
424
|
+
{
|
|
425
|
+
who: { type: "string", description: "Refuse unless the open turn is this agent's" },
|
|
426
|
+
"if-open": {
|
|
427
|
+
type: "boolean",
|
|
428
|
+
default: false,
|
|
429
|
+
description: "Succeed with no entry when no turn is open"
|
|
430
|
+
}
|
|
431
|
+
},
|
|
561
432
|
(args) => withOwner2("end", args.dir, async (owner, turn, projectDir) => {
|
|
433
|
+
if (!turn && args.ifOpen)
|
|
434
|
+
return print(args.json, { entry: null, parts: [] }, "No turn is open.");
|
|
562
435
|
if (!turn) throw new Refusal("No turn is open; start one with history begin");
|
|
436
|
+
if (args.who !== void 0 && turn.who.name !== args.who)
|
|
437
|
+
throw new Refusal(`The open turn is ${turn.who.name}'s, not ${args.who}'s`);
|
|
563
438
|
const { entry, parts } = await endTurn(owner, turn, projectDir);
|
|
564
|
-
const earlier = parts.length - (entry ? 1 : 0);
|
|
565
|
-
const text = entry ? line(entry) : earlier ? "Nothing changed since this turn's last command." : "Nothing changed in this turn.";
|
|
566
439
|
print(
|
|
567
440
|
args.json,
|
|
568
441
|
{ entry: entry && publicEntry(entry), parts },
|
|
569
|
-
|
|
570
|
-
(+${earlier} earlier part${earlier > 1 ? "s" : ""})` : text
|
|
442
|
+
endedTurnText(entry, parts)
|
|
571
443
|
);
|
|
572
444
|
})
|
|
573
445
|
)
|
|
@@ -312,12 +312,16 @@ ${Ou("",e)}
|
|
|
312
312
|
var __hfBaseHyperframes = window.__hyperframes;
|
|
313
313
|
var __hfScopedHyperframes = ${u0};
|
|
314
314
|
var __hfRun = function() {
|
|
315
|
+
var report = window.__hfScriptState;
|
|
316
|
+
if (typeof report === "function") report("start", __hfCompositionSrc || "index.html");
|
|
315
317
|
try {
|
|
316
318
|
(function(document, gsap, window, __hyperframes) {
|
|
317
319
|
${e.replace(/<\/(script)/gi,"<\\/$1")}
|
|
318
320
|
}).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);
|
|
319
321
|
} catch (_err) {
|
|
320
322
|
console.error(__hfErrorLabel, __hfCompId, _err);
|
|
323
|
+
} finally {
|
|
324
|
+
if (typeof report === "function") report("finish", __hfCompositionSrc || "index.html");
|
|
321
325
|
}
|
|
322
326
|
};
|
|
323
327
|
// What the script started on the global gsap timeline, by any route, for a scene swap to revert.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "4042fe30acc3f58fb1b80dc0a7681ae6d101993d01e43d47f4a933b19dcb49e7",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|
|
@@ -312,12 +312,16 @@ ${Ou("",e)}
|
|
|
312
312
|
var __hfBaseHyperframes = window.__hyperframes;
|
|
313
313
|
var __hfScopedHyperframes = ${u0};
|
|
314
314
|
var __hfRun = function() {
|
|
315
|
+
var report = window.__hfScriptState;
|
|
316
|
+
if (typeof report === "function") report("start", __hfCompositionSrc || "index.html");
|
|
315
317
|
try {
|
|
316
318
|
(function(document, gsap, window, __hyperframes) {
|
|
317
319
|
${e.replace(/<\/(script)/gi,"<\\/$1")}
|
|
318
320
|
}).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);
|
|
319
321
|
} catch (_err) {
|
|
320
322
|
console.error(__hfErrorLabel, __hfCompId, _err);
|
|
323
|
+
} finally {
|
|
324
|
+
if (typeof report === "function") report("finish", __hfCompositionSrc || "index.html");
|
|
321
325
|
}
|
|
322
326
|
};
|
|
323
327
|
// What the script started on the global gsap timeline, by any route, for a scene swap to revert.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var HyperframesPlayer=(()=>{var We=Object.defineProperty;var Jn=Object.getOwnPropertyDescriptor;var Zn=Object.getOwnPropertyNames;var Qn=Object.prototype.hasOwnProperty;var ei=(n,e)=>{for(var t in e)We(n,t,{get:e[t],enumerable:!0})},ti=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Zn(e))!Qn.call(n,r)&&r!==t&&We(n,r,{get:()=>e[r],enumerable:!(i=Jn(e,r))||i.enumerable});return n};var ni=n=>ti(We({},"__esModule",{value:!0}),n);var zr={};ei(zr,{HyperframesPlayer:()=>He,SPEED_PRESETS:()=>ut,formatSpeed:()=>ae,formatTime:()=>Ie});var Ct=n=>n!==null&&Number.isFinite(n)&&n>0;function _e(n){let e=n.clipEndsSeconds.filter(i=>i===null).length;if(Ct(n.authoredDurationSeconds))return{seconds:n.authoredDurationSeconds,source:"authored",pendingClips:e};let t=n.clipEndsSeconds.filter(Ct);return t.length>0?{seconds:Math.max(...t),source:"derived",pendingClips:e}:{seconds:null,source:"unresolved",pendingClips:e,reason:e>0?"every clip's length is still pending":"no authored duration and no clip with a length"}}var ii="http://www.w3.org/1999/xhtml";function Dt(n){return n!=null&&n.nodeType===1}function Ge(n){return Dt(n)&&n.namespaceURI===ii}function Be(n,e){return Ge(n)&&n.localName===e}function ri(n){return Be(n,"video")}function oi(n){return Be(n,"audio")}function M(n){return ri(n)||oi(n)}function $e(n){return Be(n,"img")}function ye(n){if(n==null||n.trim()==="")return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function ve(n=document){let e=n.querySelector('[data-composition-id][data-root="true"]');return Ge(e)?e:n.querySelector("[data-composition-id]")}var V=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),Jr=Object.freeze([V.start,V.duration,V.trackIndex]),Zr=Object.freeze([V.derivedEnd]),Qr=Object.freeze([V.derivedEnd,V.legacyTrack]);function ze(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Nt=n=>{let e=ze(n);return e!==null&&e>=0?e:null};function Ae(n){return Nt(n("data-playback-start"))??Nt(n("data-media-start"))??0}var X=.1,K=10;function je(n){return Number.isFinite(n)&&n>0?Math.max(X,Math.min(K,n)):1}function Pt(n,e=1){let t=Number.parseFloat(n("data-playback-rate")??"");return je(Number.isFinite(t)&&t>0?t:e)}function qe(n){let e=ze(n("data-duration"));return e!==null&&e>0?e:null}function Lt(n,e){let t=qe(n);if(t!==null)return t;let i=ze(n("data-end"));return i!==null?i-e:null}var ai=3;function Ye(n,e,t){return Number.isFinite(n)?Math.max(0,n-e)/je(t):null}function Xe(n){let{tag:e,authoredDurationSeconds:t,sourceDurationSeconds:i,mediaStartSeconds:r,playbackRate:o}=n;if(t!==null&&t>0)return{seconds:t,source:"authored"};if(e==="img")return{seconds:ai,source:"default"};if(i===null)return{seconds:null,source:"pending",reason:"source duration not yet probed"};let a=Ye(i,r,o);return a===null?{seconds:null,source:"pending",reason:"source reported a non-finite duration"}:{seconds:a,source:"media"}}var Ft="data-fx-chain",to=Ft.slice(5);var J=(n="frequency",e="Frequency",t=1e3,i=20,r=2e4)=>({kind:"number",key:n,label:e,unit:"Hz",min:i,max:r,step:1,default:t,scale:"log",automatable:!0}),Ke=(n=.707,e="Bandwidth: higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:n,scale:"log",automatable:!0,hint:e}),Se=(n=-40,e=40,t=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:n,max:e,step:.1,default:t,automatable:!0}),Ot={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},Vt=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Se(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[J("frequency","Frequency",1e3),Se(-40,40,0),Ke(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[J("frequency","Frequency",200,20,2e3),Se(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[J("frequency","Frequency",4e3,500,2e4),Se(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies: the usual fix for rumble on a voice.",params:[J("frequency","Cutoff",300,20,2e4),Ke(.707),Ot],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies, which darkens or muffles a track.",params:[J("frequency","Cutoff",8e3,100,2e4),Ke(.707),Ot],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Peak limiter that follows the signal's level. It has no lookahead, so a fast peak or an inter-sample peak can pass the ceiling; use the true-peak limiter for a delivery limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"truepeak",label:"True-peak limiter",group:"dynamics",description:"Lookahead limiter that holds a 4x estimate of the inter-sample peak at a dBTP ceiling; full-band noise can land up to about 1.7 dB above it. Adds lookahead plus about 0.3 ms of latency.",params:[{kind:"number",key:"ceiling",label:"Ceiling",unit:"dBTP",min:-24,max:0,step:.1,default:-1,hint:"Target true peak, measured on a 4x oversampled signal. Dense full-band sound can end up to about 1.7 dB above it."},{kind:"number",key:"lookahead",label:"Lookahead",unit:"ms",min:.5,max:10,step:.1,default:3,hint:"How far ahead the gain starts falling. Longer is smoother and adds the same latency."},{kind:"number",key:"release",label:"Release",unit:"ms",min:10,max:2e3,step:1,default:80,scale:"log"}],web:"worklet-truepeak"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times, a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],no=new Map(Vt.map(n=>[n.id,n]));var io=Vt.map(n=>n.id);function si(n){return 10**(n/20)}var Ut=si(12);var Ze="data-automation",po=Ze.slice(5),Je=1,ui=512,I=class extends Error{constructor(e){super(e),this.name="AudioAutomationError"}},Ee="volume",Te="rate";function Ht(n){if(n===Ee)return{kind:"volume"};if(n===Te)return{kind:"rate"};let e=n.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===li){let r=e[2];return r?{kind:"preset",presetId:r}:null}if(e.length!==3||e[0]!=="fx")return null;let[,t,i]=e;return!t||!i?null:{kind:"fx",nodeId:t,param:i}}var li="preset";var di={min:0,max:Ut,step:.01,unit:"",label:"Volume",scale:"linear",default:1},ci={min:X,max:K,step:.05,unit:"x",label:"Speed",scale:"log",default:1};function Z(n){if(typeof n=="number")return Number.isFinite(n)?n:null;if(typeof n=="string"&&n.trim()!==""){let e=Number(n);return Number.isFinite(e)?e:null}return null}function mi(n){let e=Z(n);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function Wt(n,e){let t=Z(n),i=Z(e);if(t===null||i===null)return null;let r=s=>Math.min(.999,Math.max(.001,s)),o=r(t),a=r(i);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function pi(n){let e=mi(n?.curve),t=Wt(n?.viaX,n?.viaY);return{...e?{curve:e}:{},...t?{viaX:t.x,viaY:t.y}:{}}}function fi(n,e){let t=Z(n?.t),i=Z(n?.v);if(t===null||i===null)return null;let r=e?Math.min(e.max,Math.max(e.min,i)):i;return{t:Math.max(0,t),v:r,...pi(n)}}function hi(n,e){let t=n.map(r=>fi(r,e)).filter(r=>r!==null).sort((r,o)=>r.t-o.t),i=[];for(let r of t)i.length>0&&i[i.length-1].t===r.t?i[i.length-1]=r:i.push(r);return i.slice(0,ui)}function bi(n){let e=[];for(let t of n.lanes){if(!Ht(t.target))continue;let i=t.target===Ee?di:t.target===Te?ci:null,r=hi(t.points??[],i);r.length>0&&e.push({target:t.target,points:r})}return{version:Je,lanes:e}}function Gt(n){let e;try{e=JSON.parse(n)}catch(r){throw new I(`Automation is not valid JSON: ${r.message}`)}if(typeof e!="object"||e===null)throw new I("Automation must be a JSON object.");let t=e;if(t.version!==Je)throw new I(`Unsupported automation version: ${String(t.version)}`);if(!Array.isArray(t.lanes))throw new I("Automation is missing a `lanes` array.");let i=t.lanes.map((r,o)=>{if(typeof r!="object"||r===null)throw new I(`Lane ${o} is not an object.`);let a=r;if(typeof a.target!="string"||!Ht(a.target))throw new I(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new I(`Lane ${o} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return bi({version:Je,lanes:i})}function gi(n,e){return e?Math.pow(n,Math.pow(2,2*e)):n}function _i(n,e){let t=n-.5,i=e-.5,r=.999,o=1e6,a=t>0?t/(r-n):t<0?-t/(n-(1-r)):0,s=i>0?i/(r-e):i<0?-i/(e-(1-r)):0,u=Math.min(o,Math.max(1,a,s));return{cx:n+t/u,cy:e+i/u,w:u}}function yi(n,e,t){let{cx:i,cy:r,w:o}=_i(e,t),a=2-2*o,s=n*a-1+2*o*i,u=-n*a-2*o*i,d=vi(s,u,n),m=1-d,g=m*m+2*o*d*m+d*d;return g>0?(2*o*r*d*m+d*d)/g:n}function vi(n,e,t){if(Math.abs(n)<1e-12)return Math.abs(e)<1e-12?t:-t/e;let i=Math.sqrt(Math.max(0,e*e-4*n*t)),r=(-e+i)/(2*n),o=(-e-i)/(2*n),a=s=>s>=-1e-9&&s<=1+1e-9;return a(r)?Math.min(1,Math.max(0,r)):a(o)?Math.min(1,Math.max(0,o)):t}function Ai(n,e){let t=Wt(e.viaX,e.viaY);return t?yi(Math.min(1,Math.max(0,n)),t.x,t.y):gi(n,e.curve)}function Si(n,e,t,i){return i==="log"&&n>0&&e>0?Math.exp(Math.log(n)+(Math.log(e)-Math.log(n))*t):n+(e-n)*t}function Re(n,e,t="linear"){let i=n.points;if(i.length===0)return 0;let r=i[0];if(e<=r.t)return r.v;let o=i[i.length-1];if(e>=o.t)return o.v;let a=0,s=i.length-1;for(;s-a>1;){let g=a+s>>1;i[g].t<=e?a=g:s=g}let u=i[a],d=i[s],m=d.t-u.t;return m<=0?d.v:Si(u.v,d.v,Ai((e-u.t)/m,u),t)}var xe=new Map,Ei=64;function Bt(n,e=Ee){let t=`${e}\0${n}`,i=xe.get(t);if(i!==void 0)return i;let r=null;try{r=Gt(n).lanes.find(o=>o.target===e)??null}catch{r=null}return xe.size>Ei&&xe.clear(),xe.set(t,r),r}var $t=48,zt=new WeakMap;function Ti(n){let e=n.points,t=e[0].v,i=e[e.length-1].v,r=[0],o=[0],a=u=>{let d=r[r.length-1];if(u<=d)return;let m=Re(n,d,"log");r.push(u),o.push(o[o.length-1]+(m+Re(n,u,"log"))/2*(u-d))},s=Math.max(0,e[0].t);a(s);for(let u=1;u<e.length;u+=1){let d=e[u-1].t,m=e[u].t;if(!(m<=0))for(let g=1;g<=$t;g+=1)a(Math.max(d,0)+(m-d)*g/$t)}return{ts:Float64Array.from(r),ss:Float64Array.from(o),firstRate:t,lastRate:i}}function Ri(n){let e=zt.get(n);return e||(e=Ti(n),zt.set(n,e)),e}function xi(n){return typeof n!="number"&&n.points.length>0}function wi(n,e,t){let i=0,r=n.length-1;for(;r-i>1;){let o=i+r>>1;n[o]<=t?i=o:r=o}return e[i]+(e[r]-e[i])*(t-n[i])/(n[r]-n[i])}function Qe(n,e){if(typeof n=="number")return e/n;if(!xi(n))return e;let{ts:t,ss:i,firstRate:r,lastRate:o}=Ri(n),a=t.length-1;return e<=0?e/r:e>=i[a]?t[a]+(e-i[a])/o:wi(i,t,e)}function ki(n){return n?Bt(n,Te):null}function jt(n,e){return ki(n)??e}var vo=[{id:"montage",label:"Montage",points:[[0,.9],[.15,.3],[.5,2.5],[.85,.3],[1,.9]]},{id:"hero",label:"Hero",points:[[0,1],[.25,1.6],[.5,.25],[.75,1.6],[1,1]]},{id:"bullet",label:"Bullet",points:[[0,3],[.4,3],[.5,.15],[.6,3],[1,3]]},{id:"jump-cut",label:"Jump cut",points:[[0,.5],[.24,.5],[.26,3],[.5,3],[.52,.5],[.74,.5],[.76,3],[1,3]]},{id:"flash-in",label:"Flash in",points:[[0,.3],[.6,.6],[1,5]]},{id:"flash-out",label:"Flash out",points:[[0,5],[.4,.6],[1,.3]]},{id:"ramp-in",label:"Ramp in",points:[[0,.5],[1,1]]},{id:"ramp-out",label:"Ramp out",points:[[0,1],[1,.5]]},{id:"slowmo-middle",label:"Slow-mo middle",points:[[0,1],[1/3,.35],[2/3,.35],[1,1]]}];var v=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),So=Object.freeze([v.start,v.duration,v.trackIndex]),Eo=Object.freeze([v.derivedEnd]),To=Object.freeze([v.derivedEnd,v.legacyTrack]);function C(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Xt=/^[A-Za-z0-9_.:-]+$/;function Kt(n,e){let t=n.charCodeAt(e);return t>=48&&t<=57}function qt(n,e){let t=e;for(;t>=0&&Kt(n,t);)t--;return t}function Mi(n,e){let t=e;for(;t>=0&&(n[t]??"").trim()==="";)t--;return t}function Ii(n){let e=n.length-1;if(!Kt(n,e))return null;let t=qt(n,e);return n[t]==="."&&(t=qt(n,t-1)),t+1}function Ci(n){let e=Ii(n);if(e==null)return null;let t=Mi(n,e-1),i=n[t];if(i!=="+"&&i!=="-")return null;let r=n.slice(0,t).trim();if(!Xt.test(r))return null;let o=Number(n.slice(e));return Number.isFinite(o)?{refId:r,operator:i,magnitude:o}:null}function Q(n){let e=(n??"").trim();if(!e)return null;let t=C(e);if(t!=null)return{kind:"absolute",value:t};if(Xt.test(e))return{kind:"reference",refId:e,offset:0};let i=Ci(e);return i?{kind:"reference",refId:i.refId,offset:i.operator==="-"?-i.magnitude:i.magnitude}:null}function T(n,e,t,i){n.push({code:e,attribute:t,value:i})}function Di(n,e,t,i){if(e==null||e.trim()==="")return t.defaultStart===void 0?0:t.defaultStart;if(!n)return T(i,"invalid-start",v.start,e),null;if(n.kind==="absolute")return Math.max(0,n.value);let r=t.resolveReferenceEnd?.(n.refId);return r==null||!Number.isFinite(r)?(T(i,"unresolved-start-reference",v.start,e),null):Math.max(0,r+n.offset)}var Ni=1e-9;function Pi(n,e){return Math.abs(n-e)<=Ni}function Li(n,e,t){let i=C(n);if(i==null){T(t,"deprecated-end",v.derivedEnd,n),T(t,"invalid-end",v.derivedEnd,n);return}if(e==null){T(t,"deprecated-end",v.derivedEnd,n);return}Pi(i,e)||(T(t,"deprecated-end",v.derivedEnd,n),T(t,"conflicting-end",v.derivedEnd,n))}function Oi(n,e,t){let i=C(n);return i==null||i<0?(T(t,"invalid-duration",v.duration,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i,end:e==null?null:e+i,durationSource:"duration"}}function Fi(n,e,t){T(t,"deprecated-end",v.derivedEnd,n);let i=C(n);return i==null?(T(t,"invalid-end",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):e==null?{duration:null,end:i,durationSource:"legacy-end"}:i<e?(T(t,"end-before-start",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i-e,end:i,durationSource:"legacy-end"}}function Vi(n,e,t){let i=n.getAttribute(v.duration),r=n.getAttribute(v.derivedEnd);if(i==null)return r==null?{duration:null,end:null,durationSource:"missing"}:Fi(r,e,t);let o=Oi(i,e,t);return r!=null&&Li(r,o.end,t),o}function Yt(n,e,t,i){let r=C(n);return r==null||!Number.isInteger(r)?(T(i,"invalid-track-index",e,n),{trackIndex:0,trackSource:"invalid"}):{trackIndex:r,trackSource:t}}function Ui(n,e){let t=n.getAttribute(v.trackIndex),i=n.getAttribute(v.legacyTrack);if(t==null&&i==null)return{trackIndex:0,trackSource:"default"};if(t==null&&i!=null)return T(e,"deprecated-layer",v.legacyTrack,i),Yt(i,v.legacyTrack,"legacy-layer",e);let r=Yt(t??"",v.trackIndex,"track-index",e);if(i==null)return r;T(e,"deprecated-layer",v.legacyTrack,i);let o=C(i);return o!=null&&o!==r.trackIndex&&T(e,"conflicting-layer",v.legacyTrack,i),r}function et(n,e={}){let t=[],i=n.getAttribute(v.start),r=Q(i),o=Di(r,i,e,t),a=Vi(n,o,t),s=Ui(n,t);return{startExpression:r,start:o,...a,...s,diagnostics:t}}function P(n){return C(n)}function ee(n){return Pt(e=>n.getAttribute(e),M(n)?n.defaultPlaybackRate:1)}function tt(n){return jt(n.getAttribute("data-automation"),ee(n))}function nt(n){return Ae(e=>n.getAttribute(e))}function U(n,e){return Hi(e,nt(n),tt(n))}function it(n){let e=Xe({tag:"video",authoredDurationSeconds:qe(t=>n.getAttribute(t)),sourceDurationSeconds:Number.isFinite(n.duration)?n.duration:null,mediaStartSeconds:nt(n),playbackRate:ee(n)});return e.source==="media"?U(n,n.duration):e.seconds}function we(n,e=0){return!$e(n)||!n.hasAttribute("data-start")&&!n.hasAttribute("data-track-index")?null:Xe({tag:"img",authoredDurationSeconds:Lt(t=>n.getAttribute(t),e),sourceDurationSeconds:null,mediaStartSeconds:0,playbackRate:1}).seconds}function Hi(n,e,t){return typeof t=="number"?Ye(n,e,t):Number.isFinite(n)?Qe(t,Math.max(0,n-e)):null}function Jt(){return globalThis}function te(n,e){if(typeof window>"u")return;let t=Jt(),i=t.__hf?.onSwallowed;if(i)try{i({label:n,error:e})}catch(r){}(t.__hfDebug||t.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${n} swallowed:`,e)}function ne(n){try{if(typeof n?.duration!="function")return null;let e=Number(n.duration());return Number.isFinite(e)?e:null}catch(e){return te("runtime.timelineDuration",e),null}}var Zt="data-hf-authored-duration",Qt="data-hf-authored-end";function ie(n){if(n==null||typeof n=="string"&&n.trim()==="")return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function ke(n){let e=ie(n.start);if(e==null)return null;let t=Math.max(0,e),i=ie(n.duration),r=ie(n.authoredDuration),o=i!=null&&i>0?i:r!=null&&r>0?r:null;if(o!=null)return{start:t,duration:o,end:t+o};let a=ie(n.end),s=ie(n.authoredEnd),u=a!=null&&a>t?a:s!=null&&s>t?s:null;return{start:t,duration:u==null?null:u-t,end:u}}var en="data-hf-media-start-basis";function tn(n){return n?.trim().toLowerCase()==="global"?"global":"local"}function Wi(n){return tn(n.basis)==="global"?n.authoredStart:n.hostStart+n.authoredStart}function nn(n){return on(n)?Wi({authoredStart:n.authoredStart,hostStart:n.hostStart,basis:n.basis}):n.ordinaryStart()}function rn(n){return on(n)&&tn(n.basis)==="global"}function on(n){return!n.hasAutoStart&&n.authoredStart!=null&&n.hostStart!==0}function rt(n){return Ae(e=>n.getAttribute(e))}function an(n,e){return n-rt(e)}function H(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=n.documentRef??document,r=new WeakMap,o=new WeakMap,a=new Set,s=l=>{let f=i.getElementById(l);return f||(Array.from(i.querySelectorAll("[data-composition-id]")).find(_=>_.getAttribute("data-composition-id")===l)??null)},u=(l,f)=>t?l.getAttribute(f):null,d=l=>ke({start:0,duration:l.getAttribute("data-duration"),authoredDuration:u(l,"data-hf-authored-duration")})?.duration??ke({start:R(l,0),end:l.getAttribute("data-end"),authoredEnd:u(l,"data-hf-authored-end")})?.duration??null,m=l=>l!=null&&Number.isFinite(l)&&l>0?l:null,g=l=>{let f=l.getAttribute("data-composition-id");return f?m(ne(e[f])):null},y=l=>{let f=o.get(l);if(f!==void 0)return f;let _=d(l)??m(M(l)?U(l,l.duration):null)??m(we(l))??g(l);return o.set(l,_),_},h=l=>l.hasAttribute("data-composition-src")||l.hasAttribute("data-composition-id")||l.hasAttribute("data-composition-file"),A=l=>{let f=l.parentElement;return!f||!l.hasAttribute("data-composition-id")||Q(l.getAttribute("data-start"))?null:h(f)?f:null},b=(l,f)=>an(R(l,f),A(l)??l),S=(l,f)=>{let _=l.hasAttribute("data-composition-id")?l.parentElement?.closest("[data-composition-id]"):l.closest("[data-composition-id]");return _?b(_,f):0},D=(l,f)=>{let _=Q(l.getAttribute("data-start"));if(!_){let Y=A(l);return Y?R(Y,f):f}if(_.kind==="absolute")return S(l,f)+Math.max(0,_.value);let w=s(_.refId);if(!w)return f;let L=R(w,0),fe=y(w)??0,he=Math.min(0,S(l,0));return Math.max(he,L+fe+_.offset)},R=(l,f)=>{let _=r.get(l);if(_!==void 0)return _??f;if(a.has(l))return f;a.add(l);try{let w=D(l,f);return r.set(l,w),w}finally{a.delete(l)}},k=l=>{let f=l.closest("[data-composition-id]");return{authoredStart:P(l.getAttribute("data-start")),hostStart:f?b(f,0):0,hasAutoStart:l.hasAttribute("data-hf-auto-start"),basis:l.getAttribute(en)}};return{resolveStartForElement:(l,f=0)=>R(l,Math.max(0,f)),resolveDurationForElement:l=>y(l),resolveMediaStartForElement:l=>{let f=k(l);return nn({...f,ordinaryStart:()=>R(l,f.hostStart)})},resolveHostStartForElement:l=>S(l,0),resolveHostSlotsForElement:l=>{let f=[];for(let _=l.parentElement;_;_=_.parentElement){if(!h(_)||A(_)||rt(_)<=0)continue;let w=R(_,0),L=d(_);f.push({start:w,end:L?w+L:1/0})}return f},isRootGlobalMediaStartForElement:l=>M(l)&&rn(k(l))}}function sn(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var un=7200,ot=1/60,re=n=>n!==null&&n>ot?n:null;function Gi(n){return{width:ye(n.getAttribute("data-width")),height:ye(n.getAttribute("data-height"))}}function Bi(n,e){let t=[];for(let i of n.querySelectorAll("video[data-start], audio[data-start]")){let r=e.mediaStart(i);if(!Number.isFinite(r))continue;let o=e.mediaDuration(i);o==null||o<=ot||t.push(Math.max(0,r)+o)}return re(_e({authoredDurationSeconds:null,clipEndsSeconds:t}).seconds)}function $i(n,e){let t=[];for(let r of n.querySelectorAll("[data-composition-id][data-start]")){if(r.parentElement?.closest("[data-composition-id]")!==n)continue;let o=e.resolveStartForElement(r,0),a=e.resolveDurationForElement(r);!Number.isFinite(o)||a==null||a<=0||t.push(Math.max(0,o)+a)}let i=P(n.getAttribute("data-duration"));return re(_e({authoredDurationSeconds:null,clipEndsSeconds:[i,...t]}).seconds)}var zi=n=>n.hasAttribute("data-composition-id")||n.hasAttribute("data-composition-src");function ji(n,e,{unregisteredLottie:t}){let i=[];for(let o of n.querySelectorAll("[data-start]")){let a=e.resolveStartForElement(o,0);if(!Number.isFinite(a))continue;let s=e.resolveDurationForElement(o);s!=null?i.push(Math.max(0,a)+s):(M(o)||zi(o))&&i.push(null)}(t||n.querySelector("[data-lottie-src]"))&&i.push(null);let r=_e({authoredDurationSeconds:null,clipEndsSeconds:i});return r.pendingClips>0?{...r,seconds:null,source:"unresolved",reason:"a clip's length is pending"}:r}function qi(n){if(n.declared!==null&&Number.isFinite(n.declared)&&n.declared>0)return n.declared;let e=re(n.timeline()),t=Math.max(0,...n.floors().map(u=>u??0)),i=Number.isFinite(n.fallback)&&n.fallback>ot?n.fallback:0,r=Math.max(t,i),a=e!==null&&e>=un&&re(r)!==null?null:e,s;return a!==null?s=Math.max(a,r):re(t)!==null?s=r:i>0?s=i:s=n.derived(),s>0?s:0}function ln(n){let e=ve(n);if(!e)return null;let t=H({timelineRegistry:{},includeAuthoredTimingAttrs:!0,documentRef:n}),i=qi({declared:P(e.getAttribute("data-duration")),timeline:()=>null,floors:()=>[Bi(n,{mediaStart:t.resolveMediaStartForElement,mediaDuration:it}),$i(e,t)],fallback:0,derived:()=>ji(e,t,{unregisteredLottie:!1}).seconds??0});return{...Gi(e),fps:sn().canonicalFps,durationSeconds:i}}var dn="hyperframes-studio-preview";var cn="__hfPreviewErrors";function mn(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function W(n){return typeof n=="object"&&n!==null}function pn(n){return W(n)&&typeof n.getDuration=="function"}function fn(n){return W(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var G="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.151/dist/hyperframe.runtime.iife.js";function oe(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function Yi(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=oe(e.getAttribute("data-width")),i=oe(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}function Xi(n){return Array.isArray(n)?n.find(e=>typeof e=="string"&&e.trim()!==""&&e!=="[object Event]")??null:null}var Me=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;_runtimeScript=null;_failure=null;get failed(){return this._failure!==null&&this._failure.document===this._iframe.contentDocument}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._failure=null,this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;let t=null;try{t=this._poll(e)}catch(i){i instanceof DOMException&&i.name==="SecurityError"||(t={kind:"error",message:i instanceof Error?i.message:String(i)})}if(t){this.stop(),t.kind==="error"?(this._failure={document:this._iframe.contentDocument},this._callbacks.onError(t.message)):this._callbacks.onReady(t.result);return}e>=40&&(this.stop(),this._failure={document:this._iframe.contentDocument},this._callbacks.onError("Composition timeline not found after 8s"))},200)}_poll(e){let t=this._iframe.contentWindow;if(!t)return null;let i=Xi(Reflect.get(t,cn));if(i!==null)return{kind:"error",message:i};let r=this._iframe.contentDocument,o=Reflect.get(t,"__timelines"),a=this.hasRuntimeBridge(t);if(mn({hasRuntime:a,hasTimelines:W(o)&&Object.keys(o).length>0,hasNestedCompositions:!!r?.querySelector("[data-composition-src]"),runtimeInjected:this._runtimeInjected,attempts:e}))return this._injectRuntime(),null;if(this._runtimeInjected&&!a)return null;let s=this._resolveReadyResult(t,r);return s?{kind:"ready",result:s}:null}_resolveReadyResult(e,t){let i=this._resolvePlaybackDurationAdapter(e)??{kind:"document",getDuration:()=>0},r=i.getDuration();if(!Number.isFinite(r)||r<=0){if(i.kind==="direct-timeline")return null;r=t?ln(t)?.durationSeconds??0:0}return r<=0?null:{duration:r,adapter:{...i,getDuration:()=>r},compositionSize:Yi(t)}}stop(){this._runtimeScript&&(this._runtimeScript.onerror=null,this._runtimeScript=null),this.failed||(this._failure=null),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 W(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=this._callbacks.resolveRuntimeUrl?.()??G,this._runtimeScript=t,t.onerror=()=>{this._runtimeScript!==t||this._iframe.contentDocument!==e||(this.stop(),this._failure={document:e},this._callbacks.onError("HyperFrames runtime failed to load from "+t.src))},(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(!W(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 fn(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(pn(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var hn=`
|
|
1
|
+
"use strict";var HyperframesPlayer=(()=>{var We=Object.defineProperty;var Jn=Object.getOwnPropertyDescriptor;var Zn=Object.getOwnPropertyNames;var Qn=Object.prototype.hasOwnProperty;var ei=(n,e)=>{for(var t in e)We(n,t,{get:e[t],enumerable:!0})},ti=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Zn(e))!Qn.call(n,r)&&r!==t&&We(n,r,{get:()=>e[r],enumerable:!(i=Jn(e,r))||i.enumerable});return n};var ni=n=>ti(We({},"__esModule",{value:!0}),n);var zr={};ei(zr,{HyperframesPlayer:()=>He,SPEED_PRESETS:()=>ut,formatSpeed:()=>ae,formatTime:()=>Ie});var Ct=n=>n!==null&&Number.isFinite(n)&&n>0;function _e(n){let e=n.clipEndsSeconds.filter(i=>i===null).length;if(Ct(n.authoredDurationSeconds))return{seconds:n.authoredDurationSeconds,source:"authored",pendingClips:e};let t=n.clipEndsSeconds.filter(Ct);return t.length>0?{seconds:Math.max(...t),source:"derived",pendingClips:e}:{seconds:null,source:"unresolved",pendingClips:e,reason:e>0?"every clip's length is still pending":"no authored duration and no clip with a length"}}var ii="http://www.w3.org/1999/xhtml";function Dt(n){return n!=null&&n.nodeType===1}function Ge(n){return Dt(n)&&n.namespaceURI===ii}function Be(n,e){return Ge(n)&&n.localName===e}function ri(n){return Be(n,"video")}function oi(n){return Be(n,"audio")}function M(n){return ri(n)||oi(n)}function $e(n){return Be(n,"img")}function ye(n){if(n==null||n.trim()==="")return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function ve(n=document){let e=n.querySelector('[data-composition-id][data-root="true"]');return Ge(e)?e:n.querySelector("[data-composition-id]")}var V=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),Jr=Object.freeze([V.start,V.duration,V.trackIndex]),Zr=Object.freeze([V.derivedEnd]),Qr=Object.freeze([V.derivedEnd,V.legacyTrack]);function ze(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Nt=n=>{let e=ze(n);return e!==null&&e>=0?e:null};function Ae(n){return Nt(n("data-playback-start"))??Nt(n("data-media-start"))??0}var X=.1,K=10;function je(n){return Number.isFinite(n)&&n>0?Math.max(X,Math.min(K,n)):1}function Pt(n,e=1){let t=Number.parseFloat(n("data-playback-rate")??"");return je(Number.isFinite(t)&&t>0?t:e)}function qe(n){let e=ze(n("data-duration"));return e!==null&&e>0?e:null}function Lt(n,e){let t=qe(n);if(t!==null)return t;let i=ze(n("data-end"));return i!==null?i-e:null}var ai=3;function Ye(n,e,t){return Number.isFinite(n)?Math.max(0,n-e)/je(t):null}function Xe(n){let{tag:e,authoredDurationSeconds:t,sourceDurationSeconds:i,mediaStartSeconds:r,playbackRate:o}=n;if(t!==null&&t>0)return{seconds:t,source:"authored"};if(e==="img")return{seconds:ai,source:"default"};if(i===null)return{seconds:null,source:"pending",reason:"source duration not yet probed"};let a=Ye(i,r,o);return a===null?{seconds:null,source:"pending",reason:"source reported a non-finite duration"}:{seconds:a,source:"media"}}var Ft="data-fx-chain",to=Ft.slice(5);var J=(n="frequency",e="Frequency",t=1e3,i=20,r=2e4)=>({kind:"number",key:n,label:e,unit:"Hz",min:i,max:r,step:1,default:t,scale:"log",automatable:!0}),Ke=(n=.707,e="Bandwidth: higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:n,scale:"log",automatable:!0,hint:e}),Se=(n=-40,e=40,t=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:n,max:e,step:.1,default:t,automatable:!0}),Ot={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},Vt=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Se(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[J("frequency","Frequency",1e3),Se(-40,40,0),Ke(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[J("frequency","Frequency",200,20,2e3),Se(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[J("frequency","Frequency",4e3,500,2e4),Se(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies: the usual fix for rumble on a voice.",params:[J("frequency","Cutoff",300,20,2e4),Ke(.707),Ot],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies, which darkens or muffles a track.",params:[J("frequency","Cutoff",8e3,100,2e4),Ke(.707),Ot],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Peak limiter that follows the signal's level. It has no lookahead, so a fast peak or an inter-sample peak can pass the ceiling; use the true-peak limiter for a delivery limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"truepeak",label:"True-peak limiter",group:"dynamics",description:"Lookahead limiter that holds a 4x estimate of the inter-sample peak at a dBTP ceiling; full-band noise can land up to about 1.7 dB above it. Adds lookahead plus about 0.3 ms of latency.",params:[{kind:"number",key:"ceiling",label:"Ceiling",unit:"dBTP",min:-24,max:0,step:.1,default:-1,hint:"Target true peak, measured on a 4x oversampled signal. Dense full-band sound can end up to about 1.7 dB above it."},{kind:"number",key:"lookahead",label:"Lookahead",unit:"ms",min:.5,max:10,step:.1,default:3,hint:"How far ahead the gain starts falling. Longer is smoother and adds the same latency."},{kind:"number",key:"release",label:"Release",unit:"ms",min:10,max:2e3,step:1,default:80,scale:"log"}],web:"worklet-truepeak"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times, a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],no=new Map(Vt.map(n=>[n.id,n]));var io=Vt.map(n=>n.id);function si(n){return 10**(n/20)}var Ut=si(12);var Ze="data-automation",po=Ze.slice(5),Je=1,ui=512,I=class extends Error{constructor(e){super(e),this.name="AudioAutomationError"}},Ee="volume",Te="rate";function Ht(n){if(n===Ee)return{kind:"volume"};if(n===Te)return{kind:"rate"};let e=n.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===li){let r=e[2];return r?{kind:"preset",presetId:r}:null}if(e.length!==3||e[0]!=="fx")return null;let[,t,i]=e;return!t||!i?null:{kind:"fx",nodeId:t,param:i}}var li="preset";var di={min:0,max:Ut,step:.01,unit:"",label:"Volume",scale:"linear",default:1},ci={min:X,max:K,step:.05,unit:"x",label:"Speed",scale:"log",default:1};function Z(n){if(typeof n=="number")return Number.isFinite(n)?n:null;if(typeof n=="string"&&n.trim()!==""){let e=Number(n);return Number.isFinite(e)?e:null}return null}function mi(n){let e=Z(n);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function Wt(n,e){let t=Z(n),i=Z(e);if(t===null||i===null)return null;let r=s=>Math.min(.999,Math.max(.001,s)),o=r(t),a=r(i);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function pi(n){let e=mi(n?.curve),t=Wt(n?.viaX,n?.viaY);return{...e?{curve:e}:{},...t?{viaX:t.x,viaY:t.y}:{}}}function fi(n,e){let t=Z(n?.t),i=Z(n?.v);if(t===null||i===null)return null;let r=e?Math.min(e.max,Math.max(e.min,i)):i;return{t:Math.max(0,t),v:r,...pi(n)}}function hi(n,e){let t=n.map(r=>fi(r,e)).filter(r=>r!==null).sort((r,o)=>r.t-o.t),i=[];for(let r of t)i.length>0&&i[i.length-1].t===r.t?i[i.length-1]=r:i.push(r);return i.slice(0,ui)}function bi(n){let e=[];for(let t of n.lanes){if(!Ht(t.target))continue;let i=t.target===Ee?di:t.target===Te?ci:null,r=hi(t.points??[],i);r.length>0&&e.push({target:t.target,points:r})}return{version:Je,lanes:e}}function Gt(n){let e;try{e=JSON.parse(n)}catch(r){throw new I(`Automation is not valid JSON: ${r.message}`)}if(typeof e!="object"||e===null)throw new I("Automation must be a JSON object.");let t=e;if(t.version!==Je)throw new I(`Unsupported automation version: ${String(t.version)}`);if(!Array.isArray(t.lanes))throw new I("Automation is missing a `lanes` array.");let i=t.lanes.map((r,o)=>{if(typeof r!="object"||r===null)throw new I(`Lane ${o} is not an object.`);let a=r;if(typeof a.target!="string"||!Ht(a.target))throw new I(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new I(`Lane ${o} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return bi({version:Je,lanes:i})}function gi(n,e){return e?Math.pow(n,Math.pow(2,2*e)):n}function _i(n,e){let t=n-.5,i=e-.5,r=.999,o=1e6,a=t>0?t/(r-n):t<0?-t/(n-(1-r)):0,s=i>0?i/(r-e):i<0?-i/(e-(1-r)):0,u=Math.min(o,Math.max(1,a,s));return{cx:n+t/u,cy:e+i/u,w:u}}function yi(n,e,t){let{cx:i,cy:r,w:o}=_i(e,t),a=2-2*o,s=n*a-1+2*o*i,u=-n*a-2*o*i,d=vi(s,u,n),m=1-d,g=m*m+2*o*d*m+d*d;return g>0?(2*o*r*d*m+d*d)/g:n}function vi(n,e,t){if(Math.abs(n)<1e-12)return Math.abs(e)<1e-12?t:-t/e;let i=Math.sqrt(Math.max(0,e*e-4*n*t)),r=(-e+i)/(2*n),o=(-e-i)/(2*n),a=s=>s>=-1e-9&&s<=1+1e-9;return a(r)?Math.min(1,Math.max(0,r)):a(o)?Math.min(1,Math.max(0,o)):t}function Ai(n,e){let t=Wt(e.viaX,e.viaY);return t?yi(Math.min(1,Math.max(0,n)),t.x,t.y):gi(n,e.curve)}function Si(n,e,t,i){return i==="log"&&n>0&&e>0?Math.exp(Math.log(n)+(Math.log(e)-Math.log(n))*t):n+(e-n)*t}function Re(n,e,t="linear"){let i=n.points;if(i.length===0)return 0;let r=i[0];if(e<=r.t)return r.v;let o=i[i.length-1];if(e>=o.t)return o.v;let a=0,s=i.length-1;for(;s-a>1;){let g=a+s>>1;i[g].t<=e?a=g:s=g}let u=i[a],d=i[s],m=d.t-u.t;return m<=0?d.v:Si(u.v,d.v,Ai((e-u.t)/m,u),t)}var xe=new Map,Ei=64;function Bt(n,e=Ee){let t=`${e}\0${n}`,i=xe.get(t);if(i!==void 0)return i;let r=null;try{r=Gt(n).lanes.find(o=>o.target===e)??null}catch{r=null}return xe.size>Ei&&xe.clear(),xe.set(t,r),r}var $t=48,zt=new WeakMap;function Ti(n){let e=n.points,t=e[0].v,i=e[e.length-1].v,r=[0],o=[0],a=u=>{let d=r[r.length-1];if(u<=d)return;let m=Re(n,d,"log");r.push(u),o.push(o[o.length-1]+(m+Re(n,u,"log"))/2*(u-d))},s=Math.max(0,e[0].t);a(s);for(let u=1;u<e.length;u+=1){let d=e[u-1].t,m=e[u].t;if(!(m<=0))for(let g=1;g<=$t;g+=1)a(Math.max(d,0)+(m-d)*g/$t)}return{ts:Float64Array.from(r),ss:Float64Array.from(o),firstRate:t,lastRate:i}}function Ri(n){let e=zt.get(n);return e||(e=Ti(n),zt.set(n,e)),e}function xi(n){return typeof n!="number"&&n.points.length>0}function wi(n,e,t){let i=0,r=n.length-1;for(;r-i>1;){let o=i+r>>1;n[o]<=t?i=o:r=o}return e[i]+(e[r]-e[i])*(t-n[i])/(n[r]-n[i])}function Qe(n,e){if(typeof n=="number")return e/n;if(!xi(n))return e;let{ts:t,ss:i,firstRate:r,lastRate:o}=Ri(n),a=t.length-1;return e<=0?e/r:e>=i[a]?t[a]+(e-i[a])/o:wi(i,t,e)}function ki(n){return n?Bt(n,Te):null}function jt(n,e){return ki(n)??e}var vo=[{id:"montage",label:"Montage",points:[[0,.9],[.15,.3],[.5,2.5],[.85,.3],[1,.9]]},{id:"hero",label:"Hero",points:[[0,1],[.25,1.6],[.5,.25],[.75,1.6],[1,1]]},{id:"bullet",label:"Bullet",points:[[0,3],[.4,3],[.5,.15],[.6,3],[1,3]]},{id:"jump-cut",label:"Jump cut",points:[[0,.5],[.24,.5],[.26,3],[.5,3],[.52,.5],[.74,.5],[.76,3],[1,3]]},{id:"flash-in",label:"Flash in",points:[[0,.3],[.6,.6],[1,5]]},{id:"flash-out",label:"Flash out",points:[[0,5],[.4,.6],[1,.3]]},{id:"ramp-in",label:"Ramp in",points:[[0,.5],[1,1]]},{id:"ramp-out",label:"Ramp out",points:[[0,1],[1,.5]]},{id:"slowmo-middle",label:"Slow-mo middle",points:[[0,1],[1/3,.35],[2/3,.35],[1,1]]}];var v=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),So=Object.freeze([v.start,v.duration,v.trackIndex]),Eo=Object.freeze([v.derivedEnd]),To=Object.freeze([v.derivedEnd,v.legacyTrack]);function C(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Xt=/^[A-Za-z0-9_.:-]+$/;function Kt(n,e){let t=n.charCodeAt(e);return t>=48&&t<=57}function qt(n,e){let t=e;for(;t>=0&&Kt(n,t);)t--;return t}function Mi(n,e){let t=e;for(;t>=0&&(n[t]??"").trim()==="";)t--;return t}function Ii(n){let e=n.length-1;if(!Kt(n,e))return null;let t=qt(n,e);return n[t]==="."&&(t=qt(n,t-1)),t+1}function Ci(n){let e=Ii(n);if(e==null)return null;let t=Mi(n,e-1),i=n[t];if(i!=="+"&&i!=="-")return null;let r=n.slice(0,t).trim();if(!Xt.test(r))return null;let o=Number(n.slice(e));return Number.isFinite(o)?{refId:r,operator:i,magnitude:o}:null}function Q(n){let e=(n??"").trim();if(!e)return null;let t=C(e);if(t!=null)return{kind:"absolute",value:t};if(Xt.test(e))return{kind:"reference",refId:e,offset:0};let i=Ci(e);return i?{kind:"reference",refId:i.refId,offset:i.operator==="-"?-i.magnitude:i.magnitude}:null}function T(n,e,t,i){n.push({code:e,attribute:t,value:i})}function Di(n,e,t,i){if(e==null||e.trim()==="")return t.defaultStart===void 0?0:t.defaultStart;if(!n)return T(i,"invalid-start",v.start,e),null;if(n.kind==="absolute")return Math.max(0,n.value);let r=t.resolveReferenceEnd?.(n.refId);return r==null||!Number.isFinite(r)?(T(i,"unresolved-start-reference",v.start,e),null):Math.max(0,r+n.offset)}var Ni=1e-9;function Pi(n,e){return Math.abs(n-e)<=Ni}function Li(n,e,t){let i=C(n);if(i==null){T(t,"deprecated-end",v.derivedEnd,n),T(t,"invalid-end",v.derivedEnd,n);return}if(e==null){T(t,"deprecated-end",v.derivedEnd,n);return}Pi(i,e)||(T(t,"deprecated-end",v.derivedEnd,n),T(t,"conflicting-end",v.derivedEnd,n))}function Oi(n,e,t){let i=C(n);return i==null||i<0?(T(t,"invalid-duration",v.duration,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i,end:e==null?null:e+i,durationSource:"duration"}}function Fi(n,e,t){T(t,"deprecated-end",v.derivedEnd,n);let i=C(n);return i==null?(T(t,"invalid-end",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):e==null?{duration:null,end:i,durationSource:"legacy-end"}:i<e?(T(t,"end-before-start",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i-e,end:i,durationSource:"legacy-end"}}function Vi(n,e,t){let i=n.getAttribute(v.duration),r=n.getAttribute(v.derivedEnd);if(i==null)return r==null?{duration:null,end:null,durationSource:"missing"}:Fi(r,e,t);let o=Oi(i,e,t);return r!=null&&Li(r,o.end,t),o}function Yt(n,e,t,i){let r=C(n);return r==null||!Number.isInteger(r)?(T(i,"invalid-track-index",e,n),{trackIndex:0,trackSource:"invalid"}):{trackIndex:r,trackSource:t}}function Ui(n,e){let t=n.getAttribute(v.trackIndex),i=n.getAttribute(v.legacyTrack);if(t==null&&i==null)return{trackIndex:0,trackSource:"default"};if(t==null&&i!=null)return T(e,"deprecated-layer",v.legacyTrack,i),Yt(i,v.legacyTrack,"legacy-layer",e);let r=Yt(t??"",v.trackIndex,"track-index",e);if(i==null)return r;T(e,"deprecated-layer",v.legacyTrack,i);let o=C(i);return o!=null&&o!==r.trackIndex&&T(e,"conflicting-layer",v.legacyTrack,i),r}function et(n,e={}){let t=[],i=n.getAttribute(v.start),r=Q(i),o=Di(r,i,e,t),a=Vi(n,o,t),s=Ui(n,t);return{startExpression:r,start:o,...a,...s,diagnostics:t}}function P(n){return C(n)}function ee(n){return Pt(e=>n.getAttribute(e),M(n)?n.defaultPlaybackRate:1)}function tt(n){return jt(n.getAttribute("data-automation"),ee(n))}function nt(n){return Ae(e=>n.getAttribute(e))}function U(n,e){return Hi(e,nt(n),tt(n))}function it(n){let e=Xe({tag:"video",authoredDurationSeconds:qe(t=>n.getAttribute(t)),sourceDurationSeconds:Number.isFinite(n.duration)?n.duration:null,mediaStartSeconds:nt(n),playbackRate:ee(n)});return e.source==="media"?U(n,n.duration):e.seconds}function we(n,e=0){return!$e(n)||!n.hasAttribute("data-start")&&!n.hasAttribute("data-track-index")?null:Xe({tag:"img",authoredDurationSeconds:Lt(t=>n.getAttribute(t),e),sourceDurationSeconds:null,mediaStartSeconds:0,playbackRate:1}).seconds}function Hi(n,e,t){return typeof t=="number"?Ye(n,e,t):Number.isFinite(n)?Qe(t,Math.max(0,n-e)):null}function Jt(){return globalThis}function te(n,e){if(typeof window>"u")return;let t=Jt(),i=t.__hf?.onSwallowed;if(i)try{i({label:n,error:e})}catch(r){}(t.__hfDebug||t.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${n} swallowed:`,e)}function ne(n){try{if(typeof n?.duration!="function")return null;let e=Number(n.duration());return Number.isFinite(e)?e:null}catch(e){return te("runtime.timelineDuration",e),null}}var Zt="data-hf-authored-duration",Qt="data-hf-authored-end";function ie(n){if(n==null||typeof n=="string"&&n.trim()==="")return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function ke(n){let e=ie(n.start);if(e==null)return null;let t=Math.max(0,e),i=ie(n.duration),r=ie(n.authoredDuration),o=i!=null&&i>0?i:r!=null&&r>0?r:null;if(o!=null)return{start:t,duration:o,end:t+o};let a=ie(n.end),s=ie(n.authoredEnd),u=a!=null&&a>t?a:s!=null&&s>t?s:null;return{start:t,duration:u==null?null:u-t,end:u}}var en="data-hf-media-start-basis";function tn(n){return n?.trim().toLowerCase()==="global"?"global":"local"}function Wi(n){return tn(n.basis)==="global"?n.authoredStart:n.hostStart+n.authoredStart}function nn(n){return on(n)?Wi({authoredStart:n.authoredStart,hostStart:n.hostStart,basis:n.basis}):n.ordinaryStart()}function rn(n){return on(n)&&tn(n.basis)==="global"}function on(n){return!n.hasAutoStart&&n.authoredStart!=null&&n.hostStart!==0}function rt(n){return Ae(e=>n.getAttribute(e))}function an(n,e){return n-rt(e)}function H(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=n.documentRef??document,r=new WeakMap,o=new WeakMap,a=new Set,s=l=>{let f=i.getElementById(l);return f||(Array.from(i.querySelectorAll("[data-composition-id]")).find(_=>_.getAttribute("data-composition-id")===l)??null)},u=(l,f)=>t?l.getAttribute(f):null,d=l=>ke({start:0,duration:l.getAttribute("data-duration"),authoredDuration:u(l,"data-hf-authored-duration")})?.duration??ke({start:R(l,0),end:l.getAttribute("data-end"),authoredEnd:u(l,"data-hf-authored-end")})?.duration??null,m=l=>l!=null&&Number.isFinite(l)&&l>0?l:null,g=l=>{let f=l.getAttribute("data-composition-id");return f?m(ne(e[f])):null},y=l=>{let f=o.get(l);if(f!==void 0)return f;let _=d(l)??m(M(l)?U(l,l.duration):null)??m(we(l))??g(l);return o.set(l,_),_},h=l=>l.hasAttribute("data-composition-src")||l.hasAttribute("data-composition-id")||l.hasAttribute("data-composition-file"),A=l=>{let f=l.parentElement;return!f||!l.hasAttribute("data-composition-id")||Q(l.getAttribute("data-start"))?null:h(f)?f:null},b=(l,f)=>an(R(l,f),A(l)??l),S=(l,f)=>{let _=l.hasAttribute("data-composition-id")?l.parentElement?.closest("[data-composition-id]"):l.closest("[data-composition-id]");return _?b(_,f):0},D=(l,f)=>{let _=Q(l.getAttribute("data-start"));if(!_){let Y=A(l);return Y?R(Y,f):f}if(_.kind==="absolute")return S(l,f)+Math.max(0,_.value);let w=s(_.refId);if(!w)return f;let L=R(w,0),fe=y(w)??0,he=Math.min(0,S(l,0));return Math.max(he,L+fe+_.offset)},R=(l,f)=>{let _=r.get(l);if(_!==void 0)return _??f;if(a.has(l))return f;a.add(l);try{let w=D(l,f);return r.set(l,w),w}finally{a.delete(l)}},k=l=>{let f=l.closest("[data-composition-id]");return{authoredStart:P(l.getAttribute("data-start")),hostStart:f?b(f,0):0,hasAutoStart:l.hasAttribute("data-hf-auto-start"),basis:l.getAttribute(en)}};return{resolveStartForElement:(l,f=0)=>R(l,Math.max(0,f)),resolveDurationForElement:l=>y(l),resolveMediaStartForElement:l=>{let f=k(l);return nn({...f,ordinaryStart:()=>R(l,f.hostStart)})},resolveHostStartForElement:l=>S(l,0),resolveHostSlotsForElement:l=>{let f=[];for(let _=l.parentElement;_;_=_.parentElement){if(!h(_)||A(_)||rt(_)<=0)continue;let w=R(_,0),L=d(_);f.push({start:w,end:L?w+L:1/0})}return f},isRootGlobalMediaStartForElement:l=>M(l)&&rn(k(l))}}function sn(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var un=7200,ot=1/60,re=n=>n!==null&&n>ot?n:null;function Gi(n){return{width:ye(n.getAttribute("data-width")),height:ye(n.getAttribute("data-height"))}}function Bi(n,e){let t=[];for(let i of n.querySelectorAll("video[data-start], audio[data-start]")){let r=e.mediaStart(i);if(!Number.isFinite(r))continue;let o=e.mediaDuration(i);o==null||o<=ot||t.push(Math.max(0,r)+o)}return re(_e({authoredDurationSeconds:null,clipEndsSeconds:t}).seconds)}function $i(n,e){let t=[];for(let r of n.querySelectorAll("[data-composition-id][data-start]")){if(r.parentElement?.closest("[data-composition-id]")!==n)continue;let o=e.resolveStartForElement(r,0),a=e.resolveDurationForElement(r);!Number.isFinite(o)||a==null||a<=0||t.push(Math.max(0,o)+a)}let i=P(n.getAttribute("data-duration"));return re(_e({authoredDurationSeconds:null,clipEndsSeconds:[i,...t]}).seconds)}var zi=n=>n.hasAttribute("data-composition-id")||n.hasAttribute("data-composition-src");function ji(n,e,{unregisteredLottie:t}){let i=[];for(let o of n.querySelectorAll("[data-start]")){let a=e.resolveStartForElement(o,0);if(!Number.isFinite(a))continue;let s=e.resolveDurationForElement(o);s!=null?i.push(Math.max(0,a)+s):(M(o)||zi(o))&&i.push(null)}(t||n.querySelector("[data-lottie-src]"))&&i.push(null);let r=_e({authoredDurationSeconds:null,clipEndsSeconds:i});return r.pendingClips>0?{...r,seconds:null,source:"unresolved",reason:"a clip's length is pending"}:r}function qi(n){if(n.declared!==null&&Number.isFinite(n.declared)&&n.declared>0)return n.declared;let e=re(n.timeline()),t=Math.max(0,...n.floors().map(u=>u??0)),i=Number.isFinite(n.fallback)&&n.fallback>ot?n.fallback:0,r=Math.max(t,i),a=e!==null&&e>=un&&re(r)!==null?null:e,s;return a!==null?s=Math.max(a,r):re(t)!==null?s=r:i>0?s=i:s=n.derived(),s>0?s:0}function ln(n){let e=ve(n);if(!e)return null;let t=H({timelineRegistry:{},includeAuthoredTimingAttrs:!0,documentRef:n}),i=qi({declared:P(e.getAttribute("data-duration")),timeline:()=>null,floors:()=>[Bi(n,{mediaStart:t.resolveMediaStartForElement,mediaDuration:it}),$i(e,t)],fallback:0,derived:()=>ji(e,t,{unregisteredLottie:!1}).seconds??0});return{...Gi(e),fps:sn().canonicalFps,durationSeconds:i}}var dn="hyperframes-studio-preview";var cn="__hfPreviewErrors";function mn(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function W(n){return typeof n=="object"&&n!==null}function pn(n){return W(n)&&typeof n.getDuration=="function"}function fn(n){return W(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var G="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.153/dist/hyperframe.runtime.iife.js";function oe(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function Yi(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=oe(e.getAttribute("data-width")),i=oe(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}function Xi(n){return Array.isArray(n)?n.find(e=>typeof e=="string"&&e.trim()!==""&&e!=="[object Event]")??null:null}var Me=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;_runtimeScript=null;_failure=null;get failed(){return this._failure!==null&&this._failure.document===this._iframe.contentDocument}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._failure=null,this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;let t=null;try{t=this._poll(e)}catch(i){i instanceof DOMException&&i.name==="SecurityError"||(t={kind:"error",message:i instanceof Error?i.message:String(i)})}if(t){this.stop(),t.kind==="error"?(this._failure={document:this._iframe.contentDocument},this._callbacks.onError(t.message)):this._callbacks.onReady(t.result);return}e>=40&&(this.stop(),this._failure={document:this._iframe.contentDocument},this._callbacks.onError("Composition timeline not found after 8s"))},200)}_poll(e){let t=this._iframe.contentWindow;if(!t)return null;let i=Xi(Reflect.get(t,cn));if(i!==null)return{kind:"error",message:i};let r=this._iframe.contentDocument,o=Reflect.get(t,"__timelines"),a=this.hasRuntimeBridge(t);if(mn({hasRuntime:a,hasTimelines:W(o)&&Object.keys(o).length>0,hasNestedCompositions:!!r?.querySelector("[data-composition-src]"),runtimeInjected:this._runtimeInjected,attempts:e}))return this._injectRuntime(),null;if(this._runtimeInjected&&!a)return null;let s=this._resolveReadyResult(t,r);return s?{kind:"ready",result:s}:null}_resolveReadyResult(e,t){let i=this._resolvePlaybackDurationAdapter(e)??{kind:"document",getDuration:()=>0},r=i.getDuration();if(!Number.isFinite(r)||r<=0){if(i.kind==="direct-timeline")return null;r=t?ln(t)?.durationSeconds??0:0}return r<=0?null:{duration:r,adapter:{...i,getDuration:()=>r},compositionSize:Yi(t)}}stop(){this._runtimeScript&&(this._runtimeScript.onerror=null,this._runtimeScript=null),this.failed||(this._failure=null),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 W(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=this._callbacks.resolveRuntimeUrl?.()??G,this._runtimeScript=t,t.onerror=()=>{this._runtimeScript!==t||this._iframe.contentDocument!==e||(this.stop(),this._failure={document:e},this._callbacks.onError("HyperFrames runtime failed to load from "+t.src))},(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(!W(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 fn(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(pn(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var hn=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
position: relative;
|