framefields 2.15.0 → 2.16.0
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/cloud/index.d.mts.map +1 -1
- package/dist/components/index.d.mts +2 -2
- package/dist/{index-BnB_Ou2y.d.mts → index-Cq8jgdNY.d.mts} +89 -2
- package/dist/index-Cq8jgdNY.d.mts.map +1 -0
- package/dist/{index-DkAjKnhW.d.mts → index-Dg5BAtDq.d.mts} +50 -50
- package/dist/{index-DkAjKnhW.d.mts.map → index-Dg5BAtDq.d.mts.map} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/preview/index.d.mts +2 -2
- package/dist/preview/index.mjs +2 -2
- package/dist/{preview-BeGF1Bb1.mjs → preview-Dm912wly.mjs} +37 -2
- package/dist/preview-Dm912wly.mjs.map +1 -0
- package/dist/preview-engine/{chunk-VM2ZBPLM.mjs → chunk-VZUVB3BP.mjs} +1 -1
- package/dist/preview-engine/components.mjs +1 -1
- package/dist/preview-engine/framefields.mjs +1 -1
- package/dist/preview-engine/player.mjs +3 -3
- package/dist/preview-page/main.css +1 -1
- package/dist/preview-page/main.js +121 -122
- package/package.json +61 -61
- package/dist/index-BnB_Ou2y.d.mts.map +0 -1
- package/dist/preview-BeGF1Bb1.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { $n as buildPathLUT, $r as Light3DOptions, $t as LongShadowConfig, Ai as
|
|
|
5
5
|
import "./renderer-DKJOon6y.mjs";
|
|
6
6
|
import { a as SfxTrigger, c as softLimit, i as SfxRenderContext, n as encodeStereoWav, o as mixSfxInto, r as RenderedSfx, s as renderSfx } from "./index-RILu3ULT.mjs";
|
|
7
7
|
import "./renderer-DU3f6ZrS.mjs";
|
|
8
|
-
import { $ as SpringConfig, $n as color, $o as EnvironmentFogSchema, $s as SpringOptions, $t as Scatter3DNode, A as VolumetricFogNoiseOptions, An as PoseKeypointName, Ao as BloomConfigSchema, As as MediaAnimatableProp, At as Icosphere3DOptions, B as PhysicsBody2D, Bn as ChartDatum, Bo as CarrierHandoffConfigSchema, Bs as SceneDefinitionSchema, Bt as Prism3DOptions, C as SectionOptions, Cc as computeStaggerDelay, Cn as ParticleBlend, Cs as LightType, Ct as Cube3DOptions, D as SubjectSandwichOptions, Dc as lintComposition, Dn as ClipVisionOptions, Do as AnimationTrack, Ds as MaterialTypeSchema, Dt as ExtrudeShape3DOptions, E as SubjectOutlineOptions, Ec as hoistMattes, En as ClipVision, Eo as AnimatablePropsFor, Er as AudioLevels, Es as MaterialType, Et as Cylinder3DOptions, F as StyleName, Fn as RigMap, Fo as CameraLens, Fs as Model3DNodeSchema, Ft as Line3DOptions, G as PhysicsWallsOptions, Gn as ChartType, Go as CompositorProgramConfig, Gs as SequenceOptions, Gt as Shard3DOptions, H as PhysicsRect, Hi as after, Hn as ChartPadding, Ho as ColorSignalOptions, Hs as SceneTransitionType, Ht as Ring3DOptions, I as Styles, In as retargetPose, Io as CameraNode, Is as ModelAnimationLayer, It as Plane3DOptions, J as Lighting, Jn as MarkOptions, Jo as CrowdConfig, Js as ShapeNode, Jt as Surface3DOptions, K as PhysicsWorld2D, Kn as ChartX, Ko as CompositorProgramSchema, Ks as SequenceTimelineResult, Kt as SolidShape3DNode, L as Physics, Ln as ChartAnimationOptions, Lo as CameraNodeSchema, Lr as Cue, Ls as NumberTrack, Lt as Points3DOptions, M as blurRegion, Mn as RIG_PRESETS, Mo as BoxNodeSchema, Ms as MediaNodeSchema, Mt as Instances3DOptions, N as editTrackedRegion, Ni as Theme, Nn as RetargetBone, No as CameraAnimation, Ns as Model3DAnimatableProp, Nt as Lathe3DOptions, O as TrackEditing, Oc as mergeAnimationTracks, On as PersonPlacement, Oo as BlockNode, Os as MatteMode, Ot as ExtrudedText3DOptions, P as section, Pi as ThemeInput, Pn as RetargetOptions, Po as CameraDoF, Ps as Model3DNode, Pt as Layer3D, Q as InterpolateOptions, Qn as code, Qo as EnvironmentFog, Qs as SpringBoneChain, Qt as Swarm3DOptions, R as Body2DOptions, Ra as pulseKeys, Rn as ChartAxisOptions, Ro as CameraShake, Rr as Cues, Rs as Scene, Rt as Polyhedron3DOptions, S as SectionNode, Sc as computeLayoutSync, Sn as EmitterShape, Ss as LightNodeSchema, St as Carousel3DOptions, T as SmartFramingOptions, Tc as evaluateTrackAtFrame, Tn as ParticleShape, To as AnimatableProp, Ts as LookAtConstraint, Tt as CubeFaceInput, U as PhysicsRopeOptions, Un as ChartSeries, Uo as ColorStop, Us as SceneTransitionTypeSchema, Ut as RoundedBox3DOptions, V as PhysicsGroundOptions, Vn as ChartOptions, Vo as CarrierState, Vs as SceneOptions, Vt as Pyramid3DOptions, W as PhysicsSpringOptions, Wn as ChartSlice, Wo as ColorStopSchema, Ws as Sequence, Wt as Shape3DContainer, X as LightingRigOptions, Xn as accent, Xo as EnvironmentFloor, Xs as SignalTrackOptions, Xt as Torus3DOptions, Y as LightingRig, Yn as TextSpanItem, Yo as EaseRef, Ys as ShapeNodeSchema, Yt as Text3DOptions, Z as Easing, Zn as bold, Zo as EnvironmentFloorSchema, Zs as SizeSpec, Zt as Tube3DOptions, _ as Media, _c as calculateSequenceTimeline, _n as BodyCommonOptions, _r as ai, _s as LayerAnimation, _t as SequenceNode, a as AnimatableNode, ac as TextSpanMarkSchema, an as Body3DOptions, ar as size, as as EnvironmentSsrSchema, at as interpolate, b as RenderVideoOptions, bc as computeCarrierContinuity, bn as PhysicsDriver, bo as withDefaults, br as Anchor, bs as LightAnimatableProp, bt as TransitionSpec, c as Composition, cc as ToneMappingSchema, cn as PhysicsBox3D, cr as sup, cs as EnvironmentVolumetricFogNoiseSchema, ct as measureText, d as Effect, da as defineTheme, dc as TrackSource, di as MotionPreset, dn as PhysicsWorld3D, dr as ApiError, ds as FlexNodeSchema, dt as preloadFont, ec as TextAnimatableProp, en as Scatter3DOptions, er as italic, es as EnvironmentGi, et as StrokeRect, f as EnvironmentOptions, fc as TwoBoneIkConstraint, fn as World3DOptions, fr as FRAMEFIELDS_AI_PROXY_URL, fs as FromToOptions, ft as requiresIsolation, g as LightOptions, gc as applyStaggerToChildren, gn as ParticlesOptions, gr as ValidationError, gs as KeyframeTuple, gt as SequenceEntry, h as Light, hc as WindConfig, hn as Particles, hr as RunOptions, hs as Keyframe, ht as SceneSequenceOptions, i as analyzeAudio, ic as TextNodeSchema, in as TerrainSurface, ir as rich, is as EnvironmentSsr, it as computeStrokeRect, j as VolumetricFogOptions, jn as PoseSource, jo as BoxNode, js as MediaNode, jt as InstanceTransform3D, k as TrackedRegionOptions, ki as Target, kn as PersonTrack, ko as BloomConfig, kr as BaseProps, ks as MatteModeSchema, kt as Grid3DOptions, l as CompositionOptions, lc as ToonShadingSchema, ln as PhysicsRope3DOptions, lr as Ai, ls as EnvironmentVolumetricFogSchema, lt as measureTextAsync, m as Layer, mc as WiggleOptions, mn as Fracture3DOptions, mr as Result, ms as JointPose, mt as springCalculation, n as bindComponent, nc as TextAnimatorSchema, nn as Terrain3DNode, nr as normalizeTextSpans, ns as EnvironmentPreset, nt as TextMeasureStyle, o as CameraOptions, oc as TextSpanSchema, on as FieldSample3D, or as span, os as EnvironmentVolumetricFog, ot as mapBlendModeToSkia, p as HdriPath, pc as Vec3Track, pn as Fracture3D, pr as QueueStatus, ps as GeometryOutlineOptionsSchema, pt as spring, q as World2DOptions, qn as DEFAULT_CHART_COLORS, qo as CompositorToProgramOptions, qs as ShapeAnimatableProp, qt as Sphere3DOptions, rc as TextNode, rn as Terrain3DOptions, rr as parseMarkup, rs as EnvironmentPresetSchema, rt as bezier, s as CompatibleEffect, sc as ToneMapping, sn as PhysicsBody3D, sr as sub, ss as EnvironmentVolumetricFogNoise, st as measureSpring, t as ComponentNode, tc as TextAnimator, tn as Sdf3DOptions, tr as mark, ts as EnvironmentGiSchema, tt as TextMeasureResult, u as EditableObjectTrack, uc as TrackSignal, un as PhysicsSpring3DOptions, uo as themes, ur as AiConfig, us as FlexNode, ut as preloadCompositionFonts, v as Model3DOptions, vc as collectNodeOps, vn as PhysicsBakeOptions, vs as LayoutNode, vt as Transition, w as SignalOrNumber, wc as evaluateAnimationAtFrame, wn as ParticleBounds, wo as AimConstraint, ws as LightTypeSchema, wt as CubeFaceConfig, x as RenderVideoResult, xc as computeLayout, xn as PhysicsWorldOptions, xs as LightNode, xt as Capsule3DOptions, y as NodeCapability, yc as compositorToProgram, yn as PhysicsCollision, ys as LayoutNodeSchema, yt as TransitionDirection, z as FieldSample2D, zn as ChartCandle, zo as CarrierHandoffConfig, zs as SceneDefinition, zt as Primitive3DNodeOptions } from "./index-
|
|
8
|
+
import { $ as SpringConfig, $n as color, $o as EnvironmentFogSchema, $s as SpringOptions, $t as Scatter3DNode, A as VolumetricFogNoiseOptions, An as PoseKeypointName, Ao as BloomConfigSchema, As as MediaAnimatableProp, At as Icosphere3DOptions, B as PhysicsBody2D, Bn as ChartDatum, Bo as CarrierHandoffConfigSchema, Bs as SceneDefinitionSchema, Bt as Prism3DOptions, C as SectionOptions, Cc as computeStaggerDelay, Cn as ParticleBlend, Cs as LightType, Ct as Cube3DOptions, D as SubjectSandwichOptions, Dc as lintComposition, Dn as ClipVisionOptions, Do as AnimationTrack, Ds as MaterialTypeSchema, Dt as ExtrudeShape3DOptions, E as SubjectOutlineOptions, Ec as hoistMattes, En as ClipVision, Eo as AnimatablePropsFor, Er as AudioLevels, Es as MaterialType, Et as Cylinder3DOptions, F as StyleName, Fn as RigMap, Fo as CameraLens, Fs as Model3DNodeSchema, Ft as Line3DOptions, G as PhysicsWallsOptions, Gn as ChartType, Go as CompositorProgramConfig, Gs as SequenceOptions, Gt as Shard3DOptions, H as PhysicsRect, Hi as after, Hn as ChartPadding, Ho as ColorSignalOptions, Hs as SceneTransitionType, Ht as Ring3DOptions, I as Styles, In as retargetPose, Io as CameraNode, Is as ModelAnimationLayer, It as Plane3DOptions, J as Lighting, Jn as MarkOptions, Jo as CrowdConfig, Js as ShapeNode, Jt as Surface3DOptions, K as PhysicsWorld2D, Kn as ChartX, Ko as CompositorProgramSchema, Ks as SequenceTimelineResult, Kt as SolidShape3DNode, L as Physics, Ln as ChartAnimationOptions, Lo as CameraNodeSchema, Lr as Cue, Ls as NumberTrack, Lt as Points3DOptions, M as blurRegion, Mn as RIG_PRESETS, Mo as BoxNodeSchema, Ms as MediaNodeSchema, Mt as Instances3DOptions, N as editTrackedRegion, Ni as Theme, Nn as RetargetBone, No as CameraAnimation, Ns as Model3DAnimatableProp, Nt as Lathe3DOptions, O as TrackEditing, Oc as mergeAnimationTracks, On as PersonPlacement, Oo as BlockNode, Os as MatteMode, Ot as ExtrudedText3DOptions, P as section, Pi as ThemeInput, Pn as RetargetOptions, Po as CameraDoF, Ps as Model3DNode, Pt as Layer3D, Q as InterpolateOptions, Qn as code, Qo as EnvironmentFog, Qs as SpringBoneChain, Qt as Swarm3DOptions, R as Body2DOptions, Ra as pulseKeys, Rn as ChartAxisOptions, Ro as CameraShake, Rr as Cues, Rs as Scene, Rt as Polyhedron3DOptions, S as SectionNode, Sc as computeLayoutSync, Sn as EmitterShape, Ss as LightNodeSchema, St as Carousel3DOptions, T as SmartFramingOptions, Tc as evaluateTrackAtFrame, Tn as ParticleShape, To as AnimatableProp, Ts as LookAtConstraint, Tt as CubeFaceInput, U as PhysicsRopeOptions, Un as ChartSeries, Uo as ColorStop, Us as SceneTransitionTypeSchema, Ut as RoundedBox3DOptions, V as PhysicsGroundOptions, Vn as ChartOptions, Vo as CarrierState, Vs as SceneOptions, Vt as Pyramid3DOptions, W as PhysicsSpringOptions, Wn as ChartSlice, Wo as ColorStopSchema, Ws as Sequence, Wt as Shape3DContainer, X as LightingRigOptions, Xn as accent, Xo as EnvironmentFloor, Xs as SignalTrackOptions, Xt as Torus3DOptions, Y as LightingRig, Yn as TextSpanItem, Yo as EaseRef, Ys as ShapeNodeSchema, Yt as Text3DOptions, Z as Easing, Zn as bold, Zo as EnvironmentFloorSchema, Zs as SizeSpec, Zt as Tube3DOptions, _ as Media, _c as calculateSequenceTimeline, _n as BodyCommonOptions, _r as ai, _s as LayerAnimation, _t as SequenceNode, a as AnimatableNode, ac as TextSpanMarkSchema, an as Body3DOptions, ar as size, as as EnvironmentSsrSchema, at as interpolate, b as RenderVideoOptions, bc as computeCarrierContinuity, bn as PhysicsDriver, bo as withDefaults, br as Anchor, bs as LightAnimatableProp, bt as TransitionSpec, c as Composition, cc as ToneMappingSchema, cn as PhysicsBox3D, cr as sup, cs as EnvironmentVolumetricFogNoiseSchema, ct as measureText, d as Effect, da as defineTheme, dc as TrackSource, di as MotionPreset, dn as PhysicsWorld3D, dr as ApiError, ds as FlexNodeSchema, dt as preloadFont, ec as TextAnimatableProp, en as Scatter3DOptions, er as italic, es as EnvironmentGi, et as StrokeRect, f as EnvironmentOptions, fc as TwoBoneIkConstraint, fn as World3DOptions, fr as FRAMEFIELDS_AI_PROXY_URL, fs as FromToOptions, ft as requiresIsolation, g as LightOptions, gc as applyStaggerToChildren, gn as ParticlesOptions, gr as ValidationError, gs as KeyframeTuple, gt as SequenceEntry, h as Light, hc as WindConfig, hn as Particles, hr as RunOptions, hs as Keyframe, ht as SceneSequenceOptions, i as analyzeAudio, ic as TextNodeSchema, in as TerrainSurface, ir as rich, is as EnvironmentSsr, it as computeStrokeRect, j as VolumetricFogOptions, jn as PoseSource, jo as BoxNode, js as MediaNode, jt as InstanceTransform3D, k as TrackedRegionOptions, ki as Target, kn as PersonTrack, ko as BloomConfig, kr as BaseProps, ks as MatteModeSchema, kt as Grid3DOptions, l as CompositionOptions, lc as ToonShadingSchema, ln as PhysicsRope3DOptions, lr as Ai, ls as EnvironmentVolumetricFogSchema, lt as measureTextAsync, m as Layer, mc as WiggleOptions, mn as Fracture3DOptions, mr as Result, ms as JointPose, mt as springCalculation, n as bindComponent, nc as TextAnimatorSchema, nn as Terrain3DNode, nr as normalizeTextSpans, ns as EnvironmentPreset, nt as TextMeasureStyle, o as CameraOptions, oc as TextSpanSchema, on as FieldSample3D, or as span, os as EnvironmentVolumetricFog, ot as mapBlendModeToSkia, p as HdriPath, pc as Vec3Track, pn as Fracture3D, pr as QueueStatus, ps as GeometryOutlineOptionsSchema, pt as spring, q as World2DOptions, qn as DEFAULT_CHART_COLORS, qo as CompositorToProgramOptions, qs as ShapeAnimatableProp, qt as Sphere3DOptions, rc as TextNode, rn as Terrain3DOptions, rr as parseMarkup, rs as EnvironmentPresetSchema, rt as bezier, s as CompatibleEffect, sc as ToneMapping, sn as PhysicsBody3D, sr as sub, ss as EnvironmentVolumetricFogNoise, st as measureSpring, t as ComponentNode, tc as TextAnimator, tn as Sdf3DOptions, tr as mark, ts as EnvironmentGiSchema, tt as TextMeasureResult, u as EditableObjectTrack, uc as TrackSignal, un as PhysicsSpring3DOptions, uo as themes, ur as AiConfig, us as FlexNode, ut as preloadCompositionFonts, v as Model3DOptions, vc as collectNodeOps, vn as PhysicsBakeOptions, vs as LayoutNode, vt as Transition, w as SignalOrNumber, wc as evaluateAnimationAtFrame, wn as ParticleBounds, wo as AimConstraint, ws as LightTypeSchema, wt as CubeFaceConfig, x as RenderVideoResult, xc as computeLayout, xn as PhysicsWorldOptions, xs as LightNode, xt as Capsule3DOptions, y as NodeCapability, yc as compositorToProgram, yn as PhysicsCollision, ys as LayoutNodeSchema, yt as TransitionDirection, z as FieldSample2D, zn as ChartCandle, zo as CarrierHandoffConfig, zs as SceneDefinition, zt as Primitive3DNodeOptions } from "./index-Dg5BAtDq.mjs";
|
|
9
9
|
import "./index-CYVpYGM-.mjs";
|
|
10
10
|
import { a as ExtractedAudioSignalsBundle, i as AudioSignalOptions, n as AudioPitchSignals, r as AudioSignal, t as AudioPitchOptions } from "./audio-7oqTUi4G.mjs";
|
|
11
11
|
import { a as RegisteredFont, i as RegisterFontOptions, n as MeasureTextOptions, o as TextMetrics, r as MeasuredGlyph, t as FontManager } from "./index-TCtdSXd7.mjs";
|
|
@@ -13,5 +13,5 @@ import { A as VisionBundle, C as PoseSkeletonRenderer, D as SpatialLandmarkTrans
|
|
|
13
13
|
import { C as Sam3Precision, S as Sam3Options, d as Sam2Model, h as Sam2Prompt, m as Sam2Point, o as Sam2FrameResult, p as Sam2Options, w as Sam3Prompt } from "./index-BHTycml5.mjs";
|
|
14
14
|
import { $ as TileOffsetEdgeMode, $n as ResizerScalerProps, $t as FlipProps, An as Paint, At as CameraParallax3DProps, B as PBRGlass, Bn as Pixelate, Bt as ContourProps, C as GradientMapProps, Cn as MeshWarp, Ct as AudioParametricEq, D as HalftoneScreen, Dn as NoiseGeneratorProps, Dt as CRT, E as HalftoneMode, En as NoiseGenerator, Et as AudioReverbProps, F as LevelsProps, Fn as Painterly, Ft as ColorBalance, G as SSAOProps, Gn as ProceduralVFXProps, Gt as DatamoshProps, H as Relight3D, Hn as Posterize, I as Modulate, In as PainterlyProps, It as ColorBalanceProps, J as SelectiveColorProps, Jn as RefineEdge, Jt as Dither, K as SelectiveColor, Kn as RGBSplit, Kt as DisplacementMap, L as ModulateProps, Ln as PatchHeal, Lt as ColorKey, M as HighPassProps, Mt as ChannelMergerProps, N as LevelChannel, Nt as ChannelSplitter, O as HalftoneScreenProps, On as OpArt, Ot as CRTProps, P as Levels, Pt as ChannelSplitterProps, Q as TileOffset, Qn as ResizerScaler, Qt as Flip, R as MotionBlur, Rt as ColorKeyProps, S as GradientMap, Sn as MaskMathProps, St as AudioNoiseGateProps, T as HalftoneDotShape, Tn as MeshWarpProps, Tt as AudioReverb, U as Relight3DProps, Un as PosterizeProps, Ut as CornerPinProps, V as PBRGlassProps, Vn as PixelateProps, Vt as CornerPin, W as SSAO, Wn as ProceduralVFX, Wt as Datamosh, X as ShadowsHighlightsProps, Xn as RefractionCaustics3D, Xt as ExtractLUT, Y as ShadowsHighlights, Yn as RefineEdgeProps, Yt as DitherProps, Z as TemporalDeflicker, Zn as RefractionCaustics3DProps, Zt as ExtractLUTProps, _ as EffectConfigMap, _t as AudioDelay, a as ApplyLUTProps, an as KaleidoscopeProps, ar as Toon, b as FilmGrain, bn as LiquifyProps, bt as AudioFadeProps, c as Crop, cn as KenBurnsProps, cr as TrailsProps, d as CurvesChannelPoint, dt as Blur, en as Gooey, er as Rotate, et as TileOffsetProps, f as CurvesProps, ft as BlurProps, g as DepthOfFieldProps, gn as LayerStyleProps, gt as AudioCompressorProps, h as DepthOfField, ht as AudioCompressor, i as ApplyLUT, in as Kaleidoscope, it as VisionProps, j as HighPass, jn as PaintProps, jt as ChannelMerger, kn as OpArtProps, kt as CameraParallax3D, l as CropProps, ln as LayerStyle, lr as Vignette, lt as effectFactories, m as DeflickerProps, mt as AsciiProps, n as AnyEffect, nn as Iridescence, nr as StereoPanning, nt as UnsharpMaskProps, o as AudioSignalExtractor, on as KenBurns, or as ToonProps, p as CustomEffect, pt as Ascii, q as SelectiveColorAdjustment, qn as RGBSplitProps, qt as DisplacementMapProps, r as AnyVisualEffect, rn as IridescenceProps, rr as StereoPanningProps, rt as Vision, s as AudioSignalExtractorProps, sr as Trails, t as AnyAudioEffect, tn as GooeyProps, tr as RotateProps, tt as UnsharpMask, u as Curves, ur as VignetteProps, ut as effectMeta, v as EffectOp, vn as Liquify, vt as AudioDelayProps, w as GradientMapStop, wt as AudioParametricEqProps, x as FilmGrainProps, xn as MaskMath, xt as AudioNoiseGate, y as EffectPropsFor, yt as AudioFade, z as MotionBlurProps, zn as PatchHealProps, zt as Contour } from "./index-BcxxxwhV.mjs";
|
|
15
15
|
import { C as formatQaReport, D as stitchChunks, E as resetRenderCaches, S as VideoQaStats, T as renderSemaphore, _ as RenderProgress, a as renderFrameGrid, b as VideoQaOptions, c as ChunkPlan, f as HeadlessMediaRenderer, g as QaSegment, h as QaIssue, i as computeGridLayout, l as ChunkPlanOptions, m as PlannedChunk, n as FrameGridRenderable, o as resolveSamplePoints, p as HeadlessWebGPURenderer, r as FrameSamplePoint, s as AudioQaStats, t as FrameGridOptions, u as FrameCostSample, v as StitchOptions, w as planChunks, x as VideoQaReport, y as StitchResult } from "./index-DhL7ckvs.mjs";
|
|
16
|
-
import { a as startPreview, i as PreviewSource, n as PreviewOptions, r as PreviewSession, t as PreviewCloseReason } from "./index-
|
|
16
|
+
import { a as startPreview, i as PreviewSource, n as PreviewOptions, r as PreviewSession, t as PreviewCloseReason } from "./index-Cq8jgdNY.mjs";
|
|
17
17
|
export { AETextAnimator, AETextAnimatorSchema, AdvancedTextAnimator, AdvancedTextAnimatorBuilder, AdvancedTextAnimatorSchema, Ai, AiConfig, AimConstraint, Anchor, AnchorGrouping, AnchorGroupingSchema, AnchorPreset, AnchorPresetSchema, AnimatableGlyphProps, AnimatableGlyphPropsSchema, AnimatableNode, AnimatableProp, AnimatablePropsFor, AnimationClip3D, AnimationTrack, AnimationType, AnimationTypeSchema, AnyAudioEffect, AnyEffect, AnyOutputUnion, AnyOutputUnionSchema, AnyVisualEffect, ApiError, ApplyLUT, ApplyLUTProps, ArcLengthLUTEntry, Ascii, AsciiProps, AudioCompressor, AudioCompressorProps, AudioDelay, AudioDelayProps, AudioExtractorSignalData, AudioExtractorSignalDataSchema, AudioFade, AudioFadeProps, AudioLatentData, AudioLatentEngine, AudioLatentTrackCache, AudioLevels, AudioMeshDeformPipeline, AudioNoiseGate, AudioNoiseGateProps, AudioParametricEq, AudioParametricEqProps, AudioPitchOptions, AudioPitchSignals, AudioQaStats, AudioReverb, AudioReverbProps, AudioSignal, AudioSignalExtractor, AudioSignalExtractorProps, AudioSignalOptions, AudioSpectrumTypography, AudioSpectrumTypographySchema, BaseMediaOperationProps, BaseMediaOperationPropsSchema, BaseProps, BaseVideoLayerProps, BaseVideoLayerPropsSchema, BezierSegment3D, BlendMode, BlockNode, BloomConfig, BloomConfigSchema, Blur, BlurProps, Body2DOptions, Body3DOptions, BodyCommonOptions, Bone3D, BoxNode, BoxNodeSchema, Brand, CAPTION_LAYER_DEFAULTS, COCO17_BONES, COCO17_KEYPOINTS, COCO17_KEYPOINT_NAMES, COCO_CLASSES, COMPOSITE_OPERATIONS, COMPOSITOR_DEFAULTS, CRT, CRTProps, CUBE_FLIP, Camera3D, Camera3DPose, CameraAnimation, CameraDoF, CameraLens, CameraNode, CameraNodeSchema, CameraOptions, CameraParallax3D, CameraParallax3DProps, CameraShake, CameraShakeOptions, CannyComputePipeline, CannyOptions, Capsule3DOptions, Carousel3DOptions, CarrierHandoffConfig, CarrierHandoffConfigSchema, CarrierState, CatmullRomOptions, ChannelMerger, ChannelMergerProps, ChannelSplitter, ChannelSplitterProps, ChartAnimationOptions, ChartAxisOptions, ChartCandle, ChartDatum, ChartOptions, ChartPadding, ChartSeries, ChartSlice, ChartType, ChartX, ChromaticGlitchConfig, ChromaticGlitchConfigSchema, ChunkPlan, ChunkPlanOptions, CirclePathOptions, ClipVision, ClipVisionOptions, Color, ColorBalance, ColorBalanceProps, ColorKey, ColorKeyProps, ColorSignalOptions, ColorStop, ColorStopLike, ColorStopSchema, CompatibleEffect, ComponentNode, Composition, CompositionOptions, CompositorProgramConfig, CompositorProgramSchema, CompositorToProgramOptions, ConfigHandle, ConfigHandleSchema, ConfigSchemaRegistry, ConnectedInput, Contour, ContourProps, ControlNetConditioningOutputs, ControlNetMultiplexer, CornerPin, CornerPinProps, Crop, CropProps, CrowdConfig, Cube3DOptions, CubeFaceConfig, CubeFaceInput, CubeLensOptions, CubicBezierSegment, CubicBezierSegmentSchema, Cue, Cues, Curves, CurvesChannelPoint, CurvesProps, CustomEffect, Cylinder3DOptions, DATA_TYPE_EXTENSIONS, DEFAULT_CHART_COLORS, DEFAULT_DURATION_MS, DEFAULT_FPS, DEFAULT_MEDIA_DIMENSION, DIRECT_LIGHT_FLOATS, DOPPLER_LUT_MAX, DOPPLER_LUT_SIZE, DataForType, DataType, DataTypeEnum, DataTypeVal, DataTypes, Datamosh, DatamoshProps, DeflickerOptions, DeflickerProps, Degrees, DepthNormalsComputePipeline, DepthNormalsOptions, DepthOfField, DepthOfFieldProps, DetectedObject, DisplacementMap, DisplacementMapProps, Dither, DitherProps, DynamicStrokeProperties, DynamicStrokePropertiesSchema, ENVIRONMENT_PRESETS, EaseRef, Easing, EditableObjectTrack, Effect, EffectConfig, EffectConfigMap, EffectConfigValue, EffectDomain, EffectOp, EffectPipeline, EffectPropsFor, EmitterShape, EmojiPresentation, EnhancedTextNode, EnhancedTextNodeSchema, Environment3DFloor, Environment3DFog, Environment3DGiOptions, Environment3DOptions, Environment3DSsrOptions, Environment3DVolumetricFog, Environment3DVolumetricFogNoise, EnvironmentFloor, EnvironmentFloorSchema, EnvironmentFog, EnvironmentFogSchema, EnvironmentGi, EnvironmentGiSchema, EnvironmentOptions, EnvironmentPreset, EnvironmentPresetSchema, EnvironmentSsr, EnvironmentSsrSchema, EnvironmentVolumetricFog, EnvironmentVolumetricFogNoise, EnvironmentVolumetricFogNoiseSchema, EnvironmentVolumetricFogSchema, ExportResult, ExportResultSchema, ExpressionEvaluationContext, ExpressionSelector, ExpressionSelectorSchema, ExtendedGlyphProperties, ExtendedGlyphPropertiesSchema, ExtendedLayer, ExtendedLayerSchema, ExtractLUT, ExtractLUTProps, ExtractedAudioSignalsBundle, ExtrudeShape3DOptions, ExtrudedText3DOptions, FRAMEFIELDS_AI_PROXY_URL, FaceLandmarksOptions, FieldSample2D, FieldSample3D, FileAsset, FileAssetSchema, FileData, FileDataSchema, FilmGrain, FilmGrainProps, FlexNode, FlexNodeSchema, Flip, FlipProps, FontManager, Fps, FractalMode, FractalOptions, Fracture3D, Fracture3DOptions, FrameContext, FrameCostSample, FrameGridOptions, FrameGridRenderable, FrameIndex, FrameSamplePoint, FrameSignal, FromToOptions, FrustumPlane, FrustumPlanes, GPULightData, GPUTextureBinding, GateSignalOptions, GeneratorSignalData, GeneratorSignalDataSchema, GeometryOutlineOptions, GeometryOutlineOptionsSchema, GlassPipeline, GlobalCompositeOperation, GlyphAnchorGrouping, GlyphAnchorGroupingSchema, GlyphAnchorPoint, GlyphAnchorPointSchema, Gooey, GooeyProps, GpuAdapterDescription, Gradient, GradientMap, GradientMapProps, GradientMapStop, GradientType, Grid3DOptions, HalftoneDotShape, HalftoneMode, HalftoneScreen, HalftoneScreenProps, HandleId, HandleLabel, HandleType, HandleTypeVal, HdriPath, HdriUniforms, HeadlessMediaRenderer, HeadlessWebGPURenderer, HelixOptions, HighPass, HighPassProps, Icosphere3DOptions, InstanceMask, InstanceTransform3D, Instances3DOptions, InterpolateOptions, Iridescence, IridescenceProps, JointPose, JsonArray, JsonObject, JsonValue, JsonValueSchema, Kaleidoscope, KaleidoscopeProps, KenBurns, KenBurnsProps, Keyframe, KeyframeTuple, KineticMarqueeConfig, KineticMarqueeConfigSchema, LIGHT_UNIFORM_SIZE_BYTES, Landmark3D, LandmarkCoordinateSignals, Lathe3DOptions, Layer, Layer3D, LayerAnimation, LayerStyle, LayerStyleProps, LayoutNode, LayoutNodeSchema, LensProjection, LevelChannel, Levels, LevelsProps, Light, Light3D, Light3DOptions, LightAnimatableProp, LightKind, LightNode, LightNodeSchema, LightOptions, LightType, LightTypeSchema, Lighting, LightingRig, LightingRigOptions, LightsUniformData, Line3DOptions, LineSpacingDynamics, LineSpacingDynamicsSchema, Liquify, LiquifyProps, LoadModelOptions, LongShadowConfig, LongShadowConfigSchema, LookAtConstraint, MAX_GRADIENT_STOPS, MAX_LIGHTS, MIME_TYPES, MarkOptions, MaskMath, MaskMathProps, MaskTrackSignals, Mat4, Material3D, MaterialType, MaterialTypeSchema, Matrix4Math, MatteMode, MatteModeSchema, MeasureTextOptions, MeasuredGlyph, Media, MediaAnimatableProp, MediaMetadata, MediaMetadataSchema, MediaNode, MediaNodeSchema, MediaOperation, MediaOperationSchema, MediaService, MediaSignalRecorder, MediaSourceDescriptor, MediaSourceInput, MediaSourceRange, MediaSourceSchema, MediaTimeRemap, MediaTimeRemapInput, MediaTimeRemapInputSchema, MediaTimeRemapSchema, MediaTimeSignalRemap, MediaTimeSignalRemapSchema, Mesh3DData, MeshAudioDeformConfig, MeshWarp, MeshWarpProps, Milliseconds, Model3DAnimatableProp, Model3DData, Model3DNode, Model3DNodeSchema, Model3DOptions, ModelAnimationLayer, ModerationError, ModerationUnrefundableError, Modulate, ModulateProps, MotionBlur, MotionBlurPipeline, MotionBlurProps, MotionPreset, MultiOutputGeneric, MultiOutputGenericSchema, NodeAnimationTrack3D, NodeCapability, NodeId, NodeInputConnection, NodeMetadata, NodeMetadataSchema, NodeOperation, NodeProcessorContext, NodeProcessorParams, NodeResult, NodeResultSchema, NodeRunFunction, NodeValidationFn, NodeVisualConfig, NodeVisualConfigSchema, Noise, NoiseGenerator, NoiseGeneratorProps, NormalRelightingOptions, Normalized, NormalizedLandmarkList, NumberTrack, ObjectAnchorName, ObjectAnchorsSignals, ObjectBoundingBox, ObjectBoundingBoxSignals, ObjectCollectionSignals, ObjectKinematicsSignals, ObjectTrackSignals, OpArt, OpArtProps, OpticalFlowComputePipeline, OpticalFlowOptions, Output, OutputItem, OutputItemSchema, PBRGlass, PBRGlassProps, Paint, PaintProps, Painterly, PainterlyProps, ParsedGradient, ParsedGradientStop, ParticleBlend, ParticleBounds, ParticleDissolveConfig, ParticleDissolveConfigSchema, ParticleShape, Particles, ParticlesOptions, PatchHeal, PatchHealProps, Path3D, Path3DPoint, Path3DSample, PathChainLUT, PathChainLUTEntry, PersonMatte, PersonPlacement, PersonTrack, Physics, PhysicsBakeOptions, PhysicsBody2D, PhysicsBody3D, PhysicsBox3D, PhysicsCollision, PhysicsDriver, PhysicsGroundOptions, PhysicsRect, PhysicsRope3DOptions, PhysicsRopeOptions, PhysicsSpring3DOptions, PhysicsSpringOptions, PhysicsWallsOptions, PhysicsWorld2D, PhysicsWorld3D, PhysicsWorldOptions, PinToLandmarkOptions, PinToObjectOptions, Pixelate, PixelateProps, Pixels, Plane3DOptions, PlannedChunk, Points3DOptions, Polyhedron3DOptions, PoseKeypointName, PoseLandmarkSignals, PoseResult, PoseSkeletonOptions, PoseSkeletonRenderer, PoseSource, Posterize, PosterizeProps, PreviewCloseReason, PreviewOptions, PreviewSession, PreviewSource, Primitive3DNodeOptions, Prism3DOptions, ProceduralVFX, ProceduralVFXProps, ProgrammaticSignal, ProgrammaticSignalOptions, Pyramid3DOptions, QaIssue, QaSegment, QueueStatus, RGBSplit, RGBSplitProps, RIG_PRESETS, RadialExtent, Radians, RefineEdge, RefineEdgeProps, RefractionCaustics3D, RefractionCaustics3DProps, RegisterFontOptions, RegisteredFont, Relight3D, Relight3DProps, RenderContextValue, RenderDiagnostic, RenderProgress, RenderVideoOptions, RenderVideoResult, RenderedSfx, Renderer2D, Renderer3D, ResizerScaler, ResizerScalerProps, ResolvedEnvironment, ResolvedGi, ResolvedMediaTimeRemap, ResolvedSsr, ResolvedVolumetricFog, Result, RetargetBone, RetargetOptions, Rgba, RigMap, Ring3DOptions, Rotate, RotateProps, RoundedBox3DOptions, RunOptions, SSAO, SSAOPipeline, SSAOProps, Sam2FrameResult, Sam2Model, Sam2Options, Sam2Point, Sam2Prompt, Sam3Options, Sam3Precision, Sam3Prompt, SampledMediaSignal, Scatter3DNode, Scatter3DOptions, ScatterPoint, Scene, SceneDefinition, SceneDefinitionSchema, SceneOptions, SceneSequenceOptions, SceneTransitionType, SceneTransitionTypeSchema, ScreenIndirectPass, Sdf3DOptions, SdfPrimitive, Seconds, SectionNode, SectionOptions, SegmentationOptions, SegmentationResult, SegmentationTexturePool, SelectiveColor, SelectiveColorAdjustment, SelectiveColorProps, SelectorBasedOn, SelectorBasedOnSchema, SelectorMode, SelectorModeSchema, SelectorShape, SelectorShapeSchema, SelectorUnits, SelectorUnitsSchema, Sequence, SequenceEntry, SequenceNode, SequenceOptions, SequenceTimelineResult, SfxRenderContext, SfxTrigger, ShadowPipeline, ShadowUniformInfo, ShadowsHighlights, ShadowsHighlightsProps, Shape3DContainer, ShapeAnimatableProp, ShapeNode, ShapeNodeSchema, Shard3DOptions, Signal, SignalBuilderConfig, SignalChannelMeta, SignalChannelMetaSchema, SignalContext, SignalData, SignalDataSchema, SignalGateData, SignalGateDataSchema, SignalMathData, SignalMathDataSchema, SignalOrNumber, SignalStats, SignalStatsSchema, SignalTrackOptions, SignalValue, SineSignalOptions, SingleOutputGeneric, SingleOutputGenericSchema, SizeSpec, Skeleton3D, SkewProperties, SkewPropertiesSchema, SlugFontCache, SlugPipeline, SmartFramingOptions, SolidShape3DNode, SourceOperationSchema, Spatial3DProperties, Spatial3DPropertiesSchema, SpatialLandmarkTransformer, Sphere3DOptions, SpringBoneChain, SpringConfig, SpringOptions, SpringPhysics, SpringPhysicsSchema, StereoPanning, StereoPanningProps, StitchOptions, StitchResult, StorageService, StrokeRect, StyleName, Styles, SubjectOutlineOptions, SubjectSandwichOptions, Surface3DOptions, Swarm3DOptions, TEXT_LAYER_DEFAULTS, Target, TemporalDeflicker, TemporalDeflickerPipeline, TemporalObjectTracker, TensorData, TensorDimensions, TensorFormat, TensorNode, TensorPipeline, TensorPipelineConfig, TensorSource, TensorViewExport, Terrain3DNode, Terrain3DOptions, TerrainColorByElevation, TerrainNoiseOptions, TerrainSurface, Text3DOptions, TextAnchorConfig, TextAnchorConfigSchema, TextAnimatableProp, TextAnimator, TextAnimatorBuilder, TextAnimatorSchema, TextCursorConfig, TextCursorConfigSchema, TextCursorStyle, TextCursorStyleSchema, TextMeasureResult, TextMeasureStyle, TextMetrics, TextNode, TextNodeSchema, TextOperationSchema, TextPathBuilder, TextPathOptions, TextPathOptionsSchema, TextPathSource, TextPathSourceSchema, TextRangeSelector, TextRangeSelectorSchema, TextScrambleConfig, TextScrambleConfigSchema, TextSelector, TextSelectorSchema, TextSignalSelector, TextSignalSelectorSchema, TextSpan, TextSpanItem, TextSpanMark, TextSpanMarkSchema, TextSpanSchema, TextWigglySelector, TextWigglySelectorSchema, Theme, ThemeInput, TileOffset, TileOffsetEdgeMode, TileOffsetProps, TimelineSegmentSchema, TimelineTransform, TimelineTransformSchema, ToneMapping, ToneMappingSchema, Toon, ToonProps, ToonShading, ToonShadingSchema, Torus3DOptions, TrackEditing, TrackSignal, TrackSource, TrackedObject, TrackedRegionOptions, Trails, TrailsProps, Transition, TransitionDirection, TransitionSchema, TransitionSpec, TransitionType, TransitionTypeSchema, Tube3DOptions, TwoBoneIkConstraint, TypewriterAnimator, TypewriterAnimatorSchema, TypingCadence, TypingCadenceSchema, UnsharpMask, UnsharpMaskProps, ValidationError, VariableFontAxes, VariableFontAxesSchema, Vec2, Vec2Schema, Vec3, Vec3Track, Vector3Math, VideoAnimation, VideoAnimationSchema, VideoLayerType, VideoLayerTypeSchema, VideoQaOptions, VideoQaReport, VideoQaStats, VideoSpatialPropsSchema, VideoStylePropsSchema, VideoTextPropsSchema, VideoTimingPropsSchema, Vignette, VignetteProps, VirtualMediaData, VirtualMediaDataSchema, Vision, VisionAnalysisReport, VisionBundle, VisionConfig, VisionNode, VisionNodeSpec, VisionProps, VisionRunner, VisionTask, VisionVariant, VolumetricFogNoiseOptions, VolumetricFogOptions, VolumetricFogPipeline, VolumetricFormationConfig, VolumetricFormationConfigSchema, VolumetricFormationMode, VolumetricFormationModeSchema, WiggleOptions, WindConfig, World2DOptions, World3DOptions, WritableSignal, XYPosition, aberrate, accent, after, ai, analyzeAudio, analyzeSequence, appendOperation, applyStaggerToChildren, assertFps, assertNever, bezier, bindComponent, blurRegion, bold, buildPathLUT, calculateSequenceTimeline, cameraBasis, checkNodeResultCache, code, collectNodeOps, color, compositionFrameContext, compositorToProgram, computeAnchorPivotOffset, computeCarrierContinuity, computeGridLayout, computeLayout, computeLayoutSync, computeLineLeadingDisplacement, computeRangeSelectorWeight, computeStaggerDelay, computeStrokeRect, computeVideoCropRenderProps, computed, cosineSignal, createNoise, createOutputItemSchema, createRandom, createVirtualMedia, cubeFaceCameras, cubeTexel, dataTypeColors, defaultCubeFaceSize, defineTheme, degrees, describeGpu, deserializeSignalData, deterministicWigglyNoise, distanceToCurveParameter, dopplerColorMatrix, dopplerLuminanceGain, dopplerLut, editTrackedRegion, effectFactories, effectMeta, ellipseToCubicBeziers, emojiPresentation, encodeStereoWav, ensureDevice, evaluateAnimationAtFrame, evaluateCubicBezier, evaluateCubicBezierDerivative, evaluateExpressionSelector, evaluateMarqueeOffset, evaluateSelectorCombination, evaluateSkewMatrix, evaluateSpringProgress, evaluateTrackAtFrame, evaluateTypewriterState, evaluateVolumetricFormation, extractSvgDimensions, findSourceAsset, formatHex, formatQaReport, fps, fractal2, frame, frameArraySignal, frameCount, frameSignal, generateArcLengthLUT, generateId, generatePathSegments, getActiveMediaMetadata, getFileDataMetadata, getFingerprint, getLeafMediaType, getMediaType, getRenderFingerprint, getScramblePool, getShuffledOrder, gradientStopsToOklab, handleId, handleLabel, hasOnlySingleSource, hoistMattes, inputStore, interpolate, isCssGradient, isEqual, isFrameIndex, isNormalized, isSignal, isValueSignal, isVirtualMediaData, italic, lensCenterDensity, limitGradientStops, linearRgb, lintComposition, loadFBX, loadModel3D, loadOBJ, lorentzFactor, lutStore, mapBlendModeToSkia, mark, measureSpring, measureText, measureTextAsync, mediaSourceIsHold, mediaSourceRange, mediaSourceRate, mediaSourceTime, mergeAnimationTracks, mixAudioTracks, mixColors, mixSfxInto, ms, nodeId, normalizeColorStops, normalizeTextSpans, normalized, oklabToRgb, parseColorToRgb, parseCssColor, parseCssGradient, parseFBX, parseMTL, parseMarkup, parseOBJ, parseSvgPathToCubicBeziers, pinNodeToLandmark, pinNodeToObject, pixels, planChunks, preloadCompositionFonts, preloadFont, programmaticSignal, progressSignal, pulseKeys, radians, registerSignalDependency, renderFrameGrid, renderSemaphore, renderSfx, reportRenderDiagnostic, requiresIsolation, resetRenderCaches, resolveBoolean, resolveEnvironment, resolveFrameRequest, resolveGi, resolveMediaMimeType, resolveNumber, resolveParam, resolveSamplePoints, resolveSsr, resolveString, resolveVolumetricFog, retargetPose, rgbToOklab, rich, sampleAudioSpectrumScale, sampleColorStops, sampleCurveGeometry, sampleFrameMediaSignal, sampleMediaSignal, samplePathChainGeometry, sampledMediaSourceRange, sampledMediaSourceTime, seconds, section, serializeSignalData, shaderStore, signal, signalBuilder, signalRegistry, sineSignal, size, softLimit, span, spring, springCalculation, stampResult, startPreview, stitchChunks, sub, sup, takeRenderDiagnostics, terrace, textureCache, themes, timeSignal, updateClockSignals, validateMediaTimeRemap, waveToCubicBeziers, withDefaults };
|
package/dist/index.mjs
CHANGED
|
@@ -55,6 +55,6 @@ import "./renderer-Dq7AioJa.mjs";
|
|
|
55
55
|
import "./renderer-Dt4sqNEu.mjs";
|
|
56
56
|
import { $ as NoiseGenerator, A as AudioParametricEq, B as Datamosh, C as effectFactories, D as AudioDelay, E as AudioCompressor, F as ChannelSplitter, G as Gooey, H as Dither, I as ColorBalance, J as KenBurns, K as Iridescence, L as ColorKey, M as CRT, N as CameraParallax3D, O as AudioFade, P as ChannelMerger, Q as MeshWarp, R as Contour, S as Vision, T as Ascii, U as ExtractLUT, V as DisplacementMap, W as Flip, X as Liquify, Y as LayerStyle, Z as MaskMath, _ as SelectiveColor, a as CustomEffect, at as Posterize, b as TileOffset, c as GradientMap, ct as RefineEdge, d as Levels, dt as Rotate, et as OpArt, f as Modulate, ft as StereoPanning, g as SSAO, gt as effectMeta, h as Relight3D, ht as Vignette, i as Curves, it as Pixelate, j as AudioReverb, k as AudioNoiseGate, l as HalftoneScreen, lt as RefractionCaustics3D, m as PBRGlass, mt as Trails, n as AudioSignalExtractor, nt as Painterly, o as DepthOfField, ot as ProceduralVFX, p as MotionBlur, pt as Toon, q as Kaleidoscope, r as Crop, rt as PatchHeal, s as FilmGrain, st as RGBSplit, t as ApplyLUT, tt as Paint, u as HighPass, ut as ResizerScaler, v as ShadowsHighlights, w as Blur, x as UnsharpMask, y as TemporalDeflicker, z as CornerPin } from "./effects-DlRMovU5.mjs";
|
|
57
57
|
import { a as resetRenderCaches, c as HeadlessWebGPURenderer, i as planChunks, l as formatQaReport, n as renderFrameGrid, o as stitchChunks, r as resolveSamplePoints, s as HeadlessMediaRenderer, t as computeGridLayout, u as renderSemaphore } from "./renderer-tvYj306A.mjs";
|
|
58
|
-
import { t as startPreview } from "./preview-
|
|
58
|
+
import { t as startPreview } from "./preview-Dm912wly.mjs";
|
|
59
59
|
|
|
60
60
|
export { AETextAnimatorSchema, AdvancedTextAnimatorBuilder, AdvancedTextAnimatorSchema, AnchorGroupingSchema, AnchorPresetSchema, AnimatableGlyphPropsSchema, AnimationTypeSchema, AnyOutputUnionSchema, ApiError, ApplyLUT, Ascii, AudioCompressor, AudioDelay, AudioExtractorSignalDataSchema, AudioFade, AudioLatentEngine, AudioLatentTrackCache, AudioMeshDeformPipeline, AudioNoiseGate, AudioParametricEq, AudioReverb, AudioSignal, AudioSignalExtractor, AudioSpectrumTypographySchema, BaseMediaOperationPropsSchema, BaseVideoLayerPropsSchema, BloomConfigSchema, Blur, BoxNodeSchema, CAPTION_LAYER_DEFAULTS, COCO17_BONES, COCO17_KEYPOINTS, COCO17_KEYPOINT_NAMES, COCO_CLASSES, COMPOSITE_OPERATIONS, COMPOSITOR_DEFAULTS, CRT, CUBE_FLIP, Camera3D, CameraAnimation, CameraNodeSchema, CameraParallax3D, CannyComputePipeline, CarrierHandoffConfigSchema, ChannelMerger, ChannelSplitter, ChromaticGlitchConfigSchema, ClipVision, Color, ColorBalance, ColorKey, ColorStopSchema, Composition, CompositorProgramSchema, ConfigHandleSchema, ConfigSchemaRegistry, Contour, ControlNetMultiplexer, CornerPin, Crop, CubicBezierSegmentSchema, Curves, CustomEffect, DATA_TYPE_EXTENSIONS, DEFAULT_CHART_COLORS, DEFAULT_DURATION_MS, DEFAULT_FPS, DEFAULT_MEDIA_DIMENSION, DIRECT_LIGHT_FLOATS, DOPPLER_LUT_MAX, DOPPLER_LUT_SIZE, DataType, DataTypeVal, DataTypes, Datamosh, DepthNormalsComputePipeline, DepthOfField, DisplacementMap, Dither, DynamicStrokePropertiesSchema, ENVIRONMENT_PRESETS, Easing, Effect, EffectPipeline, EnhancedTextNodeSchema, EnvironmentFloorSchema, EnvironmentFogSchema, EnvironmentGiSchema, EnvironmentPresetSchema, EnvironmentSsrSchema, EnvironmentVolumetricFogNoiseSchema, EnvironmentVolumetricFogSchema, ExportResultSchema, ExpressionSelectorSchema, ExtendedGlyphPropertiesSchema, ExtendedLayerSchema, ExtractLUT, FRAMEFIELDS_AI_PROXY_URL, FileAssetSchema, FileDataSchema, FilmGrain, FlexNodeSchema, Flip, FontManager, Fracture3D, GeneratorSignalDataSchema, GeometryOutlineOptionsSchema, GlassPipeline, GlobalCompositeOperation, GlyphAnchorGroupingSchema, GlyphAnchorPointSchema, Gooey, Gradient, GradientMap, HalftoneScreen, HandleTypeVal, HeadlessMediaRenderer, HeadlessWebGPURenderer, HighPass, Iridescence, JsonValueSchema, Kaleidoscope, KenBurns, KineticMarqueeConfigSchema, LIGHT_UNIFORM_SIZE_BYTES, Layer, Layer3D, LayerAnimation, LayerStyle, LayoutNodeSchema, Levels, Light, Light3D, LightNodeSchema, LightTypeSchema, Lighting, LineSpacingDynamicsSchema, Liquify, LongShadowConfigSchema, MAX_GRADIENT_STOPS, MAX_LIGHTS, MIME_TYPES, MaskMath, MaterialTypeSchema, Matrix4Math, MatteModeSchema, Media, MediaMetadataSchema, MediaNodeSchema, MediaOperationSchema, MediaSignalRecorder, MediaSourceSchema, MediaTimeRemapInputSchema, MediaTimeRemapSchema, MediaTimeSignalRemapSchema, MeshWarp, Model3DNodeSchema, ModerationError, ModerationUnrefundableError, Modulate, MotionBlur, MotionBlurPipeline, MultiOutputGenericSchema, NodeMetadataSchema, NodeResultSchema, NodeVisualConfigSchema, NoiseGenerator, OpArt, OpticalFlowComputePipeline, OutputItemSchema, PBRGlass, Paint, Painterly, ParticleDissolveConfigSchema, Particles, PatchHeal, Path3D, PersonTrack, Physics, PhysicsBody2D, PhysicsBody3D, PhysicsWorld2D, PhysicsWorld3D, Pixelate, PoseSkeletonRenderer, Posterize, ProceduralVFX, ProgrammaticSignal, RGBSplit, RIG_PRESETS, RefineEdge, RefractionCaustics3D, Relight3D, Renderer2D, Renderer3D, ResizerScaler, Rotate, SSAO, SSAOPipeline, Scene, SceneDefinitionSchema, SceneTransitionTypeSchema, SegmentationTexturePool, SelectiveColor, SelectorBasedOnSchema, SelectorModeSchema, SelectorShapeSchema, SelectorUnitsSchema, Sequence, ShadowPipeline, ShadowsHighlights, ShapeNodeSchema, Signal, SignalChannelMetaSchema, SignalDataSchema, SignalGateDataSchema, SignalMathDataSchema, SignalStatsSchema, SingleOutputGenericSchema, SkewPropertiesSchema, SlugFontCache, SlugPipeline, SourceOperationSchema, Spatial3DPropertiesSchema, SpatialLandmarkTransformer, SpringPhysicsSchema, StereoPanning, Styles, TEXT_LAYER_DEFAULTS, TemporalDeflicker, TemporalDeflickerPipeline, TemporalObjectTracker, TensorPipeline, TextAnchorConfigSchema, TextAnimator, TextAnimatorBuilder, TextAnimatorSchema, TextCursorConfigSchema, TextCursorStyleSchema, TextNodeSchema, TextOperationSchema, TextPathBuilder, TextPathOptionsSchema, TextPathSourceSchema, TextRangeSelectorSchema, TextScrambleConfigSchema, TextSelectorSchema, TextSignalSelectorSchema, TextSpanMarkSchema, TextSpanSchema, TextWigglySelectorSchema, TileOffset, TimelineSegmentSchema, TimelineTransformSchema, ToneMappingSchema, Toon, ToonShadingSchema, Trails, Transition, TransitionSchema, TransitionTypeSchema, TypewriterAnimatorSchema, TypingCadenceSchema, UnsharpMask, ValidationError, VariableFontAxesSchema, Vec2Schema, Vector3Math, VideoAnimationSchema, VideoLayerTypeSchema, VideoSpatialPropsSchema, VideoStylePropsSchema, VideoTextPropsSchema, VideoTimingPropsSchema, Vignette, VirtualMediaDataSchema, Vision, VisionBundle, VisionNode, VisionRunner, VolumetricFogPipeline, VolumetricFormationConfigSchema, VolumetricFormationModeSchema, aberrate, accent, after, ai, analyzeAudio, analyzeSequence, appendOperation, applyStaggerToChildren, assertFps, assertNever, bezier, bindComponent, blurRegion, bold, buildPathLUT, calculateSequenceTimeline, cameraBasis, checkNodeResultCache, code, collectNodeOps, color, compositionFrameContext, compositorToProgram, computeAnchorPivotOffset, computeCarrierContinuity, computeGridLayout, computeLayout, computeLayoutSync, computeLineLeadingDisplacement, computeRangeSelectorWeight, computeStaggerDelay, computeStrokeRect, computeVideoCropRenderProps, computed, cosineSignal, createNoise, createOutputItemSchema, createRandom, createVirtualMedia, cubeFaceCameras, cubeTexel, dataTypeColors, defaultCubeFaceSize, defineTheme, degrees, describeGpu, deserializeSignalData, deterministicWigglyNoise, distanceToCurveParameter, dopplerColorMatrix, dopplerLuminanceGain, dopplerLut, editTrackedRegion, effectFactories, effectMeta, ellipseToCubicBeziers, emojiPresentation, encodeStereoWav, ensureDevice, evaluateAnimationAtFrame, evaluateCubicBezier, evaluateCubicBezierDerivative, evaluateExpressionSelector, evaluateMarqueeOffset, evaluateSelectorCombination, evaluateSkewMatrix, evaluateSpringProgress, evaluateTrackAtFrame, evaluateTypewriterState, evaluateVolumetricFormation, extractSvgDimensions, findSourceAsset, formatHex, formatQaReport, fps, fractal2, frame, frameArraySignal, frameCount, frameSignal, generateArcLengthLUT, generateId, generatePathSegments, getActiveMediaMetadata, getFileDataMetadata, getFingerprint, getLeafMediaType, getMediaType, getRenderFingerprint, getScramblePool, getShuffledOrder, gradientStopsToOklab, handleId, handleLabel, hasOnlySingleSource, hoistMattes, inputStore, interpolate, isCssGradient, isEqual, isFrameIndex, isNormalized, isSignal, isValueSignal, isVirtualMediaData, italic, lensCenterDensity, limitGradientStops, linearRgb, lintComposition, loadFBX, loadModel3D, loadOBJ, lorentzFactor, lutStore, mapBlendModeToSkia, mark, measureSpring, measureText, measureTextAsync, mediaSourceIsHold, mediaSourceRange, mediaSourceRate, mediaSourceTime, mergeAnimationTracks, mixAudioTracks, mixColors, mixSfxInto, ms, nodeId, normalizeColorStops, normalizeTextSpans, normalized, oklabToRgb, parseColorToRgb, parseCssColor, parseCssGradient, parseFBX, parseMTL, parseMarkup, parseOBJ, parseSvgPathToCubicBeziers, pinNodeToLandmark, pinNodeToObject, pixels, planChunks, preloadCompositionFonts, preloadFont, programmaticSignal, progressSignal, pulseKeys, radians, registerSignalDependency, renderFrameGrid, renderSemaphore, renderSfx, reportRenderDiagnostic, requiresIsolation, resetRenderCaches, resolveBoolean, resolveEnvironment, resolveFrameRequest, resolveGi, resolveMediaMimeType, resolveNumber, resolveParam, resolveSamplePoints, resolveSsr, resolveString, resolveVolumetricFog, retargetPose, rgbToOklab, rich, sampleAudioSpectrumScale, sampleColorStops, sampleCurveGeometry, sampleFrameMediaSignal, sampleMediaSignal, samplePathChainGeometry, sampledMediaSourceRange, sampledMediaSourceTime, seconds, section, serializeSignalData, shaderStore, signal, signalBuilder, signalRegistry, sineSignal, size, softLimit, span, spring, springCalculation, stampResult, startPreview, stitchChunks, sub, sup, takeRenderDiagnostics, terrace, textureCache, themes, timeSignal, updateClockSignals, validateMediaTimeRemap, waveToCubicBeziers, withDefaults };
|
package/dist/preview/index.d.mts
CHANGED
|
@@ -2,5 +2,5 @@ import "../index-C-V6CAhP.mjs";
|
|
|
2
2
|
import "../index-BVd6nXd5.mjs";
|
|
3
3
|
import "../index-s2qQ8ifZ.mjs";
|
|
4
4
|
import "../index-DhL7ckvs.mjs";
|
|
5
|
-
import { a as startPreview, i as PreviewSource, n as PreviewOptions, r as PreviewSession, t as PreviewCloseReason } from "../index-
|
|
6
|
-
export { PreviewCloseReason, PreviewOptions, PreviewSession, PreviewSource, startPreview };
|
|
5
|
+
import { a as startPreview, c as PreviewCommand, d as PreviewMessage, f as PreviewPosition, g as readPreviewCommand, h as PreviewStateMessage, i as PreviewSource, l as PreviewCommandMessage, m as PreviewReplyMessage, n as PreviewOptions, o as PREVIEW_PROTOCOL, p as PreviewReadyMessage, r as PreviewSession, s as PreviewBuildMessage, t as PreviewCloseReason, u as PreviewFilm } from "../index-Cq8jgdNY.mjs";
|
|
6
|
+
export { PREVIEW_PROTOCOL, PreviewBuildMessage, PreviewCloseReason, PreviewCommand, PreviewCommandMessage, PreviewFilm, PreviewMessage, PreviewOptions, PreviewPosition, PreviewReadyMessage, PreviewReplyMessage, PreviewSession, PreviewSource, PreviewStateMessage, readPreviewCommand, startPreview };
|
package/dist/preview/index.mjs
CHANGED
|
@@ -9,6 +9,6 @@ import "../renderer-DjJshz9Y.mjs";
|
|
|
9
9
|
import "../renderer-BxttZHme.mjs";
|
|
10
10
|
import "../renderer-Co2YqWX0.mjs";
|
|
11
11
|
import "../renderer-Cz30EVws.mjs";
|
|
12
|
-
import { t as startPreview } from "../preview-
|
|
12
|
+
import { n as PREVIEW_PROTOCOL, r as readPreviewCommand, t as startPreview } from "../preview-Dm912wly.mjs";
|
|
13
13
|
|
|
14
|
-
export { startPreview };
|
|
14
|
+
export { PREVIEW_PROTOCOL, readPreviewCommand, startPreview };
|
|
@@ -463,6 +463,41 @@ const PEAK_BINS = 1200;
|
|
|
463
463
|
/** A mix counts as silent below this peak. */
|
|
464
464
|
const SILENT_PEAK = .001;
|
|
465
465
|
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/preview/embed-protocol.ts
|
|
468
|
+
/**
|
|
469
|
+
* The preview page's message channel with an app that embeds it in a frame
|
|
470
|
+
* (protocol 1). The page talks only when embedded, with
|
|
471
|
+
* `window.parent.postMessage(message, "*")`, and takes commands only from
|
|
472
|
+
* `window.parent`. Every message has a `type` starting `framefields-preview:`.
|
|
473
|
+
*
|
|
474
|
+
* Page → parent: `ready` once the first frame shows; `state` on play, pause,
|
|
475
|
+
* each finished seek, and up to 4 times a second while playing; `build`
|
|
476
|
+
* around a rebuild (and `error` when a build or a frame fails); `reply` to
|
|
477
|
+
* each command. Parent → page: `command`, answered by a `reply` with its `id`.
|
|
478
|
+
*
|
|
479
|
+
* The page also seeks when its address fragment changes (`#t=12.5`,
|
|
480
|
+
* `#frame=375`), without a reload; `seekByHash` in `ready` says so.
|
|
481
|
+
*/
|
|
482
|
+
const PREVIEW_PROTOCOL = 1;
|
|
483
|
+
const COMMANDS = new Set([
|
|
484
|
+
"seek",
|
|
485
|
+
"seekFrame",
|
|
486
|
+
"play",
|
|
487
|
+
"pause",
|
|
488
|
+
"state"
|
|
489
|
+
]);
|
|
490
|
+
/** The command in a message from the parent, or null when it isn't a well-formed one. */
|
|
491
|
+
function readPreviewCommand(data) {
|
|
492
|
+
if (typeof data !== "object" || data === null) return null;
|
|
493
|
+
const m = data;
|
|
494
|
+
if (m.type !== "framefields-preview:command" || typeof m.id !== "string") return null;
|
|
495
|
+
if (typeof m.command !== "string" || !COMMANDS.has(m.command)) return null;
|
|
496
|
+
if (m.command === "seek" && !Number.isFinite(m.time)) return null;
|
|
497
|
+
if (m.command === "seekFrame" && !Number.isFinite(m.frame)) return null;
|
|
498
|
+
return m;
|
|
499
|
+
}
|
|
500
|
+
|
|
466
501
|
//#endregion
|
|
467
502
|
//#region src/preview/index.ts
|
|
468
503
|
/** Requests carrying this header come from another preview process, not a page. */
|
|
@@ -998,5 +1033,5 @@ function openBrowser(url) {
|
|
|
998
1033
|
}
|
|
999
1034
|
|
|
1000
1035
|
//#endregion
|
|
1001
|
-
export { startPreview as t };
|
|
1002
|
-
//# sourceMappingURL=preview-
|
|
1036
|
+
export { PREVIEW_PROTOCOL as n, readPreviewCommand as r, startPreview as t };
|
|
1037
|
+
//# sourceMappingURL=preview-Dm912wly.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-Dm912wly.mjs","names":["url","resolve"],"sources":["../src/preview/bundle.ts","../src/preview/notes.ts","../src/preview/peaks.ts","../src/preview/embed-protocol.ts","../src/preview/index.ts"],"sourcesContent":["/**\n * The preview page runs the project's composition code and renders it with\n * WebGPU. Two bundles make that work:\n *\n * - The engine (`buildEngine`): framefields and its browser player, built once\n * for the browser. Published packages ship it in `dist/preview-engine`;\n * running from source, it is built on first use.\n * - The project (`bundleProject`): only the user's own files, built on each\n * preview. Its `framefields` imports point at the engine's files, so the\n * composition and the player share one engine (signals, clock, caches).\n *\n * The page around them (`buildPage`) is its own small bundle: the Lit UI in\n * `ui/`, shipped prebuilt in `dist/preview-page`, or built on first use.\n *\n * Node APIs that compositions use at build time are shimmed: `path`, `url`,\n * `os`, `import.meta.url` (each file keeps its own `file://` URL), and `fs`\n * reads, which fetch the file from the preview server. Absolute file paths\n * double as URLs there, so assets referenced by path load unchanged.\n * Node-only packages become stubs that throw when used.\n */\nimport fs from \"node:fs\";\nimport { createRequire, isBuiltin } from \"node:module\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport type { BuildOptions, PluginBuild } from \"esbuild\";\n\nconst HERE = path.dirname(fileURLToPath(import.meta.url));\n// Spelled in two parts so this file survives its own rewrite.\nconst META_URL = [\"import\", \"meta\", \"url\"].join(\".\");\nconst require = createRequire(import.meta.url);\n\n/** URL prefix the server serves the engine's files under. */\nexport const ENGINE_URL = \"/@framefields/engine\";\n\n/** URL prefix the server serves the page's script and styles under. */\nexport const PAGE_URL = \"/@framefields/ui\";\n\n/** Public entry points a composition may import, and their sources. */\nconst ENTRIES: Record<string, string> = {\n\tframefields: \"index.ts\",\n\t\"framefields/effects\": \"effects/index.ts\",\n\t\"framefields/audio\": \"audio/index.ts\",\n\t\"framefields/signals\": \"signals/index.ts\",\n\t\"framefields/fonts\": \"fonts/index.ts\",\n\t// Installed components import their toolkit from here (`framefields add`).\n\t\"framefields/components\": \"components/index.ts\",\n};\n\n/** Node built-ins with a browser version (shim file names); others are stubbed. */\nconst SHIMS: Record<string, string> = {\n\tpath: \"path\",\n\t\"path/posix\": \"path\",\n\turl: \"url\",\n\tos: \"os\",\n\tfs: \"fs\",\n\t\"fs/promises\": \"fs-promises\",\n\tmodule: \"module\",\n};\n\n/** Packages that only work in Node; the browser never needs them to draw. */\nconst NODE_ONLY = new Set([\n\t\"sharp\",\n\t\"skia-canvas\",\n\t\"node-av\",\n\t\"onnxruntime-node\",\n\t\"@resvg/resvg-js\",\n\t\"@napi-rs/webcodecs\",\n\t\"@mediabunny/server\",\n\t\"@mediabunny/mp3-encoder\",\n\t\"webgpu\",\n\t\"pino\",\n\t\"pino-pretty\",\n\t\"dotenv\",\n\t\"esbuild\",\n\t\"@framefields/renderer\",\n\t\"framefields/renderer\",\n\t\"framefields/preview\",\n]);\n\n// Reported as an ES module so named imports (`import { homedir } from \"os\"`)\n// read through the proxy instead of being copied off it.\nconst STUB = `\nconst stub = () => new Proxy(function () {}, {\n\tget: (_t, k) => (k === \"__esModule\" ? true : k === Symbol.toPrimitive ? () => \"\" : stub()),\n\tapply: () => stub(),\n\tconstruct: () => stub(),\n});\nmodule.exports = stub();\n`;\n\n/**\n * Builds framefields for the browser into `outDir`: one module per public entry,\n * the player and the shims, with shared code split into chunks (node renderers\n * load only when a composition uses them).\n */\nexport async function buildEngine(outDir: string): Promise<void> {\n\tconst { build } = await import(\"esbuild\");\n\tconst src = path.resolve(HERE, \"..\");\n\tconst shims = path.join(HERE, \"shims\");\n\tconst entryPoints: Record<string, string> = {\n\t\tplayer: path.join(HERE, \"player.ts\"),\n\t};\n\tfor (const [spec, file] of Object.entries(ENTRIES)) {\n\t\tentryPoints[engineName(spec)] = path.join(src, file);\n\t}\n\tfor (const name of new Set(Object.values(SHIMS))) {\n\t\tentryPoints[`shims/${name}`] = path.join(shims, `${name}.ts`);\n\t}\n\n\tawait fs.promises.rm(outDir, { recursive: true, force: true });\n\tawait build({\n\t\t...BROWSER,\n\t\tentryPoints,\n\t\toutdir: outDir,\n\t\toutExtension: { \".js\": \".mjs\" },\n\t\tsplitting: true,\n\t\tminify: true,\n\t\tconditions: [\"development\", \"browser\", \"import\"],\n\t\tdefine: { \"process.env.NODE_ENV\": '\"production\"', global: \"globalThis\" },\n\t\tinject: [path.join(shims, \"process.ts\")],\n\t\tplugins: [\n\t\t\t{\n\t\t\t\tname: \"framefields-engine\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\tb.onResolve({ filter: /^framefields-preview:renderers$/ }, () => ({\n\t\t\t\t\t\tpath: builtinRenderersModule(),\n\t\t\t\t\t}));\n\t\t\t\t\tresolveNode(b, (name) => ({ path: path.join(shims, `${name}.ts`) }));\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n}\n\nexport interface ProjectBundle {\n\tcode: string;\n\t/** The project's source files, to watch for changes. */\n\tinputs: string[];\n}\n\n/** Bundles the module that builds the composition, and what it imports. */\nexport async function bundleProject(options: {\n\t/** Module that exports the composition factory. */\n\tentry: string;\n\t/** Name of the export; a function returning a Composition (or one itself). */\n\texportName: string;\n\t/** Where cached vision models are, and where onnxruntime-web loads from. */\n\tmodelsDir: string;\n\tortBase: string;\n}): Promise<ProjectBundle> {\n\tconst { build } = await import(\"esbuild\");\n\tconst entry = path.resolve(options.entry);\n\tconst fromEngine = (file: string) => ({\n\t\tpath: `${ENGINE_URL}/${file}.mjs`,\n\t\texternal: true,\n\t});\n\tconst settings = { modelsDir: options.modelsDir, ortBase: options.ortBase };\n\n\tconst result = await build({\n\t\t...BROWSER,\n\t\tentryPoints: [\"framefields-preview:entry\"],\n\t\twrite: false,\n\t\tmetafile: true,\n\t\tsourcemap: \"inline\",\n\t\tplugins: [\n\t\t\t{\n\t\t\t\tname: \"framefields-project\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\tb.onResolve({ filter: /^framefields-preview:entry$/ }, () => ({\n\t\t\t\t\t\tpath: \"entry\",\n\t\t\t\t\t\tnamespace: \"framefields-preview\",\n\t\t\t\t\t}));\n\t\t\t\t\tb.onLoad({ filter: /.*/, namespace: \"framefields-preview\" }, () => ({\n\t\t\t\t\t\tcontents: [\n\t\t\t\t\t\t\t`import { startAudioMixer, startPlayer } from ${JSON.stringify(`${ENGINE_URL}/player.mjs`)};`,\n\t\t\t\t\t\t\t`import * as mod from ${JSON.stringify(entry)};`,\n\t\t\t\t\t\t\t// The page loads it as the player; a worker it starts, as the soundtrack's mixer.\n\t\t\t\t\t\t\t`if (typeof document === \"undefined\") startAudioMixer(mod, ${JSON.stringify(options.exportName)});`,\n\t\t\t\t\t\t\t`else startPlayer(mod, ${JSON.stringify(options.exportName)}, ${JSON.stringify(settings)});`,\n\t\t\t\t\t\t].join(\"\\n\"),\n\t\t\t\t\t\tresolveDir: path.dirname(entry),\n\t\t\t\t\t\tloader: \"js\",\n\t\t\t\t\t}));\n\t\t\t\t\tb.onResolve({ filter: /^\\/@framefields\\/engine\\// }, (args) => ({\n\t\t\t\t\t\tpath: args.path,\n\t\t\t\t\t\texternal: true,\n\t\t\t\t\t}));\n\t\t\t\t\tb.onResolve({ filter: /^framefields(\\/|$)/ }, (args) =>\n\t\t\t\t\t\tENTRIES[args.path] ? fromEngine(engineName(args.path)) : undefined,\n\t\t\t\t\t);\n\t\t\t\t\tresolveNode(b, (name) => fromEngine(`shims/${name}`));\n\t\t\t\t\trewriteMetaUrl(b);\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst inputs = Object.keys(result.metafile?.inputs ?? {})\n\t\t.filter((p) => !p.includes(\":\") && !p.includes(\"node_modules\"))\n\t\t.map((p) => path.resolve(p));\n\treturn { code: result.outputFiles[0].text, inputs };\n}\n\n/**\n * Builds the preview page into `outDir`: `index.html`, and `main.js` and\n * `main.css` from the UI's sources (Lit included; nothing else of the page\n * reaches a project's code). `dev` keeps it readable, with a source map.\n */\nexport async function buildPage(\n\toutDir: string,\n\t{ dev = false }: { dev?: boolean } = {},\n): Promise<void> {\n\tconst { build } = await import(\"esbuild\");\n\tconst ui = path.join(HERE, \"ui\");\n\tawait fs.promises.rm(outDir, { recursive: true, force: true });\n\tawait build({\n\t\t...BROWSER,\n\t\tentryPoints: { main: path.join(ui, \"main.ts\") },\n\t\toutdir: outDir,\n\t\tminify: !dev,\n\t\tsourcemap: dev ? \"inline\" : false,\n\t\t// Lit's production build: its development one warns in the console.\n\t\tconditions: [\"browser\", \"import\"],\n\t\t// Types the page shares with the server are erased; nothing of Node may remain.\n\t\tplugins: [\n\t\t\t{\n\t\t\t\tname: \"framefields-page\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\tb.onResolve({ filter: /^(node:|@framefields\\/)/ }, (args) => ({\n\t\t\t\t\t\terrors: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttext: `the preview page may not import ${args.path} (from ${args.importer})`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\tawait fs.promises.copyFile(\n\t\tpath.join(ui, \"index.html\"),\n\t\tpath.join(outDir, \"index.html\"),\n\t);\n}\n\n/**\n * A prebuilt folder shipped beside a compiled bundle (`dist/<name>`), if\n * there is one. The bundle lands either at the package's dist root or beside\n * dist/preview, depending on how the bundler splits it, so both are checked.\n */\nfunction prebuiltDir(here: string, name: string, marker: string) {\n\treturn [here, path.join(here, \"..\")]\n\t\t.map((base) => path.join(base, name))\n\t\t.find((dir) => fs.existsSync(path.join(dir, marker)));\n}\n\n/** The prebuilt engine shipped beside a compiled bundle, if there is one. */\nexport function prebuiltEngineDir(here: string): string | undefined {\n\treturn prebuiltDir(here, \"preview-engine\", \"player.mjs\");\n}\n\nconst builds = new Map<string, Promise<string>>();\n\n/**\n * `name` prebuilt in the package's dist or, running from source (where HERE\n * is src/preview, so the lookup misses), built once per process into a\n * temporary folder, so edits show without a package build.\n */\nfunction prebuiltOrBuild(\n\tprebuilt: string | undefined,\n\tname: string,\n\tbuild: (dir: string) => Promise<void>,\n): Promise<string> {\n\tif (prebuilt) return Promise.resolve(prebuilt);\n\tlet pending = builds.get(name);\n\tif (!pending) {\n\t\tconst dir = path.join(os.tmpdir(), `framefields-${name}-${process.pid}`);\n\t\tpending = build(dir).then(() => dir);\n\t\tbuilds.set(name, pending);\n\t\tpending.catch(() => builds.delete(name));\n\t}\n\treturn pending;\n}\n\n/** The browser engine to serve. */\nexport function engineDir(): Promise<string> {\n\treturn prebuiltOrBuild(\n\t\tprebuiltEngineDir(HERE),\n\t\t\"preview-engine\",\n\t\tbuildEngine,\n\t);\n}\n\n/** The preview page to serve. */\nexport function pageDir(): Promise<string> {\n\treturn prebuiltOrBuild(\n\t\tprebuiltDir(HERE, \"preview-page\", \"main.js\"),\n\t\t\"preview-page\",\n\t\t(dir) => buildPage(dir, { dev: true }),\n\t);\n}\n\n/** Where vision models are cached, as `@framefields/vision` resolves it. */\nexport function visionModelsDir(): string {\n\treturn process.env.FRAMEFIELDS_MODELS_DIR\n\t\t? path.resolve(process.env.FRAMEFIELDS_MODELS_DIR)\n\t\t: path.join(os.homedir(), \".cache\", \"framefields\", \"models\");\n}\n\nconst ORT_WEB_VERSION = \"1.30.0\";\n\n/**\n * onnxruntime-web, for vision effects: the project's own install when it has\n * one (served from disk), otherwise a pinned CDN build. Loaded only when a\n * vision effect runs, so framefields doesn't ship its WebAssembly.\n */\nexport function onnxRuntimeWeb(fromDir: string): {\n\tbase: string;\n\tdir?: string;\n} {\n\tfor (const from of [fromDir, HERE]) {\n\t\ttry {\n\t\t\tconst main = createRequire(path.join(from, \"noop.js\")).resolve(\n\t\t\t\t\"onnxruntime-web\",\n\t\t\t);\n\t\t\tconst dir = path.dirname(main);\n\t\t\treturn { base: `/@fs${dir}/`, dir };\n\t\t} catch {}\n\t}\n\treturn {\n\t\tbase: `https://cdn.jsdelivr.net/npm/onnxruntime-web@${ORT_WEB_VERSION}/dist/`,\n\t};\n}\n\n// ── shared ──\n\nconst BROWSER: BuildOptions = {\n\tbundle: true,\n\tformat: \"esm\",\n\tplatform: \"browser\",\n\ttarget: \"es2022\",\n\tmainFields: [\"browser\", \"module\", \"main\"],\n\tlogLevel: \"silent\",\n};\n\nfunction engineName(spec: string): string {\n\treturn spec === \"framefields\"\n\t\t? \"framefields\"\n\t\t: spec.slice(\"framefields/\".length);\n}\n\n/** Node built-ins to shims, the rest of Node to stubs. */\nfunction resolveNode(\n\tb: PluginBuild,\n\tshim: (name: string) => { path: string; external?: boolean },\n): void {\n\tb.onResolve({ filter: /^(node:)?[a-z_/]+$/ }, (args) => {\n\t\tconst name = args.path.replace(/^node:/, \"\");\n\t\tif (SHIMS[name]) return shim(SHIMS[name]);\n\t\tif (args.path.startsWith(\"node:\") || isBuiltin(name))\n\t\t\treturn { path: name, namespace: \"framefields-stub\" };\n\t\treturn undefined;\n\t});\n\tb.onResolve({ filter: /.*/ }, (args) => {\n\t\tconst pkg = packageName(args.path);\n\t\tif (pkg && (NODE_ONLY.has(pkg) || NODE_ONLY.has(args.path)))\n\t\t\treturn { path: args.path, namespace: \"framefields-stub\" };\n\t\treturn undefined;\n\t});\n\tb.onLoad({ filter: /.*/, namespace: \"framefields-stub\" }, () => ({\n\t\tcontents: STUB,\n\t\tloader: \"js\",\n\t}));\n}\n\n/** Each project file keeps its own URL, as `fileURLToPath(import.meta.url)` expects. */\nfunction rewriteMetaUrl(b: PluginBuild): void {\n\tb.onLoad({ filter: /\\.[cm]?[jt]sx?$/ }, async (args) => {\n\t\tif (args.path.includes(`${path.sep}node_modules${path.sep}`))\n\t\t\treturn undefined;\n\t\tconst source = await fs.promises.readFile(args.path, \"utf8\");\n\t\tif (!source.includes(META_URL)) return undefined;\n\t\treturn {\n\t\t\tcontents: `const __framefieldsFileUrl = ${JSON.stringify(pathToFileURL(args.path).href)};\\n${source.replaceAll(META_URL, \"__framefieldsFileUrl\")}`,\n\t\t\tloader: loaderFor(args.path),\n\t\t};\n\t});\n}\n\n/** The generated list of node renderers (needed only to build the engine). */\nfunction builtinRenderersModule(): string {\n\tconst dist = require.resolve(\"@framefields/renderer\");\n\tconst file = path.join(\n\t\tpath.dirname(dist),\n\t\t\"..\",\n\t\t\"src\",\n\t\t\"generated\",\n\t\t\"node-renderers.ts\",\n\t);\n\tif (!fs.existsSync(file))\n\t\tthrow new Error(`[framefields] node renderer list not found at ${file}`);\n\treturn file;\n}\n\nfunction packageName(spec: string): string | undefined {\n\tif (spec.startsWith(\".\") || spec.startsWith(\"/\")) return undefined;\n\tconst parts = spec.split(\"/\");\n\treturn spec.startsWith(\"@\") ? parts.slice(0, 2).join(\"/\") : parts[0];\n}\n\nfunction loaderFor(file: string): \"ts\" | \"tsx\" | \"js\" | \"jsx\" {\n\tif (file.endsWith(\".tsx\")) return \"tsx\";\n\tif (file.endsWith(\".jsx\")) return \"jsx\";\n\treturn /\\.[cm]?ts$/.test(file) ? \"ts\" : \"js\";\n}\n","/**\n * Notes the user pins on the preview: a moment, a spot (or an area) on the\n * frame, and what should change there. They are kept as files so whoever\n * edits the film (a person, or an agent) can read them: `notes.json`, plus the\n * frame with the spot marked as `note-<id>.jpg`. The folder ignores itself in\n * git. `notes.json` is read on every change, so it can be edited by hand\n * (marking a note done, say) while the preview runs.\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport interface PreviewNote {\n\tid: number;\n\tframe: number;\n\t/** Seconds into the film. */\n\ttime: number;\n\t/** The spot, as fractions of the frame's width and height (0..1). */\n\tx: number;\n\ty: number;\n\t/** Set when an area was marked: its size, from the spot at its top left. */\n\tw?: number;\n\th?: number;\n\ttext: string;\n\t/** The frame with the spot marked (absolute path), when it was captured. */\n\timage?: string;\n\tdone: boolean;\n\tcreated: string;\n}\n\nexport interface NewNote {\n\tframe: number;\n\ttime: number;\n\tx: number;\n\ty: number;\n\tw?: number;\n\th?: number;\n\ttext: string;\n\t/** JPEG as a base64 data URL. */\n\timage?: string;\n}\n\nexport class NoteStore {\n\treadonly file: string;\n\n\tconstructor(readonly dir: string) {\n\t\tthis.file = path.join(dir, \"notes.json\");\n\t}\n\n\tasync list(): Promise<PreviewNote[]> {\n\t\ttry {\n\t\t\tconst notes = JSON.parse(await fs.promises.readFile(this.file, \"utf8\"));\n\t\t\treturn Array.isArray(notes) ? notes : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tasync add(input: NewNote): Promise<PreviewNote> {\n\t\tconst notes = await this.list();\n\t\tconst id = notes.reduce((max, n) => Math.max(max, n.id), 0) + 1;\n\t\tconst note: PreviewNote = {\n\t\t\tid,\n\t\t\tframe: Math.max(0, Math.round(Number(input.frame) || 0)),\n\t\t\ttime: round(Number(input.time) || 0, 3),\n\t\t\tx: round(clamp01(input.x), 4),\n\t\t\ty: round(clamp01(input.y), 4),\n\t\t\t...(input.w !== undefined &&\n\t\t\t\tinput.h !== undefined && {\n\t\t\t\t\tw: round(clamp01(input.w), 4),\n\t\t\t\t\th: round(clamp01(input.h), 4),\n\t\t\t\t}),\n\t\t\ttext: String(input.text ?? \"\").trim(),\n\t\t\tdone: false,\n\t\t\tcreated: new Date().toISOString(),\n\t\t};\n\t\tawait this.ensureDir();\n\t\tconst jpeg = /^data:image\\/jpeg;base64,(.+)$/.exec(input.image ?? \"\");\n\t\tif (jpeg) {\n\t\t\tnote.image = path.join(this.dir, `note-${id}.jpg`);\n\t\t\tawait fs.promises.writeFile(note.image, Buffer.from(jpeg[1], \"base64\"));\n\t\t}\n\t\tawait this.save([...notes, note]);\n\t\treturn note;\n\t}\n\n\tasync update(\n\t\tid: number,\n\t\tpatch: { done?: boolean; text?: string },\n\t): Promise<PreviewNote | undefined> {\n\t\tconst notes = await this.list();\n\t\tconst note = notes.find((n) => n.id === id);\n\t\tif (!note) return undefined;\n\t\tif (typeof patch.done === \"boolean\") note.done = patch.done;\n\t\tif (typeof patch.text === \"string\" && patch.text.trim())\n\t\t\tnote.text = patch.text.trim();\n\t\tawait this.save(notes);\n\t\treturn note;\n\t}\n\n\tasync remove(id: number): Promise<PreviewNote | undefined> {\n\t\tconst notes = await this.list();\n\t\tconst note = notes.find((n) => n.id === id);\n\t\tif (!note) return undefined;\n\t\tif (note.image) await fs.promises.rm(note.image, { force: true });\n\t\tawait this.save(notes.filter((n) => n !== note));\n\t\treturn note;\n\t}\n\n\tprivate async save(notes: PreviewNote[]): Promise<void> {\n\t\tawait this.ensureDir();\n\t\tconst tmp = `${this.file}.${process.pid}.tmp`;\n\t\tawait fs.promises.writeFile(tmp, `${JSON.stringify(notes, null, \"\\t\")}\\n`);\n\t\tawait fs.promises.rename(tmp, this.file);\n\t}\n\n\tprivate async ensureDir(): Promise<void> {\n\t\tawait fs.promises.mkdir(this.dir, { recursive: true });\n\t\t// Notes are working material, not part of the project.\n\t\tconst ignore = path.join(path.dirname(this.dir), \".gitignore\");\n\t\tif (!fs.existsSync(ignore)) await fs.promises.writeFile(ignore, \"*\\n\");\n\t}\n}\n\n/** One line for a terminal (or an agent reading one). */\nexport function describeNote(note: PreviewNote, fps: number): string {\n\tconst pct = (v: number) => `${Math.round(v * 100)}%`;\n\tconst where =\n\t\tnote.w !== undefined && note.h !== undefined\n\t\t\t? `area ${pct(note.x)},${pct(note.y)} to ${pct(note.x + note.w)},${pct(note.y + note.h)}`\n\t\t\t: `spot ${pct(note.x)},${pct(note.y)}`;\n\treturn `note ${note.id} at ${timecode(note.frame, fps)} (frame ${note.frame}), ${where}: ${note.text}`;\n}\n\nfunction timecode(frame: number, fps: number): string {\n\tconst s = frame / fps;\n\tconst m = Math.floor(s / 60);\n\treturn `${m}:${(s - m * 60).toFixed(2).padStart(5, \"0\")}`;\n}\n\nfunction clamp01(v: unknown): number {\n\tconst n = Number(v);\n\treturn Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 0;\n}\n\nfunction round(v: number, digits: number): number {\n\treturn Number(v.toFixed(digits));\n}\n","/** Waveform peaks of a stereo mix: the loudest sample of either channel per bin, 0–1. */\nexport function computePeaks(\n\tleft: Float32Array,\n\tright: Float32Array,\n\tbins: number,\n): number[] {\n\tconst peaks = new Array<number>(bins).fill(0);\n\tif (left.length === 0) return peaks;\n\tconst per = left.length / bins;\n\tfor (let b = 0; b < bins; b++) {\n\t\tconst start = Math.floor(b * per);\n\t\tconst end = Math.min(left.length, Math.floor((b + 1) * per));\n\t\tlet max = 0;\n\t\tfor (let i = start; i < end; i++) {\n\t\t\tconst v = Math.max(Math.abs(left[i] ?? 0), Math.abs(right[i] ?? 0));\n\t\t\tif (v > max) max = v;\n\t\t}\n\t\tpeaks[b] = Math.min(1, max);\n\t}\n\treturn peaks;\n}\n\n/** Bins the page's waveform draws. */\nexport const PEAK_BINS = 1200;\n\n/** A mix counts as silent below this peak. */\nexport const SILENT_PEAK = 0.001;\n","/**\n * The preview page's message channel with an app that embeds it in a frame\n * (protocol 1). The page talks only when embedded, with\n * `window.parent.postMessage(message, \"*\")`, and takes commands only from\n * `window.parent`. Every message has a `type` starting `framefields-preview:`.\n *\n * Page → parent: `ready` once the first frame shows; `state` on play, pause,\n * each finished seek, and up to 4 times a second while playing; `build`\n * around a rebuild (and `error` when a build or a frame fails); `reply` to\n * each command. Parent → page: `command`, answered by a `reply` with its `id`.\n *\n * The page also seeks when its address fragment changes (`#t=12.5`,\n * `#frame=375`), without a reload; `seekByHash` in `ready` says so.\n */\n\nexport const PREVIEW_PROTOCOL = 1;\n\n/** The film the page shows. `frames` is its frame count, `duration` the last frame's time in seconds. */\nexport interface PreviewFilm {\n\ttitle: string;\n\twidth: number;\n\theight: number;\n\tfps: number;\n\tframes: number;\n\tduration: number;\n}\n\n/** Where the page is. `time` is `frame / fps` in seconds. */\nexport interface PreviewPosition {\n\tframe: number;\n\ttime: number;\n\tplaying: boolean;\n}\n\nexport interface PreviewReadyMessage {\n\ttype: \"framefields-preview:ready\";\n\tprotocol: typeof PREVIEW_PROTOCOL;\n\t/** Setting the frame's `#t=` / `#frame=` seeks in place. */\n\tseekByHash: true;\n\tmeta: PreviewFilm;\n}\n\nexport interface PreviewStateMessage extends PreviewPosition {\n\ttype: \"framefields-preview:state\";\n}\n\nexport interface PreviewBuildMessage {\n\ttype: \"framefields-preview:build\";\n\t/**\n\t * \"building\" before the page reloads into a rebuilt preview (its `ready`\n\t * after the reload means it's done), \"error\" when a build or a frame\n\t * failed, with the text.\n\t */\n\tstatus: \"building\" | \"ready\" | \"error\";\n\tmessage?: string;\n}\n\nexport type PreviewCommand =\n\t/** `time` in seconds. */\n\t| { command: \"seek\"; time: number }\n\t| { command: \"seekFrame\"; frame: number }\n\t| { command: \"play\" }\n\t| { command: \"pause\" }\n\t| { command: \"state\" };\n\nexport type PreviewCommandMessage = {\n\ttype: \"framefields-preview:command\";\n\t/** Echoed in the reply. */\n\tid: string;\n} & PreviewCommand;\n\n/** The answer to a command, once it's done (a seek once the frame is drawn). */\nexport type PreviewReplyMessage = {\n\ttype: \"framefields-preview:reply\";\n\tid: string;\n} & ({ ok: true; state: PreviewPosition } | { ok: false; error: string });\n\n/** Everything the page posts to its parent. */\nexport type PreviewMessage =\n\t| PreviewReadyMessage\n\t| PreviewStateMessage\n\t| PreviewBuildMessage\n\t| PreviewReplyMessage;\n\nconst COMMANDS = new Set([\"seek\", \"seekFrame\", \"play\", \"pause\", \"state\"]);\n\n/** The command in a message from the parent, or null when it isn't a well-formed one. */\nexport function readPreviewCommand(\n\tdata: unknown,\n): PreviewCommandMessage | null {\n\tif (typeof data !== \"object\" || data === null) return null;\n\tconst m = data as Record<string, unknown>;\n\tif (m.type !== \"framefields-preview:command\" || typeof m.id !== \"string\")\n\t\treturn null;\n\tif (typeof m.command !== \"string\" || !COMMANDS.has(m.command)) return null;\n\tif (m.command === \"seek\" && !Number.isFinite(m.time)) return null;\n\tif (m.command === \"seekFrame\" && !Number.isFinite(m.frame)) return null;\n\treturn m as unknown as PreviewCommandMessage;\n}\n","import { spawn } from \"node:child_process\";\nimport { createHash, randomUUID } from \"node:crypto\";\nimport fs from \"node:fs\";\nimport http from \"node:http\";\nimport type { AddressInfo } from \"node:net\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport type { VirtualMediaData } from \"@framefields/core\";\nimport { type AssetLocator, openAssetLocator } from \"@framefields/storage\";\nimport { inputStore } from \"@framefields/webgpu-renderers\";\nimport { encodeStereoWav } from \"../audio/index.js\";\nimport { HeadlessMediaRenderer } from \"../renderer/index.js\";\nimport {\n\tbundleProject,\n\tENGINE_URL,\n\tengineDir,\n\tonnxRuntimeWeb,\n\tPAGE_URL,\n\tpageDir,\n\tvisionModelsDir,\n} from \"./bundle.js\";\nimport { describeNote, type NewNote, NoteStore } from \"./notes.js\";\nimport { computePeaks, PEAK_BINS, SILENT_PEAK } from \"./peaks.js\";\nimport type {\n\tAudioStatus,\n\tNoteRequest,\n\tPreviewMeta,\n\tPreviewMetaReply,\n} from \"./protocol.js\";\n\n/** A notes request as received: a `NoteRequest`, unchecked. */\ntype NoteBody = {\n\top?: NoteRequest[\"op\"];\n\tid?: number;\n\tdone?: boolean;\n\ttext?: string;\n\tnote?: NewNote;\n};\n\n// The message channel an app embedding the page talks over (protocol 1).\nexport * from \"./embed-protocol.js\";\n\n/** Where the composition comes from: the module that builds it. */\nexport interface PreviewSource {\n\t/** Path or file URL of the module, e.g. `new URL(\"./film.ts\", import.meta.url)`. */\n\tentry: string | URL;\n\t/**\n\t * The export to preview: a function returning a `Composition` (it may be\n\t * async), or a `Composition`. Defaults to `\"default\"`.\n\t */\n\texport?: string;\n}\n\n/** What the server needs from the composition: its size, timing and soundtrack. */\ninterface PreviewTarget {\n\ttoVirtualMedia?(): VirtualMediaData;\n\ttoVirtualMediaAsync?(): Promise<VirtualMediaData>;\n\tcomputeDuration?(): Promise<number>;\n\tprepareMediaTime?(): Promise<void>;\n\tfps?: number;\n\tdurationMs?: number;\n\twidth?: number;\n\theight?: number;\n}\n\nexport interface PreviewOptions {\n\t/**\n\t * Port to listen on. Defaults to a port derived from the working directory,\n\t * so every preview of a project lands on the same URL and an open tab picks\n\t * up the next one by itself. A preview already running there is replaced.\n\t */\n\tport?: number;\n\t/** Interface to bind. Defaults to \"127.0.0.1\" so the preview never leaves the machine. */\n\thost?: string;\n\t/**\n\t * Also open the page in the system's default browser. Off by default: the\n\t * caller shows the URL where it suits, e.g. an agent app's own browser\n\t * pane. Skipped when a tab from an earlier preview reconnects on its own.\n\t */\n\topen?: boolean;\n\t/** Title shown in the page header. */\n\ttitle?: string;\n\t/** Mix and play the composition's audio. Defaults to true. */\n\taudio?: boolean;\n\t/** Optional shared renderer instance, used to mix the soundtrack. */\n\trenderer?: HeadlessMediaRenderer;\n\t/**\n\t * Close the server this many milliseconds after the last open tab goes\n\t * away (closed, not reloaded). Defaults to 5000. `false` keeps it serving\n\t * until `close()`. Nothing closes before a tab has connected.\n\t */\n\tidleCloseMs?: number | false;\n\t/**\n\t * Files the page may load by absolute path (the composition's assets).\n\t * Defaults to the project that holds the entry: the nearest `.git`, else\n\t * the nearest `package.json`, else the entry's directory. Pass one path or\n\t * several to allow assets kept outside it.\n\t */\n\troot?: string | string[];\n\t/**\n\t * Where the preview reports what happens out of sight: the page opening,\n\t * errors in the page (a failed build, a frame that threw, no WebGPU), and\n\t * why the server stopped. Defaults to stderr, so whoever runs the preview\n\t * (an agent's background command, say) reads them in its output. `false`\n\t * keeps it quiet.\n\t */\n\tlog?: ((line: string) => void) | false;\n\t/**\n\t * Where notes pinned on the page are kept: `notes.json` and, per note, the\n\t * frame with its spot marked. Defaults to `.framefields/preview-notes` in the\n\t * working directory (`.framefields` ignores itself in git). `false` turns\n\t * notes off.\n\t */\n\tnotesDir?: string | false;\n}\n\n/** Why a preview stopped. */\nexport type PreviewCloseReason =\n\t/** `close()` was called. */\n\t| \"closed\"\n\t/** Its last tab closed (see `idleCloseMs`). */\n\t| \"idle\"\n\t/** A newer preview of the project took over its port. */\n\t| \"replaced\";\n\nexport interface PreviewSession {\n\turl: string;\n\tclose(): Promise<void>;\n\t/** Resolves with the reason when the server stops. */\n\tclosed: Promise<PreviewCloseReason>;\n}\n\n/** Requests carrying this header come from another preview process, not a page. */\nconst TAKEOVER_HEADER = \"x-framefields-preview\";\nconst PLAYER_PATH = \"/@framefields/player.js\";\n\n/**\n * Serves a localhost player for a composition. The page loads the\n * composition's own code, bundled with the engine, and renders its frames\n * with WebGPU in the browser, like the editor's player; nothing is streamed.\n * The server provides the bundle, the project's files, and the soundtrack,\n * which it mixes with the export engine.\n *\n * The server runs until its tab closes or `close()`. Starting another preview\n * on the same port (the default for a project) stops this one, and open tabs\n * reload into it.\n */\nexport async function startPreview(\n\tsource: PreviewSource,\n\toptions: PreviewOptions = {},\n): Promise<PreviewSession> {\n\tconst entry =\n\t\tsource.entry instanceof URL || String(source.entry).startsWith(\"file:\")\n\t\t\t? fileURLToPath(source.entry)\n\t\t\t: path.resolve(String(source.entry));\n\tconst exportName = source.export ?? \"default\";\n\t// Vision nodes load their cached models, and onnxruntime-web's files when\n\t// the project has it installed.\n\tconst modelsDir = visionModelsDir();\n\tconst ort = onnxRuntimeWeb(path.dirname(entry));\n\tconst roots = [\n\t\t...(options.root === undefined\n\t\t\t? [repoRoot(path.dirname(entry))]\n\t\t\t: Array.isArray(options.root)\n\t\t\t\t? options.root\n\t\t\t\t: [options.root]),\n\t\tmodelsDir,\n\t\tort.dir,\n\t]\n\t\t.filter((r): r is string => !!r)\n\t\t.map((r) => path.resolve(r));\n\tconst sseClients = new Set<http.ServerResponse>();\n\tconst idleCloseMs = options.idleCloseMs ?? 5000;\n\tlet idleTimer: NodeJS.Timeout | undefined;\n\tconst title = options.title ?? \"framefields preview\";\n\tconst session = randomUUID();\n\tconst log =\n\t\toptions.log === false\n\t\t\t? () => {}\n\t\t\t: (options.log ?? ((line: string) => console.error(line)));\n\tconst say = (line: string) => log(`[framefields preview] ${line}`);\n\t// Each distinct page error is reported once; playback repeats them per frame.\n\tconst reported = new Set<string>();\n\tlet pageOpened = false;\n\n\tconst notes =\n\t\toptions.notesDir === false\n\t\t\t? undefined\n\t\t\t: new NoteStore(\n\t\t\t\t\tpath.resolve(\n\t\t\t\t\t\toptions.notesDir ??\n\t\t\t\t\t\t\tpath.join(process.cwd(), \".framefields\", \"preview-notes\"),\n\t\t\t\t\t),\n\t\t\t\t);\n\t// Changes run one at a time: each reads and rewrites notes.json.\n\tlet noteQueue: Promise<unknown> = Promise.resolve();\n\n\t// Assets framefields.json pins but that aren't on disk (an agent's\n\t// sandbox, a fresh clone) stream from their bucket: the page is\n\t// redirected there, and the soundtrack mix reads them over HTTP.\n\tconst assets = await openAssetLocator(path.dirname(entry)).catch(\n\t\t(err: unknown) => {\n\t\t\tsay(`pinned assets are off: ${(err as Error).message}`);\n\t\t\treturn undefined;\n\t\t},\n\t);\n\tif (assets) inputStore.setMissingMediaResolver((file) => assets.url(file));\n\tconst unreadable = new Set<string>();\n\n\tconst target = await loadTarget(entry, exportName);\n\tconst meta = await resolveMeta(target, title, session, notes?.dir ?? null);\n\t// The project's own code, bundled against the browser engine; the engine\n\t// itself is prebuilt (or built once, running from source).\n\tlet bundle: Promise<string> | undefined;\n\tconst playerBundle = () => {\n\t\tif (!bundle) {\n\t\t\tconst built = bundleProject({\n\t\t\t\tentry,\n\t\t\t\texportName,\n\t\t\t\tmodelsDir,\n\t\t\t\tortBase: ort.base,\n\t\t\t}).then((b) => b.code);\n\t\t\tbundle = built;\n\t\t\tbuilt.catch((err: unknown) => {\n\t\t\t\tsay(\n\t\t\t\t\t`could not build ${path.relative(process.cwd(), entry)}:\\n${errorText(err)}`,\n\t\t\t\t);\n\t\t\t\t// Let a later request try again, unless it started its own build.\n\t\t\t\tif (bundle === built) bundle = undefined;\n\t\t\t});\n\t\t}\n\t\treturn bundle;\n\t};\n\tconst engine = engineDir();\n\tengine.catch(() => {});\n\tconst page = pageDir();\n\tpage.catch(() => {});\n\n\t// ── Audio: the page mixes it with the export's mixer, reading sources\n\t// itself (straight from their bucket, for pinned assets). The server mixes\n\t// only when the page can't, and sends the mix as a WAV. ──\n\tlet audio: AudioStatus = {\n\t\tstate: options.audio === false ? \"none\" : \"browser\",\n\t};\n\tlet audioWav: Buffer | undefined;\n\n\tfunction broadcast(event: string, data: unknown) {\n\t\tfor (const client of sseClients) {\n\t\t\tclient.write(`event: ${event}\\ndata: ${JSON.stringify(data)}\\n\\n`);\n\t\t}\n\t}\n\n\tfunction setAudio(next: AudioStatus) {\n\t\taudio = next;\n\t\tbroadcast(\"audio\", audio);\n\t}\n\n\tfunction startAudio() {\n\t\tif (audio.state !== \"mixing\") return;\n\t\tif (!target.toVirtualMediaAsync && !target.toVirtualMedia) {\n\t\t\tsetAudio({ state: \"none\" });\n\t\t\treturn;\n\t\t}\n\t\tconst renderer = options.renderer ?? new HeadlessMediaRenderer();\n\t\t(async () => {\n\t\t\tconst vm = target.toVirtualMediaAsync\n\t\t\t\t? await target.toVirtualMediaAsync()\n\t\t\t\t: (target.toVirtualMedia as () => VirtualMediaData)();\n\t\t\t// Live signal time is recorded frame by frame; finish it before mixing.\n\t\t\tawait target.prepareMediaTime?.();\n\t\t\treturn renderer.renderAudio(vm, { fps: meta.fps });\n\t\t})().then(\n\t\t\t({ channels, sampleRate }) => {\n\t\t\t\tconst left = channels[0] ?? new Float32Array(0);\n\t\t\t\tconst right = channels[1] ?? left;\n\t\t\t\tconst peaks = computePeaks(left, right, PEAK_BINS);\n\t\t\t\tif (left.length === 0 || Math.max(...peaks) < SILENT_PEAK) {\n\t\t\t\t\tsetAudio({ state: \"none\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\taudioWav = encodeStereoWav([left, right], { sampleRate });\n\t\t\t\tsetAudio({\n\t\t\t\t\tstate: \"ready\",\n\t\t\t\t\tdurationSec: left.length / sampleRate,\n\t\t\t\t\tpeaks: peaks.map((p) => Math.round(p * 1000) / 1000),\n\t\t\t\t});\n\t\t\t},\n\t\t\t(err: unknown) => {\n\t\t\t\tsetAudio({\n\t\t\t\t\tstate: \"error\",\n\t\t\t\t\terror: err instanceof Error ? err.message : String(err),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t}\n\n\tlet resolveClosed!: (reason: PreviewCloseReason) => void;\n\tconst closed = new Promise<PreviewCloseReason>((r) => {\n\t\tresolveClosed = r;\n\t});\n\tlet closing: Promise<void> | undefined;\n\tfunction close(reason: PreviewCloseReason = \"closed\"): Promise<void> {\n\t\tclosing ??= new Promise<void>((resolve) => {\n\t\t\tclearTimeout(idleTimer);\n\t\t\tif (reason === \"idle\") say(\"stopped: its tab was closed\");\n\t\t\tif (reason === \"replaced\") say(\"stopped: a newer preview took over\");\n\t\t\tfor (const client of sseClients) client.end();\n\t\t\tsseClients.clear();\n\t\t\tif (assets) inputStore.setMissingMediaResolver();\n\t\t\tserver.close(() => {\n\t\t\t\tresolve();\n\t\t\t\tresolveClosed(reason);\n\t\t\t});\n\t\t\tserver.closeAllConnections();\n\t\t});\n\t\treturn closing;\n\t}\n\n\tconst server = http.createServer(async (req, res) => {\n\t\tconst url = new URL(req.url ?? \"/\", \"http://localhost\");\n\t\t// Cross-origin isolation: lets onnxruntime-web use SharedArrayBuffer and\n\t\t// threads for vision models (single-threaded otherwise). \"credentialless\"\n\t\t// keeps cross-origin assets such as the font stylesheet loading.\n\t\tres.setHeader(\"cross-origin-opener-policy\", \"same-origin\");\n\t\tres.setHeader(\"cross-origin-embedder-policy\", \"credentialless\");\n\t\ttry {\n\t\t\t// The page: its HTML here, its script and styles under PAGE_URL.\n\t\t\tif (req.method === \"GET\" && url.pathname === \"/\") {\n\t\t\t\tawait sendFile(req, res, path.join(await page, \"index.html\"), true);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (req.method === \"GET\" && url.pathname === \"/meta\") {\n\t\t\t\tsendJson(res, 200, { ...meta, audio } satisfies PreviewMetaReply);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const [prefix, dir] of [\n\t\t\t\t[ENGINE_URL, engine],\n\t\t\t\t[PAGE_URL, page],\n\t\t\t] as const) {\n\t\t\t\tif (req.method !== \"GET\" || !url.pathname.startsWith(`${prefix}/`))\n\t\t\t\t\tcontinue;\n\t\t\t\tconst root = await dir;\n\t\t\t\tconst file = path.resolve(\n\t\t\t\t\troot,\n\t\t\t\t\t`.${url.pathname.slice(prefix.length)}`,\n\t\t\t\t);\n\t\t\t\tif (isInside(root, file) && (await isFile(file)))\n\t\t\t\t\tawait sendFile(req, res, file, prefix === PAGE_URL);\n\t\t\t\telse sendJson(res, 404, { error: \"not found\" });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (req.method === \"GET\" && url.pathname === PLAYER_PATH) {\n\t\t\t\tlet code: string;\n\t\t\t\ttry {\n\t\t\t\t\tawait engine;\n\t\t\t\t\tcode = await playerBundle();\n\t\t\t\t} catch (err) {\n\t\t\t\t\t// Shown on the page: usually an error in the composition's code.\n\t\t\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\t\t\tcode = `throw new Error(${JSON.stringify(`Could not build the preview:\\n${message}`)});`;\n\t\t\t\t}\n\t\t\t\tres.writeHead(200, {\n\t\t\t\t\t\"content-type\": \"text/javascript; charset=utf-8\",\n\t\t\t\t\t\"cache-control\": \"no-store\",\n\t\t\t\t});\n\t\t\t\tres.end(code);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// `fs.existsSync` / `statSync` in the page: a missing file is an\n\t\t\t// answer here, not a 404 the browser logs as an error.\n\t\t\tif (req.method === \"GET\" && url.pathname === \"/@framefields/stat\") {\n\t\t\t\tconst file = path.resolve(url.searchParams.get(\"path\") ?? \"\");\n\t\t\t\tlet size = -1;\n\t\t\t\tif (roots.some((r) => isInside(r, file))) {\n\t\t\t\t\tsize = await fs.promises.stat(file).then(\n\t\t\t\t\t\t(st) => (st.isFile() ? st.size : -1),\n\t\t\t\t\t\t() => assets?.entry(file)?.size ?? -1,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tsendJson(res, 200, { exists: size >= 0, size: Math.max(0, size) });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (req.method === \"GET\" && url.pathname === \"/events\") {\n\t\t\t\tres.writeHead(200, {\n\t\t\t\t\t\"content-type\": \"text/event-stream\",\n\t\t\t\t\t\"cache-control\": \"no-store\",\n\t\t\t\t\tconnection: \"keep-alive\",\n\t\t\t\t});\n\t\t\t\t// Reconnect fast: a tab left open finds the next preview's\n\t\t\t\t// server within a second of it starting.\n\t\t\t\tres.write(\"retry: 1000\\n\");\n\t\t\t\tres.write(\n\t\t\t\t\t`event: hello\\ndata: ${JSON.stringify({ session: meta.session })}\\n\\n`,\n\t\t\t\t);\n\t\t\t\tsseClients.add(res);\n\t\t\t\tclearTimeout(idleTimer);\n\t\t\t\tif (!pageOpened) {\n\t\t\t\t\tpageOpened = true;\n\t\t\t\t\tsay(\n\t\t\t\t\t\tidleCloseMs === false\n\t\t\t\t\t\t\t? \"page opened\"\n\t\t\t\t\t\t\t: `page opened; the server stops ${Number((idleCloseMs / 1000).toFixed(1))} s after its last tab closes`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tonClient?.();\n\t\t\t\treq.on(\"close\", () => {\n\t\t\t\t\tsseClients.delete(res);\n\t\t\t\t\t// A reload reconnects within a second; a closed tab doesn't.\n\t\t\t\t\tif (sseClients.size === 0 && idleCloseMs !== false && !closing) {\n\t\t\t\t\t\tidleTimer = setTimeout(() => {\n\t\t\t\t\t\t\tif (sseClients.size === 0) void close(\"idle\");\n\t\t\t\t\t\t}, idleCloseMs);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// A newer preview of the same project wants this port. The custom\n\t\t\t// header keeps web pages from triggering it (it forces a CORS preflight).\n\t\t\tif (\n\t\t\t\treq.method === \"POST\" &&\n\t\t\t\turl.pathname === \"/takeover\" &&\n\t\t\t\treq.headers[TAKEOVER_HEADER] === \"1\"\n\t\t\t) {\n\t\t\t\tsendJson(res, 200, { ok: true });\n\t\t\t\tsetImmediate(() => void close(\"replaced\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Errors in the page, so they reach the terminal (and an agent)\n\t\t\t// without anyone looking at the browser. JSON only: other sites\n\t\t\t// can't send that without a preflight this server doesn't answer.\n\t\t\tif (\n\t\t\t\treq.method === \"POST\" &&\n\t\t\t\turl.pathname === \"/@framefields/log\" &&\n\t\t\t\treq.headers[\"content-type\"] === \"application/json\"\n\t\t\t) {\n\t\t\t\tconst body = await readBody(req, 16 * 1024);\n\t\t\t\tconst { message, level } = JSON.parse(body) as {\n\t\t\t\t\tmessage?: unknown;\n\t\t\t\t\tlevel?: unknown;\n\t\t\t\t};\n\t\t\t\tconst text = String(message ?? \"\").trim();\n\t\t\t\tif (text && !reported.has(text) && reported.size < 200) {\n\t\t\t\t\treported.add(text);\n\t\t\t\t\tsay(\n\t\t\t\t\t\t`${level === \"warning\" ? \"warning\" : \"error\"} in the page: ${text}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tres.writeHead(204).end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (notes && url.pathname === \"/@framefields/notes\") {\n\t\t\t\tif (req.method === \"GET\") {\n\t\t\t\t\tsendJson(res, 200, await notes.list());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\treq.method === \"POST\" &&\n\t\t\t\t\treq.headers[\"content-type\"] === \"application/json\"\n\t\t\t\t) {\n\t\t\t\t\tconst body = JSON.parse(\n\t\t\t\t\t\tawait readBody(req, 16 * 1024 * 1024),\n\t\t\t\t\t) as NoteBody;\n\t\t\t\t\tconst change = noteQueue.then(() =>\n\t\t\t\t\t\tchangeNote(notes, body, meta.fps, say),\n\t\t\t\t\t);\n\t\t\t\t\tnoteQueue = change.catch(() => {});\n\t\t\t\t\tconst note = await change;\n\t\t\t\t\tbroadcast(\"notes\", await notes.list());\n\t\t\t\t\tsendJson(res, note ? 200 : 404, note ?? { error: \"no such note\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// The page couldn't mix the soundtrack: mix it here instead.\n\t\t\tif (req.method === \"POST\" && url.pathname === \"/audio/mix\") {\n\t\t\t\tif (audio.state === \"browser\" || audio.state === \"error\") {\n\t\t\t\t\taudio = { state: \"mixing\" };\n\t\t\t\t\tstartAudio();\n\t\t\t\t}\n\t\t\t\tsendJson(res, 202, audio);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (req.method === \"GET\" && url.pathname === \"/audio\") {\n\t\t\t\tif (audio.state !== \"ready\" || !audioWav) {\n\t\t\t\t\tsendJson(res, 404, { error: `audio is ${audio.state}` });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tres.writeHead(200, {\n\t\t\t\t\t\"content-type\": \"audio/wav\",\n\t\t\t\t\t\"content-length\": audioWav.length,\n\t\t\t\t\t\"cache-control\": \"no-store\",\n\t\t\t\t});\n\t\t\t\tres.end(audioWav);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Fonts referenced by family only resolve to assets/fonts/<Family>.ttf,\n\t\t\t// read from the project's folder, as the export engine does.\n\t\t\tconst fontMatch = /^\\/assets\\/fonts\\/([^/]+)$/.exec(url.pathname);\n\t\t\tif (fontMatch && (req.method === \"GET\" || req.method === \"HEAD\")) {\n\t\t\t\tconst file = path.join(\n\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\"assets\",\n\t\t\t\t\t\"fonts\",\n\t\t\t\t\tdecodeURIComponent(fontMatch[1]),\n\t\t\t\t);\n\t\t\t\tif (await isFile(file)) {\n\t\t\t\t\tawait sendFile(req, res, file);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// The composition's files, by absolute path: what the program\n\t\t\t// references loads as-is.\n\t\t\tif (req.method === \"GET\" || req.method === \"HEAD\") {\n\t\t\t\t// The engine asks for local files under Vite's `/@fs/` prefix.\n\t\t\t\tconst file = path.resolve(\n\t\t\t\t\tdecodeURIComponent(url.pathname.replace(/^\\/@fs(?=\\/)/, \"\")),\n\t\t\t\t);\n\t\t\t\tif (roots.some((r) => isInside(r, file)) && (await isFile(file))) {\n\t\t\t\t\tawait sendFile(req, res, file);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\tassets &&\n\t\t\t\t\t(await redirectToBucket(res, assets, file, unreadable, say))\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t\tsendJson(res, 404, { error: \"not found\" });\n\t\t} catch (err) {\n\t\t\tif (!res.headersSent) {\n\t\t\t\tsendJson(res, 500, {\n\t\t\t\t\terror: err instanceof Error ? err.message : String(err),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tres.end();\n\t\t\t}\n\t\t}\n\t});\n\n\tlet onClient: (() => void) | undefined;\n\tconst host = options.host ?? \"127.0.0.1\";\n\tconst port = options.port ?? stablePort();\n\tconst listen = (p: number) =>\n\t\tnew Promise<void>((resolve, reject) => {\n\t\t\tconst fail = (err: Error) => {\n\t\t\t\tserver.off(\"listening\", ok);\n\t\t\t\treject(err);\n\t\t\t};\n\t\t\tconst ok = () => {\n\t\t\t\tserver.off(\"error\", fail);\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tserver.once(\"error\", fail);\n\t\t\tserver.once(\"listening\", ok);\n\t\t\tserver.listen(p, host);\n\t\t});\n\ttry {\n\t\tawait listen(port);\n\t} catch (err) {\n\t\tif ((err as NodeJS.ErrnoException).code !== \"EADDRINUSE\") throw err;\n\t\t// Most likely the previous preview of this project: ask it to step aside.\n\t\tif (await requestTakeover(host, port)) {\n\t\t\tawait listen(port).catch(() => listen(0));\n\t\t} else if (options.port === undefined) {\n\t\t\tawait listen(0);\n\t\t} else {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tconst { port: actualPort } = server.address() as AddressInfo;\n\tconst url = `http://${host.includes(\":\") ? `[${host}]` : host}:${actualPort}/`;\n\n\t// Build the page's bundle while the browser opens.\n\tvoid playerBundle().catch(() => {});\n\tif (options.open === true) {\n\t\t// A tab from the last preview reconnects within ~1 s and reloads itself;\n\t\t// only open a new one when nobody comes back.\n\t\tconst reconnected = await new Promise<boolean>((resolve) => {\n\t\t\tconst timer = setTimeout(() => resolve(false), 2000);\n\t\t\tonClient = () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(true);\n\t\t\t};\n\t\t\tif (sseClients.size > 0) onClient();\n\t\t});\n\t\tonClient = undefined;\n\t\tif (!reconnected) openBrowser(url);\n\t}\n\n\treturn { url, closed, close: () => close() };\n}\n\nasync function loadTarget(\n\tentry: string,\n\texportName: string,\n): Promise<PreviewTarget> {\n\tconst mod = (await import(pathToFileURL(entry).href)) as Record<\n\t\tstring,\n\t\tunknown\n\t>;\n\tconst exported = mod[exportName];\n\tif (exported === undefined) {\n\t\tthrow new Error(\n\t\t\t`[framefields] ${entry} has no export named \"${exportName}\" to preview.`,\n\t\t);\n\t}\n\treturn (\n\t\ttypeof exported === \"function\"\n\t\t\t? await (exported as () => unknown)()\n\t\t\t: exported\n\t) as PreviewTarget;\n}\n\n/**\n * The project holding `dir`: the nearest `.git`, else the nearest\n * `package.json`, else `dir` itself. A repo wins over a nested package, so a\n * monorepo's shared assets stay reachable.\n */\nfunction repoRoot(dir: string): string {\n\tlet project: string | undefined;\n\tfor (let d = dir; ; d = path.dirname(d)) {\n\t\tif (fs.existsSync(path.join(d, \".git\"))) return d;\n\t\tif (!project && fs.existsSync(path.join(d, \"package.json\"))) project = d;\n\t\tif (path.dirname(d) === d) return project ?? dir;\n\t}\n}\n\n/** Applies one change from the page and says what it was. */\nasync function changeNote(\n\tnotes: NoteStore,\n\tbody: NoteBody,\n\tfps: number,\n\tsay: (line: string) => void,\n) {\n\tif (body.op === \"add\" && body.note && String(body.note.text).trim()) {\n\t\tconst note = await notes.add(body.note);\n\t\tconst files = [\n\t\t\tnote.image && `frame with the spot marked: ${note.image}`,\n\t\t\t`all notes: ${notes.file}`,\n\t\t];\n\t\tsay(`${describeNote(note, fps)}\\n ${files.filter(Boolean).join(\" · \")}`);\n\t\treturn note;\n\t}\n\tconst id = Number(body.id);\n\tif (body.op === \"update\") {\n\t\tconst note = await notes.update(id, body);\n\t\tif (note && typeof body.done === \"boolean\")\n\t\t\tsay(`note ${id} marked ${note.done ? \"done\" : \"open\"}`);\n\t\treturn note;\n\t}\n\tif (body.op === \"remove\") {\n\t\tconst note = await notes.remove(id);\n\t\tif (note) say(`note ${id} deleted`);\n\t\treturn note;\n\t}\n\treturn undefined;\n}\n\nfunction errorText(err: unknown): string {\n\treturn err instanceof Error ? err.message : String(err);\n}\n\nfunction readBody(req: http.IncomingMessage, limit: number): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet body = \"\";\n\t\treq.setEncoding(\"utf8\");\n\t\treq.on(\"data\", (chunk: string) => {\n\t\t\tbody += chunk;\n\t\t\tif (body.length > limit) {\n\t\t\t\treject(new Error(\"request body too large\"));\n\t\t\t\treq.destroy();\n\t\t\t}\n\t\t});\n\t\treq.on(\"end\", () => resolve(body));\n\t\treq.on(\"error\", reject);\n\t});\n}\n\nfunction isInside(root: string, file: string): boolean {\n\tconst rel = path.relative(root, file);\n\treturn !!rel && !rel.startsWith(\"..\") && !path.isAbsolute(rel);\n}\n\nasync function isFile(file: string): Promise<boolean> {\n\ttry {\n\t\treturn (await fs.promises.stat(file)).isFile();\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nconst CONTENT_TYPES: Record<string, string> = {\n\t\".png\": \"image/png\",\n\t\".jpg\": \"image/jpeg\",\n\t\".jpeg\": \"image/jpeg\",\n\t\".webp\": \"image/webp\",\n\t\".gif\": \"image/gif\",\n\t\".svg\": \"image/svg+xml\",\n\t\".mp4\": \"video/mp4\",\n\t\".mov\": \"video/quicktime\",\n\t\".webm\": \"video/webm\",\n\t\".mp3\": \"audio/mpeg\",\n\t\".wav\": \"audio/wav\",\n\t\".m4a\": \"audio/mp4\",\n\t\".ogg\": \"audio/ogg\",\n\t\".ttf\": \"font/ttf\",\n\t\".otf\": \"font/otf\",\n\t\".woff\": \"font/woff\",\n\t\".woff2\": \"font/woff2\",\n\t\".json\": \"application/json\",\n\t\".html\": \"text/html; charset=utf-8\",\n\t\".css\": \"text/css; charset=utf-8\",\n\t\".map\": \"application/json\",\n\t\".js\": \"text/javascript; charset=utf-8\",\n\t\".mjs\": \"text/javascript; charset=utf-8\",\n\t\".wasm\": \"application/wasm\",\n\t\".onnx\": \"application/octet-stream\",\n\t\".srt\": \"text/plain; charset=utf-8\",\n\t\".txt\": \"text/plain; charset=utf-8\",\n};\n\n/**\n * Sends the page to the bucket for a pinned asset that isn't on disk. The\n * bucket must allow this page's origin (CORS): the engine reads media with\n * `fetch`. True when it answered.\n */\nasync function redirectToBucket(\n\tres: http.ServerResponse,\n\tassets: AssetLocator,\n\tfile: string,\n\tunreadable: Set<string>,\n\tsay: (line: string) => void,\n): Promise<boolean> {\n\tif (!assets.entry(file)) return false;\n\tconst url = await assets.url(file);\n\tif (url) {\n\t\tres.writeHead(302, { location: url, \"cache-control\": \"no-store\" });\n\t\tres.end();\n\t\treturn true;\n\t}\n\tconst rel = path.relative(assets.root, file);\n\tif (!unreadable.has(rel)) {\n\t\tunreadable.add(rel);\n\t\tsay(\n\t\t\t`${rel} is pinned on a private remote and there are no keys here: set its FRAMEFIELDS_STORAGE_* keys, give the remote a publicUrl, or \\`npx framefields assets pull\\``,\n\t\t);\n\t}\n\treturn false;\n}\n\n/** Serves a file, with byte ranges so video can seek without loading it whole. */\nasync function sendFile(\n\treq: http.IncomingMessage,\n\tres: http.ServerResponse,\n\tfile: string,\n\t/** The page's own files: always fetched fresh, as a newer framefields may serve them. */\n\tnoStore = false,\n) {\n\tconst { size } = await fs.promises.stat(file);\n\tconst type =\n\t\tCONTENT_TYPES[path.extname(file).toLowerCase()] ??\n\t\t\"application/octet-stream\";\n\tconst range = /^bytes=(\\d*)-(\\d*)$/.exec(req.headers.range ?? \"\");\n\tlet start = 0;\n\tlet end = size - 1;\n\tif (range && (range[1] || range[2])) {\n\t\tif (range[1]) {\n\t\t\tstart = Number(range[1]);\n\t\t\tif (range[2]) end = Math.min(end, Number(range[2]));\n\t\t} else {\n\t\t\tstart = Math.max(0, size - Number(range[2]));\n\t\t}\n\t\tif (start > end || start >= size) {\n\t\t\tres.writeHead(416, { \"content-range\": `bytes */${size}` });\n\t\t\tres.end();\n\t\t\treturn;\n\t\t}\n\t}\n\tres.writeHead(range ? 206 : 200, {\n\t\t\"content-type\": type,\n\t\t\"content-length\": end - start + 1,\n\t\t\"accept-ranges\": \"bytes\",\n\t\t\"cache-control\": noStore ? \"no-store\" : \"no-cache\",\n\t\t...(range && { \"content-range\": `bytes ${start}-${end}/${size}` }),\n\t});\n\tif (req.method === \"HEAD\") {\n\t\tres.end();\n\t\treturn;\n\t}\n\tfs.createReadStream(file, { start, end }).pipe(res);\n}\n\nasync function resolveMeta(\n\ttarget: PreviewTarget,\n\ttitle: string,\n\tsession: string,\n\tnotesDir: string | null,\n): Promise<PreviewMeta> {\n\tconst fps = target.fps ?? 24;\n\tconst durationMs =\n\t\ttarget.durationMs ?? (await target.computeDuration?.()) ?? 5000;\n\treturn {\n\t\tsession,\n\t\tnotesDir,\n\t\ttitle,\n\t\tfps,\n\t\tframeCount: Math.max(1, Math.round((durationMs / 1000) * fps)),\n\t\twidth: target.width ?? 1920,\n\t\theight: target.height ?? 1080,\n\t};\n}\n\n/** Same project, same port: 41000–41899, from the working directory. */\nfunction stablePort(): number {\n\tconst digest = createHash(\"sha1\").update(process.cwd()).digest();\n\treturn 41000 + (digest.readUInt16BE(0) % 900);\n}\n\n/** Asks a preview already on `port` to shut down; false if something else is there. */\nasync function requestTakeover(host: string, port: number): Promise<boolean> {\n\t// A fresh connection (no agent): a pooled keep-alive socket may point at a\n\t// server that is already gone.\n\tconst ok = await new Promise<boolean>((resolve) => {\n\t\tconst req = http.request(\n\t\t\t{\n\t\t\t\thost,\n\t\t\t\tport,\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tpath: \"/takeover\",\n\t\t\t\tagent: false,\n\t\t\t\theaders: { [TAKEOVER_HEADER]: \"1\" },\n\t\t\t\ttimeout: 1500,\n\t\t\t},\n\t\t\t(res) => {\n\t\t\t\tres.resume();\n\t\t\t\tresolve(res.statusCode === 200);\n\t\t\t},\n\t\t);\n\t\treq.on(\"timeout\", () => req.destroy());\n\t\treq.on(\"error\", () => resolve(false));\n\t\treq.end();\n\t});\n\t// Give it a moment to release the socket.\n\tif (ok) await new Promise((r) => setTimeout(r, 150));\n\treturn ok;\n}\n\n/** Max absolute amplitude of both channels per bin, 0..1. */\nfunction sendJson(res: http.ServerResponse, status: number, body: unknown) {\n\tres.writeHead(status, {\n\t\t\"content-type\": \"application/json\",\n\t\t\"cache-control\": \"no-store\",\n\t});\n\tres.end(JSON.stringify(body));\n}\n\nfunction openBrowser(url: string) {\n\tconst [cmd, args] =\n\t\tprocess.platform === \"darwin\"\n\t\t\t? [\"open\", [url]]\n\t\t\t: process.platform === \"win32\"\n\t\t\t\t? [\"cmd\", [\"/c\", \"start\", \"\", url]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