@hyperframes/core 0.9.94 → 0.9.96

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.
Files changed (61) hide show
  1. package/dist/atomicFile.js +14 -9
  2. package/dist/audibleVideo.d.ts +10 -0
  3. package/dist/audibleVideo.js +37 -0
  4. package/dist/compiler/htmlBundler.js +2 -0
  5. package/dist/compiler/index.d.ts +1 -0
  6. package/dist/compiler/index.js +1 -0
  7. package/dist/compiler/inlineSubCompositions.js +2 -1
  8. package/dist/compositionSource.d.ts +1 -0
  9. package/dist/compositionSource.js +22 -1
  10. package/dist/generated/runtime-inline.js +1 -1
  11. package/dist/hyperframe.runtime.iife.js +67 -67
  12. package/dist/index.d.ts +1 -1
  13. package/dist/runtime/adapters/seek-dispatch.d.ts +40 -0
  14. package/dist/runtime/adapters/seek-dispatch.js +164 -0
  15. package/dist/runtime/assetUrl.d.ts +6 -0
  16. package/dist/runtime/assetUrl.js +8 -0
  17. package/dist/runtime/audioFx.d.ts +77 -0
  18. package/dist/runtime/audioFx.js +277 -0
  19. package/dist/runtime/bridge.d.ts +6 -0
  20. package/dist/runtime/bridge.js +20 -0
  21. package/dist/runtime/decodesFirst.d.ts +4 -0
  22. package/dist/runtime/decodesFirst.js +14 -0
  23. package/dist/runtime/drawnBox.d.ts +29 -0
  24. package/dist/runtime/drawnBox.js +100 -0
  25. package/dist/runtime/editingDraft.d.ts +0 -11
  26. package/dist/runtime/editingDraft.js +1 -61
  27. package/dist/runtime/editingElement.js +3 -3
  28. package/dist/runtime/editingGestureStart.d.ts +2 -6
  29. package/dist/runtime/editingGestureStart.js +1 -40
  30. package/dist/runtime/editingHandles.d.ts +4 -0
  31. package/dist/runtime/editingHandles.js +9 -0
  32. package/dist/runtime/editingPort.d.ts +5 -0
  33. package/dist/runtime/editingPort.js +5 -1
  34. package/dist/runtime/media.d.ts +113 -0
  35. package/dist/runtime/media.js +820 -0
  36. package/dist/runtime/mediaLoadFailure.d.ts +8 -0
  37. package/dist/runtime/mediaLoadFailure.js +58 -0
  38. package/dist/runtime/mediaProxy.d.ts +91 -0
  39. package/dist/runtime/mediaProxy.js +803 -0
  40. package/dist/runtime/playbackHealth.d.ts +31 -0
  41. package/dist/runtime/playbackHealth.js +137 -0
  42. package/dist/runtime/preloadMedia.d.ts +16 -0
  43. package/dist/runtime/preloadMedia.js +266 -0
  44. package/dist/runtime/previewCopies.d.ts +13 -0
  45. package/dist/runtime/previewCopies.js +80 -0
  46. package/dist/runtime/proxyWait.d.ts +3 -0
  47. package/dist/runtime/proxyWait.js +51 -0
  48. package/dist/runtime/runtimeLoad.d.ts +3 -0
  49. package/dist/runtime/runtimeLoad.js +13 -0
  50. package/dist/runtime/state.d.ts +7 -0
  51. package/dist/runtime/state.js +3 -0
  52. package/dist/runtime/timedClipHide.d.ts +12 -0
  53. package/dist/runtime/timedClipHide.js +94 -0
  54. package/dist/runtime/types.d.ts +29 -18
  55. package/dist/runtime/webAudioTransport.d.ts +241 -0
  56. package/dist/runtime/webAudioTransport.js +1162 -0
  57. package/dist/safePath.d.ts +2 -0
  58. package/dist/safePath.js +41 -13
  59. package/dist/studioPreviewMark.js +2 -4
  60. package/dist/utils/inlineTextStyleRead.js +2 -4
  61. package/package.json +16 -4
