@lappis/cg-manager 0.0.1
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/LICENSE +21 -0
- package/dist/basic.d.ts +21 -0
- package/dist/command.d.ts +44 -0
- package/dist/commands/add.d.ts +4 -0
- package/dist/commands/call.d.ts +9 -0
- package/dist/commands/cg.d.ts +20 -0
- package/dist/commands/clear.d.ts +5 -0
- package/dist/commands/load.d.ts +4 -0
- package/dist/commands/loadbg.d.ts +41 -0
- package/dist/commands/mixer.d.ts +82 -0
- package/dist/commands/pause.d.ts +4 -0
- package/dist/commands/play.d.ts +4 -0
- package/dist/commands/print.d.ts +4 -0
- package/dist/commands/remove.d.ts +4 -0
- package/dist/commands/resume.d.ts +4 -0
- package/dist/commands/stop.d.ts +4 -0
- package/dist/commands/swap.d.ts +15 -0
- package/dist/commands.d.ts +13 -0
- package/dist/effect.d.ts +44 -0
- package/dist/executor.d.ts +63 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +1 -0
- package/dist/layers.d.ts +66 -0
- package/dist/plugin.d.ts +49 -0
- package/dist/transform.d.ts +46 -0
- package/dist/types/caspar/executor.d.ts +11 -0
- package/dist/types/caspar/process.d.ts +14 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/log.d.ts +19 -0
- package/dist/types/manager.d.ts +31 -0
- package/dist/types/plugin.d.ts +10 -0
- package/dist/types/scanner/db.d.ts +74 -0
- package/dist/types/scanner/dir.d.ts +16 -0
- package/dist/types/scanner/scanner.d.ts +7 -0
- package/dist/types/server.d.ts +14 -0
- package/dist/types/ui.d.ts +16 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Lapplandsveckan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/basic.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class BasicChannel {
|
|
2
|
+
protected readonly casparChannel: number;
|
|
3
|
+
constructor(casparChannel: number);
|
|
4
|
+
getCasparChannel(): number;
|
|
5
|
+
getCommandString(): string;
|
|
6
|
+
}
|
|
7
|
+
export declare class BasicLayer {
|
|
8
|
+
protected channel: BasicChannel;
|
|
9
|
+
protected casparLayer: number;
|
|
10
|
+
constructor(channel: BasicChannel);
|
|
11
|
+
static caspar(channel: BasicLayer): any;
|
|
12
|
+
static caspar(channel: BasicChannel, layer?: number): any;
|
|
13
|
+
static caspar(channel: number, layer?: number): any;
|
|
14
|
+
static from(channel: number | BasicChannel | BasicLayer, layer?: number): BasicChannel | BasicLayer;
|
|
15
|
+
protected setChannel(channel: BasicChannel): void;
|
|
16
|
+
protected setCasparLayer(layer: number): void;
|
|
17
|
+
protected onMove(): void;
|
|
18
|
+
getCasparLayer(): number;
|
|
19
|
+
getCasparChannel(): number;
|
|
20
|
+
getCommandString(): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BasicChannel, BasicLayer } from './basic';
|
|
2
|
+
export declare abstract class Command {
|
|
3
|
+
abstract getCommand(): string | undefined | void;
|
|
4
|
+
}
|
|
5
|
+
export declare abstract class BasicCommand {
|
|
6
|
+
protected abstract getCommandType(): string;
|
|
7
|
+
protected abstract getArguments(): string[];
|
|
8
|
+
private static create;
|
|
9
|
+
static from(command: string): ReturnType<typeof BasicCommand.create>;
|
|
10
|
+
static interpret(command: string): ReturnType<typeof BasicCommand.create>[];
|
|
11
|
+
protected compileArgs(): string;
|
|
12
|
+
getCommand(): string;
|
|
13
|
+
}
|
|
14
|
+
export declare abstract class LayeredCommand extends BasicCommand {
|
|
15
|
+
protected allocation?: BasicLayer | BasicChannel;
|
|
16
|
+
constructor(allocation?: BasicLayer | BasicChannel);
|
|
17
|
+
allocate(channel: BasicLayer | BasicChannel | number): any;
|
|
18
|
+
allocate(channel: BasicChannel | number, layer: number): any;
|
|
19
|
+
protected isChannel(): boolean;
|
|
20
|
+
protected isLayer(): boolean;
|
|
21
|
+
protected getPosition(): string;
|
|
22
|
+
}
|
|
23
|
+
export declare abstract class SimpleCommand extends LayeredCommand {
|
|
24
|
+
protected getArguments(): string[];
|
|
25
|
+
}
|
|
26
|
+
export declare abstract class SimpleArgsCommand extends SimpleCommand {
|
|
27
|
+
protected args: string[];
|
|
28
|
+
constructor(...args: string[]);
|
|
29
|
+
setArgs(...args: string[]): this;
|
|
30
|
+
protected getArguments(): string[];
|
|
31
|
+
}
|
|
32
|
+
export declare class CommandGroup extends Command {
|
|
33
|
+
protected readonly commands: Command[];
|
|
34
|
+
protected allocation?: BasicLayer | BasicChannel;
|
|
35
|
+
constructor(commands: Command[]);
|
|
36
|
+
allocate(channel: BasicLayer | BasicChannel | number): any;
|
|
37
|
+
allocate(channel: BasicChannel | number, layer: number): any;
|
|
38
|
+
getCommand(): string;
|
|
39
|
+
}
|
|
40
|
+
export declare class RawCommand extends Command {
|
|
41
|
+
private readonly command;
|
|
42
|
+
constructor(command: string);
|
|
43
|
+
getCommand(): string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LayeredCommand } from '../command';
|
|
2
|
+
export declare class CallCommand extends LayeredCommand {
|
|
3
|
+
private method;
|
|
4
|
+
constructor(method?: string);
|
|
5
|
+
static call(method: string): CallCommand;
|
|
6
|
+
setMethod(method: string): this;
|
|
7
|
+
protected getCommandType(): string;
|
|
8
|
+
protected getArguments(): string[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LayeredCommand } from '../command';
|
|
2
|
+
export declare class CgCommand extends LayeredCommand {
|
|
3
|
+
private cmd;
|
|
4
|
+
private cgLayer?;
|
|
5
|
+
private arguments;
|
|
6
|
+
constructor();
|
|
7
|
+
setLayer(layer: number): this;
|
|
8
|
+
private static single;
|
|
9
|
+
static add(templateName: string, playOnLoad?: boolean, data?: any): CgCommand;
|
|
10
|
+
static play(): CgCommand;
|
|
11
|
+
static stop(): CgCommand;
|
|
12
|
+
static next(): CgCommand;
|
|
13
|
+
static remove(): CgCommand;
|
|
14
|
+
static clear(): CgCommand;
|
|
15
|
+
static update(data: any): CgCommand;
|
|
16
|
+
static invoke(method: string): CgCommand;
|
|
17
|
+
static info(): CgCommand;
|
|
18
|
+
getCommandType(): string;
|
|
19
|
+
getArguments(): string[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LayeredCommand } from '../command';
|
|
2
|
+
import { BasicChannel, BasicLayer } from '../basic';
|
|
3
|
+
export declare enum Transition {
|
|
4
|
+
CUT = "CUT",
|
|
5
|
+
MIX = "MIX",
|
|
6
|
+
SLIDE = "SLIDE"
|
|
7
|
+
}
|
|
8
|
+
export declare enum Tween {
|
|
9
|
+
Linear = "Linear"
|
|
10
|
+
}
|
|
11
|
+
export declare enum Direction {
|
|
12
|
+
LEFT = "LEFT",
|
|
13
|
+
RIGHT = "RIGHT"
|
|
14
|
+
}
|
|
15
|
+
export interface PlayoutOptions {
|
|
16
|
+
duration?: number;
|
|
17
|
+
transition?: Transition;
|
|
18
|
+
tween?: Tween;
|
|
19
|
+
direction?: Direction;
|
|
20
|
+
seek?: number;
|
|
21
|
+
length?: number;
|
|
22
|
+
filter?: string;
|
|
23
|
+
loop?: boolean;
|
|
24
|
+
auto?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare class Color {
|
|
27
|
+
static RGBA(r: number, g: number, b: number, a?: number): string;
|
|
28
|
+
}
|
|
29
|
+
export declare class Video {
|
|
30
|
+
static getVideoArguments(options?: PlayoutOptions): string[];
|
|
31
|
+
}
|
|
32
|
+
export declare class LoadBGCommand extends LayeredCommand {
|
|
33
|
+
private arguments;
|
|
34
|
+
protected getCommandType(): string;
|
|
35
|
+
protected getArguments(): string[];
|
|
36
|
+
constructor();
|
|
37
|
+
private setArguments;
|
|
38
|
+
static video(video: string, options?: PlayoutOptions): LoadBGCommand;
|
|
39
|
+
static route(source: BasicLayer | BasicChannel): LoadBGCommand;
|
|
40
|
+
static color(color: string): LoadBGCommand;
|
|
41
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CommandGroup } from '../command';
|
|
2
|
+
interface ChromaEnabled {
|
|
3
|
+
enabled: true;
|
|
4
|
+
target_hue: number;
|
|
5
|
+
hue_width: number;
|
|
6
|
+
min_saturation: number;
|
|
7
|
+
min_brightness: number;
|
|
8
|
+
softness: number;
|
|
9
|
+
spill_suppress: number;
|
|
10
|
+
spill_suppress_saturation: number;
|
|
11
|
+
show_mask: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface ChromaDisabled {
|
|
14
|
+
enabled: false;
|
|
15
|
+
}
|
|
16
|
+
type Chrome = ChromaEnabled | ChromaDisabled;
|
|
17
|
+
interface Levels {
|
|
18
|
+
min_input: number;
|
|
19
|
+
max_input: number;
|
|
20
|
+
gamma: number;
|
|
21
|
+
min_output: number;
|
|
22
|
+
max_output: number;
|
|
23
|
+
}
|
|
24
|
+
interface Fill {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
x_scale: number;
|
|
28
|
+
y_scale: number;
|
|
29
|
+
}
|
|
30
|
+
interface Clip {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}
|
|
36
|
+
interface Anchor {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
}
|
|
40
|
+
interface Crop {
|
|
41
|
+
left_edge: number;
|
|
42
|
+
top_edge: number;
|
|
43
|
+
right_edge: number;
|
|
44
|
+
bottom_edge: number;
|
|
45
|
+
}
|
|
46
|
+
interface Perspective {
|
|
47
|
+
top_left: Anchor;
|
|
48
|
+
top_right: Anchor;
|
|
49
|
+
bottom_right: Anchor;
|
|
50
|
+
bottom_left: Anchor;
|
|
51
|
+
}
|
|
52
|
+
export type Tween = {
|
|
53
|
+
type?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
54
|
+
duration: number;
|
|
55
|
+
} | number;
|
|
56
|
+
export declare class MixerCommand extends CommandGroup {
|
|
57
|
+
constructor(shouldClear?: boolean);
|
|
58
|
+
protected single(command: string, args?: string[], tween?: Tween): this;
|
|
59
|
+
static create(): MixerCommand;
|
|
60
|
+
static clear(): MixerCommand;
|
|
61
|
+
keyer(keyer: number): this;
|
|
62
|
+
chroma(chroma: Chrome, tween?: Tween): this;
|
|
63
|
+
blend(blend: string): this;
|
|
64
|
+
invert(invert: boolean): this;
|
|
65
|
+
opacity(opacity: number, tween?: Tween): this;
|
|
66
|
+
brightness(brightness: number, tween?: Tween): this;
|
|
67
|
+
saturation(saturation: number, tween?: Tween): this;
|
|
68
|
+
contrast(contrast: number, tween?: Tween): this;
|
|
69
|
+
levels(levels: Levels, tween?: Tween): this;
|
|
70
|
+
fill(fill: Fill, tween?: Tween): this;
|
|
71
|
+
clip(clip: Clip, tween?: Tween): this;
|
|
72
|
+
anchor(anchor: Anchor, tween?: Tween): this;
|
|
73
|
+
crop(crop: Crop, tween?: Tween): this;
|
|
74
|
+
rotation(angle: number, tween?: Tween): this;
|
|
75
|
+
perspective(perspective: Perspective, tween?: Tween): this;
|
|
76
|
+
mipmap(mipmap: boolean): this;
|
|
77
|
+
volume(volume: number, tween?: Tween): this;
|
|
78
|
+
mastervolume(volume: number): this;
|
|
79
|
+
straightAlphaOutput(enabled: boolean): this;
|
|
80
|
+
clear(): this;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BasicCommand } from '../command';
|
|
2
|
+
import { BasicChannel, BasicLayer } from '../basic';
|
|
3
|
+
export declare class SwapCommand extends BasicCommand {
|
|
4
|
+
protected allocation1?: BasicLayer | BasicChannel;
|
|
5
|
+
protected allocation2?: BasicLayer | BasicChannel;
|
|
6
|
+
protected transforms: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
constructor(allocation1: BasicLayer | BasicChannel, allocation2: BasicLayer | BasicChannel, transforms?: boolean);
|
|
9
|
+
allocate1(channel: BasicLayer | BasicChannel | number): any;
|
|
10
|
+
allocate1(channel: BasicChannel | number, layer: number): any;
|
|
11
|
+
allocate2(channel: BasicLayer | BasicChannel | number): any;
|
|
12
|
+
allocate2(channel: BasicChannel | number, layer: number): any;
|
|
13
|
+
protected getCommandType(): string;
|
|
14
|
+
protected getArguments(): string[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { AddCommand } from './commands/add';
|
|
2
|
+
export { CallCommand } from './commands/call';
|
|
3
|
+
export { CgCommand } from './commands/cg';
|
|
4
|
+
export { ClearCommand } from './commands/clear';
|
|
5
|
+
export { LoadCommand } from './commands/load';
|
|
6
|
+
export { LoadBGCommand } from './commands/loadbg';
|
|
7
|
+
export { MixerCommand } from './commands/mixer';
|
|
8
|
+
export { PauseCommand } from './commands/pause';
|
|
9
|
+
export { PlayCommand } from './commands/play';
|
|
10
|
+
export { PrintCommand } from './commands/print';
|
|
11
|
+
export { RemoveCommand } from './commands/remove';
|
|
12
|
+
export { StopCommand } from './commands/stop';
|
|
13
|
+
export { SwapCommand } from './commands/swap';
|
package/dist/effect.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Transform } from './transform';
|
|
2
|
+
import { EffectGroup, Layer } from './layers';
|
|
3
|
+
export declare abstract class Effect {
|
|
4
|
+
private _active;
|
|
5
|
+
private _disposed;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
get active(): boolean;
|
|
8
|
+
protected transform: Transform;
|
|
9
|
+
getTransform(): Transform;
|
|
10
|
+
setTransform(transform: Transform): void;
|
|
11
|
+
protected applyTransform(): void;
|
|
12
|
+
protected effectGroup: EffectGroup;
|
|
13
|
+
get group(): EffectGroup;
|
|
14
|
+
get executor(): import("./executor").CommandExecutor;
|
|
15
|
+
protected constructor(effectGroup: EffectGroup);
|
|
16
|
+
activate(): any;
|
|
17
|
+
deactivate(): any;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
protected layers: Layer[];
|
|
20
|
+
getLayers(): Layer[];
|
|
21
|
+
protected allocateLayers(count?: number): Layer[];
|
|
22
|
+
protected deallocateLayers(layers: Layer[]): void;
|
|
23
|
+
updatePositions(): void;
|
|
24
|
+
getName(): string;
|
|
25
|
+
getMetadata(): {};
|
|
26
|
+
toJSON(): {
|
|
27
|
+
id: string;
|
|
28
|
+
type: string;
|
|
29
|
+
active: boolean;
|
|
30
|
+
metadata: {};
|
|
31
|
+
layers: {
|
|
32
|
+
id: string;
|
|
33
|
+
effect: string;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export type EffectConstructor = (group: EffectGroup, options: Record<string, any>) => Effect;
|
|
38
|
+
export declare class EffectRegistry {
|
|
39
|
+
private effects;
|
|
40
|
+
register(name: string, effect: EffectConstructor): void;
|
|
41
|
+
unregister(name: string): void;
|
|
42
|
+
get(name: string): EffectConstructor;
|
|
43
|
+
create(name: string, group: EffectGroup, options: Record<string, any>): Effect;
|
|
44
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Channel } from './layers';
|
|
2
|
+
import { Command } from './command';
|
|
3
|
+
import { Effect } from './effect';
|
|
4
|
+
export interface TemplateInfo {
|
|
5
|
+
id: string;
|
|
6
|
+
path: string;
|
|
7
|
+
type: string;
|
|
8
|
+
gdd?: any;
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CommandListener {
|
|
12
|
+
command: string;
|
|
13
|
+
success: (data: string[], code: number) => void;
|
|
14
|
+
error: (data: string[], code: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare class CommandExecutor {
|
|
17
|
+
protected templates: TemplateInfo[];
|
|
18
|
+
private lastFetch;
|
|
19
|
+
private fetchPromise;
|
|
20
|
+
get connected(): boolean;
|
|
21
|
+
protected _fetchTemplates(): Promise<any[]>;
|
|
22
|
+
protected fetchTemplates(): Promise<TemplateInfo[]>;
|
|
23
|
+
getTemplates(force?: boolean): Promise<TemplateInfo[]>;
|
|
24
|
+
resolveTemplates(): TemplateInfo[];
|
|
25
|
+
promise(command: string): Promise<{
|
|
26
|
+
data: string[];
|
|
27
|
+
code: number;
|
|
28
|
+
}>;
|
|
29
|
+
/** @description NOTE: only use this function when you are certain that the server won't respond */
|
|
30
|
+
executePassive(command: Command): void;
|
|
31
|
+
execute(command: Command): Promise<{
|
|
32
|
+
data: string[];
|
|
33
|
+
code: number;
|
|
34
|
+
}[]>;
|
|
35
|
+
channels: Map<number, Channel>;
|
|
36
|
+
getChannel(casparChannel: number): Channel;
|
|
37
|
+
getChannels(): Channel[];
|
|
38
|
+
allocateChannel(casparChannel: number): Channel;
|
|
39
|
+
executeAllocations(): void;
|
|
40
|
+
protected send(data: string): void;
|
|
41
|
+
protected receive(data: string): string;
|
|
42
|
+
protected listeners: CommandListener[];
|
|
43
|
+
protected addListener(listener: CommandListener): void;
|
|
44
|
+
protected removeListener(listener: CommandListener): void;
|
|
45
|
+
protected executeListeners(code: number, cmd: string, data: string[]): void;
|
|
46
|
+
protected onEvent(code: number, cmd: string, data: string[]): void;
|
|
47
|
+
protected effects: Map<string, Effect>;
|
|
48
|
+
getEffects(): Effect[];
|
|
49
|
+
getEffect(effect: string): Effect;
|
|
50
|
+
toJSON(): {
|
|
51
|
+
channels: {
|
|
52
|
+
channel: number;
|
|
53
|
+
layers: {
|
|
54
|
+
id: string;
|
|
55
|
+
effect: string;
|
|
56
|
+
}[];
|
|
57
|
+
groups: {
|
|
58
|
+
name: string;
|
|
59
|
+
effects: string[];
|
|
60
|
+
}[];
|
|
61
|
+
}[];
|
|
62
|
+
};
|
|
63
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
+
(()=>{"use strict";var t={7:t=>{var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,{once:!0})}(t,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var u=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var o,i,u,f;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),u=i[e]),void 0===u)u=i[e]=r,++t._eventsCount;else if("function"==typeof u?u=i[e]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),(o=c(t))>0&&u.length>o&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=u.length,f=l,console&&console.warn&&console.warn(f)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function y(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):h(o,o.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var u;if(e.length>0&&(u=e[0]),u instanceof Error)throw u;var a=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw a.context=u,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)n(c,this,e);else{var f=c.length,l=h(c,f);for(r=0;r<f;++r)n(l[r],this,e)}return!0},i.prototype.addListener=function(t,e){return f(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return f(this,t,e,!0)},i.prototype.once=function(t,e){return a(e),this.on(t,s(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,s(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,o,i,u;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){u=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,u||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return y(this,t,!0)},i.prototype.rawListeners=function(t){return y(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{r.r(n),r.d(n,{AddCommand:()=>J,BasicChannel:()=>l,BasicCommand:()=>L,BasicLayer:()=>s,CallCommand:()=>z,CasparPlugin:()=>nn,CgCommand:()=>at,Channel:()=>Er,ClearCommand:()=>vt,Command:()=>x,CommandExecutor:()=>Mr,CommandGroup:()=>R,Effect:()=>lr,EffectGroup:()=>Pr,EffectRegistry:()=>sr,Layer:()=>kr,LayeredCommand:()=>T,LoadBGCommand:()=>Lt,LoadCommand:()=>Bt,LogLevel:()=>e,MixerCommand:()=>Qt,PauseCommand:()=>ue,PlayCommand:()=>he,PluginAPI:()=>on,PrintCommand:()=>je,RawCommand:()=>I,RemoveCommand:()=>Te,SimpleArgsCommand:()=>A,SimpleCommand:()=>C,StopCommand:()=>Me,SwapCommand:()=>Ke,Transform:()=>ln});var t=r(7),e=function(t){return t.INFO="INFO",t.WARN="WARN",t.DEBUG="DEBUG",t.ERROR="ERROR",t.FATAL="FATAL",t.NONE="NONE",t}({});function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}function a(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t,e,r){return(e=f(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:String(e)}var l=function(){function t(e){i(this,t),c(this,"casparChannel",void 0),this.casparChannel=e}return a(t,[{key:"getCasparChannel",value:function(){return this.casparChannel}},{key:"getCommandString",value:function(){return this.getCasparChannel().toString()}}]),t}(),s=function(){function t(e){i(this,t),c(this,"channel",void 0),c(this,"casparLayer",void 0),this.setChannel(e)}return a(t,[{key:"setChannel",value:function(t){this.channel=t}},{key:"setCasparLayer",value:function(t){this.casparLayer=t,this.onMove()}},{key:"onMove",value:function(){}},{key:"getCasparLayer",value:function(){return this.casparLayer}},{key:"getCasparChannel",value:function(){var t;return null===(t=this.channel)||void 0===t?void 0:t.getCasparChannel()}},{key:"getCommandString",value:function(){var t=this.getCasparChannel(),e=this.getCasparLayer();if(void 0!==e&&void 0!==t)return"".concat(t,"-").concat(e)}}],[{key:"caspar",value:function(e,r){return t.from(e,r)}},{key:"from",value:function(e,r){if(e instanceof t)return e;if("number"==typeof e&&(e=new l(e)),"number"!=typeof r)return e;var n=new t(e);return n.setCasparLayer(r),n}}]),t}();function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=O(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},p.apply(this,arguments)}function h(t,e,r){return(e=E(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e,r){return e=O(e),function(t,e){if(e&&("object"===y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return g(t)}(t,w()?Reflect.construct(e,r||[],O(t).constructor):e.apply(t,r))}function g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function w(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(w=function(){return!!t})()}function O(t){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},O(t)}function j(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&S(t,e)}function S(t,e){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},S(t,e)}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,E(n.key),n)}}function P(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function E(t){var e=function(t,e){if("object"!=y(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==y(e)?e:String(e)}function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var x=P((function t(){k(this,t)})),L=function(){function t(){k(this,t)}return P(t,[{key:"compileArgs",value:function(){return this.getArguments().map((function(t){return t.startsWith('"')?t.indexOf(" ")>-1?t:'"'.concat(t,'"'):JSON.stringify(t)})).map((function(t){return t.indexOf(" ")>-1?t:t.substring(1,t.length-1)})).join(" ")}},{key:"getCommand",value:function(){var t=this.getCommandType();if(t){var e=this.compileArgs();return e?"".concat(t," ").concat(e,"\r\n"):"".concat(t,"\r\n")}}}],[{key:"create",value:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new(function(t){function r(){return k(this,r),d(this,r,arguments)}return j(r,t),P(r,[{key:"getCommandType",value:function(){return e}},{key:"getArguments",value:function(){return n}},{key:"getCmd",value:function(){return this.getCommandType()}},{key:"getArgs",value:function(){return this.getArguments()}}]),r}(t))}},{key:"from",value:function(t){if(t.endsWith("\r\n")&&(t=t.slice(0,-2)),t.indexOf("\r\n")>-1)throw new Error("Command cannot contain line breaks");for(var e=t.split(" "),r=e[0],n=e.slice(1),o=-1,i=0;i<n.length;i++){var u=n[i];if(o<0&&u.startsWith('"')&&(o=i),o>-1){if(!u.endsWith('"'))continue;for(var a=!1,c=u.length-2;c>=0&&"\\"===u[c];c--)a=!a;if(a)continue;for(var f=[],l=o;l<=i;l++)f.push(n[l]);n.splice(o,i-o+1,JSON.parse(f.join(" "))),o=-1}}if(o>-1)throw new Error("Command contains unclosed quotes");return this.create.apply(this,[r].concat(v(n)))}},{key:"interpret",value:function(t){var e=this;return t.split("\r\n").filter((function(t){return t.length>0})).map((function(t){return e.from(t)}))}}]),t}(),T=function(t){function e(t){var r;return k(this,e),h(g(r=d(this,e)),"allocation",void 0),t&&r.allocate(t),r}return j(e,t),P(e,[{key:"allocate",value:function(t,e){return this.allocation=s.from(t,e),this}},{key:"isChannel",value:function(){return this.allocation instanceof l}},{key:"isLayer",value:function(){return this.allocation instanceof s}},{key:"getPosition",value:function(){var t;return null===(t=this.allocation)||void 0===t?void 0:t.getCommandString()}}]),e}(L),C=function(t){function e(){return k(this,e),d(this,e,arguments)}return j(e,t),P(e,[{key:"getArguments",value:function(){var t=this.getPosition();return t?[t]:[]}}]),e}(T),A=function(t){function e(){var t;k(this,e),h(g(t=d(this,e)),"args",void 0);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.args=n,t}return j(e,t),P(e,[{key:"setArgs",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.args=e,this}},{key:"getArguments",value:function(){return[].concat(v(p(O(e.prototype),"getArguments",this).call(this)),v(this.args))}}]),e}(C),R=function(t){function e(t){var r;return k(this,e),h(g(r=d(this,e)),"commands",void 0),h(g(r),"allocation",void 0),r.commands=t,r}return j(e,t),P(e,[{key:"allocate",value:function(t,e){this.allocation=s.from(t,e);var r,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=m(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;o instanceof T&&o.allocate(this.allocation)}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"getCommand",value:function(){return this.commands.map((function(t){return t.getCommand()})).join("")}}]),e}(x),I=function(t){function e(t){var r;return k(this,e),h(g(r=d(this,e)),"command",void 0),r.command=t,r}return j(e,t),P(e,[{key:"getCommand",value:function(){return this.command}}]),e}(x);function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function D(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,B(n.key),n)}}function B(t){var e=function(t,e){if("object"!=N(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:String(e)}function M(t,e,r){return e=U(e),function(t,e){if(e&&("object"===N(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,G()?Reflect.construct(e,r||[],U(t).constructor):e.apply(t,r))}function G(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(G=function(){return!!t})()}function U(t){return U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},U(t)}function F(t,e){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},F(t,e)}var J=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),M(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&F(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&D(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function Y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,q(n.key),n)}}function W(t,e,r){return e=$(e),function(t,e){if(e&&("object"===V(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return K(t)}(t,H()?Reflect.construct(e,r||[],$(t).constructor):e.apply(t,r))}function H(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(H=function(){return!!t})()}function $(t){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$(t)}function K(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function X(t,e){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},X(t,e)}function q(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==V(e)?e:String(e)}var z=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=K(r=W(this,e)),i=void 0,(o=q(o="method"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.method=t,r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&X(t,e)}(e,t),r=e,o=[{key:"call",value:function(t){return new e(t)}}],(n=[{key:"setMethod",value:function(t){return this.method=t,this}},{key:"getCommandType",value:function(){return"CALL"}},{key:"getArguments",value:function(){return[this.method]}}])&&Y(r.prototype,n),o&&Y(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(T);function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function Z(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ut(n.key),n)}}function tt(t,e,r){return e=rt(e),function(t,e){if(e&&("object"===Q(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return nt(t)}(t,et()?Reflect.construct(e,r||[],rt(t).constructor):e.apply(t,r))}function et(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(et=function(){return!!t})()}function rt(t){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rt(t)}function nt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ot(t,e){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ot(t,e)}function it(t,e,r){return(e=ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ut(t){var e=function(t,e){if("object"!=Q(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Q(e)?e:String(e)}var at=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),it(nt(t=tt(this,e)),"cmd",void 0),it(nt(t),"cgLayer",void 0),it(nt(t),"arguments",[]),t}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ot(t,e)}(e,t),r=e,o=[{key:"single",value:function(t){var r=new e;return r.cmd=t,r}},{key:"add",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,o=e.single("ADD");return o.arguments.push(t),o.arguments.push(r?"1":"0"),n&&o.arguments.push(JSON.stringify(n)),o}},{key:"play",value:function(){return e.single("PLAY")}},{key:"stop",value:function(){return e.single("STOP")}},{key:"next",value:function(){return e.single("NEXT")}},{key:"remove",value:function(){return e.single("REMOVE")}},{key:"clear",value:function(){return e.single("CLEAR")}},{key:"update",value:function(t){var r=e.single("UPDATE");return r.arguments.push(JSON.stringify(t)),r}},{key:"invoke",value:function(t){var r=e.single("INVOKE");return r.arguments.push(t),r}},{key:"info",value:function(){return e.single("INFO")}}],(n=[{key:"setLayer",value:function(t){return this.cgLayer=t,this}},{key:"getCommandType",value:function(){return"CG"}},{key:"getArguments",value:function(){var t=this.arguments.slice();void 0!==this.cgLayer?t.unshift(this.cgLayer.toString()):"CLEAR"!==this.cmd&&t.unshift("0"),t.unshift(this.cmd);var e=this.getPosition();return e&&t.unshift(e),t}}])&&Z(r.prototype,n),o&&Z(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(T);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ft(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,lt(n.key),n)}}function lt(t){var e=function(t,e){if("object"!=ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ct(e)?e:String(e)}function st(t,e,r){return e=pt(e),function(t,e){if(e&&("object"===ct(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yt()?Reflect.construct(e,r||[],pt(t).constructor):e.apply(t,r))}function yt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yt=function(){return!!t})()}function pt(t){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pt(t)}function ht(t,e){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ht(t,e)}var vt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),st(this,e,arguments)}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ht(t,e)}(e,t),r=e,o=[{key:"all",value:function(){return new I("CLEAR ALL")}}],(n=[{key:"getCommandType",value:function(){return"CLEAR"}}])&&ft(r.prototype,n),o&&ft(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function bt(t){return function(t){if(Array.isArray(t))return dt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return dt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function gt(t,e,r){return e=Ot(e),function(t,e){if(e&&("object"===mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jt(t)}(t,wt()?Reflect.construct(e,r||[],Ot(t).constructor):e.apply(t,r))}function wt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wt=function(){return!!t})()}function Ot(t){return Ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ot(t)}function jt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function St(t,e){return St=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},St(t,e)}function _t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kt(n.key),n)}}function Et(t,e,r){return e&&Pt(t.prototype,e),r&&Pt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function kt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mt(e)?e:String(e)}var xt=function(){function t(){_t(this,t)}return Et(t,null,[{key:"getVideoArguments",value:function(t){var e,r=[];return(t=t||{}).transition&&(r.push(t.transition),r.push((null!==(e=t.duration)&&void 0!==e?e:0).toString()),t.tween&&r.push(t.tween),t.direction&&r.push(t.direction)),t.seek&&r.push("SEEK",t.seek.toString()),t.length&&r.push("LENGTH",t.length.toString()),t.filter&&r.push("FILTER",t.filter),t.loop&&r.push("LOOP"),t.auto&&r.push("AUTO"),r}}]),t}(),Lt=function(t){function e(){var t,r,n,o;return _t(this,e),r=jt(t=gt(this,e)),o=void 0,(n=kt(n="arguments"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t.arguments=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&St(t,e)}(e,t),Et(e,[{key:"getCommandType",value:function(){return"LOADBG"}},{key:"getArguments",value:function(){var t=this.getPosition();return t?[t].concat(bt(this.arguments)):[]}},{key:"setArguments",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.arguments=e,this}}],[{key:"video",value:function(t,e){var r;return(r=new this).setArguments.apply(r,[t].concat(bt(xt.getVideoArguments(e))))}},{key:"route",value:function(t){return(new this).setArguments("route://".concat(t.getCommandString()))}},{key:"color",value:function(t){return(new this).setArguments(t)}}]),e}(T);function Tt(t){return Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tt(t)}function Ct(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,At(n.key),n)}}function At(t){var e=function(t,e){if("object"!=Tt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tt(e)?e:String(e)}function Rt(t,e,r){return e=Nt(e),function(t,e){if(e&&("object"===Tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,It()?Reflect.construct(e,r||[],Nt(t).constructor):e.apply(t,r))}function It(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(It=function(){return!!t})()}function Nt(t){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(t)}function Dt(t,e){return Dt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Dt(t,e)}var Bt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Rt(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dt(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"LOAD"}}])&&Ct(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(Lt);function Mt(t){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mt(t)}function Gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ft(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qt(n.key),n)}}function Jt(t,e,r){return e&&Ft(t.prototype,e),r&&Ft(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vt(t,e,r){return e=Wt(e),function(t,e){if(e&&("object"===Mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ht(t)}(t,Yt()?Reflect.construct(e,r||[],Wt(t).constructor):e.apply(t,r))}function Yt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yt=function(){return!!t})()}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}function Ht(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kt(t,e)}function Kt(t,e){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kt(t,e)}function Xt(t,e,r){return(e=qt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qt(t){var e=function(t,e){if("object"!=Mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mt(e)?e:String(e)}var zt=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ut(this,e),Xt(Ht(r=Vt(this,e)),"command",void 0),Xt(Ht(r),"args",void 0),r.command=t,r.args=n,r}return $t(e,t),Jt(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(function(t){if(Array.isArray(t))return Gt(t)}(t=this.args)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Gt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var t}}]),e}(T),Qt=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Ut(this,e),t=Vt(this,e,[[]]),r&&t.commands.push(new zt("CLEAR")),t}return $t(e,t),Jt(e,[{key:"single",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;r&&("number"==typeof r?e.push(r.toString()):e.push(r.duration.toString())),"number"!=typeof r&&null!=r&&r.type&&e.push(r.type);var n=new zt(t,e);return this.commands.push(n),this}},{key:"keyer",value:function(t){return this.single("KEYER",[t.toString()])}},{key:"chroma",value:function(t,e){if(!t.enabled)return this.single("CHROMA",["0"]);var r=[1,t.target_hue,t.hue_width,t.min_saturation,t.min_brightness,t.softness,t.spill_suppress,t.spill_suppress_saturation,t.show_mask?1:0];return this.single("CHROMA",r.map((function(t){return t.toString()})),e)}},{key:"blend",value:function(t){return this.single("BLEND",[t])}},{key:"invert",value:function(t){return this.single("INVERT",[t?"1":"0"])}},{key:"opacity",value:function(t,e){var r=[t];return this.single("OPACITY",r.map((function(t){return t.toString()})),e)}},{key:"brightness",value:function(t,e){var r=[t];return this.single("BRIGHTNESS",r.map((function(t){return t.toString()})),e)}},{key:"saturation",value:function(t,e){var r=[t];return this.single("SATURATION",r.map((function(t){return t.toString()})),e)}},{key:"contrast",value:function(t,e){var r=[t];return this.single("CONTRAST",r.map((function(t){return t.toString()})),e)}},{key:"levels",value:function(t,e){var r=[t.min_input,t.max_input,t.gamma,t.min_output,t.max_output];return this.single("LEVELS",r.map((function(t){return t.toString()})),e)}},{key:"fill",value:function(t,e){var r=[t.x,t.y,t.x_scale,t.y_scale];return this.single("FILL",r.map((function(t){return t.toString()})),e)}},{key:"clip",value:function(t,e){var r=[t.x,t.y,t.width,t.height];return this.single("CLIP",r.map((function(t){return t.toString()})),e)}},{key:"anchor",value:function(t,e){var r=[t.x,t.y];return this.single("ANCHOR",r.map((function(t){return t.toString()})),e)}},{key:"crop",value:function(t,e){var r=[t.left_edge,t.top_edge,t.right_edge,t.bottom_edge];return this.single("CROP",r.map((function(t){return t.toString()})),e)}},{key:"rotation",value:function(t,e){var r=[t];return this.single("ROTATION",r.map((function(t){return t.toString()})),e)}},{key:"perspective",value:function(t,e){var r=[t.top_left.x,t.top_left.y,t.top_right.x,t.top_right.y,t.bottom_right.x,t.bottom_right.y,t.bottom_left.x,t.bottom_left.y];return this.single("PERSPECTIVE",r.map((function(t){return t.toString()})),e)}},{key:"mipmap",value:function(t){return this.single("MIPMAP",[t?"1":"0"])}},{key:"volume",value:function(t,e){var r=[t];return this.single("VOLUME",r.map((function(t){return t.toString()})),e)}},{key:"mastervolume",value:function(t){return this.single("MASTERVOLUME",[t.toString()])}},{key:"straightAlphaOutput",value:function(t){return this.single("STRAIGHT_ALPHA_OUTPUT",[t?"1":"0"])}},{key:"clear",value:function(){return this.commands.splice(0,this.commands.length),this}}],[{key:"create",value:function(){return new e}},{key:"clear",value:function(){return new e(!0)}}]),e}(R);function Zt(t){return Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zt(t)}function te(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ee(n.key),n)}}function ee(t){var e=function(t,e){if("object"!=Zt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zt(e)?e:String(e)}function re(t,e,r){return e=oe(e),function(t,e){if(e&&("object"===Zt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ne()?Reflect.construct(e,r||[],oe(t).constructor):e.apply(t,r))}function ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ne=function(){return!!t})()}function oe(t){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},oe(t)}function ie(t,e){return ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ie(t,e)}var ue=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),re(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ie(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PAUSE"}}])&&te(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function ae(t){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ae(t)}function ce(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fe(n.key),n)}}function fe(t){var e=function(t,e){if("object"!=ae(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ae(e)?e:String(e)}function le(t,e,r){return e=ye(e),function(t,e){if(e&&("object"===ae(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,se()?Reflect.construct(e,r||[],ye(t).constructor):e.apply(t,r))}function se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(se=function(){return!!t})()}function ye(t){return ye=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ye(t)}function pe(t,e){return pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pe(t,e)}var he=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),le(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PLAY"}}])&&ce(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(Lt);function ve(t){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(t)}function me(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,be(n.key),n)}}function be(t){var e=function(t,e){if("object"!=ve(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ve(e)?e:String(e)}function de(t,e,r){return e=we(e),function(t,e){if(e&&("object"===ve(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ge()?Reflect.construct(e,r||[],we(t).constructor):e.apply(t,r))}function ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ge=function(){return!!t})()}function we(t){return we=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},we(t)}function Oe(t,e){return Oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oe(t,e)}var je=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),de(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Oe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&me(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function Se(t){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(t)}function _e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pe(n.key),n)}}function Pe(t){var e=function(t,e){if("object"!=Se(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Se(e)?e:String(e)}function Ee(t,e,r){return e=xe(e),function(t,e){if(e&&("object"===Se(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ke()?Reflect.construct(e,r||[],xe(t).constructor):e.apply(t,r))}function ke(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ke=function(){return!!t})()}function xe(t){return xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xe(t)}function Le(t,e){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Le(t,e)}var Te=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ee(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Le(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&_e(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);function Ce(t){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ce(t)}function Ae(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Re(n.key),n)}}function Re(t){var e=function(t,e){if("object"!=Ce(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ce(e)?e:String(e)}function Ie(t,e,r){return e=De(e),function(t,e){if(e&&("object"===Ce(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ne()?Reflect.construct(e,r||[],De(t).constructor):e.apply(t,r))}function Ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ne=function(){return!!t})()}function De(t){return De=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},De(t)}function Be(t,e){return Be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Be(t,e)}var Me=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ie(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Be(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&Ae(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function Ge(t){return Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(t)}function Ue(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$e(n.key),n)}}function Fe(t,e,r){return e=Ve(e),function(t,e){if(e&&("object"===Ge(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ye(t)}(t,Je()?Reflect.construct(e,r||[],Ve(t).constructor):e.apply(t,r))}function Je(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Je=function(){return!!t})()}function Ve(t){return Ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ve(t)}function Ye(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function We(t,e){return We=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},We(t,e)}function He(t,e,r){return(e=$e(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $e(t){var e=function(t,e){if("object"!=Ge(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ge(e)?e:String(e)}var Ke=function(t){function e(t,r){var n,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),He(Ye(n=Fe(this,e)),"allocation1",void 0),He(Ye(n),"allocation2",void 0),He(Ye(n),"transforms",void 0),t&&n.allocate1(t),r&&n.allocate2(r),n.transforms=o,n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&We(t,e)}(e,t),r=e,(n=[{key:"allocate1",value:function(t,e){return this.allocation1=s.from(t,e),this}},{key:"allocate2",value:function(t,e){return this.allocation2=s.from(t,e),this}},{key:"getCommandType",value:function(){return"SWAP"}},{key:"getArguments",value:function(){var t,e,r=null===(t=this.allocation1)||void 0===t?void 0:t.getCommandString(),n=null===(e=this.allocation2)||void 0===e?void 0:e.getCommandString();if(!r||!n)return[];var o=[r,n];return this.transforms&&o.push("TRANSFORM"),o}}])&&Ue(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(L);const Xe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let qe;const ze=new Uint8Array(16);function Qe(){if(!qe&&(qe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qe(ze)}const Ze=[];for(let t=0;t<256;++t)Ze.push((t+256).toString(16).slice(1));const tr=function(t,e,r){if(Xe.randomUUID&&!e&&!t)return Xe.randomUUID();const n=(t=t||{}).random||(t.rng||Qe)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=n[t];return e}return function(t,e=0){return Ze[t[e+0]]+Ze[t[e+1]]+Ze[t[e+2]]+Ze[t[e+3]]+"-"+Ze[t[e+4]]+Ze[t[e+5]]+"-"+Ze[t[e+6]]+Ze[t[e+7]]+"-"+Ze[t[e+8]]+Ze[t[e+9]]+"-"+Ze[t[e+10]]+Ze[t[e+11]]+Ze[t[e+12]]+Ze[t[e+13]]+Ze[t[e+14]]+Ze[t[e+15]]}(n)};function er(t){return er="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(t)}function rr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=nr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function nr(t,e){if(t){if("string"==typeof t)return or(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?or(t,e):void 0}}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ir(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ur(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fr(n.key),n)}}function ar(t,e,r){return e&&ur(t.prototype,e),r&&ur(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cr(t,e,r){return(e=fr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fr(t){var e=function(t,e){if("object"!=er(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=er(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==er(e)?e:String(e)}var lr=function(){function t(e){ir(this,t),cr(this,"_active",!1),cr(this,"_disposed",!1),cr(this,"id",tr()),cr(this,"transform",void 0),cr(this,"effectGroup",void 0),cr(this,"layers",[]),this.effectGroup=e,this.group.addEffect(this)}return ar(t,[{key:"active",get:function(){return this._active}},{key:"getTransform",value:function(){return this.transform}},{key:"setTransform",value:function(t){this.transform=t,this.applyTransform()}},{key:"applyTransform",value:function(){if(this.active&&this.transform){var t,e=rr(this.layers);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.executor.execute(this.transform.getCommand().allocate(r))}}catch(t){e.e(t)}finally{e.f()}}}},{key:"group",get:function(){return this.effectGroup}},{key:"executor",get:function(){return this.group.channel.executor}},{key:"activate",value:function(){return!this._disposed&&!this.active&&(this._active=!0,this.executor.executeAllocations(),this.applyTransform(),!0)}},{key:"deactivate",value:function(){return!!this.active&&(this._active=!1,!0)}},{key:"dispose",value:function(){this._disposed||(this._disposed=!0,this.deactivate(),this.deallocateLayers(this.layers),this.executor.executeAllocations(),this.group.removeEffect(this),this.effectGroup=null,this.transform=null)}},{key:"getLayers",value:function(){return this.layers}},{key:"allocateLayers",value:function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=this.group.getEffectIndex(this),o=this.group.channel.allocateLayers({count:r,index:n});(t=this.layers).push.apply(t,function(t){if(Array.isArray(t))return or(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||nr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var i,u=rr(o);try{for(u.s();!(i=u.n()).done;)i.value.setEffect(this)}catch(t){u.e(t)}finally{u.f()}return o}},{key:"deallocateLayers",value:function(t){var e,r=rr(t=t.slice());try{for(r.s();!(e=r.n()).done;){var n=e.value;n.setEffect(null);var o=this.layers.indexOf(n);o>=0&&this.layers.splice(o,1)}}catch(t){r.e(t)}finally{r.f()}this.group.channel.deallocateLayers(t)}},{key:"updatePositions",value:function(){}},{key:"getName",value:function(){return this.constructor.name}},{key:"getMetadata",value:function(){return{}}},{key:"toJSON",value:function(){return{id:this.id,type:this.getName(),active:this.active,metadata:this.getMetadata(),layers:this.layers.map((function(t){return t.toJSON()}))}}}]),t}(),sr=function(){function t(){ir(this,t),cr(this,"effects",new Map)}return ar(t,[{key:"register",value:function(t,e){this.effects.set(t,e)}},{key:"unregister",value:function(t){this.effects.delete(t)}},{key:"get",value:function(t){return this.effects.get(t)}},{key:"create",value:function(t,e,r){var n=this.get(t);return n?n(e,r):null}}]),t}();function yr(t){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(t)}function pr(t,e,r){return e=vr(e),function(t,e){if(e&&("object"===yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return mr(t)}(t,hr()?Reflect.construct(e,r||[],vr(t).constructor):e.apply(t,r))}function hr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(hr=function(){return!!t})()}function vr(t){return vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vr(t)}function mr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function br(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dr(t,e)}function dr(t,e){return dr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dr(t,e)}function gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Or(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_r(n.key),n)}}function jr(t,e,r){return e&&Or(t.prototype,e),r&&Or(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Sr(t,e,r){return(e=_r(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _r(t){var e=function(t,e){if("object"!=yr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yr(e)?e:String(e)}var Pr=function(){function t(e,r){wr(this,t),Sr(this,"effects",[]),Sr(this,"name",void 0),Sr(this,"channel",void 0),this.name=r,this.channel=e}return jr(t,[{key:"addEffect",value:function(t){this.effects.push(t),this.channel.executor.effects.set(t.id,t)}},{key:"removeEffect",value:function(t){var e=this.effects.indexOf(t);e>=0&&this.effects.splice(e,1),this.channel.executor.effects.delete(t.id)}},{key:"dispose",value:function(){var t,e=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return gr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.effects);try{for(e.s();!(t=e.n()).done;)t.value.dispose()}catch(t){e.e(t)}finally{e.f()}}},{key:"getEffectIndex",value:function(t){var e=this.effects.indexOf(t);if(e<0)throw new Error("Effect not found in group");for(;e>=0;){var r=this.effects[e].getLayers();if(r.length){var n=r[r.length-1];return this.channel.getLayerIndex(n)+1}e--}return this.getStartingIndex()}},{key:"getStartingIndex",value:function(){var t=this.channel.groups.indexOf(this);if(t<0)throw new Error("Effect group not found in channel");if(0===t)return 0;for(;t>0;){t--;var e=this.channel.groups[t];if(!(e.effects.length<1)){for(var r=e.effects,n=r.length-1;n>=0&&!r[n].getLayers().length;)n--;if(!(n<0)){var o=r[n].getLayers(),i=o[o.length-1];return this.channel.getLayerIndex(i)+1}}}return 0}},{key:"toJSON",value:function(){return{name:this.name,effects:this.effects.map((function(t){return t.id}))}}}]),t}(),Er=function(t){function e(t,r){var n;return wr(this,e),Sr(mr(n=pr(this,e,[t])),"layers",new Map),Sr(mr(n),"groups",[]),Sr(mr(n),"lastOrder",[]),Sr(mr(n),"currentOrder",[]),Sr(mr(n),"executor",void 0),Sr(mr(n),"needExecute",!1),n.executor=r,n}return br(e,t),jr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Pr(this,t);return e=e<0?this.groups.length:e,this.groups.splice(e,0,r),r}},{key:"getGroup",value:function(t,e){var r;t=null!==(r=t)&&void 0!==r?r:tr();var n=this.groups.find((function(e){return e.name===t}));return null!=n?n:this.createGroup(t,null!=e?e:-1)}},{key:"setExecutor",value:function(t){this.executor=t}},{key:"getLayer",value:function(t){return this.layers.get(t)}},{key:"getLayers",value:function(){var t=this;return this.currentOrder.map((function(e){return t.layers.get(e)})).filter((function(t){return void 0!==t}))}},{key:"getLayerIndex",value:function(t){return this.currentOrder.indexOf(t.id)}},{key:"allocateLayers",value:function(t){var e,r,n,o,i=null!==(r=(t=null!==(e=t)&&void 0!==e?e:{}).count)&&void 0!==r?r:1;if(i<1)throw new Error("You have to allocate at least 1 layer");for(var u=new Array(i),a=new Array(i),c=0;c<i;c++){var f=new kr(this);this.layers.set(f.id,f),u[c]=f,a[c]=f.id}var l=null!==(n=t.index)&&void 0!==n?n:this.currentOrder.length;(o=this.currentOrder).splice.apply(o,[l,0].concat(a));for(var s=l+1;s<this.currentOrder.length&&i>0;s++)void 0===this.currentOrder[s]&&(this.currentOrder.splice(s,1),i--,s--);return this.needExecute=!0,u}},{key:"allocateLayer",value:function(t){return this.allocateLayers({index:t,count:1})[0]}},{key:"deallocateLayers",value:function(t){for(var e=0;e<t.length;e++){var r=t[e],n=this.currentOrder.indexOf(r.id);this.currentOrder[n]=void 0,this.layers.delete(r.id)}this.needExecute=!0}},{key:"executeAllocation",value:function(){if(this.needExecute){this.needExecute=!1;for(var t=[],e=this.lastOrder.slice(),r=0;r<e.length;r++){var n=e[r];if(void 0!==n&&!(this.currentOrder.indexOf(n)>=0)){e[r]=void 0;var o=s.caspar(this.casparChannel,r+1);t.push(new vt(o)),t.push(Qt.clear().allocate(o))}}for(var i=0;i<this.currentOrder.length;i++){var u=this.currentOrder[i];if(void 0!==u){this.layers.get(u).setCasparLayer(i+1);var a=e.indexOf(u);if(a!==i&&!(a<0)){e[a]=e[i],e[i]=u;var c=s.caspar(this.casparChannel,i+1),f=s.caspar(this.casparChannel,a+1);t.push(new Ke(c,f,!0))}}}this.lastOrder=this.currentOrder,this.currentOrder=this.currentOrder.slice();for(var l=0;l<this.currentOrder.length;l++){var y=this.currentOrder[l];if(void 0!==y){var p=this.layers.get(y);p&&p.setCasparLayer(l+1)}}var h=new R(t);this.executor.execute(h)}}},{key:"toJSON",value:function(){var t=this;return{channel:this.casparChannel,layers:this.currentOrder.filter((function(t){return t})).map((function(e){return t.layers.get(e)})).map((function(t){return t.toJSON()})),groups:this.groups.map((function(t){return t.toJSON()}))}}}]),e}(l),kr=function(t){function e(t){var r;return wr(this,e),Sr(mr(r=pr(this,e,[t])),"id",void 0),Sr(mr(r),"effect",void 0),r.id=tr(),r}return br(e,t),jr(e,[{key:"setEffect",value:function(t){this.effect=t}},{key:"getEffect",value:function(){return this.effect}},{key:"dispose",value:function(){this.channel.deallocateLayers([this])}},{key:"toJSON",value:function(){var t;return{id:this.id,effect:null===(t=this.effect)||void 0===t?void 0:t.id}}}]),e}(s);function xr(t){return xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xr(t)}function Lr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Tr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function Tr(t,e){if(t){if("string"==typeof t)return Cr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Cr(t,e):void 0}}function Cr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ar(){Ar=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new T(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function b(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=b.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==xr(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(xr(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function Rr(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function Ir(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){Rr(i,n,o,u,a,"next",t)}function a(t){Rr(i,n,o,u,a,"throw",t)}u(void 0)}))}}function Nr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Br(n.key),n)}}function Dr(t,e,r){return(e=Br(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Br(t){var e=function(t,e){if("object"!=xr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=xr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xr(e)?e:String(e)}var Mr=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Dr(this,"templates",[]),Dr(this,"lastFetch",0),Dr(this,"fetchPromise",null),Dr(this,"channels",new Map),Dr(this,"listeners",[]),Dr(this,"effects",new Map)}var e,r,n,o;return e=t,r=[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(o=Ir(Ar().mark((function t(){return Ar().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",[]);case 1:case"end":return t.stop()}}),t)}))),function(){return o.apply(this,arguments)})},{key:"fetchTemplates",value:function(){var t=this;return this.fetchPromise||(this.fetchPromise=this._fetchTemplates().then((function(e){return t.fetchPromise=null,t.templates=e}))),this.fetchPromise}},{key:"getTemplates",value:(n=Ir(Ar().mark((function t(){var e=arguments;return Ar().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e.length>0&&void 0!==e[0]&&e[0]||Date.now()-this.lastFetch>3e5)){t.next=5;break}return this.lastFetch=Date.now(),t.next=5,this.fetchTemplates();case 5:return t.abrupt("return",this.templates);case 6:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"resolveTemplates",value:function(){return this.templates}},{key:"promise",value:function(t){var e=this;return new Promise((function(r,n){var o;!function t(){o=setTimeout((function(){if(!e.connected)return t();e.removeListener(i),n({data:["Timeout"],code:-1})}),1e3)}();var i={command:t,success:function(t,e){o&&clearTimeout(o),r({data:t,code:e})},error:function(t,e){o&&clearTimeout(o),n({data:t,code:e})}};e.addListener(i)}))}},{key:"executePassive",value:function(t){var e=t.getCommand();e&&this.send(e)}},{key:"execute",value:function(t){var e=this,r=t.getCommand();if(r){var n=L.interpret(r).map((function(t){return e.promise(t.getCmd())}));return this.send(r),Promise.all(n)}}},{key:"getChannel",value:function(t){return this.channels.get(t)}},{key:"getChannels",value:function(){return Array.from(this.channels.values())}},{key:"allocateChannel",value:function(t){var e=new Er(t,this);return this.channels.set(t,e),e}},{key:"executeAllocations",value:function(){var t,e=Lr(this.channels.values());try{for(e.s();!(t=e.n()).done;)t.value.executeAllocation()}catch(t){e.e(t)}finally{e.f()}}},{key:"send",value:function(t){}},{key:"receive",value:function(t){for(var e=t.split("\r\n"),r=e.pop(),n=0,o=0;o<e.length;o++){var i=e[o].split(" "),u=parseInt(i[0]),a=[];if((101===u||201===u||400===u)&&(o++,a.push(e[o]),o===e.length))break;if(200===u){for(o++;e[o];)a.push(e[o]),o++;if(o===e.length)break}n=o+1;var c=null;400!==u&&500!==u&&(c=i[1]),this.executeListeners(u,c,a),this.onEvent(u,c,a)}return[].concat((f=e.slice(n),function(t){if(Array.isArray(t))return Cr(t)}(f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(f)||Tr(f)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),[r]).join("\r\n");var f}},{key:"addListener",value:function(t){this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},{key:"executeListeners",value:function(t,e,r){if(!(t<200)&&e){var n,o=2===Math.floor(t/100),i=Lr(this.listeners);try{for(i.s();!(n=i.n()).done;){var u=n.value;if(u.command===e){o?u.success(r,t):u.error(r,t),this.removeListener(u);break}}}catch(t){i.e(t)}finally{i.f()}}}},{key:"onEvent",value:function(t,e,r){}},{key:"getEffects",value:function(){return Array.from(this.effects.values())}},{key:"getEffect",value:function(t){return this.effects.get(t)}},{key:"toJSON",value:function(){return{channels:this.getChannels().map((function(t){return t.toJSON()}))}}}],r&&Nr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Gr(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function Ur(t){return Ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(t)}function Fr(){Fr=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new T(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function b(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=b.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==Ur(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Ur(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function Jr(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function Vr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=qr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function Yr(t,e,r){return e=Hr(e),function(t,e){if(e&&("object"===Ur(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return $r(t)}(t,Wr()?Reflect.construct(e,r||[],Hr(t).constructor):e.apply(t,r))}function Wr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wr=function(){return!!t})()}function Hr(t){return Hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hr(t)}function $r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Kr(t,e){return Kr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kr(t,e)}function Xr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||qr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qr(t,e){if(t){if("string"==typeof t)return zr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zr(t,e):void 0}}function zr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Qr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rn(n.key),n)}}function tn(t,e,r){return e&&Zr(t.prototype,e),r&&Zr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function en(t,e,r){return(e=rn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rn(t){var e=function(t,e){if("object"!=Ur(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ur(e)?e:String(e)}var nn=function(){function t(){Qr(this,t),en(this,"_api",void 0),en(this,"_enabled",!1),en(this,"logger",void 0)}return tn(t,[{key:"pluginName",get:function(){return this.constructor.pluginName}},{key:"enable",value:function(t){var e=this;if(!this._enabled){this._enabled=!0;var r=Xr(Gr((function(){return e.onEnable()})),1)[0];if(r)return t.error("Error enabling plugin: ".concat(r)),void(this._enabled=!1);t.debug("Enabled")}}},{key:"disable",value:function(t){var e=this;if(this._enabled){this._enabled=!1,this._api.unregister();var r=Xr(Gr((function(){return e.onDisable()})),1)[0];r?t.error("Error disabling plugin: ".concat(r)):t.debug("Disabled")}}},{key:"onEnable",value:function(){}},{key:"onDisable",value:function(){}},{key:"api",get:function(){return this._api}}],[{key:"pluginName",get:function(){return this.name}}]),t}(),on=function(t){function e(t,r){var n;return Qr(this,e),en($r(n=Yr(this,e)),"files",[]),en($r(n),"uiInjections",[]),en($r(n),"_manager",void 0),en($r(n),"_plugin",void 0),en($r(n),"_effects",[]),en($r(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=$r(n),n._plugin.logger=t.getLogger("Plugin").scope(n._plugin.pluginName),n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kr(t,e)}(e,t),tn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=Vr(this._effects);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.effects.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this._effects=[]}},{key:"unregisterRoutes",value:function(){var t,e=Vr(this.routes);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.server.unregisterRoute(r)}}catch(t){e.e(t)}finally{e.f()}this.routes=[]}},{key:"unregisterFiles",value:(r=Fr().mark((function t(){var e,r,n;return Fr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Vr(this.files),t.prev=1,e.s();case 3:if((r=e.n()).done){t.next=9;break}return n=r.value,t.next=7,this._manager.directory.deleteDirectory(n);case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:this.files=[];case 18:case"end":return t.stop()}}),t,this,[[1,11,14,17]])})),n=function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function u(t){Jr(i,n,o,u,a,"next",t)}function a(t){Jr(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=Vr(this.uiInjections);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.ui.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this.uiInjections=[]}},{key:"unregister",value:function(){return this.unregisterEffects(),this.unregisterRoutes(),this.unregisterUIInjections(),this.unregisterFiles()}},{key:"registerRoute",value:function(t,e,r){var n=this._manager.server.registerRoute("plugin/".concat(this._plugin.pluginName,"/").concat(t),e,r);return this.routes.push(n),n}},{key:"unregisterRoute",value:function(t){var e=this.routes.indexOf(t);e<0||(this.routes.splice(e,1),this._manager.server.unregisterRoute(t))}},{key:"registerFile",value:function(t,e){var r=this;return this._manager.directory.createDirectory(t,e).then((function(t){return r.files.push(t.id),t}))}},{key:"getEffectGroup",value:function(t,e){return this._manager.executor.getEffectGroup(t,e)}},{key:"unregisterFile",value:function(t){var e=this.files.indexOf(t);if(!(e<0))return this.files.splice(e,1),this._manager.directory.deleteDirectory(t)}},{key:"getDirectory",value:function(t){if(this.files.includes(t))return this._manager.directory.getDirectory(t)}},{key:"getDirectories",value:function(){var t=this;return this.files.map((function(e){return t._manager.directory.getDirectory(e)}))}},{key:"registerUI",value:function(t,e){var r=this._manager.ui.register(t,e,this._plugin.pluginName);this.uiInjections.push(r)}},{key:"unregisterUI",value:function(t){var e=this.uiInjections.indexOf(t);e<0||(this.uiInjections.splice(e,1),this._manager.ui.unregister(t))}},{key:"createEffect",value:function(t,e,r){var n=this._manager.executor.getEffectGroup(e);return this._manager.effects.create(t,n,r)}},{key:"getEffect",value:function(t){return this._manager.executor.getEffect(t)}}]),e}(t.EventEmitter);function un(t){return un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},un(t)}function an(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fn(n.key),n)}}function cn(t,e,r){return(e=fn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fn(t){var e=function(t,e){if("object"!=un(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=un(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==un(e)?e:String(e)}var ln=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),cn(this,"source",void 0),cn(this,"destination",void 0),cn(this,"fillTransition",null),cn(this,"cropTransition",null),this.source=e,this.destination=r}var e,r,n;return e=t,n=[{key:"getRect",value:function(t,e,r,n){return{start:{x:t,y:e},end:{x:r,y:n}}}},{key:"normalRect",value:function(){return t.getRect(0,0,1,1)}},{key:"fromArray",value:function(e){return new t(t.getRect(e[0],e[1],e[2],e[3]),t.getRect(e[4],e[5],e[6],e[7]))}}],(r=[{key:"setTween",value:function(t,e){void 0===t&&(t=null),void 0===e&&(e=t),this.fillTransition=t,this.cropTransition=e}},{key:"getFill",value:function(t){return{x:t.start.x,y:t.start.y,x_scale:t.end.x-t.start.x,y_scale:t.end.y-t.start.y}}},{key:"getCrop",value:function(t){return{left_edge:t.start.x,top_edge:t.start.y,right_edge:t.end.x,bottom_edge:t.end.y}}},{key:"getCommand",value:function(){return Qt.create().crop(this.getCrop(this.source),this.cropTransition).fill(this.getFill(this.destination),this.fillTransition)}}])&&an(e.prototype,r),n&&an(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
package/dist/layers.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Effect } from './effect';
|
|
2
|
+
import { BasicChannel, BasicLayer } from './basic';
|
|
3
|
+
import { CommandExecutor } from './executor';
|
|
4
|
+
export interface AllocateOptions {
|
|
5
|
+
count?: number;
|
|
6
|
+
index?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class EffectGroup {
|
|
9
|
+
effects: Effect[];
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly channel: Channel;
|
|
12
|
+
constructor(channel: Channel, name: string);
|
|
13
|
+
addEffect(effect: Effect): void;
|
|
14
|
+
removeEffect(effect: Effect): void;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
/** Gets the first index that is after all previous effects, and after all the effects layer. AKA the index for a new layer */
|
|
17
|
+
getEffectIndex(effect: Effect): number;
|
|
18
|
+
/** Gets the first index that is after all other effect groups */
|
|
19
|
+
protected getStartingIndex(): number;
|
|
20
|
+
toJSON(): {
|
|
21
|
+
name: string;
|
|
22
|
+
effects: string[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare class Channel extends BasicChannel {
|
|
26
|
+
layers: Map<string, Layer>;
|
|
27
|
+
groups: EffectGroup[];
|
|
28
|
+
createGroup(name: string, index?: number): EffectGroup;
|
|
29
|
+
getGroup(name?: string, index?: number): EffectGroup;
|
|
30
|
+
private lastOrder;
|
|
31
|
+
private currentOrder;
|
|
32
|
+
executor: CommandExecutor;
|
|
33
|
+
constructor(casparChannel: number, executor?: CommandExecutor);
|
|
34
|
+
setExecutor(executor: CommandExecutor): void;
|
|
35
|
+
getLayer(id: string): Layer;
|
|
36
|
+
getLayers(): Layer[];
|
|
37
|
+
getLayerIndex(layer: Layer): number;
|
|
38
|
+
allocateLayers(options?: AllocateOptions): Layer[];
|
|
39
|
+
private needExecute;
|
|
40
|
+
allocateLayer(index?: number): Layer;
|
|
41
|
+
deallocateLayers(layers: Layer[]): void;
|
|
42
|
+
executeAllocation(): void;
|
|
43
|
+
toJSON(): {
|
|
44
|
+
channel: number;
|
|
45
|
+
layers: {
|
|
46
|
+
id: string;
|
|
47
|
+
effect: string;
|
|
48
|
+
}[];
|
|
49
|
+
groups: {
|
|
50
|
+
name: string;
|
|
51
|
+
effects: string[];
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare class Layer extends BasicLayer {
|
|
56
|
+
readonly id: string;
|
|
57
|
+
constructor(channel: Channel);
|
|
58
|
+
private effect;
|
|
59
|
+
setEffect(effect: Effect): void;
|
|
60
|
+
getEffect(): Effect;
|
|
61
|
+
dispose(): void;
|
|
62
|
+
toJSON(): {
|
|
63
|
+
id: string;
|
|
64
|
+
effect: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { EffectConstructor } from './effect';
|
|
4
|
+
import { Logger, CasparManager } from './types';
|
|
5
|
+
import { Method } from 'rest-exchange-protocol';
|
|
6
|
+
import { Route } from 'rest-exchange-protocol/dist/route';
|
|
7
|
+
import { UI_INJECTION_ZONE } from './types/ui';
|
|
8
|
+
export declare class CasparPlugin {
|
|
9
|
+
private _api;
|
|
10
|
+
private _enabled;
|
|
11
|
+
protected logger: Logger;
|
|
12
|
+
static get pluginName(): string;
|
|
13
|
+
get pluginName(): any;
|
|
14
|
+
private enable;
|
|
15
|
+
private disable;
|
|
16
|
+
protected onEnable(): void;
|
|
17
|
+
protected onDisable(): void;
|
|
18
|
+
protected get api(): PluginAPI;
|
|
19
|
+
}
|
|
20
|
+
export declare class PluginAPI extends EventEmitter {
|
|
21
|
+
private files;
|
|
22
|
+
private uiInjections;
|
|
23
|
+
private readonly _manager;
|
|
24
|
+
private readonly _plugin;
|
|
25
|
+
constructor(_manager: CasparManager, _plugin: CasparPlugin);
|
|
26
|
+
private _effects;
|
|
27
|
+
private routes;
|
|
28
|
+
registerEffect(name: string, effect: EffectConstructor): void;
|
|
29
|
+
private unregisterEffects;
|
|
30
|
+
private unregisterRoutes;
|
|
31
|
+
private unregisterFiles;
|
|
32
|
+
private unregisterUIInjections;
|
|
33
|
+
private unregister;
|
|
34
|
+
registerRoute(path: string, handler: Route['handler'], method: Method): Route;
|
|
35
|
+
unregisterRoute(route: Route): void;
|
|
36
|
+
registerFile(type: 'media' | 'template', path: string): Promise<import("./types/scanner/dir").InternalMediaData>;
|
|
37
|
+
getEffectGroup(name: string, index?: number): import("./layers").EffectGroup;
|
|
38
|
+
unregisterFile(id: string): Promise<void>;
|
|
39
|
+
getDirectory(id: string): Promise<import("./types/scanner/dir").InternalMediaData>;
|
|
40
|
+
getDirectories(): Promise<import("./types/scanner/dir").InternalMediaData>[];
|
|
41
|
+
/**
|
|
42
|
+
* @param injectionZone The zone to inject the file into, e.g. UI_INJECTION_ZONE.EFFECT_CREATOR for the effect creator
|
|
43
|
+
* @param file The file to inject, it holds the component as default export
|
|
44
|
+
*/
|
|
45
|
+
registerUI(injectionZone: UI_INJECTION_ZONE, file: string): void;
|
|
46
|
+
unregisterUI(id: string): void;
|
|
47
|
+
createEffect(name: string, group: string, options: any): import("./effect").Effect;
|
|
48
|
+
getEffect(id: string): import("./effect").Effect;
|
|
49
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MixerCommand, Tween } from './commands/mixer';
|
|
2
|
+
export interface Point {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export interface Rect {
|
|
7
|
+
start: Point;
|
|
8
|
+
end: Point;
|
|
9
|
+
}
|
|
10
|
+
type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
|
|
11
|
+
type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>;
|
|
12
|
+
export declare class Transform {
|
|
13
|
+
source: Rect;
|
|
14
|
+
destination: Rect;
|
|
15
|
+
fillTransition: Tween;
|
|
16
|
+
cropTransition: Tween;
|
|
17
|
+
constructor(source: Rect, destination: Rect);
|
|
18
|
+
static getRect(sx: number, sy: number, ex: number, ey: number): {
|
|
19
|
+
start: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
end: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
static normalRect(): {
|
|
29
|
+
start: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
};
|
|
33
|
+
end: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
static fromArray(arr: Tuple<number, 8>): Transform;
|
|
39
|
+
setTween(): any;
|
|
40
|
+
setTween(tween: Tween): any;
|
|
41
|
+
setTween(fillTween: Tween, cropTween: Tween): any;
|
|
42
|
+
private getFill;
|
|
43
|
+
private getCrop;
|
|
44
|
+
getCommand(): MixerCommand;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandExecutor } from '../../executor';
|
|
2
|
+
import { EffectGroup } from '../../layers';
|
|
3
|
+
export declare class CasparExecutor extends CommandExecutor {
|
|
4
|
+
readonly ip: string;
|
|
5
|
+
readonly port: number;
|
|
6
|
+
private constructor();
|
|
7
|
+
connect(): void;
|
|
8
|
+
disconnect(): void;
|
|
9
|
+
get connected(): boolean;
|
|
10
|
+
getEffectGroup(identifier: string, index?: number): EffectGroup;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
export declare class CasparProcess extends EventEmitter {
|
|
4
|
+
start(): Promise<void>;
|
|
5
|
+
stop(): Promise<void>;
|
|
6
|
+
restart(): Promise<void>;
|
|
7
|
+
get running(): boolean;
|
|
8
|
+
getStatus(): {
|
|
9
|
+
running: boolean;
|
|
10
|
+
};
|
|
11
|
+
appendLog(data: string): void;
|
|
12
|
+
getLogs(): string;
|
|
13
|
+
get log(): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
INFO = "INFO",
|
|
3
|
+
WARN = "WARN",
|
|
4
|
+
DEBUG = "DEBUG",
|
|
5
|
+
ERROR = "ERROR",
|
|
6
|
+
FATAL = "FATAL",
|
|
7
|
+
NONE = "NONE"
|
|
8
|
+
}
|
|
9
|
+
export declare class Logger {
|
|
10
|
+
private constructor();
|
|
11
|
+
log(level: LogLevel, message: string): void;
|
|
12
|
+
scope(scope: string): Logger;
|
|
13
|
+
info(message: string): void;
|
|
14
|
+
warn(message: string): void;
|
|
15
|
+
error(message: string | Error): void;
|
|
16
|
+
debug(message: string): void;
|
|
17
|
+
fatal(message: string | Error): void;
|
|
18
|
+
print(message: string): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { Injection } from './ui';
|
|
4
|
+
import { EffectRegistry } from '../effect';
|
|
5
|
+
import { UIInjector } from './ui';
|
|
6
|
+
import { Logger } from './log';
|
|
7
|
+
import { MediaScanner } from './scanner/scanner';
|
|
8
|
+
import { DirectoryManager } from './scanner/dir';
|
|
9
|
+
import { CGServer } from './server';
|
|
10
|
+
import { PluginManager } from './plugin';
|
|
11
|
+
import { CasparProcess } from './caspar/process';
|
|
12
|
+
import { CasparExecutor } from './caspar/executor';
|
|
13
|
+
export declare class CasparManager extends EventEmitter {
|
|
14
|
+
effects: EffectRegistry;
|
|
15
|
+
ui: UIInjector;
|
|
16
|
+
scanner: MediaScanner;
|
|
17
|
+
server: CGServer;
|
|
18
|
+
plugins: PluginManager;
|
|
19
|
+
caspar: CasparProcess;
|
|
20
|
+
executor: CasparExecutor;
|
|
21
|
+
start(): Promise<void>;
|
|
22
|
+
stop(): Promise<void>;
|
|
23
|
+
getMediaScanner(): MediaScanner;
|
|
24
|
+
get directory(): DirectoryManager;
|
|
25
|
+
getPlugins(): PluginManager;
|
|
26
|
+
getCasparProcess(): CasparProcess;
|
|
27
|
+
getExecutor(): CasparExecutor;
|
|
28
|
+
getPluginInjections(): Injection[];
|
|
29
|
+
getPluginInjectionCode(id: string): Promise<string>;
|
|
30
|
+
getLogger(scope: string): Logger;
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CasparPlugin } from '../plugin';
|
|
2
|
+
export declare class PluginManager {
|
|
3
|
+
register(plugin: typeof CasparPlugin): void;
|
|
4
|
+
unregister(plugin: CasparPlugin): void;
|
|
5
|
+
enableAll(): void;
|
|
6
|
+
disableAll(): void;
|
|
7
|
+
get plugins(): CasparPlugin[];
|
|
8
|
+
get enabled(): boolean;
|
|
9
|
+
broadcast(event: string, ...args: any[]): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
export interface MediaDoc {
|
|
5
|
+
id: string;
|
|
6
|
+
_invalidate?: boolean;
|
|
7
|
+
mediaPath?: string;
|
|
8
|
+
mediaSize?: number;
|
|
9
|
+
mediaTime?: number;
|
|
10
|
+
thumbSize?: number;
|
|
11
|
+
thumbTime?: number;
|
|
12
|
+
cinf?: string;
|
|
13
|
+
tinf?: string;
|
|
14
|
+
mediainfo?: {
|
|
15
|
+
name: string;
|
|
16
|
+
path: string;
|
|
17
|
+
size: number;
|
|
18
|
+
time: number;
|
|
19
|
+
field_order: string;
|
|
20
|
+
streams: {
|
|
21
|
+
codec: {
|
|
22
|
+
long_name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
time_base: string;
|
|
25
|
+
tag_string: string;
|
|
26
|
+
is_avc: any;
|
|
27
|
+
};
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
sample_aspect_ratio: string;
|
|
31
|
+
display_aspect_ratio: string;
|
|
32
|
+
pix_fmt: string;
|
|
33
|
+
bits_per_raw_sample: string;
|
|
34
|
+
sample_fmt: string;
|
|
35
|
+
sample_rate: number;
|
|
36
|
+
channels: number;
|
|
37
|
+
channel_layout: string;
|
|
38
|
+
bits_per_sample: number;
|
|
39
|
+
time_base: string;
|
|
40
|
+
start_time: number;
|
|
41
|
+
duration_ts: string;
|
|
42
|
+
duration: string;
|
|
43
|
+
bit_rate: string;
|
|
44
|
+
max_bit_rate: string;
|
|
45
|
+
nb_frames: string;
|
|
46
|
+
}[];
|
|
47
|
+
format: {
|
|
48
|
+
name: string;
|
|
49
|
+
long_name: string;
|
|
50
|
+
size: string;
|
|
51
|
+
start_time: number;
|
|
52
|
+
duration: number;
|
|
53
|
+
bit_rate: number;
|
|
54
|
+
max_bit_rate: number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
_attachments?: {
|
|
58
|
+
'thumb.png': {
|
|
59
|
+
content_type: string;
|
|
60
|
+
data: Buffer;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export declare class FileDatabase extends EventEmitter {
|
|
65
|
+
get(id: string): MediaDoc;
|
|
66
|
+
retrieve(hash: string): MediaDoc;
|
|
67
|
+
getHash(id: string): string;
|
|
68
|
+
put(hash: string, doc: MediaDoc): MediaDoc;
|
|
69
|
+
remove(id: string): MediaDoc;
|
|
70
|
+
allDocs(): MediaDoc[];
|
|
71
|
+
close(): void;
|
|
72
|
+
save(): string;
|
|
73
|
+
load(data: string): void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface InternalMediaData {
|
|
2
|
+
name: string;
|
|
3
|
+
id: string;
|
|
4
|
+
identifier: string;
|
|
5
|
+
location: string;
|
|
6
|
+
type: 'media' | 'template';
|
|
7
|
+
}
|
|
8
|
+
export declare class DirectoryManager {
|
|
9
|
+
private constructor();
|
|
10
|
+
initialize(mediaPath: string, templatePath: string): Promise<void>;
|
|
11
|
+
createDirectories(): Promise<void>;
|
|
12
|
+
deleteDirectories(): Promise<void>;
|
|
13
|
+
createDirectory(type: 'media' | 'template', from: string): Promise<InternalMediaData>;
|
|
14
|
+
deleteDirectory(id: string): Promise<void>;
|
|
15
|
+
getDirectory(id: string): Promise<InternalMediaData>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Method, Middleware, TypedClient } from 'rest-exchange-protocol';
|
|
2
|
+
import { Route } from 'rest-exchange-protocol/dist/route';
|
|
3
|
+
export type CGClient = TypedClient<{}>;
|
|
4
|
+
export declare class CGServer {
|
|
5
|
+
private constructor();
|
|
6
|
+
log(): Middleware;
|
|
7
|
+
upload(): Middleware;
|
|
8
|
+
web(): Middleware;
|
|
9
|
+
cors(): Middleware;
|
|
10
|
+
start(): Promise<void>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
registerRoute(path: string, handler: Route['handler'], method: Method): Route;
|
|
13
|
+
unregisterRoute(route: Route): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const UI_INJECTION_ZONE: {
|
|
2
|
+
readonly EFFECT_CREATOR: "effect-creator";
|
|
3
|
+
};
|
|
4
|
+
export type UI_INJECTION_ZONE = typeof UI_INJECTION_ZONE[keyof typeof UI_INJECTION_ZONE];
|
|
5
|
+
export interface Injection {
|
|
6
|
+
zone: UI_INJECTION_ZONE;
|
|
7
|
+
file: string;
|
|
8
|
+
plugin: string;
|
|
9
|
+
id: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class UIInjector {
|
|
12
|
+
register(zone: UI_INJECTION_ZONE, file: string, plugin: string): string;
|
|
13
|
+
unregister(id: string): void;
|
|
14
|
+
getInjections(zone?: UI_INJECTION_ZONE): Injection[];
|
|
15
|
+
bundle(id: string): Promise<string | null>;
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lappis/cg-manager",
|
|
3
|
+
"repository": "https://github.com/Lapplandsveckan/cg-manager-plugin",
|
|
4
|
+
"author": "firecraftgaming <eliyah@sundstroem.com>",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"version": "0.0.1",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@babel/core": "^7.19.3",
|
|
11
|
+
"@babel/preset-env": "^7.19.3",
|
|
12
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
13
|
+
"ts-loader": "^9.2.6",
|
|
14
|
+
"typescript": "^4.5.5",
|
|
15
|
+
"webpack": "^5.69.0",
|
|
16
|
+
"webpack-cli": "^4.9.2"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"package.json"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"tsc": "tsc --noEmit",
|
|
25
|
+
"build": "webpack && tsc --emitDeclarationOnly",
|
|
26
|
+
"watch": "webpack --watch"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"babel-loader": "^8.2.5",
|
|
30
|
+
"no-try": "^3.1.0",
|
|
31
|
+
"rest-exchange-protocol": "^0.0.16",
|
|
32
|
+
"ts-node": "^10.9.1",
|
|
33
|
+
"uuid": "^9.0.1"
|
|
34
|
+
}
|
|
35
|
+
}
|