@motionscript/core 0.1.0-alpha.6 → 0.1.0-alpha.7
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/CHANGELOG.md +28 -0
- package/README.md +2 -4
- package/dist/assets/errors.js +4 -5
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/scope.d.ts +1 -1
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +3 -18
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/index.d.ts +3 -5
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +2 -2
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/insets.d.ts +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/size.d.ts +1 -1
- package/dist/attributes/layout/size.js +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +44 -11
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +37 -9
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.d.ts +1 -1
- package/dist/attributes/properties/inputs.js +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +19 -140
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +12 -108
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +1 -1
- package/dist/attributes/shape/corners/corner-radius.js +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts +1 -1
- package/dist/attributes/shape/fill/color/parser.js +1 -1
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +2 -2
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.d.ts +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -1
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +4 -3
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/ops.d.ts +1 -2
- package/dist/attributes/shape/path/ops.d.ts.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shared/operators.d.ts +2 -2
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/types.d.ts +2 -3
- package/dist/attributes/text/types.d.ts.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-D4FSTPML.js +14 -0
- package/dist/browser/chunks/chunk-D4FSTPML.js.map +7 -0
- package/dist/browser/chunks/chunk-LKUYVFU3.js +2 -0
- package/dist/browser/chunks/{chunk-DHB4COFY.js.map → chunk-LKUYVFU3.js.map} +4 -4
- package/dist/browser/chunks/chunk-RTNATFWX.js +5 -0
- package/dist/browser/chunks/chunk-RTNATFWX.js.map +7 -0
- package/dist/browser/chunks/chunk-ZRPZPWZU.js +3 -0
- package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/manifest.json +2 -4
- package/dist/browser/sdk.js +1 -1
- package/dist/component.d.ts +10 -18
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +10 -17
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/audio/audio.d.ts +53 -0
- package/dist/components/builtins/audio/audio.d.ts.map +1 -0
- package/dist/components/builtins/audio/audio.js +41 -0
- package/dist/components/builtins/audio/audio.js.map +1 -0
- package/dist/components/builtins/geometry/composite.d.ts +93 -0
- package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
- package/dist/components/builtins/geometry/composite.js +25 -0
- package/dist/components/builtins/geometry/composite.js.map +1 -0
- package/dist/components/builtins/geometry/geometry.d.ts +921 -0
- package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
- package/dist/components/builtins/geometry/geometry.js +107 -0
- package/dist/components/builtins/geometry/geometry.js.map +1 -0
- package/dist/components/builtins/geometry/shape-outline.d.ts +93 -0
- package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
- package/dist/components/builtins/geometry/shape-outline.js +470 -0
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
- package/dist/components/builtins/layout/layout.d.ts +186 -0
- package/dist/components/builtins/layout/layout.d.ts.map +1 -0
- package/dist/components/builtins/layout/layout.js +84 -0
- package/dist/components/builtins/layout/layout.js.map +1 -0
- package/dist/components/builtins/media/media.d.ts +240 -0
- package/dist/components/builtins/media/media.d.ts.map +1 -0
- package/dist/components/builtins/media/media.js +149 -0
- package/dist/components/builtins/media/media.js.map +1 -0
- package/dist/components/builtins/providers/providers.d.ts +47 -0
- package/dist/components/builtins/providers/providers.d.ts.map +1 -0
- package/dist/components/builtins/providers/providers.js +30 -0
- package/dist/components/builtins/providers/providers.js.map +1 -0
- package/dist/components/builtins/text/number-format.d.ts +66 -0
- package/dist/components/builtins/text/number-format.d.ts.map +1 -0
- package/dist/components/builtins/text/number-format.js +227 -0
- package/dist/components/builtins/text/number-format.js.map +1 -0
- package/dist/components/builtins/text/number-pattern.d.ts +51 -0
- package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
- package/dist/components/builtins/text/number-pattern.js +77 -0
- package/dist/components/builtins/text/number-pattern.js.map +1 -0
- package/dist/components/builtins/text/text-defaults.d.ts +32 -0
- package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
- package/dist/components/builtins/text/text-defaults.js +37 -0
- package/dist/components/builtins/text/text-defaults.js.map +1 -0
- package/dist/components/builtins/text/text-layout.d.ts +82 -0
- package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
- package/dist/components/builtins/text/text-layout.js +331 -0
- package/dist/components/builtins/text/text-layout.js.map +1 -0
- package/dist/components/builtins/text/text.d.ts +409 -0
- package/dist/components/builtins/text/text.d.ts.map +1 -0
- package/dist/components/builtins/text/text.js +113 -0
- package/dist/components/builtins/text/text.js.map +1 -0
- package/dist/components/builtins/three/canvas3d.d.ts +245 -0
- package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
- package/dist/components/builtins/three/canvas3d.js +21 -0
- package/dist/components/builtins/three/canvas3d.js.map +1 -0
- package/dist/components/builtins/three/grid-geometry3d.d.ts +62 -0
- package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
- package/dist/components/builtins/three/grid-geometry3d.js +114 -0
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
- package/dist/components/builtins/three/three.d.ts +1889 -0
- package/dist/components/builtins/three/three.d.ts.map +1 -0
- package/dist/components/builtins/three/three.js +305 -0
- package/dist/components/builtins/three/three.js.map +1 -0
- package/dist/components/factory/api.d.ts +516 -0
- package/dist/components/factory/api.d.ts.map +1 -0
- package/dist/components/factory/api.js +4 -0
- package/dist/components/factory/api.js.map +1 -0
- package/dist/components/factory/clip-of.d.ts +5 -0
- package/dist/components/factory/clip-of.d.ts.map +1 -0
- package/dist/components/factory/clip-of.js +33 -0
- package/dist/components/factory/clip-of.js.map +1 -0
- package/dist/components/factory/commands-for.d.ts +19 -0
- package/dist/components/factory/commands-for.d.ts.map +1 -0
- package/dist/components/factory/commands-for.js +5 -0
- package/dist/components/factory/commands-for.js.map +1 -0
- package/dist/components/factory/component-audio.d.ts +9 -0
- package/dist/components/factory/component-audio.d.ts.map +1 -0
- package/dist/components/factory/component-audio.js +18 -0
- package/dist/components/factory/component-audio.js.map +1 -0
- package/dist/components/factory/component2d.d.ts +8 -0
- package/dist/components/factory/component2d.d.ts.map +1 -0
- package/dist/components/factory/component2d.js +240 -0
- package/dist/components/factory/component2d.js.map +1 -0
- package/dist/components/factory/component3d.d.ts +9 -0
- package/dist/components/factory/component3d.d.ts.map +1 -0
- package/dist/components/factory/component3d.js +99 -0
- package/dist/components/factory/component3d.js.map +1 -0
- package/dist/components/factory/factory.d.ts +63 -0
- package/dist/components/factory/factory.d.ts.map +1 -0
- package/dist/components/factory/factory.js +313 -0
- package/dist/components/factory/factory.js.map +1 -0
- package/dist/components/factory/timeline.d.ts +22 -0
- package/dist/components/factory/timeline.d.ts.map +1 -0
- package/dist/components/factory/timeline.js +128 -0
- package/dist/components/factory/timeline.js.map +1 -0
- package/dist/components/factory/type-def.d.ts +26 -0
- package/dist/components/factory/type-def.d.ts.map +1 -0
- package/dist/components/factory/type-def.js +16 -0
- package/dist/components/factory/type-def.js.map +1 -0
- package/dist/components/factory/types.d.ts +91 -0
- package/dist/components/factory/types.d.ts.map +1 -0
- package/dist/components/factory/types.js +88 -0
- package/dist/components/factory/types.js.map +1 -0
- package/dist/components/factory/views.d.ts +121 -0
- package/dist/components/factory/views.d.ts.map +1 -0
- package/dist/components/factory/views.js +413 -0
- package/dist/components/factory/views.js.map +1 -0
- package/dist/components/modules/aim.d.ts +30 -0
- package/dist/components/modules/aim.d.ts.map +1 -0
- package/dist/components/modules/aim.js +39 -0
- package/dist/components/modules/aim.js.map +1 -0
- package/dist/components/modules/corners.d.ts +13 -0
- package/dist/components/modules/corners.d.ts.map +1 -0
- package/dist/components/modules/corners.js +12 -0
- package/dist/components/modules/corners.js.map +1 -0
- package/dist/components/modules/flow.d.ts +26 -0
- package/dist/components/modules/flow.d.ts.map +1 -0
- package/dist/components/modules/flow.js +57 -0
- package/dist/components/modules/flow.js.map +1 -0
- package/dist/components/modules/material.d.ts +40 -0
- package/dist/components/modules/material.d.ts.map +1 -0
- package/dist/components/modules/material.js +75 -0
- package/dist/components/modules/material.js.map +1 -0
- package/dist/components/modules/paint.d.ts +71 -0
- package/dist/components/modules/paint.d.ts.map +1 -0
- package/dist/components/modules/paint.js +106 -0
- package/dist/components/modules/paint.js.map +1 -0
- package/dist/components/modules/shapes.d.ts +31 -0
- package/dist/components/modules/shapes.d.ts.map +1 -0
- package/dist/components/modules/shapes.js +43 -0
- package/dist/components/modules/shapes.js.map +1 -0
- package/dist/components/modules/text-layout.d.ts +26 -0
- package/dist/components/modules/text-layout.d.ts.map +1 -0
- package/dist/components/modules/text-layout.js +57 -0
- package/dist/components/modules/text-layout.js.map +1 -0
- package/dist/components/modules/text-style.d.ts +48 -0
- package/dist/components/modules/text-style.d.ts.map +1 -0
- package/dist/components/modules/text-style.js +63 -0
- package/dist/components/modules/text-style.js.map +1 -0
- package/dist/components/modules/three-entries.d.ts +23 -0
- package/dist/components/modules/three-entries.d.ts.map +1 -0
- package/dist/components/modules/three-entries.js +41 -0
- package/dist/components/modules/three-entries.js.map +1 -0
- package/dist/components/modules/view3d.d.ts +59 -0
- package/dist/components/modules/view3d.d.ts.map +1 -0
- package/dist/components/modules/view3d.js +171 -0
- package/dist/components/modules/view3d.js.map +1 -0
- package/dist/components/trees/2d/group-bounds.d.ts +56 -0
- package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
- package/dist/components/trees/2d/group-bounds.js +87 -0
- package/dist/components/trees/2d/group-bounds.js.map +1 -0
- package/dist/components/trees/2d/node-lifecycle.d.ts +46 -0
- package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
- package/dist/components/trees/2d/node-lifecycle.js +264 -0
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
- package/dist/components/trees/2d/node-motion.d.ts +56 -0
- package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
- package/dist/components/trees/2d/node-motion.js +86 -0
- package/dist/components/trees/2d/node-motion.js.map +1 -0
- package/dist/components/trees/2d/node-render.d.ts +36 -0
- package/dist/components/trees/2d/node-render.d.ts.map +1 -0
- package/dist/components/trees/2d/node-render.js +67 -0
- package/dist/components/trees/2d/node-render.js.map +1 -0
- package/dist/components/trees/2d/node-space.d.ts +63 -0
- package/dist/components/trees/2d/node-space.d.ts.map +1 -0
- package/dist/components/trees/2d/node-space.js +131 -0
- package/dist/components/trees/2d/node-space.js.map +1 -0
- package/dist/components/trees/2d/node-transform.d.ts +55 -0
- package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
- package/dist/components/trees/2d/node-transform.js +73 -0
- package/dist/components/trees/2d/node-transform.js.map +1 -0
- package/dist/components/trees/2d/node2d.d.ts +1020 -0
- package/dist/components/trees/2d/node2d.d.ts.map +1 -0
- package/dist/components/trees/2d/node2d.js +1481 -0
- package/dist/components/trees/2d/node2d.js.map +1 -0
- package/dist/components/trees/audio/index.d.ts +2 -0
- package/dist/components/trees/audio/index.d.ts.map +1 -0
- package/dist/components/trees/audio/index.js +2 -0
- package/dist/components/trees/audio/index.js.map +1 -0
- package/dist/components/trees/audio/node-audio.d.ts +109 -0
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
- package/dist/components/trees/audio/node-audio.js +167 -0
- package/dist/components/trees/audio/node-audio.js.map +1 -0
- package/dist/components/trees/index.d.ts +10 -0
- package/dist/components/trees/index.d.ts.map +1 -0
- package/dist/components/trees/index.js +14 -0
- package/dist/components/trees/index.js.map +1 -0
- package/dist/components/trees/node/node-editor-state.d.ts +53 -0
- package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
- package/dist/components/trees/node/node-editor-state.js +23 -0
- package/dist/components/trees/node/node-editor-state.js.map +1 -0
- package/dist/components/trees/node/node-reactive.d.ts +89 -0
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
- package/dist/components/trees/node/node-reactive.js +135 -0
- package/dist/components/trees/node/node-reactive.js.map +1 -0
- package/dist/components/trees/node/node-time.d.ts +39 -0
- package/dist/components/trees/node/node-time.d.ts.map +1 -0
- package/dist/components/trees/node/node-time.js +14 -0
- package/dist/components/trees/node/node-time.js.map +1 -0
- package/dist/components/trees/node/node-walk.d.ts +46 -0
- package/dist/components/trees/node/node-walk.d.ts.map +1 -0
- package/dist/components/trees/node/node-walk.js +74 -0
- package/dist/components/trees/node/node-walk.js.map +1 -0
- package/dist/components/trees/node/node.d.ts +401 -0
- package/dist/components/trees/node/node.d.ts.map +1 -0
- package/dist/components/trees/node/node.js +680 -0
- package/dist/components/trees/node/node.js.map +1 -0
- package/dist/components/trees/root/canvas2d-node.d.ts +163 -0
- package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
- package/dist/components/trees/root/canvas2d-node.js +216 -0
- package/dist/components/trees/root/canvas2d-node.js.map +1 -0
- package/dist/components/trees/three/node3d.d.ts +222 -0
- package/dist/components/trees/three/node3d.d.ts.map +1 -0
- package/dist/components/trees/three/node3d.js +289 -0
- package/dist/components/trees/three/node3d.js.map +1 -0
- package/dist/document/builtins.js +13 -13
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +2 -2
- package/dist/document/command-traits.js +1 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.d.ts +2 -2
- package/dist/document/deny-globals.js +2 -2
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/expression/index.d.ts +1 -1
- package/dist/document/expression/index.js +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/index.d.ts +1 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +1 -2
- package/dist/document/index.js.map +1 -1
- package/dist/document/node-decorator.d.ts +14 -10
- package/dist/document/node-decorator.d.ts.map +1 -1
- package/dist/document/node-decorator.js +14 -10
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +3 -3
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/registry.d.ts +23 -25
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +12 -18
- package/dist/document/registry.js.map +1 -1
- package/dist/document/timeline.d.ts +3 -3
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +2 -2
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +4 -4
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +1 -1
- package/dist/document/validate.js.map +1 -1
- package/dist/experimental.d.ts +19 -19
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +17 -17
- package/dist/experimental.js.map +1 -1
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/layout/types.d.ts +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/props/host.d.ts +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/slot.d.ts +1 -1
- package/dist/props/slot.js +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/render/clip.d.ts +1 -1
- package/dist/render/clip.js +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +11 -5
- package/dist/render/descriptors/text.d.ts.map +1 -1
- package/dist/render/descriptors/text.js +7 -1
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render3d/builders.d.ts +1 -1
- package/dist/render3d/builders.js +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +13 -19
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +13 -19
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +1 -1
- package/dist/render3d/scene3d.js +1 -1
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/texture.d.ts +2 -2
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/vector3.d.ts +2 -2
- package/dist/render3d/vector3.js +2 -2
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/runtime/asset-refine.d.ts +1 -1
- package/dist/runtime/asset-refine.d.ts.map +1 -1
- package/dist/runtime/asset-refine.js +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-update.js +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.d.ts +0 -11
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +0 -25
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +3 -3
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +4 -4
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +2 -3
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +17 -35
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +3 -3
- package/dist/runtime/engine.js +2 -2
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +2 -2
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +3 -3
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +2 -2
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +1 -1
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +2 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +1 -1
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +2 -2
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +1 -1
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +4 -5
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +43 -39
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +24 -25
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +7 -9
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +2 -2
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/index.d.ts +2 -1
- package/dist/tween/index.d.ts.map +1 -1
- package/dist/tween/index.js +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/loop.d.ts +1 -1
- package/dist/tween/loop.js +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/util/reference.d.ts +6 -6
- package/dist/util/reference.js.map +1 -1
- package/package.json +2 -10
- package/dist/browser/chunks/chunk-2RIYH36X.js +0 -3
- package/dist/browser/chunks/chunk-2RIYH36X.js.map +0 -7
- package/dist/browser/chunks/chunk-DDJN3QII.js +0 -15
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +0 -7
- package/dist/browser/chunks/chunk-DHB4COFY.js +0 -2
- package/dist/browser/chunks/chunk-EJDPYDQI.js +0 -5
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +0 -7
- package/dist/browser/chunks/chunk-SFNJRPBV.js +0 -2
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +0 -7
- package/dist/browser/chunks/chunk-XAWE4EAK.js +0 -2
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +0 -7
- package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
- package/dist/browser/jsx-jsx-dev-runtime.js.map +0 -7
- package/dist/browser/jsx-jsx-runtime.js +0 -2
- package/dist/browser/jsx-jsx-runtime.js.map +0 -7
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{$b as Es,$d as Ki,Ad as Ni,Ae as Ge,B as ui,Bc as zs,Be as Wr,Ca as ys,Cb as Ht,Cc as zr,Ce as oa,Da as fi,Db as As,Dd as Ks,De as Ve,Ea as lt,Eb as gi,Ec as ki,Ed as zi,Ee as ia,Fa as Er,Fc as G,Fe as Hr,Gc as kt,Ge as aa,Hb as Ir,Hc as Ai,Hd as Bi,He as da,Ia as gs,Ib as Ms,Ic as Mi,Id as C,Ja as ne,Jc as ce,Jd as k,Je as ca,Kb as Os,Kc as Br,Kd as nt,Ke as la,La as Dr,Lb as De,Lc as Oi,Ld as Mt,Le as ua,M as cs,Mc as jr,Me as fa,N as ls,Nb as Ts,Nc as Bs,Nd as ee,Ob as m,Oc as Ti,Od as se,Pc as F,Pd as H,Qb as me,Rb as Ps,Rd as ji,Sc as At,Sd as Y,T as Yt,Ta as Ze,Td as q,Ua as _s,Ud as ye,Vc as Lr,Vd as E,Wa as pi,Wc as Gr,Xa as hi,Xd as Li,Ya as mi,Yb as Cs,Yd as Gi,Za as yi,Zd as Vi,_ as qt,_b as Qe,_d as Yr,ac as Ds,ae as Ui,bd as js,be as Us,ca as Pr,cc as Fs,da as Cr,db as Fr,dc as Is,de as Yi,ea as N,eb as ws,ec as Rs,ee as qi,f as Be,fa as us,fb as xe,fc as Zt,fe as Xi,gc as $s,ha as fs,hc as ut,he as Ys,ic as Rr,id as er,ie as qs,jb as xs,jd as Ls,je as Xs,kd as tr,ke as Zi,lc as Ns,ld as rr,le as Ji,ma as bt,mb as Je,mc as _i,me as Qi,n as ds,nb as Pe,nc as Jt,nd as Vr,ne as ea,oa as Xt,oc as St,od as Gs,pa as J,pc as $r,pd as Vs,pe as nr,qb as vs,qc as et,qd as Pi,qe as ta,ra as ps,rc as ft,re as qr,sa as hs,sb as bs,sc as Ce,sd as Le,se as ra,tb as je,tc as Nr,te as na,ub as Q,uc as Qt,ud as Ei,ue as sa,vb as Ee,vd as Di,wb as Ss,wd as Fi,we as Ws,xa as ms,xd as Ii,xe as X,yb as ks,yd as Ri,ye as v,zc as Si,zd as ve,ze as Xr}from"./chunk-EJDPYDQI.js";import{b as Wi,f as Hi,h as pa}from"./chunk-DHB4COFY.js";import{A as Kr,B as Ur,C as Ci,F as tt,G as rt,L as $i,a as li,c as is,e as as,g as vt,l as Te,n as Wt,o as wi,p as xi,t as vi,w as pt,x as bi}from"./chunk-2RIYH36X.js";var Hs=["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","normal"],bl=[...Hs,"pass-through"],Sl=Object.fromEntries(Hs.map((r,e)=>[r,e]));function kl(r){return Sl[r]}function Zs(r){let e=1;for(let t of r)t.type==="speed"&&!Fr(t.value)&&t.value>0&&(e*=t.value);return e}function Zr(r,e){let t=Zs(r);for(let n of r)if(n.type==="speed"&&Fr(n.value))return xs(n.value,e)/t;return e/t}function Jr(r,e,t,n){let s=r.at??0,o=r.until??1/0,i=r.trimStart??0,a=r.trimEnd??1/0,d=r.loop??!1,c=Pe(r.filters),l=e.getMediaDuration(r.src),u={id:`${t}|${r.src}|${s}|${n}`,src:r.src,startAt:s,endAt:1/0,trimStart:i,volume:r.volume??1,loop:d,ownerId:t};if(c.length>0&&(u.filters=c),r.bus&&(u.bus=r.bus),r.optional&&(u.optional=!0),d&&a>i&&Number.isFinite(a)&&(u.trimEnd=a),d&&Number.isFinite(o))u.endAt=o;else if(d)u.open=!0;else if(Number.isFinite(a))u.endAt=Math.min(o,s+Zr(c,Math.max(0,a-i)));else{let p=Zr(c,Math.max(0,l-i));Number.isFinite(o)?u.endAt=Math.min(o,s+p):(u.open=!0,u.mediaDuration=p)}return u}var Js=class{src;volume;loop;trimStart;trimEnd;filters;constructor(e){this.src=e.src,this.volume=e.volume??1,this.loop=e.loop??!1,this.trimStart=e.trimStart??0,this.trimEnd=e.trimEnd??e.duration??1/0,this.filters=Pe(e.filters)}effectiveSpeed(){return Zs(this.filters)}clipDurationFor(e){return Zr(this.filters,e)}sceneDurationFor(e){return this.clipDurationFor(e)}get clipDuration(){return this.trimEnd!==1/0?this.clipDurationFor(this.trimEnd-this.trimStart):void 0}};function sr(r){return!r||r.length===0?"":r.map(e=>{switch(e.type){case"gain":case"speed":return`${e.type}:${xe(e.value)}`;case"highpass":case"lowpass":return`${e.type}:${xe(e.frequency)}:${xe(e.q)}`;case"tremolo":return`tremolo:${xe(e.rate)}:${xe(e.depth)}`;case"echo":return`echo:${xe(e.delay)}:${xe(e.feedback)}:${xe(e.mix)}`}}).join("|")}function Qs(r){return`${r.id}:${xe(r.volume)}:${xe(r.pan)}:${r.mute?1:0}:${sr(r.filters)}:${r.startAt}:${r.endAt}`}var Ml=new Set(["number","slider","angle","hue","boolean","color","vector","point"]);function hy(r){return Ml.has(r.kind)}var ha=64,ma=64e3;function ya(r){if(typeof r!="object"||r===null)throw new Error("A shader pack must be an object.");let e=r,t=e.scope;if(t!=="fill"&&t!=="effect")throw new Error(`A shader pack needs scope "fill" or "effect", got ${JSON.stringify(t)}. The two are written against different contracts \u2014 a fill has no backdrop to sample and an effect has no shape box to map coordinates onto.`);let n=typeof e.source=="string"?e.source.trim():"";if(n==="")throw new Error(`Shader pack "${String(e.name??"?")}" has no source.`);if(n.length>ma)throw new Error(`Shader pack "${String(e.name??"?")}" source is ${n.length} characters, over the ${ma} ceiling.`);let s={...typeof e.$kind=="string"?{$kind:e.$kind}:{},...typeof e.id=="string"?{id:e.id}:{},name:typeof e.name=="string"&&e.name!==""?e.name:"Shader",...typeof e.description=="string"?{description:e.description}:{},source:n,...en(e.uniforms)?{uniforms:e.uniforms}:{},properties:Ol(e.properties,String(e.name??"?"))};if(t==="fill"){let o=e.coords;return{...s,scope:"fill",...o==="normalized"||o==="centered"||o==="local"?{coords:o}:{}}}return{...s,scope:"effect",...e.backdrop===!0?{backdrop:!0}:{}}}function Ol(r,e){if(!en(r))return{};let t={},n=new Map;for(let[s,o]of Object.entries(r)){if(Object.keys(t).length>=ha){or(`shader "${e}" declares more than ${ha} properties; the rest are ignored.`);break}if(!en(o)||typeof o.kind!="string"){or(`shader "${e}" property "${s}" has no kind; ignored.`);continue}let i=o.inputs;if(!en(i)||Object.keys(i).length===0){or(`shader "${e}" property "${s}" names no uniform in "inputs"; ignored.`);continue}let a=!1;for(let d of Object.values(i)){if(typeof d!="string"){or(`shader "${e}" property "${s}" has a non-string uniform name; ignored.`),a=!0;break}let c=n.get(d);if(c!==void 0){or(`shader "${e}" properties "${c}" and "${s}" both write uniform "${d}"; "${s}" ignored.`),a=!0;break}n.set(d,s)}a||(t[s]=o)}return t}function en(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}var Qr=new Set;function or(r){Qr.has(r)||(Qr.size>256&&Qr.clear(),Qr.add(r),console.warn(`[shader] ${r}`))}var Fe=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},oe=class extends F{shapeGraphics(){return null}renderSelf(e){let t=this.shapeGraphics();t&&e.draw(t.shadow(this.shadow).fill(this.fill))}renderStroke(e){let t=this.stroke;if(t.length===0)return;let n=this.shapeGraphics();n&&e.draw(this.castsShadowFromStroke()?n.shadow(this.shadow).stroke(t):n.stroke(t))}castsShadowFromStroke(){return this.shadow.length===0?!1:!this.fill.some(n=>(n.opacity??1)>0)}declareAssets(e){super.declareAssets(e),e.fill(this.fill);for(let t of this.stroke)e.fill(t.fill);for(let t of this.shadow)e.fill(t.fill)}hitTestSelf(e,t){let n=this.clipSelf();return!n||n.isEmpty()?super.hitTestSelf(e,t):js(n,e,t)}fillTo(e){let t=this.fill,n=ne.resolve(e.data),s=e.lerp??ne.lerp;return this.command(o=>({fill:s(t,n,o)}),e.duration,e.easing)}strokeTo(e){let t=this.stroke,n=Ze.resolve(e.data,t),s=e.lerp??Ze.lerp;return this.command(o=>({stroke:s(t,n,o)}),e.duration,e.easing)}shadowTo(e){let t=this.shadow,n=Dr.resolve(e.data,t),s=e.lerp??Dr.lerp;return this.command(o=>({shadow:s(t,n,o)}),e.duration,e.easing)}progressTo(e){let{start:t,end:n}=e.data??{},s={...t===void 0?{}:{start:t},...n===void 0?{}:{end:n}};return this.to({data:s,duration:e.duration,easing:e.easing})}flash(e){let t={start:this.start,end:this.end},n=Math.min(1,Math.max(.01,e.data?.portion??.25));return this.command(s=>{if(s<=0||s>=1)return t;let o=s*(1+n);return{start:Math.max(0,o-n),end:Math.min(1,o)}},e.duration,e.easing)}};Fe([Qe()],oe.prototype,"fill",void 0);Fe([Es()],oe.prototype,"stroke",void 0);Fe([Ds()],oe.prototype,"shadow",void 0);Fe([m({default:0})],oe.prototype,"start",void 0);Fe([m({default:1})],oe.prototype,"end",void 0);Fe([G()],oe.prototype,"fillTo",null);Fe([G()],oe.prototype,"strokeTo",null);Fe([G()],oe.prototype,"shadowTo",null);Fe([G({args:[{key:"start",kind:"number",min:0,max:1,step:.01,scale:100,unit:"%"},{key:"end",kind:"number",min:0,max:1,step:.01,scale:100,unit:"%"}]})],oe.prototype,"progressTo",null);Fe([G({args:[{key:"portion",kind:"number",min:.01,max:1,step:.01,scale:100,unit:"%",default:.25}]})],oe.prototype,"flash",null);function Ke(r,e){return r===""?String(e):`${r}.${e}`}function eo(r,e){r.declareAssets(e)}function to(r,e){if(!r.mounted)return;eo(r,e);let t=r._allChildren;for(let n=0;n<t.length;n++)to(t[n],e)}function ga(r,e){r.attachDetached(e)}function tn(r){r._sample();for(let e of r.children)tn(e)}function rn(r,e){r._primeMotion(e);for(let t of r.children)rn(t,e)}function ro(r,e){let t=n=>{let s=n.key!==void 0?e?.[n.key]:void 0;n._setEditorState(s?.hidden===!0,s?.locked===!0);for(let o of n._allChildren)t(o)};t(r)}var j=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},D=class extends F{constructor(e){super(e)}zoomTo(e){return this.to({data:e.data,duration:e.duration,easing:e.easing})}panTo(e){return this.to({data:e.data,duration:e.duration,easing:e.easing})}orbitTo(e){return this.to({data:e.data,duration:e.duration,easing:e.easing})}dollyTo(e){return this.to({data:e.data,duration:e.duration,easing:e.easing})}headingTo(e){return this.to({data:e.data,duration:e.duration,easing:e.easing})}fillTo(e){let t=this.fill,n=ne.resolve(e.data),s=e.lerp??ne.lerp;return this.command(o=>({fill:s(t,n,o)}),e.duration,e.easing)}overlayTo(e){let t=this.overlay,n=ne.resolve(e.data),s=e.lerp??ne.lerp;return this.command(o=>({overlay:s(t,n,o)}),e.duration,e.easing)}flowArrangement(){return this}shapeGraphics(){return new N().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}renderSelf(e){let t=this.fill;t.length!==0&&e.draw(this.shapeGraphics().fill(t))}renderOverlay(e){let t=this.overlay;t.length!==0&&e.draw(this.shapeGraphics().fill(t))}acceptsChild(e){return e.dimension==="2d"||e.dimension==="audio"}get _childTrees(){return["2d","audio"]}get childrenAudio(){return this._allChildren.filter(e=>e instanceof er)}declareAssets(e){super.declareAssets(e),e.fill(this.fill),e.fill(this.overlay)}clipSelf(){return new ce().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}_cameraScope(){return this.space3D||this.zoom===1&&this.heading===0&&this.lookAt.x===0&&this.lookAt.y===0?null:{lookAt:this.lookAt,zoom:this.zoom,heading:this.heading}}_spaceCamera(){if(!this.space3D)return null;let e=this.layoutBounds;return{perspective:this.perspective,orbit:this.orbit,elevation:this.elevation,dolly:this.dolly,lookAt:this.lookAt,zoom:this.zoom,heading:this.heading,viewportX:e?.x??0,viewportY:-(e?.y??0)}}_projection(){return this.space3D?ks:super._projection()}renderChildren(e){let t=this._spaceCamera();if(t){this._renderInSpace(e,Br(this,t));return}if(this.zoom===1&&this.heading===0&&this.lookAt.x===0&&this.lookAt.y===0){super.renderChildren(e);return}let n=this.layoutBounds,s=n?.width??0,o=n?.height??0,i=n?.x??0,a=n?.y??0;e.beginCamera({x:i,y:-a,width:s,height:o},this.lookAt,this.zoom,this.heading);for(let d of this._children)d instanceof F&&d.render(e);e.endCamera()}};j([Qe()],D.prototype,"fill",void 0);j([Qe()],D.prototype,"overlay",void 0);j([Rr()],D.prototype,"flow",void 0);j([m({default:0})],D.prototype,"gap",void 0);j([m({default:!1})],D.prototype,"wrap",void 0);j([m({default:void 0})],D.prototype,"crossGap",void 0);j([m({default:1})],D.prototype,"columns",void 0);j([ut()],D.prototype,"align",void 0);j([m({default:1})],D.prototype,"zoom",void 0);j([m({default:{x:0,y:0},tween:Ht})],D.prototype,"lookAt",void 0);j([m({default:0})],D.prototype,"heading",void 0);j([m({default:!1})],D.prototype,"space3D",void 0);j([m({default:0})],D.prototype,"orbit",void 0);j([m({default:0})],D.prototype,"elevation",void 0);j([m({default:0})],D.prototype,"dolly",void 0);j([G({args:[{key:"zoom",kind:"number",min:.01,step:.1,unit:"\xD7"}]})],D.prototype,"zoomTo",null);j([G({args:[{key:"lookAt",kind:"vector2",properties:{x:{kind:"number"},y:{kind:"number"},z:{kind:"number"}}}]})],D.prototype,"panTo",null);j([G({args:[{key:"orbit",kind:"number",step:1,unit:"\xB0"},{key:"elevation",kind:"number",step:1,unit:"\xB0"}]})],D.prototype,"orbitTo",null);j([G({args:[{key:"dolly",kind:"number",step:10}]})],D.prototype,"dollyTo",null);j([G({args:[{key:"heading",kind:"number",step:1,unit:"\xB0"}]})],D.prototype,"headingTo",null);j([G()],D.prototype,"fillTo",null);j([G()],D.prototype,"overlayTo",null);var Ie=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},be=class extends F{constructor(e){super(e)}provideContext(e){let t=e.get(Vr),n=De.mergeStyle(t,this._props);return n===t?e:e.with(Vr,n)}renderContent(e){e.pushTextStyle(this.currentStyle());try{super.renderContent(e)}finally{e.popTextStyle()}}currentStyle(){return De.mergeStyle(Os,this)}};Ie([m({default:void 0})],be.prototype,"fontFamily",void 0);Ie([m({default:void 0})],be.prototype,"fontSize",void 0);Ie([m({default:void 0})],be.prototype,"fontWeight",void 0);Ie([m({default:void 0})],be.prototype,"fontStyle",void 0);Ie([m({default:void 0})],be.prototype,"letterSpacing",void 0);Ie([m({default:void 0})],be.prototype,"lineHeight",void 0);Ie([m({default:void 0})],be.prototype,"textAlign",void 0);Ie([m({default:void 0})],be.prototype,"fill",void 0);Ie([m({default:void 0})],be.prototype,"stroke",void 0);Ie([m({default:void 0})],be.prototype,"shadow",void 0);function no(r,e,t={autofit:!0}){let n=e?.variant,s=De.mergeStyle(De.mergeStyle(De.preset("default"),r.useContext(Vr)),n?De.preset(n):void 0),o=r;for(let i of Ms){if(e?.[i]!==void 0)continue;let a=s[i];a!==void 0&&(i==="fontSize"&&a==="autofit"&&!t.autofit||(o[i]=a))}}var st=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},z=class extends oe{overlayTo(e){let t=this.overlay,n=ne.resolve(e.data),s=e.lerp??ne.lerp;return this.command(o=>({overlay:s(t,n,o)}),e.duration,e.easing)}renderOverlay(e){let t=this.overlay;if(t.length===0)return;let n=this.shapeGraphics();n&&e.draw(n.fill(t))}declareAssets(e){super.declareAssets(e),e.fill(this.overlay)}applyDefaultSize(e){let t=F.flowChildrenProp(e),n=t.length>0,s=e?.flow??"freeform",o=s==="horizontal"||s==="freeform"||s==="grid",i=s==="vertical"||s==="freeform",a=n&&o&&F.hasFillChild(t,"width")?"fill":n?"hug":"fill",d=n&&i&&F.hasFillChild(t,"height")?"fill":n?"hug":"fill";(!e||e.width===void 0)&&this.applyProp("width",a,{tween:Ir.lerp}),(!e||e.height===void 0)&&this.applyProp("height",d,{tween:Ir.lerp})}flowArrangement(){return this}effectivePadding(){let e=0,t=this.padding,n=this.stroke;if(!n||!(Symbol.iterator in Object(n)))return t;for(let s of n){let o=s.weight*(1-s.align)/2;o>e&&(e=o)}return e===0?t:{left:t.left+e,right:t.right+e,top:t.top+e,bottom:t.bottom+e}}};st([Qe()],z.prototype,"overlay",void 0);st([Rr()],z.prototype,"flow",void 0);st([m({default:0})],z.prototype,"gap",void 0);st([m({default:!1})],z.prototype,"wrap",void 0);st([m({default:void 0})],z.prototype,"crossGap",void 0);st([m({default:1})],z.prototype,"columns",void 0);st([ut()],z.prototype,"align",void 0);st([G()],z.prototype,"overlayTo",null);var _a=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ue=class extends z{constructor(e){super(e)}shapeGraphics(){return new N().rect({width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end})}clipSelf(){return new ce().rect({width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle})}};_a([Is()],Ue.prototype,"cornerRadius",void 0);_a([Rs()],Ue.prototype,"cornerStyle",void 0);var so=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ot=class extends z{constructor(e){super(e)}shapeGraphics(){return new N().ellipse({width:this.layoutBounds.width,height:this.layoutBounds.height,startAngle:this.startAngle,sweep:this.sweep,ratio:this.ratio,start:this.start,end:this.end})}clipSelf(){return new ce().ellipse({width:this.layoutBounds.width,height:this.layoutBounds.height,startAngle:this.startAngle,sweep:this.sweep,ratio:this.ratio})}};so([m({default:0})],Ot.prototype,"startAngle",void 0);so([m({default:360})],Ot.prototype,"sweep",void 0);so([m({default:0})],Ot.prototype,"ratio",void 0);var Tl=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},nn=class extends z{constructor(e){super(e)}applyDefaultSize(e){this.applyProp("width",e?.width??"hug"),this.applyProp("height",e?.height??"hug")}measure(e,t){let n=this.width,s=this.height;if(n!=="hug"&&s!=="hug")return super.measure(e,t);let o=Te.size(this.data),i=this.padding,a=typeof n=="number"?n:n==="hug"?o.width+i.left+i.right:e.maxWidth??0,d=typeof s=="number"?s:s==="hug"?o.height+i.top+i.bottom:e.maxHeight??0;return{width:a,height:d}}shapeGraphics(){let e=Te.bounds(this.data);return new N().path({data:this.data,centerBounds:e?[e.minX,e.minY,e.maxX,e.maxY]:void 0,start:this.start,end:this.end})}};Tl([Zt()],nn.prototype,"data",void 0);var oo=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Tt=class extends z{constructor(e){super(e)}shapeGraphics(){return new N().polygon({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end})}clipSelf(){return new ce().polygon({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle})}};oo([m({default:5})],Tt.prototype,"sides",void 0);oo([m({default:0})],Tt.prototype,"cornerRadius",void 0);oo([m({default:"rounded",tween:Be})],Tt.prototype,"cornerStyle",void 0);var sn=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ht=class extends z{constructor(e){super(e)}shapeGraphics(){return new N().polygram({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,ratio:this.ratio,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end})}clipSelf(){return new ce().polygram({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,ratio:this.ratio,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle})}};sn([m({default:5})],ht.prototype,"sides",void 0);sn([m({default:.5})],ht.prototype,"ratio",void 0);sn([m({default:0})],ht.prototype,"cornerRadius",void 0);sn([m({default:"rounded",tween:Be})],ht.prototype,"cornerStyle",void 0);var an=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Pt=class extends z{outlineOptions(){return{width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle}}outline(){return Te.anchorCommands(Ci(this.kind(),this.outlineOptions()),e=>({x:e.x,y:-e.y}))}centerBounds(){let e=this.layoutBounds.width/2,t=this.layoutBounds.height/2;return[-e,-t,e,t]}shapeGraphics(){return new N().path({data:this.outline(),centerBounds:this.centerBounds(),start:this.start,end:this.end})}clipSelf(){return new ce().rect({x:0,y:0,width:this.layoutBounds.width,height:this.layoutBounds.height})}};an([m({default:0})],Pt.prototype,"cornerRadius",void 0);an([m({default:"rounded",tween:Be})],Pt.prototype,"cornerStyle",void 0);var on=class extends Pt{constructor(e){super(e)}kind(){return"star"}outlineOptions(){return{...super.outlineOptions(),sides:Math.max(3,Math.round(this.points)),ratio:this.ratio}}};an([m({default:Ur})],on.prototype,"points",void 0);an([m({default:Kr})],on.prototype,"ratio",void 0);var Pl=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},dn=class extends z{constructor(e){super(e)}toLocal(){let e=this.layoutBounds.width,t=this.layoutBounds.height;return n=>({x:n.x*e,y:-n.y*t})}outline(){return Te.anchorCommands(Te.anchors(this.data),this.toLocal())}centerBounds(){let e=this.layoutBounds.width/2,t=this.layoutBounds.height/2;return[-e,-t,e,t]}shapeGraphics(){return new N().path({data:this.outline(),centerBounds:this.centerBounds(),start:this.start,end:this.end})}clipSelf(){return new ce().rect({x:0,y:0,width:this.layoutBounds.width,height:this.layoutBounds.height})}};Pl([Zt()],dn.prototype,"data",void 0);var Se=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ie=class extends oe{get wrapsText(){return!1}get glyphPath(){return null}styledRuns(){return[]}styleRuns(){return[]}resolveContext(e){no(this,this._props)}applyDefaultSize(e){let t=e?.fontSize==="autofit";this.applyProp("height",e?.height??(t?"fill":"hug")),this.applyProp("width",e?.width??(t?"fill":"hug"))}measure(e,t){return Ei(this,this._source(),e,t)}buildSegments(){return Di(this,this._source())}declareAssets(e){super.declareAssets(e),Ii(this,this._source(),e)}_textState(){return Fi(this,this._source(),this.layoutBounds)}textOpGraphics(){let e=this._textState();return{g:new N().text(e),segments:e.segments!=null}}renderSelf(e){let{g:t,segments:n}=this.textOpGraphics();t.shadow(this.shadow),n||t.fill(this.fill),e.draw(t)}renderStroke(e){let t=this.stroke;if(t.length===0)return;let{g:n,segments:s}=this.textOpGraphics();s||e.draw(n.stroke(t))}_source(){return{text:this.displayText(),wraps:this.wrapsText,glyphPath:this.glyphPath,selections:this.styledRuns(),runs:this.styleRuns()}}};Se([m()],ie.prototype,"fontFamily",void 0);Se([m({default:48,tween:De.lerpFontSize})],ie.prototype,"fontSize",void 0);Se([m({default:400})],ie.prototype,"fontWeight",void 0);Se([m({default:"normal"})],ie.prototype,"fontStyle",void 0);Se([m({default:0})],ie.prototype,"letterSpacing",void 0);Se([m({default:1.2})],ie.prototype,"lineHeight",void 0);Se([m({default:"center"})],ie.prototype,"textAlign",void 0);Se([m({default:"center",kind:"enum",options:["top","center","bottom"]})],ie.prototype,"verticalAlign",void 0);Se([m({default:"none",kind:"enum",options:["none","underline","line-through"]})],ie.prototype,"textDecoration",void 0);Se([m({default:"none",kind:"enum",options:["none","upper","lower","title"]})],ie.prototype,"textCase",void 0);Se([m({default:12})],ie.prototype,"minFontSize",void 0);Se([m({default:void 0})],ie.prototype,"variant",void 0);var W=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},L=class extends Ue{_video=null;_videoKey="";constructor(e){super(e)}playedAt(e){let t=this.segments;if(!t||t.length===0)return null;let n=0;for(let s of t){if(e<=s.at)break;let o=s.speed??this.speed??1;n+=Math.min(e-s.at,s.duration)*o}return n}scheduledTimestamp(){let e=this.playedAt(this.time.elapsed);if(e===null)return;let t=this.trimStart??0,n=this.segments[0],s=n?n.from-t:0;return Pr(e+s,t,this.trimEnd??1/0,this.loop,this.duration)}videoKey(){let e=this.crop,t=this.anchor;return[this.src??"",this.fit??"",this.zoom,this.playing?1:0,e.left,e.right,e.top,e.bottom,t.x,t.y,this.timestamp??"",this.trimStart??"",this.trimEnd??"",this.speed??"",this.loop??"",this.duration??"",this.scheduledTimestamp()??""].join("|")}syncVideo(){if(!this.src){this._video=null,this._videoKey="";return}let e=this.videoKey();if(e===this._videoKey&&this._video)return;this._videoKey=e;let t={type:"video",src:this.src,fit:this.fit,crop:this.crop,zoom:this.zoom,anchor:this.anchor,matrix:this.matrix,filters:this.filters,playing:this.playing,timestamp:this.timestamp??this.scheduledTimestamp(),trimStart:this.trimStart,trimEnd:this.trimEnd,speed:this.speed,loop:this.loop,duration:this.duration};this._video=lt(t)}declareAssets(e){super.declareAssets(e),this.src&&e.fill(lt({type:"video",src:this.src,filters:this.filters,trimStart:this.trimStart,trimEnd:this.trimEnd}))}declareAudio(e){let t=this.src;if(!t||this.muted)return;let n=this._busPath(e);if(this.segments.length>0){let o=this.trimEnd??e.catalog.getMediaDuration(t);for(let i of this.segments){let a=i.speed??this.speed??1,d=i.from,c=Math.min(o,d+i.duration*a);c>d&&e.clip({src:t,at:e.span.start+i.at,volume:i.volume??this.volume,trimStart:d,trimEnd:c,filters:this._soundFilters(a),bus:n,optional:!0})}return}if(!this.playing)return;let s=(this.loop??"none")!=="none";e.clip({src:t,volume:this.volume,loop:s,trimStart:this.trimStart,trimEnd:this.trimEnd??(s?void 0:e.catalog.getMediaDuration(t)),filters:this._soundFilters(this.speed??1),bus:n,optional:!0})}_soundFilters(e){let t=[];return e!==1&&t.push(...Pe(Je.speed(e))),t.push(...this.audioFilters),t}_busPath(e){if(!this.bus)return;let t=rr(this,this.bus);return t?tr(t,e):void 0}rectState(){return{width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end}}shapeGraphics(){return new N().rect(this.rectState())}renderOverlay(e){let t=this.overlay;if(t.length===0)return;let n=(this.syncVideo(),this._video);n&&e.draw(new N().mask().rect(this.rectState()).fill([n]).applyMask().rect(this.rectState()).fill(t).endMask())}renderSelf(e){this.syncVideo();let t=[this._video??Er];t.push(...this.fill),e.draw(this.shapeGraphics().shadow(this.shadow).fill(t))}dispose(){this._video=null,this._videoKey="",super.dispose()}};W([m()],L.prototype,"src",void 0);W([m()],L.prototype,"fit",void 0);W([$s()],L.prototype,"crop",void 0);W([m({default:1})],L.prototype,"zoom",void 0);W([ut()],L.prototype,"anchor",void 0);W([m()],L.prototype,"matrix",void 0);W([m({default:[],tween:Yt,mapper:qt})],L.prototype,"filters",void 0);W([m({default:!0})],L.prototype,"playing",void 0);W([m()],L.prototype,"timestamp",void 0);W([m()],L.prototype,"trimStart",void 0);W([m()],L.prototype,"trimEnd",void 0);W([m()],L.prototype,"speed",void 0);W([m()],L.prototype,"loop",void 0);W([m()],L.prototype,"duration",void 0);W([m({default:1})],L.prototype,"volume",void 0);W([m({default:!1})],L.prototype,"muted",void 0);W([m({default:[],mapper:Pe})],L.prototype,"audioFilters",void 0);W([m({default:void 0})],L.prototype,"bus",void 0);W([m({default:[]})],L.prototype,"segments",void 0);var K=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Cl=["opacity","roughness","metalness","emission","emissionStrength","normalMap","roughnessMap","metalnessMap","aoMap","alphaMap","envMapIntensity","wireframe","shading","faces","vertexColors","blend"],R=class extends ve{buildGeometry(){return this.geometry}materialShorthand(){let e={},t=this.material;t!==void 0&&(e.material=t),this.fill!==void 0&&(e.fill=this.fill);for(let n of Cl){let s=this[n];s!==void 0&&(e[n]=s)}return this.unlit&&(e.unlit=!0),e}buildGraphics3D(){let e=new J,t=this.buildGeometry();return t&&e.mesh(t,Xt(this.materialShorthand())),e}renderSelf(e){e.draw(this.buildGraphics3D())}};K([m({default:void 0})],R.prototype,"geometry",void 0);K([m({default:void 0})],R.prototype,"material",void 0);K([m({default:"white",tween:bt})],R.prototype,"fill",void 0);K([m({default:void 0})],R.prototype,"opacity",void 0);K([m({default:void 0})],R.prototype,"roughness",void 0);K([m({default:void 0})],R.prototype,"metalness",void 0);K([Fs({default:void 0})],R.prototype,"emission",void 0);K([m({default:void 0})],R.prototype,"emissionStrength",void 0);K([m({default:void 0})],R.prototype,"normalMap",void 0);K([m({default:void 0})],R.prototype,"roughnessMap",void 0);K([m({default:void 0})],R.prototype,"metalnessMap",void 0);K([m({default:void 0})],R.prototype,"aoMap",void 0);K([m({default:void 0})],R.prototype,"alphaMap",void 0);K([m({default:void 0})],R.prototype,"envMapIntensity",void 0);K([m({default:void 0})],R.prototype,"wireframe",void 0);K([m({default:void 0})],R.prototype,"shading",void 0);K([m({default:void 0})],R.prototype,"faces",void 0);K([m({default:void 0})],R.prototype,"vertexColors",void 0);K([m({default:void 0})],R.prototype,"blend",void 0);K([m({default:!1})],R.prototype,"unlit",void 0);var te=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},cn=class extends R{buildGraphics3D(){let e=new J,t=this.buildGeometry(),n=this.instances;return!t||!n?.length||e.instances(t,this.resolvedMaterial(),n,{colors:this.colors}),e}resolvedMaterial(){let e=Xt(this.materialShorthand());return Array.isArray(e)?e[0]:e}};te([m({default:void 0})],cn.prototype,"instances",void 0);te([m({default:void 0})],cn.prototype,"colors",void 0);var Ye=class extends ve{buildGraphics3D(){let e=new J,t=this.geometry,n=this.points;return!t&&!n?.length||e.line({points:t?void 0:n,geometry:t,closed:this.closed,segments:this.segments,stroke:this.stroke,opacity:this.opacity,material:this.material}),e}renderSelf(e){e.draw(this.buildGraphics3D())}};te([m({default:void 0})],Ye.prototype,"points",void 0);te([m({default:void 0})],Ye.prototype,"geometry",void 0);te([m({default:!1})],Ye.prototype,"closed",void 0);te([m({default:!1})],Ye.prototype,"segments",void 0);te([m({default:void 0})],Ye.prototype,"stroke",void 0);te([m({default:void 0})],Ye.prototype,"opacity",void 0);te([m({default:void 0})],Ye.prototype,"material",void 0);var ir=class extends ve{buildGraphics3D(){return new J().sprite({fill:this.fill,opacity:this.opacity,material:this.material})}renderSelf(e){e.draw(this.buildGraphics3D())}};te([m({default:void 0,tween:bt})],ir.prototype,"fill",void 0);te([m({default:void 0})],ir.prototype,"opacity",void 0);te([m({default:void 0})],ir.prototype,"material",void 0);var Ct=class extends ve{buildGraphics3D(){let e=new J;return this.src&&e.model({src:this.src,animation:this.animation,override:this.override}),e}renderSelf(e){e.draw(this.buildGraphics3D())}};te([m({default:void 0})],Ct.prototype,"src",void 0);te([m({default:void 0})],Ct.prototype,"animation",void 0);te([m({default:void 0})],Ct.prototype,"override",void 0);var ar=class extends Ct{constructor(e){super(e)}buildGraphics3D(){let e=new J;return this.src?(e.model({src:this.src,animation:{clip:Fl(this.clip),time:this.clipTime},override:this.override}),e):Dl(e)}};te([m({default:""})],ar.prototype,"clip",void 0);te([m({default:0})],ar.prototype,"clipTime",void 0);function Dl(r){return r.box({width:1,height:1,depth:1,material:{type:"basic",color:"#6b7280",wireframe:!0,transparent:!0,opacity:.7}})}function Fl(r){let e=r.trim();if(e==="")return;let t=Number(e);return Number.isInteger(t)&&t>=0?t:e}var I=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Il=async()=>{await ms()},P=class r extends Ue{gridCache=null;fadeColor(){let e=this.fill;if(Array.isArray(e))for(let t of e){let n=t;if(n?.type!=="solid")continue;let s=n.color;if(typeof s=="string"||Array.isArray(s)&&(s[3]??1)>0)return s}return this.gridFadeColor}gridDescriptor(){let e={size:this.gridSize,divisions:Math.max(1,Math.round(this.gridDivisions)),majorEvery:Math.max(1,Math.round(this.gridMajorEvery)),minorColor:this.gridColor,majorColor:this.gridMajorColor,axisXColor:this.axisXColor,axisZColor:this.axisZColor,showAxes:this.showAxes,fadeTo:this.fadeColor(),fade:this.gridFade},t=JSON.stringify(e);return this.gridCache?.key!==t&&(this.gridCache={key:t,geometry:Ni(e)}),this.gridCache.geometry}constructor(e){super(e??{})}orbitTo(e){let t={};for(let[n,s]of Object.entries(e.data??{}))s!==void 0&&(t[n]=s);return this.to({data:t,duration:e.duration,easing:e.easing})}acceptsChild(e){return!0}get _childTrees(){return["2d","3d"]}_spaceOf(e){return null}get children3D(){return this._allChildren.filter(e=>e instanceof ve)}applyDefaultSize(e){(!e||e.width===void 0)&&this.applyProp("width","fill"),(!e||e.height===void 0)&&this.applyProp("height","fill")}buildScene3D(){let e=new hs,t=ps(this.shadows);t&&e.shadows(t),(this.tone!==void 0||this.exposure!==void 0)&&e.tone({mapping:this.tone,exposure:this.exposure}),this.post!==void 0&&e.post(this.post);for(let s of this._children)s instanceof ve&&s.render(e);let n=e.fogDescriptor();if(n&&n.color===void 0){let s=Rl(this.fill);s!==void 0&&e.fog({...n,color:s})}return this.showGrid&&e.draw(new J().line({geometry:this.gridDescriptor(),segments:!0,material:{type:"lineBasic",vertexColors:!0,toneMapped:!1}})),this.buildScene3D===r.prototype.buildScene3D&&e.isEmpty()&&!this._children.some(s=>s instanceof ve)||(e.cameraDescriptor()===null&&e.perspective({fov:this.fov,orbit:$i(this.orbit),elevation:this.elevation,distance:this.zoom}),e.ops().some(s=>s.kind==="light")||e.light({type:"ambient",intensity:this.ambientIntensity,color:this.ambientColor}).light({type:"directional",intensity:this.keyIntensity,color:this.keyColor},{position:[4,6,3]}).light({type:"directional",intensity:this.keyIntensity*.35,color:this.keyColor},{position:[-5,-2,-4]})),e}_isViewport3D(){return!0}_scene3D(){return this.buildScene3D()}declareAssets(e){if(super.declareAssets(e),e.loader("three:runtime",Il),this.buildScene3D===r.prototype.buildScene3D)return;let t=this.buildScene3D();t.isEmpty()||fi(t,e)}bindSurfaceSources(e){ys(e,t=>{if(!fs(t))return;let n=us(t.source);n.kind==="node"&&this.attachDetached(n.node)})}renderSelf(e){let t=this.buildScene3D(),n=t.isEmpty()?null:t;n&&(n.assertBalanced(),this.bindSurfaceSources(n));let s=n?[...ls(this.fill),...cs.canvas3D(n,{maxPixelRatio:this.maxPixelRatio,antialias:this.antialias})]:this.fill;e.draw(this.shapeGraphics().shadow(this.shadow).fill(s))}};I([m({default:35})],P.prototype,"orbit",void 0);I([m({default:20})],P.prototype,"elevation",void 0);I([m({default:12})],P.prototype,"zoom",void 0);I([m({default:45})],P.prototype,"fov",void 0);I([m({default:.45})],P.prototype,"ambientIntensity",void 0);I([m({default:"#ffffff",mapper:tt,tween:rt})],P.prototype,"ambientColor",void 0);I([m({default:2.4})],P.prototype,"keyIntensity",void 0);I([m({default:"#ffffff",mapper:tt,tween:rt})],P.prototype,"keyColor",void 0);I([m({default:!1})],P.prototype,"showGrid",void 0);I([m({default:40})],P.prototype,"gridSize",void 0);I([m({default:40})],P.prototype,"gridDivisions",void 0);I([m({default:5})],P.prototype,"gridMajorEvery",void 0);I([m({default:"#26292f",mapper:tt,tween:rt})],P.prototype,"gridColor",void 0);I([m({default:"#363a42",mapper:tt,tween:rt})],P.prototype,"gridMajorColor",void 0);I([m({default:!1})],P.prototype,"showAxes",void 0);I([m({default:"#c8404f",mapper:tt,tween:rt})],P.prototype,"axisXColor",void 0);I([m({default:"#2f6fd0",mapper:tt,tween:rt})],P.prototype,"axisZColor",void 0);I([m({default:.55})],P.prototype,"gridFade",void 0);I([m({default:"#0b0d12",mapper:tt,tween:rt})],P.prototype,"gridFadeColor",void 0);I([m({default:2})],P.prototype,"maxPixelRatio",void 0);I([m({default:!0})],P.prototype,"antialias",void 0);I([m({default:!1})],P.prototype,"shadows",void 0);I([m({default:void 0})],P.prototype,"tone",void 0);I([m({default:void 0})],P.prototype,"exposure",void 0);I([m({default:void 0})],P.prototype,"post",void 0);I([G({args:[{key:"orbit",kind:"number",step:1,unit:"\xB0"},{key:"elevation",kind:"number",min:-89,max:89,step:1,unit:"\xB0"},{key:"zoom",kind:"number",min:.01,step:.1}]})],P.prototype,"orbitTo",null);function Rl(r){if(r){for(let e of r)if(e&&e.type==="solid")return e.color}}var un={cornerRadius:k.number(0),cornerStyle:k.custom("rounded",{lerp:Be})},wa=C({key:"rect",state:{...Y,...ee,...nt},commands:{...q},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Mt(r.size,e))}),xa=C({key:"ellipse",state:{...Y,...ee,startAngle:k.number(0),sweep:k.number(360),ratio:k.number(0)},commands:{...q},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Li(r.size,e))}),va=C({key:"polygon",state:{...Y,...ee,sides:k.number(5),...un},commands:{...q},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Gi(r.size,e))}),ba=C({key:"polygram",state:{...Y,...ee,sides:k.number(5),ratio:k.number(.5),...un},commands:{...q},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Vi(r.size,e))}),Sa=C({key:"path",state:{...Y,...ee,data:k.path},commands:{...q},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Ki(r.size,e.data),{clipShape:Yr(r.size)})}),Gw=C({key:"facePath",state:{...Y,...ee,data:k.path},defaults:{width:"hug",height:"hug"},commands:{...q},measure:(r,e)=>{let t=Te.size(e.data),n=e.padding;return{width:t.width+n.left+n.right,height:t.height+n.top+n.bottom}},layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Ui(e.data),{clipShape:null})});function cr(r,e){return C({key:r,state:{...Y,...ee,...un},commands:{...q},measure:(t,n,s)=>se(t,n,s,E(n)),layout:(t,n,s)=>H(t,n,s,E(n)),render:(t,n)=>ye(t,n,Us(e,t.size,n),{clipShape:Yr(t.size)})})}var Vw=cr("triangle","triangle"),Kw=cr("rightTriangle","rightTriangle"),Uw=cr("pentagon","pentagon"),Yw=cr("hexagon","hexagon"),qw=cr("octagon","octagon"),Xw=C({key:"star",state:{...Y,...ee,...un,points:k.number(Ur),ratio:k.number(Kr)},commands:{...q},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Us("star",r.size,{cornerRadius:e.cornerRadius,cornerStyle:e.cornerStyle,sides:Math.max(3,Math.round(e.points)),ratio:e.ratio}),{clipShape:Yr(r.size)})});var ka=C({key:"boolean",state:{...Y,...ee,op:k.oneOf(["union","subtract","intersect","exclude"])},commands:{...q},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>r.merge(e.op,e)}),Aa=C({key:"mask",state:{mode:k.oneOf(["alpha","vector","luminance"]),inverted:!1},render:(r,e)=>r.mask(e)});var Ta=C({key:"camera",state:{...Y,...ee,...Yi,...nt},commands:{...q,...qi},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>ye(r,e,Mt(r.size,e),{children:()=>Xi(r,e)})}),Ma={lookAt:k.custom({x:0,y:0},{lerp:Ht,kind:"vector2",properties:{x:{kind:"number"},y:{kind:"number"},z:{kind:"number"}}}),zoom:k.number(1,{min:.01,step:.1,unit:"\xD7"}),heading:k.number(0,{step:1,unit:"\xB0"}),orbit:k.number(0,{step:1,unit:"\xB0"}),elevation:k.number(0,{step:1,unit:"\xB0"}),dolly:k.number(0,{step:10}),orbitSpeed:k.number(0)},Pa=C({key:"orbitCamera",state:Ma,defaults:{width:"hug",height:"hug",perspective:1e3},commands:ji(Ma,{orbitTo:{args:["orbit","elevation"]},dollyTo:{args:["dolly"]},zoomTo:{args:["zoom"]},panTo:{args:["lookAt"]},headingTo:{args:["heading"]}}),render:(r,e)=>r.space({perspective:e.perspective,orbit:e.orbit+e.orbitSpeed*r.time.total,elevation:e.elevation,dolly:e.dolly,lookAt:e.lookAt,zoom:e.zoom,heading:e.heading,viewportX:0,viewportY:0})}),Ca=C({key:"rotated-box",state:{angle:k.number(-90)},defaults:{rotation:r=>r.angle},measure:(r,e,t)=>{let{cos:n,sin:s}=Oa(e.angle),{width:o,height:i}=r.max,a=Math.abs(e.angle%180)===90,d=o!==void 0&&i!==void 0?{width:o*n+i*s,height:o*s+i*n}:{width:a?i:o,height:a?o:i},c=0,l=0;for(let u of t){let p=u.measure(d);c=Math.max(c,p.width),l=Math.max(l,p.height)}return{width:c*n+l*s,height:c*s+l*n}},layout:(r,e,t)=>{let{cos:n,sin:s}=Oa(e.angle),o={x:0,y:0,width:r.width*n+r.height*s,height:r.width*s+r.height*n};return H(o,e,t)}});function Oa(r){let e=r*(Math.PI/180);return{cos:Math.abs(Math.cos(e)),sin:Math.abs(Math.sin(e))}}var{overlay:hx,...fo}=Y,{overlayTo:mx,...po}=q,lo=r=>r.fontSize==="autofit"?"fill":"hug",uo=[];function $l(r){return r==null?null:r instanceof Cr?r.toCommands():r}function Nl(r){return Array.isArray(r)?r.map(({fill:e,stroke:t,...n})=>({...n,...e===void 0?{}:{fill:ne.resolve(e)},...t===void 0?{}:{stroke:Ze.resolve(t)}})):[]}var zl={...fo,...qr,text:k.text("",{typing:!0}),wrap:!1,path:k.custom(null,{resolve:$l}),runs:k.custom([],{resolve:Nl,animatable:!1})},ao=r=>({text:r.text,wraps:r.wrap,glyphPath:r.path,selections:uo,runs:r.runs}),fn=C({key:"text",state:zl,defaults:{width:r=>r.fontSize==="autofit"||r.wrap?"fill":"hug",height:lo},commands:{...po,append:{args:{text:k.text("",{multiline:!0})},run:(r,e)=>r.tween({text:e.text+r.args.text})},prepend:{args:{text:k.text("",{multiline:!0})},run:(r,e)=>r.tween({text:r.args.text+e.text})}},load:(r,e)=>Xs(r,e,ao(e)),measure:(r,e)=>Ys(r,e,ao(e)),render:(r,e)=>qs(r,e,ao(e))}),Bl={...fo,...qr,value:0,format:k.custom("number"),customPattern:"",fractionDigits:0,grouped:!0,currencySymbol:"$"},co=r=>({text:Wi(r.value,Hi(r)),wraps:!1,glyphPath:null,selections:uo,runs:uo}),Ea=C({key:"number",state:Bl,defaults:{width:lo,height:lo},commands:{...po,countTo:{args:["value"]}},load:(r,e)=>Xs(r,e,co(e)),measure:(r,e)=>Ys(r,e,co(e)),render:(r,e)=>qs(r,e,co(e))}),{verticalAlign:yx,textDecoration:gx,textCase:_x,minFontSize:wx,...jl}=qr,Da=C({key:"richtext",state:{...fo,...jl,fontSize:k.number(48,{inherit:ta("fontSize",{autofit:!1})}),spans:k.custom([],{resolve:r=>r==null?[]:Array.isArray(r)?r:[r]})},defaults:{width:"hug",height:"hug"},commands:{...po},load:(r,e)=>ea(r,e),measure:(r,e)=>Ji(r,e),render:(r,e)=>Qi(r,e)}),Fa=C({key:"default-text-style",state:ra,provide:(r,e)=>na(r,e),render:(r,e)=>r.textStyle(sa(e),()=>r.children())});var Ia=C({key:"provider",state:{context:k.custom(void 0),value:k.custom(void 0)},provide:r=>r.context?[nr(r.context,r.value!==void 0?r.value:r.context.defaultValue)]:[]}),Ra=C({key:"theme-provider",state:{theme:k.custom(void 0),data:k.custom(void 0),seed:k.custom(void 0)},provide:(r,e)=>{let t=[];return r.theme&&t.push(nr(Gs,{...e(Gs),...r.theme})),r.data&&t.push(nr(Vs,{...e(Vs),...r.data})),r.seed!==void 0&&t.push(nr(Pi,r.seed)),t}});function Ll(r){let e=[...r.filters];return(ws(r.volume,1)!==1||typeof r.volume!="number")&&e.push(...Je.gain(r.volume)),r.speed!==1&&e.push(...Je.speed(r.speed)),e}var $a=Ws({key:"sound",state:{src:k.custom(void 0),trimStart:0,trimEnd:k.custom(void 0),loop:!1,speed:1},allowedChildren:[],commands:{play:(r,e)=>r.sound(e.src,{trimStart:e.trimStart,trimEnd:e.trimEnd,loop:e.loop,filters:Ll(e)})}}),Na=Ws({key:"audioBus",state:{solo:!1}});var Gl={src:k.custom(void 0),fit:k.custom(void 0),crop:k.insets,zoom:1,anchor:k.alignment,matrix:k.custom(void 0),filters:k.custom([],{resolve:r=>qt(r),lerp:Yt}),playing:!0,timestamp:k.custom(void 0),trimStart:k.custom(void 0),trimEnd:k.custom(void 0),speed:k.custom(void 0),loop:k.custom(void 0),duration:k.custom(void 0),volume:1,muted:!1,audioFilters:k.custom([],{resolve:r=>Pe(r)}),bus:k.custom(void 0),segments:k.custom([])};function Vl(r,e){if(r.segments.length===0)return null;let t=0;for(let n of r.segments){if(e<=n.at)break;t+=Math.min(e-n.at,n.duration)*(n.speed??r.speed??1)}return t}function Kl(r,e){let t=Vl(r,e);if(t===null)return;let n=r.trimStart??0,s=r.segments[0];return Pr(t+(s?s.from-n:0),n,r.trimEnd??1/0,r.loop,r.duration)}var ho=new WeakMap;function Ul(r,e,t){if(!e.src)return ho.delete(r),null;let n=Kl(e,t),s=e.crop,o=e.anchor,i=[e.src,e.fit??"",e.zoom,e.playing?1:0,s.left,s.right,s.top,s.bottom,o.x,o.y,e.timestamp??"",e.trimStart??"",e.trimEnd??"",e.speed??"",e.loop??"",e.duration??"",n??""].join("|"),a=ho.get(r);if(a&&a.key===i)return a.fill;let d={type:"video",src:e.src,fit:e.fit,crop:e.crop,zoom:e.zoom,anchor:e.anchor,matrix:e.matrix,filters:e.filters,playing:e.playing,timestamp:e.timestamp??n,trimStart:e.trimStart,trimEnd:e.trimEnd,speed:e.speed,loop:e.loop,duration:e.duration},c=lt(d);return ho.set(r,{key:i,fill:c}),c}function Yl(r,e){let t=[];return e!==1&&t.push(...Pe(Je.speed(e))),t.push(...r.audioFilters),t}var za=C({key:"video",state:{...Y,...ee,...nt,...Gl},commands:{...q,play:{args:{from:k.custom(void 0),volume:k.custom(void 0),speed:k.custom(void 0)},run:(r,e)=>{let t=e,n=r.args.from!==void 0;if(!t.src||t.muted||!n&&!t.playing)return r.together([]);let s=r.args.speed??t.speed??1,o=!n&&(t.loop??"none")!=="none";return r.sound(t.src,{volume:r.args.volume??t.volume,loop:o,trimStart:n?r.args.from:t.trimStart,trimEnd:t.trimEnd,filters:Yl(t,s),bus:t.bus,optional:!0,closed:!o})}}},load:(r,e)=>{e.src&&r.fill(lt({type:"video",src:e.src,filters:e.filters,trimStart:e.trimStart,trimEnd:e.trimEnd}))},measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>{let t=e,n=Ul(Bi(r).host,t,r.time.elapsed),s={width:r.size.width,height:r.size.height,cornerRadius:t.cornerRadius,cornerStyle:t.cornerStyle,start:t.start,end:t.end};ye(r,e,Mt(r.size,e),{fill:[n??Er,...e.fill],overlay:()=>n?new N().mask().rect(s).fill([n]).applyMask().rect(s).fill(e.overlay).endMask():null})}});var mt={orbit:0,elevation:0,distance:10};function Ba(r){return r.orbit!==void 0||r.elevation!==void 0||r.distance!==void 0}function mo(r){let e=me(r.target??0);if(!Ba(r)){let i=r.lookAt??r.target;return{position:me(r.position??0),lookAt:i===void 0?void 0:me(i)}}let t=r.distance??mt.distance,n=(r.orbit??mt.orbit)*Math.PI/180,s=ql(r.elevation??mt.elevation,-89.9,89.9)*Math.PI/180,o=Math.cos(s)*t;return{position:{x:e.x+Math.sin(n)*o,y:e.y+Math.sin(s)*t,z:e.z+Math.cos(n)*o},lookAt:e}}function ql(r,e,t){return r<e?e:r>t?t:r}var ja=X({key:"group3d"}),lr={geometry:v(),...ia},La=X({key:"mesh3d",state:lr,render:(r,e)=>r.draw(Hr(e,e.geometry))}),yt={startAngle:v(),sweep:v()},gt=["startAngle","sweep"];function ge(r,e,t,n){return X({key:r,state:{...lr,...t},render:(s,o)=>s.draw(Hr(o,Ve(e,o,n)))})}var Ga=ge("box3d","box",{width:v(),height:v(),depth:v(),cornerRadius:v(),segments:v()},["width","height","depth","cornerRadius","segments"]),Va=ge("sphere3d","sphere",{radius:v(),segments:v(),...yt,startLatitude:v(),latitudeSweep:v()},["radius","segments","startLatitude","latitudeSweep",...gt]),Ka=ge("plane3d","plane",{width:v(),height:v(),segments:v()},["width","height","segments"]),Ua=ge("cylinder3d","cylinder",{radius:v(),height:v(),segments:v(),capped:v(),...yt},["radius","height","segments","capped",...gt]),Ya=ge("cone3d","cone",{radius:v(),height:v(),segments:v(),capped:v(),...yt},["radius","height","segments","capped",...gt]),qa=ge("torus3d","torus",{radius:v(),thickness:v(),segments:v(),...yt},["radius","thickness","segments",...gt]),Xa=ge("torus-knot3d","torusKnot",{radius:v(),thickness:v(),segments:v(),windings:v()},["radius","thickness","segments","windings"]),Wa=ge("circle3d","circle",{radius:v(),segments:v(),...yt},["radius","segments",...gt]),Ha=ge("ring3d","ring",{radius:v(),innerRadius:v(),segments:v(),...yt},["radius","innerRadius","segments",...gt]),Za=ge("capsule3d","capsule",{radius:v(),height:v(),segments:v()},["radius","height","segments"]),Ja=X({key:"polyhedron3d",state:{...lr,shape:k.custom("icosahedron"),radius:v(),segments:v()},render:(r,e)=>r.draw(Hr(e,Ve("polyhedron",e,["shape","radius","segments"])))}),Qa=ge("extrude3d","extrude",{path:v(),depth:v(),segments:v(),bevel:v()},["path","depth","segments","bevel"]),ed=ge("lathe3d","lathe",{points:v(),segments:v(),...yt},["points","segments",...gt]),td=ge("tube3d","tube",{points:v(),radius:v(),segments:v(),closed:v()},["points","radius","segments","closed"]),rd=X({key:"instances3d",state:{...lr,instances:v(),colors:v()},render:(r,e)=>{!e.geometry||!e.instances?.length||r.draw(new J().instances(e.geometry,aa(e),e.instances,{colors:e.colors}))}}),nd=X({key:"points3d",state:lr,render:(r,e)=>{e.geometry&&r.draw(new J().points(e.geometry,da(e)))}}),sd=X({key:"line3d",state:{points:v(),geometry:v(),closed:k.custom(!1),segments:k.custom(!1),stroke:v(),opacity:v(),material:v()},render:(r,e)=>{!e.geometry&&!e.points?.length||r.draw(new J().line({points:e.geometry?void 0:e.points,geometry:e.geometry,closed:e.closed,segments:e.segments,stroke:e.stroke,opacity:e.opacity,material:e.material}))}}),od=X({key:"sprite3d",state:{fill:k.custom(void 0,{lerp:bt}),opacity:v(),material:v()},render:(r,e)=>r.draw(new J().sprite({fill:e.fill,opacity:e.opacity,material:e.material}))}),id=X({key:"model3d",state:{src:v(),animation:v(),override:v()},render:(r,e)=>{e.src&&r.draw(new J().model({src:e.src,animation:e.animation,override:e.override}))}}),yo={shadow:!1},ad=X({key:"ambient-light3d",state:{color:Ge(),intensity:v()},render:(r,e)=>r.light(Ve("ambient",e,["color","intensity"]))}),dd=X({key:"hemisphere-light3d",state:{sky:Ge(),ground:Ge(),intensity:v()},render:(r,e)=>r.light(Ve("hemisphere",e,["sky","ground","intensity"]))}),cd=X({key:"directional-light3d",state:{color:Ge(),intensity:v(),target:Wr("origin")},defaults:yo,render:(r,e)=>r.light(Ve("directional",e,["color","intensity","target","shadow"]))}),ld=X({key:"point-light3d",state:{color:Ge(),intensity:v(),distance:v(),decay:v()},defaults:yo,render:(r,e)=>r.light(Ve("point",e,["color","intensity","distance","decay","shadow"]))}),ud=X({key:"spot-light3d",state:{color:Ge(),intensity:v(),distance:v(),angle:v(),penumbra:v(),decay:v(),target:Wr("origin")},defaults:yo,render:(r,e)=>r.light(Ve("spot",e,["color","intensity","distance","angle","penumbra","decay","target","shadow"]))}),fd=X({key:"area-light3d",state:{color:Ge(),intensity:v(),width:v(),height:v()},render:(r,e)=>r.light(Ve("area",e,["color","intensity","width","height"]))}),Xl=["target","orbit","elevation","distance","fov","frustumHeight","near","far","zoom"],Wl=["orbit","elevation","distance"],pd=X({key:"camera3d",state:{type:k.custom("perspective"),target:Wr("origin"),orbit:v(),elevation:v(),distance:v(),fov:v(),frustumHeight:v(),near:v(),far:v(),zoom:v()},commands:{orbitTo:{args:{orbit:Xr({step:1,unit:"\xB0"}),elevation:Xr({min:-89,max:89,step:1,unit:"\xB0"}),distance:Xr({min:.01,step:.1})},run:(r,e)=>{let t={orbit:e.orbit??mt.orbit,elevation:e.elevation??mt.elevation,distance:e.distance??mt.distance};return r.animate(n=>{let s={};for(let o of Wl){let i=r.args[o];i!==void 0&&(s[o]=t[o]+(i-t[o])*n)}return s})}},lookTo:{args:["target"]}},render:(r,e)=>{let t={type:e.type};for(let n of Xl)e[n]!==void 0&&(t[n]=e[n]);r.camera(t)}}),hd=X({key:"fog3d",state:{color:Ge(),near:v(),far:v(),density:v()},render:(r,e)=>{let t={};e.color!==void 0&&(t.color=e.color),e.density!==void 0?t.density=e.density:(e.near!==void 0&&(t.near=e.near),e.far!==void 0&&(t.far=e.far)),r.fog(t)}}),md=X({key:"environment3d",state:{src:v(),faces:v(),preset:v(),intensity:v(),background:v(),blur:v()},render:(r,e)=>{if(e.src===void 0&&e.faces===void 0&&e.preset===void 0)return r.environment(null);let t=oa(e,["src","faces","preset","intensity","background","blur"]);(e.rotationX||e.rotationY||e.rotationZ)&&(t.rotation=[e.rotationX,e.rotationY,e.rotationZ]),r.environment(t)}});var yd=C({key:"canvas3d",state:{...Y,...ee,...nt,...ca},defaults:{width:"fill",height:"fill"},commands:{...q,...la},allowedChildren:["2d","3d"],load:r=>ua(r),measure:(r,e,t)=>se(r,e,t,E(e)),layout:(r,e,t)=>H(r,e,t,E(e)),render:(r,e)=>fa(r,e)});function Et(r){return r.kind==="still"}function tv(r){return r.kind==="composition"}function pn(r){return r.kind==="audio"}function Hl(r){return r.kind!=="still"}var S="";function ae(r){let e=r;return{start:e.startAt??0,end:e.endAt??1/0}}function rv(r,e){return hn(new Map(r.map(t=>[t.id,t])),e)}function gd(r){let e=new Map(r.map(o=>[o.id,o])),t=new Map,n=[],s=new Set;for(let o of e.values()){if(t.has(o.id))continue;n.length=0,s.clear();let i,a=o;for(;a;){let d=t.get(a.id);if(d){i=d;break}if(s.has(a.id)){for(let c of n)t.set(c.id,hn(e,c.id));n.length=0;break}n.push(a),s.add(a.id),a=a.parentId===null?void 0:e.get(a.parentId)}for(let d=n.length-1;d>=0;d--){let c=ae(n[d]);i&&(c.start=Math.max(c.start,i.start),c.end=Math.min(c.end,i.end)),t.set(n[d].id,c),i=c}}return t}function hn(r,e){let t=r.get(e);if(!t)return;let n=ae(t),s=new Set;for(;t.parentId!==null&&!s.has(t.id);){s.add(t.id);let o=r.get(t.parentId);if(!o)break;let i=ae(o);n.start=Math.max(n.start,i.start),n.end=Math.min(n.end,i.end),t=o}return n}function nv(r){let{startAt:e,endAt:t,...n}=r;return n}function Zl(r){let e=r.duration??0;return e<=0||!r.loop||r.loop.count===null?e:e*wi(r.loop)}function Re(r){if(!Hl(r))return 0;if(r.duration!==void 0)return r.duration;let e=0;for(let t of r.commands)e=Math.max(e,t.at+Zl(t));for(let t of r.nodes)t.startAt!==void 0&&(e=Math.max(e,t.startAt)),t.endAt!==void 0&&Number.isFinite(t.endAt)&&(e=Math.max(e,t.endAt));return e}function Jl(r){return typeof r=="object"&&r!==null&&r.kind==="project"}function _d(r,e={}){return Jl(r)?r:{kind:"project",name:e.name??"Untitled",fps:e.fps,viewport:e.viewport,theme:r.theme,tracks:[{id:"clip",clip:r,duration:Re(r)}]}}var U=class extends Error{source;position;path;constructor(e,t,n=-1,s){let o=n>=0?` (at character ${n+1} of "${t}")`:` (in "${t}")`;super(`${e}${o}${s?` at ${s}`:""}`),this.name="ExpressionError",this.source=t,this.position=n,this.path=s}};var _t=Math.PI/180,go={abs:{arity:[1,1],apply:r=>Math.abs(r[0])},sign:{arity:[1,1],apply:r=>Math.sign(r[0])},sqrt:{arity:[1,1],apply:r=>Math.sqrt(r[0])},floor:{arity:[1,1],apply:r=>Math.floor(r[0])},ceil:{arity:[1,1],apply:r=>Math.ceil(r[0])},round:{arity:[1,2],apply:r=>r.length>1&&r[1]!==0?Math.round(r[0]/r[1])*r[1]:Math.round(r[0])},min:{arity:[1,1/0],apply:r=>Math.min(...r)},max:{arity:[1,1/0],apply:r=>Math.max(...r)},clamp:{arity:[3,3],apply:r=>Math.min(Math.max(r[0],r[1]),r[2])},mod:{arity:[2,2],apply:r=>(r[0]%r[1]+r[1])%r[1]},pow:{arity:[2,2],apply:r=>r[0]**r[1]},log:{arity:[1,2],apply:r=>r.length>1?Math.log(r[0])/Math.log(r[1]):Math.log(r[0])},exp:{arity:[1,1],apply:r=>Math.exp(r[0])},mix:{arity:[3,3],apply:r=>r[0]+(r[1]-r[0])*r[2]},smoothstep:{arity:[3,3],apply:r=>{if(Number.isNaN(r[0])||Number.isNaN(r[1])||Number.isNaN(r[2]))return NaN;if(r[0]===r[1])return r[2]<r[0]?0:1;let e=Math.min(Math.max((r[2]-r[0])/(r[1]-r[0]),0),1);return e*e*(3-2*e)}},step:{arity:[2,2],apply:r=>Number.isNaN(r[0])||Number.isNaN(r[1])?NaN:r[1]<r[0]?0:1},sin:{arity:[1,1],apply:r=>Math.sin(r[0]*_t)},cos:{arity:[1,1],apply:r=>Math.cos(r[0]*_t)},tan:{arity:[1,1],apply:r=>Math.tan(r[0]*_t)},asin:{arity:[1,1],apply:r=>Math.asin(r[0])/_t},acos:{arity:[1,1],apply:r=>Math.acos(r[0])/_t},atan:{arity:[1,1],apply:r=>Math.atan(r[0])/_t},atan2:{arity:[2,2],apply:r=>Math.atan2(r[0],r[1])/_t},hypot:{arity:[2,1/0],apply:r=>Math.hypot(...r)}},wd={pi:Math.PI,tau:Math.PI*2,e:Math.E},Ft={functions:go,constants:wd,refs:"bracket",unknownName:r=>`unknown name "${r}" \u2014 a variable is referenced as "[${r}]"; bare names are the constants ${ur(wd).join(", ")}`};function ur(r){return Object.keys(r).sort()}var Ql=new Set(["+","-","*","/","%","^"]);function Dt(r){return r!==void 0&&r>="0"&&r<="9"}function eu(r,e){let t=[],n=0;for(;n<r.length;){let s=r[n];if(s===" "||s===" "||s===`
|
|
2
|
-
`||s==="\r"){n++;continue}if(Dt(s)||s==="."&&Dt(r[n+1])){let o=n;for(;Dt(r[n]);)n++;if(r[n]===".")for(n++;Dt(r[n]);)n++;if(r[n]==="e"||r[n]==="E"){let i=n;if(n++,(r[n]==="+"||r[n]==="-")&&n++,Dt(r[n]))for(;Dt(r[n]);)n++;else n=i}if(r[n]===".")throw new U('unexpected character "."',r,n);t.push({kind:"number",text:"",value:Number(r.slice(o,n)),pos:o});continue}if(s==="["&&e.refs==="bracket"){let o=n,i=r.indexOf("]",n+1);if(i===-1)throw new U("unclosed `[` \u2014 a variable reference is written `[id]`",r,o);let a=r.slice(n+1,i).trim();if(a.length===0)throw new U("empty variable reference `[]`",r,o);if(a.includes("["))throw new U("variable references cannot nest",r,o);t.push({kind:"ref",text:a,value:0,pos:o}),n=i+1;continue}if(/[A-Za-z_]/.test(s)){let o=n;for(;n<r.length&&/[A-Za-z0-9_]/.test(r[n]);)n++;t.push({kind:"ident",text:r.slice(o,n),value:0,pos:o});continue}if(Ql.has(s)){t.push({kind:"op",text:s,value:0,pos:n++});continue}if(s==="("||s===")"||s===","){t.push({kind:s,text:s,value:0,pos:n++});continue}throw new U(`unexpected character "${s}"`,r,n)}return t.push({kind:"end",text:"",value:0,pos:r.length}),t}function mn(r,e=Ft){if(r.trim().length===0)throw new U("empty expression",r);let t=eu(r,e),n=[],s=0,o=()=>t[s],i=()=>t[s++],a=_=>(n.includes(_)||n.push(_),{kind:"ref",name:_}),d=_=>_.kind==="number"||_.kind==="ref"||_.kind==="ident"||_.kind==="(";function c(){let _=l();for(;;){let w=o();if(w.kind==="op"&&(w.text==="+"||w.text==="-")){i(),_={kind:"binary",op:w.text,left:_,right:l()};continue}return _}}function l(){let _=u();for(;;){let w=o();if(w.kind==="op"&&(w.text==="*"||w.text==="/"||w.text==="%")){i(),_={kind:"binary",op:w.text,left:_,right:u()};continue}if(d(w)){_={kind:"binary",op:"*",left:_,right:u()};continue}return _}}function u(){let _=o();if(_.kind==="op"&&(_.text==="-"||_.text==="+")){i();let w=u();return _.text==="-"?{kind:"unary",op:"-",operand:w}:w}return p()}function p(){let _=h(),w=o();return w.kind==="op"&&w.text==="^"?(i(),{kind:"binary",op:"^",left:_,right:u()}):_}function f(_,w){let b=Object.hasOwn(e.functions,_)?e.functions[_]:void 0;if(!b)throw new U(`unknown function "${_}" \u2014 available: ${ur(e.functions).join(", ")}`,r,w);let M=[];if(o().kind!==")")for(;M.push(c()),o().kind===",";)i();let O=i();if(O.kind!==")")throw new U(`expected \`)\` closing ${_}(`,r,O.pos);let[T,V]=b.arity;if(M.length<T||M.length>V){let re=V===1/0?`at least ${T}`:T===V?`${T}`:`${T}\u2013${V}`,B=(V===1/0||T===V)&&T===1?"":"s";throw new U(`${_}() takes ${re} argument${B}, got ${M.length}`,r,w)}return{kind:"call",name:_,args:M}}function h(){let _=i();switch(_.kind){case"number":return{kind:"const",value:_.value};case"ref":return a(_.text);case"(":{let w=c(),b=i();if(b.kind!==")")throw new U("expected `)`",r,b.pos);return w}case"ident":{if(o().kind==="(")return i(),f(_.text,_.pos);let w=Object.hasOwn(e.constants,_.text)?e.constants[_.text]:void 0;if(w!==void 0)return{kind:"const",value:w};if(e.refs==="bare")return a(_.text);throw new U(e.unknownName(_.text),r,_.pos)}default:throw new U(_.kind==="end"?"expression ends early":`unexpected "${_.text}"`,r,_.pos)}}let x=c(),y=o();if(y.kind!=="end")throw new U(`unexpected "${y.text}"`,r,y.pos);return{source:r,root:x,refs:n,passthrough:x.kind==="ref"}}function tu(r){return typeof r=="number"?r:typeof r=="boolean"?r?1:0:typeof r=="string"?r.trim()===""?NaN:Number(r):NaN}function yn(r,e,t){let n=o=>{let i=e(o);if(!i)throw new U(`"${o}" resolves to nothing in this document \u2014 a reference names a variable (declared with a "variable" command), a constant (a \`constants\` row), or another node's prop as "[key.prop]" (\`key\` on that node's row)`,r.source,-1,t);return i};if(r.passthrough)return n(r.root.name);let s=o=>{switch(o.kind){case"const":{let{value:i}=o;return()=>i}case"ref":{let i=n(o.name);return()=>tu(i())}case"unary":{let i=s(o.operand);return()=>-i()}case"binary":{let i=s(o.left),a=s(o.right);switch(o.op){case"+":return()=>i()+a();case"-":return()=>i()-a();case"*":return()=>i()*a();case"/":return()=>i()/a();case"%":return()=>i()%a();case"^":return()=>i()**a()}break}case"call":{let{apply:i}=go[o.name],a=o.args.map(s);return()=>i(a.map(d=>d()))}}throw new U("unsupported expression node",r.source,-1,t)};return s(r.root)}function It(r){return typeof r=="string"&&r.length>1&&r[0]==="="&&r[1]!=="="}function _o(r){return r.startsWith("==")?r.slice(1):r}var ot=r=>({dynamic:!1,value:r});function fr(r,e,t){if(typeof r=="string")return t(r,e);if(Array.isArray(r)){let n=r.map((o,i)=>fr(o,`${e}[${i}]`,t));if(n.some(o=>o.dynamic))return{dynamic:!0,read:()=>n.map(o=>o.dynamic?o.read():o.value)};let s=n.map(o=>o.value);return ot(s.every((o,i)=>o===r[i])?r:s)}if(nu(r)){let n=Object.keys(r),s=n.map(i=>fr(r[i],`${e}.${i}`,t));if(s.some(i=>i.dynamic))return{dynamic:!0,read:()=>{let i={};return n.forEach((a,d)=>{let c=s[d];i[a]=c.dynamic?c.read():c.value}),i}};if(!s.some((i,a)=>i.value!==r[n[a]]))return ot(r);let o={};return n.forEach((i,a)=>{o[i]=s[a].value}),ot(o)}return ot(r)}function wo(r,e,t="props"){return fr(r,t,(n,s)=>It(n)?{dynamic:!0,read:yn(mn(n.slice(1)),e,s)}:ot(_o(n)))}function xd(r,e,t="props"){let n={},s={},o=!1;for(let i of Object.keys(r??{})){let a=wo(r[i],e,`${t}.${i}`);a.dynamic?(s[i]=a.read,o=!0):n[i]=a.value}return{literal:n,bindings:s,hasBindings:o}}function vd(r,e){let t=[];return fr(r,e,(n,s)=>(It(n)&&t.push({path:s,source:n}),ot(n))),t}var ru=/\[([^[\]]+)\]/g;function bd(r,e){return fr(r,"",n=>It(n)?ot(n.replace(ru,(s,o)=>{let i=e(o.trim());return i===void 0?s:`[${i}]`})):ot(n)).value}function nu(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Sd(r,e=Ft){return mn(It(r)?r.slice(1):r,e)}var Z={isSource:It,unescape:_o,parse:Sd,tryParse:(r,e)=>{try{return{expression:Sd(r,e)}}catch(t){return{error:t instanceof Error?t.message:String(t)}}},compile:yn,bind:wo,bindProps:xd,collect:vd,renameRefs:bd,functions:()=>ur(Ft.functions),constants:()=>ur(Ft.constants),dialect:Ft};var kd=(r,e,t)=>Math.min(t,Math.max(e,r));function su(r){let e=[];for(let t=0;t<r.length-1;t++){let n=r[t],s=r[t+1],o=r[t-1]??n,i=r[t+2]??s,a=n.out?{x:n.x+n.out.x,y:n.y+n.out.y}:{x:n.x+(s.x-o.x)/6,y:n.y+(s.y-o.y)/6},d=s.in?{x:s.x+s.in.x,y:s.y+s.in.y}:{x:s.x-(i.x-n.x)/6,y:s.y-(i.y-n.y)/6};e.push({p0:{x:n.x,y:n.y},c1:{x:kd(a.x,n.x,s.x),y:a.y},c2:{x:kd(d.x,n.x,s.x),y:d.y},p3:{x:s.x,y:s.y}})}return e}function Ad(r,e,t,n,s){let o=1-s;return o*o*o*r+3*o*o*s*e+3*o*s*s*t+s*s*s*n}function ou(r,e){let t=0,n=1;for(let s=0;s<30;s++){let o=(t+n)/2;Ad(r.p0.x,r.c1.x,r.c2.x,r.p3.x,o)<e?t=o:n=o}return(t+n)/2}function gn(r){return Array.isArray(r)&&r.length>=2&&r.every(iu)}function iu(r){if(typeof r!="object"||r===null)return!1;let{x:e,y:t}=r;return typeof e=="number"&&Number.isFinite(e)&&typeof t=="number"&&Number.isFinite(t)}function Md(r){let e=su(r);return e.length===0?_s(t=>t,"lin"):_s(t=>{if(t<=0)return e[0].p0.y;let n=e[e.length-1];if(t>=1)return n.p3.y;let s=n;for(let i of e)if(t<=i.p3.x){s=i;break}let o=ou(s,t);return Ad(s.p0.y,s.c1.y,s.c2.y,s.p3.y,o)},`curve:${JSON.stringify(r)}`)}var Od=new Set(["linear","in","out","inOut","custom"]),Td=new Set(["normal","reverse","alternate"]);function ke(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function qe(r){return typeof r=="number"&&Number.isFinite(r)&&r>=0}function au(r,e,t){if(r===void 0)return;if(!ke(r)){t.push({path:e,message:"easing must be an object with a `kind`."});return}let{kind:n,args:s}=r;if(typeof n!="string"||!Od.has(n)){t.push({path:`${e}.kind`,message:`easing kind must be one of ${[...Od].join(", ")} (got ${JSON.stringify(n)}).`});return}n==="custom"&&s!==void 0&&typeof s!="string"&&!gn(s)&&t.push({path:`${e}.args`,message:"a custom easing's args must be its curve \u2014 two or more `{ x, y }` points \u2014 or a registered ease's key."})}function du(r,e,t){if(r===void 0)return;if(!ke(r)){t.push({path:e,message:"loop must be an object with a `count`."});return}let{direction:n,count:s}=r;s!==null&&(typeof s!="number"||!Number.isInteger(s)||s<0)&&t.push({path:`${e}.count`,message:"loop count must be a whole number of repeats >= 0, or null to repeat for the rest of the clip."}),n!==void 0&&!Td.has(n)&&t.push({path:`${e}.direction`,message:`loop direction must be one of ${[...Td].join(", ")} (got ${JSON.stringify(n)}).`})}function cu(r,e,t){if(!ke(r))return t.push({path:e,message:"node must be an object."}),!1;let n=!0,{id:s,type:o,parentId:i,layerOrder:a,props:d,key:c}=r;return typeof s!="string"&&(t.push({path:`${e}.id`,message:"id must be a string."}),n=!1),(typeof o!="string"||o.length===0)&&(t.push({path:`${e}.type`,message:"type must be a non-empty string."}),n=!1),i!==null&&typeof i!="string"&&(t.push({path:`${e}.parentId`,message:"parentId must be a node id or null."}),n=!1),(typeof a!="number"||!Number.isFinite(a))&&(t.push({path:`${e}.layerOrder`,message:"layerOrder must be a finite number."}),n=!1),ke(d)||(t.push({path:`${e}.props`,message:"props must be an object (`{}` when nothing is set)."}),n=!1),c!==void 0&&(typeof c!="string"||c.length===0?(t.push({path:`${e}.key`,message:"key must be a non-empty string when present."}),n=!1):(c.includes("]")||c.includes("."))&&(t.push({path:`${e}.key`,message:`node key "${c}" cannot contain "]" or "." \u2014 it is referenced as "[${c}.prop]".`}),n=!1)),n}function Cd(r,e){let t=new Map;for(let n of r){let s=n.spec.key;if(typeof s!="string"||s.length===0)continue;let o=t.get(s);if(o){e.push({path:`${n.path}.key`,message:`duplicate node key "${s}" (also declared at ${o.path}).`});continue}t.set(s,n)}return t}function lu(r,e,t,n){r.id===""&&(r.type!==t||r.parentId!==null)&&n.push({path:e,message:`the node with id "" is this document's root and must be \`{ type: "${t}", parentId: null }\`.`})}function uu(r,e,t){if(!ke(r))return t.push({path:e,message:"command must be an object."}),!1;let n=!0,{id:s,type:o,targetId:i,at:a,duration:d,args:c}=r;return(typeof s!="string"||s.length===0)&&(t.push({path:`${e}.id`,message:"id must be a non-empty string."}),n=!1),(typeof o!="string"||o.length===0)&&(t.push({path:`${e}.type`,message:"type must be a non-empty string."}),n=!1),i!==null&&typeof i!="string"&&(t.push({path:`${e}.targetId`,message:"targetId must be a node id, or null for the scene root."}),n=!1),qe(a)||(t.push({path:`${e}.at`,message:"at must be a finite number of seconds >= 0."}),n=!1),d!==void 0&&!qe(d)&&(t.push({path:`${e}.duration`,message:"duration must be a finite number of seconds >= 0."}),n=!1),ke(c)||(t.push({path:`${e}.args`,message:"args must be an object (`{}` when there are none)."}),n=!1),au(r.easing,`${e}.easing`,t),du(r.loop,`${e}.loop`,t),n}function fu(r,e,t){if(!ke(r))return t.push({path:e,message:"variable must be an object."}),!1;let n=!0,{id:s,name:o,value:i,lerp:a}=r;return typeof s!="string"||s.length===0?(t.push({path:`${e}.id`,message:"id must be a non-empty string."}),n=!1):s.includes("]")&&(t.push({path:`${e}.id`,message:`variable id "${s}" cannot contain "]" \u2014 it is referenced as "[${s}]".`}),n=!1),o!==void 0&&typeof o!="string"&&(t.push({path:`${e}.name`,message:"name must be a string when present."}),n=!1),"value"in r?Z.isSource(i)&&(t.push({path:`${e}.value`,message:"a variable holds a value, not an expression \u2014 only a node prop can be bound."}),n=!1):(t.push({path:`${e}.value`,message:"value is required \u2014 a variable is what it holds before anything changes it."}),n=!1),a!==void 0&&typeof a!="string"&&(t.push({path:`${e}.lerp`,message:"lerp must be a registered lerp key when present."}),n=!1),n}function Ed(r,e){if(r===void 0)return[];if(!Array.isArray(r))return e.push({path:"variables",message:"variables must be an array."}),[];let t=[];return r.forEach((n,s)=>{let o=`variables[${s}]`;fu(n,o,e)&&t.push({spec:n,path:o})}),t}function Dd(r,e){let t=new Map;for(let n of r){let s=t.get(n.spec.id);if(s){e.push({path:`${n.path}.id`,message:`duplicate variable id "${n.spec.id}" (also declared at ${s.path}).`});continue}t.set(n.spec.id,n)}return t}function Fd(r){let e=r.indexOf(".");return e<0?void 0:{key:r.slice(0,e),prop:r.slice(e+1)}}function xo(r,e,t,n,s){for(let o of Z.collect(r,e)){let i=Z.tryParse(o.source);if("error"in i){s.push({path:o.path,message:i.error});continue}for(let a of i.expression.refs){let d=Fd(a);if(!d){if(t.has(a))continue;s.push({path:o.path,message:n.has(a)?`expression references "[${a}]", which is a node key \u2014 a node is not a value, so name the prop too: "[${a}.x]".`:`expression references "[${a}]", which this document does not declare. Declared: ${[...t].map(c=>`[${c}]`).join(", ")||"none"}.`});continue}if(d.key.length===0||d.prop.length===0||d.prop.includes(".")){s.push({path:o.path,message:`expression references "[${a}]", which is not a node reference \u2014 one is "[key.prop]".`});continue}n.has(d.key)||s.push({path:o.path,message:`expression references "[${a}]", but no node in this document is keyed "${d.key}". Keyed: ${[...n].join(", ")||"none"}.`})}}}function vo(r,e,t,n){if(ke(e))for(let s of Object.keys(e)){let o=[];for(let i of Z.collect(e[s],`${t}.${s}`)){let a=Z.tryParse(i.source);if(!("error"in a))for(let d of a.expression.refs)Fd(d)&&o.push(d)}o.length>0&&n.push({id:`${r}.${s}`,path:`${t}.${s}`,reads:o})}}function Id(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Set,s=[],o=new Set,i=a=>{let d=t.get(a);if(!d||n.has(a))return;let c=s.indexOf(a);if(c>=0){if(!o.has(a)){let l=[...s.slice(c),a];for(let u of l)o.add(u);e.push({path:d.path,message:`expression cycle ${l.join(" \u2192 ")} \u2014 a prop cannot read a prop that reads it back.`})}return}s.push(a);for(let l of d.reads)i(l);s.pop(),n.add(a)};for(let a of r)i(a.id)}function pu(r,e){let t=new Map;for(let s of r){if(t.has(s.spec.id)){e.push({path:`${s.path}.id`,message:`duplicate node id "${s.spec.id}".`});continue}t.set(s.spec.id,s)}for(let s of r){let o=s.spec.parentId;o!==null&&!t.has(o)&&e.push({path:`${s.path}.parentId`,message:`parentId "${o}" is not a node in this document.`})}let n=new Set;for(let{spec:s}of r){if(n.has(s.id))continue;let o=new Set,i=s;for(;i;){if(o.has(i.id)){e.push({path:`${t.get(i.id)?.path}.parentId`,message:`node "${i.id}" is its own ancestor \u2014 parent chain forms a cycle.`});break}if(o.add(i.id),n.has(i.id))break;let a=i.parentId;i=a===null?void 0:t.get(a)?.spec}for(let a of o)n.add(a)}}function Rd(r,e,t){for(let n of r){let s=e.get(n.id);s&&t.push({path:`${s.path}.id`,message:`"${n.id}" is already a node id \u2014 nodes and variables share one id space.`})}}function $d(r,e){r.constants!==void 0&&e.push({path:"constants",message:"constants were merged into `variables` \u2014 move each row there and drop its `kind`."})}function Nd(r,e,t){if(!Array.isArray(r))return t.push({path:"nodes",message:"nodes must be an array."}),[];let n=[];return r.forEach((s,o)=>{let i=`nodes[${o}]`;cu(s,i,t)&&(n.push({spec:s,path:i}),lu(s,i,e,t))}),pu(n,t),n}function hu(r,e,t){let{startAt:n,endAt:s}=r;n!==void 0&&!qe(n)&&t.push({path:`${e}.startAt`,message:"startAt must be a finite number of seconds >= 0."}),s!==void 0&&!qe(s)&&t.push({path:`${e}.endAt`,message:"endAt must be a finite number of seconds >= 0."}),qe(s)&&s<=(qe(n)?n:0)&&t.push({path:`${e}.endAt`,message:`endAt (${s}s) must be after startAt (${n??0}s).`}),r.id===""&&(n!==void 0||s!==void 0)&&t.push({path:e,message:"the root is present for the whole clip \u2014 it cannot carry startAt or endAt."})}function mu(r,e){$d(r,e),r.commands!==void 0&&e.push({path:"commands",message:"a still has no timeline, so no commands \u2014 make it a composition to animate it."});let t=Dd(Ed(r.variables,e),e),n=Nd(r.nodes,"canvas2d",e);for(let c of n){let{startAt:l,endAt:u}=c.spec;(l!==void 0||u!==void 0)&&e.push({path:c.path,message:"a still has no timeline \u2014 drop startAt/endAt, or make it a composition."})}let s=n.map(c=>c.spec);Rd(s,t,e);let o=Cd(n,e),i=new Set(t.keys()),a=new Set(o.keys()),d=[];for(let c of n)xo(c.spec.props,`${c.path}.props`,i,a,e),c.spec.key&&vo(c.spec.key,c.spec.props,`${c.path}.props`,d);Id(d,e)}function yu(r,e){zd(r,"canvas2d",e)}function gu(r,e){zd(r,"audioBus",e)}var _u={add:"a node is a row in `nodes` \u2014 its `startAt` is when it enters.",variable:"a variable is declared in `variables`."};function zd(r,e,t){if($d(r,t),!Array.isArray(r.commands)){t.push({path:"commands",message:"commands must be an array."});return}r.duration!==void 0&&!qe(r.duration)&&t.push({path:"duration",message:"duration must be a finite number of seconds >= 0."});let n=Dd(Ed(r.variables,t),t),s=Nd(r.nodes,e,t);for(let f of s)hu(f.spec,f.path,t);let o=s.map(f=>f.spec);Rd(o,n,t);let i=Cd(s,t),a=[],d=new Set;r.commands.forEach((f,h)=>{if(!uu(f,`commands[${h}]`,t))return;if(d.has(f.id)){t.push({path:`commands[${h}].id`,message:`duplicate command id "${f.id}".`});return}let x=_u[f.type];if(x){t.push({path:`commands[${h}].type`,message:`there is no "${f.type}" command \u2014 ${x}`});return}d.add(f.id),a.push({spec:f,path:`commands[${h}]`})});let c=new Map(o.map(f=>[f.id,f]));for(let{spec:f,path:h}of a){if(f.targetId===null||n.has(f.targetId))continue;let x=hn(c,f.targetId);x===void 0?t.push({path:`${h}.targetId`,message:`targetId "${f.targetId}" is not a node or variable in this document.`}):f.at<x.start&&t.push({path:`${h}.at`,message:`command runs at ${f.at}s but its target "${f.targetId}" is not present until ${x.start}s.`})}let l=new Set(n.keys()),u=new Set(i.keys());for(let f of s)xo(f.spec.props,`${f.path}.props`,l,u,t);for(let{spec:f,path:h}of a)xo(f.args,`${h}.args`,l,u,t);let p=[];for(let f of s)f.spec.key&&vo(f.spec.key,f.spec.props,`${f.path}.props`,p);for(let{spec:f,path:h}of a){if(f.type!=="set"||f.targetId===null)continue;let x=c.get(f.targetId)?.key;x&&vo(x,f.args,`${h}.args`,p)}Id(p,t)}function bo(r){let e=[];if(!ke(r))return{valid:!1,issues:[{path:"",message:"document must be an object."}]};let t=r.kind;return t==="still"?mu(r,e):t==="composition"?yu(r,e):t==="audio"?gu(r,e):e.push({path:"kind",message:`kind must be "still", "composition" or "audio" (got ${JSON.stringify(t)}).`}),{valid:e.length===0,issues:e}}function wu(r){let e=[];if(!ke(r))return{valid:!1,issues:[{path:"",message:"document must be an object."}]};let t=r;if(t.kind!=="project"&&e.push({path:"kind",message:`kind must be "project" (got ${JSON.stringify(t.kind)}).`}),(typeof t.name!="string"||t.name.length===0)&&e.push({path:"name",message:"name must be a non-empty string."}),t.fps!==void 0&&(typeof t.fps!="number"||!(t.fps>0))&&e.push({path:"fps",message:"fps must be a positive number when present."}),!Array.isArray(t.tracks))return e.push({path:"tracks",message:"tracks must be an array."}),{valid:!1,issues:e};let n=new Set;return t.tracks.forEach((s,o)=>{let i=`tracks[${o}]`;if(!ke(s)){e.push({path:i,message:"track must be an object."});return}let a=s;if(typeof a.id!="string"||a.id.length===0?e.push({path:`${i}.id`,message:"id must be a non-empty string."}):n.has(a.id)?e.push({path:`${i}.id`,message:`duplicate track id "${a.id}".`}):n.add(a.id),a.name!==void 0&&typeof a.name!="string"&&e.push({path:`${i}.name`,message:"name must be a string when present."}),a.startAt!==void 0&&!qe(a.startAt)&&e.push({path:`${i}.startAt`,message:"startAt must be a finite number of seconds >= 0."}),qe(a.duration)||e.push({path:`${i}.duration`,message:"duration is required, and must be a finite number of seconds >= 0."}),a.clip===void 0){e.push({path:`${i}.clip`,message:"clip is required \u2014 a track places a clip document inline."});return}for(let d of xu(a.clip))e.push({path:`${i}.clip${d.path?`.${d.path}`:""}`,message:d.message})}),{valid:e.length===0,issues:e}}var Pd=new WeakMap;function xu(r){if(!ke(r))return bo(r).issues;let e=Pd.get(r);return e||(e=bo(r).issues,Pd.set(r,e)),e}function Bd(r){let{valid:e,issues:t}=wu(r);if(!e){let n=t.map(s=>` ${s.path||"<root>"}: ${s.message}`).join(`
|
|
3
|
-
`);throw new Error(`Invalid project document:
|
|
4
|
-
${n}`)}}function Tv(r){let{valid:e,issues:t}=bo(r);if(!e){let n=t.map(s=>` ${s.path||"<root>"}: ${s.message}`).join(`
|
|
5
|
-
`);throw new Error(`Invalid clip document:
|
|
6
|
-
${n}`)}return r}var vu={canvas2d:D,provider:Ia,"theme-provider":Ra,"default-text-style":Fa,rect:wa,ellipse:xa,path:Sa,polygon:va,polygram:ba,boolean:ka,mask:Aa,camera:Ta,orbitCamera:Pa,"rotated-box":Ca,text:fn,richtext:Da,number:Ea,video:za,audioBus:Na,sound:$a,canvas3d:yd,group3d:ja,mesh3d:La,box3d:Ga,sphere3d:Va,plane3d:Ka,circle3d:Wa,cylinder3d:Ua,cone3d:Ya,capsule3d:Za,torus3d:qa,"torus-knot3d":Xa,tube3d:td,lathe3d:ed,extrude3d:Qa,ring3d:Ha,polyhedron3d:Ja,points3d:nd,line3d:sd,sprite3d:od,instances3d:rd,model3d:id,camera3d:pd,"ambient-light3d":ad,"directional-light3d":cd,"point-light3d":ld,"spot-light3d":ud,"hemisphere-light3d":dd,"area-light3d":fd,fog3d:hd,environment3d:md};function _n(r,e){return(t,n,s,o)=>{let i=t[r];if(typeof i!="function")throw new Error(`Command "${r}" is not available on ${t.constructor.name}.`);return i.call(t,{data:n[e],duration:s,easing:o})}}var bu={number:li,vector2:is,vector3:Ps,color:((r,e,t)=>{let[n,s,o,i]=ds(vt(String(r)),vt(String(e)),t),a=d=>Math.round(Math.min(Math.max(d,0),1)*255);return`rgba(${a(n)}, ${a(s)}, ${a(o)}, ${Number(i.toFixed(4))})`}),step:((r,e,t)=>t>=1?e:r)};function jd(r){for(let[e,t]of Object.entries(vu))r.addNode(e,t);for(let[e,t]of Object.entries(bu))r.addLerp(e,t);r.addCommand("to",(e,t,n,s)=>e.to({data:{...t},duration:n,easing:s})),r.addCommand("set",(e,t)=>{let n=t;return pt(0,()=>{e.set(n)})},{binds:!0}),r.addCommand("fillTo",_n("fillTo","fill"),{args:[{key:"fill",kind:"fills"}],method:"fillTo"}),r.addCommand("overlayTo",_n("overlayTo","overlay"),{args:[{key:"overlay",kind:"fills"}],method:"overlayTo"}),r.addCommand("strokeTo",_n("strokeTo","stroke"),{args:[{key:"stroke",kind:"strokes"}],method:"strokeTo"}),r.addCommand("shadowTo",_n("shadowTo","shadow"),{args:[{key:"shadow",kind:"shadows"}],method:"shadowTo"}),r.addVariableCommand("variableTo",(e,t,n,s)=>{let o=t.value,i=t.lerp,a=typeof i=="string"?r.lerp(i):void 0;if(i!==void 0&&!a)throw new Error(`A "lerp" param must name a registered lerp (variable "${e.id}"), got ${JSON.stringify(i)}. Registered: ${r.lerpKeys().join(", ")}.`);let d=a??e.lerp,c,l=!1;return pt(n,u=>{l||(c=e.get(),l=!0),e.set(d(c,o,u))},s)}),r.addVariableCommand("variableSet",(e,t)=>pt(0,()=>{e.set(t.value)})),r.addCommand("save",e=>pt(0,()=>{e.save()}))}var So=["globalThis","window","self","top","parent","frames","Function","importScripts","document","navigator","location","history","screen","customElements","fetch","XMLHttpRequest","WebSocket","EventSource","Request","Response","Headers","localStorage","sessionStorage","indexedDB","caches","cookieStore","crypto","Worker","SharedWorker","ServiceWorker","MessageChannel","BroadcastChannel","postMessage","alert","confirm","prompt","open","print","Notification"],Su=new Set(["eval","arguments"]),Ld=So.filter(r=>Su.has(r));if(Ld.length>0)throw new Error(`DENIED_GLOBALS cannot contain ${Ld.join(", ")}: strict mode forbids binding those names, so no dynamic node would link at all. See the note in this file.`);var ku=["@motionscript/sdk","motionscript","motion-script"],wn=class r{static MAX_SHADERS=512;constructor(e={}){if(this._dynamicNodes=e.dynamicNodes,e.builtins!==!1&&jd(this),Array.isArray(e.nodes))for(let t of e.nodes)this.addNode(t);else for(let[t,n]of Object.entries(e.nodes??{}))this.addNode(t,n);for(let[t,n]of Object.entries(e.lerps??{}))this.addLerp(t,n);for(let[t,n]of Object.entries(e.eases??{}))this.addEase(t,n);for(let[t,n]of Object.entries(e.shaders??{}))this.addShader(t,n)}addNode(e,t,n){let s=typeof t=="function",o=s?t:e,i=typeof o.node=="function"?o.node:o,a=s?n:t,d=s?e:Ks(i);if(d===void 0)throw new Error(`${i.name||"The class"} is no component, so it has no document key. Make it with component2d({ key }), or register it explicitly: addNode("myKey", TheClass).`);let c=typeof d=="string"?{key:d}:d,l=c.key,u=this._nodes.get(l);if(u){if(u.ctor===i)return this;if(!a?.replace)throw new Error(`Node type "${l}" is already registered to a different class (${u.ctor.name} vs ${i.name}). Keys must be unique \u2014 a document naming this type would otherwise resolve differently depending on registration order.`)}let p=new Map,f=new Map;for(let h of ki(Object.create(i.prototype)))(h.withdrawn?f:p).set(h.key,{method:h.method,args:this._describeArgs(h.args)});return this._nodes.set(l,{key:l,ctor:i,commands:p,withdrawn:f,descriptor:{...c,dimension:this._describeDimension(i),holds:this._describeHolds(i),properties:this._describeProperties(i)}}),this}async addNodeFromSource(e,t){if(!this._dynamicNodes)throw new Error("addNodeFromSource needs `dynamicNodes: { sdk, compile }` on the Registry constructor.");let n=await this._dynamicNodes.compile(e),s=this._evalNodeModule(n);return this.addNode(s,t),s}node(e){return this._nodes.get(e)}hasNode(e){return this._nodes.has(e)}nodeKeys(){return[...this._nodes.keys()].sort()}describe(e){return this._nodes.get(e)?.descriptor}instantiate(e,t){let n=this._nodes.get(e.type);if(!n)throw new Error(`Unknown node type "${e.type}" (node ${e.id}). This registry knows: ${this.nodeKeys().join(", ")||"nothing"}.`);return new n.ctor({...t??e.props,id:e.id,...e.key!==void 0&&{key:e.key}})}addCommand(e,t,n){return this._claimed(e,t)?this:(this._commands.set(e,{key:e,scope:"node",factory:t,...n?.args?{args:this._describeArgs(n.args)}:{},binds:n?.binds,...n?.method?{method:n.method}:{}}),this)}addVariableCommand(e,t){return this._claimed(e,t)?this:(this._commands.set(e,{key:e,scope:"variable",factory:t}),this)}command(e){return this._commands.get(e)}nodeCommand(e,t){let n=this._nodes.get(e),s=n?.commands.get(t)??n?.withdrawn.get(t);if(s)return(o,i,a,d)=>{let c=o[s.method];if(typeof c!="function")throw new Error(`Command "${t}" needs a "${s.method}" method on ${o.constructor.name}, which has none.`);let l={};for(let u of s.args)l[u.key]=i[u.key];return c.call(o,{data:l,duration:a,easing:d})}}takesCommand(e,t){let n=this._nodes.get(e);if(!n)return!1;if(n.commands.has(t))return!0;let s=this._commands.get(t);return s?.scope!=="node"?!1:s.method===void 0?!0:n.withdrawn.has(s.method)?!1:typeof n.ctor.prototype[s.method]=="function"}commandKeys(e){return[...e===void 0?this._commands.keys():this._nodes.get(e)?.commands.keys()??[]].sort()}addLerp(e,t){let n=this._lerps.get(e);if(n&&n!==t)throw new Error(`Variable lerp "${e}" is already registered to a different function. Keys must be unique.`);return this._lerps.set(e,t),this}lerp(e){return this._lerps.get(e)}lerpKeys(){return[...this._lerps.keys()].sort()}requireLerp(e,t,n){let s=e??(typeof t=="number"?"number":"step"),o=this._lerps.get(s);if(!o)throw new Error(`Unknown variable lerp "${s}" (${n}). Registered: ${this.lerpKeys().join(", ")||"none"}.`);return o}addEase(e,t){let n=this._eases.get(e);if(n&&n!==t)throw new Error(`Ease "${e}" is already registered to a different function. Keys must be unique.`);return this._eases.set(e,t),this}ease(e){return this._eases.get(e)}easeKeys(){return[...this._eases.keys()].sort()}addShader(e,t,n){let s=ya(t),o=this._shaders.get(e);if(o){if(o.scope===s.scope&&o.source===s.source&&o.name===s.name)return o;if(!n?.replace)throw new Error(`Shader "${e}" is already registered to a different pack ("${o.name}" vs "${s.name}"). Keys must be unique \u2014 a document naming this shader would otherwise resolve differently depending on registration order.`)}else if(this._shaders.size>=r.MAX_SHADERS)throw new Error(`Cannot register shader "${e}": the ${r.MAX_SHADERS}-shader ceiling is reached.`);return this._shaders.set(e,s),s}shader(e){return this._shaders.get(e)}fillShader(e){let t=this._shaders.get(e);return t?.scope==="fill"?t:void 0}effectShader(e){let t=this._shaders.get(e);return t?.scope==="effect"?t:void 0}shaderKeys(){return[...this._shaders.keys()].sort()}_nodes=new Map;_commands=new Map;_lerps=new Map;_eases=new Map;_shaders=new Map;_dynamicNodes;_evalNodeModule(e){let{sdk:t,modules:n}=this._dynamicNodes,s=d=>{if(ku.includes(d))return t;if(n&&Object.hasOwn(n,d))return n[d];let c=["@motionscript/sdk",...Object.keys(n??{})];throw new Error(`"${d}" isn't available to a custom node. It can require ${c.map(l=>`"${l}"`).join(", ")}; a host supplies more through \`dynamicNodes.modules\`.`)},o={exports:{}};new Function("exports","require","module",...So,`"use strict";
|
|
7
|
-
return function () {
|
|
8
|
-
${e}
|
|
9
|
-
};`)(o.exports,s,o)();let a=o.exports.default;if(typeof a!="function"||Ks(typeof a.node=="function"?a.node:a)===void 0)throw new Error('This script must `export default` a component: `component2d({ key: "\u2026", \u2026 })`.');return a}_claimed(e,t){let n=this._commands.get(e);if(!n)return!1;if(n.factory===t)return!0;throw new Error(`Command type "${e}" is already registered to a different factory. Keys must be unique.`)}_describeProperties(e){let t={};for(let n of Ts(Object.create(e.prototype))){if(n.withdrawn)continue;let s=n.editor??{};t[n.key]={...s,kind:s.kind??this._inferKind(n.default),...n.default!==void 0?{default:n.default}:{}}}return t}_describeDimension(e){let t=Object.create(e.prototype).dimension;return typeof t=="string"?t:void 0}_describeHolds(e){let t=Object.create(e.prototype)._childTrees;return Array.isArray(t)?[...t]:void 0}_inferKind(e){switch(typeof e){case"number":return"number";case"string":return"text";case"boolean":return"boolean";case"object":return e===null?"unknown":Array.isArray(e)&&e.every(t=>typeof t=="number")?"vector":"object";default:return"unknown"}}_describeArgs(e){return(e??[]).map(t=>typeof t=="string"?{key:t,kind:"unknown"}:{kind:"unknown",...t})}};var Au="canvas3d";function Mu(r,e,t){let n=new Set;for(let s=e;s!==void 0&&!n.has(s);s=r.describe(s)?.parentKey){if(s===t)return!0;n.add(s)}return!1}function xn(r,e,t,n){return t.some(s=>Mu(r,e,s)||n.isA?.(e,s)===!0)}function Ou(r,e,t,n={}){let s=r.describe(e),o=t===null?void 0:r.describe(t);if(t!==null&&(o?.layout?.acceptsChildren===!1||o?.holds?.length===0))return{kind:"leaf",parent:t};let i=s?.within??[];if(i.length>0&&(t===null||!xn(r,t,i,n)))return{kind:"within",within:i};if(t!==null&&o?.closed===!0&&!xn(r,t,i,n))return{kind:"closed",parent:t};let a=t!==null&&(o?.dimension==="3d"||o?.holds?.includes("3d")===!0||xn(r,t,[Au],n));return s?.dimension==="3d"!==a?{kind:"dimension",parent:t}:null}function Tu(r,e,t,n={}){let s=r.describe(e)?.beside??[];return s.length===0||t.some(o=>xn(r,o,s,n))?null:{kind:"beside",beside:s}}function rb(r,e,t={}){let n=a=>a.parentId===S?null:a.parentId,s=new Map(e.map(a=>[a.id,a])),o=new Map;for(let a of e){if(a.id===S)continue;let d=o.get(n(a));d?d.push(a.type):o.set(n(a),[a.type])}let i=new Map;for(let a of e){if(a.id===S||!r.hasNode(a.type))continue;let d=n(a),c=d===null?null:s.get(d)?.type??null,l=Ou(r,a.type,c,t)??Tu(r,a.type,Pu(o.get(d)??[],a.type),t);l&&i.set(a.id,l)}return i}function Pu(r,e){let t=r.indexOf(e);return t===-1?[...r]:[...r.slice(0,t),...r.slice(t+1)]}var vn="@bus";function Cu(){return{id:vn,type:"audioBus",parentId:null,layerOrder:0,props:{}}}function Eu(){return{id:"",type:"canvas2d",parentId:null,layerOrder:0,props:{}}}function Du(r){let e=[Eu()];r.nodes.some(Gd)||e.push(Cu());for(let t of r.nodes)e.push(Fu(t));return{kind:"composition",duration:r.duration,variables:r.variables,nodes:e,commands:r.commands.map(Iu)}}function Gd(r){return r.id===""&&r.type==="audioBus"}function Fu(r){return Gd(r)?{...r,id:vn,parentId:null}:r.parentId===null||r.parentId===""?{...r,parentId:vn}:r}function Iu(r){return r.targetId===null||r.targetId===""?{...r,targetId:vn}:r}function Ru(r){let e=new Set(r.commands.filter(n=>n.type==="play").map(n=>n.targetId)),t=[];for(let n of r.nodes){if(n.type!=="sound"&&n.type!=="video"||e.has(n.id))continue;let{start:s,end:o}=ae(n),i=n.type==="video"?n.props.segments:void 0;if(Array.isArray(i)&&i.length>0){i.forEach((a,d)=>{t.push({id:`@play:${n.id}:${d}`,type:"play",targetId:n.id,at:s+a.at,duration:Number.isFinite(a.duration)?a.duration:0,args:{from:a.from,...a.speed!==void 0&&{speed:a.speed},...a.volume!==void 0&&{volume:a.volume}}})});continue}t.push({id:`@play:${n.id}`,type:"play",targetId:n.id,at:s,duration:Number.isFinite(o)?o-s:0,args:{}})}return t.length===0?r:{...r,commands:[...r.commands,...t]}}function Rt(r){let e=pn(r)?Du(r):r;return Et(e)?e:Ru(e)}var Yd=["center","topLeft","topRight","bottomLeft","bottomRight","topCenter","bottomCenter","centerLeft","centerRight"];function Ao(r,e,t){let n=$u.has(e.type),s=r.command(e.type);if(s?.scope==="variable"){let p=Nu.has(e.type);return{scope:"variable",known:p,lifecycle:n,readsLayout:!p,writesLayout:!1}}let o=t??(e.targetId===null?Xd:void 0),i=o?r.node(o.type):void 0;if(!o||!i)return null;let a;if(s){if(a=Wd[e.type],a&&typeof bn(i.ctor,a[0])!="function")return null}else{let p=i.commands.get(e.type);if(!p)return null;a=p.method===e.type?Hd[e.type]:void 0}let d=!n&&a!==void 0&&Ku(i.ctor,a);if(!d)return{scope:"node",known:d,lifecycle:n,readsLayout:!0,writesLayout:!0};let c=e.args??{},l=o.props??{},u=Gu(e.type,c);return{scope:"node",known:d,lifecycle:n,readsLayout:Lu(e.type,c,l,u),writesLayout:u===void 0||u.some(p=>!Oo(r,o.type,p))}}function qd(r,e,t){let n=r.command(e.type),s=t??(e.targetId===null?Xd:void 0),o=n?n.scope==="node"?n.args:void 0:s?r.node(s.type)?.commands.get(e.type)?.args:void 0,i=[];for(let a of o??[]){let d=e.args?.[a.key];a.kind==="nodeRef"&&typeof d=="string"&&d!==""&&i.push(d)}return i}function Sn(r,e){let t=r.node(e)?.ctor;return t!==void 0&&bn(t,"provideContext")!==bn(kt,"provideContext")}function Mo(r){for(let e of Z.collect(r,"")){let t=Z.tryParse(e.source);if("error"in t||t.expression.refs.some(n=>n.includes(".")))return!0}return!1}function Oo(r,e,t){let n=r.node(e);return!n||!Zd().ctors.has(n.ctor)?!1:n.descriptor.dimension==="audio"?!0:zu.has(t)}var $u=new Set(["removeChildAt","addChildAt","reparent"]),Nu=new Set(["variableTo","variableSet"]),zu=new Set(["x","y","rotation","scale","opacity","fill","stroke","shadow","overlay","effects","blend","transformOrigin","zoom","lookAt","heading"]),Xd={id:S,type:"canvas2d",parentId:null,layerOrder:0,props:{}},fe=["to","_prepareStep","_writeProp"],wt=["command","set","_writeProp"],Wd={to:fe,set:["set","_writeProp"],save:["save"],fillTo:["fillTo",...wt],overlayTo:["overlayTo",...wt],strokeTo:["strokeTo",...wt],shadowTo:["shadowTo",...wt]},Hd={...Wd,restore:["restore","_prepareStep","_writeProp"],fadeTo:["fadeTo",...fe],rotateTo:["rotateTo",...fe],scaleTo:["scaleTo",...fe],layoutTo:["layoutTo",...fe],effectTo:["effectTo",...fe],progressTo:["progressTo",...fe],pulse:["pulse",...wt],wiggle:["wiggle",...wt],flash:["flash",...wt],moveTo:["moveTo",...fe,"command","set"],zoomTo:["zoomTo",...fe],panTo:["panTo",...fe],headingTo:["headingTo",...fe],countTo:["countTo",...fe],append:["append",...fe],prepend:["prepend",...fe],play:["play"]},Bu={fadeTo:["opacity"],rotateTo:["rotation"],scaleTo:["scale"],layoutTo:["width","height","padding"],effectTo:["effects"],progressTo:["start","end"],pulse:["scale"],wiggle:["rotation"],flash:["start","end"],moveTo:["x","y"],zoomTo:["zoom"],panTo:["lookAt"],headingTo:["heading"],fillTo:["fill"],overlayTo:["overlay"],strokeTo:["stroke"],shadowTo:["shadow"],play:[]},ju=new Set(Object.keys(Hd).filter(r=>r!=="set"&&r!=="save"));function Lu(r,e,t,n){if(Vd(e)||r==="moveTo"&&typeof e.target=="string"&&e.target!=="")return!0;let s=Vd(t),o=Vu(t);return r==="save"||r==="restore"?s||o.size>0:ju.has(r)?(r==="append"||r==="prepend"?["text"]:r==="countTo"?["value"]:n??[]).some(a=>o.has(a)||s&&(a==="x"||a==="y")):!1}function Gu(r,e){let t=Bu[r];if(t)return t;if(r!=="to"&&r!=="set")return;let n=[];for(let s of Object.keys(e))s==="size"?n.push("width","height"):r==="to"&&s==="pivot"?n.push("transformOrigin"):r==="to"&&Yd.includes(s)?n.push("x","y","transformOrigin"):n.push(s);return n}function Vd(r){return Yd.some(e=>r[e]!==void 0)}var Kd=new WeakMap;function Vu(r){let e=Kd.get(r);if(!e){let t=new Set;for(let n of Object.keys(r))Mo(r[n])&&t.add(n);Kd.set(r,e=t)}return e}function bn(r,e){return r.prototype[e]}var Ud=new WeakMap;function Ku(r,e){let t=Ud.get(r);t||Ud.set(r,t=new Map);let n=t.get(e);return n===void 0&&(n=e.every(s=>{let o=bn(r,s);return o===void 0||Uu(s).has(o)}),t.set(e,n)),n}var ko=null;function Zd(){if(!ko){let r=new wn;ko={ctors:new Set(r.nodeKeys().map(e=>r.node(e).ctor)),methods:new Map}}return ko}function Uu(r){let e=Zd(),t=e.methods.get(r);if(!t){let n=new Set;for(let s of e.ctors)for(let o=s.prototype;o&&o!==Object.prototype;o=Object.getPrototypeOf(o)){let i=Object.getOwnPropertyDescriptor(o,r);i&&typeof i.value=="function"&&n.add(i.value)}e.methods.set(r,t=n)}return t}function le(r,e){if(r===e)return!0;if(typeof r!="object"||typeof e!="object"||r===null||e===null)return r!==r&&e!==e;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!le(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=r,n=e,s=0;for(let o of Object.keys(t)){let i=t[o];if(i!==void 0&&(s++,!le(i,n[o])))return!1}for(let o of Object.keys(n))n[o]!==void 0&&s--;return s===0}function Yu(){return{identical:!0,kindChanged:!1,themeChanged:!1,rootChanged:!1,duration:!1,nodes:{added:new Set,removed:new Set,changed:new Set,respec:new Set,moved:new Set,span:new Set,reorderedParents:new Set},commands:{added:new Set,removed:new Set,changed:new Set,reorderedAts:new Set},variables:{added:new Set,removed:new Set,changed:new Set},remappedKeys:new Set}}function kn(r,e){let t=Yu();if(r===e)return t;if(r.kind!==e.kind)return t.kindChanged=!0,t.identical=!1,t;let n=Jd(r),s=Jd(e);t.themeChanged=!le(r.theme,e.theme),t.duration=Re(n)!==Re(s),r.nodes!==e.nodes&&qu(n.nodes,s.nodes,t),r.variables!==e.variables&&Hu(n.variables??[],s.variables??[],t);let o=n.kind==="composition"?n.commands:[],i=s.kind==="composition"?s.commands:[];return r.commands!==e.commands&&Wu(o,i,t),t.identical=!t.themeChanged&&!t.rootChanged&&!t.duration&&t.remappedKeys.size===0&&To(t.nodes)&&t.nodes.reorderedParents.size===0&&To(t.commands)&&t.commands.reorderedAts.size===0&&To(t.variables),t}function Jd(r){return Rt(r)}function To(r){return r.added.size===0&&r.removed.size===0&&r.changed.size===0}var Qd={id:S,type:"canvas2d",parentId:null,layerOrder:0,props:{}};function qu(r,e,t){let n=$t(r),s=$t(e),o=t.nodes,i=n.get(S)??Qd,a=s.get(S)??Qd;t.rootChanged=i!==a&&!Xu(i,a);for(let[u,p]of n){if(u===S)continue;let f=s.get(u);if(!f){o.removed.add(u);continue}if(p===f)continue;let h=!1;(p.type!==f.type||p.key!==f.key||!le(p.props,f.props))&&(o.respec.add(u),h=!0),p.parentId!==f.parentId&&(o.moved.add(u),h=!0),nc(p,f)||(o.span.add(u),h=!0),(h||p.layerOrder!==f.layerOrder)&&o.changed.add(u)}for(let u of s.keys())u!==S&&!n.has(u)&&o.added.add(u);let d=ec(r);for(let[u,p]of ec(e)){let f=d.get(u);f!==void 0&&f!==p&&t.remappedKeys.add(u)}let c=tc(r),l=tc(e);for(let[u,p]of c){let f=l.get(u);f&&!sc(p,f)&&o.reorderedParents.add(u)}}function Xu(r,e){return r.type===e.type&&r.key===e.key&&r.parentId===e.parentId&&r.layerOrder===e.layerOrder&&le(r.props,e.props)&&nc(r,e)}function nc(r,e){let t=ae(r),n=ae(e);return t.start===n.start&&t.end===n.end}function Wu(r,e,t){let n=$t(r),s=$t(e),o=t.commands;for(let[d,c]of n){let l=s.get(d);if(!l){o.removed.add(d);continue}c!==l&&(c.type!==l.type||c.targetId!==l.targetId||c.at!==l.at||(c.duration??0)!==(l.duration??0)||!le(c.easing,l.easing)||!le(c.loop,l.loop)||!le(c.args,l.args))&&o.changed.add(d)}for(let d of s.keys())n.has(d)||o.added.add(d);let i=rc(r),a=rc(e);for(let[d,c]of i){let l=a.get(d);l&&!sc(c,l)&&o.reorderedAts.add(d)}}function Hu(r,e,t){let n=$t(r),s=$t(e),o=t.variables;for(let[i,a]of n){let d=s.get(i);if(!d){o.removed.add(i);continue}a!==d&&(a.lerp!==d.lerp||!le(a.value,d.value))&&o.changed.add(i)}for(let i of s.keys())n.has(i)||o.added.add(i)}function $t(r){let e=new Map;for(let t of r)e.set(t.id,t);return e}function ec(r){let e=new Map;for(let t of r)t.key&&e.set(t.key,t.id);return e}function tc(r){let e=new Map;r.forEach((n,s)=>{if(n.id===S)return;let o=n.parentId??S,i=e.get(o);i||e.set(o,i=[]),i.push({id:n.id,order:n.layerOrder,index:s})});let t=new Map;for(let[n,s]of e)s.sort((o,i)=>o.order-i.order||o.index-i.index),t.set(n,s.map(o=>o.id));return t}function rc(r){let e=new Map;for(let t of r){let n=e.get(t.at);n||e.set(t.at,n=[]),n.push(t.id)}return e}function sc(r,e){let t=new Set(e),n=new Set(r),s=r.filter(i=>t.has(i)),o=e.filter(i=>n.has(i));if(s.length!==o.length)return!1;for(let i=0;i<s.length;i++)if(s[i]!==o[i])return!1;return!0}function Zu(r){let e=r.indexOf(".");return e<0?void 0:{key:r.slice(0,e),prop:r.slice(e+1)}}function Po(r,e=""){let t=[],n=[],s=0,o=new Set;for(let i of Z.collect(r,e)){let a=Z.tryParse(i.source);if("error"in a){s++;continue}for(let d of a.expression.refs){if(o.has(d))continue;o.add(d);let c=Zu(d);c?n.push([c.key,c.prop]):t.push(d)}}return{vars:t,keys:n,unparsable:s}}function Eo(r){return new Co(Rt(r))}var Ju=Object.freeze({vars:[],keys:[],unparsable:0}),Qu=new Map,oc=[];function An(r,e){return r!==void 0&&e>=r.start&&e<r.end}var Co=class{doc;nodes=new Map;nodeCount;variables=new Map;commands=new Map;ordered;byTarget=new Map;keyed=new Map;dependents={byVar:new Map,byKey:new Map};duration;issues={duplicateIds:!1,duplicateKeys:!1,unresolvedParent:!1,cycle:!1,invalidRoot:!1,unparsable:!1,unresolvedRefs:!1};constructor(e){this.doc=e,this.duration=Re(e);let t=e.kind==="composition"?e.commands:[];this._indexNodes(e.nodes),this.nodeCount=this.nodes.size-1;for(let n of e.variables??[])(this.variables.has(n.id)||this.nodes.has(n.id))&&(this.issues.duplicateIds=!0),this.variables.set(n.id,n);this.ordered=t.map((n,s)=>({spec:n,index:s})).sort((n,s)=>n.spec.at-s.spec.at||n.index-s.index).map(n=>n.spec);for(let n of this.ordered){this.commands.has(n.id)&&(this.issues.duplicateIds=!0),this.commands.set(n.id,n);let s=this.targetOf(n),o=this.byTarget.get(s);o||this.byTarget.set(s,o=[]),o.push(n.id);let i=this._byAt.get(n.at);i||this._byAt.set(n.at,i=[]),i.push(n)}this._ats=[...this._byAt.keys()],this._indexRefs(t)}children(e){return this._children.get(e)??oc}descendants(e){let t=[],n=new Set([e]),s=[...this.children(e)].reverse();for(;s.length>0;){let o=s.pop();if(n.has(o))continue;n.add(o),t.push(o);let i=this.children(o);for(let a=i.length-1;a>=0;a--)s.push(i[a])}return t}ownSpan(e){let t=this.nodes.get(e);return t?ae(t):void 0}effSpan(e){let t=this._eff.get(e);if(t)return t;if(!this.nodes.has(e))return;let n=[],s=new Set,o={start:0,end:1/0},i=this.nodes.get(e);for(;i;){let a=this._eff.get(i.id);if(a){o=a;break}if(s.has(i.id)||(s.add(i.id),n.push(i),i.id===S||i.parentId===null))break;i=this.nodes.get(i.parentId)}for(let a=n.length-1;a>=0;a--){let d=ae(n[a]);o={start:Math.max(o.start,d.start),end:Math.min(o.end,d.end)},this._eff.set(n[a].id,o)}return this._eff.get(e)}targetOf(e){return e.targetId??S}commandsAt(e){return this._byAt.get(e)??oc}bindings(e){return this._bindings.get(e)??Qu}refs(e){return this._refs.get(e)??Ju}initialKey(e){return An(this.ownSpan(e),0)?An(this.effSpan(e),0)?"mounted":"unmounted":"absent"}captureKey(e){let t=this.captureTime(e);return t===void 0?"none":An(this.effSpan(e),t)?"arrival-mounted":"arrival-unmounted"}captureTime(e){let t=this.ownSpan(e);if(!t||An(t,0))return;let n=0,s=this._ats.length;for(;n<s;){let i=n+s>>1;this._ats[i]<t.start?n=i+1:s=i}let o=this._ats[n];return o!==void 0&&o<t.end?o:void 0}_children=new Map;_eff=new Map;_byAt=new Map;_ats=[];_bindings=new Map;_refs=new Map;_indexNodes(e){let t=new Map;e.forEach((s,o)=>{if(this.nodes.has(s.id)&&(this.issues.duplicateIds=!0),this.nodes.set(s.id,s),s.key&&(this.keyed.has(s.key)&&(this.issues.duplicateKeys=!0),this.keyed.set(s.key,s.id)),s.id===S){(s.type!=="canvas2d"||s.parentId!==null)&&(this.issues.invalidRoot=!0);return}let i=s.parentId??S,a=t.get(i);a||t.set(i,a=[]),a.push({id:s.id,order:s.layerOrder,index:o})}),this.nodes.has(S)||this.nodes.set(S,{id:S,type:"canvas2d",parentId:null,layerOrder:0,props:{}});for(let[s,o]of t)o.sort((i,a)=>i.order-a.order||i.index-a.index),this._children.set(s,o.map(i=>i.id));let n=new Set([S]);for(let s of this.nodes.values()){s.parentId!==null&&!this.nodes.has(s.parentId)&&(this.issues.unresolvedParent=!0);let o=new Set,i=s;for(;i&&!n.has(i.id);){if(o.has(i.id)){this.issues.cycle=!0;break}o.add(i.id),i=i.parentId===null?void 0:this.nodes.get(i.parentId)}for(let a of o)n.add(a)}}_indexRefs(e){for(let t of this.nodes.values())this._bind(t.id,t.props);for(let t of e){if(t.type==="set"){let n=this.targetOf(t);if(this.nodes.has(n)){this._bind(n,t.args);continue}}Po(t.args).unparsable>0&&(this.issues.unparsable=!0)}for(let[t,n]of this._bindings){let s=new Set,o=new Map,i=0;for(let a of n.values()){for(let d of a.vars)s.add(d);for(let d of a.keys)o.set(`${d[0]}.${d[1]}`,d);i+=a.unparsable}this._refs.set(t,{vars:[...s],keys:[...o.values()],unparsable:i});for(let a of s){this.variables.has(a)||(this.issues.unresolvedRefs=!0);let d=this.dependents.byVar.get(a);d||this.dependents.byVar.set(a,d=new Set),d.add(t)}for(let[a]of o.values()){this.keyed.has(a)||(this.issues.unresolvedRefs=!0);let d=this.dependents.byKey.get(a);d||this.dependents.byKey.set(a,d=new Set),d.add(t)}}}_bind(e,t){if(t)for(let n of Object.keys(t)){let s=Po(t[n]);if(s.unparsable>0&&(this.issues.unparsable=!0),s.vars.length===0&&s.keys.length===0)continue;let o=this._bindings.get(e);o||this._bindings.set(e,o=new Map);let i=o.get(n);if(!i){o.set(n,s);continue}let a=new Set([...i.vars,...s.vars]),d=new Map([...i.keys,...s.keys].map(c=>[`${c[0]}.${c[1]}`,c]));o.set(n,{vars:[...a],keys:[...d.values()],unparsable:i.unparsable+s.unparsable})}}};var On=class r{_finish;_tracks;_replayed;static build(e){let t=new Float64Array(e.length).fill(NaN),n=new Map,s=[],o=[];for(let i=0;i<e.length;i++){let a=e[i],d=vi(a.command)?rf(a.start,a.duration):NaN;if(Number.isNaN(d)){s.push(i);continue}t[i]=d,d>a.start&&o.push(i);let c=new Set;Ce({read:()=>{},write:l=>c.add(l)},()=>a.command.at(1));for(let l of c){let u=n.get(l),p={order:i,finish:d,end:l.snapshot()};u?u.push(p):n.set(l,[p])}}return s.length===e.length?null:new r(e,t,[...n].map(([i,a])=>new Do(i,a)),s,o)}holds(e){return!Number.isNaN(this._finish[e])}evaluate(e,t){let n=this._tracks,s=this._held;for(let p=0;p<n.length;p++){let f=s[p]=n[p].at(t);f>=0&&n[p].slot.restoreFrom(n[p].ends[f])}let o=this._replayed,i=this._long,a=this._binOf(t),d=this._binStart[a+1],c=0,l=this._binStart[a],u=0;for(;;){let p=c<o.length?o[c]:Mn,f=l<d?this._binItems[l]:Mn,h=u<i.length?i[u]:Mn,x;if(p<f&&p<h)x=p,c++;else if(f<h)x=f,l++;else if(h!==Mn)x=h,u++;else break;let y=e[x];if(!(t<y.start||this._finish[x]<=t)){y.command.at(Wt(y.duration>0?(t-y.start)/y.duration:1));for(let _=this._fixStart[x];_<this._fixStart[x+1];_++){let w=this._fixTracks[_],b=s[w];b>=0&&n[w].order[b]>x&&n[w].slot.restoreFrom(n[w].ends[b])}}}}constructor(e,t,n,s,o){this._finish=t,this._tracks=n,this._replayed=s,this._held=new Int32Array(n.length);let i=1/0,a=-1/0;for(let f of o)i=Math.min(i,e[f].start),a=Math.max(a,t[f]);let d=Math.max(1,Math.min(ef,o.length));this._from=Number.isFinite(i)?i:0,this._width=a>i?(a-i)/d:1,this._bins=d;let c=Array.from({length:d},()=>[]),l=[];for(let f of o){let h=this._binOf(e[f].start),x=this._binOf(t[f]);if(x-h>tf)l.push(f);else for(let y=h;y<=x;y++)c[y].push(f)}this._long=l,this._binStart=new Int32Array(d+1);for(let f=0;f<d;f++)this._binStart[f+1]=this._binStart[f]+c[f].length;this._binItems=Int32Array.from(c.flat());let u=new Map(n.map((f,h)=>[f.slot,h])),p=[];this._fixStart=new Int32Array(e.length+1);for(let f=0;f<e.length;f++){for(let h of e[f].writes){let x=u.get(h);x!==void 0&&p.push(x)}this._fixStart[f+1]=p.length}this._fixTracks=Int32Array.from(p)}_held;_from;_width;_bins;_binStart;_binItems;_long;_fixStart;_fixTracks;_binOf(e){let t=Math.floor((e-this._from)/this._width);return t<0?0:t>=this._bins?this._bins-1:t}},Mn=2147483647,ef=1024,tf=32,Do=class{slot;finish;order;ends;_best;constructor(e,t){this.slot=e,t.sort((s,o)=>s.finish-o.finish||s.order-o.order),this.finish=Float64Array.from(t,s=>s.finish),this.order=Int32Array.from(t,s=>s.order),this.ends=t.map(s=>s.end),this._best=new Int32Array(t.length);let n=0;for(let s=0;s<t.length;s++)this.order[s]>this.order[n]&&(n=s),this._best[s]=n}at(e){let t=0,n=this.finish.length;for(;t<n;){let s=t+n>>>1;this.finish[s]<=e?t=s+1:n=s}return t===0?-1:this._best[t-1]}};function rf(r,e){if(!(e>0))return r;let t=s=>(s-r)/e>=1,n=r+e;if(!Number.isFinite(n))return NaN;for(let s=0;!t(n);s++){if(s===8)return NaN;n=ic(n,!0)}for(let s=0;s<8;s++){let o=ic(n,!1);if(!t(o))return n;n=o}return NaN}var Fo=new Float64Array(1),nf=new BigInt64Array(Fo.buffer);function ic(r,e){return r===0?e?Number.MIN_VALUE:-Number.MIN_VALUE:(Fo[0]=r,nf[0]+=r>0===e?1n:-1n,Fo[0])}var sf=16;function pc(r,e,t,n,s={}){if(t.kindChanged||t.themeChanged||ac(r)||ac(e))return null;let o=r.nodes.get(S),i=e.nodes.get(S);if(t.rootChanged&&!of(o,i)||e.issues.unparsable||e.issues.unresolvedRefs||t.remappedKeys.size>0)return null;let a=dc(r,n),d=a&&dc(e,n);if(!a||!d)return null;let{added:c,removed:l,respec:u,moved:p,span:f,reorderedParents:h}=t.nodes,x=g=>(e.byTarget.get(g)?.length??0)>0,y=(g,A,$,ue)=>g.byTarget.get($)?.some(de=>ue(A.get(de)))??!1,_=g=>y(r,a,g,A=>!A.known)||y(e,d,g,A=>!A.known),w=(g,A)=>{let $=g.nodes.get(A)?.type;return $===void 0||n.dimensionOf?.($)!=="audio"},b=g=>w(r,g)||w(e,g),M=[];for(let g of e.nodes.keys())g!==S&&r.nodes.has(g)&&M.push(g);let O=new Set,T=g=>{let A=r.nodes.get(g)?.type,$=e.nodes.get(g)?.type;return A!==void 0&&n.isContextProvider(A)||$!==void 0&&n.isContextProvider($)},V=g=>{if(!O.has(g)&&(O.add(g),T(g)))for(let A of e.descendants(g))O.add(A)};for(let g of u)V(g);for(let g of p)if(V(g),uc(r,g,n)||uc(e,g,n))for(let A of e.descendants(g))O.add(A);for(let g of[...c,...l])if(T(g))for(let A of e.descendants(g))O.add(A);let re=!1;for(let g of M){let A=n.ctorOf(g);A!==void 0&&n.registeredCtor(e.nodes.get(g).type)!==A&&(V(g),b(g)&&(re=!0)),x(g)&&r.initialKey(g)!==e.initialKey(g)&&V(g)}let B=new Set,_e=new Set,Oe=g=>{e.variables.has(g)?_e.add(g):e.nodes.has(g)&&B.add(g)};for(let g of t.commands.added)Oe(e.targetOf(e.commands.get(g)));for(let g of t.commands.removed)Oe(r.targetOf(r.commands.get(g)));for(let g of t.commands.changed)Oe(r.targetOf(r.commands.get(g))),Oe(e.targetOf(e.commands.get(g)));for(let g of new Set([...r.byTarget.keys(),...e.byTarget.keys()]))cf(r.byTarget.get(g),e.byTarget.get(g))||Oe(g);for(let g of t.commands.reorderedAts){for(let A of r.commandsAt(g))Oe(r.targetOf(A));for(let A of e.commandsAt(g))Oe(e.targetOf(A))}if(t.duration)for(let g of e.commands.values())g.loop?.count===null&&Oe(e.targetOf(g));for(let g of t.variables.added)_e.add(g);for(let g of t.variables.changed)_e.add(g);let Kt=new Set;for(let g of M)df(r.effSpan(g),e.effSpan(g))?x(g)&&(r.captureKey(g)!==e.captureKey(g)||r.captureTime(g)!==e.captureTime(g))&&B.add(g):(Kt.add(g),x(g)&&B.add(g));let he=h.size>0||re||[...c].some(g=>w(e,g))||[...l].some(g=>w(r,g))||[...p].some(b)||[...f].some(b)||[...u].some(g=>b(g)&&fc(r.nodes.get(g),e.nodes.get(g),n))||t.rootChanged&&fc(o,i,n),we=new Set([...c,...l,...Kt]);t.rootChanged&&we.add(S);let xl=[...cc(r,n),...cc(e,n)],di=(g,A)=>{let $=e.nodes.get(g)?.type;if($===void 0||n.dimensionOf?.($)==="audio")return!1;for(let[ue,de]of e.bindings(g))if(A(de)&&!n.isLayoutNeutralProp($,ue))return!0;return!1},ci=-1;for(;ci!==B.size+_e.size+O.size+we.size+(he?1:0);){ci=B.size+_e.size+O.size+we.size+(he?1:0);for(let g of O)x(g)&&B.add(g);for(let g of O)we.add(g);for(let g of B)we.add(g);for(let g of _e)for(let A of e.dependents.byVar.get(g)??[])we.add(A),!he&&di(A,$=>$.vars.includes(g))&&(he=!0);for(let g of we)for(let A of af(r,e,g))for(let $ of e.dependents.byKey.get(A)??[])we.add($),!he&&di($,ue=>ue.keys.some(([de])=>de===A))&&(he=!0);for(let{reader:g,ref:A}of xl)(lc(r,A,we)||lc(e,A,we))&&we.add(g);for(let g of we)e.nodes.has(g)&&x(g)&&B.add(g);for(let g of B)g!==S&&_(g)&&V(g);if(!he){for(let g of[...B,..._e])if(y(r,a,g,A=>A.writesLayout)||y(e,d,g,A=>A.writesLayout)){he=!0;break}}if(he)for(let g of e.byTarget.keys())e.nodes.has(g)&&y(e,d,g,A=>A.readsLayout)&&B.add(g)}if(B.has(S)&&_(S))return null;let vl=Math.max((s.rebuildFraction??.5)*e.nodeCount,s.minRebuildNodes??sf);if(O.size>vl)return null;let Ut;if([...B,..._e].some(g=>y(e,d,g,A=>A.readsLayout||!A.known)))Ut="all";else{Ut=new Set;let g=[],A=new Set;for(let $ of B){let ue=e.refs($);ue.vars.length===0&&ue.keys.length===0||(e.byTarget.get($)??[]).some(de=>e.commands.get(de).type!=="set")&&(A.add($),g.push($))}for(;g.length>0;){let $=e.refs(g.pop());for(let ue of $.vars)!_e.has(ue)&&x(ue)&&Ut.add(ue);for(let[ue]of $.keys){let de=e.keyed.get(ue);de!==void 0&&(!B.has(de)&&x(de)&&Ut.add(de),A.has(de)||(A.add(de),g.push(de)))}}}let ss=new Set([...l,...O]);for(let g of h)for(let A of e.children(g))r.nodes.has(A)&&ss.add(A);for(let g of O)for(let A of e.children(g))ss.add(A);let os=[];for(let g of new Set([...B,...O,...c])){if(!x(g))continue;let A=e.captureTime(g);A!==void 0&&os.push({at:A,id:g})}return os.sort((g,A)=>g.at-A.at),{prev:r,next:e,diff:t,added:c,removed:l,reinstantiate:O,detach:ss,dirtyNodes:B,dirtyVariables:_e,replay:Ut,captures:os,layoutChanged:he}}function ac(r){let{duplicateIds:e,duplicateKeys:t,unresolvedParent:n,cycle:s,invalidRoot:o}=r.issues;return e||t||n||s||o}function dc(r,e){let t=new Map;for(let n of r.ordered){let s=r.targetOf(n),o=r.nodes.get(s),i=e.traits(n,o);if(!i||i.lifecycle||(i.scope==="variable"?!r.variables.has(s):!o))return null;t.set(n.id,i)}return t}function cc(r,e){if(!e.nodeRefs)return[];let t=[];for(let n of r.ordered){let s=r.targetOf(n);for(let o of e.nodeRefs(n,r.nodes.get(s)))t.push({reader:s,ref:o})}return t}function lc(r,e,t){let n=new Set,s=e;for(;s!==void 0&&!n.has(s);){if(t.has(s))return!0;n.add(s);let o=r.nodes.get(s);if(!o||s===S)return!1;s=o.parentId??S}return!1}function uc(r,e,t){let n=new Set([e]),s=r.nodes.get(e);for(;s&&s.id!==S;){let o=s.parentId??S;if(n.has(o))return!1;if(n.add(o),s=r.nodes.get(o),s&&t.isContextProvider(s.type))return!0}return!1}function of(r,e){let t=ae(r),n=ae(e);return r.type===e.type&&r.key===e.key&&r.parentId===e.parentId&&r.layerOrder===e.layerOrder&&t.start===n.start&&t.end===n.end}function fc(r,e,t){if(r.type!==e.type||r.key!==e.key)return!0;for(let n of new Set([...Object.keys(r.props),...Object.keys(e.props)]))if(!le(r.props[n],e.props[n])&&!t.isLayoutNeutralProp(e.type,n))return!0;return!1}function af(r,e,t){let n=[],s=r.nodes.get(t)?.key,o=e.nodes.get(t)?.key;return s&&n.push(s),o&&o!==s&&n.push(o),n}function df(r,e){return r?.start===e?.start&&r?.end===e?.end}function cf(r,e){if(r===e)return!0;if(!r||!e||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function lf(r,e){if(r)switch(r.kind){case"linear":return pi();case"in":return hi(r.args);case"out":return mi(r.args);case"inOut":return yi(r.args);case"custom":{let t=r.args;if(gn(t))return Md(t);if(typeof t!="string")throw new Error(`A "custom" ease needs a curve or its Registry.addEase key in \`args\` (got ${JSON.stringify(r.args)}).`);let n=e.ease(t);if(!n)throw new Error(`No ease registered under "${t}". Registered: ${e.easeKeys().join(", ")||"none"}.`);return n}}}function uf(r){return r.map((e,t)=>({spec:e,index:t})).sort((e,t)=>e.spec.at-t.spec.at||e.index-t.index).map(e=>e.spec)}function ff(){return{id:S,type:"canvas2d",parentId:null,layerOrder:0,props:{}}}function hc(r){let e=[],t;for(let n of r){if(n.id===S&&n.type==="canvas2d"){t=n;continue}e.push(n)}return{root:t??ff(),rest:e}}function mc(r){let e=new Map;for(let t of r.nodes)e.set(t.id,ae(t));return e.delete(S),e}var Pn=class{canvas;constructor(e,t,n){this.canvas=n,this._doc=e,this._registry=t;let{root:s,rest:o}=hc(e.nodes);this._rootSpec=s,this._specs=o,this._varSpecs=e.variables??[],this._keyed=new Map([s,...o].filter(i=>!!i.key).map(i=>[i.key,i.id])),this._spans=mc(e),this._duration=Re(e)}get duration(){return this._duration}build(){this._buildVariables(),this._pristineRoot=zs(this.canvas),this._applyRootProps();for(let e of this._specs)this._live.set(e.id,{spec:e,node:this._instantiate(e),initial:it,initialStackDepth:0,baseline:it,baseStackDepth:0,presence:new Jt(!1,null,et+e.id)});this._baseChildCount.set(S,this.canvas._allChildren.length);for(let[e,t]of this._live)this._baseChildCount.set(e,t.node._allChildren.length);this.syncPresence(0),this._root={spec:this._rootSpec,node:this.canvas,initial:it,initialStackDepth:0,baseline:it,baseStackDepth:0,presence:new Jt(!0,null,et+S)};for(let e of this._live.values())Tn(e);Tn(this._root),this._baselined=new Set(this._present);for(let e of this._present)this._live.get(e)?.node.mounted===!1&&(this._baselined.delete(e),this._unmounted.add(e))}compile(e=()=>{}){this._settled=null,this._compileCommands(e),this._restoreBaselines();let t=this.syncPresence(0);(this._restoreDisplaced(this._collectDisplaced())||t)&&e(),this._indexSettled()}variableValue(e){return this._vars.get(e)?.cell.get()}variables(){return this._varSpecs}get presenceTime(){return this._presenceIndex().time}commandSounds(){let e=[];for(let t of this._placed){let n=zi(t.command);if(n)for(let s of n.sounds)e.push({node:n.host,at:t.start+s.at,until:s.until===void 0?void 0:t.start+s.until,src:s.src,options:s.options})}return e}placedCommands(){return this._placed}evaluateAt(e,t){if(t){Nr(()=>this._restoreBaselines()),this._evaluateObserved(e,t);return}if(this._settled){this._restoreBaselines(this._wholeRestore);for(let{slot:n,baseline:s}of this._slotRestore)n.restoreFrom(s);this._settled.evaluate(this._placed,e);return}this._restoreBaselines();for(let n of this._placed){if(e<n.start)continue;let s=n.duration>0?(e-n.start)/n.duration:1;n.command.at(Wt(s))}}syncPresence(e){let t=this._presenceIndex().crossed(e);if(t.length===0)return!1;let n=[],s=[];for(let i of t){let a=Cn(i,e);a!==this._present.has(i.id)&&(a?n:s).push(i)}if(this._arrived=n,n.length===0&&s.length===0)return!1;s.sort(_c);for(let i of s){this._present.delete(i.id),i.siblings.add(i.slot,-1);let a=this._live.get(i.id);a&&(a.presence.set(!1),this._parentNodeOf(a.spec)?.remove(a.node))}n.sort(_c);let o=new Map;for(let i of n){let a=o.get(i.siblings);a?a.push(i):o.set(i.siblings,[i])}for(let[i,a]of o){a.sort((l,u)=>l.slot-u.slot);let d=i.parentId===S?this.canvas:this._live.get(i.parentId)?.node,c=this._baseChildCount.get(i.parentId)??0;for(let l of a){this._present.add(l.id);let u=c+i.before(l.slot);i.add(l.slot,1);let p=this._live.get(l.id);p&&(p.presence.set(!0),d?.addChildAt({data:{child:p.node,index:u}}))}}return!0}liveNode(e){return e===S?this.canvas:this._live.get(e)?.node}baselineProps(e){let t=e===S?this._root:this._live.get(e);if(!t)return;let n=t.baseline===it?t.initial:t.baseline,s={};for(let[o,i]of n)s[o]=i.fn?i.fn():i.value;return s}presenceSlot(e){return e===S?this._root?.presence:this._live.get(e)?.presence}variableSlot(e){return this._vars.get(e)?.cell}planUpdate(e){let t=this._docIndex??=Eo(this._doc);return pc(t,Eo(e),kn(this._doc,e),this._patchEnvironment())}applyUpdate(e,t,n){if(!this._root)throw new Error("ClipTimeline.applyUpdate needs a built timeline.");if(e.prev!==this._docIndex)throw new Error("This patch was planned against a different version of the document.");this._settled=null,this._restoreBaselines(),this.syncPresence(0),this._updateVariables(e),this._keyed.clear();for(let[u,p]of e.next.keyed)this._keyed.set(u,p);let s=this._updateStructure(e);for(let u of s){Tn(u);let p=u.spec.id;this._present.has(p)&&(u.node.mounted?this._baselined.add(p):this._unmounted.add(p))}if(e.diff.rootChanged){let u=this.canvas;zr(u,this._pristineRoot),u._stateStack.length=0,this._applyRootProps(),Tn(this._root)}for(let u of e.dirtyNodes){let p=u===S?this._root:this._live.get(u);p&&!s.has(p)&&hf(p)}n();let o=new Map;for(let u of this._placed)o.set(u.spec.id,u);let i=this._walkPatch(e,o,t),a=u=>e.dirtyNodes.has(u)||e.dirtyVariables.has(u),d=[],c=new Set;if(this._animated=[],this._animatedVars=[],this._animatedParts=[],!Et(this._doc))for(let u of e.next.ordered){let p=i.get(u.id);if(!p&&!a(e.next.targetOf(u))){let f=o.get(u.id);f&&(p=f.spec===u?f:{...f,spec:u})}p&&(d.push(p),this._touch(p,c))}this._placed=d,this._restoreBaselines();let l=this.syncPresence(0);(this._restoreDisplaced(this._collectDisplaced())||l)&&t(),this._indexSettled()}_doc;_registry;_rootSpec;_specs;_varSpecs;_spans;_duration;_docIndex=null;_pristineRoot=it;_live=new Map;_vars=new Map;_keyed;_placed=[];_settled=null;_wholeRestore=[];_slotRestore=[];_root=null;_animated=[];_animatedVars=[];_animatedParts=[];_partBaselines=new WeakMap;_baseChildCount=new Map;_present=new Set;_baselined=new Set;_displaced=[];_unmounted=new Set;_presence=null;_arrived=[];_resolveVariable=e=>{let t=e.indexOf(".");if(t>0){let n=this._keyed.get(e.slice(0,t));if(n===void 0)return;let s=e.slice(t+1);return()=>this._nodeById(n)?.[s]}return this._vars.get(e)?.read};_nodeById(e){if(e===S)return this.canvas;let t=this._live.get(e);if(t)return _i!==null&&this._readPresence(t),t.node.mounted?t.node:void 0}_readPresence(e){let t=e;for(let n=0;t&&n<=this._live.size;n++)t.presence.get(),t=t.spec.parentId===null?void 0:this._live.get(t.spec.parentId)}_applyRootProps(){let{literal:e,bindings:t}=Z.bindProps(this._rootSpec.props,this._resolveVariable);this.canvas.set({...e,...t})}_instantiate(e){let{literal:t,bindings:n,hasBindings:s}=Z.bindProps(e.props,this._resolveVariable),o=this._registry.instantiate(e,t);return s&&o.set(n),o}_buildVariables(){for(let e of this._varSpecs){if(this._vars.has(e.id))throw new Error(`Duplicate variable id "${e.id}". Ids must be unique \u2014 an expression writing "[${e.id}]" would otherwise name whichever declaration was read last.`);this._vars.set(e.id,this._liveVariable(e))}}_liveVariable(e){let t=new Jt(e.value,null,$r+e.id);return{spec:e,cell:t,read:()=>t.get(),target:this._variableTarget(e,t),baseline:e.value}}_variableTarget(e,t){let n=this._registry.requireLerp(e.lerp,e.value,`variable "${e.id}"`);return{id:e.id,get:()=>t.get(),set:s=>t.set(s),lerp:n}}_restoreBaselines(e=this._animated){this._restoreDisplaced(this._displaced);for(let t of this._animatedVars)t.cell.set(t.baseline);for(let t of e){let n=t.node;zr(n,t.baseline),n._stateStack.length>t.baseStackDepth&&(n._stateStack.length=t.baseStackDepth)}for(let t of this._animatedParts)t.restoreFrom(this._partBaselines.get(t))}_compileCommands(e){if(Et(this._doc))return;let t=new Set,n=uf(this._doc.commands),s=this._refBound(n),o=this._settleWindows(n,i=>this._readsLayout(n[i],s));for(let i=0;i<n.length;i++){let a=n[i];if(this.syncPresence(a.at)){for(let c of this._arrived)this._baselined.has(c.id)||this._baselineArrival(c.id);this._baselineMounted(),o[i]&&e()}let d=this._buildPlaced(a);this._placed.push(d),this._touch(d,t)}}_indexSettled(){let e=this._settled=On.build(this._placed);if(!e)return;this._restoreBaselines();let t=new Set,n=new Map;this._placed.forEach((s,o)=>{let i=e.holds(o);i||t.add(s.owner);for(let a of s.writes){let d=a._host,c=d===null?void 0:d.id===S?this._root:this._live.get(d.id);c&&(i?n.has(c)?n.get(c).add(a):n.set(c,new Set([a])):t.add(c))}}),this._wholeRestore=[],this._slotRestore=[];for(let s of this._animated){let o=t.has(s)?null:pf(s,n.get(s));o?this._slotRestore.push(...o):this._wholeRestore.push(s)}}_collectDisplaced(){let e=[];for(let t of this._present){let n=this._live.get(t),s=n&&this._declaredParent(t);n&&s&&n.node.parent!==s&&e.push(n)}return e.sort((t,n)=>this._presenceIndex().row(t.spec.id).slot-this._presenceIndex().row(n.spec.id).slot),this._displaced=e}_restoreDisplaced(e){let t=!1;for(let n of e){let s=n.spec.id,o=this._presenceIndex().row(s),i=this._declaredParent(s);if(!o||!i||!this._present.has(s)||n.node.parent===i)continue;n.node.parent?.remove(n.node);let a=this._baseChildCount.get(o.siblings.parentId)??0;i.addChildAt({data:{child:n.node,index:a+o.siblings.before(o.slot)}}),t=!0}return t}_declaredParent(e){let t=this._presenceIndex().row(e)?.siblings.parentId;if(t!==void 0)return t===S?this.canvas:this._live.get(t)?.node}_baselineArrival(e){let t=this._live.get(e);if(t&&!t.node.mounted){this._unmounted.add(e);return}t&&Ro(t),this._baselined.add(e),this._unmounted.delete(e)}_baselineMounted(){for(let e of this._unmounted){let t=this._live.get(e);t?t.node.mounted&&(Ro(t),this._baselined.add(e),this._unmounted.delete(e)):this._unmounted.delete(e)}}_buildPlaced(e){let t=this._registry.command(e.type);if(!t){let p=this._targetOrThrow(e).entry.spec.type,f=this._registry.nodeCommand(p,e.type);if(!f)throw new Error(`Node type "${p}" has no command "${e.type}" (command ${e.id}). It publishes: ${this._registry.commandKeys(p).join(", ")||"none"}.`+(yc[e.type]?` ${yc[e.type]}`:""));t={key:e.type,scope:"node",factory:f}}let n=e.duration??0,s=lf(e.easing,this._registry),o=new Io(this._notePartWrite),i=xi(e.loop)?e.loop:void 0,a=p=>p&&i?bi(p,i,this._unlimitedFill(e.at)):p;if(t.scope==="variable"){let p=e.targetId===null?void 0:this._vars.get(e.targetId);if(!p)throw new Error(`Command ${e.id} ("${e.type}") targets variable "${e.targetId}", which this document does not declare.`);this._assertNoExpressions(e);let{factory:f}=t,h=Ce(o,()=>gc(()=>a(f(p.target,e.args,n,s))));return{spec:e,start:e.at,duration:i?h.duration:n,command:h,writes:o.writes,readsLayout:o.readsLayout,owner:p}}let d=this._targetOrThrow(e),c=t.binds?this._bindArgs(e.args):(this._assertNoExpressions(e),e.args),{factory:l}=t,u=Ce(o,()=>gc(()=>a(l(d.node,c,n,s))));return{spec:e,start:e.at,duration:i?u.duration:n,command:u,writes:o.writes,readsLayout:o.readsLayout,owner:d.entry}}_unlimitedFill(e){return Math.max(0,this._duration-e)}_touch(e,t){this._touchOwner(e.owner,t);for(let n of e.writes){let s=n._host;if(s===null)continue;let o=s.id===S?this._root:this._live.get(s.id);o?this._touchOwner(o,t):this._partBaselines.has(n)&&!t.has(n)&&(t.add(n),this._animatedParts.push(n))}}_touchOwner(e,t){t.has(e)||(t.add(e),"cell"in e?this._animatedVars.push(e):this._animated.push(e))}_notePartWrite=e=>{let t=e._host;t===null||this._partBaselines.has(e)||t.id===S||this._live.has(t.id)||this._partBaselines.set(e,e.snapshot())};_bindArgs(e){let{literal:t,bindings:n}=Z.bindProps(e,this._resolveVariable,"args");return{...t,...n}}_assertNoExpressions(e){let t=Z.collect(e.args,"args");if(t.length===0)return;let{path:n,source:s}=t[0];throw new Error(`Command ${e.id} ("${e.type}") carries an expression at ${n}: ${JSON.stringify(s)}. Expressions bind a prop to a variable; they are not tween destinations. Bind the prop where the node is authored (or with a "set" command) and animate the variable with "variableTo" instead.`)}_targetOrThrow(e){let t=this._targetOf(e);if(!t)throw new Error(`Command ${e.id} ("${e.type}") targets node "${e.targetId}", which this document does not declare.`);return t}_targetOf(e){if(e.targetId===null)return this._root?{id:S,node:this._root.node,entry:this._root}:null;let t=this._live.get(e.targetId);return t?{id:e.targetId,node:t.node,entry:t}:null}_evaluateObserved(e,t){let n=0;Ce({read:()=>{},write:o=>t(n,o)},()=>{for(;n<this._placed.length;n++){let o=this._placed[n];if(e<o.start)continue;let i=o.duration>0?(e-o.start)/o.duration:1;o.command.at(Wt(i))}})}_settleWindows(e,t){let n=this._presenceIndex(),s=new Uint8Array(e.length),o=-1,i=n.time;for(let a=0;a<e.length;a++){let{at:d}=e[a];n.differs(i,d)&&(o=a),i=d,!(o<0||s[o])&&t(a)&&(s[o]=1)}return s}_readsLayout(e,t){let n=e.targetId??S,s=e.targetId===null?this._rootSpec:this._live.get(e.targetId)?.spec,o=Ao(this._registry,e,s);return o===null||o.readsLayout||t.has(n)}_refBound(e){let t=new Set;for(let n of e){let s=this._registry.command(n.type);s?.scope==="node"&&s.binds&&Mo(n.args)&&t.add(n.targetId??S)}return t}_presenceIndex(){return this._presence??=new En(this._specs,this._spans)}_parentNodeOf(e){return e.parentId===null?this.canvas:this._live.get(e.parentId)?.node}_patchEnvironment(){let e=this._registry;return{traits:(t,n)=>Ao(e,t,n),nodeRefs:(t,n)=>qd(e,t,n),isContextProvider:t=>Sn(e,t),isLayoutNeutralProp:(t,n)=>Oo(e,t,n),ctorOf:t=>this._live.get(t)?.node.constructor,registeredCtor:t=>e.node(t)?.ctor,dimensionOf:t=>e.node(t)?.descriptor.dimension}}_updateVariables(e){let{added:t,removed:n,changed:s}=e.diff.variables;for(let o of n)this._vars.delete(o);for(let o of t)this._vars.set(o,this._liveVariable(e.next.variables.get(o)));for(let o of s){let i=e.next.variables.get(o),a=this._vars.get(o);if(!a){this._vars.set(o,this._liveVariable(i));continue}a.baseline=i.value,a.target=this._variableTarget(i,a.cell)}for(let o of e.next.variables.values()){let i=this._vars.get(o.id);i&&(i.spec=o)}for(let o of e.dirtyVariables){let i=this._vars.get(o);i&&i.cell.set(i.baseline)}}_updateStructure(e){let{next:t}=e;for(let d of e.detach){let c=this._live.get(d);c&&(c.node.parent?.remove(c.node),c.presence.set(!1),this._present.delete(d))}let n=d=>this._live.get(d.id)?.node===d;for(let d of e.removed){let c=this._live.get(d);c&&($o(c.node,n),this._live.delete(d),this._baseChildCount.delete(d),this._baselined.delete(d),this._unmounted.delete(d))}for(let d of e.reinstantiate){let c=this._live.get(d);c&&$o(c.node,n)}let{root:s,rest:o}=hc(t.doc.nodes),i=new Set;for(let d of o){let c=this._live.get(d.id);if(c&&!e.reinstantiate.has(d.id)){c.spec=d;continue}let l=this._instantiate(d);c?(c.spec=d,c.node=l,this._baselined.delete(d.id),this._unmounted.delete(d.id)):(c={spec:d,node:l,initial:it,initialStackDepth:0,baseline:it,baseStackDepth:0,presence:new Jt(!1,null,et+d.id)},this._live.set(d.id,c)),this._baseChildCount.set(d.id,l._allChildren.length),i.add(c)}this._doc=t.doc,this._docIndex=t,this._rootSpec=s,this._root.spec=s,this._specs=o,this._varSpecs=t.doc.variables??[],this._spans=mc(t.doc),this._duration=Re(t.doc);let a=this._presence=new En(this._specs,this._spans);for(let d of[...this._present]){let c=a.row(d);if(c&&Cn(c,0)){c.siblings.add(c.slot,1);continue}this._present.delete(d);let l=this._live.get(d);l&&(l.presence.set(!1),l.node.parent?.remove(l.node))}return this.syncPresence(0),i}_walkPatch(e,t,n){let s=new Map;if(Et(this._doc))return s;let{next:o}=e,i=h=>e.dirtyNodes.has(h)||e.dirtyVariables.has(h),a=this._refBound(o.ordered),d=e.replay;d!=="all"&&[...a].some(i)&&(d="all");let c=[],{captures:l}=e,u=0;for(let h of o.ordered){for(;u<l.length&&l[u].at<=h.at;)c.push({at:l[u].at,capture:l[u++].id});let x=o.targetOf(h);(d==="all"||i(x)||d.has(x))&&c.push({at:h.at,spec:h})}for(;u<l.length;u++)c.push({at:l[u].at,capture:l[u].id});let p=this._settleWindows(c,h=>{let x=c[h].spec;return x!==void 0&&i(o.targetOf(x))&&this._readsLayout(x,a)}),f=!1;for(let h=0;h<c.length;h++){let x=c[h];if(p[h]&&(f=!0),this.syncPresence(x.at)&&this._baselineMounted(),x.capture!==void 0){this._baselined.delete(x.capture),this._baselineArrival(x.capture);continue}f&&(n(),f=!1);let y=x.spec,_=t.get(y.id);if(_&&!i(o.targetOf(y))){_.command.at(1);continue}s.set(y.id,this._buildPlaced(y))}return s}},yc={add:"A node is a row in `nodes`, entering at its `startAt`.",remove:"A node leaves at its `endAt`.",variable:"A variable is declared in `variables`."},it=new Map,Io=class{firstWrite;writes=new Set;readsLayout=!1;constructor(e){this.firstWrite=e}read(e){e._name===St&&(this.readsLayout=!0)}write(e){this.writes.has(e)||(this.firstWrite(e),this.writes.add(e))}};function gc(r){let e=r();return e?(e.at(1),e):pt(0,()=>{r()})}function Ro(r){let e=r.node;r.baseline=zs(e),r.baseStackDepth=e._stateStack.length}function pf(r,e){if(!e)return[];let t=r.node.__cells?.slots;if(!t)return null;let n=[];for(let[s,o]of t){let i=e.has(o)?r.baseline.get(s):void 0;i&&n.push({slot:o,baseline:i})}return n.length===e.size?n:null}function Tn(r){Ro(r),r.initial=r.baseline,r.initialStackDepth=r.baseStackDepth}function hf(r){let e=r.node;zr(e,r.initial),e._stateStack.length>r.initialStackDepth&&(e._stateStack.length=r.initialStackDepth),r.baseline=r.initial,r.baseStackDepth=r.initialStackDepth}function $o(r,e){for(let t of r._allChildren)e(t)||$o(t,e);r.dispose()}function Cn(r,e){return e>=r.start&&e<r.end}function _c(r,e){return r.order-e.order}var No=class{parentId;constructor(e,t){this.parentId=e,this._tree=new Int32Array(t+1)}add(e,t){for(let n=e+1;n<this._tree.length;n+=n&-n)this._tree[n]+=t}before(e){let t=0;for(let n=e;n>0;n-=n&-n)t+=this._tree[n];return t}_tree},En=class{time=-1/0;constructor(e,t){let n=new Map;e.forEach((s,o)=>{if(!t.has(s.id))return;let i=s.parentId??S,a=n.get(i);a?a.push({spec:s,order:o}):n.set(i,[{spec:s,order:o}])});for(let[s,o]of n){o.sort((a,d)=>a.spec.layerOrder-d.spec.layerOrder);let i=new No(s,o.length);o.forEach(({spec:a,order:d},c)=>{let{start:l,end:u}=t.get(a.id),p={id:a.id,start:l,end:u,order:d,slot:c,siblings:i,pass:0};this._rows.set(a.id,p),this._events.push({time:l,row:p}),Number.isFinite(u)&&this._events.push({time:u,row:p})})}this._events.sort((s,o)=>s.time-o.time)}crossed(e){this.time=e;let t=this._upperBound(e);if(t===this._cursor)return mf;let n=Math.min(t,this._cursor),s=Math.max(t,this._cursor);this._cursor=t;let o=++this._pass,i=[];for(let a=n;a<s;a++){let{row:d}=this._events[a];d.pass!==o&&(d.pass=o,i.push(d))}return i}differs(e,t){let n=this._upperBound(Math.min(e,t)),s=this._upperBound(Math.max(e,t));for(let o=n;o<s;o++){let{row:i}=this._events[o];if(Cn(i,e)!==Cn(i,t))return!0}return!1}row(e){return this._rows.get(e)}_events=[];_rows=new Map;_cursor=0;_pass=0;_upperBound(e){let t=0,n=this._events.length;for(;t<n;){let s=t+n>>>1;this._events[s].time<=e?t=s+1:n=s}return t}},mf=[];function Yb(r){return r.x===0&&r.y===0&&r.scale===1&&r.rotation===0}function yf(r){let e=r.fontFamily;if(typeof e=="string"&&e!=="")return e;let t=pa();if(t!=="")return t;let n=r.text?` drawing "${r.text.slice(0,32)}"`:"";throw new Error(`Text${n} has no fontFamily. Set one on the text itself, on an enclosing <DefaultTextStyle>, or as the theme's \`default\` typography preset \u2014 there is no fallback face.`)}function qb(r){let e=r.width??0,t=r.height??0,{x:n,y:s,pivot:o}=Gr(r,e,t);return{...Lr(r),opacity:r.opacity??1,rotation:r.rotation??0,scale:r.scale??1,x:n,y:s,start:r.start??0,end:r.end??1,pivot:At(o),text:r.text??"",fontSize:r.fontSize??48,fontFamily:yf(r),fontWeight:r.fontWeight??400,fontStyle:r.fontStyle??"normal",letterSpacing:r.letterSpacing??0,lineHeight:r.lineHeight??0,textAlign:r.textAlign??"center",verticalAlign:r.verticalAlign??"center",textDecoration:r.textDecoration??"none",wrap:r.wrap??!1,minFontSize:r.minFontSize??12,width:r.width??0,height:r.height??0,segments:r.segments,path:r.path??null}}function Hb(r){let e=r.width??0,t=r.height??0,{x:n,y:s,pivot:o}=Gr(r,e,t);return{...Lr(r),opacity:r.opacity??1,rotation:r.rotation??0,scale:r.scale??1,x:n,y:s,start:r.start??0,end:r.end??1,pivot:At(o),spans:r.spans??[],lineHeight:r.lineHeight??1.2,textAlign:r.textAlign??"center",width:e,height:t}}function Jb(r){return{x:r.x??0,y:r.y??0,width:r.width??0,height:r.height??0,opacity:r.opacity??1,blend:r.blend??"pass-through",rotation:r.rotation??0,scale:r.scale??1,effects:r.effects??[],pivot:r.pivot??{x:0,y:0},matrix:r.matrix}}function t0(r){return typeof r=="string"?r:r.map(e=>{switch(e.type){case"M":case"m":return`${e.type} ${e.x} ${e.y}`;case"L":case"l":return`${e.type} ${e.x} ${e.y}`;case"T":case"t":return`${e.type} ${e.x} ${e.y}`;case"H":case"h":return`${e.type} ${e.x}`;case"V":case"v":return`${e.type} ${e.y}`;case"C":case"c":return`${e.type} ${e.x1} ${e.y1} ${e.x2} ${e.y2} ${e.x} ${e.y}`;case"S":case"s":return`${e.type} ${e.x2} ${e.y2} ${e.x} ${e.y}`;case"Q":case"q":return`${e.type} ${e.x1} ${e.y1} ${e.x} ${e.y}`;case"A":case"a":return`${e.type} ${e.rx} ${e.ry} ${e.rotation} ${e.largeArc} ${e.sweep} ${e.x} ${e.y}`;case"Z":case"z":return e.type}}).join(" ")}function r0(r){return{opacity:r.opacity??1,rotation:r.rotation??0,scale:r.scale??1,x:r.x??0,y:r.y??0,start:r.start??0,end:r.end??1,width:r.width??0,height:r.height??0,pivot:At(r.pivot),data:r.data??"",centerBounds:r.centerBounds}}function zo(r){let e=r.lines[r.lines.length-1];return e?e.end+1:1}function wc(r){return typeof r?.layoutTextBlock=="function"?r:null}var gf={box:r=>({type:"box",...r}),sphere:r=>({type:"sphere",...r}),plane:r=>({type:"plane",...r}),cylinder:r=>({type:"cylinder",...r}),cone:r=>({type:"cone",...r}),torus:r=>({type:"torus",...r}),torusKnot:r=>({type:"torusKnot",...r}),circle:r=>({type:"circle",...r}),ring:r=>({type:"ring",...r}),capsule:r=>({type:"capsule",...r}),tetrahedron:r=>({type:"polyhedron",shape:"tetrahedron",...r}),octahedron:r=>({type:"polyhedron",shape:"octahedron",...r}),icosahedron:r=>({type:"polyhedron",shape:"icosahedron",...r}),dodecahedron:r=>({type:"polyhedron",shape:"dodecahedron",...r}),extrude:r=>({type:"extrude",...r}),lathe:r=>({type:"lathe",...r}),tube:r=>({type:"tube",...r}),buffer:r=>({type:"buffer",...r}),parametric:r=>({type:"parametric",...r}),edges:(r,e)=>({type:"edges",source:r,...e}),wireframe:r=>({type:"wireframe",source:r}),model:(r,e)=>({type:"modelGeometry",src:r,...e})},_f={basic:r=>({type:"basic",...r}),standard:r=>({type:"standard",...r}),physical:r=>({type:"physical",...r}),phong:r=>({type:"phong",...r}),lambert:r=>({type:"lambert",...r}),toon:r=>({type:"toon",...r}),normal:r=>({type:"normal",...r}),depth:r=>({type:"depth",...r}),matcap:r=>({type:"matcap",...r}),points:r=>({type:"points",...r}),lineBasic:r=>({type:"lineBasic",...r}),lineDashed:r=>({type:"lineDashed",...r}),sprite:r=>({type:"sprite",...r}),shadow:r=>({type:"shadow",...r}),shader:r=>({type:"shader",...r})},wf={image:(r,e)=>({src:r,...e}),data:(r,e,t,n)=>({data:r,width:e,height:t,...n}),surface:(r,e)=>({width:512,height:512,...e,source:r})};function xf(r,e){return r===void 0?e.map(Bo):typeof r=="number"?e.map(()=>Bo(r)):e.map((t,n)=>Bo(r[n]??t))}function Bo(r){return Math.max(1,Math.floor(r))}function vf(r,e){return e<=0?3:Math.max(3,Math.min(16,Math.round(r/e*40)))}function bf(r){let e=[r.width/2,r.height/2,r.depth/2],t=Math.max(e[0],e[1],e[2]),n=Math.max(0,Math.min(r.radius,e[0],e[1],e[2])),s=[Math.max(0,e[0]-n),Math.max(0,e[1]-n),Math.max(0,e[2]-n)],o=vf(n,t),i=[],a=[],d=[],c=[];for(let l of Sf(e,s,n,r.segments,o))kf(l,e,i,a,d,c);return{type:"buffer",position:new Float32Array(i),normal:new Float32Array(a),uv:new Float32Array(d),index:new Uint32Array(c),staticData:!0}}function*Sf(r,e,t,n,s){let o=[0,1,2],i=[-1,1];for(let a of o){let d=(a+1)%3,c=(a+2)%3;for(let l of i){let u=Mf(a,l);yield{uSteps:n[d],vSteps:n[c],normal:()=>u,position:(p,f)=>{let h=[0,0,0];return h[a]=l*r[a],h[d]=jo(-e[d],e[d],p),h[c]=jo(-e[c],e[c],f),h}}}}if(!(t<=0)){for(let a of o){let d=(a+1)%3,c=(a+2)%3;for(let l of i)for(let u of i)yield{uSteps:s,vSteps:n[a],normal:p=>{let f=p*Math.PI/2,h=[0,0,0];return h[d]=l*Math.cos(f),h[c]=u*Math.sin(f),h},position:(p,f)=>{let h=p*Math.PI/2,x=[0,0,0];return x[d]=l*(e[d]+t*Math.cos(h)),x[c]=u*(e[c]+t*Math.sin(h)),x[a]=jo(-e[a],e[a],f),x}}}for(let a of i)for(let d of i)for(let c of i){let l=[a*e[0],d*e[1],c*e[2]],u=(p,f)=>{let h=p*Math.PI/2,x=f*Math.PI/2;return[a*Math.sin(h)*Math.cos(x),d*Math.cos(h),c*Math.sin(h)*Math.sin(x)]};yield{uSteps:s,vSteps:s,normal:u,position:(p,f)=>{let h=u(p,f);return[l[0]+t*h[0],l[1]+t*h[1],l[2]+t*h[2]]}}}}}function kf(r,e,t,n,s,o){let i=t.length/3,a=r.uSteps+1,d=r.vSteps+1;for(let c=0;c<d;c++)for(let l=0;l<a;l++){let u=r.uSteps===0?0:l/r.uSteps,p=r.vSteps===0?0:c/r.vSteps,f=r.position(u,p),h=r.normal(u,p);t.push(f[0],f[1],f[2]),n.push(h[0],h[1],h[2]);let[x,y]=Af(f,h,e);s.push(x,y)}for(let c=0;c<r.vSteps;c++)for(let l=0;l<r.uSteps;l++){let u=i+c*a+l,p=u+1,f=u+a,h=f+1;xc(t,n,o,u,f,p),xc(t,n,o,p,f,h)}}function xc(r,e,t,n,s,o){let i=r[n*3],a=r[n*3+1],d=r[n*3+2],c=r[s*3],l=r[s*3+1],u=r[s*3+2],p=r[o*3],f=r[o*3+1],h=r[o*3+2],x=c-i,y=l-a,_=u-d,w=p-i,b=f-a,M=h-d,O=y*M-_*b,T=_*w-x*M,V=x*b-y*w;if(O*O+T*T+V*V<1e-20)return;O*e[n*3]+T*e[n*3+1]+V*e[n*3+2]>=0?t.push(n,s,o):t.push(n,o,s)}function Af(r,e,t){let n=Math.abs(e[0]),s=Math.abs(e[1]),o=Math.abs(e[2]),i=n>=s&&n>=o?0:s>=o?1:2,a=(i+1)%3,d=(i+2)%3;return[t[a]===0?.5:.5+r[a]/(2*t[a]),t[d]===0?.5:.5+r[d]/(2*t[d])]}function Mf(r,e){let t=[0,0,0];return t[r]=e,t}function jo(r,e,t){return r+(e-r)*t}function vc(r){return r===void 0||r===!0?!0:r===!1?!1:r==="cast"||typeof r=="object"}function Of(r){return r===void 0||r===!0?!0:r===!1?!1:r==="receive"||typeof r=="object"}function Tf(r){return vc(r)?typeof r=="object"?r:{}:null}function Go(r){return r===void 0?[1,1]:typeof r=="number"?[r,r]:[r[0]??1,r[1]??r[0]??1]}function Pf(r){if(r===void 0)return null;let e=typeof r=="number"?{size:r}:r,t=e.size??.1;return{size:t,thickness:e.thickness??t*2,offset:e.offset??0,segments:e.segments??3}}function Cf(r){let e=r.segments,[t,n]=typeof e=="number"?[e,e]:[e[0]??1,e[1]??e[0]??1],s=Math.max(1,Math.floor(t))+1,o=Math.max(1,Math.floor(n))+1,i=new Float32Array(s*o*3),a=new Float32Array(s*o*2),d=r.color?new Float32Array(s*o*3):void 0,c={x:0,y:0,z:0};for(let p=0;p<o;p++){let f=p/(o-1);for(let h=0;h<s;h++){let x=h/(s-1),y=p*s+h,_=r.vertex(x,f);if(Array.isArray(_))c.x=_[0],c.y=_[1],c.z=_[2];else{let w=_;c.x=w.x,c.y=w.y,c.z=w.z}if(i[y*3]=c.x,i[y*3+1]=c.y,i[y*3+2]=c.z,a[y*2]=x,a[y*2+1]=f,d&&r.color){let w=Ef(r.color(x,f,c));d[y*3]=w[0],d[y*3+1]=w[1],d[y*3+2]=w[2]}}}let l=new Uint32Array((s-1)*(o-1)*6),u=0;for(let p=0;p<o-1;p++)for(let f=0;f<s-1;f++){let h=p*s+f,x=h+1,y=h+s,_=y+1;l[u++]=h,l[u++]=y,l[u++]=x,l[u++]=x,l[u++]=y,l[u++]=_}return{type:"buffer",position:i,uv:a,color:d,index:l,computeNormals:r.computeNormals,params:r.params}}function Ef(r){let[e,t,n]=typeof r=="string"?vt(r):r;return[Lo(e),Lo(t),Lo(n)]}function Lo(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Dn(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function $e(r,e){let t=new Array(16);for(let n=0;n<4;n++){let s=e[n*4],o=e[n*4+1],i=e[n*4+2],a=e[n*4+3];t[n*4]=r[0]*s+r[4]*o+r[8]*i+r[12]*a,t[n*4+1]=r[1]*s+r[5]*o+r[9]*i+r[13]*a,t[n*4+2]=r[2]*s+r[6]*o+r[10]*i+r[14]*a,t[n*4+3]=r[3]*s+r[7]*o+r[11]*i+r[15]*a}return t}function Fn(r){let[e,t,n,s,o,i,a,d,c,l,u,p,f,h,x,y]=r,_=l*x*d-h*u*d+h*a*p-i*x*p-l*a*y+i*u*y,w=f*u*d-c*x*d-f*a*p+o*x*p+c*a*y-o*u*y,b=c*h*d-f*l*d+f*i*p-o*h*p-c*i*y+o*l*y,M=f*l*a-c*h*a-f*i*u+o*h*u+c*i*x-o*l*x,O=e*_+t*w+n*b+s*M;if(O===0)return null;let T=1/O;return[_*T,(h*u*s-l*x*s-h*n*p+t*x*p+l*n*y-t*u*y)*T,(i*x*s-h*a*s+h*n*d-t*x*d-i*n*y+t*a*y)*T,(l*a*s-i*u*s-l*n*d+t*u*d+i*n*p-t*a*p)*T,w*T,(c*x*s-f*u*s+f*n*p-e*x*p-c*n*y+e*u*y)*T,(f*a*s-o*x*s-f*n*d+e*x*d+o*n*y-e*a*y)*T,(o*u*s-c*a*s+c*n*d-e*u*d-o*n*p+e*a*p)*T,b*T,(f*l*s-c*h*s-f*t*p+e*h*p+c*t*y-e*l*y)*T,(o*h*s-f*i*s+f*t*d-e*h*d-o*t*y+e*i*y)*T,(c*i*s-o*l*s-c*t*d+e*l*d+o*t*p-e*i*p)*T,M*T,(c*h*n-f*l*n+f*t*u-e*h*u-c*t*x+e*l*x)*T,(f*i*n-o*h*n-f*t*a+e*h*a+o*t*x-e*i*x)*T,(o*l*n-c*i*n+c*t*a-e*l*a-o*t*u+e*i*u)*T]}function Ne(r,e){let{x:t,y:n,z:s}=e;return{x:r[0]*t+r[4]*n+r[8]*s+r[12],y:r[1]*t+r[5]*n+r[9]*s+r[13],z:r[2]*t+r[6]*n+r[10]*s+r[14],w:r[3]*t+r[7]*n+r[11]*s+r[15]}}function bc(r,e,t){let{x:n,y:s,z:o,w:i}=e,a=n+n,d=s+s,c=o+o,l=n*a,u=n*d,p=n*c,f=s*d,h=s*c,x=o*c,y=i*a,_=i*d,w=i*c;return[(1-(f+x))*t.x,(u+w)*t.x,(p-_)*t.x,0,(u-w)*t.y,(1-(l+x))*t.y,(h+y)*t.y,0,(p+_)*t.z,(h-y)*t.z,(1-(l+f))*t.z,0,r.x,r.y,r.z,1]}function pr(r,e,t=Df){let n=r.x-e.x,s=r.y-e.y,o=r.z-e.z,i=Math.hypot(n,s,o);i===0&&(o=1,i=1),n/=i,s/=i,o/=i;let a=t.y*o-t.z*s,d=t.z*n-t.x*o,c=t.x*s-t.y*n,l=Math.hypot(a,d,c);l===0&&(Math.abs(t.z)===1?n+=1e-4:o+=1e-4,i=Math.hypot(n,s,o),n/=i,s/=i,o/=i,a=t.y*o-t.z*s,d=t.z*n-t.x*o,c=t.x*s-t.y*n,l=Math.hypot(a,d,c)),a/=l,d/=l,c/=l;let u=s*c-o*d,p=o*a-n*c,f=n*d-s*a;return[a,d,c,0,u,p,f,0,n,s,o,0,0,0,0,1]}var Df={x:0,y:1,z:0};function hr(r,e){if(!r)return Dn();let t=me(r.position),n=me(r.scale===void 0?1:r.scale);if(r.lookAt!==void 0){let o=me(r.lookAt),i=e?Ne(e,t):{...t,w:1},a={x:i.x,y:i.y,z:i.z},d=pr(o,a);if(e){let c=Fn(Sc(e));c&&(d=$e(c,d))}return $e($e(mr(t),d),If(n))}let s=r.quaternion??Cs(Ff(r.rotation));return bc(t,s,n)}function Ff(r){return{...me(r),order:r?.order}}function mr(r){return[1,0,0,0,0,1,0,0,0,0,1,0,r.x,r.y,r.z,1]}function If(r){return[r.x,0,0,0,0,r.y,0,0,0,0,r.z,0,0,0,0,1]}function Sc(r){let e=Math.hypot(r[0],r[1],r[2])||1,t=Math.hypot(r[4],r[5],r[6])||1,n=Math.hypot(r[8],r[9],r[10])||1;return[r[0]/e,r[1]/e,r[2]/e,0,r[4]/t,r[5]/t,r[6]/t,0,r[8]/n,r[9]/n,r[10]/n,0,0,0,0,1]}function In(r,e,t,n,s){let o=t*Math.tan(r*Math.PI/360)/s,i=2*o,a=e*i,d=-.5*a;return Rf(d,d+a,o,o-i,t,n)}function Rf(r,e,t,n,s,o){let i=2*s/(e-r),a=2*s/(t-n),d=(e+r)/(e-r),c=(t+n)/(t-n),l=-(o+s)/(o-s),u=-2*o*s/(o-s);return[i,0,0,0,0,a,0,0,d,c,l,-1,0,0,u,0]}function Vo(r,e,t,n,s,o,i){let a=(e-r)/(2*i),d=(t-n)/(2*i),c=(e+r)/2,l=(t+n)/2,u=c-a,p=c+a,f=l+d,h=l-d,x=1/(p-u),y=1/(f-h),_=1/(o-s);return[2*x,0,0,0,0,2*y,0,0,0,0,-2*_,0,-(p+u)*x,-(f+h)*y,-(o+s)*_,1]}function pe(r,e,t){return{min:{x:-r,y:-e,z:-t},max:{x:r,y:e,z:t}}}function yr(r,e){return r?e?{min:{x:Math.min(r.min.x,e.min.x),y:Math.min(r.min.y,e.min.y),z:Math.min(r.min.z,e.min.z)},max:{x:Math.max(r.max.x,e.max.x),y:Math.max(r.max.y,e.max.y),z:Math.max(r.max.z,e.max.z)}}:r:e}function Rn(r){let{min:e,max:t}=r;return[{x:e.x,y:e.y,z:e.z},{x:t.x,y:e.y,z:e.z},{x:e.x,y:t.y,z:e.z},{x:t.x,y:t.y,z:e.z},{x:e.x,y:e.y,z:t.z},{x:t.x,y:e.y,z:t.z},{x:e.x,y:t.y,z:t.z},{x:t.x,y:t.y,z:t.z}]}function Nt(r,e){let t=1/0,n=1/0,s=1/0,o=-1/0,i=-1/0,a=-1/0;for(let d of Rn(r)){let c=Ne(e,d);c.x<t&&(t=c.x),c.y<n&&(n=c.y),c.z<s&&(s=c.z),c.x>o&&(o=c.x),c.y>i&&(i=c.y),c.z>a&&(a=c.z)}return{min:{x:t,y:n,z:s},max:{x:o,y:i,z:a}}}function $n(r){if(!r)return null;switch(r.type){case"box":return pe((r.width??1)/2,(r.height??1)/2,(r.depth??1)/2);case"sphere":return pe(r.radius??1,r.radius??1,r.radius??1);case"plane":return pe((r.width??1)/2,(r.height??1)/2,0);case"cylinder":{let[e,t]=Go(r.radius),n=Math.max(e,t);return pe(n,(r.height??1)/2,n)}case"cone":{let e=r.radius??1;return pe(e,(r.height??1)/2,e)}case"torus":{let e=r.radius??1,t=r.thickness??.4;return pe(e+t,e+t,t)}case"torusKnot":{let e=r.radius??1,t=r.thickness??.4;return pe(e*1.5+t,e*1.5+t,e*.5+t)}case"circle":return pe(r.radius??1,r.radius??1,0);case"ring":{let e=r.radius??1;return pe(e,e,0)}case"capsule":{let e=r.radius??.5;return pe(e,(r.height??1)/2+e,e)}case"polyhedron":{let e=r.radius??1;return pe(e,e,e)}case"lathe":{let e=0,t=1/0,n=-1/0;for(let s of r.points){let o=me(s);e=Math.max(e,Math.abs(o.x)),t=Math.min(t,o.y),n=Math.max(n,o.y)}return Number.isFinite(t)?{min:{x:-e,y:t,z:-e},max:{x:e,y:n,z:e}}:null}case"tube":{let e=r.points.map(n=>me(n)),t=$f(e);return t?zf(t,r.radius??1):null}case"buffer":return Nf(r.position);case"edges":case"wireframe":return $n(r.source);default:return null}}function $f(r){if(r.length===0)return null;let e=1/0,t=1/0,n=1/0,s=-1/0,o=-1/0,i=-1/0;for(let a of r)a.x<e&&(e=a.x),a.y<t&&(t=a.y),a.z<n&&(n=a.z),a.x>s&&(s=a.x),a.y>o&&(o=a.y),a.z>i&&(i=a.z);return{min:{x:e,y:t,z:n},max:{x:s,y:o,z:i}}}function Nf(r){if(r.length<3)return null;let e=1/0,t=1/0,n=1/0,s=-1/0,o=-1/0,i=-1/0;for(let a=0;a+2<r.length;a+=3){let d=r[a],c=r[a+1],l=r[a+2];d<e&&(e=d),c<t&&(t=c),l<n&&(n=l),d>s&&(s=d),c>o&&(o=c),l>i&&(i=l)}return{min:{x:e,y:t,z:n},max:{x:s,y:o,z:i}}}function zf(r,e){return{min:{x:r.min.x-e,y:r.min.y-e,z:r.min.z-e},max:{x:r.max.x+e,y:r.max.y+e,z:r.max.z+e}}}var Bf=["color","opacity","visible","emission","emissionStrength","roughness","metalness","shininess","specular","reflectivity","clearcoat","clearcoatRoughness","transmission","thickness","ior","sheen","sheenColor","sheenRoughness","iridescence","iridescenceIOR","specularIntensity","specularColor","anisotropy","anisotropyRotation","attenuationColor","attenuationDistance","aoMapIntensity","lightMapIntensity","envMapIntensity","normalScale","displacementScale","displacementBias","size","width","dashSize","gapSize","scale","rotation","depthWrite","depthTest","polygonOffsetFactor","polygonOffsetUnits"],jf=["transparent","alphaTest","faces","wireframe","blend","vertexColors","toneMapped","shading","dithering","polygonOffset","raw","extends","defines"];var Nn=class{onError;precomp;storageAdapter;audioDevice;lastAudioRequestKey="";lastAudioSrcs=new Set;audioFetching=new Map;audioFailed=new Map;audioReported=new Set;audioRequired=new Set;layoutGateKeys;disposed=!1;loaderDisposers=new Map;loaderInFlight=new Map;constructor(e,t,n,s=o=>console.error(`[AssetManager] ${o.message}`)){this.onError=s,this.precomp=e,this.layoutGateKeys=kc(e),this.storageAdapter=t,this.audioDevice=n}setPrecomp(e){this.precomp=e,this.layoutGateKeys=kc(e);for(let t of this.audioReported)this.audioFailed.delete(t);this.audioReported.clear(),this.lastAudioRequestKey=null,this.lastAudioSrcs=null}async loadAt(e){let t=[];for(let[n,s]of this.precomp.assets){if(s.record.type==="loader"){let o=this.syncLoader(n,s,e);o&&t.push(o);continue}s.cacheAt<=e&&s.record.endFrame>=e&&t.push(this.storageAdapter.loadAsset(n,s.record))}await Promise.all(t),this.audioDevice.schedulesAudio&&this.syncAudio(e)}isReady(e){return this.loaderDisposers.has(e)||this.storageAdapter.isLoaded(e)}async loadRecords(e){await Promise.all(e.map(t=>t.type==="loader"?this.runLoader(t.src,t.load):this.storageAdapter.loadAsset(t.src,t)))}prefetch(e){for(let[t,n]of this.precomp.assets){if(n.record.type==="loader"){this.syncLoader(t,n,e)?.catch(s=>{console.error(`[AssetManager] loader failed for ${t}:`,s)});continue}n.cacheAt<=e&&n.record.endFrame>=e&&this.storageAdapter.loadAsset(t,n.record).catch(s=>{console.error(`[AssetManager] prefetch failed for ${t}:`,s)})}}syncLoader(e,t,n){if(t.record.type!=="loader")return;let s=t.discardAt??1/0;if(!(t.cacheAt<=n&&n<=s)){if(this.layoutGateKeys.has(e))return;let i=this.loaderDisposers.get(e);i&&(this.loaderDisposers.delete(e),i());return}return this.runLoader(e,t.record.load)}runLoader(e,t){if(this.loaderDisposers.has(e))return;let n=this.loaderInFlight.get(e);if(n)return n;let s=t().then(o=>{this.loaderDisposers.set(e,o??Lf)}).finally(()=>{this.loaderInFlight.delete(e)});return this.loaderInFlight.set(e,s),s}dispose(){for(let e of this.loaderDisposers.values())e();this.loaderDisposers.clear(),this.loaderInFlight.clear(),this.disposed=!0}syncAudio(e){let t=e/this.precomp.fps,n=[],s=new Set,o=new Set,i=new Set,a=(c,l)=>{let u=l+c.startAt,p=l+c.endAt;if(p<t||u>t+10)return;c.optional||o.add(c.src);let f=Gf(c,l);i.has(f)||(i.add(f),n.push({...c,id:f,startAt:u,endAt:p,...c.bus&&{bus:c.bus.map(h=>({...h,startAt:l+h.startAt,endAt:l+h.endAt}))}}),s.add(c.src))};for(let c of this.precomp.tracks){let l=c.startFrame/this.precomp.fps;for(let u of c.audioRequests)a(u,l)}this.audioRequired=o;for(let c of s)if(!this.audioDevice.has(c)&&!this.audioFetching.has(c)&&!this.audioFailed.has(c)){let l=this.storageAdapter.fetchAudioData(c).then(u=>this.audioDevice.append(c,u)).catch(u=>this.failAudio(c,u)).finally(()=>this.audioFetching.delete(c));this.audioFetching.set(c,l)}for(let[c,l]of this.audioFailed)s.has(c)?o.has(c)&&this.reportAudio(c,l):(this.audioFailed.delete(c),this.audioReported.delete(c));let d=Kf(n);d!==this.lastAudioRequestKey&&(this.audioDevice.schedule(n),this.lastAudioRequestKey=d),(this.lastAudioSrcs===null||!Uf(this.lastAudioSrcs,s))&&(this.audioDevice.retain(s),this.lastAudioSrcs=s)}failAudio(e,t){this.disposed||(this.audioFailed.set(e,t),this.audioRequired.has(e)&&this.reportAudio(e,t))}reportAudio(e,t){if(this.audioReported.has(e))return;this.audioReported.add(e);let n=t instanceof Error?t.message:String(t);this.onError(new Error(`audio "${e}" could not be loaded: ${n}`,{cause:t}))}};function kc(r){let e=new Set;for(let t of r.tracks)for(let n of t.layoutGates??[])e.add(n);return e}var Lf=()=>{};function Gf(r,e){return`${r.src}|${e+r.startAt}|${e+r.endAt}|${r.trimStart}|${r.trimEnd??"_"}|${r.loop?1:0}|${r.volume}|${sr(r.filters)}|${Vf(r.bus)}`}function Vf(r){return!r||r.length===0?"":r.map(Qs).join(">")}function Kf(r){return r.length===0?"":r.map(e=>e.id).sort().join(`
|
|
10
|
-
`)}function Uf(r,e){if(r.size!==e.size)return!1;for(let t of r)if(!e.has(t))return!1;return!0}function Ac(r){switch(r.type){case"image":case"video":return r.src;case"font":return r.family;case"loader":return r.key}}function Yf(r){return typeof r=="number"?Number.isFinite(r)?r:400:typeof r=="string"&&parseInt(r,10)||400}var zn=class{catalog;constructor(e,t={}){this.catalog=e,this._options=t}get declarations(){return this._decls}image(e){!e||this._decls.has(e)||(this.catalog.getImageMeta(e),this._decls.set(e,{type:"image",src:e}))}video(e,t){!e||this._decls.has(e)||(this.catalog.getVideoMeta(e),this._decls.set(e,{type:"video",src:e,trimStart:t?.start??0,trimEnd:t?.end??this.catalog.getVideoDuration(e)}))}font(e,t){!e||this._decls.has(e)||this._decls.set(e,{type:"font",family:e,weight:Yf(t)})}loader(e,t,n){let s=n?.gate??"render",o=this._decls.get(e);if(o===void 0){this._decls.set(e,{type:"loader",key:e,load:t,gate:s});return}o.type==="loader"&&(o.load,s==="layout"&&o.gate!=="layout"&&this._decls.set(e,{...o,gate:s}))}fill(e){if(e){if(!Array.isArray(e)){gs(e,this);return}for(let t of e)gs(t,this)}}effects(e){if(e)for(let t of e)ui(t,this)}subtree(e){this._subtrees??=new Set,!this._subtrees.has(e)&&(this._subtrees.add(e),this._options.bindSubtree?.(e),this._options.onSubtree?this._options.onSubtree(e,this):to(e,this))}_options;_decls=new Map;_subtrees};function We(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function qf(){let r=globalThis.scheduler;return typeof r?.yield=="function"?r.yield.bind(r):void 0}var Xe=null,Ko=[];function Xf(){return typeof MessageChannel!="function"?null:(Xe||(Xe=new MessageChannel,Xe.port1.onmessage=()=>Ko.shift()?.(),Xe.port1.unref?.(),Xe.port2.unref?.()),new Promise(r=>{Ko.push(r),Xe.port2.postMessage(null)}))}function Bn(){let r=qf();return r?r():Xf()??new Promise(e=>setTimeout(e,0))}function LS(){Xe?.port1.close(),Xe?.port2.close(),Xe=null,Ko.length=0}function xt(r,e){return r*(1/e)}function He(r,e){let t=r*e,n=Math.round(t);return Math.abs(t-n)<=1e-9*Math.max(1,Math.abs(t))?n:t}function VS(r,e){return{kind:"frame",frame:Math.round(He(r,e))}}function zt(r,e){return typeof r!="number"||!Number.isFinite(r)?1:Math.max(1,Math.ceil(He(r,e)))}function gr(r,e){return r.map((t,n)=>{let s=Math.max(0,Math.round(He(t.startAt??0,e)));return{id:t.id,index:n,startFrame:s,endFrame:s+zt(t.duration,e)-1}})}function Mc(r){let e=0;for(let t of r)e=Math.max(e,t.endFrame+1);return e}function at(r,e){return r.filter(t=>e>=t.startFrame&&e<=t.endFrame)}function Ae(r,e,t){return Math.min(xt(r,e),t)}function Bt(r,e,t){let n=t-1,s=a=>Ae(a,e,1/0),o=Math.min(n+1,Math.max(0,Math.ceil(r.start*e)));for(;o>0&&s(o-1)>=r.start;)o--;for(;o<=n&&s(o)<r.start;)o++;let i=n;if(r.end!==1/0){for(i=Math.max(-1,Math.min(n,Math.ceil(r.end*e)));i>=0&&s(i)>=r.end;)i--;for(;i<n&&s(i+1)<r.end;)i++}return o<=i?{startFrame:o,endFrame:i}:null}var jn=class{_scope;canvas;constructor(e,t,n){this._scope=n,this._clip=e,this._duration=t,this._doc=Oc(e);let{width:s,height:o}=n.viewport;this.canvas=new D({id:S,width:s,height:o,flow:"freeform"}),this._timeline=new Pn(this._doc,n.registry,this.canvas),this._indexRows()}get duration(){return this._duration}get clip(){return this._clip}build(e=this._scope.measurer){this.attach(0),this._timeline.build(),this.sample(),this.layout(e),this._timeline.compile(()=>{this.sample(),this.layout(e)}),this.layout(e)}update(e,t){if(e===this._clip)return this._duration=t,!0;let n=this.planUpdate(e);return n?(this.applyUpdate(n,e,t),!0):!1}planUpdate(e){return this._timeline.planUpdate(Oc(e))}applyUpdate(e,t,n,s=this._scope.measurer){this.attach(0);let o=()=>{this.sample(),this.layout(s)};this._timeline.applyUpdate(e,o,o),this.layout(s),this._clip=t,this._doc=e.next.doc,this._duration=n,this._indexRows()}placedCommands(){return this._timeline.placedCommands()}commandSounds(){return this._timeline.commandSounds()}atPresence(e,t){let n=this._timeline.presenceTime;this._timeline.syncPresence(e);try{return t()}finally{this._timeline.syncPresence(n)}}evaluateAt(e,t){this._timeline.syncPresence(e),this._timeline.evaluateAt(e,t)}attach(e,t){this.canvas.attach({assets:this._scope.assets,context:Si.EMPTY,time:e}),ro(this.canvas,t)}layout(e=this._scope.measurer){let{width:t,height:n}=this._scope.viewport;this.canvas.layout({x:0,y:0,width:t,height:n},e)}render(e){this.canvas.render(e)}sample(){tn(this.canvas)}primeMotion(e){rn(this.canvas,e)}node(e){return this._timeline.liveNode(e)}baselineProps(e){return this._timeline.baselineProps(e)}rowSpans(){return[...this._rows.values()].map(e=>e.span)}rowSpan(e){return this._rows.get(e)?.span}ownerKeyOf(e){let t="";for(let n=e;;){if(n===this.canvas||this._timeline.liveNode(n.id)===n){let i=n===this.canvas?S:n.id;return t===""?i:`${i}/${t}`}let s=n.parent;if(!s)return;let o=s._allChildren.indexOf(n);t=t===""?String(o):`${o}.${t}`,n=s}}spanOf(e){for(let t=e;t;t=t.parent){if(t===this.canvas)return{start:0,end:this.duration};let n=this._rowSpan(t);if(n)return{...n}}}forEachOwner(e){let t=(n,s,o,i,a)=>{if(!n.mounted)return;let d=n===this.canvas?void 0:this._rowSpan(n);d&&(s=n.id,o="",i=d),e(n,o===""?s:`${s}/${o}`,i,a);let c=n._allChildren;for(let l=0;l<c.length;l++)t(c[l],s,o===""?String(l):`${o}.${l}`,i,Ke(a,l))};t(this.canvas,S,"",{start:0,end:this.duration},"")}dispose(){for(let e of this.canvas.children)e.dispose();this.canvas.dispose()}_clip;_doc;_duration;_timeline;_rows=new Map;_indexRows(){this._rows.clear();let e=gd(this._doc.nodes);for(let t of this._doc.nodes)t.id!==S&&this._rows.set(t.id,{parentId:t.parentId,span:e.get(t.id)})}_rowSpan(e){let t=this._rows.get(e.id);if(!t)return;let n=e.parent;return(t.parentId===null||t.parentId===S?n===this.canvas:n!==null&&n.id===t.parentId)?t.span:void 0}};function Oc(r){return Rt(r)}var Wf=new Set,_r=class{constructor(e){this._frameCount=Math.max(0,e)}setOwner(e,t){let n=new Set,s=this._owners.get(e);s&&this._unlink(e,s,n);let o={declared:new Map,learned:new Map};for(let i of t)i.endFrame>=i.startFrame&&Hf(o.declared,{...i});return o.declared.size>0?(this._owners.set(e,o),this._link(e,o,n)):this._owners.delete(e),this._refresh(n)}removeOwner(e){let t=this._owners.get(e);if(!t)return{keys:new Set};let n=new Set;return this._unlink(e,t,n),this._owners.delete(e),this._refresh(n)}learn(e,t,n){let s=Ac(t),o=this._owners.get(e);o||(o={declared:new Map,learned:new Map},this._owners.set(e,o));let i=o.learned.get(s)??[],a=i.findIndex(c=>n>=c.startFrame-1&&n<=c.endFrame+1);if(a<0)i.push({key:s,decl:t,startFrame:n,endFrame:n});else{let c=i[a];i[a]={...c,startFrame:Math.min(c.startFrame,n),endFrame:Math.max(c.endFrame,n)}}o.learned.set(s,i);let d=this._byKey.get(s);return d||this._byKey.set(s,d=new Set),d.add(e),this._refresh(new Set([s]))}setFrameCount(e){let t=Math.max(0,e);return t===this._frameCount?{keys:new Set}:(this._frameCount=t,this._refresh(new Set(this._byKey.keys())))}owners(e){return this._byKey.get(e)??Wf}segmentsOf(e){let t=this._owners.get(e);if(!t)return[];let n=[];for(let s of t.declared.values())n.push(...s);for(let s of t.learned.values())n.push(...s);return n}declaredSegmentsOf(e){let t=this._owners.get(e);if(!t)return[];let n=[];for(let s of t.declared.values())n.push(...s);return n}ownerKeys(){return this._owners.keys()}records(){return this._records}layoutGates(){if(this._layoutGates===null){let e=[];for(let t of this._entries.values())t.layout&&e.push(t.record);this._layoutGates=e}return this._layoutGates}_frameCount;_owners=new Map;_byKey=new Map;_entries=new Map;_records=new Map;_layoutGates=null;_link(e,t,n){for(let s of t.declared.keys()){let o=this._byKey.get(s);o||this._byKey.set(s,o=new Set),o.add(e),n.add(s)}}_unlink(e,t,n){for(let s of[t.declared,t.learned])for(let o of s.keys()){let i=this._byKey.get(o);i&&(i.delete(e),i.size===0&&this._byKey.delete(o)),n.add(o)}}_refresh(e){let t=new Set;for(let n of e){let s=this._entries.get(n),o=this._compute(n);if(o===void 0){if(s===void 0)continue;this._entries.delete(n),this._records.delete(n)}else{if(s!==void 0&&s.layout===o.layout&&Jf(s.record,o.record))continue;this._entries.set(n,o),this._records.set(n,o.record)}t.add(n)}return t.size>0&&(this._layoutGates=null),{keys:t}}_compute(e){let t=this._byKey.get(e);if(!t)return;let n=this._frameCount-1,s,o=1/0,i=-1/0,a=!1,d=c=>{if(c)for(let l of c){let u=Math.max(0,l.startFrame),p=Math.min(n,l.endFrame);p<u||(u<o&&(o=u,s=l),p>i&&(i=p),l.decl.type==="loader"&&l.decl.gate==="layout"&&(a=!0))}};for(let c of t){let l=this._owners.get(c);l&&(d(l.declared.get(e)),d(l.learned.get(e)))}if(s!==void 0)return{record:Zf(s.decl,o,i),layout:s.decl.type==="font"||a}}};function Hf(r,e){let t=r.get(e.key);t?t.push(e):r.set(e.key,[e])}function Zf(r,e,t){switch(r.type){case"image":return{type:"image",startFrame:e,endFrame:t,src:r.src};case"video":return{type:"video",startFrame:e,endFrame:t,src:r.src,trimStart:r.trimStart,trimEnd:r.trimEnd};case"font":return{type:"font",startFrame:e,endFrame:t,fontWeight:r.weight,fontFamily:r.family,src:r.family};case"loader":return{type:"loader",src:r.key,startFrame:e,endFrame:t,load:r.load}}}function Jf(r,e){if(r.type!==e.type||r.src!==e.src||r.startFrame!==e.startFrame||r.endFrame!==e.endFrame)return!1;switch(r.type){case"video":{let t=e;return r.trimStart===t.trimStart&&r.trimEnd===t.trimEnd}case"font":return r.fontWeight===e.fontWeight;case"loader":return r.load===e.load;default:return!0}}function*Yo(r,e){let t=new Uo(r,e);for(;t.step();)yield;return t.result()}var Tc=3,Uo=class{_instance;_options;constructor(e,t){this._instance=e,this._options=t,this._last=t.frameCount-1;let{owners:n,below:s}=t,o=n!==void 0||s!==void 0;if(!(this._last<0||o&&(n?.size??0)+(s?.size??0)===0)){if(o){this._start=1/0;for(let i of[...n?.values()??[],...s?.values()??[]])this._start=Math.min(this._start,Math.max(0,i))}if(!(this._start>this._last)){this._walked=this._start-1,this._placed=e.placedCommands().map(i=>({id:i.spec.id,...this._activeFrames(i.start,i.duration),writes:new Set(i.writes)}));for(let i=0;i<this._placed.length;i++)for(let a of this._placed[i].writes)this._addWriter(a,i);this._enqueue(this._start);for(let i of this._structureSpans()){let a=Bt(i,t.fps,t.frameCount);a&&(this._structureFrame(a.startFrame),this._structureFrame(a.endFrame+1))}for(let i of this._placed)[...i.writes].some(Ln)&&this._forEachDueFrame(i,this._start,a=>this._structureFrame(a))}}}step(){let e=op(this._heap);return e===void 0?!1:(this._queued.delete(e),this._frame=e,this._dueTaken=!1,this._evaluate(e),this._declareDue(e),this._heap.length>0)}result(){let e=new Map,t=new Map;for(let n of this._owners.values()){let s=n.present?[...n.intervals,[n.arrivedAt,1/0]]:n.intervals;e.set(n.key,{ownerKey:n.key,nodeId:n.node.id,segments:n.error?[]:rp(n.history,s),deps:n.allDeps,...n.error&&{error:n.error}});for(let o of n.allDeps){let i=t.get(o);i||t.set(o,i=new Set),i.add(n.key)}}for(let n of this._options.owners?.keys()??[])e.has(n)||e.set(n,{ownerKey:n,nodeId:void 0,segments:[],deps:new Set});return{owners:e,readers:t}}_last;_start=0;_walked=-1;_placed=[];_writers=new Map;_heap=[];_queued=new Set;_due=new Map;_structureFrames=new Set;_owners=new Map;_readers=new Map;_pseudo=new Set;_rewound=new Set;_frame=-1;_dueTaken=!1;_dev=np();_presenceObserver={read:()=>{},write:e=>{Ln(e)&&this._pseudo.add(e)}};_structureSpans(){let{owners:e,below:t}=this._options;if(e===void 0&&t===void 0)return this._instance.rowSpans();let n=new Set(t?.keys());for(let o of e?.keys()??[]){let i=o.indexOf("/");n.add(i<0?o:o.slice(0,i))}let s=[];for(let o of n){let i=this._instance.rowSpan(o);i&&s.push(i)}return s}_activeFrames(e,t){let{fps:n}=this._options,s=e+Math.max(0,t),o=Math.max(0,Math.ceil(e*n));for(;o>0&&Ae(o-1,n,1/0)>=e;)o--;for(;Ae(o,n,1/0)<e;)o++;let i=Math.max(-1,Math.floor(s*n));for(;Ae(i+1,n,1/0)<=s;)i++;for(;i>=0&&Ae(i,n,1/0)>s;)i--;return{from:o,to:i}}_evaluate(e){this._options.onPhase?.("evaluate");let t=Ae(e,this._options.fps,this._instance.duration);if(e>this._walked&&(e===this._start||this._structureFrames.has(e))&&this._instance.attach(t),this._pseudo.clear(),Ce(this._presenceObserver,()=>this._instance.evaluateAt(t,(n,s)=>{Ln(s)&&this._pseudo.add(s),this._commandWrote(n,s)})),!(e<=this._walked)){(e===this._start||this._pseudo.size>0)&&this._reconcile(e);for(let n of this._pseudo)for(let s of this._readers.get(n)??[])s.stale=!0,this._queueOwner(s,e);this._walked=e}}_reconcile(e){let t=new Set;this._instance.forEachOwner((n,s,o)=>{let i=this._limitOf(s);if(i===void 0)return;let a=this._owners.get(s);a||(a={key:s,node:n,span:o,from:i,present:!1,arrivedAt:-1,arrived:!1,intervals:[],history:[],deps:null,values:[],stale:!0,allDeps:new Set,scheduled:new Set,rounds:0},this._owners.set(s,a)),t.add(a),a.node!==n&&(a.node=n,a.stale=!0,a.present&&this._queueOwner(a,Math.max(e,a.from))),!a.present&&(a.present=!0,a.arrivedAt=Math.max(e,a.from),a.stale=!0,this._queueOwner(a,a.arrivedAt),a.arrived||(a.arrived=!0,this._options.onArrive?.(n,s,o,e)))});for(let n of this._owners.values())!n.present||t.has(n)||(e-1>=n.arrivedAt&&n.intervals.push([n.arrivedAt,e-1]),n.present=!1)}_limitOf(e){let{owners:t,below:n}=this._options;if(t===void 0&&n===void 0)return this._start;let s=t?.get(e);if(n)for(let o=e.indexOf("/");o>=0;o=e.indexOf("/",o+1)){let i=n.get(e.slice(0,o));i!==void 0&&(s===void 0||i<s)&&(s=i)}return s}_declareDue(e){this._dueTaken=!0;let t=this._due.get(e);if(this._due.delete(e),this._options.declare!==!1){for(let n of t??[])n.error||this._rewound.has(n)||!Qf(n,e)||!n.stale&&ep(n)||this._declare(n,e);for(let n of this._rewound)this._queueOwner(n,e);this._rewound.clear()}}_declare(e,t){this._options.onPhase?.("declare");let n=e.node,s=new Set,o=[],i,a=!1,d=!1,c=this._options.bindSubtree??(f=>ga(n,f)),l=new zn(this._options.catalog,{bindSubtree:f=>Nr(()=>c(f))});try{Ce({read:f=>{s.add(f),i=f,f._name===St&&(a=!0)},write:f=>{o.push(f)},clock:()=>{d=!0}},()=>eo(n,l))}catch(f){let h=f instanceof Error?f:new Error(String(f));e.error={message:h.message,stack:h.stack,...i&&{prop:Qt(i)}};return}if(this._dev){let f=n.constructor.name;if(o.length>0){let h=[...new Set(o.map(Qt))].join(", ");wr(`${f}:write:${h}`,`[assets] ${f} wrote ${h} while declaring its assets. A declaration is re-run only when something it read changes, so a write there is a frame-order dependency.`)}a&&wr(`${f}:layout`,`[assets] ${f}.declareAssets read layoutBounds. Declarations run without layout; decode size follows the draw, so declare the asset without a size.`),d&&wr(`${f}:clock`,`[assets] ${f}.declareAssets read time. Declarations are re-run only when a prop they read changes, so anything following the clock is missed between those frames.`)}e.stale=!1,e.deps=[...s],e.values=e.deps.map(f=>f.get());for(let f of s){if(e.allDeps.has(f))continue;e.allDeps.add(f);let h=this._readers.get(f);h||this._readers.set(f,h=new Set),h.add(e)}let u=l.declarations,p=e.history[e.history.length-1];(!p||p.frame<e.arrivedAt||!tp(p.decls,u))&&e.history.push({frame:t,decls:u}),this._scheduleWriters(e,t+1)}_scheduleWriters(e,t){for(let n of e.deps??[]){let s=this._writers.get(n);if(s)for(let o of s)e.scheduled.has(o)||(e.scheduled.add(o),this._forEachDueFrame(this._placed[o],t,i=>this._queueOwner(e,i)))}}_forEachDueFrame(e,t,n){let s=Math.max(t,e.from),o=Math.min(this._last,e.to);for(let a=s;a<=o;a++)n(a);let i=Math.max(e.to+1,e.from);i>=t&&i<=this._last&&n(i)}_commandWrote(e,t){let n=this._placed[e];if(!(!n||n.writes.has(t))){n.writes.add(t),this._addWriter(t,e),this._dev&&wr(`command:${n.id}:${Qt(t)}`,`[assets] Command ${n.id} wrote ${Qt(t)} at frame ${this._frame}, which compile did not record it writing. Owners reading it are re-declared over the command's span.`);for(let s of this._readers.get(t)??[])this._requeue(s,Math.max(n.from,s.from),n.id)}}_requeue(e,t,n){if(!e.error){if(t>this._frame){this._scheduleWriters(e,t);return}if(t===this._frame){this._queueOwner(e,t);return}if(e.rounds>=Tc){this._dev&&wr(`requeue:${e.key}`,`[assets] ${e.key} was re-queued ${Tc} times (last by command ${n}); its asset windows may be incomplete.`);return}e.rounds++,e.history=e.history.filter(s=>s.frame<t),e.stale=!0,e.scheduled.clear(),this._queueOwner(e,t);for(let[s]of e.intervals)s>t&&this._queueOwner(e,s);if(e.present&&e.arrivedAt>t&&this._queueOwner(e,e.arrivedAt),e.deps?.some(Ln))for(let s of this._structureFrames)s>=t&&s<=this._walked&&this._queueOwner(e,s);this._rewound.add(e)}}_addWriter(e,t){let n=this._writers.get(e);n?n.push(t):this._writers.set(e,[t])}_structureFrame(e){e<=this._start||e>this._last||(this._structureFrames.add(e),this._enqueue(e))}_queueOwner(e,t){if(t>this._last)return;let n=this._due.get(t);n||this._due.set(t,n=new Set),n.add(e),this._enqueue(t)}_enqueue(e){this._queued.has(e)||e===this._frame&&!this._dueTaken||(this._queued.add(e),sp(this._heap,e))}};function Ln(r){return r._name===ft||r._name.startsWith(et)}function Qf(r,e){if(r.present&&e>=r.arrivedAt)return!0;for(let[t,n]of r.intervals)if(e>=t&&e<=n)return!0;return!1}function ep(r){let e=r.deps;if(e===null)return!1;for(let t=0;t<e.length;t++)if(!Object.is(e[t].get(),r.values[t]))return!1;return!0}function tp(r,e){if(r.size!==e.size)return!1;for(let[t,n]of r){let s=e.get(t);if(!s||!Cc(n,s))return!1}return!0}function Cc(r,e){switch(r.type){case"image":return e.type==="image"&&r.src===e.src;case"video":return e.type==="video"&&r.src===e.src&&r.trimStart===e.trimStart&&r.trimEnd===e.trimEnd;case"font":return e.type==="font"&&r.family===e.family;case"loader":return e.type==="loader"&&r.key===e.key&&r.load===e.load&&r.gate===e.gate}}function rp(r,e){let t=[];for(let[n,s]of e){let o=new Map;for(let i of r)if(!(i.frame<n||i.frame>s)){for(let[a,d]of o){let c=i.decls.get(a);c&&Cc(d.decl,c)||(t.push({...d,endFrame:i.frame-1}),o.delete(a))}for(let[a,d]of i.decls)o.has(a)||o.set(a,{key:a,decl:d,startFrame:i.frame,endFrame:s})}for(let i of o.values())t.push({...i,endFrame:s})}return t}function np(){return!1}var Pc=new Set;function wr(r,e){Pc.has(r)||(Pc.add(r),console.warn(e))}function sp(r,e){let t=r.length;for(r.push(e);t>0;){let n=t-1>>1;if(r[n]<=e)break;r[t]=r[n],t=n}r[t]=e}function op(r){if(r.length===0)return;let e=r[0],t=r.pop();if(r.length===0)return e;let n=0;for(;;){let s=2*n+1;if(s>=r.length)break;let o=s+1,i=o<r.length&&r[o]<r[s]?o:s;if(r[i]>=t)break;r[n]=r[i],n=i}return r[n]=t,e}var Wo="",Kn="",Un="";function Vn(r,e){return r+Wo+e}function Ec(r){return Kn+r}function Dc(r){if(!(r.startsWith(Kn)||r.startsWith(Un)))return r.slice(0,r.lastIndexOf(Wo))}function Xo(r){return r.startsWith(Kn)||r.startsWith(Un)?r.slice(1):r.slice(r.lastIndexOf(Wo)+1)}var Lt=class{_instance;constructor(e){this._instance=e}idOf(e){let t=e._host;if(t===null)return Kn+e._name;let n=this._keys.get(t);return n===void 0&&(n=t instanceof kt?this._instance.ownerKeyOf(t)??null:null,this._keys.set(t,n)),n===null?Un+e._name:Vn(n,e._name)}idsOf(e){let t=[];for(let n of e)t.push(this.idOf(n));return t}_keys=new Map};function Gn(r){let e=[];for(let t=r.indexOf("/");t>=0;t=r.indexOf("/",t+1))e.push(r.slice(0,t));return e}function xr(r,e,t){let n=r.get(e);n||r.set(e,n=new Set),n.add(t)}function vr(r,e,t){let n=r.get(e);return!n||(n.delete(t),n.size>0)?!1:(r.delete(e),!0)}var jt=new Set,br=class{set(e,t){this.remove(e);let n=new Set(t);this._deps.set(e,n);for(let s of Gn(e))xr(this._ownersBelow,s,e);for(let s of n)this._readers.has(s)||this._index(s),xr(this._readers,s,e)}remove(e){let t=this._deps.get(e);if(t){this._deps.delete(e);for(let n of Gn(e))vr(this._ownersBelow,n,e);for(let n of t)vr(this._readers,n,e)&&this._unindex(n)}}has(e){return this._deps.has(e)}depsOf(e){return this._deps.get(e)??jt}readersOf(e){return this._readers.get(e)??jt}ownersBelow(e){return this._ownersBelow.get(e)??jt}slotsHostedBy(e){return this._byHost.get(e)??jt}*slotsHostedBelow(e){for(let t of this._hostsBelow.get(e)??jt)yield*this.slotsHostedBy(t)}slotsNamed(e){return this._byName.get(e)??jt}_deps=new Map;_readers=new Map;_ownersBelow=new Map;_byHost=new Map;_hostsBelow=new Map;_byName=new Map;_index(e){xr(this._byName,Xo(e),e);let t=Dc(e);if(t!==void 0){xr(this._byHost,t,e);for(let n of Gn(t))xr(this._hostsBelow,n,t)}}_unindex(e){vr(this._byName,Xo(e),e);let t=Dc(e);if(t!==void 0&&vr(this._byHost,t,e))for(let n of Gn(t))vr(this._hostsBelow,n,t)}};function Fc(r){let{patch:e,deps:t,fps:n}=r,{prev:s,next:o,diff:i}=e,a={owners:new Map,below:new Map,removed:new Set,arrivalOwners:new Set,arrivalBelow:new Set},d=(y,_,w)=>{let b=y.get(_);(b===void 0||w<b)&&y.set(_,w)},c=(y,_,w)=>{d(a.owners,y,_),w&&a.arrivalOwners.add(y)},l=(y,_,w)=>{for(let b of t.readersOf(y))c(b,_,w)},u=(y,_)=>{!r.buildsChildren(y)&&t.ownersBelow(y).size===0||(d(a.below,y,_),a.arrivalBelow.add(y))},p=(y,_)=>{let w=y.effSpan(_);return w?qo(w.start,n):1/0},f=(y,_)=>{l(Ec(et+y),_,!0),l(Vn(y,ft),_,!0);for(let w of[s,o]){let b=w.nodes.get(y);b&&l(Vn(b.parentId??S,ft),_,!0)}},h=(y,_,w)=>{for(let b of t.slotsHostedBy(y)){let M=Xo(b);(w===null||w.has(M)||M===ft)&&l(b,_,!0)}for(let b of t.slotsHostedBelow(y))l(b,_,!0)};for(let[y,_]of r.before){if(r.after.has(y))continue;let w=qo(_.start,n);for(let b of _.writes)l(b,w,!1)}for(let[y,_]of r.after){if(r.before.has(y))continue;let w=qo(_.start,n);for(let b of _.writes)l(b,w,!1)}for(let y of i.variables.changed)l(Ec($r+y),0,!0);if(e.layoutChanged)for(let y of t.slotsNamed(St))l(y,0,!0);for(let y of i.nodes.reorderedParents)l(Vn(y,ft),0,!0);for(let y of i.nodes.removed){let _=p(s,y);a.removed.add(y),f(y,_),h(y,_,null)}for(let y of i.nodes.added){let _=p(o,y);_!==1/0&&(c(y,_,!0),u(y,_),f(y,_))}for(let y of o.nodes.keys()){if(y===S||!s.nodes.has(y))continue;let _=s.effSpan(y),w=o.effSpan(y);if(_?.start===w?.start&&_?.end===w?.end)continue;let b=Math.min(p(s,y),p(o,y));b!==1/0&&(c(y,b,!0),u(y,b),f(y,b))}let x=new Set([...e.reinstantiate,...i.nodes.added,...i.nodes.removed]);for(let y of e.reinstantiate){let _=ip(y,r,x);h(y,0,_),u(y,0);for(let w of[y,...t.ownersBelow(y)])for(let b of t.depsOf(w))if(b.startsWith(Un)){c(w,0,!0);break}i.nodes.moved.has(y)&&f(y,0)}if(i.rootChanged){let y=r.propsOf(S);h(S,0,y?Ic(s.nodes.get(S),o.nodes.get(S),y):null)}return a}function ip(r,e,t){let{prev:n,next:s,diff:o}=e.patch,i=n.nodes.get(r),a=s.nodes.get(r);if(!i||!a||!o.nodes.respec.has(r)||o.nodes.moved.has(r)||i.type!==a.type||i.key!==a.key)return null;for(let c of[n,s])if(ap(c,r,t,e))return null;let d=e.propsOf(r);return d?Ic(i,a,d):null}function Ic(r,e,t){let n=new Set;for(let s of new Set([...Object.keys(r.props),...Object.keys(e.props)]))if(!le(r.props[s],e.props[s])){if(!t.has(s))return null;n.add(s)}return n}function ap(r,e,t,n){let s=new Set([e]),o=r.nodes.get(e)?.parentId??null;for(;o!==null&&o!==S&&!s.has(o);){s.add(o);let i=r.nodes.get(o);if(!i)return!1;if(t.has(o)&&n.isContextProvider(i.type))return!0;o=i.parentId}return!1}function qo(r,e){if(!(r>0))return 0;if(!Number.isFinite(r))return 1/0;let t=Math.max(0,Math.ceil(r*e));for(;t>0&&Ae(t-1,e,1/0)>=r;)t--;for(;Ae(t,e,1/0)<r;)t++;return t}var Sr=class{setOwner(e,t){if(t.length===0)return this.removeOwner(e);let n=this._owners.get(e);return n&&Nc(n,t)?!1:(this._owners.set(e,t),!0)}removeOwner(e){return this._owners.delete(e)}requests(){let e=[];for(let t of this._owners.values())e.push(...t);return e}_owners=new Map};function Rc(r){return r.declareAudio!==kt.prototype.declareAudio}function $c(r,e,t,n,s){let o=[];return r.declareAudio({catalog:t,span:{start:e.start,end:e.end},clip(i){let a={...i,at:i.at??e.start,until:i.until??e.end};o.push(Jr(a,t,n,o.length))},_spanOf(i){let a=s(i);if(!a)throw new Error(`${i.className} is not in the tree declaring "${n}"'s audio, so it has no span.`);return{start:a.start,end:a.end}}}),o}function Nc(r,e){if(Object.is(r,e))return!0;if(typeof r!="object"||typeof e!="object"||r===null||e===null||Object.getPrototypeOf(r)!==Object.getPrototypeOf(e))return!1;let t=Object.keys(r);if(t.length!==Object.keys(e).length)return!1;for(let n of t)if(!Nc(r[n],e[n]))return!1;return!0}var dp="@commands",Ar=8,dt=class{_scope;constructor(e,t,n={}){this._scope=t,this._options=n,this._refine=n.assets!==!1?"assets":n.audio!==!1?"audio":"none",this._project=e;for(let s of e.tracks)this._entries.set(s.id,this._fresh(s));this._spans=gr(e.tracks,t.fps)}get project(){return this._project}get tracks(){return this._project.tracks}get spans(){return this._spans}get version(){return this._version}get profile(){return this._options.profile}setProject(e){let t={deltas:new Map,rebuilt:[]};if(this._disposed||e===this._project)return t;let n=!le(this._project.theme,e.theme);this._project=e;let s=this._entries;this._entries=new Map;for(let a of e.tracks){let d=s.get(a.id),c=d&&!n?this._reconcile(d,a,t):this._fresh(a);d&&c!==d&&t.rebuilt.push(a.id),this._entries.set(a.id,c)}let o=t.rebuilt.length>0||s.size!==this._entries.size;for(let[a,d]of s)this._entries.get(a)!==d&&(this._discard(d),o=!0);let i=gr(e.tracks,this._scope.fps);return(o||!pp(i,this._spans))&&this._version++,this._spans=i,t}reset(){if(this._disposed)return;let e=this._entries;this._entries=new Map;for(let t of this._project.tracks)this._entries.set(t.id,this._fresh(t));for(let t of e.values())this._discard(t);this._version++}ensureBuilt(e){let t=this._entries.get(e);return!t||t.running||this._disposed?null:(t.steps&&this._drain(t),!t.instance&&!t.failure&&(this._start(t,!0,this._refine!=="none"&&!t.discovered),this._drain(t)),t.instance)}discover(e){let t=this._entries.get(e);if(!(!t||t.running||this._disposed)){if(this._refine==="none"){this.ensureBuilt(e);return}t.discovered||(t.steps||this._start(t,!t.instance,!0),this._drain(t))}}async runAsync(e={}){let{budgetMs:t=Ar,isCancelled:n,onProgress:s}=e;if(this._refine!=="none")for(;;){if(this._disposed||n?.())return;let o=this._nextUndiscovered();if(!o)return;o.steps||this._start(o,!o.instance,!0);let i=We()+t,a=this._step(o);for(;!a;){if(We()>=i){if(o.profile?.suspend(),await Bn(),this._disposed||n?.())return;if(o.discarded||!o.steps)break;o.profile?.resume(),i=We()+t}a=this._step(o)}!o.discarded&&o.discovered&&s?.()}}instanceOf(e){let t=this._entries.get(e);return t&&!t.steps?t.instance:null}generationOf(e){return this._entries.get(e)?.generation??-1}failed(e){return!!this._entries.get(e)?.failure}isDiscovered(e){return!!this._entries.get(e)?.discovered}trackAssets(e){return this._entries.get(e)?.discovered??void 0}errorsOf(e){let t=this._entries.get(e);return t?.discovered?t.errors:[]}ownersOf(e,t){return this._entries.get(e)?.index.owners(t)??new Set}layoutGates(e){let t=this._entries.get(e);return t?.discovered?t.index.layoutGates():[]}learn(e,t,n,s){let o=this._entries.get(e);return!o?.discovered||o.index.learn(t,n,s).keys.size===0?!1:this._refresh(o)}settleGates(e){let t=this._options.isReady;if(!t)return!1;let n=!1;for(let s of e){let o=this._entries.get(s);if(!o||o.unready.size===0||!o.instance||o.steps||o.running)continue;let i=o.discovered?new Set(o.index.layoutGates().map(d=>d.src)):null,a=!1;for(let d of[...o.unready])i&&!i.has(d)?o.unready.delete(d):t(d)&&(a=!0);a&&(this._rebuildInstance(o),n=!0)}return n}rebuild(e){let t=this._entries.get(e);!t||t.running||t.steps||(t.instance?.dispose(),t.instance=null,t.unready.clear(),t.generation++,t.failure&&(t.failure=null,t.discovered=null,this._version++))}release(e){let t=this._entries.get(e);!t||!t.instance||t.running||t.steps||!t.discovered||(t.instance.dispose(),t.instance=null,t.generation++)}trim(e,t){for(let n=0;n<this._spans.length;n++){let s=this._spans[n];s.endFrame>=e-t&&s.startFrame<=e+t||this.release(s.id)}}dispose(){this._disposed=!0;for(let e of this._entries.values())this._discard(e)}_options;_refine;_project;_entries=new Map;_spans;_version=0;_disposed=!1;_fresh(e){let t=zt(e.duration,this._scope.fps);return{track:e,frameCount:t,instance:null,steps:null,running:!1,discarded:!1,profile:void 0,discovered:null,errors:[],index:new _r(t),audio:new Sr,commandAudio:new Set,commandSounds:null,deps:new br,assetDeps:new Map,audioDeps:new Map,ownerErrors:new Map,audioErrors:new Map,failure:null,refineError:null,generation:0,writes:new WeakMap,unready:new Set}}_reconcile(e,t,n){let s=zt(t.duration,this._scope.fps);if(e.track.clip===t.clip)return this._resize(e,t,s);if(e.steps||e.failure)return this._fresh(t);if(!e.instance)return e.discovered&&kn(e.track.clip,t.clip).identical?this._resize(e,t,s):this._fresh(t);let o=e.instance,i;try{i=o.planUpdate(t.clip)}catch{i=null}if(!i)return this._fresh(t);if(i.diff.identical)return this._resize(e,t,s);let a=e.discovered!==null&&this._refine!=="none",d=a?this._placedWrites(e):void 0;try{this._compile(e,u=>o.applyUpdate(i,t.clip,t.duration,u))}catch{return this._fresh(t)}if(e.generation++,e.track=t,!a)return e.frameCount=s,e;if(s>e.frameCount)return this._undiscover(e,s),e;let c=Fc({patch:i,deps:e.deps,before:d,after:this._placedWrites(e),fps:this._scope.fps,propsOf:u=>{let p=o.node(u);return p?new Set(p.__cells?.slots.keys()??[]):void 0},buildsChildren:u=>{let p=o.node(u);return!!p&&p._allChildren.some(f=>o.node(f.id)!==f)},isContextProvider:u=>Sn(this._scope.registry,u)}),l=this._applyDirty(e,c,s);if(s!==e.frameCount){e.frameCount=s;for(let u of e.index.setFrameCount(s).keys)l.add(u)}return this._refresh(e)&&n.deltas.set(t.id,l),e}_resize(e,t,n){let s=e.track.duration;return e.track=t,t.duration===s?e:e.steps?this._fresh(t):(e.instance?.update(e.instance.clip,t.duration),this._refine==="none"||!e.discovered?e.frameCount=n:n>e.frameCount?this._undiscover(e,n):n!==e.frameCount&&(e.frameCount=n,e.index.setFrameCount(n),this._refresh(e)),e)}_undiscover(e,t){e.frameCount=t,e.discovered=null,this._version++}_discard(e){e.discarded=!0,!e.running&&(e.steps?.return(void 0),e.steps=null,e.instance?.dispose(),e.instance=null)}_nextUndiscovered(){let e,t=1/0;for(let n of this._spans){let s=this._entries.get(n.id);!s||s.discovered||s.running||(!e||n.startFrame<t)&&(e=s,t=n.startFrame)}return e}_start(e,t,n){let s=this._project.tracks.findIndex(o=>o.id===e.track.id);e.profile=n?this._options.profile?.track(s,e.track.id):void 0,e.steps=this._steps(e,t,n)}_drain(e){for(;e.steps&&!this._step(e););}_step(e){let t=e.steps;if(!t)return!0;e.running=!0;let n;try{n=t.next()}finally{e.running=!1}return e.generation++,e.discarded||this._disposed?(n.done||t.return(void 0),e.steps=null,e.instance?.dispose(),e.instance=null,!0):n.done?(e.steps=null,!0):!1}*_steps(e,t,n){let s=e.profile,{fps:o,assets:i}=this._scope;if(t){s?.enter("build"),e.unready.clear();try{let u=new jn(e.track.clip,e.track.duration,this._scope);e.instance=u,this._compile(e,p=>u.build(p))}catch(u){e.instance?.dispose(),e.instance=null,e.failure=Yn(e.track.id,u),n&&(this._resetAssets(e),this._refresh(e,!0),s?.done(e.frameCount));return}if(!n)return;yield}let a=e.instance,d=e.frameCount;this._resetAssets(e);let c=new Map;try{let u=yield*Yo(a,{fps:o,frameCount:d,catalog:i,declare:this._refine==="assets",onPhase:p=>s?.enter(p),onArrive:(p,f,h)=>{s?.enter("audio"),this._declareAudio(e,p,f,h,c)}});this._commit(e,u,c)}catch(u){e.refineError=Yn(e.track.id,u)}let l=this._options.isReady;if(l)for(let u of e.index.layoutGates())u.type==="loader"&&!l(u.src)&&e.unready.add(u.src);this._refresh(e,!0),s?.done(d),this._options.keepInstances===!1&&(a.dispose(),e.instance=null)}_resetAssets(e){e.index=new _r(e.frameCount),e.audio=new Sr,e.commandAudio=new Set,e.commandSounds=null,e.deps=new br,e.assetDeps.clear(),e.audioDeps.clear(),e.ownerErrors.clear(),e.audioErrors.clear(),e.refineError=null}_commit(e,t,n){let s=new Lt(e.instance);for(let o of t.owners.values()){let i=o.ownerKey;o.error?e.ownerErrors.set(i,this._ownerError(e,o)):e.index.setOwner(i,o.segments),e.assetDeps.set(i,s.idsOf(o.deps))}for(let[o,i]of n)e.audioDeps.set(o,s.idsOf(i));for(let o of new Set([...e.assetDeps.keys(),...e.audioDeps.keys()]))this._link(e,o)}_applyDirty(e,t,n){let s=new Set,o=w=>{for(let b of w.keys)s.add(b)};for(let w of t.removed)for(let b of[w,...e.deps.ownersBelow(w)])this._drop(e,b,o);if(t.owners.size===0&&t.below.size===0)return s;let i=e.instance,{fps:a,assets:d}=this._scope,c=new Set,l=new Map,u=Yo(i,{fps:a,frameCount:n,catalog:d,owners:t.owners,below:t.below,declare:this._refine==="assets",onArrive:(w,b,M,O)=>{c.add(b),O===Bt(M,a,n)?.startFrame&&this._declareAudio(e,w,b,M,l)}}),p=u.next();for(;!p.done;)p=u.next();e.generation++;let f=p.value,h=w=>{let b=t.owners.get(w);for(let M=w.indexOf("/");M>=0;M=w.indexOf("/",M+1)){let O=t.below.get(w.slice(0,M));O!==void 0&&(b===void 0||O<b)&&(b=O)}return b??0},x=w=>{if(t.arrivalOwners.has(w))return!0;for(let b=w.indexOf("/");b>=0;b=w.indexOf("/",b+1))if(t.arrivalBelow.has(w.slice(0,b)))return!0;return!1},y=new Set(f.owners.keys());for(let w of t.below.keys())for(let b of e.deps.ownersBelow(w))y.add(b);let _=new Lt(i);for(let w of y){let b=h(w),M=f.owners.get(w);if(!M&&b===0){this._drop(e,w,o);continue}let O=b>0?cp(e.index.declaredSegmentsOf(w),b):[];if(M?.error?e.ownerErrors.set(w,this._ownerError(e,M)):e.ownerErrors.delete(w),o(e.index.setOwner(w,M&&!M.error?[...O,...M.segments]:O)),M){let T=_.idsOf(M.deps);e.assetDeps.set(w,b>0?[...new Set([...e.assetDeps.get(w)??[],...T])]:T)}x(w)&&!c.has(w)&&(e.audio.removeOwner(w),e.audioDeps.delete(w),e.audioErrors.delete(w)),this._link(e,w)}for(let[w,b]of l)e.audioDeps.set(w,_.idsOf(b)),this._link(e,w);return s}_drop(e,t,n){n(e.index.removeOwner(t)),e.audio.removeOwner(t),e.assetDeps.delete(t),e.audioDeps.delete(t),e.ownerErrors.delete(t),e.audioErrors.delete(t),e.deps.remove(t)}_link(e,t){let n=e.assetDeps.get(t),s=e.audioDeps.get(t);n===void 0&&s===void 0?e.deps.remove(t):e.deps.set(t,[...n??[],...s??[]])}_declareAudio(e,t,n,s,o){let i=[];if(o.set(n,i),!Rc(t)){let a=e.instance?this._commandSoundsOf(e,e.instance).get(n):void 0;if(a)return this._setCommandAudio(e,e.instance,n,a);e.audio.removeOwner(n),e.audioErrors.delete(n);return}try{let a=Ce({read:d=>{i.push(d)},write:()=>{}},()=>$c(t,s,this._scope.assets,n,d=>e.instance.spanOf(d)));e.audio.setOwner(n,a),e.audioErrors.delete(n)}catch(a){e.audio.removeOwner(n),e.audioErrors.set(n,{...Yn(e.track.id,a),nodeId:t.id})}}_declareCommandAudio(e){let t=e.instance;if(e.commandSounds=null,!t||this._refine==="none")return;let n=this._commandSoundsOf(e,t);for(let s of e.commandAudio)n.has(s)||(e.audio.removeOwner(s),e.audioErrors.delete(s));e.commandAudio=new Set(n.keys());for(let[s,o]of n)this._setCommandAudio(e,t,s,o);e.commandSounds=null}_commandSoundsOf(e,t){if(e.commandSounds)return e.commandSounds;let n=new Map;for(let s of t.commandSounds()){let o=t.ownerKeyOf(s.node)??dp,i=n.get(o);i?i.push(s):n.set(o,[s])}return e.commandSounds=n}_setCommandAudio(e,t,n,s){let o=this._scope.assets,a={catalog:o,span:{start:0,end:1/0},clip:()=>{},_spanOf:d=>{let c=t.spanOf(d);if(!c)throw new Error(`${d.className} is not in the tree, so it has no span.`);return c}};try{let d=s.map((c,l)=>{let{bus:u,closed:p,...f}=c.options,h=t.atPresence(c.at,()=>{let y=u?rr(c.node,u):null;return y?tr(y,a):c.node instanceof er?Ls(c.node,a):void 0}),x=f.trimEnd??(p?o.getMediaDuration(c.src):void 0);return Jr({...f,trimEnd:x,src:c.src,at:c.at,until:c.until,bus:h},o,n,l)});e.audio.setOwner(n,d),e.audioErrors.delete(n),e.commandAudio.add(n)}catch(d){e.audio.removeOwner(n),e.audioErrors.set(n,{...Yn(e.track.id,d),nodeId:s[0].node.id})}}_ownerError(e,t){let n=t.error;return{trackId:e.track.id,message:n.message,...n.stack!==void 0&&{stack:n.stack},...t.nodeId!==void 0&&{nodeId:t.nodeId},...n.prop!==void 0&&{prop:n.prop}}}_refresh(e,t=!1){this._declareCommandAudio(e);let n=e.discovered,{fps:s}=this._scope,o=n&&fp(n.assetRecords,e.index.records())?n.assetRecords:new Map(e.index.records()),i=lp(e.audio.requests(),e.frameCount/s),a=e.index.layoutGates().map(c=>c.src),d=[...e.audioErrors.values(),...e.ownerErrors.values(),...e.failure?[e.failure]:[],...e.refineError?[e.refineError]:[]];return!t&&n&&o===n.assetRecords&&n.frameCount===e.frameCount&&kr(n.audioRequests,i)&&kr(n.layoutGates,a)&&kr(e.errors,d)?!1:(e.discovered={id:e.track.id,discovered:!0,frameCount:e.frameCount,startFrame:0,audioRequests:i,assetRecords:o,layoutGates:a},e.errors=d,this._version++,!0)}_placedWrites(e){let t=e.instance,n=new Map,s;for(let o of t.placedCommands()){let i=e.writes.get(o.writes);i||(s??=new Lt(t),i={start:o.start,writes:s.idsOf(o.writes)},e.writes.set(o.writes,i)),n.set(o.writes,i)}return n}_compile(e,t){let n=this._options.isReady,s=this._scope.measurer;if(!n){t(s);return}let o=new Set;t({measureText(i,a,d,c,l,u){return o.add(d),s.measureText(i,a,d,c,l,u)}});for(let i of o)n(i)||e.unready.add(i)}_rebuildInstance(e){e.instance?.dispose(),e.instance=null,e.generation++,this._start(e,!0,!1),this._drain(e),e.failure&&e.discovered&&this._refresh(e)}};function Yn(r,e){let t=e instanceof Error?e:new Error(String(e));return{trackId:r,message:t.message,stack:t.stack}}function cp(r,e){let t=[];for(let n of r)n.startFrame>=e||t.push(n.endFrame>=e?{...n,endFrame:e-1}:n);return t}function lp(r,e){let t=[];for(let n of r){let s=n.bus&&up(n.bus,e),o=s===n.bus?{...n}:{...n,bus:s};if(n.open){t.push(o);continue}if(n.startAt>=e)continue;let i=Math.min(n.endAt,e);i<=n.startAt||t.push(i===n.endAt?o:{...o,endAt:i})}return t}function up(r,e){return r.every(t=>t.endAt<=e)?r:r.map(t=>t.endAt<=e?t:{...t,endAt:e})}function fp(r,e){if(r.size!==e.size)return!1;for(let[t,n]of r){let s=e.get(t);if(!s||!kr(n,s))return!1}return!0}function pp(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t].id!==e[t].id||r[t].startFrame!==e[t].startFrame||r[t].endFrame!==e[t].endFrame)return!1;return!0}function kr(r,e){if(Object.is(r,e))return!0;if(typeof r!="object"||typeof e!="object"||r===null||e===null||Array.isArray(r)!==Array.isArray(e))return!1;let t=Object.keys(r);if(t.length!==Object.keys(e).length)return!1;for(let n of t)if(!kr(r[n],e[n]))return!1;return!0}var qn=class{_scope;constructor(e,t,n){this._scope=t,this._owned=n===void 0,this._store=n??new dt(e,t,{assets:!1,audio:!1}),this._slots=this._slotsFor(e.tracks,new Map),this._currentTrackId=Ho(this._slots)?.track.id??null}get currentFrame(){return this._currentFrame}get currentTrackId(){return this._currentTrackId}get currentCanvas(){return this.currentInstance?.canvas??null}get currentInstance(){let e=this._slotOf(this._currentTrackId);return e?.instance&&e.instance===this._store.instanceOf(e.track.id)?e.instance:null}get activeTrackIds(){return this._active.map(e=>e.track.id)}stateAt(e){if(this._disposed)return;let t=Math.max(0,Math.floor(e)),n=this._slotsToDraw(t);if(!this._stale&&t===this._currentFrame&&hp(n,this._active)&&n.every(o=>this._settled(o)))return;this._active=n;let s=Ho([...n].reverse());s&&(this._currentTrackId=s.track.id);for(let o of n)o.instance=this._store.ensureBuilt(o.track.id);for(let o of n)o.instance&&(this._evaluate(o,t-o.span.startFrame),o.generation=this._store.generationOf(o.track.id));this._currentFrame=t,this._stale=!1}layout(e=this._scope.measurer){for(let t of this._active)this._live(t)?.layout(e)}render(e){for(let t of this._active)this._live(t)?.render(e)}invalidate(){this._stale=!0}rebuild(e=this._currentTrackId){e!==null&&(this._store.rebuild(e),this._stale=!0)}setProject(e){if(this._disposed)return;this._store.setProject(e);let t=new Map(this._slots.map(s=>[s.track.id,s]));this._slots=this._slotsFor(e.tracks,t);let n=new Set(this._slots);for(let s of this._editorStates.keys())this._slotOf(s)||this._editorStates.delete(s);this._active=this._active.filter(s=>n.has(s)),this._slotOf(this._currentTrackId)||(this._currentTrackId=Ho(this._slots)?.track.id??null),this._stale=!0}setEditorStates(e,t){t?this._editorStates.set(e,t):this._editorStates.delete(e),this._stale=!0}dispose(){this._disposed=!0,this._active=[];for(let e of this._slots)e.instance=null;this._owned&&this._store.dispose()}_store;_owned;_slots;_active=[];_currentFrame=0;_currentTrackId;_stale=!1;_disposed=!1;_editorStates=new Map;_slotsFor(e,t){let n=gr(e,this._scope.fps);return e.map((s,o)=>{let i=t.get(s.id);return i?(i.track=s,i.span=n[o],i):{track:s,span:n[o],instance:null,generation:-1}})}_slotOf(e){return e===null?void 0:this._slots.find(t=>t.track.id===e)}_settled(e){let t=e.track.id;return e.instance?e.instance===this._store.instanceOf(t)&&e.generation===this._store.generationOf(t):this._store.failed(t)}_live(e){return e.instance&&e.instance===this._store.instanceOf(e.track.id)?e.instance:null}_slotsToDraw(e){let t=this._slots.map(s=>s.span),n=at(t,e);if(n.length===0){let s=Math.max(-1,...t.map(o=>o.endFrame));e>s&&s>=0&&(n=at(t,s))}return n.map(s=>this._slots[s.index])}_evaluate(e,t){let n=e.instance,s=xt(1,this._scope.fps),o=Ae(t,this._scope.fps,e.track.duration);n.attach(o,this._editorStates.get(e.track.id));let i=Math.max(0,o-s);n.evaluateAt(i),n.layout(),n.primeMotion(i),n.evaluateAt(o),n.layout(),n.sample()}};function Ho(r){return r.find(e=>!pn(e.track.clip))}function hp(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}var Zo=4;async function zc(r,e,t){for(let n=0;n<4;n++){if(!t())return"superseded";if(r(),!await e.warmPendingDecodes())return"settled";if(!t())return"superseded"}return"exhausted"}var Xn=class{_fps;_catalog;constructor(e,t){this._fps=e,this._catalog=t}update(e){let t=new Set,n=new Set;for(let o of e){n.add(o.id);let i=this._tracks.get(o.id);if(i&&i.records===o.records&&i.startFrame===o.startFrame)continue;let a=!i||i.startFrame!==o.startFrame;for(let[d,c]of o.records){let l=i?.records.get(d);(a||!l||!Lc(l,c))&&t.add(d),this._holders(d).add(o.id)}if(i)for(let d of i.records.keys())o.records.has(d)||(t.add(d),this._release(d,o.id));this._tracks.set(o.id,{id:o.id,startFrame:o.startFrame,records:o.records})}for(let[o,i]of this._tracks)if(!n.has(o)){this._tracks.delete(o);for(let a of i.records.keys())t.add(a),this._release(a,o)}let s;for(let o of t){let i=this._entryOf(o),a=this._map.get(o);if(i===void 0){if(a===void 0)continue;s??=new Map(this._map),s.delete(o)}else(a===void 0||!vp(a,i))&&(s??=new Map(this._map),s.set(o,i))}return s&&(this._map=s),this._map}_tracks=new Map;_byKey=new Map;_map=new Map;_holders(e){let t=this._byKey.get(e);return t||this._byKey.set(e,t=new Set),t}_release(e,t){let n=this._byKey.get(e);n&&(n.delete(t),n.size===0&&this._byKey.delete(e))}_entryOf(e){let t=this._byKey.get(e);if(!t)return;let n;for(let s of t){let o=this._tracks.get(s),i=o.records.get(e);i&&(n=yp(n,mp(i,o.startFrame)))}return n&&xp(n,this._fps,this._catalog)}};function mp(r,e){return e===0?r:{...r,startFrame:r.startFrame+e,endFrame:r.endFrame+e}}function yp(r,e){return r?{...r,startFrame:Math.min(r.startFrame,e.startFrame),endFrame:Math.max(r.endFrame,e.endFrame)}:e}function Bc(r,e){let t;try{t=r.type==="image"?e.getImageMeta(r.src):e.getVideoMeta(r.src)}catch{return 0}return!(t.width>0)&&!(t.height>0)?0:wp(t.width,t.height)}var gp=2,_p=2,Qo=120,Jo=30;function wp(r,e){return r*e*4/(1024*1024)}function jc(r){return Math.min(Qo,Math.max(_p,Math.round(r*gp)))}function xp(r,e,t){switch(r.type){case"image":{let n=jc(Bc(r,t));return{record:r,cacheAt:Math.max(0,r.startFrame-n),discardAt:r.endFrame+Jo}}case"video":{let n=Math.min(Qo,jc(Bc(r,t))*2+Math.round(e));return{record:r,cacheAt:Math.max(0,r.startFrame-n),discardAt:r.endFrame+Jo}}case"font":return{record:r,cacheAt:0,discardAt:null};case"loader":return{record:r,cacheAt:Math.max(0,r.startFrame-Qo),discardAt:r.endFrame+Jo};default:return}}function vp(r,e){return r.cacheAt===e.cacheAt&&r.discardAt===e.discardAt&&Lc(r.record,e.record)}function Lc(r,e){if(r===e)return!0;if(r.type!==e.type||r.src!==e.src||r.startFrame!==e.startFrame||r.endFrame!==e.endFrame)return!1;switch(r.type){case"video":{let t=e;return r.trimStart===t.trimStart&&r.trimEnd===t.trimEnd}case"font":{let t=e;return r.fontWeight===t.fontWeight&&r.fontFamily===t.fontFamily}case"loader":return r.load===e.load;default:return!0}}var bp=["build","declare","evaluate","audio"];function Gk(){let r=[];return{timings:r,track(e,t){let n=Object.fromEntries(bp.map(d=>[d,0])),s=null,o=We(),i=0,a=()=>{let d=We()-o;s&&(n[s]+=d),i+=d};return{enter(d){a(),s=d,o=We()},suspend(){a(),s=null},resume(){o=We()},done(d){a(),s=null,r[e]={trackId:t,trackIndex:e,frameCount:d,totalMs:i,phases:n}}}}}}var Wn=class{_scope;constructor(e,t,n={}){this._scope=t,this._owned=n.store===void 0,this._store=n.store??new dt(e,t,{profile:n.profile,assets:n.assets,keepInstances:!1}),this._assets=new Xn(t.fps,t.assets)}get store(){return this._store}get discoveredCount(){let e=0;for(let t of this._store.tracks)this._store.isDiscovered(t.id)&&e++;return e}result(){return this._assemble()}ensureCovering(e){for(let t of at(this._store.spans,e))this._store.discover(t.id);return this._assemble()}run(){for(let e of this._store.tracks)this._store.discover(e.id);return this._assemble()}async runAsync(e={}){let{budgetMs:t=Ar,isCancelled:n,onProgress:s}=e;return await this._store.runAsync({budgetMs:t,isCancelled:n,onProgress:s&&(()=>s(this._assemble()))}),this._assemble()}setProject(e){return this._store.setProject(e),this._assemble()}learn(e,t,n,s){return this._store.learn(e,t,n,s),this._assemble()}dispose(){this._owned&&this._store.dispose()}_store;_owned;_assets;_result=null;_version=-1;_assemble(){let e=this._store;if(this._result&&this._version===e.version)return this._result;let{fps:t}=this._scope,n=e.spans,s=Mc(n),o=s/t,i=[],a=[],d=!0,c=n.map(p=>{let f=e.trackAssets(p.id);return f||(d=!1),a.push(...e.errorsOf(p.id)),f??Sp(p.id,p.endFrame-p.startFrame+1)}),l=this._assets.update(c.map((p,f)=>({id:p.id,startFrame:n[f].startFrame,records:p.assetRecords})));for(let p=0;p<c.length;p++)i.push(kp({...c[p],startFrame:n[p].startFrame},t,o));let u=e.profile;return this._version=e.version,this._result={fps:t,tracks:i,totalFrames:s,totalDuration:o,assets:l,buildErrors:a,complete:d,timings:u?.timings?.slice()}}};function Sp(r,e){return{id:r,discovered:!1,frameCount:e,startFrame:0,audioRequests:[],assetRecords:new Map,layoutGates:[]}}function kp(r,e,t){if(!r.audioRequests.some(o=>o.open))return r;let n=r.startFrame/e,s=r.audioRequests.map(o=>{if(!o.open)return o;let i=n+o.startAt,a=o.loop?t:Math.min(i+(o.mediaDuration??0),t);return{...o,endAt:Math.max(o.startAt,a-n)}});return{...r,audioRequests:s}}function Gt(r){return typeof r?._isViewport3D=="function"&&r._isViewport3D()}function ri(r,e,t){let n=si(r);if(!n)return[];let s=[];for(let o of ni(r,t)){let i=n.boxes.get(o.node.id);if(!i)continue;let a=Wc(i,n);a&&s.push({box:Hc(o.node,o.path,a.rect,e),depth:a.depth})}return s.sort((o,i)=>i.depth-o.depth),s.map(o=>o.box)}var Ap={x:0,y:0,z:0};function Uc(r,e,t,n,s,o){let i=si(r);if(!i)return null;let a=ni(r,t).find(f=>f.path===n);if(!a)return null;let d=i.matrices.get(a.node.id),c=i.parentMatrices.get(a.node.id);if(!d||!c)return null;let l=(f,h)=>h.map(x=>Gc(f,x,i,e)),u=Ri(a.node),p=u?s.map(f=>u.toLocal(f.x,f.y,f.z)):s;return{origin:Gc(d,Ap,i,e),parentPoints:l(c,p),localPoints:l(d,o)}}function Gc(r,e,t,n){let s=Ne(r,e),o=Ne(t.clip,{x:s.x,y:s.y,z:s.z});if(o.w<=Mr)return null;let i=o.x/o.w,a=o.y/o.w,d=t.centerX+i*(t.width/2),c=t.centerY+a*(t.height/2),l=Q(n.matrix,{x:d,y:-c});return{x:l.x,y:-l.y}}function Yc(r,e,t,n,s){let o=si(r);if(!o)return null;let i=Ee(e.matrix);if(!i)return null;let a=Q(i,{x:t.x,y:-t.y}),d={x:a.x,y:-a.y},c=null,l=-1/0;for(let u of ni(r,s)){let p=o.boxes.get(u.node.id);if(!p)continue;let f=Wc(p,o);f&&Dp(f.rect,d,n)&&(f.depth<=l||(l=f.depth,c={node:u.node,path:u.path,rect:f.rect}))}return c?Hc(c.node,c.path,c.rect,e):null}function ni(r,e){let t=[];return qc(r._allChildren,e,t),t}function qc(r,e,t){for(let n=0;n<r.length;n++){let s=r[n];if(!(s instanceof ve))continue;let o=Ke(e,n);t.push({node:s,path:o}),qc(s._allChildren,o,t)}}function si(r){let e=r._localBounds();if(!(e.width>0)||!(e.height>0))return null;let t=r._scene3D();if(!t)return null;let n=Mp(t);if(n.boxes.size===0)return null;let s=Fn(n.camera);if(!s)return null;let o=e.width/e.height;return{boxes:n.boxes,matrices:n.matrices,parentMatrices:n.parentMatrices,clip:$e(Cp(n.descriptor,o),s),view:s,width:e.width,height:e.height,centerX:e.x,centerY:e.y}}function Mp(r){let e=new Map,t=new Map,n=new Map,o=[{key:void 0,matrix:Dn(),visible:!0,box:null}],i=null,a=null,d=()=>o[o.length-1];for(let c of r.ops()){let l=d();switch(c.kind){case"push":{let u=Xc(l.matrix,c.transform);c.transform?.key!==void 0&&(t.set(c.transform.key,u),n.set(c.transform.key,l.matrix)),o.push({key:c.transform?.key,matrix:u,visible:l.visible&&c.transform?.visible!==!1,box:null});break}case"pop":{if(o.length===1)break;let u=o.pop();if(!u.visible||!u.box)break;u.key!==void 0&&e.set(u.key,u.box);let p=d();p.box=yr(p.box,u.box);break}case"camera":{a=c.camera,i=Tp(c.camera,l.matrix);break}case"light":break;default:{if(!l.visible)break;let u=Op(c,l.matrix);u&&(l.box=yr(l.box,u));break}}}return{boxes:e,matrices:t,parentMatrices:n,camera:i??Pp,descriptor:a}}function Xc(r,e){return $e(r,hr(e,r))}function Op(r,e){if(r.kind==="model"||!("transform"in r))return null;let t=Xc(e,r.transform);if(r.kind==="sprite")return Nt(pe(.5,.5,0),t);if(!("geometry"in r))return null;let n=$n(r.geometry);if(!n)return null;if(r.kind==="instances"){let s=null;for(let o of r.instances)s=yr(s,Nt(n,hr(o,null)));return s?Nt(s,t):null}return Nt(n,t)}function Tp(r,e){let t=mo(r);if(t.lookAt===void 0)return $e(e,hr({...r,position:t.position},e));let n=Ne(e,t.position),s={x:n.x,y:n.y,z:n.z};return $e(mr(s),pr(s,t.lookAt))}var Pp=$e(mr({x:0,y:0,z:5}),pr({x:0,y:0,z:5},{x:0,y:0,z:0})),Vc=50,ei=.1,ti=1e3;function Cp(r,e){if(r===null)return In(Vc,e,ei,ti,1);if(r.type==="perspective")return In(r.fov??Vc,e,r.near??ei,r.far??ti,r.zoom??1);let t=(r.frustumHeight??10)/2;return Vo(-t*e,t*e,t,-t,r.near??ei,r.far??ti,r.zoom??1)}var Ep=[[0,1],[2,3],[4,5],[6,7],[0,2],[1,3],[4,6],[5,7],[0,4],[1,5],[2,6],[3,7]],Mr=1e-4,Kc=8;function Wc(r,e){let n=Rn(r).map(_=>Ne(e.clip,_)),s=1/0,o=1/0,i=-1/0,a=-1/0,d=!1,c=(_,w,b)=>{let M=_/b,O=w/b;M<s&&(s=M),O<o&&(o=O),M>i&&(i=M),O>a&&(a=O),d=!0};for(let[_,w]of Ep){let b=n[_],M=n[w],O=b.w>Mr,T=M.w>Mr;if(!O&&!T||(O&&c(b.x,b.y,b.w),T&&c(M.x,M.y,M.w),O===T))continue;let V=(Mr-b.w)/(M.w-b.w);c(b.x+(M.x-b.x)*V,b.y+(M.y-b.y)*V,Mr)}if(!d)return null;let l=e.width/2,u=e.height/2,p=l*Kc,f=u*Kc,h={minX:Hn(e.centerX+s*l,e.centerX-p,e.centerX+p),maxX:Hn(e.centerX+i*l,e.centerX-p,e.centerX+p),minY:Hn(e.centerY+o*u,e.centerY-f,e.centerY+f),maxY:Hn(e.centerY+a*u,e.centerY-f,e.centerY+f)},x={x:(r.min.x+r.max.x)/2,y:(r.min.y+r.max.y)/2,z:(r.min.z+r.max.z)/2},y=Ne(e.view,x);return{rect:h,depth:y.z}}function Hn(r,e,t){return r<e?e:r>t?t:r}function Dp(r,e,t){return e.x>=r.minX-t&&e.x<=r.maxX+t&&e.y>=r.minY-t&&e.y<=r.maxY+t}function Hc(r,e,t,n){let s=(o,i)=>{let a=Q(n.matrix,{x:o,y:-i});return{x:a.x,y:-a.y}};return{id:r.id,path:e,type:r.className,topLeft:s(t.minX,t.maxY),topRight:s(t.maxX,t.maxY),bottomRight:s(t.maxX,t.minY),bottomLeft:s(t.minX,t.minY),center:s((t.minX+t.maxX)/2,(t.minY+t.maxY)/2),width:t.maxX-t.minX,height:t.maxY-t.minY,rotation:n.box.rotation,scale:n.box.scale,opacity:n.box.opacity,locked:r.locked}}function Me(r){let e=jr(r);if(e)return je(Me(e.root),e.screen);let t=r.parent;return t?je(Or(t),r._localMatrix()):r._localMatrix()}function Or(r){let e=Me(r),t=r._spaceCamera();if(t)return je(e,Br(r,t).screen);let n=r._cameraScope();if(!n)return e;let s=r.layoutBounds;return je(e,Ss(s.x,-s.y,n.lookAt,n.zoom,n.heading))}function Jc(r,e,t){if(e==="")return null;let n=ct(r,e),s=n instanceof F?n.parent:null;if(!(n instanceof F)||!s)return null;let o=nl(n,s),i=Ee(o);if(!i)return null;let a=Q(i,{x:t.x,y:-t.y});if(oi(o,a))return null;let d=s._planeOf(n);if(!d)return{x:a.x,y:-a.y};let c=n._placement()?null:n.layoutBounds;return d.toCoords(a.x-(c?.x??0),(c?.y??0)-a.y)}function Qc(r,e,t){let n=ct(r,e);if(!(n instanceof F))return null;let s=n._planeOf(null);if(!s)return null;let o=Ee(Or(n));if(!o)return null;let i=Q(o,{x:t.x,y:-t.y});return s.toCoords(i.x,-i.y)}function el(r,e,t,n){let s=ct(r,e),o=ct(r,t),i=s instanceof F?s.parent:null;if(!(s instanceof F)||!(i instanceof F)||!(o instanceof F))return null;for(let re=o;re;re=re.parent)if(re===s)return null;let a=s.layoutBounds,d=o._planeOf(null),c=d?null:o._slotFor({width:a?.width??0,height:a?.height??0});if(!d&&!c)return null;let l=nl(s,i),u=Ee(l),p=Ee(Or(o));if(!u||!p)return null;let f=s._placement(),h=Zc(i),x=Zc(o),y=h.rotation+(f?.rotation??0)-x.rotation,_=x.scale===0?1:h.scale*(f?.scale??1)/x.scale,w=s._centreShift(s.rotation+y,s.scale*_),b=Q(u,Q(Me(s),{x:0,y:0})),M=i._planeOf(s),O=re=>M?{...M.toOffset(re.x,re.y)}:re,T=O({x:s.x,y:s.y});return{offsets:n.map(re=>{let B=O(re),_e=Q(l,{x:b.x+B.x-T.x,y:b.y-(B.y-T.y)}),Oe=Q(p,_e),Kt=Oe.x-w.x,he=Oe.y-w.y;return d?d.toCoords(Kt,-he):{x:Kt-c.x,y:c.y-he}}),turn:y,scale:_}}function Zc(r){let e=sl(r),t=r._cameraScope();return t?{rotation:e.rotation-t.heading,scale:e.scale*t.zoom}:e}function tl(r,e){let t=ct(r,e);if(!(t instanceof F))return null;let n=Me(t);return t._handles().map(({prop:s,at:o})=>{let i=Q(n,{x:o.x,y:-o.y});return{prop:s,at:{x:i.x,y:-i.y}}})}function rl(r,e,t,n){let s=ct(r,e);if(!(s instanceof F))return null;let o=Me(s),i=Ee(o);if(!i)return null;let a=Q(i,{x:n.x,y:-n.y});return oi(o,a)?null:s._handleValue(t,{x:a.x,y:-a.y})}function nl(r,e){let t=jr(r)?Bs(e):null;if(!t){let i=r._slotMatrix();return i?je(Or(e),i):Or(e)}let n=r._slotAffine(),s=n?As(t.view,n):t.view,o=As(s,[1,0,0,0,0,1,0,0,0,0,1,r.depth]);return je(Me(t.root),gi(t.camera,o))}function oi(r,e){return vs(r)&&(r.g??0)*e.x+(r.h??0)*e.y+(r.i??1)<=0}function sl(r){let e=0,t=1,n=1;for(let s=r;s;s=s.parent){let o=s._placement();e+=s.rotation+(o?.rotation??0),t*=s.scale*(o?.scale??1),n*=s.opacity*(o?.opacity??1);let i=s!==r?s._cameraScope():null;i&&(e-=i.heading,t*=i.zoom)}return{rotation:e,scale:t,opacity:n}}function Tr(r,e){let t=r._localBounds(),n=t.x===0&&t.y===0?Me(r):je(Me(r),bs(t.x,-t.y)),s=Mi(n,t.width/2,t.height/2),o=sl(r);return{id:r.id,path:e,type:r.className,topLeft:s.topLeft,topRight:s.topRight,bottomRight:s.bottomRight,bottomLeft:s.bottomLeft,center:s.center,width:t.width,height:t.height,rotation:o.rotation,scale:o.scale,opacity:o.opacity,locked:r.locked}}function ol(r,e){if(e==="")return Tr(r,e);let t=r,n=null,s=e.split(".");for(let i=0;i<s.length;i++){Gt(t)&&(n={node:t,path:il(s,i)});let a=t._allChildren[Number(s[i])];if(!a)return null;t=a}if(t instanceof F)return Tr(t,e);if(!n)return null;let o=Zn(n.node,n.path);return ri(n.node,o,n.path).find(i=>i.path===e)??null}function ct(r,e){if(e==="")return r;let t=r;for(let n of e.split(".")){let s=t._allChildren[Number(n)];if(!s)return null;t=s}return t}function il(r,e){return r.slice(0,e).join(".")}function al(r,e,t,n){if(e==="")return null;let s=r,o=null,i=e.split(".");for(let d=0;d<i.length;d++){Gt(s)&&(o={node:s,path:il(i,d)});let c=s._allChildren[Number(i[d])];if(!c)return null;s=c}if(s instanceof F||!o)return null;let a=Zn(o.node,o.path);return Uc(o.node,a,o.path,e,t,n)}function dl(r,e,t=0){return cl(r,"",e,t,!0)}function cl(r,e,t,n,s){if(r.opacity===0||r.hidden)return null;let o=ll(r,s);if(o==="none")return null;let i=o==="all"&&Fp(r,t,n);if(!i&&o==="all"&&r._confinesChildren())return null;let a=fl(r),d=ul(r,a);for(let c=d.length-1;c>=0;c--){let l=d[c],u=a[l];if(u===null)continue;let p=cl(u,Ke(e,l),t,n,!1);if(p)return p}if(Gt(r)&&i){let c=Yc(r,Zn(r,e),t,n,e);if(c)return c}return s||r.locked?null:i?Tr(r,e):null}function ii(r,e,t,n){if(r.opacity===0||r.hidden)return;let s=ll(r,n);if(s==="none")return;if(!n&&s==="all"&&t.push(Tr(r,e)),Gt(r))for(let i of ri(r,Zn(r,e),e))t.push(i);let o=fl(r);for(let i of ul(r,o)){let a=o[i];a!==null&&ii(a,Ke(e,i),t,!1)}}function ll(r,e){if(e)return"all";let t=jr(r);return t?!r.backfaceVisible&&t.facesAway?"none":t.paints?"all":r._rendersChildrenInSpace()?"children":"none":"all"}function ul(r,e){let t=e.map((i,a)=>a),n=Bs(r);if(!n)return t;let s=t.filter(i=>e[i]!==null),o=s.map(i=>Oi(n,e[i]));return Ti(o).map(i=>s[i])}function fl(r){return Gt(r)?r._allChildren.map(e=>e instanceof F?e:null):r.children}function Zn(r,e){return{box:Tr(r,e),matrix:Me(r)}}function Fp(r,e,t){let n=Me(r),s=Ee(n);if(!s)return!1;let o=Q(s,{x:e.x,y:-e.y});return oi(n,o)?!1:r._hitTestSelf({x:o.x,y:-o.y},t)}var Vt=function(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o};function Ip(r){return r==null?null:r instanceof Cr?r.toCommands():r}function Rp(r){return Array.isArray(r)?r.map(({fill:e,stroke:t,...n})=>({...n,...e===void 0?{}:{fill:ne.resolve(e)},...t===void 0?{}:{stroke:Ze.resolve(t)}})):[]}var ze=class extends ie{constructor(e){super(e)}displayText(){return this.text}get wrapsText(){return this.wrap}get glyphPath(){return this.path}styledRuns(){return this._selections}styleRuns(){return this.runs}applyDefaultSize(e){let t=e?.fontSize==="autofit";this.applyProp("height",e?.height??(t?"fill":"hug")),this.applyProp("width",e?.width??(t||e?.wrap?"fill":"hug"))}append(e){let t=e.data.text;return this.to({data:{text:this.text+t},duration:e.duration,easing:e.easing})}prepend(e){let t=e.data.text;return this.to({data:{text:t+this.text},duration:e.duration,easing:e.easing})}_selections=[];_registerSelection(e){this._selections.push(e)}find(e,t){let n=this.text,s=[];if(e.length>0){let a=0,d;for(;(d=n.indexOf(e,a))!==-1;)s.push({start:d,end:d+e.length}),a=d+e.length}let o=t?.index??0,i=s[o]?[s[o]]:[];return new Le(this,i)}match(e){let t=e.flags.includes("g")?e.flags:e.flags+"g",n=new RegExp(e.source,t),s=[],o;for(;(o=n.exec(this.text))!==null;){if(o[0].length===0){n.lastIndex++;continue}s.push({start:o.index,end:o.index+o[0].length})}return new Le(this,s)}line(e){let t=this.text.split(`
|
|
11
|
-
`),n=0;for(let s=0;s<t.length;s++){let o=t[s].length;if(s===e)return new Le(this,[{start:n,end:n+o}]);n+=o+1}return new Le(this,[])}words(){return new Le(this,this._wordRanges())}word(e){let t=this._wordRanges()[e];return new Le(this,t?[t]:[])}slice(e,t){return new Le(this,[{start:e,end:t}])}filter(e){let t=[],n=-1;for(let s=0;s<this.text.length;s++)e(this.text[s],s)?n===-1&&(n=s):n!==-1&&(t.push({start:n,end:s}),n=-1);return n!==-1&&t.push({start:n,end:this.text.length}),new Le(this,t)}_wordRanges(){let e=[],t=/\S+/g,n;for(;(n=t.exec(this.text))!==null;)e.push({start:n.index,end:n.index+n[0].length});return e}};Vt([Ns()],ze.prototype,"text",void 0);Vt([m({default:!1})],ze.prototype,"wrap",void 0);Vt([m({default:null,mapper:Ip})],ze.prototype,"path",void 0);Vt([m({default:[],mapper:Rp,animatable:!1})],ze.prototype,"runs",void 0);Vt([G({args:[{key:"text",kind:"text",default:"",multiline:!0}]})],ze.prototype,"append",null);Vt([G({args:[{key:"text",kind:"text",default:"",multiline:!0}]})],ze.prototype,"prepend",null);function pl(r,e,t){let n=r instanceof ze?r._textState():r instanceof fn?Zi(r):null;if(!n)return null;let s=t.layoutTextBlock(n);if(!s)return null;let o=Me(r),i=(c,l)=>{let u=Q(o,{x:c,y:l});return{x:u.x,y:-u.y}},a=new Array(zo(s)),d=[];for(let c of s.lines){d.push({start:c.start,end:c.end});for(let l=0;l<c.carets.length;l++){let u=c.carets[l];a[c.start+l]={offset:c.start+l,top:i(u,c.top),bottom:i(u,c.bottom)}}}return{path:e,text:r.text,carets:a,lines:d}}function xA(r,e){let t=0,n=1/0;for(let s of r.carets){let o=$p(e,s.top,s.bottom);o<n&&(n=o,t=s.offset)}return t}function vA(r,e,t){let n=Math.max(0,Math.min(e,t)),s=Math.min(r.carets.length-1,Math.max(e,t)),o=[];for(let i of r.lines){let a=Math.max(n,i.start),d=Math.min(s,i.end);if(a>=d)continue;let c=r.carets[a],l=r.carets[d];o.push({topLeft:c.top,topRight:l.top,bottomRight:l.bottom,bottomLeft:c.bottom})}return o}function $p(r,e,t){let n=t.x-e.x,s=t.y-e.y,o=n*n+s*s,i=o===0?0:Math.max(0,Math.min(1,((r.x-e.x)*n+(r.y-e.y)*s)/o));return Math.hypot(r.x-(e.x+i*n),r.y-(e.y+i*s))}var Jn=class{renderContext;measurer;storageAdapter;masterClock;stateEvaluator;assetManager;audioDevice;assetCatalog;onFramePainted;disposed=!1;precompRunning=!1;hasPainted=!1;seekGeneration=0;precompBudgetMs;onPrecompProgress;fps;viewport;precomper;store;overrides=new Map;precomp;get spans(){return this.precomp.tracks.map((e,t)=>({id:e.id,index:t,startFrame:e.startFrame,endFrame:e.startFrame+e.frameCount-1}))}get totalFrames(){return this.precomp.totalFrames}get totalDuration(){return this.precomp.totalDuration}get currentTrackId(){return this.stateEvaluator.currentTrackId}get buildErrors(){return this.renderErrors.length===0?this.precomp.buildErrors:[...this.precomp.buildErrors,...this.renderErrors]}renderErrors=[];onRenderError;captureRenderError(e,t){let n=e instanceof Error?e:new Error(String(e));t!==void 0&&this.recoverMissingAsset(n,t)||this.renderErrors.some(s=>s.message===n.message)||(this.renderErrors.push({trackId:this.stateEvaluator.currentTrackId??"",message:n.message,stack:n.stack}),this.onRenderError?.(this.buildErrors))}learnMissingAsset(e,t){let n=Bp(e,this.assetCatalog);if(n)for(let s of[...this.stateEvaluator.activeTrackIds].reverse()){let o=this.store.instanceOf(s),i=this.precomp.tracks.find(c=>c.id===s);if(!o||!i)continue;let a;if(e.nodeId!==void 0&&o.forEachOwner((c,l)=>{a===void 0&&c.id===e.nodeId&&(a=l)}),a??=this.store.ownersOf(s,e.src).values().next().value,a===void 0)continue;let d=this.precomper.learn(s,a,n,Math.floor(t)-i.startFrame);d!==this.precomp&&this.adoptPrecomp(d);return}}rescuedAssets=new Set;recoverMissingAsset(e,t){if(!(e instanceof Ai)||e.assetType==="audio")return!1;let n=`${e.assetType}:${e.src}`;if(this.rescuedAssets.has(n))return!1;this.rescuedAssets.add(n),this.learnMissingAsset(e,t);let s=this.recordFor(e.assetType,e.src,t);return s?(this.storageAdapter.loadAsset(e.src,s).then(()=>{this.disposed||(this.renderAt(this.stateEvaluator.currentFrame),this.settleTrailing())}).catch(o=>{this.disposed||this.captureRenderError(new Error(`${e.message}
|
|
12
|
-
|
|
13
|
-
Loading it directly also failed: ${String(o)}`))}),!0):!1}recordFor(e,t,n){try{return e==="font"?{type:"font",src:t,startFrame:n,endFrame:n,fontFamily:t,fontWeight:400}:e==="image"?(this.assetCatalog.getImageMeta(t),{type:"image",src:t,startFrame:n,endFrame:n}):(this.assetCatalog.getVideoMeta(t),{type:"video",src:t,startFrame:n,endFrame:n,trimStart:0,trimEnd:this.assetCatalog.getVideoDuration(t)})}catch{return null}}clearRenderErrors(){this.rescuedAssets.clear(),this.renderErrors.length!==0&&(this.renderErrors.length=0,this.onRenderError?.(this.buildErrors))}constructor(e){let{project:t}=e;if(t.fps===void 0||t.viewport===void 0)throw new Error("PlaybackController takes a project whose fps and viewport are resolved \u2014 see Session.");this.renderContext=e.renderContext,this.measurer=e.measurer,this.masterClock=e.masterClock,this.storageAdapter=e.storageAdapter,this.audioDevice=e.audioDevice,this.fps=t.fps,this.viewport=t.viewport,this.precompBudgetMs=e.precompBudgetMs??Ar,this.onPrecompProgress=e.onPrecompProgress,this.assetCatalog=e.assets;let n={registry:e.registry,viewport:this.viewport,fps:this.fps,assets:e.assets,measurer:this.measurer};this.store=new dt(t,n,{profile:e.precompProfile,isReady:s=>this.assetManager?.isReady(s)??!1}),this.precomper=new Wn(t,n,{store:this.store}),this.precomp=this.precomper.ensureCovering(0),this.stateEvaluator=new qn(t,n,this.store),this.assetManager=new Nn(this.precomp,this.storageAdapter,this.audioDevice,s=>this.captureRenderError(s)),this.masterClock.setDuration(this.totalDuration),this.masterClock.onPlay((s,o,i)=>{this.audioDevice.play(s,o,i),this.storageAdapter.setPlaying(!0)}),this.masterClock.onPause(()=>{this.audioDevice.stop(),this.storageAdapter.setPlaying(!1)}),this.masterClock.onTick(async s=>{let o=++this.seekGeneration,i=He(s,this.fps);i>=this.totalFrames&&this.masterClock.pause(),this.discoverThrough(i),await this.loadFrame(i),this.isCurrent(o)&&(this.audioDevice.syncTo(s),this.renderAt(i),this.assetManager.prefetch(i),this.trimAround(i))}),this.startBackgroundPrecomp()}startBackgroundPrecomp(){this.precompRunning||this.disposed||this.precomp.complete||(this.precompRunning=!0,(async()=>{try{for(await Bn();!this.disposed&&!this.precomp.complete;){let e=await this.precomper.runAsync({budgetMs:this.precompBudgetMs,isCancelled:()=>this.disposed,onProgress:t=>this.adoptPrecomp(t)});if(this.disposed)return;this.precomp.complete||this.adoptPrecomp(e)}}finally{this.precompRunning=!1}})())}adoptPrecomp(e){this.disposed||(this.precomp=e,this.assetManager.setPrecomp(e),this.masterClock.setDuration(this.totalDuration),this.onPrecompProgress?.(e))}discoverThrough(e){let t=this.precomper.ensureCovering(Math.floor(e));t!==this.precomp&&this.adoptPrecomp(t)}async loadFrame(e){let t=[];for(let n of at(this.store.spans,Math.floor(e)))for(let s of this.store.layoutGates(n.id))this.assetManager.isReady(s.src)||t.push(s);if(t.length===0){await this.assetManager.loadAt(e);return}await Promise.all([this.assetManager.loadAt(e),this.assetManager.loadRecords(t)])}trimAround(e){Math.abs(e-this.lastTrimFrame)<this.fps||(this.lastTrimFrame=e,this.store.trim(Math.floor(e),Math.ceil(Np*this.fps)))}lastTrimFrame=0;get isPlaying(){return this.masterClock.isPlaying}get currentTime(){return this.masterClock.currentTime}get currentFrame(){return He(this.masterClock.currentTime,this.fps)}onTime(e){this.masterClock.onTime(e)}onPlay(e){this.masterClock.onPlay(()=>e())}onPause(e){this.masterClock.onPause(e)}isCurrent(e){return!this.disposed&&e===this.seekGeneration}renderAt(e){if(!this.disposed){this.hasPainted=!0,this.renders++;try{this.store.settleGates(at(this.store.spans,Math.floor(e)).map(t=>t.id)),this.stateEvaluator.stateAt(e),this.applyOverrides(),this.stateEvaluator.layout(this.measurer),this.renderContext.execute(()=>{this.stateEvaluator.render(this.renderContext)})}catch(t){this.captureRenderError(t,e)}this.announcePaint(e)}}announcePaint(e){if(this.onFramePainted)try{this.onFramePainted(Math.floor(e))}catch(t){console.error("[PlaybackController] onFramePainted listener threw:",t)}}async seek(e){if(this.disposed)return;let t=++this.seekGeneration;this.paintInFlight=t;try{let n=Math.max(0,Math.min(e,this.totalFrames));if(this.masterClock.pause(),this.discoverThrough(n),this.masterClock.seek(xt(n,this.fps)),await this.loadFrame(n),!this.isCurrent(t)||await this.settle(()=>this.renderAt(n),t)==="superseded")return;this.assetManager.prefetch(n),this.trimAround(n)}finally{this.paintLanded(t)}}setProject(e){if(this.disposed)return;let t=++this.seekGeneration;this.precomper.setProject(e),this.stateEvaluator.setProject(e),this.discoverThrough(this.currentFrame),this.clearRenderErrors(),this.masterClock.setDuration(this.totalDuration);let n=Math.min(this.currentFrame,Math.max(0,this.totalFrames-1));this.pendingSwap=t,this.paintInFlight=t,this.lastReplacePaint=this.loadAndRepaint(n,t),this.startBackgroundPrecomp()}reconcileCatalog(){this.disposed||(this.store.reset(),this.setProject(this.store.project))}whenReplaced(){return this.lastReplacePaint}lastReplacePaint=Promise.resolve();pendingSwap=0;async loadAndRepaint(e,t){try{try{await this.loadFrame(e)}catch(n){console.error("[PlaybackController] swap asset load failed:",n);return}await this.settle(()=>this.renderAt(e),t)}finally{this.pendingSwap===t&&(this.pendingSwap=0),this.paintLanded(t)}}seekWhilePlaying(e){++this.seekGeneration;let t=Math.max(0,Math.min(e,this.totalFrames));this.masterClock.seek(xt(t,this.fps))}async screenshot(){let e=this.stateEvaluator.currentFrame,t=++this.seekGeneration;this.paintInFlight=t;try{return await this.loadFrame(e),!this.isCurrent(t)||await this.settle(()=>this.renderAt(e),t,!0)==="superseded"?void 0:this.renderContext.screenshot()}finally{this.paintLanded(t)}}async settle(e,t,n=!1){let s=n?zp(this.storageAdapter):this.storageAdapter,o=await zc(e,s,()=>this.isCurrent(t));return o==="exhausted"&&console.warn(`[PlaybackController] frame ${this.stateEvaluator.currentFrame} still had decodes pending after ${4} passes`),o}paintInFlight=0;renders=0;repaintOwedSince=null;paintLanded(e){if(!(this.paintInFlight!==e||this.disposed)){if(this.paintInFlight=0,this.repaintOwedSince!==null){let t=this.renders===this.repaintOwedSince;this.repaintOwedSince=null,t&&!this.isPlaying&&this.renderAt(this.stateEvaluator.currentFrame)}this.settleTrailing()}}getTreeState(){let e=this.stateEvaluator.currentInstance;if(!e)return null;let t=this.precomp.tracks.find(d=>d.id===this.stateEvaluator.currentTrackId),n=t?.startFrame??0,s=t?.frameCount??zt(e.duration,this.fps),o=new Map,i=new Map;e.forEachOwner((d,c,l,u)=>{i.set(c,u);let p=Bt(l,this.fps,s);p&&o.set(u,{startFrame:n+p.startFrame,endFrame:n+p.endFrame})});let a=jp(t?.audioRequests??[],i);return ml(e.canvas,"",o,a)}getNodeState(e){let t=this.stateEvaluator.currentCanvas;if(!t)return null;let n=yl(t,e);return n?{id:n.id,type:n.className,properties:n.properties}:null}getNodeInitialProps(e){return this.stateEvaluator.currentInstance?.baselineProps(e)??null}getNodeBox(e){let t=this.stateEvaluator.currentCanvas;return t?ol(t,e):null}getNodePropsAt(e){let t=this.stateEvaluator.currentCanvas;if(!t)return null;let n=ct(t,e);return n?n.properties:null}getNodeBoxes(){let e=this.stateEvaluator.currentCanvas;if(!e)return[];let t=[];return ii(e,"",t,!0),t}projectNode3D(e,t,n){let s=this.stateEvaluator.currentCanvas;return s?al(s,e,t,n):null}parentPlanePoint(e,t){let n=this.stateEvaluator.currentCanvas;return n?Jc(n,e,t):null}childPlanePoint(e,t){let n=this.stateEvaluator.currentCanvas;return n?Qc(n,e,t):null}reparentPlacement(e,t,n){let s=this.stateEvaluator.currentCanvas;return s?el(s,e,t,n):null}nodeHandles(e){let t=this.stateEvaluator.currentCanvas;return t?tl(t,e):null}handleValue(e,t,n){let s=this.stateEvaluator.currentCanvas;return s?rl(s,e,t,n):null}getTextLayout(e){let t=this.stateEvaluator.currentCanvas;if(!t)return null;let n=hl(t,e);return n instanceof F?this.textLayoutOf(n,e):null}textLayoutOf(e,t){let n=wc(this.measurer);return n?pl(e,t,n):null}pickNode(e,t=0){let n=this.stateEvaluator.currentCanvas;return n?dl(n,e,t):null}setNodeOverride(e,t){let n=this.overrides.get(e);this.overrides.set(e,n?{...n,...t}:{...t}),this.applyOverrides()}clearNodeOverrides(e){(e===void 0?this.overrides.size>0&&(this.overrides.clear(),!0):this.overrides.delete(e))&&(this.stateEvaluator.rebuild(),this.repaint())}setEditorStates(e,t){this.stateEvaluator.setEditorStates(e,t),this.repaint()}repaint(){this.hasPainted&&(this.pendingSwap!==0&&this.isCurrent(this.pendingSwap)||(this.renderAt(this.stateEvaluator.currentFrame),this.settleTrailing()))}settleTrailing(){this.trailingSettle||this.disposed||this.isPlaying||!this.hasBackgroundDecodes()||this.repaintBehindDecodes().catch(e=>{console.error("[PlaybackController] background decode failed:",e)})}trailingSettle=!1;hasBackgroundDecodes(){return this.storageAdapter.hasPendingDecodes()||this.storageAdapter.hasPendingUpgrades()}async repaintBehindDecodes(){this.trailingSettle=!0;try{for(let e=0;e<4&&this.hasBackgroundDecodes();e++){let[t,n]=await Promise.all([this.storageAdapter.warmPendingDecodes(),this.storageAdapter.warmPendingUpgrades()]);if(!(t||n)||this.disposed||this.isPlaying)return;if(this.paintInFlight!==0){this.repaintOwedSince=this.renders;return}this.renderAt(this.stateEvaluator.currentFrame)}}finally{this.trailingSettle=!1}}applyOverrides(){if(this.overrides.size===0)return;let e=this.stateEvaluator.currentCanvas;if(e)for(let[t,n]of this.overrides)hl(e,t)?.set(n)}play(e=1,t=!1){if(this.currentFrame>=this.totalFrames){this.seek(0).then(()=>this.masterClock.play(e,t)).catch(()=>{});return}this.masterClock.play(e,t)}pause(){this.masterClock.pause()}setMuted(e){this.audioDevice.setMuted(e)}dispose(){this.disposed=!0,this.masterClock.dispose(),this.audioDevice.dispose(),this.stateEvaluator.dispose(),this.store.dispose(),this.assetManager.dispose()}},Np=30;function zp(r){return{async warmPendingDecodes(){let[e,t]=await Promise.all([r.warmPendingDecodes(),r.warmPendingUpgrades()]);return e||t}}}function Bp(r,e){switch(r.assetType){case"image":return{type:"image",src:r.src};case"font":return{type:"font",family:r.src,weight:400};case"video":try{return{type:"video",src:r.src,trimStart:0,trimEnd:e.getVideoDuration(r.src)}}catch{return}default:return}}function NA(r){return r.children.length>0}function ml(r,e,t,n){let s={id:r.id,path:e,type:r.className,children:r._allChildren.map((a,d)=>ml(a,Ke(e,d),t,n))},o=n.get(e);o&&o.length>0&&(s.waveform=o);let i=t.get(e);return i&&(s.startFrame=i.startFrame,s.endFrame=i.endFrame),s}function jp(r,e){let t=new Map;for(let n of r){let s=n.ownerId!==void 0?e.get(n.ownerId):"";if(s===void 0)continue;let o={src:n.src,startTime:n.startAt,endTime:Number.isFinite(n.endAt)?n.endAt:null},i=t.get(s);i?i.push(o):t.set(s,[o])}return t}function hl(r,e){if(e==="")return r;let t=r;for(let n of e.split(".")){let s=t._allChildren[Number(n)];if(!s)return null;t=s}return t}function yl(r,e){if(r.id===e)return r;for(let t of r._allChildren){let n=yl(t,e);if(n)return n}return null}var Qn=class{manifest;constructor(e){this.manifest=e}reconcile(e){this.manifest=e}normalizeKey(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}getImageMeta(e){let t=this.manifest.image[this.normalizeKey(e)];if(!t)throw new Error(`Image asset not found: "${e}". Check the file exists in your public folder and the src matches its filename.`);return t}getVideoMeta(e){let t=this.manifest.video[this.normalizeKey(e)];if(!t)throw new Error(`Video asset not found: "${e}". Check the file exists in your public folder and the src matches its filename.`);return t}getAudioMeta(e){let t=this.manifest.audio[this.normalizeKey(e)];if(!t)throw new Error(`No audio metadata for src: ${e}`);return t}getFontMeta(e){let t=this.manifest.font[e];if(!t)throw new Error(`No font metadata for key: ${e}`);return t}getFontFamilyMetas(e){return Object.values(this.manifest.font).filter(t=>t.fontFamily===e)}getVideoDuration(e){return this.getVideoMeta(e).duration}getAudioDuration(e){return this.getAudioMeta(e).duration}getMediaDuration(e){let t=this.normalizeKey(e),n=this.manifest.audio[t];if(n)return n.duration;let s=this.manifest.video[t];if(s)return s.duration;throw new Error(`Audio asset not found: "${e}". Check the file exists in your public folder and the src matches its filename.`)}getImageSize(e){let{width:t,height:n}=this.getImageMeta(e);return{width:t,height:n}}};var es=class{controller;constructor(e){this.controller=e}get isPlaying(){return this.controller.isPlaying}get frame(){return this.controller.currentFrame}play(e=1,t=!1){this.controller.play(e,t)}pause(){this.controller.pause()}seekFrame(e){this.controller.seekWhilePlaying(e)}setMuted(e){this.controller.setMuted(e)}onTime(e){this.controller.onTime(e)}onPlay(e){this.controller.onPlay(e)}onPause(e){this.controller.onPause(e)}};var ts=class{_isPlaying=!1;_currentTime=0;_duration=0;get isPlaying(){return this._isPlaying}get currentTime(){return this._currentTime}get duration(){return this._duration}setDuration(e){this._duration=e}setCurrentTime(e,t=!0){if(this._currentTime!==e&&(this._currentTime=e,!!t))for(let n of this.timeCallbacks)n(e)}setPlaying(e){this._isPlaying=e}play(e,t){this._isPlaying=!0;for(let n of this.playCallbacks)n(this._currentTime,e,t)}async tick(){await Promise.all(this.tickCallbacks.map(e=>e(this._currentTime)))}pause(){this._isPlaying=!1;for(let e of this.pauseCallbacks)e()}tickCallbacks=[];playCallbacks=[];pauseCallbacks=[];timeCallbacks=[];dispose(){this.tickCallbacks.length=0,this.playCallbacks.length=0,this.pauseCallbacks.length=0,this.timeCallbacks.length=0}onTick(e){this.tickCallbacks.push(e)}onPlay(e){this.playCallbacks.push(e)}onPause(e){this.pauseCallbacks.push(e)}onTime(e){this.timeCallbacks.push(e)}};var rs=class extends ts{seek(e){this.setCurrentTime(e)}};var gl=class{engine;viewport;fps;constructor(e,t){this.engine=e,this._override={viewport:t.viewport,fps:t.fps},this._project=_l(t.document,t,e),this.viewport=this._project.viewport,this.fps=this._project.fps,this._catalog=new Qn(e.manifest),this._unsubscribe=e._onManifestChange(a=>{this._catalog.reconcile(a),this._storage.setCatalog(this._catalog),this._controller.reconcileCatalog()});let n={catalog:this._catalog,viewport:this.viewport,fps:this.fps};this._storage=e.platform.createStorageAdapter(n),this._renderContext=e.platform.createRenderContext(this._storage);let s=e.platform.createMeasureContext(this._storage),o=e.platform.createAudioSink(),i=e.platform.createTicker(this.fps,o);this.applyGlobals(),t.target!==void 0&&this._renderContext.mount(t.target),this._controller=new Jn({project:this._project,registry:e._registry,renderContext:this._renderContext,measurer:s,storageAdapter:this._storage,masterClock:i??new rs,audioDevice:o,assets:this._catalog,onPrecompProgress:t.onPrecompProgress}),this._playback=i===null?null:new es(this._controller)}get document(){return this._project}get playback(){return this._playback}get controller(){return this._controller}get surface(){return this._renderContext}get duration(){return this._controller.totalDuration}get totalFrames(){return this._controller.totalFrames}async seek(e){await this.seekFrame(Math.round(He(e,this.fps)))}async seekFrame(e){this.applyGlobals(),await this._controller.seek(e)}replace(e){let t=_l(e,this._override,this);if(t.fps!==this.fps||t.viewport.width!==this.viewport.width||t.viewport.height!==this.viewport.height)throw new Error(`Cannot replace a ${this.viewport.width}\xD7${this.viewport.height} @ ${this.fps}fps document with a ${t.viewport.width}\xD7${t.viewport.height} @ ${t.fps}fps one \u2014 open a new session.`);this._project=t,this.applyGlobals(),this._controller.setProject(t)}image(e={}){return this.applyGlobals(),this.engine.exporter.exportStill({...e,frame:e.frame??{kind:"last"},project:this._project,registry:this.engine._registry,manifest:e.manifest??this.engine.manifest})}export(e={}){return this.applyGlobals(),this.engine.exporter.exportVideo({...e,project:this._project,registry:this.engine._registry,manifest:e.manifest??this.engine.manifest})}dispose(){this._unsubscribe(),this._controller.dispose(),this._renderContext.dispose()}applyGlobals(){as(this._project.theme)}_override;_project;_catalog;_storage;_renderContext;_controller;_playback;_unsubscribe};function _l(r,e,t){let n=_d(r),s={...n,viewport:e.viewport??n.viewport??t.viewport,fps:e.fps??n.fps??t.fps};return Bd(s),s}function QA(r,e={}){let t=e.delimiter??",",n=Vp(r,t);if(n.length===0)return[];let s=n[0].map(c=>c.trim()),i=n.slice(1).map(c=>{let l={};return s.forEach((u,p)=>{l[u]=c[p]??""}),l}),a=Lp(s,i,e.numeric),d=Gp(s,i,a,e.boolean);return a.length===0&&d.length===0?i:i.map(c=>{let l={...c};for(let u of a){let p=c[u];p!==""&&(l[u]=Number(p))}for(let u of d){let p=c[u];p!==""&&(l[u]=p==="true")}return l})}function eM(r,e){throw new Error(`parseData("${r}") must be called with a static string literal so the @motionscript/vite-plugin macro can inline it at build time. If you're seeing this error at runtime, either the plugin isn't installed/registered, or this call's argument isn't a plain string literal.`)}function Lp(r,e,t){return t===!1?[]:Array.isArray(t)?t:r.filter(n=>{let s=!1;for(let o of e){let i=o[n];if(i!==""){if(!Number.isFinite(Number(i)))return!1;s=!0}}return s})}function Gp(r,e,t,n){if(n===!1)return[];if(Array.isArray(n))return n;let s=new Set(t);return r.filter(o=>{if(s.has(o))return!1;let i=!1;for(let a of e){let d=a[o];if(d!==""){if(d!=="true"&&d!=="false")return!1;i=!0}}return i})}function Vp(r,e){let t=[],n=[],s="",o=!1,i=!1,a=()=>{n.push(s),s=""},d=()=>{a(),t.push(n),n=[],i=!1};for(let c=0;c<r.length;c++){let l=r[c];if(o){l==='"'?r[c+1]==='"'?(s+='"',c++):o=!1:s+=l;continue}if(l==='"'){o=!0,i=!0;continue}if(l===e){i=!0,a();continue}if(l!=="\r"){if(l===`
|
|
14
|
-
`){(i||s)&&d();continue}s+=l,i=!0}}return(i||s)&&d(),t}var rM=(r,e)=>{let t=new Array(r);for(let n=0;n<r;n++)t[n]=e(n);return t};function sM(){let r=null;function e(t){if(t!==void 0)r=t;else{if(r===null)throw new Error("Reference not assigned yet");return r}}return e}var ns=class{state=0;constructor(e){this.setSeed(e)}setSeed(e){this.state=typeof e=="string"?e.split("").reduce((t,n)=>(t=(t<<5)-t+n.charCodeAt(0),t&t),0):e}next(){this.state|=0,this.state=this.state+1831565813|0;var e=Math.imul(this.state^this.state>>>15,1|this.state);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}},wl=4294967296,ai=class r{_seed;numericSeed;gen;spareGauss=null;constructor(e){this.gen=new ns(e),this.adopt(e)}get seed(){return this._seed}set seed(e){this.adopt(e)}static toNumeric(e){return typeof e=="string"?e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0),0):e}adopt(e){this._seed=e,this.numericSeed=r.toNumeric(e),this.gen.setSeed(e),this.spareGauss=null}nextFloat(e=0,t=1){return this.gen.next()*(t-e)+e}nextInt(e=0,t=wl){return Math.floor(this.gen.next()*(t-e))+e}floatArray(e,t=0,n=1){let s=new Array(e);for(let o=0;o<e;o++)s[o]=this.nextFloat(t,n);return s}intArray(e,t=0,n=wl){let s=new Array(e);for(let o=0;o<e;o++)s[o]=this.nextInt(t,n);return s}gauss(e=0,t=1){if(this.spareGauss!==null){let a=this.spareGauss;return this.spareGauss=null,e+t*a}let n,s,o;do n=this.gen.next()*2-1,s=this.gen.next()*2-1,o=n*n+s*s;while(o>=1||o===0);let i=Math.sqrt(-2*Math.log(o)/o);return this.spareGauss=s*i,e+t*(n*i)}noise(e,t=1){let n=e*t,s=Math.floor(n),o=n-s,i=o*o*(3-2*o),a=this.latticeValue(s),d=this.latticeValue(s+1);return a+(d-a)*i}reset(e=this._seed){this.adopt(e)}latticeValue(e){let t=Math.sin(e+this.numericSeed)*1e4;return t-Math.floor(t)}};export{Hs as a,bl as b,kl as c,Js as d,sr as e,Qs as f,hy as g,ha as h,ma as i,ya as j,oe as k,Ke as l,tn as m,rn as n,ro as o,D as p,no as q,z as r,Ue as s,Ot as t,nn as u,Tt as v,ht as w,Pt as x,dn as y,ie as z,L as A,R as B,ar as C,P as D,wa as E,xa as F,va as G,ba as H,Sa as I,Gw as J,Vw as K,Kw as L,Uw as M,Yw as N,qw as O,Xw as P,ka as Q,Aa as R,Ta as S,Pa as T,Ca as U,fn as V,Ea as W,Da as X,Fa as Y,Ia as Z,Ra as _,$a as $,Na as aa,za as ba,Ba as ca,mo as da,ja as ea,La as fa,Ga as ga,Va as ha,Ka as ia,Ua as ja,Ya as ka,qa as la,Xa as ma,Wa as na,Ha as oa,Za as pa,Ja as qa,Qa as ra,ed as sa,td as ta,rd as ua,nd as va,sd as wa,od as xa,id as ya,ad as za,dd as Aa,cd as Ba,ld as Ca,ud as Da,fd as Ea,pd as Fa,hd as Ga,md as Ha,yd as Ia,Et as Ja,tv as Ka,pn as La,Hl as Ma,S as Na,ae as Oa,rv as Pa,gd as Qa,hn as Ra,nv as Sa,Zl as Ta,Re as Ua,Jl as Va,_d as Wa,U as Xa,Z as Ya,su as Za,ou as _a,gn as $a,Md as ab,bo as bb,wu as cb,Bd as db,Tv as eb,wn as fb,Mu as gb,Ou as hb,Tu as ib,rb as jb,vn as kb,Du as lb,Ru as mb,Rt as nb,Pn as ob,Yb as pb,yf as qb,qb as rb,Hb as sb,Jb as tb,t0 as ub,r0 as vb,zo as wb,gf as xb,_f as yb,wf as zb,xf as Ab,bf as Bb,vc as Cb,Of as Db,Tf as Eb,Go as Fb,Pf as Gb,Cf as Hb,Dn as Ib,$e as Jb,Fn as Kb,Ne as Lb,bc as Mb,pr as Nb,hr as Ob,mr as Pb,Sc as Qb,In as Rb,Vo as Sb,pe as Tb,yr as Ub,Rn as Vb,Nt as Wb,$n as Xb,Bf as Yb,jf as Zb,Nn as _b,zn as $b,We as ac,Bn as bc,LS as cc,xt as dc,He as ec,VS as fc,zt as gc,gr as hc,Mc as ic,at as jc,Ae as kc,Bt as lc,jn as mc,Ar as nc,dt as oc,qn as pc,Zo as qc,zc as rc,Gk as sc,Wn as tc,Gt as uc,ri as vc,Uc as wc,Yc as xc,Me as yc,Jc as zc,Qc as Ac,el as Bc,tl as Cc,rl as Dc,Tr as Ec,ol as Fc,ct as Gc,al as Hc,dl as Ic,ii as Jc,pl as Kc,xA as Lc,vA as Mc,Jn as Nc,NA as Oc,Qn as Pc,es as Qc,ts as Rc,rs as Sc,gl as Tc,_l as Uc,QA as Vc,eM as Wc,rM as Xc,sM as Yc,ns as Zc,ai as _c};
|
|
15
|
-
//# sourceMappingURL=chunk-DDJN3QII.js.map
|