@@ -0,0 +1,94 @@
1
+ import { CLIP_HIDDEN_ATTR, olderShaderBuildOnPage, revealClip } from "./clipReveal.js";
2
+ import { capturePageIn, defersMediaIn, RUNTIME_STAMPED_ATTR, STUDIO_PREVIEW_MARK_META, STUDIO_PREVIEW_UPCOMING_ATTR, } from "../studioPreviewMark.js";
3
+ // Hides timed non-media clips from script evaluation until the first visibility pass decides them;
4
+ // before it, a paused page painted every clip at once. Media is left to init's media pass.
5
+ // The rule and its flag live on the page, so every runtime copy shares them.
6
+ const HIDE_ATTR = "data-hf-first-pass-hide";
7
+ const HIDE_UNTIL_FIRST_PASS = "[data-start]:not(video, audio, img) { visibility: hidden !important; }";
8
+ const PREVIEW_HIDE_UNTIL_FIRST_PASS = 'img[loading="lazy"] { display: none !important; }';
9
+ const SKIP_ATTR = "data-hf-skip-hidden-images";
10
+ export { CLIP_HIDDEN_ATTR };
11
+ const SKIPPABLE_CLIP = `[data-start]:not(video, audio, img, [${STUDIO_PREVIEW_UPCOMING_ATTR}], [${RUNTIME_STAMPED_ATTR}])`;
12
+ export const SKIPPED_CLIP = `${SKIPPABLE_CLIP}[${CLIP_HIDDEN_ATTR}]`;
13
+ const STUDIO_PREVIEW_MARK = `meta[name="${STUDIO_PREVIEW_MARK_META}"]`;
14
+ const CONTENTS_ATTR = "data-hf-hidden-clip-contents";
15
+ const HIDDEN_CLIP_DOUBLED_FOR_WEIGHT = `[${CLIP_HIDDEN_ATTR}][${CLIP_HIDDEN_ATTR}]`;
16
+ const HIDDEN_CLIP_BY_INLINE_STYLE = `[${CLIP_HIDDEN_ATTR}][style*="visibility: hidden"]`;
17
+ const skipHiddenImages = (clip) => `${SKIPPABLE_CLIP}${clip} img { display: none !important; }`;
18
+ const LAYER_OUTRANKING_UNLAYERED_IMPORTANT = "hf-hidden-clip";
19
+ const hideHiddenClipContents = (clip) => {
20
+ const filterOutputLayers = [clip, `${clip} *`]
21
+ .flatMap((layer) => [layer, `${layer}::before`, `${layer}::after`])
22
+ .join(", ");
23
+ const rules = `${clip} * { visibility: hidden !important; } ${filterOutputLayers} { filter: none !important; }`;
24
+ return `${rules} @layer ${LAYER_OUTRANKING_UNLAYERED_IMPORTANT} { ${rules} }`;
25
+ };
26
+ export function showHiddenClips(only = () => true) {
27
+ return showClips(Array.from(document.querySelectorAll(`[${CLIP_HIDDEN_ATTR}]`)).filter(only));
28
+ }
29
+ export function showClips(hidden) {
30
+ const putMarksBack = hidden.map((el) => revealClip(el));
31
+ return () => {
32
+ for (const el of hidden) {
33
+ if (el.style.getPropertyValue("visibility") !== "hidden")
34
+ el.style.setProperty("visibility", "hidden", "important");
35
+ }
36
+ for (const putMarkBack of putMarksBack)
37
+ putMarkBack();
38
+ };
39
+ }
40
+ function appendStyle(parent, attr, css) {
41
+ const style = document.createElement("style");
42
+ style.setAttribute(attr, "");
43
+ style.textContent = css;
44
+ parent.appendChild(style);
45
+ }
46
+ export function defersMedia() {
47
+ return defersMediaIn(document);
48
+ }
49
+ /** True in Studio's preview, where hidden clips' images are neither fetched nor decoded until due. */
50
+ export function skipsHiddenImages() {
51
+ return document.querySelector(`style[${SKIP_ATTR}]`) !== null;
52
+ }
53
+ export function hideTimedClipsUntilFirstPass() {
54
+ if (typeof document === "undefined")
55
+ return;
56
+ const parent = document.head ?? document.documentElement;
57
+ if (!parent)
58
+ return;
59
+ const preview = document.querySelector(STUDIO_PREVIEW_MARK) !== null;
60
+ const capture = capturePageIn(document);
61
+ if (preview && !capture && !skipsHiddenImages())
62
+ appendStyle(parent, SKIP_ATTR, skipHiddenImages(HIDDEN_CLIP_DOUBLED_FOR_WEIGHT));
63
+ if (!document.querySelector(`style[${CONTENTS_ATTR}]`))
64
+ appendStyle(parent, CONTENTS_ATTR, hideHiddenClipContents(HIDDEN_CLIP_DOUBLED_FOR_WEIGHT));
65
+ const win = window;
66
+ // A runtime that already initialised may never run another pass to lift a new rule.
67
+ if (win.__hfFirstPassHidden || win.__hyperframeRuntimeBootstrapped)
68
+ return;
69
+ const css = preview
70
+ ? `${HIDE_UNTIL_FIRST_PASS} ${PREVIEW_HIDE_UNTIL_FIRST_PASS}`
71
+ : HIDE_UNTIL_FIRST_PASS;
72
+ appendStyle(parent, HIDE_ATTR, css);
73
+ win.__hfFirstPassHidden = true;
74
+ }
75
+ /** True when this call lifted the rule; callers then re-register what skipped hidden elements (grading). */
76
+ export function revealTimedClipsAfterFirstPass() {
77
+ const win = window;
78
+ if (!win.__hfFirstPassHidden)
79
+ return false;
80
+ win.__hfFirstPassHidden = false;
81
+ for (const style of document.querySelectorAll(`style[${HIDE_ATTR}]`))
82
+ style.remove();
83
+ return true;
84
+ }
85
+ export function keepInlineHideRulesForOlderShaders() {
86
+ if (!olderShaderBuildOnPage())
87
+ return;
88
+ const skip = document.querySelector(`style[${SKIP_ATTR}]`);
89
+ if (skip)
90
+ skip.textContent = skipHiddenImages(HIDDEN_CLIP_BY_INLINE_STYLE);
91
+ const contents = document.querySelector(`style[${CONTENTS_ATTR}]`);
92
+ if (contents)
93
+ contents.textContent = hideHiddenClipContents(HIDDEN_CLIP_BY_INLINE_STYLE);
94
+ }
@@ -12,7 +12,7 @@ export type RuntimeJson = string | number | boolean | null | RuntimeJson[] | {
12
12
  import type { HyperframeControlAction } from "../inline-scripts/runtimeContract.js";
13
13
  import type { HyperframePickerElementInfo } from "../inline-scripts/pickerApi.js";
14
14
  import type { RuntimeProtocolV1 } from "./protocol.js";
15
- type RuntimeBridgeControlActionBase = HyperframeControlAction | "tick" | "set-volume" | "set-media-output-muted" | "set-native-media-sync-disabled" | "set-web-audio-media-disabled" | "set-idle-heartbeat" | "set-display-scale" | "set-preview-quality" | "set-copies-ahead" | "retry-preview-copies" | "request-preview-facts" | "set-root-duration" | "set-play-range" | "stop-media" | "flash-elements" | "scrub-audio";
15
+ type RuntimeBridgeControlActionBase = HyperframeControlAction | "tick" | "set-volume" | "set-media-output-muted" | "set-native-media-sync-disabled" | "set-web-audio-media-disabled" | "set-idle-heartbeat" | "set-display-scale" | "set-preview-quality" | "set-copies-ahead" | "retry-preview-copies" | "request-preview-facts" | "set-root-duration" | "set-play-range" | "stop-media" | "flash-elements" | "scrub-audio" | "set-parent-audio" | "audio-clock";
16
16
  type RuntimeBridgeControlMessageBase = {
17
17
  source: "hf-parent";
18
18
  type: "control";
@@ -35,6 +35,9 @@ type RuntimeBridgeControlMessageBase = {
35
35
  grading?: RuntimeJson;
36
36
  compare?: RuntimeJson;
37
37
  seekMode?: "drag" | "commit";
38
+ clips?: string[];
39
+ rate?: number;
40
+ at?: number;
38
41
  };
39
42
  export type RuntimeStateMessage = {
40
43
  source: "hf-preview";
@@ -168,6 +171,12 @@ export type RuntimeMediaAutoplayBlockedMessage = {
168
171
  type: "media-autoplay-blocked";
169
172
  media: ParentCopy[];
170
173
  };
174
+ /** The same list, asked for by a parent that plays the film's audio from decoded buffers (`set-parent-audio`). */
175
+ export type RuntimeParentCopiesMessage = {
176
+ source: "hf-preview";
177
+ type: "parent-copies";
178
+ media: ParentCopy[];
179
+ };
171
180
  /**
172
181
  * Posted by the runtime when `installRuntimeControlBridge` finishes registering
173
182
  * its message listener — signals that subsequent control messages
@@ -260,25 +269,27 @@ export type PlaybackHeldBy = {
260
269
  networkState: number;
261
270
  fetchMs: number | FetchNotSeenToStart;
262
271
  };
272
+ /** How playback went over the last few seconds of play. */
273
+ export type PlaybackHealthReport = {
274
+ droppedShare: number;
275
+ seconds: number;
276
+ choppy: boolean;
277
+ fps: number;
278
+ worstFrameMs: number;
279
+ skippedShare: number;
280
+ waitingShare: number;
281
+ frozenShare: number;
282
+ gapP50Ms: number;
283
+ gapP95Ms: number;
284
+ clockSource: "audio" | "webaudio" | "monotonic";
285
+ heldBy: PlaybackHeldBy | null;
286
+ mode: "play";
287
+ };
263
288
  export type RuntimePreviewHealthMessage = {
264
289
  source: "hf-preview";
265
290
  type: "preview-health";
266
- /** How playback went over the last few seconds of play; null while paused, seeking or warming up. */
267
- health: {
268
- droppedShare: number;
269
- seconds: number;
270
- choppy: boolean;
271
- fps: number;
272
- worstFrameMs: number;
273
- skippedShare: number;
274
- waitingShare: number;
275
- frozenShare: number;
276
- gapP50Ms: number;
277
- gapP95Ms: number;
278
- clockSource: "audio" | "webaudio" | "monotonic";
279
- heldBy: PlaybackHeldBy | null;
280
- mode: "play";
281
- } | null;
291
+ /** Null while paused, seeking or warming up. */
292
+ health: PlaybackHealthReport | null;
282
293
  };
283
294
  export type RuntimePreviewFactsMessage = {
284
295
  source: "hf-preview";
@@ -299,7 +310,7 @@ export type RuntimePreviewFactsMessage = {
299
310
  copiesReady: boolean;
300
311
  };
301
312
  };
302
- export type RuntimeOutboundMessage = RuntimeStateMessage | RuntimePreviewCopiesMessage | RuntimePreviewHealthMessage | RuntimePreviewFactsMessage | RuntimeTimelineMessage | RuntimeDiagnosticMessage | RuntimePickerHoveredMessage | RuntimePickerCandidatesMessage | RuntimePickerPickedMessage | RuntimePickerPickedManyMessage | RuntimePickerCancelledMessage | RuntimeStageSizeMessage | RuntimeStaticCompositionMessage | RuntimeMediaAutoplayBlockedMessage | RuntimeReadyMessage | RuntimeAssetsReadyMessage | RuntimeDataErrorMessage | RuntimeDataAppliedMessage | RuntimeAnalyticsMessage | RuntimePerformanceMessage | RuntimeGroupLevelsMessage;
313
+ export type RuntimeOutboundMessage = RuntimeStateMessage | RuntimePreviewCopiesMessage | RuntimePreviewHealthMessage | RuntimePreviewFactsMessage | RuntimeTimelineMessage | RuntimeDiagnosticMessage | RuntimePickerHoveredMessage | RuntimePickerCandidatesMessage | RuntimePickerPickedMessage | RuntimePickerPickedManyMessage | RuntimePickerCancelledMessage | RuntimeStageSizeMessage | RuntimeStaticCompositionMessage | RuntimeMediaAutoplayBlockedMessage | RuntimeParentCopiesMessage | RuntimeReadyMessage | RuntimeAssetsReadyMessage | RuntimeDataErrorMessage | RuntimeDataAppliedMessage | RuntimeAnalyticsMessage | RuntimePerformanceMessage | RuntimeGroupLevelsMessage;
303
314
  export type HeldSeek = Promise<void> | void;
304
315
  export type RuntimePlayer = {
305
316
  _timeline: RuntimeTimelineLike | null;
@@ -0,0 +1,241 @@
1
+ import { type ElementFxHandle } from "./audioFx.js";
2
+ import { type AutomationTiming } from "../audio/audioFxAutomation.js";
3
+ import { type StereoLevel } from "./levelTap.js";
4
+ type BookedFades = {
5
+ node: GainNode;
6
+ rebook(timing: AutomationTiming): void;
7
+ };
8
+ type ScheduledSourceBase = {
9
+ el: HTMLMediaElement;
10
+ gainNode: GainNode;
11
+ /** The clip's volume lane, between its FX and `gainNode`; unity when it has none. */
12
+ laneNode: GainNode;
13
+ /** `data-volume` as clip gain, between the source and its FX. */
14
+ clipGainNode: GainNode;
15
+ /** FX chain spliced between source and gain, when the element carries one. */
16
+ fx?: ElementFxHandle | null;
17
+ /** The clip's fades booked on the audio clock, between the source and its clip gain; absent without a fade. */
18
+ fades?: BookedFades | null;
19
+ /** Stops re-aiming the lane and fades at a routed element's own position. */
20
+ unfollow?: () => void;
21
+ /** A routed element's first stage: unity except while `seekUnderDip` hides a seek. */
22
+ dipNode?: GainNode;
23
+ dipping?: boolean;
24
+ compositionStart: number;
25
+ mediaStart: number;
26
+ scheduledAt: number;
27
+ priorMuted: boolean;
28
+ priorVolume: number;
29
+ mediaPlaybackRate: number;
30
+ bounded: boolean;
31
+ };
32
+ export type ScheduledSource = ScheduledSourceBase & ({
33
+ sourceKind: "buffer";
34
+ sourceNode: AudioBufferSourceNode;
35
+ } | {
36
+ sourceKind: "media-element";
37
+ sourceNode: MediaElementAudioSourceNode;
38
+ });
39
+ export declare class WebAudioTransport {
40
+ /** Request options for every decode fetch, over `cache: "no-store"`. */
41
+ private readonly _fetchInit;
42
+ private readonly _busDocument;
43
+ private _givenContext;
44
+ private _ctx;
45
+ private _bufferCache;
46
+ private _decoding;
47
+ private _pendingDecodeBytes;
48
+ private _failedSrcs;
49
+ private _mediaElementSources;
50
+ private _handedOver;
51
+ private _activeSources;
52
+ private _masterGain;
53
+ /** Where the master bus chain lands; the program meter taps here. */
54
+ private _busOut;
55
+ /** The chain on the composition root, built on first schedule and kept for the session. */
56
+ private _master;
57
+ /** Preview volume and mute. Downstream of `_masterGain`; meters tap the program. */
58
+ private _monitorGain;
59
+ private _masterVolume;
60
+ private _masterMuted;
61
+ private _groups;
62
+ private _metering;
63
+ private _masterTap;
64
+ private _groupTaps;
65
+ private _rateAnchorCtx;
66
+ private _rateAnchorComp;
67
+ private _rate;
68
+ private _paused;
69
+ private _playGeneration;
70
+ private _playingCaptured;
71
+ private _suspendPending;
72
+ private _restTimer;
73
+ init(): Promise<boolean>;
74
+ /** `context`: one the caller opened inside a tap, which Safari only lets sound when made there. */
75
+ constructor(opts?: {
76
+ fetchInit?: RequestInit;
77
+ busDocument?: Document | null;
78
+ context?: AudioContext;
79
+ });
80
+ /** Builds the context on the calling thread: on Windows that opens the audio device and can block seconds. */
81
+ open(): boolean;
82
+ private wake;
83
+ private rest;
84
+ private suspendIfIdle;
85
+ get context(): AudioContext | null;
86
+ getTime(): number;
87
+ /** Drops decoded audio no listed element still points at. A playing source holds its own buffer. */
88
+ releaseDecodedExcept(els: readonly HTMLMediaElement[]): void;
89
+ /** One fetch and decode per source at a time: a play and a seek scheduling together share it. */
90
+ decodeAudioElement(el: HTMLMediaElement): Promise<AudioBuffer | null>;
91
+ fitsDecodeBudget(el: HTMLMediaElement): boolean;
92
+ private estimateDecodedBytes;
93
+ private decodedBytes;
94
+ /** Whether its length was read, for a source that has not failed for good and is not too long to decode. */
95
+ private mayDecode;
96
+ private fetchBytes;
97
+ private fetchAndDecode;
98
+ private decode;
99
+ startGeneration(): number;
100
+ currentGeneration(): number;
101
+ /**
102
+ * The element's cached MediaElementAudioSourceNode, building it on first use
103
+ * — or `null` when this element must not be captured at all.
104
+ *
105
+ * That second outcome is the whole point. `createMediaElementSource` cannot
106
+ * report that it produced a silent node: over a CORS-cross-origin resource
107
+ * the Web Audio spec asks the node for SILENCE rather than an exception, so
108
+ * the caller's `try/catch` never fires and the composition plays through
109
+ * with no audio and no error (#3458). The call also permanently reroutes the
110
+ * element away from its native output, so the question has to be settled
111
+ * before it, and there is no undo afterwards.
112
+ *
113
+ * `init.ts` routes on the same verdict before ever calling in, and
114
+ * `AudioRow.tsx`'s standalone preview player classifies over its own
115
+ * throwaway `AudioContext` before its own `createMediaElementSource` call —
116
+ * this method is A enforcement point, not THE enforcement point; every
117
+ * caller that can reach `createMediaElementSource` is expected to classify
118
+ * first. What this method DOES own is the cache below: `_mediaElementSources`
119
+ * is keyed by element identity, not by asset, so a cache hit alone says
120
+ * nothing about the element's CURRENT resource. Reclassifying on every call
121
+ * — cache hit included — means a `src` mutation an outer caller missed (a
122
+ * pooled element swapped from a same-origin clip to a cross-origin one
123
+ * without going through a fresh generation) can't leave a stale
124
+ * `web-audio` verdict silently attached to the new resource.
125
+ */
126
+ private acquireMediaElementSource;
127
+ /**
128
+ * Route the browser's pitch-preserving HTMLMediaElement transport through the
129
+ * same FX, automation, element-gain, and master graph used by final audio.
130
+ * The media element remains the source-time/rate owner; Web Audio is strictly
131
+ * downstream and therefore never resamples it for Studio global speed.
132
+ */
133
+ scheduleMediaElementPlayback(el: HTMLMediaElement, compositionStart: number, mediaStart: number, compositionTime: number, volume: number, generation: number, rate?: number, clipDuration?: number): Promise<ScheduledSource | null>;
134
+ /**
135
+ * A routed element keeps its own time: it starts late, is seeked and is steered by rate. Its lane and fades were
136
+ * booked against the context clock, so each time it starts or moves they are re-aimed at where it actually is.
137
+ */
138
+ private followElement;
139
+ /**
140
+ * Seek a sounding routed element under a short gain dip: down, seek, and back up once it has landed, so the jump
141
+ * is neither a click nor a tempo change. False when the element is not routed and has no dip to hide it under.
142
+ */
143
+ seekUnderDip(el: HTMLMediaElement, target: number): boolean;
144
+ /**
145
+ * The gain a grouped member's signal should land on, building it on first
146
+ * use. A group's clock is COMPOSITION time (design doc §1.3) — it has no
147
+ * `data-start`, and a missing start parses as 0, which is exactly
148
+ * composition time — so its chain and volume lane are scheduled once here
149
+ * against that zero-offset timing, not the member's own clip-local timing.
150
+ * A group id with no matching `<hf-audio-group>` element still gets a bus
151
+ * (flat, no chain) so a hand-authored `data-audio-group` degrades to a
152
+ * plain sum rather than losing the member's audio.
153
+ */
154
+ private groupInput;
155
+ startMetering(): void;
156
+ stopMetering(): void;
157
+ readLevels(): {
158
+ master: StereoLevel;
159
+ groups: Record<string, StereoLevel>;
160
+ };
161
+ private attachMasterTap;
162
+ private attachGroupTap;
163
+ /**
164
+ * Group mute, preview side — a separate gain from `input`'s volume fader
165
+ * so a mute toggle never fights `scheduleVolume`'s ramps on the
166
+ * same param (the same hazard the design doc flags for §2.1). A no-op
167
+ * until the group has an active member: at that point `groupInput` reads
168
+ * the element's own `data-hidden` for its initial value, so there is
169
+ * nothing to catch up on here.
170
+ */
171
+ setGroupMuted(groupId: string, muted: boolean): void;
172
+ /**
173
+ * The master bus chain, between the sum of every clip and group and the monitor.
174
+ * A seek re-anchors it once per play generation; no root yet is retried next schedule.
175
+ */
176
+ private ensureMasterBus;
177
+ /** Master, unless `el` belongs to a group — then that group's bus (built on
178
+ * first use, per `groupInput`). */
179
+ private resolveDestination;
180
+ /**
181
+ * The graph goes with it. Splicing alone left the FX handle alive and then
182
+ * UNREACHABLE — `stopAll()` disposes by walking `_activeSources`, which the
183
+ * splice just emptied of this entry. Every clip that finished naturally
184
+ * leaked its MutationObserver for the session, and each one still answered
185
+ * later `data-fx-chain` edits by rebuilding a whole graph (impulse response,
186
+ * chorus/phaser oscillators started and never stopped) around a dead
187
+ * source. Not disposed when the index is already -1: `stopAll()` has
188
+ * already done it, and `stop()` is what fired this event.
189
+ */
190
+ private handleSourceEnded;
191
+ schedulePlayback(el: HTMLMediaElement, buffer: AudioBuffer, compositionStart: number, mediaStart: number, readCompositionTime: () => number, volume: number, generation: number, rate?: number, clipDuration?: number, windowStart?: number): Promise<ScheduledSource | null>;
192
+ /** Drops the routed element's source once a decoded buffer plays in its place; it stays silent until a stop. */
193
+ releaseRouted(el: HTMLMediaElement): void;
194
+ /** A decoded buffer plays what an element carried: it cannot hold pitch through a speed change. */
195
+ hasHandedOverSources(): boolean;
196
+ /**
197
+ * Rebases the composition-time reference frame before swapping rate so
198
+ * `getTime()` stays continuous across the change. Sources scheduled to
199
+ * start in the future keep their original wallclock start time — callers
200
+ * that need rate-correct future starts should `stopAll()` and reschedule.
201
+ *
202
+ * Each decoded source's FX automation is re-aimed too. Lanes are committed to
203
+ * absolute context times when the source is scheduled, so bumping only
204
+ * `playbackRate` left every automated parameter running its original plan
205
+ * over audio moving at a different speed. The `stopAll()`+reschedule recovery
206
+ * in the runtime is no help here: it only fires for bounded sources, and a
207
+ * project-level music bed with no `data-duration` is unbounded, so it never
208
+ * recovered at all.
209
+ */
210
+ setRate(rate: number): boolean;
211
+ private setBusRate;
212
+ hasBoundedActiveSources(): boolean;
213
+ stopAll(): void;
214
+ private reconnectHandedOver;
215
+ /** Stops what plays from media gone from the page, without sending it to the destination as a stop does. */
216
+ releaseDetached(): void;
217
+ private dispose;
218
+ setVolume(volume: number): void;
219
+ /**
220
+ * The per-element gain carries the clip's AUTHOR gain, which reaches
221
+ * MAX_AUDIO_GAIN — so it is clamped against that ceiling, not the spec's
222
+ * [0,1]. `setVolume` above is the opposite case and stays spec-clamped: the
223
+ * user's master volume is a fader, not a gain.
224
+ *
225
+ * Clamping this one at unity capped every static above-unity `data-volume` on
226
+ * the preview path while the render honoured it — the exact preview/render
227
+ * divergence this ceiling exists to close. Automation lanes hid it, because
228
+ * they schedule ramps onto the param directly and never pass through here.
229
+ */
230
+ setElementVolume(el: HTMLMediaElement, volume: number, clipGain?: number, unfadedVolume?: number): void;
231
+ setMuted(muted: boolean): void;
232
+ private applyMasterGain;
233
+ ownsClock(): boolean;
234
+ /** Whether the transport currently plays THIS element (the runtime mutes it to
235
+ * avoid double audio; an unclaimed track stays audible). */
236
+ ownsElement(el: HTMLMediaElement): boolean;
237
+ /** Whether this element's native signal currently flows through the WebAudio graph. */
238
+ routesElement(el: HTMLMediaElement): boolean;
239
+ destroy(): void;
240
+ }
241
+ export {};