@lappis/cg-manager 0.0.28 → 0.0.30

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/command.d.ts CHANGED
@@ -7,6 +7,7 @@ export type Allocation = BasicLayer | ChannelResolvable;
7
7
  export declare abstract class BasicCommand {
8
8
  protected abstract getCommandType(): string;
9
9
  protected abstract getArguments(): string[];
10
+ static construct(command: string, ...args: string[]): ReturnType<typeof BasicCommand.create>;
10
11
  private static create;
11
12
  private static parseQuotes;
12
13
  private static parseArguments;
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:()=>Y,BasicChannel:()=>p,BasicCommand:()=>A,BasicLayer:()=>h,CallCommand:()=>tt,CasparPlugin:()=>An,CgCommand:()=>lt,Channel:()=>Yr,ClearCommand:()=>dt,Command:()=>C,CommandExecutor:()=>pn,CommandGroup:()=>D,Effect:()=>kr,EffectGroup:()=>Wr,EffectRegistry:()=>xr,Layer:()=>Hr,LayeredCommand:()=>R,LoadBGCommand:()=>At,LoadCommand:()=>Gt,LogLevel:()=>i,MediaDoc:()=>t.MediaDoc,MixerCommand:()=>re,PauseCommand:()=>le,PlayCommand:()=>de,PlayoutOptions:()=>e.PlayoutOptions,PluginAPI:()=>Rn,PrintCommand:()=>Ee,RawCommand:()=>B,RemoveCommand:()=>Ie,ResumeCommand:()=>Ve,SimpleArgsCommand:()=>N,SimpleCommand:()=>I,StopCommand:()=>Qe,SwapCommand:()=>ur,Transform:()=>Mn,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={PLUGIN_PAGE:"plugin-page",RUNDOWN_ITEM:"rundown-item",RUNDOWN_EDITOR:"rundown-editor",RUNDOWN_SIDE:"rundown-side",RUNDOWN_BOTTOM_PANEL:"rundown-bottom-panel"};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 U(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,G(n.key),n)}}function G(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=J(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,V()?Reflect.construct(e,r||[],J(t).constructor):e.apply(t,r))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}var Y=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&&W(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&U(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 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,z(n.key),n)}}function $(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=$(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]}}])&&K(r.prototype,n),o&&K(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:"decklink",value:function(t,e){return(new this).setArguments("DECKLINK","DEVICE",t.toString(),"FORMAT",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 Ut(t,e){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ut(t,e)}var Gt=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&&Ut(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 Vt(t){return function(t){if(Array.isArray(t))return Jt(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 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.")}()}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 Wt(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,te(n.key),n)}}function Ht(t,e,r){return e&&Yt(t.prototype,e),r&&Yt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Kt(t,e,r){return e=qt(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 Qt(t)}(t,$t()?Reflect.construct(e,r||[],qt(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 qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qt(t)}function Qt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Xt(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=te(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function te(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 ee=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Wt(this,e),zt(Qt(r=Kt(this,e)),"command",void 0),zt(Qt(r),"args",void 0),r.command=t,r.args=n,r}return Xt(e,t),Ht(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(Vt(this.args))}}]),e}(R),re=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Wt(this,e),t=Kt(this,e,[[]]),r&&t.commands.push(new ee("CLEAR")),t}return Xt(e,t),Ht(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 ee(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:"edgeblend",value:function(t){for(var e,r,n,o=t.edgeblend.slice(0,4);o.length<4;)o.push(0);var i=[].concat(Vt(o),[null!==(e=t.g)&&void 0!==e?e:1.8,null!==(r=t.p)&&void 0!==r?r:3,null!==(n=t.a)&&void 0!==n?n:.5]);return this.single("EDGEBLEND",i.map((function(t){return t.toString()})))}},{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 ne(t){return ne="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},ne(t)}function oe(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,ie(n.key),n)}}function ie(t){var e=function(t,e){if("object"!=ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ne(e)?e:String(e)}function ue(t,e,r){return e=ce(e),function(t,e){if(e&&("object"===ne(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,ae()?Reflect.construct(e,r||[],ce(t).constructor):e.apply(t,r))}function ae(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ae=function(){return!!t})()}function ce(t){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ce(t)}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}var le=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ue(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"PAUSE"}}])&&oe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function ye(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pe(n.key),n)}}function pe(t){var e=function(t,e){if("object"!=se(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:String(e)}function he(t,e,r){return e=be(e),function(t,e){if(e&&("object"===se(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ve()?Reflect.construct(e,r||[],be(t).constructor):e.apply(t,r))}function ve(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ve=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},be(t)}function me(t,e){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},me(t,e)}var de=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),he(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"}}])&&ye(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function ge(t){return ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(t)}function we(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"!=ge(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ge(e)?e:String(e)}function je(t,e,r){return e=_e(e),function(t,e){if(e&&("object"===ge(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Se()?Reflect.construct(e,r||[],_e(t).constructor):e.apply(t,r))}function Se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Se=function(){return!!t})()}function _e(t){return _e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_e(t)}function Pe(t,e){return Pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pe(t,e)}var Ee=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),je(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&we(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function ke(t){return ke="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},ke(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,Te(n.key),n)}}function Te(t){var e=function(t,e){if("object"!=ke(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ke(e)?e:String(e)}function Le(t,e,r){return e=Ae(e),function(t,e){if(e&&("object"===ke(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,Ce()?Reflect.construct(e,r||[],Ae(t).constructor):e.apply(t,r))}function Ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ce=function(){return!!t})()}function Ae(t){return Ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ae(t)}function Re(t,e){return Re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Re(t,e)}var Ie=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Le(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Re(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&xe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function Ne(t){return Ne="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},Ne(t)}function De(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Be(n.key),n)}}function Be(t){var e=function(t,e){if("object"!=Ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ne(e)?e:String(e)}function Me(t,e,r){return e=Ge(e),function(t,e){if(e&&("object"===Ne(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||[],Ge(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 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 Ve=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Me(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"}}])&&De(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 We(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 He(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,Ke()?Reflect.construct(e,r||[],$e(t).constructor):e.apply(t,r))}function Ke(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ke=function(){return!!t})()}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}function qe(t,e){return qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qe(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),He(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&&qe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&We(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Xe(t){return Xe="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},Xe(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,ir(n.key),n)}}function ze(t,e,r){return e=er(e),function(t,e){if(e&&("object"===Xe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return rr(t)}(t,tr()?Reflect.construct(e,r||[],er(t).constructor):e.apply(t,r))}function tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(tr=function(){return!!t})()}function er(t){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},er(t)}function rr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nr(t,e){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nr(t,e)}function or(t,e,r){return(e=ir(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ir(t){var e=function(t,e){if("object"!=Xe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xe(e)?e:String(e)}var ur=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),or(rr(n=ze(this,e)),"allocation1",void 0),or(rr(n),"allocation2",void 0),or(rr(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&&nr(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("TRANSFORMS"),o}}])&&Ze(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);const ar={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let cr;const fr=new Uint8Array(16);function lr(){if(!cr&&(cr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cr(fr)}const sr=[];for(let t=0;t<256;++t)sr.push((t+256).toString(16).slice(1));const yr=function(t,e,r){if(ar.randomUUID&&!e&&!t)return ar.randomUUID();const n=(t=t||{}).random||(t.rng||lr)();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 sr[t[e+0]]+sr[t[e+1]]+sr[t[e+2]]+sr[t[e+3]]+"-"+sr[t[e+4]]+sr[t[e+5]]+"-"+sr[t[e+6]]+sr[t[e+7]]+"-"+sr[t[e+8]]+sr[t[e+9]]+"-"+sr[t[e+10]]+sr[t[e+11]]+sr[t[e+12]]+sr[t[e+13]]+sr[t[e+14]]+sr[t[e+15]]}(n)};function pr(t){return pr="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},pr(t)}function hr(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 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 dr(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,Er(n.key),n)}}function gr(t,e,r){return e&&dr(t.prototype,e),r&&dr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function wr(t,e,r){return e=jr(e),function(t,e){if(e&&("object"===pr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Sr(t)}(t,Or()?Reflect.construct(e,r||[],jr(t).constructor):e.apply(t,r))}function Or(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Or=function(){return!!t})()}function jr(t){return jr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jr(t)}function Sr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _r(t,e){return _r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_r(t,e)}function Pr(t,e,r){return(e=Er(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t){var e=function(t,e){if("object"!=pr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pr(e)?e:String(e)}var kr=function(t){function e(t){var r;return mr(this,e),Pr(Sr(r=wr(this,e)),"_active",!1),Pr(Sr(r),"_disposed",!1),Pr(Sr(r),"id",yr()),Pr(Sr(r),"transform",void 0),Pr(Sr(r),"effectGroup",void 0),Pr(Sr(r),"layers",[]),r.effectGroup=t,r.group.addEffect(Sr(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&&_r(t,e)}(e,t),gr(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=hr(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 br(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||vr(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=hr(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=hr(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),xr=function(){function t(){mr(this,t),Pr(this,"effects",new Map)}return gr(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 Tr(t){return Tr="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},Tr(t)}function Lr(t,e,r){return e=Ar(e),function(t,e){if(e&&("object"===Tr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Rr(t)}(t,Cr()?Reflect.construct(e,r||[],Ar(t).constructor):e.apply(t,r))}function Cr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Cr=function(){return!!t})()}function Ar(t){return Ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ar(t)}function Rr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ir(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&&Nr(t,e)}function Nr(t,e){return Nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nr(t,e)}function Dr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Br(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 Br(t,e){if(t){if("string"==typeof t)return Mr(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)?Mr(t,e):void 0}}function Mr(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 Ur(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 Vr(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"!=Tr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tr(e)?e:String(e)}var Wr=function(){function t(e,r){Ur(this,t),Vr(this,"effects",[]),Vr(this,"name",void 0),Vr(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=Dr(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 Ur(this,e),Vr(Rr(n=Lr(this,e,[t])),"layers",new Map),Vr(Rr(n),"groups",[]),Vr(Rr(n),"lastOrder",[]),Vr(Rr(n),"currentOrder",[]),Vr(Rr(n),"executor",void 0),Vr(Rr(n),"needExecute",!1),n.executor=r,n}return Ir(e,t),Fr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Wr(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:yr();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 Hr(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=Dr(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(re.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 ur(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=Dr(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 Mr(t)}(d=b.updatePositions())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(d)||Br(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),Hr=function(t){function e(t){var r;return Ur(this,e),Vr(Rr(r=Lr(this,e,[t])),"id",void 0),Vr(Rr(r),"effect",void 0),r.id=yr(),r}return Ir(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 Kr(t){return Kr="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},Kr(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 qr(){qr=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"==Kr(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(Kr(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 Xr(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 Zr(t){return function(t){if(Array.isArray(t))return tn(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 tn(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)?tn(t,e):void 0}}function tn(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){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,sn(n.key),n)}}function rn(t,e,r){return e&&en(t.prototype,e),r&&en(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function nn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function on(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function un(t){var e="function"==typeof Map?new Map:void 0;return un=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(an())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&cn(o,r.prototype),o}(t,arguments,fn(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),cn(r,t)},un(t)}function an(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(an=function(){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){return fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fn(t)}function ln(t,e,r){return(e=sn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sn(t){var e=function(t,e){if("object"!=Kr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Kr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kr(e)?e:String(e)}var yn=function(t){function e(t,r){var n,o,i,u;return nn(this,e),ln(on((o=this,i=e,u=[[r].concat(Zr(t)).join("\n")],i=fn(i),n=function(t,e){if(e&&("object"===Kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return on(t)}(o,an()?Reflect.construct(i,u||[],fn(o).constructor):i.apply(o,u)))),"data",void 0),ln(on(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&&cn(t,e)}(e,t),rn(e)}(un(Error)),pn=function(){function t(){nn(this,t),ln(this,"templates",[]),ln(this,"lastFetch",0),ln(this,"fetchPromise",null),ln(this,"channels",new Map),ln(this,"listeners",[]),ln(this,"effects",new Map)}var e,r;return rn(t,[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(r=Xr(qr().mark((function t(){return qr().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=Xr(qr().mark((function t(){var e=arguments;return qr().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 yn(["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 yn(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(Zr(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 hn(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function vn(t){return vn="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},vn(t)}function bn(){bn=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"==vn(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(vn(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 mn(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 dn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Pn(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 gn(t,e,r){return e=On(e),function(t,e){if(e&&("object"===vn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jn(t)}(t,wn()?Reflect.construct(e,r||[],On(t).constructor):e.apply(t,r))}function wn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wn=function(){return!!t})()}function On(t){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(t)}function jn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Sn(t,e){return Sn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sn(t,e)}function _n(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)||Pn(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 Pn(t,e){if(t){if("string"==typeof t)return En(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)?En(t,e):void 0}}function En(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 kn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xn(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,Cn(n.key),n)}}function Tn(t,e,r){return e&&xn(t.prototype,e),r&&xn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ln(t,e,r){return(e=Cn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cn(t){var e=function(t,e){if("object"!=vn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vn(e)?e:String(e)}var An=function(){function t(){kn(this,t),Ln(this,"_api",void 0),Ln(this,"_enabled",!1),Ln(this,"logger",void 0)}return Tn(t,[{key:"pluginName",get:function(){return this.constructor.pluginName}},{key:"enable",value:function(t){var e=this;if(!this._enabled){this._enabled=!0;var r=_n(hn((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=_n(hn((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}(),Rn=function(t){function e(t,r){var n;return kn(this,e),Ln(jn(n=gn(this,e)),"files",[]),Ln(jn(n),"uiInjections",[]),Ln(jn(n),"_manager",void 0),Ln(jn(n),"_plugin",void 0),Ln(jn(n),"_effects",[]),Ln(jn(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=jn(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&&Sn(t,e)}(e,t),Tn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=dn(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=dn(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=bn().mark((function t(){var e,r,n;return bn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=dn(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){mn(i,n,o,u,a,"next",t)}function a(t){mn(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=dn(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:"broadcast",value:function(t,e,r,n){this._manager.server.broadcast("plugin/".concat(this._plugin.pluginName,"/").concat(t),e,r,n)}},{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)}},{key:"setVideoRouteEnabled",value:function(t,e){var r,n=null!=e?e:null===(r=this._manager.routes.getVideoRoute(t))||void 0===r?void 0:r.enabled;this._manager.routes.setVideoRouteEnabled(t,n)}}]),e}(o.EventEmitter);function In(t){return In="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},In(t)}function Nn(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,Bn(n.key),n)}}function Dn(t,e,r){return(e=Bn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Bn(t){var e=function(t,e){if("object"!=In(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==In(e)?e:String(e)}var Mn=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Dn(this,"source",void 0),Dn(this,"destination",void 0),Dn(this,"fillTransition",null),Dn(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(e,r){var n;r=null!==(n=r)&&void 0!==n?n:t.normalRect();var o=(e.end.x-e.start.x)/(r.end.x-r.start.x),i=(e.end.y-e.start.y)/(r.end.y-r.start.y);return{x:e.start.x-r.start.x*o,y:e.start.y-r.start.y*i,x_scale:o,y_scale:i}}},{key:"getClip",value:function(t){return{x:t.start.x,y:t.start.y,width:t.end.x-t.start.x,height:t.end.y-t.start.y}}},{key:"getCommand",value:function(){var t=re.create().fill(this.getFill(this.destination,this.source),this.fillTransition),e=!1;return(this.source.start.x>0||this.source.start.y>0)&&(e=!0),(this.source.end.x<1||this.source.end.y<1)&&(e=!0),e?t.clip(this.getClip(this.destination),this.cropTransition):t}}])&&Nn(e.prototype,r),n&&Nn(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:()=>Y,BasicChannel:()=>p,BasicCommand:()=>A,BasicLayer:()=>h,CallCommand:()=>tt,CasparPlugin:()=>An,CgCommand:()=>lt,Channel:()=>Yr,ClearCommand:()=>dt,Command:()=>C,CommandExecutor:()=>pn,CommandGroup:()=>D,Effect:()=>kr,EffectGroup:()=>Wr,EffectRegistry:()=>xr,Layer:()=>Hr,LayeredCommand:()=>R,LoadBGCommand:()=>At,LoadCommand:()=>Gt,LogLevel:()=>i,MediaDoc:()=>t.MediaDoc,MixerCommand:()=>re,PauseCommand:()=>le,PlayCommand:()=>de,PlayoutOptions:()=>e.PlayoutOptions,PluginAPI:()=>Rn,PrintCommand:()=>Ee,RawCommand:()=>B,RemoveCommand:()=>Ie,ResumeCommand:()=>Ve,SimpleArgsCommand:()=>N,SimpleCommand:()=>I,StopCommand:()=>Qe,SwapCommand:()=>ur,Transform:()=>Mn,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={PLUGIN_PAGE:"plugin-page",RUNDOWN_ITEM:"rundown-item",RUNDOWN_EDITOR:"rundown-editor",RUNDOWN_SIDE:"rundown-side",RUNDOWN_BOTTOM_PANEL:"rundown-bottom-panel"};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:"construct",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return this.create.apply(this,[t].concat(r))}},{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 U(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,G(n.key),n)}}function G(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=J(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,V()?Reflect.construct(e,r||[],J(t).constructor):e.apply(t,r))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}var Y=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&&W(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&U(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 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,z(n.key),n)}}function $(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=$(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]}}])&&K(r.prototype,n),o&&K(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:"decklink",value:function(t,e){return(new this).setArguments("DECKLINK","DEVICE",t.toString(),"FORMAT",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 Ut(t,e){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ut(t,e)}var Gt=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&&Ut(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 Vt(t){return function(t){if(Array.isArray(t))return Jt(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 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.")}()}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 Wt(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,te(n.key),n)}}function Ht(t,e,r){return e&&Yt(t.prototype,e),r&&Yt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Kt(t,e,r){return e=qt(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 Qt(t)}(t,$t()?Reflect.construct(e,r||[],qt(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 qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qt(t)}function Qt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Xt(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=te(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function te(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 ee=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Wt(this,e),zt(Qt(r=Kt(this,e)),"command",void 0),zt(Qt(r),"args",void 0),r.command=t,r.args=n,r}return Xt(e,t),Ht(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(Vt(this.args))}}]),e}(R),re=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Wt(this,e),t=Kt(this,e,[[]]),r&&t.commands.push(new ee("CLEAR")),t}return Xt(e,t),Ht(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 ee(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:"edgeblend",value:function(t){for(var e,r,n,o=t.edgeblend.slice(0,4);o.length<4;)o.push(0);var i=[].concat(Vt(o),[null!==(e=t.g)&&void 0!==e?e:1.8,null!==(r=t.p)&&void 0!==r?r:3,null!==(n=t.a)&&void 0!==n?n:.5]);return this.single("EDGEBLEND",i.map((function(t){return t.toString()})))}},{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 ne(t){return ne="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},ne(t)}function oe(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,ie(n.key),n)}}function ie(t){var e=function(t,e){if("object"!=ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ne(e)?e:String(e)}function ue(t,e,r){return e=ce(e),function(t,e){if(e&&("object"===ne(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,ae()?Reflect.construct(e,r||[],ce(t).constructor):e.apply(t,r))}function ae(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ae=function(){return!!t})()}function ce(t){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ce(t)}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}var le=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ue(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"PAUSE"}}])&&oe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function ye(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pe(n.key),n)}}function pe(t){var e=function(t,e){if("object"!=se(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:String(e)}function he(t,e,r){return e=be(e),function(t,e){if(e&&("object"===se(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ve()?Reflect.construct(e,r||[],be(t).constructor):e.apply(t,r))}function ve(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ve=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},be(t)}function me(t,e){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},me(t,e)}var de=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),he(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"}}])&&ye(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function ge(t){return ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(t)}function we(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"!=ge(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ge(e)?e:String(e)}function je(t,e,r){return e=_e(e),function(t,e){if(e&&("object"===ge(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Se()?Reflect.construct(e,r||[],_e(t).constructor):e.apply(t,r))}function Se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Se=function(){return!!t})()}function _e(t){return _e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_e(t)}function Pe(t,e){return Pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pe(t,e)}var Ee=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),je(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&we(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function ke(t){return ke="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},ke(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,Te(n.key),n)}}function Te(t){var e=function(t,e){if("object"!=ke(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ke(e)?e:String(e)}function Le(t,e,r){return e=Ae(e),function(t,e){if(e&&("object"===ke(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,Ce()?Reflect.construct(e,r||[],Ae(t).constructor):e.apply(t,r))}function Ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ce=function(){return!!t})()}function Ae(t){return Ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ae(t)}function Re(t,e){return Re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Re(t,e)}var Ie=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Le(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Re(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&xe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function Ne(t){return Ne="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},Ne(t)}function De(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Be(n.key),n)}}function Be(t){var e=function(t,e){if("object"!=Ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ne(e)?e:String(e)}function Me(t,e,r){return e=Ge(e),function(t,e){if(e&&("object"===Ne(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||[],Ge(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 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 Ve=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Me(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"}}])&&De(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 We(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 He(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,Ke()?Reflect.construct(e,r||[],$e(t).constructor):e.apply(t,r))}function Ke(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ke=function(){return!!t})()}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}function qe(t,e){return qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qe(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),He(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&&qe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&We(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Xe(t){return Xe="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},Xe(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,ir(n.key),n)}}function ze(t,e,r){return e=er(e),function(t,e){if(e&&("object"===Xe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return rr(t)}(t,tr()?Reflect.construct(e,r||[],er(t).constructor):e.apply(t,r))}function tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(tr=function(){return!!t})()}function er(t){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},er(t)}function rr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nr(t,e){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nr(t,e)}function or(t,e,r){return(e=ir(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ir(t){var e=function(t,e){if("object"!=Xe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xe(e)?e:String(e)}var ur=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),or(rr(n=ze(this,e)),"allocation1",void 0),or(rr(n),"allocation2",void 0),or(rr(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&&nr(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("TRANSFORMS"),o}}])&&Ze(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);const ar={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let cr;const fr=new Uint8Array(16);function lr(){if(!cr&&(cr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cr(fr)}const sr=[];for(let t=0;t<256;++t)sr.push((t+256).toString(16).slice(1));const yr=function(t,e,r){if(ar.randomUUID&&!e&&!t)return ar.randomUUID();const n=(t=t||{}).random||(t.rng||lr)();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 sr[t[e+0]]+sr[t[e+1]]+sr[t[e+2]]+sr[t[e+3]]+"-"+sr[t[e+4]]+sr[t[e+5]]+"-"+sr[t[e+6]]+sr[t[e+7]]+"-"+sr[t[e+8]]+sr[t[e+9]]+"-"+sr[t[e+10]]+sr[t[e+11]]+sr[t[e+12]]+sr[t[e+13]]+sr[t[e+14]]+sr[t[e+15]]}(n)};function pr(t){return pr="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},pr(t)}function hr(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 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 dr(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,Er(n.key),n)}}function gr(t,e,r){return e&&dr(t.prototype,e),r&&dr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function wr(t,e,r){return e=jr(e),function(t,e){if(e&&("object"===pr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Sr(t)}(t,Or()?Reflect.construct(e,r||[],jr(t).constructor):e.apply(t,r))}function Or(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Or=function(){return!!t})()}function jr(t){return jr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jr(t)}function Sr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _r(t,e){return _r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_r(t,e)}function Pr(t,e,r){return(e=Er(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t){var e=function(t,e){if("object"!=pr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pr(e)?e:String(e)}var kr=function(t){function e(t){var r;return mr(this,e),Pr(Sr(r=wr(this,e)),"_active",!1),Pr(Sr(r),"_disposed",!1),Pr(Sr(r),"id",yr()),Pr(Sr(r),"transform",void 0),Pr(Sr(r),"effectGroup",void 0),Pr(Sr(r),"layers",[]),r.effectGroup=t,r.group.addEffect(Sr(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&&_r(t,e)}(e,t),gr(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=hr(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 br(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||vr(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=hr(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=hr(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),xr=function(){function t(){mr(this,t),Pr(this,"effects",new Map)}return gr(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 Tr(t){return Tr="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},Tr(t)}function Lr(t,e,r){return e=Ar(e),function(t,e){if(e&&("object"===Tr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Rr(t)}(t,Cr()?Reflect.construct(e,r||[],Ar(t).constructor):e.apply(t,r))}function Cr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Cr=function(){return!!t})()}function Ar(t){return Ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ar(t)}function Rr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ir(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&&Nr(t,e)}function Nr(t,e){return Nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nr(t,e)}function Dr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Br(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 Br(t,e){if(t){if("string"==typeof t)return Mr(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)?Mr(t,e):void 0}}function Mr(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 Ur(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 Vr(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"!=Tr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tr(e)?e:String(e)}var Wr=function(){function t(e,r){Ur(this,t),Vr(this,"effects",[]),Vr(this,"name",void 0),Vr(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=Dr(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 Ur(this,e),Vr(Rr(n=Lr(this,e,[t])),"layers",new Map),Vr(Rr(n),"groups",[]),Vr(Rr(n),"lastOrder",[]),Vr(Rr(n),"currentOrder",[]),Vr(Rr(n),"executor",void 0),Vr(Rr(n),"needExecute",!1),n.executor=r,n}return Ir(e,t),Fr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Wr(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:yr();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 Hr(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=Dr(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(re.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 ur(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=Dr(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 Mr(t)}(d=b.updatePositions())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(d)||Br(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),Hr=function(t){function e(t){var r;return Ur(this,e),Vr(Rr(r=Lr(this,e,[t])),"id",void 0),Vr(Rr(r),"effect",void 0),r.id=yr(),r}return Ir(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 Kr(t){return Kr="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},Kr(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 qr(){qr=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"==Kr(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(Kr(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 Xr(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 Zr(t){return function(t){if(Array.isArray(t))return tn(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 tn(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)?tn(t,e):void 0}}function tn(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){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,sn(n.key),n)}}function rn(t,e,r){return e&&en(t.prototype,e),r&&en(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function nn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function on(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function un(t){var e="function"==typeof Map?new Map:void 0;return un=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(an())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&cn(o,r.prototype),o}(t,arguments,fn(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),cn(r,t)},un(t)}function an(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(an=function(){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){return fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fn(t)}function ln(t,e,r){return(e=sn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sn(t){var e=function(t,e){if("object"!=Kr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Kr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kr(e)?e:String(e)}var yn=function(t){function e(t,r){var n,o,i,u;return nn(this,e),ln(on((o=this,i=e,u=[[r].concat(Zr(t)).join("\n")],i=fn(i),n=function(t,e){if(e&&("object"===Kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return on(t)}(o,an()?Reflect.construct(i,u||[],fn(o).constructor):i.apply(o,u)))),"data",void 0),ln(on(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&&cn(t,e)}(e,t),rn(e)}(un(Error)),pn=function(){function t(){nn(this,t),ln(this,"templates",[]),ln(this,"lastFetch",0),ln(this,"fetchPromise",null),ln(this,"channels",new Map),ln(this,"listeners",[]),ln(this,"effects",new Map)}var e,r;return rn(t,[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(r=Xr(qr().mark((function t(){return qr().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=Xr(qr().mark((function t(){var e=arguments;return qr().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 yn(["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 yn(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(Zr(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 hn(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function vn(t){return vn="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},vn(t)}function bn(){bn=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"==vn(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(vn(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 mn(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 dn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Pn(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 gn(t,e,r){return e=On(e),function(t,e){if(e&&("object"===vn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jn(t)}(t,wn()?Reflect.construct(e,r||[],On(t).constructor):e.apply(t,r))}function wn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wn=function(){return!!t})()}function On(t){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(t)}function jn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Sn(t,e){return Sn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sn(t,e)}function _n(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)||Pn(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 Pn(t,e){if(t){if("string"==typeof t)return En(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)?En(t,e):void 0}}function En(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 kn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xn(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,Cn(n.key),n)}}function Tn(t,e,r){return e&&xn(t.prototype,e),r&&xn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ln(t,e,r){return(e=Cn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cn(t){var e=function(t,e){if("object"!=vn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vn(e)?e:String(e)}var An=function(){function t(){kn(this,t),Ln(this,"_api",void 0),Ln(this,"_enabled",!1),Ln(this,"logger",void 0)}return Tn(t,[{key:"pluginName",get:function(){return this.constructor.pluginName}},{key:"enable",value:function(t){var e=this;if(!this._enabled){this._enabled=!0;var r=_n(hn((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=_n(hn((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}(),Rn=function(t){function e(t,r){var n;return kn(this,e),Ln(jn(n=gn(this,e)),"files",[]),Ln(jn(n),"uiInjections",[]),Ln(jn(n),"_manager",void 0),Ln(jn(n),"_plugin",void 0),Ln(jn(n),"_effects",[]),Ln(jn(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=jn(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&&Sn(t,e)}(e,t),Tn(e,[{key:"onReconnect",value:function(t){this._manager.on("caspar-reconnect",t)}},{key:"offReconnect",value:function(t){this._manager.off("caspar-reconnect",t)}},{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=dn(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=dn(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=bn().mark((function t(){var e,r,n;return bn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=dn(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){mn(i,n,o,u,a,"next",t)}function a(t){mn(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=dn(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:"broadcast",value:function(t,e,r,n){this._manager.server.broadcast("plugin/".concat(this._plugin.pluginName,"/").concat(t),e,r,n)}},{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)}},{key:"setVideoRouteEnabled",value:function(t,e){var r,n=null!=e?e:null===(r=this._manager.routes.getVideoRoute(t))||void 0===r?void 0:r.enabled;this._manager.routes.setVideoRouteEnabled(t,n)}}]),e}(o.EventEmitter);function In(t){return In="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},In(t)}function Nn(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,Bn(n.key),n)}}function Dn(t,e,r){return(e=Bn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Bn(t){var e=function(t,e){if("object"!=In(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==In(e)?e:String(e)}var Mn=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Dn(this,"source",void 0),Dn(this,"destination",void 0),Dn(this,"fillTransition",null),Dn(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(e,r){var n;r=null!==(n=r)&&void 0!==n?n:t.normalRect();var o=(e.end.x-e.start.x)/(r.end.x-r.start.x),i=(e.end.y-e.start.y)/(r.end.y-r.start.y);return{x:e.start.x-r.start.x*o,y:e.start.y-r.start.y*i,x_scale:o,y_scale:i}}},{key:"getClip",value:function(t){return{x:t.start.x,y:t.start.y,width:t.end.x-t.start.x,height:t.end.y-t.start.y}}},{key:"getCommand",value:function(){var t=re.create().fill(this.getFill(this.destination,this.source),this.fillTransition),e=!1;return(this.source.start.x>0||this.source.start.y>0)&&(e=!0),(this.source.end.x<1||this.source.end.y<1)&&(e=!0),e?t.clip(this.getClip(this.destination),this.cropTransition):t}}])&&Nn(e.prototype,r),n&&Nn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
package/dist/plugin.d.ts CHANGED
@@ -24,6 +24,8 @@ export declare class PluginAPI extends EventEmitter {
24
24
  private readonly _manager;
25
25
  private readonly _plugin;
26
26
  constructor(_manager: CasparManager, _plugin: CasparPlugin);
27
+ onReconnect(handler: () => void): void;
28
+ offReconnect(handler: () => void): void;
27
29
  private _effects;
28
30
  private routes;
29
31
  registerEffect(name: string, effect: EffectConstructor): void;
package/package.json CHANGED
@@ -3,7 +3,7 @@
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.28",
6
+ "version": "0.0.30",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "devDependencies": {