@lappis/cg-manager 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/basic.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Allocation } from './command';
1
2
  export declare class BasicChannel {
2
3
  protected readonly casparChannel: number;
3
4
  constructor(casparChannel: number);
@@ -11,7 +12,7 @@ export declare class BasicLayer {
11
12
  static caspar(channel: BasicLayer): any;
12
13
  static caspar(channel: BasicChannel, layer?: number): any;
13
14
  static caspar(channel: number, layer?: number): any;
14
- static from(channel: number | BasicChannel | BasicLayer, layer?: number): BasicChannel | BasicLayer;
15
+ static from(channel: Allocation, layer?: number): BasicChannel | BasicLayer;
15
16
  protected setChannel(channel: BasicChannel): void;
16
17
  protected setCasparLayer(layer: number): void;
17
18
  protected onMove(): void;
package/dist/command.d.ts CHANGED
@@ -2,10 +2,14 @@ import { BasicChannel, BasicLayer } from './basic';
2
2
  export declare abstract class Command {
3
3
  abstract getCommand(): string | undefined | void;
4
4
  }
5
+ export type ChannelResolvable = BasicChannel | number;
6
+ export type Allocation = BasicLayer | ChannelResolvable;
5
7
  export declare abstract class BasicCommand {
6
8
  protected abstract getCommandType(): string;
7
9
  protected abstract getArguments(): string[];
8
10
  private static create;
11
+ private static parseQuotes;
12
+ private static parseArguments;
9
13
  static from(command: string): ReturnType<typeof BasicCommand.create>;
10
14
  static interpret(command: string): ReturnType<typeof BasicCommand.create>[];
11
15
  protected compileArgs(): string;
@@ -14,8 +18,8 @@ export declare abstract class BasicCommand {
14
18
  export declare abstract class LayeredCommand extends BasicCommand {
15
19
  protected allocation?: BasicLayer | BasicChannel;
16
20
  constructor(allocation?: BasicLayer | BasicChannel);
17
- allocate(channel: BasicLayer | BasicChannel | number): any;
18
- allocate(channel: BasicChannel | number, layer: number): any;
21
+ allocate(channel: Allocation): any;
22
+ allocate(channel: ChannelResolvable, layer: number): any;
19
23
  protected isChannel(): boolean;
20
24
  protected isLayer(): boolean;
21
25
  protected getPosition(): string;
@@ -33,8 +37,8 @@ export declare class CommandGroup extends Command {
33
37
  protected readonly commands: Command[];
34
38
  protected allocation?: BasicLayer | BasicChannel;
35
39
  constructor(commands: Command[]);
36
- allocate(channel: BasicLayer | BasicChannel | number): any;
37
- allocate(channel: BasicChannel | number, layer: number): any;
40
+ allocate(channel: Allocation): any;
41
+ allocate(channel: ChannelResolvable, layer: number): any;
38
42
  getCommand(): string;
39
43
  }
40
44
  export declare class RawCommand extends Command {
@@ -1,15 +1,15 @@
1
- import { BasicCommand } from '../command';
1
+ import { Allocation, BasicCommand, ChannelResolvable } from '../command';
2
2
  import { BasicChannel, BasicLayer } from '../basic';
3
3
  export declare class SwapCommand extends BasicCommand {
4
4
  protected allocation1?: BasicLayer | BasicChannel;
5
5
  protected allocation2?: BasicLayer | BasicChannel;
6
6
  protected transforms: boolean;
7
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;
8
+ constructor(allocation1: Allocation, allocation2: Allocation, transforms?: boolean);
9
+ allocate1(channel: Allocation): any;
10
+ allocate1(channel: ChannelResolvable, layer: number): any;
11
+ allocate2(channel: Allocation): any;
12
+ allocate2(channel: ChannelResolvable, layer: number): any;
13
13
  protected getCommandType(): string;
14
14
  protected getArguments(): string[];
15
15
  }
package/dist/effect.d.ts CHANGED
@@ -1,7 +1,9 @@
1
+ /// <reference types="node" />
1
2
  import { Transform } from './transform';
2
3
  import { EffectGroup, Layer } from './layers';
3
4
  import { Command } from './command';
4
- export declare abstract class Effect {
5
+ import { EventEmitter } from 'events';
6
+ export declare abstract class Effect extends EventEmitter {
5
7
  private _active;
6
8
  private _disposed;
7
9
  readonly id: string;
@@ -38,6 +38,7 @@ export declare class CommandExecutor {
38
38
  allocateChannel(casparChannel: number): Channel;
39
39
  executeAllocations(): void;
40
40
  protected send(data: string): void;
41
+ private readData;
41
42
  protected receive(data: string): string;
42
43
  protected listeners: CommandListener[];
43
44
  protected addListener(listener: CommandListener): void;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
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:()=>W,BasicChannel:()=>p,BasicCommand:()=>A,BasicLayer:()=>h,CallCommand:()=>tt,CasparPlugin:()=>bn,CgCommand:()=>lt,Channel:()=>Gr,ClearCommand:()=>dt,Command:()=>C,CommandExecutor:()=>Zr,CommandGroup:()=>D,Effect:()=>Or,EffectGroup:()=>Mr,EffectRegistry:()=>jr,Layer:()=>Ur,LayeredCommand:()=>R,LoadBGCommand:()=>At,LoadCommand:()=>Ut,LogLevel:()=>i,MediaDoc:()=>t.MediaDoc,MixerCommand:()=>ee,PauseCommand:()=>fe,PlayCommand:()=>be,PlayoutOptions:()=>e.PlayoutOptions,PluginAPI:()=>dn,PrintCommand:()=>Pe,RawCommand:()=>B,RemoveCommand:()=>Re,ResumeCommand:()=>Fe,SimpleArgsCommand:()=>N,SimpleCommand:()=>I,StopCommand:()=>Xe,SwapCommand:()=>ir,Transform:()=>Sn,UI_INJECTION_ZONE:()=>u});var t={};r.r(t);var e={};r.r(e),r.d(e,{RD:()=>At});var o=r(7),i=function(t){return t.INFO="INFO",t.WARN="WARN",t.DEBUG="DEBUG",t.ERROR="ERROR",t.FATAL="FATAL",t.NONE="NONE",t}({}),u={EFFECT_CREATOR:"effect-creator",PLUGIN_PAGE:"plugin-page"};function a(t){return a="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},a(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(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,y(n.key),n)}}function l(t,e,r){return e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=y(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:String(e)}var p=function(){function t(e){c(this,t),s(this,"casparChannel",void 0),this.casparChannel=e}return l(t,[{key:"getCasparChannel",value:function(){return this.casparChannel}},{key:"getCommandString",value:function(){return this.getCasparChannel().toString()}}]),t}(),h=function(){function t(e){c(this,t),s(this,"channel",void 0),s(this,"casparLayer",void 0),this.setChannel(e)}return l(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 p(e)),"number"!=typeof r)return e;var n=new t(e);return n.setCasparLayer(r),n}}]),t}();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 m(){return m="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=_(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}},m.apply(this,arguments)}function b(t,e,r){return(e=T(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||g(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 g(t,e){if(t){if("string"==typeof t)return w(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)?w(t,e):void 0}}function w(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 O(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 j(t)}(t,S()?Reflect.construct(e,r||[],_(t).constructor):e.apply(t,r))}function j(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(S=function(){return!!t})()}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function P(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&&E(t,e)}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}function k(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,T(n.key),n)}}function x(t,e,r){return e&&k(t.prototype,e),r&&k(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(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)}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var C=x((function t(){L(this,t)})),A=function(){function t(){L(this,t)}return x(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 L(this,r),O(this,r,arguments)}return P(r,t),x(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(d(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}(),R=function(t){function e(t){var r;return L(this,e),b(j(r=O(this,e)),"allocation",void 0),t&&r.allocate(t),r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){return this.allocation=h.from(t,e),this}},{key:"isChannel",value:function(){return this.allocation instanceof p}},{key:"isLayer",value:function(){return this.allocation instanceof h}},{key:"getPosition",value:function(){var t;return null===(t=this.allocation)||void 0===t?void 0:t.getCommandString()}}]),e}(A),I=function(t){function e(){return L(this,e),O(this,e,arguments)}return P(e,t),x(e,[{key:"getArguments",value:function(){var t=this.getPosition();return t?[t]:[]}}]),e}(R),N=function(t){function e(){var t;L(this,e),b(j(t=O(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 P(e,t),x(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(d(m(_(e.prototype),"getArguments",this).call(this)),d(this.args))}}]),e}(I),D=function(t){function e(t){var r;return L(this,e),b(j(r=O(this,e)),"commands",void 0),b(j(r),"allocation",void 0),r.commands=t,r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){this.allocation=h.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=g(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 R&&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}(C),B=function(t){function e(t){var r;return L(this,e),b(j(r=O(this,e)),"command",void 0),r.command=t,r}return P(e,t),x(e,[{key:"getCommand",value:function(){return this.command}}]),e}(C);function M(t){return M="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},M(t)}function G(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,U(n.key),n)}}function U(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:String(e)}function F(t,e,r){return e=V(e),function(t,e){if(e&&("object"===M(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,J()?Reflect.construct(e,r||[],V(t).constructor):e.apply(t,r))}function J(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(J=function(){return!!t})()}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}var W=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),F(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&&Y(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&G(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function H(t){return H="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},H(t)}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,Q(n.key),n)}}function K(t,e,r){return e=q(e),function(t,e){if(e&&("object"===H(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Z(t)}(t,X()?Reflect.construct(e,r||[],q(t).constructor):e.apply(t,r))}function X(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(X=function(){return!!t})()}function q(t){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},q(t)}function Z(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function z(t,e){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},z(t,e)}function Q(t){var e=function(t,e){if("object"!=H(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:String(e)}var tt=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=Z(r=K(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&&z(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]}}])&&$(r.prototype,n),o&&$(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function et(t){return et="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},et(t)}function rt(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,ft(n.key),n)}}function nt(t,e,r){return e=it(e),function(t,e){if(e&&("object"===et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}(t,ot()?Reflect.construct(e,r||[],it(t).constructor):e.apply(t,r))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}function ct(t,e,r){return(e=ft(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==et(e)?e:String(e)}var lt=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),ct(ut(t=nt(this,e)),"cmd",void 0),ct(ut(t),"cgLayer",void 0),ct(ut(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&&at(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}}])&&rt(r.prototype,n),o&&rt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function st(t){return st="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},st(t)}function yt(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,pt(n.key),n)}}function pt(t){var e=function(t,e){if("object"!=st(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=st(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:String(e)}function ht(t,e,r){return e=mt(e),function(t,e){if(e&&("object"===st(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,vt()?Reflect.construct(e,r||[],mt(t).constructor):e.apply(t,r))}function vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vt=function(){return!!t})()}function mt(t){return mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mt(t)}function bt(t,e){return bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bt(t,e)}var dt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ht(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&&bt(t,e)}(e,t),r=e,o=[{key:"all",value:function(){return new B("CLEAR ALL")}}],(n=[{key:"getCommandType",value:function(){return"CLEAR"}}])&&yt(r.prototype,n),o&&yt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function gt(t){return gt="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},gt(t)}function wt(t){return function(t){if(Array.isArray(t))return Ot(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 Ot(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)?Ot(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 Ot(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 jt(t,e,r){return e=_t(e),function(t,e){if(e&&("object"===gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Pt(t)}(t,St()?Reflect.construct(e,r||[],_t(t).constructor):e.apply(t,r))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function Pt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t,e){return Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Et(t,e)}function kt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xt(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 Tt(t,e,r){return e&&xt(t.prototype,e),r&&xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lt(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:String(e)}var Ct=function(){function t(){kt(this,t)}return Tt(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}(),At=function(t){function e(){var t,r,n,o;return kt(this,e),r=Pt(t=jt(this,e)),o=void 0,(n=Lt(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&&Et(t,e)}(e,t),Tt(e,[{key:"getCommandType",value:function(){return"LOADBG"}},{key:"getArguments",value:function(){var t=this.getPosition();return t?[t].concat(wt(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(wt(Ct.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}(R);function Rt(t){return Rt="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},Rt(t)}function It(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,Nt(n.key),n)}}function Nt(t){var e=function(t,e){if("object"!=Rt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rt(e)?e:String(e)}function Dt(t,e,r){return e=Mt(e),function(t,e){if(e&&("object"===Rt(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,Bt()?Reflect.construct(e,r||[],Mt(t).constructor):e.apply(t,r))}function Bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bt=function(){return!!t})()}function Mt(t){return Mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mt(t)}function Gt(t,e){return Gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gt(t,e)}var Ut=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Dt(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&&Gt(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"LOAD"}}])&&It(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function Ft(t){return Ft="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},Ft(t)}function Jt(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 Vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yt(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 Wt(t,e,r){return e&&Yt(t.prototype,e),r&&Yt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ht(t,e,r){return e=Kt(e),function(t,e){if(e&&("object"===Ft(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Xt(t)}(t,$t()?Reflect.construct(e,r||[],Kt(t).constructor):e.apply(t,r))}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($t=function(){return!!t})()}function Kt(t){return Kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kt(t)}function Xt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qt(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&&Zt(t,e)}function Zt(t,e){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zt(t,e)}function zt(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"!=Ft(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ft(e)?e:String(e)}var te=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Vt(this,e),zt(Xt(r=Ht(this,e)),"command",void 0),zt(Xt(r),"args",void 0),r.command=t,r.args=n,r}return qt(e,t),Wt(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(function(t){if(Array.isArray(t))return Jt(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 Jt(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)?Jt(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}(R),ee=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Vt(this,e),t=Ht(this,e,[[]]),r&&t.commands.push(new te("CLEAR")),t}return qt(e,t),Wt(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 te(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}(D);function re(t){return re="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},re(t)}function ne(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,oe(n.key),n)}}function oe(t){var e=function(t,e){if("object"!=re(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==re(e)?e:String(e)}function ie(t,e,r){return e=ae(e),function(t,e){if(e&&("object"===re(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,ue()?Reflect.construct(e,r||[],ae(t).constructor):e.apply(t,r))}function ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ue=function(){return!!t})()}function ae(t){return ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ae(t)}function ce(t,e){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ce(t,e)}var fe=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&&ce(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PAUSE"}}])&&ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function le(t){return le="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},le(t)}function se(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,ye(n.key),n)}}function ye(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==le(e)?e:String(e)}function pe(t,e,r){return e=ve(e),function(t,e){if(e&&("object"===le(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,he()?Reflect.construct(e,r||[],ve(t).constructor):e.apply(t,r))}function he(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(he=function(){return!!t})()}function ve(t){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ve(t)}function me(t,e){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},me(t,e)}var be=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),pe(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&&me(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PLAY"}}])&&se(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function de(t){return de="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},de(t)}function ge(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,we(n.key),n)}}function we(t){var e=function(t,e){if("object"!=de(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==de(e)?e:String(e)}function Oe(t,e,r){return e=Se(e),function(t,e){if(e&&("object"===de(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,je()?Reflect.construct(e,r||[],Se(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 Se(t){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Se(t)}function _e(t,e){return _e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_e(t,e)}var Pe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Oe(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&&_e(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&ge(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Ee(t){return Ee="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},Ee(t)}function ke(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,xe(n.key),n)}}function xe(t){var e=function(t,e){if("object"!=Ee(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ee(e)?e:String(e)}function Te(t,e,r){return e=Ce(e),function(t,e){if(e&&("object"===Ee(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,Le()?Reflect.construct(e,r||[],Ce(t).constructor):e.apply(t,r))}function Le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Le=function(){return!!t})()}function Ce(t){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ce(t)}function Ae(t,e){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ae(t,e)}var Re=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Te(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&&Ae(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&ke(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function Ie(t){return Ie="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},Ie(t)}function Ne(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,De(n.key),n)}}function De(t){var e=function(t,e){if("object"!=Ie(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ie(e)?e:String(e)}function Be(t,e,r){return e=Ge(e),function(t,e){if(e&&("object"===Ie(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,Me()?Reflect.construct(e,r||[],Ge(t).constructor):e.apply(t,r))}function Me(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Me=function(){return!!t})()}function Ge(t){return Ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ge(t)}function Ue(t,e){return Ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ue(t,e)}var Fe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Be(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&&Ue(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"RESUME"}}])&&Ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Je(t){return Je="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},Je(t)}function Ve(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,Ye(n.key),n)}}function Ye(t){var e=function(t,e){if("object"!=Je(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Je(e)?e:String(e)}function We(t,e,r){return e=$e(e),function(t,e){if(e&&("object"===Je(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,He()?Reflect.construct(e,r||[],$e(t).constructor):e.apply(t,r))}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(He=function(){return!!t})()}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}function Ke(t,e){return Ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ke(t,e)}var Xe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),We(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&&Ke(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&Ve(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function qe(t){return qe="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},qe(t)}function Ze(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,or(n.key),n)}}function ze(t,e,r){return e=tr(e),function(t,e){if(e&&("object"===qe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return er(t)}(t,Qe()?Reflect.construct(e,r||[],tr(t).constructor):e.apply(t,r))}function Qe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qe=function(){return!!t})()}function tr(t){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tr(t)}function er(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rr(t,e){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rr(t,e)}function nr(t,e,r){return(e=or(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function or(t){var e=function(t,e){if("object"!=qe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qe(e)?e:String(e)}var ir=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),nr(er(n=ze(this,e)),"allocation1",void 0),nr(er(n),"allocation2",void 0),nr(er(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&&rr(t,e)}(e,t),r=e,(n=[{key:"allocate1",value:function(t,e){return this.allocation1=h.from(t,e),this}},{key:"allocate2",value:function(t,e){return this.allocation2=h.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}}])&&Ze(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);const ur={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ar;const cr=new Uint8Array(16);function fr(){if(!ar&&(ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ar))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ar(cr)}const lr=[];for(let t=0;t<256;++t)lr.push((t+256).toString(16).slice(1));const sr=function(t,e,r){if(ur.randomUUID&&!e&&!t)return ur.randomUUID();const n=(t=t||{}).random||(t.rng||fr)();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 lr[t[e+0]]+lr[t[e+1]]+lr[t[e+2]]+lr[t[e+3]]+"-"+lr[t[e+4]]+lr[t[e+5]]+"-"+lr[t[e+6]]+lr[t[e+7]]+"-"+lr[t[e+8]]+lr[t[e+9]]+"-"+lr[t[e+10]]+lr[t[e+11]]+lr[t[e+12]]+lr[t[e+13]]+lr[t[e+14]]+lr[t[e+15]]}(n)};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){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=hr(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 hr(t,e){if(t){if("string"==typeof t)return vr(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)?vr(t,e):void 0}}function vr(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 mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function br(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,wr(n.key),n)}}function dr(t,e,r){return e&&br(t.prototype,e),r&&br(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gr(t,e,r){return(e=wr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wr(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 Or=function(){function t(e){mr(this,t),gr(this,"_active",!1),gr(this,"_disposed",!1),gr(this,"id",sr()),gr(this,"transform",void 0),gr(this,"effectGroup",void 0),gr(this,"layers",[]),this.effectGroup=e,this.group.addEffect(this)}return dr(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=pr(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 vr(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||hr(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=pr(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=pr(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(){return[]}},{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}(),jr=function(){function t(){mr(this,t),gr(this,"effects",new Map)}return dr(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 Sr(t){return Sr="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},Sr(t)}function _r(t,e,r){return e=Er(e),function(t,e){if(e&&("object"===Sr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return kr(t)}(t,Pr()?Reflect.construct(e,r||[],Er(t).constructor):e.apply(t,r))}function Pr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pr=function(){return!!t})()}function Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(t)}function kr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xr(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&&Tr(t,e)}function Tr(t,e){return Tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tr(t,e)}function Lr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Cr(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 Cr(t,e){if(t){if("string"==typeof t)return Ar(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)?Ar(t,e):void 0}}function Ar(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 Rr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ir(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 Nr(t,e,r){return e&&Ir(t.prototype,e),r&&Ir(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}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"!=Sr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Sr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sr(e)?e:String(e)}var Mr=function(){function t(e,r){Rr(this,t),Dr(this,"effects",[]),Dr(this,"name",void 0),Dr(this,"channel",void 0),this.name=r,this.channel=e}return Nr(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=Lr(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}(),Gr=function(t){function e(t,r){var n;return Rr(this,e),Dr(kr(n=_r(this,e,[t])),"layers",new Map),Dr(kr(n),"groups",[]),Dr(kr(n),"lastOrder",[]),Dr(kr(n),"currentOrder",[]),Dr(kr(n),"executor",void 0),Dr(kr(n),"needExecute",!1),n.executor=r,n}return xr(e,t),Nr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Mr(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:sr();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 Ur(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=h.caspar(this.casparChannel,r+1);t.push(new dt(o)),t.push(ee.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=h.caspar(this.casparChannel,i+1),f=h.caspar(this.casparChannel,a+1);t.push(new ir(c,f,!0))}}}this.lastOrder=this.currentOrder,this.currentOrder=this.currentOrder.slice();for(var l=0;l<this.currentOrder.length;l++){var s=this.currentOrder[l];if(void 0!==s){var y=this.layers.get(s);y&&y.setCasparLayer(l+1)}}var p,v=Lr(this.executor.getEffects());try{for(v.s();!(p=v.n()).done;){var m=p.value;t.push.apply(t,function(t){if(Array.isArray(t))return Ar(t)}(d=m.updatePositions())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(d)||Cr(d)||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.")}())}}catch(t){v.e(t)}finally{v.f()}var b=new D(t);this.executor.execute(b)}var d}},{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}(p),Ur=function(t){function e(t){var r;return Rr(this,e),Dr(kr(r=_r(this,e,[t])),"id",void 0),Dr(kr(r),"effect",void 0),r.id=sr(),r}return xr(e,t),Nr(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}(h);function Fr(t){return Fr="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},Fr(t)}function Jr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Vr(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 Vr(t,e){if(t){if("string"==typeof t)return Yr(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)?Yr(t,e):void 0}}function Yr(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(){Wr=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 L(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"==Fr(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(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(Fr(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,L.prototype={constructor:L,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(T),!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),T(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;T(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 Hr(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 $r(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){Hr(i,n,o,u,a,"next",t)}function a(t){Hr(i,n,o,u,a,"throw",t)}u(void 0)}))}}function Kr(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,qr(n.key),n)}}function Xr(t,e,r){return(e=qr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qr(t){var e=function(t,e){if("object"!=Fr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fr(e)?e:String(e)}var Zr=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Xr(this,"templates",[]),Xr(this,"lastFetch",0),Xr(this,"fetchPromise",null),Xr(this,"channels",new Map),Xr(this,"listeners",[]),Xr(this,"effects",new Map)}var e,r,n,o;return e=t,r=[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(o=$r(Wr().mark((function t(){return Wr().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=$r(Wr().mark((function t(){var e=arguments;return Wr().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=A.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 Gr(t,this);return this.channels.set(t,e),e}},{key:"executeAllocations",value:function(){var t,e=Jr(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 Yr(t)}(f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(f)||Vr(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=Jr(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&&Kr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function zr(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function Qr(t){return Qr="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},Qr(t)}function tn(){tn=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 L(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"==Qr(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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(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(Qr(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,L.prototype={constructor:L,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(T),!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),T(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;T(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 en(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 rn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ln(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 nn(t,e,r){return e=un(e),function(t,e){if(e&&("object"===Qr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return an(t)}(t,on()?Reflect.construct(e,r||[],un(t).constructor):e.apply(t,r))}function on(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(on=function(){return!!t})()}function un(t){return un=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},un(t)}function an(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function cn(t,e){return cn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cn(t,e)}function fn(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)||ln(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 ln(t,e){if(t){if("string"==typeof t)return sn(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)?sn(t,e):void 0}}function sn(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 yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pn(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,mn(n.key),n)}}function hn(t,e,r){return e&&pn(t.prototype,e),r&&pn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function vn(t,e,r){return(e=mn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mn(t){var e=function(t,e){if("object"!=Qr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Qr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qr(e)?e:String(e)}var bn=function(){function t(){yn(this,t),vn(this,"_api",void 0),vn(this,"_enabled",!1),vn(this,"logger",void 0)}return hn(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=fn(zr((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=fn(zr((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}(),dn=function(t){function e(t,r){var n;return yn(this,e),vn(an(n=nn(this,e)),"files",[]),vn(an(n),"uiInjections",[]),vn(an(n),"_manager",void 0),vn(an(n),"_plugin",void 0),vn(an(n),"_effects",[]),vn(an(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=an(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&&cn(t,e)}(e,t),hn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=rn(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=rn(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=tn().mark((function t(){var e,r,n;return tn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=rn(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){en(i,n,o,u,a,"next",t)}function a(t){en(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=rn(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:"getFileDatabase",value:function(){return this._manager.getFiles()}},{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}(o.EventEmitter);function gn(t){return gn="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},gn(t)}function wn(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,jn(n.key),n)}}function On(t,e,r){return(e=jn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jn(t){var e=function(t,e){if("object"!=gn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gn(e)?e:String(e)}var Sn=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),On(this,"source",void 0),On(this,"destination",void 0),On(this,"fillTransition",null),On(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 ee.create().crop(this.getCrop(this.source),this.cropTransition).fill(this.getFill(this.destination),this.fillTransition)}}])&&wn(e.prototype,r),n&&wn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
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:()=>W,BasicChannel:()=>p,BasicCommand:()=>A,BasicLayer:()=>h,CallCommand:()=>tt,CasparPlugin:()=>Cn,CgCommand:()=>lt,Channel:()=>Yr,ClearCommand:()=>dt,Command:()=>C,CommandExecutor:()=>yn,CommandGroup:()=>D,Effect:()=>Er,EffectGroup:()=>Vr,EffectRegistry:()=>kr,Layer:()=>Wr,LayeredCommand:()=>R,LoadBGCommand:()=>At,LoadCommand:()=>Ft,LogLevel:()=>i,MediaDoc:()=>t.MediaDoc,MixerCommand:()=>ee,PauseCommand:()=>fe,PlayCommand:()=>me,PlayoutOptions:()=>e.PlayoutOptions,PluginAPI:()=>An,PrintCommand:()=>Pe,RawCommand:()=>B,RemoveCommand:()=>Re,ResumeCommand:()=>Ue,SimpleArgsCommand:()=>N,SimpleCommand:()=>I,StopCommand:()=>qe,SwapCommand:()=>ir,Transform:()=>Bn,UI_INJECTION_ZONE:()=>u});var t={};r.r(t);var e={};r.r(e),r.d(e,{RD:()=>At});var o=r(7),i=function(t){return t.INFO="INFO",t.WARN="WARN",t.DEBUG="DEBUG",t.ERROR="ERROR",t.FATAL="FATAL",t.NONE="NONE",t}({}),u={EFFECT_CREATOR:"effect-creator",PLUGIN_PAGE:"plugin-page"};function a(t){return a="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},a(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(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,y(n.key),n)}}function l(t,e,r){return e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=y(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:String(e)}var p=function(){function t(e){c(this,t),s(this,"casparChannel",void 0),this.casparChannel=e}return l(t,[{key:"getCasparChannel",value:function(){return this.casparChannel}},{key:"getCommandString",value:function(){return this.getCasparChannel().toString()}}]),t}(),h=function(){function t(e){c(this,t),s(this,"channel",void 0),s(this,"casparLayer",void 0),this.setChannel(e)}return l(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 p(e)),"number"!=typeof r)return e;var n=new t(e);return n.setCasparLayer(r),n}}]),t}();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 b(){return b="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=_(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}},b.apply(this,arguments)}function m(t,e,r){return(e=T(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||g(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 g(t,e){if(t){if("string"==typeof t)return w(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)?w(t,e):void 0}}function w(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 O(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 j(t)}(t,S()?Reflect.construct(e,r||[],_(t).constructor):e.apply(t,r))}function j(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(S=function(){return!!t})()}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function P(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&&E(t,e)}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}function k(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,T(n.key),n)}}function x(t,e,r){return e&&k(t.prototype,e),r&&k(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(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)}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var C=x((function t(){L(this,t)})),A=function(){function t(){L(this,t)}return x(t,[{key:"compileArgs",value:function(){return this.getArguments().map((function(t){return JSON.stringify(t)})).map((function(t){return t.includes(" ")?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 L(this,r),O(this,r,arguments)}return P(r,t),x(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:"parseQuotes",value:function(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.endsWith('"')){for(var n=!1,o=r.length-2;o>=0&&"\\"===r[o];o--)n=!n;if(!n)return t.slice(0,e+1)}}throw new Error("Command contains unclosed quotes")}},{key:"parseArguments",value:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];if(n.startsWith('"')){var o=this.parseQuotes(t.slice(r));e.push(JSON.parse(o.join(" "))),r+=o.length-1}else e.push(n)}return e}},{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");if(t.startsWith('"'))throw new Error("Command cannot start with quotes");var e=t.split(" ");return this.create.apply(this,[e[0]].concat(d(this.parseArguments(e.slice(1)))))}},{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}(),R=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"allocation",void 0),t&&r.allocate(t),r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){return this.allocation=h.from(t,e),this}},{key:"isChannel",value:function(){return this.allocation instanceof p}},{key:"isLayer",value:function(){return this.allocation instanceof h}},{key:"getPosition",value:function(){var t;return null===(t=this.allocation)||void 0===t?void 0:t.getCommandString()}}]),e}(A),I=function(t){function e(){return L(this,e),O(this,e,arguments)}return P(e,t),x(e,[{key:"getArguments",value:function(){var t=this.getPosition();return t?[t]:[]}}]),e}(R),N=function(t){function e(){var t;L(this,e),m(j(t=O(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 P(e,t),x(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(d(b(_(e.prototype),"getArguments",this).call(this)),d(this.args))}}]),e}(I),D=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"commands",void 0),m(j(r),"allocation",void 0),r.commands=t,r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){this.allocation=h.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=g(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 R&&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}(C),B=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"command",void 0),r.command=t,r}return P(e,t),x(e,[{key:"getCommand",value:function(){return this.command}}]),e}(C);function M(t){return M="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},M(t)}function G(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 F(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:String(e)}function U(t,e,r){return e=V(e),function(t,e){if(e&&("object"===M(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,J()?Reflect.construct(e,r||[],V(t).constructor):e.apply(t,r))}function J(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(J=function(){return!!t})()}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}var W=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),U(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&&Y(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&G(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function H(t){return H="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},H(t)}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,z(n.key),n)}}function K(t,e,r){return e=Q(e),function(t,e){if(e&&("object"===H(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return X(t)}(t,q()?Reflect.construct(e,r||[],Q(t).constructor):e.apply(t,r))}function q(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(q=function(){return!!t})()}function Q(t){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Q(t)}function X(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Z(t,e){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Z(t,e)}function z(t){var e=function(t,e){if("object"!=H(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:String(e)}var tt=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=X(r=K(this,e)),i=void 0,(o=z(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&&Z(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]}}])&&$(r.prototype,n),o&&$(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function et(t){return et="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},et(t)}function rt(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,ft(n.key),n)}}function nt(t,e,r){return e=it(e),function(t,e){if(e&&("object"===et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}(t,ot()?Reflect.construct(e,r||[],it(t).constructor):e.apply(t,r))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}function ct(t,e,r){return(e=ft(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==et(e)?e:String(e)}var lt=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),ct(ut(t=nt(this,e)),"cmd",void 0),ct(ut(t),"cgLayer",void 0),ct(ut(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&&at(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}}])&&rt(r.prototype,n),o&&rt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function st(t){return st="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},st(t)}function yt(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,pt(n.key),n)}}function pt(t){var e=function(t,e){if("object"!=st(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=st(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:String(e)}function ht(t,e,r){return e=bt(e),function(t,e){if(e&&("object"===st(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,vt()?Reflect.construct(e,r||[],bt(t).constructor):e.apply(t,r))}function vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vt=function(){return!!t})()}function bt(t){return bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bt(t)}function mt(t,e){return mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mt(t,e)}var dt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ht(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&&mt(t,e)}(e,t),r=e,o=[{key:"all",value:function(){return new B("CLEAR ALL")}}],(n=[{key:"getCommandType",value:function(){return"CLEAR"}}])&&yt(r.prototype,n),o&&yt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function gt(t){return gt="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},gt(t)}function wt(t){return function(t){if(Array.isArray(t))return Ot(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 Ot(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)?Ot(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 Ot(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 jt(t,e,r){return e=_t(e),function(t,e){if(e&&("object"===gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Pt(t)}(t,St()?Reflect.construct(e,r||[],_t(t).constructor):e.apply(t,r))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function Pt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t,e){return Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Et(t,e)}function kt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xt(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 Tt(t,e,r){return e&&xt(t.prototype,e),r&&xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lt(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:String(e)}var Ct=function(){function t(){kt(this,t)}return Tt(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}(),At=function(t){function e(){var t,r,n,o;return kt(this,e),r=Pt(t=jt(this,e)),o=void 0,(n=Lt(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&&Et(t,e)}(e,t),Tt(e,[{key:"getCommandType",value:function(){return"LOADBG"}},{key:"getArguments",value:function(){var t=this.getPosition();return t?[t].concat(wt(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(wt(Ct.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}(R);function Rt(t){return Rt="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},Rt(t)}function It(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,Nt(n.key),n)}}function Nt(t){var e=function(t,e){if("object"!=Rt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rt(e)?e:String(e)}function Dt(t,e,r){return e=Mt(e),function(t,e){if(e&&("object"===Rt(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,Bt()?Reflect.construct(e,r||[],Mt(t).constructor):e.apply(t,r))}function Bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bt=function(){return!!t})()}function Mt(t){return Mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mt(t)}function Gt(t,e){return Gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gt(t,e)}var Ft=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Dt(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&&Gt(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"LOAD"}}])&&It(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function Ut(t){return Ut="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},Ut(t)}function Jt(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 Vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yt(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,zt(n.key),n)}}function Wt(t,e,r){return e&&Yt(t.prototype,e),r&&Yt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ht(t,e,r){return e=Kt(e),function(t,e){if(e&&("object"===Ut(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return qt(t)}(t,$t()?Reflect.construct(e,r||[],Kt(t).constructor):e.apply(t,r))}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($t=function(){return!!t})()}function Kt(t){return Kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kt(t)}function qt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qt(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&&Xt(t,e)}function Xt(t,e){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xt(t,e)}function Zt(t,e,r){return(e=zt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zt(t){var e=function(t,e){if("object"!=Ut(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ut(e)?e:String(e)}var te=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Vt(this,e),Zt(qt(r=Ht(this,e)),"command",void 0),Zt(qt(r),"args",void 0),r.command=t,r.args=n,r}return Qt(e,t),Wt(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(function(t){if(Array.isArray(t))return Jt(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 Jt(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)?Jt(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}(R),ee=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Vt(this,e),t=Ht(this,e,[[]]),r&&t.commands.push(new te("CLEAR")),t}return Qt(e,t),Wt(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 te(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}(D);function re(t){return re="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},re(t)}function ne(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,oe(n.key),n)}}function oe(t){var e=function(t,e){if("object"!=re(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==re(e)?e:String(e)}function ie(t,e,r){return e=ae(e),function(t,e){if(e&&("object"===re(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,ue()?Reflect.construct(e,r||[],ae(t).constructor):e.apply(t,r))}function ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ue=function(){return!!t})()}function ae(t){return ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ae(t)}function ce(t,e){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ce(t,e)}var fe=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&&ce(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PAUSE"}}])&&ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function le(t){return le="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},le(t)}function se(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,ye(n.key),n)}}function ye(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==le(e)?e:String(e)}function pe(t,e,r){return e=ve(e),function(t,e){if(e&&("object"===le(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,he()?Reflect.construct(e,r||[],ve(t).constructor):e.apply(t,r))}function he(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(he=function(){return!!t})()}function ve(t){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ve(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),pe(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"PLAY"}}])&&se(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function de(t){return de="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},de(t)}function ge(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,we(n.key),n)}}function we(t){var e=function(t,e){if("object"!=de(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==de(e)?e:String(e)}function Oe(t,e,r){return e=Se(e),function(t,e){if(e&&("object"===de(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,je()?Reflect.construct(e,r||[],Se(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 Se(t){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Se(t)}function _e(t,e){return _e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_e(t,e)}var Pe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Oe(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&&_e(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&ge(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Ee(t){return Ee="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},Ee(t)}function ke(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,xe(n.key),n)}}function xe(t){var e=function(t,e){if("object"!=Ee(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ee(e)?e:String(e)}function Te(t,e,r){return e=Ce(e),function(t,e){if(e&&("object"===Ee(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,Le()?Reflect.construct(e,r||[],Ce(t).constructor):e.apply(t,r))}function Le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Le=function(){return!!t})()}function Ce(t){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ce(t)}function Ae(t,e){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ae(t,e)}var Re=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Te(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&&Ae(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&ke(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function Ie(t){return Ie="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},Ie(t)}function Ne(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,De(n.key),n)}}function De(t){var e=function(t,e){if("object"!=Ie(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ie(e)?e:String(e)}function Be(t,e,r){return e=Ge(e),function(t,e){if(e&&("object"===Ie(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,Me()?Reflect.construct(e,r||[],Ge(t).constructor):e.apply(t,r))}function Me(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Me=function(){return!!t})()}function Ge(t){return Ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ge(t)}function Fe(t,e){return Fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fe(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),Be(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&&Fe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"RESUME"}}])&&Ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Je(t){return Je="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},Je(t)}function Ve(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,Ye(n.key),n)}}function Ye(t){var e=function(t,e){if("object"!=Je(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Je(e)?e:String(e)}function We(t,e,r){return e=$e(e),function(t,e){if(e&&("object"===Je(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,He()?Reflect.construct(e,r||[],$e(t).constructor):e.apply(t,r))}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(He=function(){return!!t})()}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}function Ke(t,e){return Ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ke(t,e)}var qe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),We(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&&Ke(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&Ve(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Qe(t){return Qe="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},Qe(t)}function Xe(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,or(n.key),n)}}function Ze(t,e,r){return e=tr(e),function(t,e){if(e&&("object"===Qe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return er(t)}(t,ze()?Reflect.construct(e,r||[],tr(t).constructor):e.apply(t,r))}function ze(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ze=function(){return!!t})()}function tr(t){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tr(t)}function er(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rr(t,e){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rr(t,e)}function nr(t,e,r){return(e=or(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function or(t){var e=function(t,e){if("object"!=Qe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qe(e)?e:String(e)}var ir=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),nr(er(n=Ze(this,e)),"allocation1",void 0),nr(er(n),"allocation2",void 0),nr(er(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&&rr(t,e)}(e,t),r=e,(n=[{key:"allocate1",value:function(t,e){return this.allocation1=h.from(t,e),this}},{key:"allocate2",value:function(t,e){return this.allocation2=h.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}}])&&Xe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);const ur={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ar;const cr=new Uint8Array(16);function fr(){if(!ar&&(ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ar))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ar(cr)}const lr=[];for(let t=0;t<256;++t)lr.push((t+256).toString(16).slice(1));const sr=function(t,e,r){if(ur.randomUUID&&!e&&!t)return ur.randomUUID();const n=(t=t||{}).random||(t.rng||fr)();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 lr[t[e+0]]+lr[t[e+1]]+lr[t[e+2]]+lr[t[e+3]]+"-"+lr[t[e+4]]+lr[t[e+5]]+"-"+lr[t[e+6]]+lr[t[e+7]]+"-"+lr[t[e+8]]+lr[t[e+9]]+"-"+lr[t[e+10]]+lr[t[e+11]]+lr[t[e+12]]+lr[t[e+13]]+lr[t[e+14]]+lr[t[e+15]]}(n)};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){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=hr(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 hr(t,e){if(t){if("string"==typeof t)return vr(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)?vr(t,e):void 0}}function vr(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 br(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mr(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,Pr(n.key),n)}}function dr(t,e,r){return e&&mr(t.prototype,e),r&&mr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gr(t,e,r){return e=Or(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 jr(t)}(t,wr()?Reflect.construct(e,r||[],Or(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 Or(t){return Or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Or(t)}function jr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Sr(t,e){return Sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sr(t,e)}function _r(t,e,r){return(e=Pr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pr(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 Er=function(t){function e(t){var r;return br(this,e),_r(jr(r=gr(this,e)),"_active",!1),_r(jr(r),"_disposed",!1),_r(jr(r),"id",sr()),_r(jr(r),"transform",void 0),_r(jr(r),"effectGroup",void 0),_r(jr(r),"layers",[]),r.effectGroup=t,r.group.addEffect(jr(r)),r}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&&Sr(t,e)}(e,t),dr(e,[{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=pr(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,this.removeAllListeners())}},{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 vr(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||hr(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=pr(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=pr(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(){return[]}},{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()}))}}}]),e}(o.EventEmitter),kr=function(){function t(){br(this,t),_r(this,"effects",new Map)}return dr(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 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 Tr(t,e,r){return e=Cr(e),function(t,e){if(e&&("object"===xr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ar(t)}(t,Lr()?Reflect.construct(e,r||[],Cr(t).constructor):e.apply(t,r))}function Lr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lr=function(){return!!t})()}function Cr(t){return Cr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cr(t)}function Ar(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Rr(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&&Ir(t,e)}function Ir(t,e){return Ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ir(t,e)}function Nr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Dr(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 Dr(t,e){if(t){if("string"==typeof t)return Br(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)?Br(t,e):void 0}}function Br(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 Mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gr(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,Jr(n.key),n)}}function Fr(t,e,r){return e&&Gr(t.prototype,e),r&&Gr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ur(t,e,r){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jr(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 Vr=function(){function t(e,r){Mr(this,t),Ur(this,"effects",[]),Ur(this,"name",void 0),Ur(this,"channel",void 0),this.name=r,this.channel=e}return Fr(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=Nr(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}(),Yr=function(t){function e(t,r){var n;return Mr(this,e),Ur(Ar(n=Tr(this,e,[t])),"layers",new Map),Ur(Ar(n),"groups",[]),Ur(Ar(n),"lastOrder",[]),Ur(Ar(n),"currentOrder",[]),Ur(Ar(n),"executor",void 0),Ur(Ar(n),"needExecute",!1),n.executor=r,n}return Rr(e,t),Fr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Vr(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:sr();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 Wr(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){var e,r=Nr(t);try{for(r.s();!(e=r.n()).done;){var n=e.value,o=this.currentOrder.indexOf(n.id);this.currentOrder[o]=void 0,this.layers.delete(n.id)}}catch(t){r.e(t)}finally{r.f()}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=h.caspar(this.casparChannel,r+1);t.push(new dt(o)),t.push(ee.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=h.caspar(this.casparChannel,i+1),f=h.caspar(this.casparChannel,a+1);t.push(new ir(c,f,!0))}}}this.lastOrder=this.currentOrder,this.currentOrder=this.currentOrder.slice();for(var l=0;l<this.currentOrder.length;l++){var s=this.currentOrder[l];if(void 0!==s){var y=this.layers.get(s);y&&y.setCasparLayer(l+1)}}var p,v=Nr(this.executor.getEffects());try{for(v.s();!(p=v.n()).done;){var b=p.value;t.push.apply(t,function(t){if(Array.isArray(t))return Br(t)}(d=b.updatePositions())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(d)||Dr(d)||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.")}())}}catch(t){v.e(t)}finally{v.f()}var m=new D(t);this.executor.execute(m)}var d}},{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}(p),Wr=function(t){function e(t){var r;return Mr(this,e),Ur(Ar(r=Tr(this,e,[t])),"id",void 0),Ur(Ar(r),"effect",void 0),r.id=sr(),r}return Rr(e,t),Fr(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}(h);function Hr(t){return Hr="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},Hr(t)}function $r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Zr(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 Kr(){Kr=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 m?e:m,u=Object.create(i.prototype),a=new L(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",b={};function m(){}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=m.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"==Hr(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===b)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===b)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")),b;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;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,b):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(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(Hr(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,L.prototype={constructor:L,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(T),!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,b):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),b},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),T(r),b}},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;T(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),b}},e}function qr(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 Qr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){qr(i,n,o,u,a,"next",t)}function a(t){qr(i,n,o,u,a,"throw",t)}u(void 0)}))}}function Xr(t){return function(t){if(Array.isArray(t))return zr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Zr(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 Zr(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 tn(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,ln(n.key),n)}}function en(t,e,r){return e&&tn(t.prototype,e),r&&tn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function on(t){var e="function"==typeof Map?new Map:void 0;return on=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(un())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&an(o,r.prototype),o}(t,arguments,cn(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),an(r,t)},on(t)}function un(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(un=function(){return!!t})()}function an(t,e){return an=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},an(t,e)}function cn(t){return cn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cn(t)}function fn(t,e,r){return(e=ln(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ln(t){var e=function(t,e){if("object"!=Hr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Hr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hr(e)?e:String(e)}var sn=function(t){function e(t,r){var n,o,i,u;return rn(this,e),fn(nn((o=this,i=e,u=[[r].concat(Xr(t)).join("\n")],i=cn(i),n=function(t,e){if(e&&("object"===Hr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return nn(t)}(o,un()?Reflect.construct(i,u||[],cn(o).constructor):i.apply(o,u)))),"data",void 0),fn(nn(n),"code",void 0),n.data=t,n.code=r,n.name="CasparResponseError",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&&an(t,e)}(e,t),en(e)}(on(Error)),yn=function(){function t(){rn(this,t),fn(this,"templates",[]),fn(this,"lastFetch",0),fn(this,"fetchPromise",null),fn(this,"channels",new Map),fn(this,"listeners",[]),fn(this,"effects",new Map)}var e,r;return en(t,[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(r=Qr(Kr().mark((function t(){return Kr().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 r.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:(e=Qr(Kr().mark((function t(){var e=arguments;return Kr().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 e.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(new sn(["Timeout"],-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(new sn(t,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=A.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 Yr(t,this);return this.channels.set(t,e),e}},{key:"executeAllocations",value:function(){var t,e=$r(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:"readData",value:function(t,e,r){var n=[];if((101===t||201===t||400===t)&&(n.push(r[0]),r.length<1))return-1;if(200===t){for(var o=0;r[o];o++)n.push(r[o]);if(n.length===r.length)return-1}return this.executeListeners(t,e,n),this.onEvent(t,e,n),200===t?n.length+1:n.length}},{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=null;400!==u&&500!==u&&(a=i[1]);var c=this.readData(u,a,e.slice(o+1));if(c<0)break;n=(o+=c)+1}return[].concat(Xr(e.slice(n)),[r]).join("\r\n")}},{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=$r(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()}))}}}]),t}();function pn(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function hn(t){return hn="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},hn(t)}function vn(){vn=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 m?e:m,u=Object.create(i.prototype),a=new L(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",b={};function m(){}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=m.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"==hn(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===b)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===b)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")),b;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;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,b):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}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 T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(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(hn(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,L.prototype={constructor:L,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(T),!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,b):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),b},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),T(r),b}},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;T(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),b}},e}function bn(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 mn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_n(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 dn(t,e,r){return e=wn(e),function(t,e){if(e&&("object"===hn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return On(t)}(t,gn()?Reflect.construct(e,r||[],wn(t).constructor):e.apply(t,r))}function gn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gn=function(){return!!t})()}function wn(t){return wn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wn(t)}function On(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jn(t,e){return jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jn(t,e)}function Sn(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)||_n(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 _n(t,e){if(t){if("string"==typeof t)return Pn(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)?Pn(t,e):void 0}}function Pn(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 En(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kn(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,Ln(n.key),n)}}function xn(t,e,r){return e&&kn(t.prototype,e),r&&kn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Tn(t,e,r){return(e=Ln(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ln(t){var e=function(t,e){if("object"!=hn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=hn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hn(e)?e:String(e)}var Cn=function(){function t(){En(this,t),Tn(this,"_api",void 0),Tn(this,"_enabled",!1),Tn(this,"logger",void 0)}return xn(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=Sn(pn((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=Sn(pn((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}(),An=function(t){function e(t,r){var n;return En(this,e),Tn(On(n=dn(this,e)),"files",[]),Tn(On(n),"uiInjections",[]),Tn(On(n),"_manager",void 0),Tn(On(n),"_plugin",void 0),Tn(On(n),"_effects",[]),Tn(On(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=On(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&&jn(t,e)}(e,t),xn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=mn(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=mn(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=vn().mark((function t(){var e,r,n;return vn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=mn(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){bn(i,n,o,u,a,"next",t)}function a(t){bn(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=mn(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:"getFileDatabase",value:function(){return this._manager.getFiles()}},{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)}},{key:"registerRundownAction",value:function(t,e){this._manager.rundowns.executor.registerAction(t,e)}}]),e}(o.EventEmitter);function Rn(t){return Rn="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},Rn(t)}function In(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,Dn(n.key),n)}}function Nn(t,e,r){return(e=Dn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Dn(t){var e=function(t,e){if("object"!=Rn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Rn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rn(e)?e:String(e)}var Bn=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Nn(this,"source",void 0),Nn(this,"destination",void 0),Nn(this,"fillTransition",null),Nn(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 ee.create().crop(this.getCrop(this.source),this.cropTransition).fill(this.getFill(this.destination),this.fillTransition)}}])&&In(e.prototype,r),n&&In(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
package/dist/plugin.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import { EffectConstructor } from './effect';
3
+ import { Effect, EffectConstructor } from './effect';
4
4
  import { Logger, CasparManager } from './types';
5
5
  import { Method } from 'rest-exchange-protocol';
6
6
  import { Route } from 'rest-exchange-protocol/dist/route';
7
7
  import { UI_INJECTION_ZONE } from './types/ui';
8
+ import { RundownItem } from './types/rundown';
8
9
  export declare class CasparPlugin {
9
10
  private _api;
10
11
  private _enabled;
@@ -45,6 +46,7 @@ export declare class PluginAPI extends EventEmitter {
45
46
  */
46
47
  registerUI(injectionZone: UI_INJECTION_ZONE, file: string): void;
47
48
  unregisterUI(id: string): void;
48
- createEffect(name: string, group: string, options: any): import("./effect").Effect;
49
- getEffect(id: string): import("./effect").Effect;
49
+ createEffect<T = Effect>(name: string, group: string, options: any): T;
50
+ getEffect(id: string): Effect;
51
+ registerRundownAction(name: string, handler: (item: RundownItem) => Promise<void> | void): void;
50
52
  }
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import { Injection } from './ui';
3
+ import { Injection, UIInjector } from './ui';
4
4
  import { EffectRegistry } from '../effect';
5
- import { UIInjector } from './ui';
6
5
  import { Logger } from './log';
7
6
  import { MediaScanner } from './scanner/scanner';
8
7
  import { DirectoryManager } from './scanner/dir';
@@ -11,6 +10,7 @@ import { PluginManager } from './plugin';
11
10
  import { CasparProcess } from './caspar/process';
12
11
  import { CasparExecutor } from './caspar/executor';
13
12
  import { FileDatabase } from './scanner/db';
13
+ import { RundownManager } from './rundown';
14
14
  export declare class CasparManager extends EventEmitter {
15
15
  effects: EffectRegistry;
16
16
  ui: UIInjector;
@@ -20,6 +20,7 @@ export declare class CasparManager extends EventEmitter {
20
20
  caspar: CasparProcess;
21
21
  executor: CasparExecutor;
22
22
  db: FileDatabase;
23
+ rundowns: RundownManager;
23
24
  start(): Promise<void>;
24
25
  stop(): Promise<void>;
25
26
  getMediaScanner(): MediaScanner;
@@ -0,0 +1,27 @@
1
+ export interface RundownItem {
2
+ id: string;
3
+ title: string;
4
+ type: string;
5
+ data: any;
6
+ metadata: {
7
+ autoNext: boolean;
8
+ };
9
+ }
10
+ export interface Rundown {
11
+ id: string;
12
+ name: string;
13
+ items: RundownItem[];
14
+ }
15
+ export declare class RundownManager {
16
+ private rundowns;
17
+ executor: RundownExecutor;
18
+ createRundown(name: string): Rundown;
19
+ getRundown(id: string): Rundown | null;
20
+ loadRundowns(): Promise<void>;
21
+ saveRundown(rundown: Rundown): Promise<void>;
22
+ deleteRundown(id: string): Promise<void>;
23
+ }
24
+ export declare class RundownExecutor {
25
+ registerAction(type: string, action: (item: RundownItem) => Promise<void> | void): void;
26
+ executeItem(item: RundownItem): Promise<void>;
27
+ }
package/package.json CHANGED
@@ -3,15 +3,25 @@
3
3
  "repository": "https://github.com/Lapplandsveckan/cg-manager-plugin",
4
4
  "author": "firecraftgaming <eliyah@sundstroem.com>",
5
5
  "license": "MIT",
6
- "version": "0.0.8",
6
+ "version": "0.0.10",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "devDependencies": {
10
10
  "@babel/core": "^7.19.3",
11
11
  "@babel/preset-env": "^7.19.3",
12
12
  "@babel/preset-typescript": "^7.18.6",
13
+ "@testdeck/mocha": "^0.3.3",
14
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
15
+ "@typescript-eslint/parser": "^7.1.1",
16
+ "chai": "^4.3.7",
17
+ "eslint": "^8.57.0",
18
+ "mocha": "10.2.0",
19
+ "mocha-typescript": "^1.1.17",
20
+ "nyc": "^15.1.0",
13
21
  "ts-loader": "^9.2.6",
14
- "typescript": "^4.5.5",
22
+ "ts-mockito": "^2.6.1",
23
+ "tsconfig-paths": "^4.2.0",
24
+ "typescript": "^4.9.5",
15
25
  "webpack": "^5.69.0",
16
26
  "webpack-cli": "^4.9.2"
17
27
  },
@@ -23,7 +33,11 @@
23
33
  "scripts": {
24
34
  "tsc": "tsc --noEmit",
25
35
  "build": "webpack && tsc --emitDeclarationOnly",
26
- "watch": "webpack --watch"
36
+ "watch": "webpack --watch",
37
+ "test": "mocha 'test/**/*.test.ts'",
38
+ "test:coverage": "nyc mocha 'test/**/*.test.ts'",
39
+ "lint": "eslint src test --ext .ts",
40
+ "lint:fix": "eslint src test --ext .ts --fix"
27
41
  },
28
42
  "dependencies": {
29
43
  "babel-loader": "^8.2.5",