@lappis/cg-manager 0.0.2 → 0.0.4
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/commands.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/plugin.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/manager.d.ts +3 -0
- package/package.json +1 -1
package/dist/commands.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ export { CallCommand } from './commands/call';
|
|
|
3
3
|
export { CgCommand } from './commands/cg';
|
|
4
4
|
export { ClearCommand } from './commands/clear';
|
|
5
5
|
export { LoadCommand } from './commands/load';
|
|
6
|
-
export { LoadBGCommand } from './commands/loadbg';
|
|
6
|
+
export { LoadBGCommand, PlayoutOptions } from './commands/loadbg';
|
|
7
7
|
export { MixerCommand } from './commands/mixer';
|
|
8
8
|
export { PauseCommand } from './commands/pause';
|
|
9
9
|
export { PlayCommand } from './commands/play';
|
|
10
10
|
export { PrintCommand } from './commands/print';
|
|
11
11
|
export { RemoveCommand } from './commands/remove';
|
|
12
|
+
export { ResumeCommand } from './commands/resume';
|
|
12
13
|
export { StopCommand } from './commands/stop';
|
|
13
14
|
export { SwapCommand } from './commands/swap';
|
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:()=>J,BasicChannel:()=>l,BasicCommand:()=>L,BasicLayer:()=>s,CallCommand:()=>z,CasparPlugin:()=>nn,CgCommand:()=>at,Channel:()=>Er,ClearCommand:()=>vt,Command:()=>x,CommandExecutor:()=>Mr,CommandGroup:()=>R,Effect:()=>lr,EffectGroup:()=>Pr,EffectRegistry:()=>sr,Layer:()=>kr,LayeredCommand:()=>T,LoadBGCommand:()=>Lt,LoadCommand:()=>Bt,LogLevel:()=>e,MixerCommand:()=>Qt,PauseCommand:()=>ue,PlayCommand:()=>he,PluginAPI:()=>on,PrintCommand:()=>je,RawCommand:()=>I,RemoveCommand:()=>Te,SimpleArgsCommand:()=>A,SimpleCommand:()=>C,StopCommand:()=>Me,SwapCommand:()=>Ke,Transform:()=>ln});var t=r(7),e=function(t){return t.INFO="INFO",t.WARN="WARN",t.DEBUG="DEBUG",t.ERROR="ERROR",t.FATAL="FATAL",t.NONE="NONE",t}({});function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}function a(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t,e,r){return(e=f(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:String(e)}var l=function(){function t(e){i(this,t),c(this,"casparChannel",void 0),this.casparChannel=e}return a(t,[{key:"getCasparChannel",value:function(){return this.casparChannel}},{key:"getCommandString",value:function(){return this.getCasparChannel().toString()}}]),t}(),s=function(){function t(e){i(this,t),c(this,"channel",void 0),c(this,"casparLayer",void 0),this.setChannel(e)}return a(t,[{key:"setChannel",value:function(t){this.channel=t}},{key:"setCasparLayer",value:function(t){this.casparLayer=t,this.onMove()}},{key:"onMove",value:function(){}},{key:"getCasparLayer",value:function(){return this.casparLayer}},{key:"getCasparChannel",value:function(){var t;return null===(t=this.channel)||void 0===t?void 0:t.getCasparChannel()}},{key:"getCommandString",value:function(){var t=this.getCasparChannel(),e=this.getCasparLayer();if(void 0!==e&&void 0!==t)return"".concat(t,"-").concat(e)}}],[{key:"caspar",value:function(e,r){return t.from(e,r)}},{key:"from",value:function(e,r){if(e instanceof t)return e;if("number"==typeof e&&(e=new l(e)),"number"!=typeof r)return e;var n=new t(e);return n.setCasparLayer(r),n}}]),t}();function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=O(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},p.apply(this,arguments)}function h(t,e,r){return(e=E(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e,r){return e=O(e),function(t,e){if(e&&("object"===y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return g(t)}(t,w()?Reflect.construct(e,r||[],O(t).constructor):e.apply(t,r))}function g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function w(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(w=function(){return!!t})()}function O(t){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},O(t)}function j(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&S(t,e)}function S(t,e){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},S(t,e)}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,E(n.key),n)}}function P(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function E(t){var e=function(t,e){if("object"!=y(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==y(e)?e:String(e)}function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var x=P((function t(){k(this,t)})),L=function(){function t(){k(this,t)}return P(t,[{key:"compileArgs",value:function(){return this.getArguments().map((function(t){return t.startsWith('"')?t.indexOf(" ")>-1?t:'"'.concat(t,'"'):JSON.stringify(t)})).map((function(t){return t.indexOf(" ")>-1?t:t.substring(1,t.length-1)})).join(" ")}},{key:"getCommand",value:function(){var t=this.getCommandType();if(t){var e=this.compileArgs();return e?"".concat(t," ").concat(e,"\r\n"):"".concat(t,"\r\n")}}}],[{key:"create",value:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new(function(t){function r(){return k(this,r),d(this,r,arguments)}return j(r,t),P(r,[{key:"getCommandType",value:function(){return e}},{key:"getArguments",value:function(){return n}},{key:"getCmd",value:function(){return this.getCommandType()}},{key:"getArgs",value:function(){return this.getArguments()}}]),r}(t))}},{key:"from",value:function(t){if(t.endsWith("\r\n")&&(t=t.slice(0,-2)),t.indexOf("\r\n")>-1)throw new Error("Command cannot contain line breaks");for(var e=t.split(" "),r=e[0],n=e.slice(1),o=-1,i=0;i<n.length;i++){var u=n[i];if(o<0&&u.startsWith('"')&&(o=i),o>-1){if(!u.endsWith('"'))continue;for(var a=!1,c=u.length-2;c>=0&&"\\"===u[c];c--)a=!a;if(a)continue;for(var f=[],l=o;l<=i;l++)f.push(n[l]);n.splice(o,i-o+1,JSON.parse(f.join(" "))),o=-1}}if(o>-1)throw new Error("Command contains unclosed quotes");return this.create.apply(this,[r].concat(v(n)))}},{key:"interpret",value:function(t){var e=this;return t.split("\r\n").filter((function(t){return t.length>0})).map((function(t){return e.from(t)}))}}]),t}(),T=function(t){function e(t){var r;return k(this,e),h(g(r=d(this,e)),"allocation",void 0),t&&r.allocate(t),r}return j(e,t),P(e,[{key:"allocate",value:function(t,e){return this.allocation=s.from(t,e),this}},{key:"isChannel",value:function(){return this.allocation instanceof l}},{key:"isLayer",value:function(){return this.allocation instanceof s}},{key:"getPosition",value:function(){var t;return null===(t=this.allocation)||void 0===t?void 0:t.getCommandString()}}]),e}(L),C=function(t){function e(){return k(this,e),d(this,e,arguments)}return j(e,t),P(e,[{key:"getArguments",value:function(){var t=this.getPosition();return t?[t]:[]}}]),e}(T),A=function(t){function e(){var t;k(this,e),h(g(t=d(this,e)),"args",void 0);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.args=n,t}return j(e,t),P(e,[{key:"setArgs",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.args=e,this}},{key:"getArguments",value:function(){return[].concat(v(p(O(e.prototype),"getArguments",this).call(this)),v(this.args))}}]),e}(C),R=function(t){function e(t){var r;return k(this,e),h(g(r=d(this,e)),"commands",void 0),h(g(r),"allocation",void 0),r.commands=t,r}return j(e,t),P(e,[{key:"allocate",value:function(t,e){this.allocation=s.from(t,e);var r,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=m(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;o instanceof T&&o.allocate(this.allocation)}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"getCommand",value:function(){return this.commands.map((function(t){return t.getCommand()})).join("")}}]),e}(x),I=function(t){function e(t){var r;return k(this,e),h(g(r=d(this,e)),"command",void 0),r.command=t,r}return j(e,t),P(e,[{key:"getCommand",value:function(){return this.command}}]),e}(x);function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function D(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,B(n.key),n)}}function B(t){var e=function(t,e){if("object"!=N(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:String(e)}function M(t,e,r){return e=U(e),function(t,e){if(e&&("object"===N(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,G()?Reflect.construct(e,r||[],U(t).constructor):e.apply(t,r))}function G(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(G=function(){return!!t})()}function U(t){return U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},U(t)}function F(t,e){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},F(t,e)}var J=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),M(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&F(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&D(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function Y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,q(n.key),n)}}function W(t,e,r){return e=$(e),function(t,e){if(e&&("object"===V(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return K(t)}(t,H()?Reflect.construct(e,r||[],$(t).constructor):e.apply(t,r))}function H(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(H=function(){return!!t})()}function $(t){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$(t)}function K(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function X(t,e){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},X(t,e)}function q(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==V(e)?e:String(e)}var z=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=K(r=W(this,e)),i=void 0,(o=q(o="method"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.method=t,r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&X(t,e)}(e,t),r=e,o=[{key:"call",value:function(t){return new e(t)}}],(n=[{key:"setMethod",value:function(t){return this.method=t,this}},{key:"getCommandType",value:function(){return"CALL"}},{key:"getArguments",value:function(){return[this.method]}}])&&Y(r.prototype,n),o&&Y(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(T);function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function Z(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ut(n.key),n)}}function tt(t,e,r){return e=rt(e),function(t,e){if(e&&("object"===Q(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return nt(t)}(t,et()?Reflect.construct(e,r||[],rt(t).constructor):e.apply(t,r))}function et(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(et=function(){return!!t})()}function rt(t){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rt(t)}function nt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ot(t,e){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ot(t,e)}function it(t,e,r){return(e=ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ut(t){var e=function(t,e){if("object"!=Q(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Q(e)?e:String(e)}var at=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),it(nt(t=tt(this,e)),"cmd",void 0),it(nt(t),"cgLayer",void 0),it(nt(t),"arguments",[]),t}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ot(t,e)}(e,t),r=e,o=[{key:"single",value:function(t){var r=new e;return r.cmd=t,r}},{key:"add",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,o=e.single("ADD");return o.arguments.push(t),o.arguments.push(r?"1":"0"),n&&o.arguments.push(JSON.stringify(n)),o}},{key:"play",value:function(){return e.single("PLAY")}},{key:"stop",value:function(){return e.single("STOP")}},{key:"next",value:function(){return e.single("NEXT")}},{key:"remove",value:function(){return e.single("REMOVE")}},{key:"clear",value:function(){return e.single("CLEAR")}},{key:"update",value:function(t){var r=e.single("UPDATE");return r.arguments.push(JSON.stringify(t)),r}},{key:"invoke",value:function(t){var r=e.single("INVOKE");return r.arguments.push(t),r}},{key:"info",value:function(){return e.single("INFO")}}],(n=[{key:"setLayer",value:function(t){return this.cgLayer=t,this}},{key:"getCommandType",value:function(){return"CG"}},{key:"getArguments",value:function(){var t=this.arguments.slice();void 0!==this.cgLayer?t.unshift(this.cgLayer.toString()):"CLEAR"!==this.cmd&&t.unshift("0"),t.unshift(this.cmd);var e=this.getPosition();return e&&t.unshift(e),t}}])&&Z(r.prototype,n),o&&Z(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(T);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ft(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,lt(n.key),n)}}function lt(t){var e=function(t,e){if("object"!=ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ct(e)?e:String(e)}function st(t,e,r){return e=pt(e),function(t,e){if(e&&("object"===ct(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yt()?Reflect.construct(e,r||[],pt(t).constructor):e.apply(t,r))}function yt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yt=function(){return!!t})()}function pt(t){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pt(t)}function ht(t,e){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ht(t,e)}var vt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),st(this,e,arguments)}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ht(t,e)}(e,t),r=e,o=[{key:"all",value:function(){return new I("CLEAR ALL")}}],(n=[{key:"getCommandType",value:function(){return"CLEAR"}}])&&ft(r.prototype,n),o&&ft(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function bt(t){return function(t){if(Array.isArray(t))return dt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return dt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function gt(t,e,r){return e=Ot(e),function(t,e){if(e&&("object"===mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jt(t)}(t,wt()?Reflect.construct(e,r||[],Ot(t).constructor):e.apply(t,r))}function wt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wt=function(){return!!t})()}function Ot(t){return Ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ot(t)}function jt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function St(t,e){return St=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},St(t,e)}function _t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kt(n.key),n)}}function Et(t,e,r){return e&&Pt(t.prototype,e),r&&Pt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function kt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mt(e)?e:String(e)}var xt=function(){function t(){_t(this,t)}return Et(t,null,[{key:"getVideoArguments",value:function(t){var e,r=[];return(t=t||{}).transition&&(r.push(t.transition),r.push((null!==(e=t.duration)&&void 0!==e?e:0).toString()),t.tween&&r.push(t.tween),t.direction&&r.push(t.direction)),t.seek&&r.push("SEEK",t.seek.toString()),t.length&&r.push("LENGTH",t.length.toString()),t.filter&&r.push("FILTER",t.filter),t.loop&&r.push("LOOP"),t.auto&&r.push("AUTO"),r}}]),t}(),Lt=function(t){function e(){var t,r,n,o;return _t(this,e),r=jt(t=gt(this,e)),o=void 0,(n=kt(n="arguments"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t.arguments=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&St(t,e)}(e,t),Et(e,[{key:"getCommandType",value:function(){return"LOADBG"}},{key:"getArguments",value:function(){var t=this.getPosition();return t?[t].concat(bt(this.arguments)):[]}},{key:"setArguments",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.arguments=e,this}}],[{key:"video",value:function(t,e){var r;return(r=new this).setArguments.apply(r,[t].concat(bt(xt.getVideoArguments(e))))}},{key:"route",value:function(t){return(new this).setArguments("route://".concat(t.getCommandString()))}},{key:"color",value:function(t){return(new this).setArguments(t)}}]),e}(T);function Tt(t){return Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tt(t)}function Ct(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,At(n.key),n)}}function At(t){var e=function(t,e){if("object"!=Tt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tt(e)?e:String(e)}function Rt(t,e,r){return e=Nt(e),function(t,e){if(e&&("object"===Tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,It()?Reflect.construct(e,r||[],Nt(t).constructor):e.apply(t,r))}function It(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(It=function(){return!!t})()}function Nt(t){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(t)}function Dt(t,e){return Dt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Dt(t,e)}var Bt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Rt(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dt(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"LOAD"}}])&&Ct(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(Lt);function Mt(t){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mt(t)}function Gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ft(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qt(n.key),n)}}function Jt(t,e,r){return e&&Ft(t.prototype,e),r&&Ft(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vt(t,e,r){return e=Wt(e),function(t,e){if(e&&("object"===Mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ht(t)}(t,Yt()?Reflect.construct(e,r||[],Wt(t).constructor):e.apply(t,r))}function Yt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yt=function(){return!!t})()}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}function Ht(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kt(t,e)}function Kt(t,e){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kt(t,e)}function Xt(t,e,r){return(e=qt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qt(t){var e=function(t,e){if("object"!=Mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mt(e)?e:String(e)}var zt=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ut(this,e),Xt(Ht(r=Vt(this,e)),"command",void 0),Xt(Ht(r),"args",void 0),r.command=t,r.args=n,r}return $t(e,t),Jt(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(function(t){if(Array.isArray(t))return Gt(t)}(t=this.args)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Gt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var t}}]),e}(T),Qt=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Ut(this,e),t=Vt(this,e,[[]]),r&&t.commands.push(new zt("CLEAR")),t}return $t(e,t),Jt(e,[{key:"single",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;r&&("number"==typeof r?e.push(r.toString()):e.push(r.duration.toString())),"number"!=typeof r&&null!=r&&r.type&&e.push(r.type);var n=new zt(t,e);return this.commands.push(n),this}},{key:"keyer",value:function(t){return this.single("KEYER",[t.toString()])}},{key:"chroma",value:function(t,e){if(!t.enabled)return this.single("CHROMA",["0"]);var r=[1,t.target_hue,t.hue_width,t.min_saturation,t.min_brightness,t.softness,t.spill_suppress,t.spill_suppress_saturation,t.show_mask?1:0];return this.single("CHROMA",r.map((function(t){return t.toString()})),e)}},{key:"blend",value:function(t){return this.single("BLEND",[t])}},{key:"invert",value:function(t){return this.single("INVERT",[t?"1":"0"])}},{key:"opacity",value:function(t,e){var r=[t];return this.single("OPACITY",r.map((function(t){return t.toString()})),e)}},{key:"brightness",value:function(t,e){var r=[t];return this.single("BRIGHTNESS",r.map((function(t){return t.toString()})),e)}},{key:"saturation",value:function(t,e){var r=[t];return this.single("SATURATION",r.map((function(t){return t.toString()})),e)}},{key:"contrast",value:function(t,e){var r=[t];return this.single("CONTRAST",r.map((function(t){return t.toString()})),e)}},{key:"levels",value:function(t,e){var r=[t.min_input,t.max_input,t.gamma,t.min_output,t.max_output];return this.single("LEVELS",r.map((function(t){return t.toString()})),e)}},{key:"fill",value:function(t,e){var r=[t.x,t.y,t.x_scale,t.y_scale];return this.single("FILL",r.map((function(t){return t.toString()})),e)}},{key:"clip",value:function(t,e){var r=[t.x,t.y,t.width,t.height];return this.single("CLIP",r.map((function(t){return t.toString()})),e)}},{key:"anchor",value:function(t,e){var r=[t.x,t.y];return this.single("ANCHOR",r.map((function(t){return t.toString()})),e)}},{key:"crop",value:function(t,e){var r=[t.left_edge,t.top_edge,t.right_edge,t.bottom_edge];return this.single("CROP",r.map((function(t){return t.toString()})),e)}},{key:"rotation",value:function(t,e){var r=[t];return this.single("ROTATION",r.map((function(t){return t.toString()})),e)}},{key:"perspective",value:function(t,e){var r=[t.top_left.x,t.top_left.y,t.top_right.x,t.top_right.y,t.bottom_right.x,t.bottom_right.y,t.bottom_left.x,t.bottom_left.y];return this.single("PERSPECTIVE",r.map((function(t){return t.toString()})),e)}},{key:"mipmap",value:function(t){return this.single("MIPMAP",[t?"1":"0"])}},{key:"volume",value:function(t,e){var r=[t];return this.single("VOLUME",r.map((function(t){return t.toString()})),e)}},{key:"mastervolume",value:function(t){return this.single("MASTERVOLUME",[t.toString()])}},{key:"straightAlphaOutput",value:function(t){return this.single("STRAIGHT_ALPHA_OUTPUT",[t?"1":"0"])}},{key:"clear",value:function(){return this.commands.splice(0,this.commands.length),this}}],[{key:"create",value:function(){return new e}},{key:"clear",value:function(){return new e(!0)}}]),e}(R);function Zt(t){return Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zt(t)}function te(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ee(n.key),n)}}function ee(t){var e=function(t,e){if("object"!=Zt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zt(e)?e:String(e)}function re(t,e,r){return e=oe(e),function(t,e){if(e&&("object"===Zt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ne()?Reflect.construct(e,r||[],oe(t).constructor):e.apply(t,r))}function ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ne=function(){return!!t})()}function oe(t){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},oe(t)}function ie(t,e){return ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ie(t,e)}var ue=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),re(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ie(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PAUSE"}}])&&te(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function ae(t){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ae(t)}function ce(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fe(n.key),n)}}function fe(t){var e=function(t,e){if("object"!=ae(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ae(e)?e:String(e)}function le(t,e,r){return e=ye(e),function(t,e){if(e&&("object"===ae(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,se()?Reflect.construct(e,r||[],ye(t).constructor):e.apply(t,r))}function se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(se=function(){return!!t})()}function ye(t){return ye=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ye(t)}function pe(t,e){return pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pe(t,e)}var he=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),le(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PLAY"}}])&&ce(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(Lt);function ve(t){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(t)}function me(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,be(n.key),n)}}function be(t){var e=function(t,e){if("object"!=ve(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ve(e)?e:String(e)}function de(t,e,r){return e=we(e),function(t,e){if(e&&("object"===ve(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ge()?Reflect.construct(e,r||[],we(t).constructor):e.apply(t,r))}function ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ge=function(){return!!t})()}function we(t){return we=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},we(t)}function Oe(t,e){return Oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oe(t,e)}var je=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),de(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Oe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&me(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function Se(t){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(t)}function _e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pe(n.key),n)}}function Pe(t){var e=function(t,e){if("object"!=Se(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Se(e)?e:String(e)}function Ee(t,e,r){return e=xe(e),function(t,e){if(e&&("object"===Se(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ke()?Reflect.construct(e,r||[],xe(t).constructor):e.apply(t,r))}function ke(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ke=function(){return!!t})()}function xe(t){return xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xe(t)}function Le(t,e){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Le(t,e)}var Te=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ee(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Le(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&_e(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);function Ce(t){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ce(t)}function Ae(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Re(n.key),n)}}function Re(t){var e=function(t,e){if("object"!=Ce(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ce(e)?e:String(e)}function Ie(t,e,r){return e=De(e),function(t,e){if(e&&("object"===Ce(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ne()?Reflect.construct(e,r||[],De(t).constructor):e.apply(t,r))}function Ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ne=function(){return!!t})()}function De(t){return De=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},De(t)}function Be(t,e){return Be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Be(t,e)}var Me=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ie(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Be(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&Ae(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(C);function Ge(t){return Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(t)}function Ue(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$e(n.key),n)}}function Fe(t,e,r){return e=Ve(e),function(t,e){if(e&&("object"===Ge(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ye(t)}(t,Je()?Reflect.construct(e,r||[],Ve(t).constructor):e.apply(t,r))}function Je(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Je=function(){return!!t})()}function Ve(t){return Ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ve(t)}function Ye(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function We(t,e){return We=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},We(t,e)}function He(t,e,r){return(e=$e(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $e(t){var e=function(t,e){if("object"!=Ge(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ge(e)?e:String(e)}var Ke=function(t){function e(t,r){var n,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),He(Ye(n=Fe(this,e)),"allocation1",void 0),He(Ye(n),"allocation2",void 0),He(Ye(n),"transforms",void 0),t&&n.allocate1(t),r&&n.allocate2(r),n.transforms=o,n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&We(t,e)}(e,t),r=e,(n=[{key:"allocate1",value:function(t,e){return this.allocation1=s.from(t,e),this}},{key:"allocate2",value:function(t,e){return this.allocation2=s.from(t,e),this}},{key:"getCommandType",value:function(){return"SWAP"}},{key:"getArguments",value:function(){var t,e,r=null===(t=this.allocation1)||void 0===t?void 0:t.getCommandString(),n=null===(e=this.allocation2)||void 0===e?void 0:e.getCommandString();if(!r||!n)return[];var o=[r,n];return this.transforms&&o.push("TRANSFORM"),o}}])&&Ue(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(L);const Xe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let qe;const ze=new Uint8Array(16);function Qe(){if(!qe&&(qe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qe(ze)}const Ze=[];for(let t=0;t<256;++t)Ze.push((t+256).toString(16).slice(1));const tr=function(t,e,r){if(Xe.randomUUID&&!e&&!t)return Xe.randomUUID();const n=(t=t||{}).random||(t.rng||Qe)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=n[t];return e}return function(t,e=0){return Ze[t[e+0]]+Ze[t[e+1]]+Ze[t[e+2]]+Ze[t[e+3]]+"-"+Ze[t[e+4]]+Ze[t[e+5]]+"-"+Ze[t[e+6]]+Ze[t[e+7]]+"-"+Ze[t[e+8]]+Ze[t[e+9]]+"-"+Ze[t[e+10]]+Ze[t[e+11]]+Ze[t[e+12]]+Ze[t[e+13]]+Ze[t[e+14]]+Ze[t[e+15]]}(n)};function er(t){return er="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(t)}function rr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=nr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function nr(t,e){if(t){if("string"==typeof t)return or(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?or(t,e):void 0}}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ir(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ur(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fr(n.key),n)}}function ar(t,e,r){return e&&ur(t.prototype,e),r&&ur(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cr(t,e,r){return(e=fr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fr(t){var e=function(t,e){if("object"!=er(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=er(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==er(e)?e:String(e)}var lr=function(){function t(e){ir(this,t),cr(this,"_active",!1),cr(this,"_disposed",!1),cr(this,"id",tr()),cr(this,"transform",void 0),cr(this,"effectGroup",void 0),cr(this,"layers",[]),this.effectGroup=e,this.group.addEffect(this)}return ar(t,[{key:"active",get:function(){return this._active}},{key:"getTransform",value:function(){return this.transform}},{key:"setTransform",value:function(t){this.transform=t,this.applyTransform()}},{key:"applyTransform",value:function(){if(this.active&&this.transform){var t,e=rr(this.layers);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.executor.execute(this.transform.getCommand().allocate(r))}}catch(t){e.e(t)}finally{e.f()}}}},{key:"group",get:function(){return this.effectGroup}},{key:"executor",get:function(){return this.group.channel.executor}},{key:"activate",value:function(){return!this._disposed&&!this.active&&(this._active=!0,this.executor.executeAllocations(),this.applyTransform(),!0)}},{key:"deactivate",value:function(){return!!this.active&&(this._active=!1,!0)}},{key:"dispose",value:function(){this._disposed||(this._disposed=!0,this.deactivate(),this.deallocateLayers(this.layers),this.executor.executeAllocations(),this.group.removeEffect(this),this.effectGroup=null,this.transform=null)}},{key:"getLayers",value:function(){return this.layers}},{key:"allocateLayers",value:function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=this.group.getEffectIndex(this),o=this.group.channel.allocateLayers({count:r,index:n});(t=this.layers).push.apply(t,function(t){if(Array.isArray(t))return or(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||nr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var i,u=rr(o);try{for(u.s();!(i=u.n()).done;)i.value.setEffect(this)}catch(t){u.e(t)}finally{u.f()}return o}},{key:"deallocateLayers",value:function(t){var e,r=rr(t=t.slice());try{for(r.s();!(e=r.n()).done;){var n=e.value;n.setEffect(null);var o=this.layers.indexOf(n);o>=0&&this.layers.splice(o,1)}}catch(t){r.e(t)}finally{r.f()}this.group.channel.deallocateLayers(t)}},{key:"updatePositions",value:function(){}},{key:"getName",value:function(){return this.constructor.name}},{key:"getMetadata",value:function(){return{}}},{key:"toJSON",value:function(){return{id:this.id,type:this.getName(),active:this.active,metadata:this.getMetadata(),layers:this.layers.map((function(t){return t.toJSON()}))}}}]),t}(),sr=function(){function t(){ir(this,t),cr(this,"effects",new Map)}return ar(t,[{key:"register",value:function(t,e){this.effects.set(t,e)}},{key:"unregister",value:function(t){this.effects.delete(t)}},{key:"get",value:function(t){return this.effects.get(t)}},{key:"create",value:function(t,e,r){var n=this.get(t);return n?n(e,r):null}}]),t}();function yr(t){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(t)}function pr(t,e,r){return e=vr(e),function(t,e){if(e&&("object"===yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return mr(t)}(t,hr()?Reflect.construct(e,r||[],vr(t).constructor):e.apply(t,r))}function hr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(hr=function(){return!!t})()}function vr(t){return vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vr(t)}function mr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function br(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dr(t,e)}function dr(t,e){return dr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dr(t,e)}function gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Or(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_r(n.key),n)}}function jr(t,e,r){return e&&Or(t.prototype,e),r&&Or(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Sr(t,e,r){return(e=_r(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _r(t){var e=function(t,e){if("object"!=yr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yr(e)?e:String(e)}var Pr=function(){function t(e,r){wr(this,t),Sr(this,"effects",[]),Sr(this,"name",void 0),Sr(this,"channel",void 0),this.name=r,this.channel=e}return jr(t,[{key:"addEffect",value:function(t){this.effects.push(t),this.channel.executor.effects.set(t.id,t)}},{key:"removeEffect",value:function(t){var e=this.effects.indexOf(t);e>=0&&this.effects.splice(e,1),this.channel.executor.effects.delete(t.id)}},{key:"dispose",value:function(){var t,e=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return gr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.effects);try{for(e.s();!(t=e.n()).done;)t.value.dispose()}catch(t){e.e(t)}finally{e.f()}}},{key:"getEffectIndex",value:function(t){var e=this.effects.indexOf(t);if(e<0)throw new Error("Effect not found in group");for(;e>=0;){var r=this.effects[e].getLayers();if(r.length){var n=r[r.length-1];return this.channel.getLayerIndex(n)+1}e--}return this.getStartingIndex()}},{key:"getStartingIndex",value:function(){var t=this.channel.groups.indexOf(this);if(t<0)throw new Error("Effect group not found in channel");if(0===t)return 0;for(;t>0;){t--;var e=this.channel.groups[t];if(!(e.effects.length<1)){for(var r=e.effects,n=r.length-1;n>=0&&!r[n].getLayers().length;)n--;if(!(n<0)){var o=r[n].getLayers(),i=o[o.length-1];return this.channel.getLayerIndex(i)+1}}}return 0}},{key:"toJSON",value:function(){return{name:this.name,effects:this.effects.map((function(t){return t.id}))}}}]),t}(),Er=function(t){function e(t,r){var n;return wr(this,e),Sr(mr(n=pr(this,e,[t])),"layers",new Map),Sr(mr(n),"groups",[]),Sr(mr(n),"lastOrder",[]),Sr(mr(n),"currentOrder",[]),Sr(mr(n),"executor",void 0),Sr(mr(n),"needExecute",!1),n.executor=r,n}return br(e,t),jr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Pr(this,t);return e=e<0?this.groups.length:e,this.groups.splice(e,0,r),r}},{key:"getGroup",value:function(t,e){var r;t=null!==(r=t)&&void 0!==r?r:tr();var n=this.groups.find((function(e){return e.name===t}));return null!=n?n:this.createGroup(t,null!=e?e:-1)}},{key:"setExecutor",value:function(t){this.executor=t}},{key:"getLayer",value:function(t){return this.layers.get(t)}},{key:"getLayers",value:function(){var t=this;return this.currentOrder.map((function(e){return t.layers.get(e)})).filter((function(t){return void 0!==t}))}},{key:"getLayerIndex",value:function(t){return this.currentOrder.indexOf(t.id)}},{key:"allocateLayers",value:function(t){var e,r,n,o,i=null!==(r=(t=null!==(e=t)&&void 0!==e?e:{}).count)&&void 0!==r?r:1;if(i<1)throw new Error("You have to allocate at least 1 layer");for(var u=new Array(i),a=new Array(i),c=0;c<i;c++){var f=new kr(this);this.layers.set(f.id,f),u[c]=f,a[c]=f.id}var l=null!==(n=t.index)&&void 0!==n?n:this.currentOrder.length;(o=this.currentOrder).splice.apply(o,[l,0].concat(a));for(var s=l+1;s<this.currentOrder.length&&i>0;s++)void 0===this.currentOrder[s]&&(this.currentOrder.splice(s,1),i--,s--);return this.needExecute=!0,u}},{key:"allocateLayer",value:function(t){return this.allocateLayers({index:t,count:1})[0]}},{key:"deallocateLayers",value:function(t){for(var e=0;e<t.length;e++){var r=t[e],n=this.currentOrder.indexOf(r.id);this.currentOrder[n]=void 0,this.layers.delete(r.id)}this.needExecute=!0}},{key:"executeAllocation",value:function(){if(this.needExecute){this.needExecute=!1;for(var t=[],e=this.lastOrder.slice(),r=0;r<e.length;r++){var n=e[r];if(void 0!==n&&!(this.currentOrder.indexOf(n)>=0)){e[r]=void 0;var o=s.caspar(this.casparChannel,r+1);t.push(new vt(o)),t.push(Qt.clear().allocate(o))}}for(var i=0;i<this.currentOrder.length;i++){var u=this.currentOrder[i];if(void 0!==u){this.layers.get(u).setCasparLayer(i+1);var a=e.indexOf(u);if(a!==i&&!(a<0)){e[a]=e[i],e[i]=u;var c=s.caspar(this.casparChannel,i+1),f=s.caspar(this.casparChannel,a+1);t.push(new Ke(c,f,!0))}}}this.lastOrder=this.currentOrder,this.currentOrder=this.currentOrder.slice();for(var l=0;l<this.currentOrder.length;l++){var y=this.currentOrder[l];if(void 0!==y){var p=this.layers.get(y);p&&p.setCasparLayer(l+1)}}var h=new R(t);this.executor.execute(h)}}},{key:"toJSON",value:function(){var t=this;return{channel:this.casparChannel,layers:this.currentOrder.filter((function(t){return t})).map((function(e){return t.layers.get(e)})).map((function(t){return t.toJSON()})),groups:this.groups.map((function(t){return t.toJSON()}))}}}]),e}(l),kr=function(t){function e(t){var r;return wr(this,e),Sr(mr(r=pr(this,e,[t])),"id",void 0),Sr(mr(r),"effect",void 0),r.id=tr(),r}return br(e,t),jr(e,[{key:"setEffect",value:function(t){this.effect=t}},{key:"getEffect",value:function(){return this.effect}},{key:"dispose",value:function(){this.channel.deallocateLayers([this])}},{key:"toJSON",value:function(){var t;return{id:this.id,effect:null===(t=this.effect)||void 0===t?void 0:t.id}}}]),e}(s);function xr(t){return xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xr(t)}function Lr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Tr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function Tr(t,e){if(t){if("string"==typeof t)return Cr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Cr(t,e):void 0}}function Cr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ar(){Ar=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new T(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function b(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=b.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==xr(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(xr(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function Rr(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function Ir(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){Rr(i,n,o,u,a,"next",t)}function a(t){Rr(i,n,o,u,a,"throw",t)}u(void 0)}))}}function Nr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Br(n.key),n)}}function Dr(t,e,r){return(e=Br(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Br(t){var e=function(t,e){if("object"!=xr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=xr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xr(e)?e:String(e)}var Mr=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Dr(this,"templates",[]),Dr(this,"lastFetch",0),Dr(this,"fetchPromise",null),Dr(this,"channels",new Map),Dr(this,"listeners",[]),Dr(this,"effects",new Map)}var e,r,n,o;return e=t,r=[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(o=Ir(Ar().mark((function t(){return Ar().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",[]);case 1:case"end":return t.stop()}}),t)}))),function(){return o.apply(this,arguments)})},{key:"fetchTemplates",value:function(){var t=this;return this.fetchPromise||(this.fetchPromise=this._fetchTemplates().then((function(e){return t.fetchPromise=null,t.templates=e}))),this.fetchPromise}},{key:"getTemplates",value:(n=Ir(Ar().mark((function t(){var e=arguments;return Ar().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e.length>0&&void 0!==e[0]&&e[0]||Date.now()-this.lastFetch>3e5)){t.next=5;break}return this.lastFetch=Date.now(),t.next=5,this.fetchTemplates();case 5:return t.abrupt("return",this.templates);case 6:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"resolveTemplates",value:function(){return this.templates}},{key:"promise",value:function(t){var e=this;return new Promise((function(r,n){var o;!function t(){o=setTimeout((function(){if(!e.connected)return t();e.removeListener(i),n({data:["Timeout"],code:-1})}),1e3)}();var i={command:t,success:function(t,e){o&&clearTimeout(o),r({data:t,code:e})},error:function(t,e){o&&clearTimeout(o),n({data:t,code:e})}};e.addListener(i)}))}},{key:"executePassive",value:function(t){var e=t.getCommand();e&&this.send(e)}},{key:"execute",value:function(t){var e=this,r=t.getCommand();if(r){var n=L.interpret(r).map((function(t){return e.promise(t.getCmd())}));return this.send(r),Promise.all(n)}}},{key:"getChannel",value:function(t){return this.channels.get(t)}},{key:"getChannels",value:function(){return Array.from(this.channels.values())}},{key:"allocateChannel",value:function(t){var e=new Er(t,this);return this.channels.set(t,e),e}},{key:"executeAllocations",value:function(){var t,e=Lr(this.channels.values());try{for(e.s();!(t=e.n()).done;)t.value.executeAllocation()}catch(t){e.e(t)}finally{e.f()}}},{key:"send",value:function(t){}},{key:"receive",value:function(t){for(var e=t.split("\r\n"),r=e.pop(),n=0,o=0;o<e.length;o++){var i=e[o].split(" "),u=parseInt(i[0]),a=[];if((101===u||201===u||400===u)&&(o++,a.push(e[o]),o===e.length))break;if(200===u){for(o++;e[o];)a.push(e[o]),o++;if(o===e.length)break}n=o+1;var c=null;400!==u&&500!==u&&(c=i[1]),this.executeListeners(u,c,a),this.onEvent(u,c,a)}return[].concat((f=e.slice(n),function(t){if(Array.isArray(t))return Cr(t)}(f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(f)||Tr(f)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),[r]).join("\r\n");var f}},{key:"addListener",value:function(t){this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},{key:"executeListeners",value:function(t,e,r){if(!(t<200)&&e){var n,o=2===Math.floor(t/100),i=Lr(this.listeners);try{for(i.s();!(n=i.n()).done;){var u=n.value;if(u.command===e){o?u.success(r,t):u.error(r,t),this.removeListener(u);break}}}catch(t){i.e(t)}finally{i.f()}}}},{key:"onEvent",value:function(t,e,r){}},{key:"getEffects",value:function(){return Array.from(this.effects.values())}},{key:"getEffect",value:function(t){return this.effects.get(t)}},{key:"toJSON",value:function(){return{channels:this.getChannels().map((function(t){return t.toJSON()}))}}}],r&&Nr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Gr(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function Ur(t){return Ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(t)}function Fr(){Fr=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new T(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function b(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=b.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==Ur(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Ur(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function Jr(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function Vr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=qr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function Yr(t,e,r){return e=Hr(e),function(t,e){if(e&&("object"===Ur(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return $r(t)}(t,Wr()?Reflect.construct(e,r||[],Hr(t).constructor):e.apply(t,r))}function Wr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wr=function(){return!!t})()}function Hr(t){return Hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hr(t)}function $r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Kr(t,e){return Kr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kr(t,e)}function Xr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||qr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qr(t,e){if(t){if("string"==typeof t)return zr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zr(t,e):void 0}}function zr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Qr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rn(n.key),n)}}function tn(t,e,r){return e&&Zr(t.prototype,e),r&&Zr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function en(t,e,r){return(e=rn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rn(t){var e=function(t,e){if("object"!=Ur(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ur(e)?e:String(e)}var nn=function(){function t(){Qr(this,t),en(this,"_api",void 0),en(this,"_enabled",!1),en(this,"logger",void 0)}return tn(t,[{key:"pluginName",get:function(){return this.constructor.pluginName}},{key:"enable",value:function(t){var e=this;if(!this._enabled){this._enabled=!0;var r=Xr(Gr((function(){return e.onEnable()})),1)[0];if(r)return t.error("Error enabling plugin: ".concat(r)),void(this._enabled=!1);t.debug("Enabled")}}},{key:"disable",value:function(t){var e=this;if(this._enabled){this._enabled=!1,this._api.unregister();var r=Xr(Gr((function(){return e.onDisable()})),1)[0];r?t.error("Error disabling plugin: ".concat(r)):t.debug("Disabled")}}},{key:"onEnable",value:function(){}},{key:"onDisable",value:function(){}},{key:"api",get:function(){return this._api}}],[{key:"pluginName",get:function(){return this.name}}]),t}(),on=function(t){function e(t,r){var n;return Qr(this,e),en($r(n=Yr(this,e)),"files",[]),en($r(n),"uiInjections",[]),en($r(n),"_manager",void 0),en($r(n),"_plugin",void 0),en($r(n),"_effects",[]),en($r(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=$r(n),n._plugin.logger=t.getLogger("Plugin").scope(n._plugin.pluginName),n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kr(t,e)}(e,t),tn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=Vr(this._effects);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.effects.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this._effects=[]}},{key:"unregisterRoutes",value:function(){var t,e=Vr(this.routes);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.server.unregisterRoute(r)}}catch(t){e.e(t)}finally{e.f()}this.routes=[]}},{key:"unregisterFiles",value:(r=Fr().mark((function t(){var e,r,n;return Fr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Vr(this.files),t.prev=1,e.s();case 3:if((r=e.n()).done){t.next=9;break}return n=r.value,t.next=7,this._manager.directory.deleteDirectory(n);case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:this.files=[];case 18:case"end":return t.stop()}}),t,this,[[1,11,14,17]])})),n=function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function u(t){Jr(i,n,o,u,a,"next",t)}function a(t){Jr(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=Vr(this.uiInjections);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.ui.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this.uiInjections=[]}},{key:"unregister",value:function(){return this.unregisterEffects(),this.unregisterRoutes(),this.unregisterUIInjections(),this.unregisterFiles()}},{key:"registerRoute",value:function(t,e,r){var n=this._manager.server.registerRoute("plugin/".concat(this._plugin.pluginName,"/").concat(t),e,r);return this.routes.push(n),n}},{key:"unregisterRoute",value:function(t){var e=this.routes.indexOf(t);e<0||(this.routes.splice(e,1),this._manager.server.unregisterRoute(t))}},{key:"registerFile",value:function(t,e){var r=this;return this._manager.directory.createDirectory(t,e).then((function(t){return r.files.push(t.id),t}))}},{key:"getEffectGroup",value:function(t,e){return this._manager.executor.getEffectGroup(t,e)}},{key:"unregisterFile",value:function(t){var e=this.files.indexOf(t);if(!(e<0))return this.files.splice(e,1),this._manager.directory.deleteDirectory(t)}},{key:"getDirectory",value:function(t){if(this.files.includes(t))return this._manager.directory.getDirectory(t)}},{key:"getDirectories",value:function(){var t=this;return this.files.map((function(e){return t._manager.directory.getDirectory(e)}))}},{key:"registerUI",value:function(t,e){var r=this._manager.ui.register(t,e,this._plugin.pluginName);this.uiInjections.push(r)}},{key:"unregisterUI",value:function(t){var e=this.uiInjections.indexOf(t);e<0||(this.uiInjections.splice(e,1),this._manager.ui.unregister(t))}},{key:"createEffect",value:function(t,e,r){var n=this._manager.executor.getEffectGroup(e);return this._manager.effects.create(t,n,r)}},{key:"getEffect",value:function(t){return this._manager.executor.getEffect(t)}}]),e}(t.EventEmitter);function un(t){return un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},un(t)}function an(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fn(n.key),n)}}function cn(t,e,r){return(e=fn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fn(t){var e=function(t,e){if("object"!=un(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=un(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==un(e)?e:String(e)}var ln=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),cn(this,"source",void 0),cn(this,"destination",void 0),cn(this,"fillTransition",null),cn(this,"cropTransition",null),this.source=e,this.destination=r}var e,r,n;return e=t,n=[{key:"getRect",value:function(t,e,r,n){return{start:{x:t,y:e},end:{x:r,y:n}}}},{key:"normalRect",value:function(){return t.getRect(0,0,1,1)}},{key:"fromArray",value:function(e){return new t(t.getRect(e[0],e[1],e[2],e[3]),t.getRect(e[4],e[5],e[6],e[7]))}}],(r=[{key:"setTween",value:function(t,e){void 0===t&&(t=null),void 0===e&&(e=t),this.fillTransition=t,this.cropTransition=e}},{key:"getFill",value:function(t){return{x:t.start.x,y:t.start.y,x_scale:t.end.x-t.start.x,y_scale:t.end.y-t.start.y}}},{key:"getCrop",value:function(t){return{left_edge:t.start.x,top_edge:t.start.y,right_edge:t.end.x,bottom_edge:t.end.y}}},{key:"getCommand",value:function(){return Qt.create().crop(this.getCrop(this.source),this.cropTransition).fill(this.getFill(this.destination),this.fillTransition)}}])&&an(e.prototype,r),n&&an(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
|
|
2
|
+
(()=>{"use strict";var t={7:t=>{var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,{once:!0})}(t,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var u=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var o,i,u,f;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),u=i[e]),void 0===u)u=i[e]=r,++t._eventsCount;else if("function"==typeof u?u=i[e]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),(o=c(t))>0&&u.length>o&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=u.length,f=l,console&&console.warn&&console.warn(f)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function y(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):h(o,o.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var u;if(e.length>0&&(u=e[0]),u instanceof Error)throw u;var a=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw a.context=u,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)n(c,this,e);else{var f=c.length,l=h(c,f);for(r=0;r<f;++r)n(l[r],this,e)}return!0},i.prototype.addListener=function(t,e){return f(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return f(this,t,e,!0)},i.prototype.once=function(t,e){return a(e),this.on(t,s(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,s(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,o,i,u;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){u=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,u||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return y(this,t,!0)},i.prototype.rawListeners=function(t){return y(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{r.r(n),r.d(n,{AddCommand:()=>W,BasicChannel:()=>p,BasicCommand:()=>A,BasicLayer:()=>h,CallCommand:()=>tt,CasparPlugin:()=>vn,CgCommand:()=>lt,Channel:()=>Br,ClearCommand:()=>dt,Command:()=>C,CommandExecutor:()=>Xr,CommandGroup:()=>D,Effect:()=>Or,EffectGroup:()=>Dr,EffectRegistry:()=>jr,Layer:()=>Mr,LayeredCommand:()=>R,LoadBGCommand:()=>At,LoadCommand:()=>Gt,LogLevel:()=>i,MediaDoc:()=>t.MediaDoc,MixerCommand:()=>ee,PauseCommand:()=>fe,PlayCommand:()=>be,PlayoutOptions:()=>e.PlayoutOptions,PluginAPI:()=>mn,PrintCommand:()=>Pe,RawCommand:()=>B,RemoveCommand:()=>Re,ResumeCommand:()=>Ue,SimpleArgsCommand:()=>N,SimpleCommand:()=>I,StopCommand:()=>Xe,SwapCommand:()=>ir,Transform:()=>On,UI_INJECTION_ZONE:()=>u});var t={};r.r(t);var e={};r.r(e),r.d(e,{RD:()=>At});var o=r(7),i=function(t){return t.INFO="INFO",t.WARN="WARN",t.DEBUG="DEBUG",t.ERROR="ERROR",t.FATAL="FATAL",t.NONE="NONE",t}({}),u={EFFECT_CREATOR:"effect-creator"};function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function l(t,e,r){return e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=y(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:String(e)}var p=function(){function t(e){c(this,t),s(this,"casparChannel",void 0),this.casparChannel=e}return l(t,[{key:"getCasparChannel",value:function(){return this.casparChannel}},{key:"getCommandString",value:function(){return this.getCasparChannel().toString()}}]),t}(),h=function(){function t(e){c(this,t),s(this,"channel",void 0),s(this,"casparLayer",void 0),this.setChannel(e)}return l(t,[{key:"setChannel",value:function(t){this.channel=t}},{key:"setCasparLayer",value:function(t){this.casparLayer=t,this.onMove()}},{key:"onMove",value:function(){}},{key:"getCasparLayer",value:function(){return this.casparLayer}},{key:"getCasparChannel",value:function(){var t;return null===(t=this.channel)||void 0===t?void 0:t.getCasparChannel()}},{key:"getCommandString",value:function(){var t=this.getCasparChannel(),e=this.getCasparLayer();if(void 0!==e&&void 0!==t)return"".concat(t,"-").concat(e)}}],[{key:"caspar",value:function(e,r){return t.from(e,r)}},{key:"from",value:function(e,r){if(e instanceof t)return e;if("number"==typeof e&&(e=new p(e)),"number"!=typeof r)return e;var n=new t(e);return n.setCasparLayer(r),n}}]),t}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},m.apply(this,arguments)}function b(t,e,r){return(e=T(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||g(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){if(t){if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function O(t,e,r){return e=_(e),function(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return j(t)}(t,S()?Reflect.construct(e,r||[],_(t).constructor):e.apply(t,r))}function j(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(S=function(){return!!t})()}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function P(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E(t,e)}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}function k(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,T(n.key),n)}}function x(t,e,r){return e&&k(t.prototype,e),r&&k(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:String(e)}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var C=x((function t(){L(this,t)})),A=function(){function t(){L(this,t)}return x(t,[{key:"compileArgs",value:function(){return this.getArguments().map((function(t){return t.startsWith('"')?t.indexOf(" ")>-1?t:'"'.concat(t,'"'):JSON.stringify(t)})).map((function(t){return t.indexOf(" ")>-1?t:t.substring(1,t.length-1)})).join(" ")}},{key:"getCommand",value:function(){var t=this.getCommandType();if(t){var e=this.compileArgs();return e?"".concat(t," ").concat(e,"\r\n"):"".concat(t,"\r\n")}}}],[{key:"create",value:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new(function(t){function r(){return L(this,r),O(this,r,arguments)}return P(r,t),x(r,[{key:"getCommandType",value:function(){return e}},{key:"getArguments",value:function(){return n}},{key:"getCmd",value:function(){return this.getCommandType()}},{key:"getArgs",value:function(){return this.getArguments()}}]),r}(t))}},{key:"from",value:function(t){if(t.endsWith("\r\n")&&(t=t.slice(0,-2)),t.indexOf("\r\n")>-1)throw new Error("Command cannot contain line breaks");for(var e=t.split(" "),r=e[0],n=e.slice(1),o=-1,i=0;i<n.length;i++){var u=n[i];if(o<0&&u.startsWith('"')&&(o=i),o>-1){if(!u.endsWith('"'))continue;for(var a=!1,c=u.length-2;c>=0&&"\\"===u[c];c--)a=!a;if(a)continue;for(var f=[],l=o;l<=i;l++)f.push(n[l]);n.splice(o,i-o+1,JSON.parse(f.join(" "))),o=-1}}if(o>-1)throw new Error("Command contains unclosed quotes");return this.create.apply(this,[r].concat(d(n)))}},{key:"interpret",value:function(t){var e=this;return t.split("\r\n").filter((function(t){return t.length>0})).map((function(t){return e.from(t)}))}}]),t}(),R=function(t){function e(t){var r;return L(this,e),b(j(r=O(this,e)),"allocation",void 0),t&&r.allocate(t),r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){return this.allocation=h.from(t,e),this}},{key:"isChannel",value:function(){return this.allocation instanceof p}},{key:"isLayer",value:function(){return this.allocation instanceof h}},{key:"getPosition",value:function(){var t;return null===(t=this.allocation)||void 0===t?void 0:t.getCommandString()}}]),e}(A),I=function(t){function e(){return L(this,e),O(this,e,arguments)}return P(e,t),x(e,[{key:"getArguments",value:function(){var t=this.getPosition();return t?[t]:[]}}]),e}(R),N=function(t){function e(){var t;L(this,e),b(j(t=O(this,e)),"args",void 0);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.args=n,t}return P(e,t),x(e,[{key:"setArgs",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.args=e,this}},{key:"getArguments",value:function(){return[].concat(d(m(_(e.prototype),"getArguments",this).call(this)),d(this.args))}}]),e}(I),D=function(t){function e(t){var r;return L(this,e),b(j(r=O(this,e)),"commands",void 0),b(j(r),"allocation",void 0),r.commands=t,r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){this.allocation=h.from(t,e);var r,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=g(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;o instanceof R&&o.allocate(this.allocation)}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"getCommand",value:function(){return this.commands.map((function(t){return t.getCommand()})).join("")}}]),e}(C),B=function(t){function e(t){var r;return L(this,e),b(j(r=O(this,e)),"command",void 0),r.command=t,r}return P(e,t),x(e,[{key:"getCommand",value:function(){return this.command}}]),e}(C);function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function 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,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 U(t,e,r){return e=V(e),function(t,e){if(e&&("object"===M(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,J()?Reflect.construct(e,r||[],V(t).constructor):e.apply(t,r))}function J(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(J=function(){return!!t})()}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}var W=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),U(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&F(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function $(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Q(n.key),n)}}function K(t,e,r){return e=q(e),function(t,e){if(e&&("object"===H(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Z(t)}(t,X()?Reflect.construct(e,r||[],q(t).constructor):e.apply(t,r))}function X(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(X=function(){return!!t})()}function q(t){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},q(t)}function Z(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function z(t,e){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},z(t,e)}function Q(t){var e=function(t,e){if("object"!=H(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:String(e)}var tt=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Z(r=K(this,e)),i=void 0,(o=Q(o="method"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.method=t,r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&z(t,e)}(e,t),r=e,o=[{key:"call",value:function(t){return new e(t)}}],(n=[{key:"setMethod",value:function(t){return this.method=t,this}},{key:"getCommandType",value:function(){return"CALL"}},{key:"getArguments",value:function(){return[this.method]}}])&&$(r.prototype,n),o&&$(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}function rt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ft(n.key),n)}}function nt(t,e,r){return e=it(e),function(t,e){if(e&&("object"===et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}(t,ot()?Reflect.construct(e,r||[],it(t).constructor):e.apply(t,r))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}function ct(t,e,r){return(e=ft(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==et(e)?e:String(e)}var lt=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ct(ut(t=nt(this,e)),"cmd",void 0),ct(ut(t),"cgLayer",void 0),ct(ut(t),"arguments",[]),t}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&at(t,e)}(e,t),r=e,o=[{key:"single",value:function(t){var r=new e;return r.cmd=t,r}},{key:"add",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,o=e.single("ADD");return o.arguments.push(t),o.arguments.push(r?"1":"0"),n&&o.arguments.push(JSON.stringify(n)),o}},{key:"play",value:function(){return e.single("PLAY")}},{key:"stop",value:function(){return e.single("STOP")}},{key:"next",value:function(){return e.single("NEXT")}},{key:"remove",value:function(){return e.single("REMOVE")}},{key:"clear",value:function(){return e.single("CLEAR")}},{key:"update",value:function(t){var r=e.single("UPDATE");return r.arguments.push(JSON.stringify(t)),r}},{key:"invoke",value:function(t){var r=e.single("INVOKE");return r.arguments.push(t),r}},{key:"info",value:function(){return e.single("INFO")}}],(n=[{key:"setLayer",value:function(t){return this.cgLayer=t,this}},{key:"getCommandType",value:function(){return"CG"}},{key:"getArguments",value:function(){var t=this.arguments.slice();void 0!==this.cgLayer?t.unshift(this.cgLayer.toString()):"CLEAR"!==this.cmd&&t.unshift("0"),t.unshift(this.cmd);var e=this.getPosition();return e&&t.unshift(e),t}}])&&rt(r.prototype,n),o&&rt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function st(t){return st="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},st(t)}function yt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pt(n.key),n)}}function pt(t){var e=function(t,e){if("object"!=st(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=st(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:String(e)}function ht(t,e,r){return e=mt(e),function(t,e){if(e&&("object"===st(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vt()?Reflect.construct(e,r||[],mt(t).constructor):e.apply(t,r))}function vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vt=function(){return!!t})()}function mt(t){return mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mt(t)}function bt(t,e){return bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bt(t,e)}var dt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ht(this,e,arguments)}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bt(t,e)}(e,t),r=e,o=[{key:"all",value:function(){return new B("CLEAR ALL")}}],(n=[{key:"getCommandType",value:function(){return"CLEAR"}}])&&yt(r.prototype,n),o&&yt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function wt(t){return function(t){if(Array.isArray(t))return Ot(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ot(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ot(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function jt(t,e,r){return e=_t(e),function(t,e){if(e&&("object"===gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Pt(t)}(t,St()?Reflect.construct(e,r||[],_t(t).constructor):e.apply(t,r))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function Pt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t,e){return Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Et(t,e)}function kt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Lt(n.key),n)}}function Tt(t,e,r){return e&&xt(t.prototype,e),r&&xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lt(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:String(e)}var Ct=function(){function t(){kt(this,t)}return Tt(t,null,[{key:"getVideoArguments",value:function(t){var e,r=[];return(t=t||{}).transition&&(r.push(t.transition),r.push((null!==(e=t.duration)&&void 0!==e?e:0).toString()),t.tween&&r.push(t.tween),t.direction&&r.push(t.direction)),t.seek&&r.push("SEEK",t.seek.toString()),t.length&&r.push("LENGTH",t.length.toString()),t.filter&&r.push("FILTER",t.filter),t.loop&&r.push("LOOP"),t.auto&&r.push("AUTO"),r}}]),t}(),At=function(t){function e(){var t,r,n,o;return kt(this,e),r=Pt(t=jt(this,e)),o=void 0,(n=Lt(n="arguments"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t.arguments=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Et(t,e)}(e,t),Tt(e,[{key:"getCommandType",value:function(){return"LOADBG"}},{key:"getArguments",value:function(){var t=this.getPosition();return t?[t].concat(wt(this.arguments)):[]}},{key:"setArguments",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.arguments=e,this}}],[{key:"video",value:function(t,e){var r;return(r=new this).setArguments.apply(r,[t].concat(wt(Ct.getVideoArguments(e))))}},{key:"route",value:function(t){return(new this).setArguments("route://".concat(t.getCommandString()))}},{key:"color",value:function(t){return(new this).setArguments(t)}}]),e}(R);function Rt(t){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(t)}function It(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Nt(n.key),n)}}function Nt(t){var e=function(t,e){if("object"!=Rt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rt(e)?e:String(e)}function Dt(t,e,r){return e=Mt(e),function(t,e){if(e&&("object"===Rt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bt()?Reflect.construct(e,r||[],Mt(t).constructor):e.apply(t,r))}function Bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bt=function(){return!!t})()}function Mt(t){return Mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mt(t)}function Ft(t,e){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ft(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&&Ft(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"LOAD"}}])&&It(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function Ut(t){return Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ut(t)}function Jt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qt(n.key),n)}}function Wt(t,e,r){return e&&Yt(t.prototype,e),r&&Yt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ht(t,e,r){return e=Kt(e),function(t,e){if(e&&("object"===Ut(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Xt(t)}(t,$t()?Reflect.construct(e,r||[],Kt(t).constructor):e.apply(t,r))}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($t=function(){return!!t})()}function Kt(t){return Kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kt(t)}function Xt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zt(t,e)}function Zt(t,e){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zt(t,e)}function zt(t,e,r){return(e=Qt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qt(t){var e=function(t,e){if("object"!=Ut(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ut(e)?e:String(e)}var te=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Vt(this,e),zt(Xt(r=Ht(this,e)),"command",void 0),zt(Xt(r),"args",void 0),r.command=t,r.args=n,r}return qt(e,t),Wt(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(function(t){if(Array.isArray(t))return Jt(t)}(t=this.args)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Jt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var t}}]),e}(R),ee=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Vt(this,e),t=Ht(this,e,[[]]),r&&t.commands.push(new te("CLEAR")),t}return qt(e,t),Wt(e,[{key:"single",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;r&&("number"==typeof r?e.push(r.toString()):e.push(r.duration.toString())),"number"!=typeof r&&null!=r&&r.type&&e.push(r.type);var n=new te(t,e);return this.commands.push(n),this}},{key:"keyer",value:function(t){return this.single("KEYER",[t.toString()])}},{key:"chroma",value:function(t,e){if(!t.enabled)return this.single("CHROMA",["0"]);var r=[1,t.target_hue,t.hue_width,t.min_saturation,t.min_brightness,t.softness,t.spill_suppress,t.spill_suppress_saturation,t.show_mask?1:0];return this.single("CHROMA",r.map((function(t){return t.toString()})),e)}},{key:"blend",value:function(t){return this.single("BLEND",[t])}},{key:"invert",value:function(t){return this.single("INVERT",[t?"1":"0"])}},{key:"opacity",value:function(t,e){var r=[t];return this.single("OPACITY",r.map((function(t){return t.toString()})),e)}},{key:"brightness",value:function(t,e){var r=[t];return this.single("BRIGHTNESS",r.map((function(t){return t.toString()})),e)}},{key:"saturation",value:function(t,e){var r=[t];return this.single("SATURATION",r.map((function(t){return t.toString()})),e)}},{key:"contrast",value:function(t,e){var r=[t];return this.single("CONTRAST",r.map((function(t){return t.toString()})),e)}},{key:"levels",value:function(t,e){var r=[t.min_input,t.max_input,t.gamma,t.min_output,t.max_output];return this.single("LEVELS",r.map((function(t){return t.toString()})),e)}},{key:"fill",value:function(t,e){var r=[t.x,t.y,t.x_scale,t.y_scale];return this.single("FILL",r.map((function(t){return t.toString()})),e)}},{key:"clip",value:function(t,e){var r=[t.x,t.y,t.width,t.height];return this.single("CLIP",r.map((function(t){return t.toString()})),e)}},{key:"anchor",value:function(t,e){var r=[t.x,t.y];return this.single("ANCHOR",r.map((function(t){return t.toString()})),e)}},{key:"crop",value:function(t,e){var r=[t.left_edge,t.top_edge,t.right_edge,t.bottom_edge];return this.single("CROP",r.map((function(t){return t.toString()})),e)}},{key:"rotation",value:function(t,e){var r=[t];return this.single("ROTATION",r.map((function(t){return t.toString()})),e)}},{key:"perspective",value:function(t,e){var r=[t.top_left.x,t.top_left.y,t.top_right.x,t.top_right.y,t.bottom_right.x,t.bottom_right.y,t.bottom_left.x,t.bottom_left.y];return this.single("PERSPECTIVE",r.map((function(t){return t.toString()})),e)}},{key:"mipmap",value:function(t){return this.single("MIPMAP",[t?"1":"0"])}},{key:"volume",value:function(t,e){var r=[t];return this.single("VOLUME",r.map((function(t){return t.toString()})),e)}},{key:"mastervolume",value:function(t){return this.single("MASTERVOLUME",[t.toString()])}},{key:"straightAlphaOutput",value:function(t){return this.single("STRAIGHT_ALPHA_OUTPUT",[t?"1":"0"])}},{key:"clear",value:function(){return this.commands.splice(0,this.commands.length),this}}],[{key:"create",value:function(){return new e}},{key:"clear",value:function(){return new e(!0)}}]),e}(D);function re(t){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re(t)}function ne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oe(n.key),n)}}function oe(t){var e=function(t,e){if("object"!=re(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==re(e)?e:String(e)}function ie(t,e,r){return e=ae(e),function(t,e){if(e&&("object"===re(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ue()?Reflect.construct(e,r||[],ae(t).constructor):e.apply(t,r))}function ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ue=function(){return!!t})()}function ae(t){return ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ae(t)}function ce(t,e){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ce(t,e)}var fe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ie(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ce(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PAUSE"}}])&&ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}function se(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ye(n.key),n)}}function ye(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==le(e)?e:String(e)}function pe(t,e,r){return e=ve(e),function(t,e){if(e&&("object"===le(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,he()?Reflect.construct(e,r||[],ve(t).constructor):e.apply(t,r))}function he(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(he=function(){return!!t})()}function ve(t){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ve(t)}function me(t,e){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},me(t,e)}var be=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),pe(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&me(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PLAY"}}])&&se(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function de(t){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(t)}function ge(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,we(n.key),n)}}function we(t){var e=function(t,e){if("object"!=de(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==de(e)?e:String(e)}function Oe(t,e,r){return e=Se(e),function(t,e){if(e&&("object"===de(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,je()?Reflect.construct(e,r||[],Se(t).constructor):e.apply(t,r))}function je(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(je=function(){return!!t})()}function Se(t){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Se(t)}function _e(t,e){return _e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_e(t,e)}var Pe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Oe(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_e(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&ge(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Ee(t){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(t)}function ke(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xe(n.key),n)}}function xe(t){var e=function(t,e){if("object"!=Ee(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ee(e)?e:String(e)}function Te(t,e,r){return e=Ce(e),function(t,e){if(e&&("object"===Ee(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Le()?Reflect.construct(e,r||[],Ce(t).constructor):e.apply(t,r))}function Le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Le=function(){return!!t})()}function Ce(t){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ce(t)}function Ae(t,e){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ae(t,e)}var Re=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Te(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ae(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&ke(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function Ie(t){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie(t)}function Ne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,De(n.key),n)}}function De(t){var e=function(t,e){if("object"!=Ie(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ie(e)?e:String(e)}function Be(t,e,r){return e=Fe(e),function(t,e){if(e&&("object"===Ie(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Me()?Reflect.construct(e,r||[],Fe(t).constructor):e.apply(t,r))}function Me(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Me=function(){return!!t})()}function Fe(t){return Fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fe(t)}function Ge(t,e){return Ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ge(t,e)}var Ue=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Be(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ge(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"RESUME"}}])&&Ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Je(t){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(t)}function Ve(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ye(n.key),n)}}function Ye(t){var e=function(t,e){if("object"!=Je(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Je(e)?e:String(e)}function We(t,e,r){return e=$e(e),function(t,e){if(e&&("object"===Je(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,He()?Reflect.construct(e,r||[],$e(t).constructor):e.apply(t,r))}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(He=function(){return!!t})()}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}function Ke(t,e){return Ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ke(t,e)}var Xe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),We(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ke(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&Ve(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function qe(t){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qe(t)}function Ze(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,or(n.key),n)}}function ze(t,e,r){return e=tr(e),function(t,e){if(e&&("object"===qe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return er(t)}(t,Qe()?Reflect.construct(e,r||[],tr(t).constructor):e.apply(t,r))}function Qe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qe=function(){return!!t})()}function tr(t){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tr(t)}function er(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rr(t,e){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rr(t,e)}function nr(t,e,r){return(e=or(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function or(t){var e=function(t,e){if("object"!=qe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qe(e)?e:String(e)}var ir=function(t){function e(t,r){var n,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),nr(er(n=ze(this,e)),"allocation1",void 0),nr(er(n),"allocation2",void 0),nr(er(n),"transforms",void 0),t&&n.allocate1(t),r&&n.allocate2(r),n.transforms=o,n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rr(t,e)}(e,t),r=e,(n=[{key:"allocate1",value:function(t,e){return this.allocation1=h.from(t,e),this}},{key:"allocate2",value:function(t,e){return this.allocation2=h.from(t,e),this}},{key:"getCommandType",value:function(){return"SWAP"}},{key:"getArguments",value:function(){var t,e,r=null===(t=this.allocation1)||void 0===t?void 0:t.getCommandString(),n=null===(e=this.allocation2)||void 0===e?void 0:e.getCommandString();if(!r||!n)return[];var o=[r,n];return this.transforms&&o.push("TRANSFORM"),o}}])&&Ze(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);const ur={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ar;const cr=new Uint8Array(16);function fr(){if(!ar&&(ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ar))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ar(cr)}const lr=[];for(let t=0;t<256;++t)lr.push((t+256).toString(16).slice(1));const sr=function(t,e,r){if(ur.randomUUID&&!e&&!t)return ur.randomUUID();const n=(t=t||{}).random||(t.rng||fr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=n[t];return e}return function(t,e=0){return lr[t[e+0]]+lr[t[e+1]]+lr[t[e+2]]+lr[t[e+3]]+"-"+lr[t[e+4]]+lr[t[e+5]]+"-"+lr[t[e+6]]+lr[t[e+7]]+"-"+lr[t[e+8]]+lr[t[e+9]]+"-"+lr[t[e+10]]+lr[t[e+11]]+lr[t[e+12]]+lr[t[e+13]]+lr[t[e+14]]+lr[t[e+15]]}(n)};function yr(t){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(t)}function pr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=hr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function hr(t,e){if(t){if("string"==typeof t)return vr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vr(t,e):void 0}}function vr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function br(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wr(n.key),n)}}function dr(t,e,r){return e&&br(t.prototype,e),r&&br(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gr(t,e,r){return(e=wr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wr(t){var e=function(t,e){if("object"!=yr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yr(e)?e:String(e)}var Or=function(){function t(e){mr(this,t),gr(this,"_active",!1),gr(this,"_disposed",!1),gr(this,"id",sr()),gr(this,"transform",void 0),gr(this,"effectGroup",void 0),gr(this,"layers",[]),this.effectGroup=e,this.group.addEffect(this)}return dr(t,[{key:"active",get:function(){return this._active}},{key:"getTransform",value:function(){return this.transform}},{key:"setTransform",value:function(t){this.transform=t,this.applyTransform()}},{key:"applyTransform",value:function(){if(this.active&&this.transform){var t,e=pr(this.layers);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.executor.execute(this.transform.getCommand().allocate(r))}}catch(t){e.e(t)}finally{e.f()}}}},{key:"group",get:function(){return this.effectGroup}},{key:"executor",get:function(){return this.group.channel.executor}},{key:"activate",value:function(){return!this._disposed&&!this.active&&(this._active=!0,this.executor.executeAllocations(),this.applyTransform(),!0)}},{key:"deactivate",value:function(){return!!this.active&&(this._active=!1,!0)}},{key:"dispose",value:function(){this._disposed||(this._disposed=!0,this.deactivate(),this.deallocateLayers(this.layers),this.executor.executeAllocations(),this.group.removeEffect(this),this.effectGroup=null,this.transform=null)}},{key:"getLayers",value:function(){return this.layers}},{key:"allocateLayers",value:function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=this.group.getEffectIndex(this),o=this.group.channel.allocateLayers({count:r,index:n});(t=this.layers).push.apply(t,function(t){if(Array.isArray(t))return vr(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||hr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var i,u=pr(o);try{for(u.s();!(i=u.n()).done;)i.value.setEffect(this)}catch(t){u.e(t)}finally{u.f()}return o}},{key:"deallocateLayers",value:function(t){var e,r=pr(t=t.slice());try{for(r.s();!(e=r.n()).done;){var n=e.value;n.setEffect(null);var o=this.layers.indexOf(n);o>=0&&this.layers.splice(o,1)}}catch(t){r.e(t)}finally{r.f()}this.group.channel.deallocateLayers(t)}},{key:"updatePositions",value:function(){}},{key:"getName",value:function(){return this.constructor.name}},{key:"getMetadata",value:function(){return{}}},{key:"toJSON",value:function(){return{id:this.id,type:this.getName(),active:this.active,metadata:this.getMetadata(),layers:this.layers.map((function(t){return t.toJSON()}))}}}]),t}(),jr=function(){function t(){mr(this,t),gr(this,"effects",new Map)}return dr(t,[{key:"register",value:function(t,e){this.effects.set(t,e)}},{key:"unregister",value:function(t){this.effects.delete(t)}},{key:"get",value:function(t){return this.effects.get(t)}},{key:"create",value:function(t,e,r){var n=this.get(t);return n?n(e,r):null}}]),t}();function Sr(t){return Sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sr(t)}function _r(t,e,r){return e=Er(e),function(t,e){if(e&&("object"===Sr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return kr(t)}(t,Pr()?Reflect.construct(e,r||[],Er(t).constructor):e.apply(t,r))}function Pr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pr=function(){return!!t})()}function Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(t)}function kr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xr(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tr(t,e)}function Tr(t,e){return Tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tr(t,e)}function Lr(t,e){(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 Cr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ar(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,Nr(n.key),n)}}function Rr(t,e,r){return e&&Ar(t.prototype,e),r&&Ar(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ir(t,e,r){return(e=Nr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nr(t){var e=function(t,e){if("object"!=Sr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Sr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sr(e)?e:String(e)}var Dr=function(){function t(e,r){Cr(this,t),Ir(this,"effects",[]),Ir(this,"name",void 0),Ir(this,"channel",void 0),this.name=r,this.channel=e}return Rr(t,[{key:"addEffect",value:function(t){this.effects.push(t),this.channel.executor.effects.set(t.id,t)}},{key:"removeEffect",value:function(t){var e=this.effects.indexOf(t);e>=0&&this.effects.splice(e,1),this.channel.executor.effects.delete(t.id)}},{key:"dispose",value:function(){var t,e=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Lr(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)?Lr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.effects);try{for(e.s();!(t=e.n()).done;)t.value.dispose()}catch(t){e.e(t)}finally{e.f()}}},{key:"getEffectIndex",value:function(t){var e=this.effects.indexOf(t);if(e<0)throw new Error("Effect not found in group");for(;e>=0;){var r=this.effects[e].getLayers();if(r.length){var n=r[r.length-1];return this.channel.getLayerIndex(n)+1}e--}return this.getStartingIndex()}},{key:"getStartingIndex",value:function(){var t=this.channel.groups.indexOf(this);if(t<0)throw new Error("Effect group not found in channel");if(0===t)return 0;for(;t>0;){t--;var e=this.channel.groups[t];if(!(e.effects.length<1)){for(var r=e.effects,n=r.length-1;n>=0&&!r[n].getLayers().length;)n--;if(!(n<0)){var o=r[n].getLayers(),i=o[o.length-1];return this.channel.getLayerIndex(i)+1}}}return 0}},{key:"toJSON",value:function(){return{name:this.name,effects:this.effects.map((function(t){return t.id}))}}}]),t}(),Br=function(t){function e(t,r){var n;return Cr(this,e),Ir(kr(n=_r(this,e,[t])),"layers",new Map),Ir(kr(n),"groups",[]),Ir(kr(n),"lastOrder",[]),Ir(kr(n),"currentOrder",[]),Ir(kr(n),"executor",void 0),Ir(kr(n),"needExecute",!1),n.executor=r,n}return xr(e,t),Rr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Dr(this,t);return e=e<0?this.groups.length:e,this.groups.splice(e,0,r),r}},{key:"getGroup",value:function(t,e){var r;t=null!==(r=t)&&void 0!==r?r:sr();var n=this.groups.find((function(e){return e.name===t}));return null!=n?n:this.createGroup(t,null!=e?e:-1)}},{key:"setExecutor",value:function(t){this.executor=t}},{key:"getLayer",value:function(t){return this.layers.get(t)}},{key:"getLayers",value:function(){var t=this;return this.currentOrder.map((function(e){return t.layers.get(e)})).filter((function(t){return void 0!==t}))}},{key:"getLayerIndex",value:function(t){return this.currentOrder.indexOf(t.id)}},{key:"allocateLayers",value:function(t){var e,r,n,o,i=null!==(r=(t=null!==(e=t)&&void 0!==e?e:{}).count)&&void 0!==r?r:1;if(i<1)throw new Error("You have to allocate at least 1 layer");for(var u=new Array(i),a=new Array(i),c=0;c<i;c++){var f=new Mr(this);this.layers.set(f.id,f),u[c]=f,a[c]=f.id}var l=null!==(n=t.index)&&void 0!==n?n:this.currentOrder.length;(o=this.currentOrder).splice.apply(o,[l,0].concat(a));for(var s=l+1;s<this.currentOrder.length&&i>0;s++)void 0===this.currentOrder[s]&&(this.currentOrder.splice(s,1),i--,s--);return this.needExecute=!0,u}},{key:"allocateLayer",value:function(t){return this.allocateLayers({index:t,count:1})[0]}},{key:"deallocateLayers",value:function(t){for(var e=0;e<t.length;e++){var r=t[e],n=this.currentOrder.indexOf(r.id);this.currentOrder[n]=void 0,this.layers.delete(r.id)}this.needExecute=!0}},{key:"executeAllocation",value:function(){if(this.needExecute){this.needExecute=!1;for(var t=[],e=this.lastOrder.slice(),r=0;r<e.length;r++){var n=e[r];if(void 0!==n&&!(this.currentOrder.indexOf(n)>=0)){e[r]=void 0;var o=h.caspar(this.casparChannel,r+1);t.push(new dt(o)),t.push(ee.clear().allocate(o))}}for(var i=0;i<this.currentOrder.length;i++){var u=this.currentOrder[i];if(void 0!==u){this.layers.get(u).setCasparLayer(i+1);var a=e.indexOf(u);if(a!==i&&!(a<0)){e[a]=e[i],e[i]=u;var c=h.caspar(this.casparChannel,i+1),f=h.caspar(this.casparChannel,a+1);t.push(new ir(c,f,!0))}}}this.lastOrder=this.currentOrder,this.currentOrder=this.currentOrder.slice();for(var l=0;l<this.currentOrder.length;l++){var s=this.currentOrder[l];if(void 0!==s){var y=this.layers.get(s);y&&y.setCasparLayer(l+1)}}var p=new D(t);this.executor.execute(p)}}},{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),Mr=function(t){function e(t){var r;return Cr(this,e),Ir(kr(r=_r(this,e,[t])),"id",void 0),Ir(kr(r),"effect",void 0),r.id=sr(),r}return xr(e,t),Rr(e,[{key:"setEffect",value:function(t){this.effect=t}},{key:"getEffect",value:function(){return this.effect}},{key:"dispose",value:function(){this.channel.deallocateLayers([this])}},{key:"toJSON",value:function(){var t;return{id:this.id,effect:null===(t=this.effect)||void 0===t?void 0:t.id}}}]),e}(h);function Fr(t){return Fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fr(t)}function Gr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ur(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 Ur(t,e){if(t){if("string"==typeof t)return Jr(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)?Jr(t,e):void 0}}function Jr(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 Vr(){Vr=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new L(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function b(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=b.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==Fr(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Fr(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function Yr(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 Wr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){Yr(i,n,o,u,a,"next",t)}function a(t){Yr(i,n,o,u,a,"throw",t)}u(void 0)}))}}function Hr(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,Kr(n.key),n)}}function $r(t,e,r){return(e=Kr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Kr(t){var e=function(t,e){if("object"!=Fr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fr(e)?e:String(e)}var Xr=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),$r(this,"templates",[]),$r(this,"lastFetch",0),$r(this,"fetchPromise",null),$r(this,"channels",new Map),$r(this,"listeners",[]),$r(this,"effects",new Map)}var e,r,n,o;return e=t,r=[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(o=Wr(Vr().mark((function t(){return Vr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",[]);case 1:case"end":return t.stop()}}),t)}))),function(){return o.apply(this,arguments)})},{key:"fetchTemplates",value:function(){var t=this;return this.fetchPromise||(this.fetchPromise=this._fetchTemplates().then((function(e){return t.fetchPromise=null,t.templates=e}))),this.fetchPromise}},{key:"getTemplates",value:(n=Wr(Vr().mark((function t(){var e=arguments;return Vr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e.length>0&&void 0!==e[0]&&e[0]||Date.now()-this.lastFetch>3e5)){t.next=5;break}return this.lastFetch=Date.now(),t.next=5,this.fetchTemplates();case 5:return t.abrupt("return",this.templates);case 6:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"resolveTemplates",value:function(){return this.templates}},{key:"promise",value:function(t){var e=this;return new Promise((function(r,n){var o;!function t(){o=setTimeout((function(){if(!e.connected)return t();e.removeListener(i),n({data:["Timeout"],code:-1})}),1e3)}();var i={command:t,success:function(t,e){o&&clearTimeout(o),r({data:t,code:e})},error:function(t,e){o&&clearTimeout(o),n({data:t,code:e})}};e.addListener(i)}))}},{key:"executePassive",value:function(t){var e=t.getCommand();e&&this.send(e)}},{key:"execute",value:function(t){var e=this,r=t.getCommand();if(r){var n=A.interpret(r).map((function(t){return e.promise(t.getCmd())}));return this.send(r),Promise.all(n)}}},{key:"getChannel",value:function(t){return this.channels.get(t)}},{key:"getChannels",value:function(){return Array.from(this.channels.values())}},{key:"allocateChannel",value:function(t){var e=new Br(t,this);return this.channels.set(t,e),e}},{key:"executeAllocations",value:function(){var t,e=Gr(this.channels.values());try{for(e.s();!(t=e.n()).done;)t.value.executeAllocation()}catch(t){e.e(t)}finally{e.f()}}},{key:"send",value:function(t){}},{key:"receive",value:function(t){for(var e=t.split("\r\n"),r=e.pop(),n=0,o=0;o<e.length;o++){var i=e[o].split(" "),u=parseInt(i[0]),a=[];if((101===u||201===u||400===u)&&(o++,a.push(e[o]),o===e.length))break;if(200===u){for(o++;e[o];)a.push(e[o]),o++;if(o===e.length)break}n=o+1;var c=null;400!==u&&500!==u&&(c=i[1]),this.executeListeners(u,c,a),this.onEvent(u,c,a)}return[].concat((f=e.slice(n),function(t){if(Array.isArray(t))return Jr(t)}(f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(f)||Ur(f)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),[r]).join("\r\n");var f}},{key:"addListener",value:function(t){this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},{key:"executeListeners",value:function(t,e,r){if(!(t<200)&&e){var n,o=2===Math.floor(t/100),i=Gr(this.listeners);try{for(i.s();!(n=i.n()).done;){var u=n.value;if(u.command===e){o?u.success(r,t):u.error(r,t),this.removeListener(u);break}}}catch(t){i.e(t)}finally{i.f()}}}},{key:"onEvent",value:function(t,e,r){}},{key:"getEffects",value:function(){return Array.from(this.effects.values())}},{key:"getEffect",value:function(t){return this.effects.get(t)}},{key:"toJSON",value:function(){return{channels:this.getChannels().map((function(t){return t.toJSON()}))}}}],r&&Hr(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function qr(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function Zr(t){return Zr="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},Zr(t)}function zr(){zr=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,u=Object.create(i.prototype),a=new L(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function b(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=b.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==Zr(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Zr(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function 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 tn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=cn(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 en(t,e,r){return e=nn(e),function(t,e){if(e&&("object"===Zr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return on(t)}(t,rn()?Reflect.construct(e,r||[],nn(t).constructor):e.apply(t,r))}function rn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(rn=function(){return!!t})()}function nn(t){return nn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nn(t)}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,e){return un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},un(t,e)}function an(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)||cn(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 cn(t,e){if(t){if("string"==typeof t)return fn(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)?fn(t,e):void 0}}function fn(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 ln(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sn(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,hn(n.key),n)}}function yn(t,e,r){return e&&sn(t.prototype,e),r&&sn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function pn(t,e,r){return(e=hn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hn(t){var e=function(t,e){if("object"!=Zr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Zr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zr(e)?e:String(e)}var vn=function(){function t(){ln(this,t),pn(this,"_api",void 0),pn(this,"_enabled",!1),pn(this,"logger",void 0)}return yn(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=an(qr((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=an(qr((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}(),mn=function(t){function e(t,r){var n;return ln(this,e),pn(on(n=en(this,e)),"files",[]),pn(on(n),"uiInjections",[]),pn(on(n),"_manager",void 0),pn(on(n),"_plugin",void 0),pn(on(n),"_effects",[]),pn(on(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=on(n),n._plugin.logger=t.getLogger("Plugin").scope(n._plugin.pluginName),n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&un(t,e)}(e,t),yn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=tn(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=tn(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=zr().mark((function t(){var e,r,n;return zr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=tn(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){Qr(i,n,o,u,a,"next",t)}function a(t){Qr(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=tn(this.uiInjections);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.ui.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this.uiInjections=[]}},{key:"unregister",value:function(){return this.unregisterEffects(),this.unregisterRoutes(),this.unregisterUIInjections(),this.unregisterFiles()}},{key:"registerRoute",value:function(t,e,r){var n=this._manager.server.registerRoute("plugin/".concat(this._plugin.pluginName,"/").concat(t),e,r);return this.routes.push(n),n}},{key:"unregisterRoute",value:function(t){var e=this.routes.indexOf(t);e<0||(this.routes.splice(e,1),this._manager.server.unregisterRoute(t))}},{key:"registerFile",value:function(t,e){var r=this;return this._manager.directory.createDirectory(t,e).then((function(t){return r.files.push(t.id),t}))}},{key:"getEffectGroup",value:function(t,e){return this._manager.executor.getEffectGroup(t,e)}},{key:"unregisterFile",value:function(t){var e=this.files.indexOf(t);if(!(e<0))return this.files.splice(e,1),this._manager.directory.deleteDirectory(t)}},{key:"getDirectory",value:function(t){if(this.files.includes(t))return this._manager.directory.getDirectory(t)}},{key:"getDirectories",value:function(){var t=this;return this.files.map((function(e){return t._manager.directory.getDirectory(e)}))}},{key:"getFileDatabase",value:function(){return this._manager.getFiles()}},{key:"registerUI",value:function(t,e){var r=this._manager.ui.register(t,e,this._plugin.pluginName);this.uiInjections.push(r)}},{key:"unregisterUI",value:function(t){var e=this.uiInjections.indexOf(t);e<0||(this.uiInjections.splice(e,1),this._manager.ui.unregister(t))}},{key:"createEffect",value:function(t,e,r){var n=this._manager.executor.getEffectGroup(e);return this._manager.effects.create(t,n,r)}},{key:"getEffect",value:function(t){return this._manager.executor.getEffect(t)}}]),e}(o.EventEmitter);function bn(t){return bn="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},bn(t)}function dn(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,wn(n.key),n)}}function gn(t,e,r){return(e=wn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wn(t){var e=function(t,e){if("object"!=bn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=bn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bn(e)?e:String(e)}var On=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),gn(this,"source",void 0),gn(this,"destination",void 0),gn(this,"fillTransition",null),gn(this,"cropTransition",null),this.source=e,this.destination=r}var e,r,n;return e=t,n=[{key:"getRect",value:function(t,e,r,n){return{start:{x:t,y:e},end:{x:r,y:n}}}},{key:"normalRect",value:function(){return t.getRect(0,0,1,1)}},{key:"fromArray",value:function(e){return new t(t.getRect(e[0],e[1],e[2],e[3]),t.getRect(e[4],e[5],e[6],e[7]))}}],(r=[{key:"setTween",value:function(t,e){void 0===t&&(t=null),void 0===e&&(e=t),this.fillTransition=t,this.cropTransition=e}},{key:"getFill",value:function(t){return{x:t.start.x,y:t.start.y,x_scale:t.end.x-t.start.x,y_scale:t.end.y-t.start.y}}},{key:"getCrop",value:function(t){return{left_edge:t.start.x,top_edge:t.start.y,right_edge:t.end.x,bottom_edge:t.end.y}}},{key:"getCommand",value:function(){return ee.create().crop(this.getCrop(this.source),this.cropTransition).fill(this.getFill(this.destination),this.fillTransition)}}])&&dn(e.prototype,r),n&&dn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
|
package/dist/plugin.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare class PluginAPI extends EventEmitter {
|
|
|
38
38
|
unregisterFile(id: string): Promise<void>;
|
|
39
39
|
getDirectory(id: string): Promise<import("./types/scanner/dir").InternalMediaData>;
|
|
40
40
|
getDirectories(): Promise<import("./types/scanner/dir").InternalMediaData>[];
|
|
41
|
+
getFileDatabase(): import("./types/scanner/db").FileDatabase;
|
|
41
42
|
/**
|
|
42
43
|
* @param injectionZone The zone to inject the file into, e.g. UI_INJECTION_ZONE.EFFECT_CREATOR for the effect creator
|
|
43
44
|
* @param file The file to inject, it holds the component as default export
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/manager.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { CGServer } from './server';
|
|
|
10
10
|
import { PluginManager } from './plugin';
|
|
11
11
|
import { CasparProcess } from './caspar/process';
|
|
12
12
|
import { CasparExecutor } from './caspar/executor';
|
|
13
|
+
import { FileDatabase } from './scanner/db';
|
|
13
14
|
export declare class CasparManager extends EventEmitter {
|
|
14
15
|
effects: EffectRegistry;
|
|
15
16
|
ui: UIInjector;
|
|
@@ -18,6 +19,7 @@ export declare class CasparManager extends EventEmitter {
|
|
|
18
19
|
plugins: PluginManager;
|
|
19
20
|
caspar: CasparProcess;
|
|
20
21
|
executor: CasparExecutor;
|
|
22
|
+
db: FileDatabase;
|
|
21
23
|
start(): Promise<void>;
|
|
22
24
|
stop(): Promise<void>;
|
|
23
25
|
getMediaScanner(): MediaScanner;
|
|
@@ -25,6 +27,7 @@ export declare class CasparManager extends EventEmitter {
|
|
|
25
27
|
getPlugins(): PluginManager;
|
|
26
28
|
getCasparProcess(): CasparProcess;
|
|
27
29
|
getExecutor(): CasparExecutor;
|
|
30
|
+
getFiles(): FileDatabase;
|
|
28
31
|
getPluginInjections(): Injection[];
|
|
29
32
|
getPluginInjectionCode(id: string): Promise<string>;
|
|
30
33
|
getLogger(scope: string): Logger;
|
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.
|
|
6
|
+
"version": "0.0.4",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"devDependencies": {
|