vtally
Version:
An affordable and reliable Tally Light that works via WiFi based on NodeMCU / ESP8266. Supports multiple video mixers.
1 lines • 100 kB
JavaScript
(this.webpackJsonpvtally=this.webpackJsonpvtally||[]).push([[0],{199:function(e,t){},231:function(e,t,n){"use strict";n.r(t);var i=n(1),o=n(0),a=n.n(o),r=n(18),s=n.n(r),c=n(151),l=n(262),u="#00bc8c",d=Object(c.a)({palette:{type:"dark",background:{paper:"#303030",default:"#222"},primary:{main:"#375a7f"},secondary:{main:u},error:{main:"#e74c3c"},warning:{main:"#f39c12"},info:{main:"#3498db"},success:{main:u},grey:{100:"#f8f9fa",200:"#ebebeb",300:"#dee2e6",400:"#ced4da",500:"#adb5bd",600:"#888",700:"#444",800:"#303030",900:"#222"}},typography:{fontSize:15,htmlFontSize:15,fontFamily:'"Lato", "Roboto", "Helvetica", "Arial", sans-serif',fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:600,h1:{fontSize:"3rem",letterSpacing:"0",fontWeight:300},h2:{fontSize:"2.5rem",letterSpacing:"0",fontWeight:300},h3:{fontSize:"2rem",letterSpacing:"0",fontWeight:400},h4:{fontSize:"1.5rem",letterSpacing:"0",fontWeight:400},h5:{fontSize:"1.25rem",letterSpacing:"0",fontWeight:500},h6:{fontSize:"1rem",letterSpacing:"0",fontWeight:500}},props:{MuiAlert:{variant:"filled"},MuiInput:{color:"secondary"},MuiInputLabel:{color:"secondary"},MuiLink:{color:"secondary"},MuiNativeSelect:{color:"secondary",variant:"filled"},MuiSelect:{native:!0,color:"secondary",variant:"filled"},MuiTextField:{color:"secondary",variant:"filled"}}});var h=function(e){var t=e.children;return Object(i.jsx)(l.a,{theme:d,children:t})},g=n(285),f=n(39),v=n(19),b=n(5),p=n(129),j=n.n(p),m=n(22),O=n(9),y=n(10),S=function(){function e(){Object(O.a)(this,e),this.connected=void 0,this.clientEventEmitter=void 0,this.serverEventEmitter=void 0,this.connected=!1,this.clientEventEmitter=new m.EventEmitter,this.serverEventEmitter=new m.EventEmitter}return Object(y.a)(e,[{key:"on",value:function(e,t){return this.clientEventEmitter.on(e,t),this}},{key:"off",value:function(e,t){return this.clientEventEmitter.off(e,t),this}},{key:"emit",value:function(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return(t=this.serverEventEmitter).emit.apply(t,[e].concat(i)),this}},{key:"emitServerEvent",value:function(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return(t=this.clientEventEmitter).emit.apply(t,[e].concat(i))}},{key:"onServerEvent",value:function(e,t){this.serverEventEmitter.on(e,t)}},{key:"cleanUp",value:function(){this.serverEventEmitter.removeAllListeners()}}]),e}(),x=new m.EventEmitter,w=void 0!==Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}).JEST_WORKER_ID?new S:j()(),C=function(){x.emit("disconnected")};"undefined"!==typeof window&&(w.on("connect",(function(){x.emit("connected")})),w.on("connect_error",C),w.on("connect_timeout",C),w.on("disconnected",C),w.on("reconnect",C),w.on("reconnecting",C),w.on("reconnect_error",C),w.on("reconnect_failed",C));var I=function(){var e=Object(o.useState)(w.connected),t=Object(b.a)(e,2),n=t[0],i=t[1],a=function(){i(!0)},r=function(){i(!1)};return Object(o.useEffect)((function(){return x.on("connected",a),x.on("disconnected",r),function(){x.off("connected",a),x.off("disconnected",r)}}),[]),n},k=n(17),N=n(16),T=new(function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(e){var i;return Object(O.a)(this,n),(i=t.call(this)).connectionState=void 0,i.connectionState=null,e.on("mixer.state",(function(e){var t=e.isConnected;i.connectionState=t,i.emit("connection",i.connectionState)})),e.emit("events.mixer.subscribe"),i}return n}(m.EventEmitter))(w);var P=function(){var e=Object(o.useState)(T.connectionState),t=Object(b.a)(e,2),n=t[0],i=t[1];return Object(o.useEffect)((function(){var e=function(e){i(e)};return T.on("connection",e),function(){T.off("connection",e)}}),[]),n},E=n(263),B=n(265),M=n(266),D=n(235),L=n(267),R=Object(E.a)((function(e){return{logo:{height:e.typography.h2.fontSize,margin:e.spacing(1,2,2,0)},contentContainer:{marginTop:e.spacing(2)}}})),_=function(e){var t=e.testId,n=e.children,o=R();return Object(i.jsxs)("div",{"data-testid":"page-".concat(t),children:[Object(i.jsx)(B.a,{position:"static",children:Object(i.jsxs)(M.a,{children:[Object(i.jsx)("img",{width:"106",height:"40",className:o.logo,src:"/logo-with-text.svg",alt:"vTally"}),Object(i.jsx)(D.a,{component:f.b,to:"/",children:"Tallies"}),Object(i.jsx)(D.a,{component:f.b,to:"/config",children:"Configuration"}),Object(i.jsx)(D.a,{component:f.b,to:"/flasher",children:"Flash"})]})}),n&&Object(i.jsx)(L.a,{maxWidth:!1,className:o.contentContainer,children:n})]})},J=n(101),A=n(50),H=n(23),V=function(){function e(t,n,i){Object(O.a)(this,e),this.r=void 0,this.g=void 0,this.b=void 0,this.r=t,this.g=n,this.b=i}return Object(y.a)(e,[{key:"calculateChannel",value:function(e,t){return Math.ceil(e*t/100)}},{key:"withBrightness",value:function(t){return new e(this.calculateChannel(this.r,t),this.calculateChannel(this.g,t),this.calculateChannel(this.b,t))}},{key:"toCss",value:function(){return"rgb(".concat(this.r,",").concat(this.g,",").concat(this.b,")")}}]),e}(),F=(new V(0,0,0),{id:"default",name:"Default",description:"The traditional color scheme for Tally Lights.",program:new V(255,0,0),preview:new V(0,255,0),highlight:new V(255,255,255),unknown:new V(0,0,255),idle:new V(0,1,0)}),W={id:"yellow-pink",name:"Yellow-Pink",description:"Intended to give better contrast for the red-green color blind (Protanopia, Deuteranopia).",program:new V(255,255,0),preview:new V(255,0,255),highlight:new V(255,255,255),unknown:new V(0,0,255),idle:new V(0,1,0)},U={getAll:function(){return[F,W]},getById:function(e){return"default"===e?F:"yellow-pink"===e?W:void 0}},z=function(){function e(){Object(O.a)(this,e),this._stageLightBrightness=e.defaultBrightness,this._stageColorScheme=e.defaultColorScheme,this._operatorLightBrightness=e.defaultBrightness,this._operatorColorScheme=e.defaultColorScheme,this._stageShowsPreview=!0,this._operatorShowsIdle=!0}return Object(y.a)(e,[{key:"getStageLightBrightness",value:function(){return this._stageLightBrightness}},{key:"setStageLightBrightness",value:function(t){null!==t&&void 0!==t||(t=e.defaultBrightness),this._stageLightBrightness=Math.min(Math.max(t,0),100)}},{key:"getStageColorScheme",value:function(){return this._stageColorScheme}},{key:"setStageColorScheme",value:function(e){this._stageColorScheme=e}},{key:"getOperatorLightBrightness",value:function(){return this._operatorLightBrightness}},{key:"setOperatorLightBrightness",value:function(t){var n=e.minOperatorLightBrightness;null===t||void 0===t?t=e.defaultBrightness:t<n&&(console.warn("Operator Light Brightness can not be below ".concat(n," to prevent a tally light that stays dark because of configuration, but got ").concat(t,". Using ").concat(n," instead.")),t=n),this._operatorLightBrightness=Math.min(t,100)}},{key:"getOperatorColorScheme",value:function(){return this._operatorColorScheme}},{key:"setOperatorColorScheme",value:function(e){this._operatorColorScheme=e}},{key:"getStageShowsPreview",value:function(){return this._stageShowsPreview}},{key:"setStageShowsPreview",value:function(e){this._stageShowsPreview=e}},{key:"getOperatorShowsIdle",value:function(){return this._operatorShowsIdle}},{key:"setOperatorShowsIdle",value:function(e){this._operatorShowsIdle=e}},{key:"toJson",value:function(){return{stBrightness:this._stageLightBrightness,opBrightness:this._operatorLightBrightness,stColor:this._stageColorScheme,opColor:this._operatorColorScheme,stPreview:this._stageShowsPreview,opIdle:this._operatorShowsIdle}}},{key:"fromJson",value:function(e){void 0!==e.opBrightness&&this.setOperatorLightBrightness(e.opBrightness),void 0!==e.stBrightness&&this.setStageLightBrightness(e.stBrightness),void 0!==e.stColor&&this.setStageColorScheme(e.stColor),void 0!==e.opColor&&this.setOperatorColorScheme(e.opColor),void 0!==e.stPreview&&this.setStageShowsPreview(e.stPreview),void 0!==e.opIdle&&this.setOperatorShowsIdle(e.opIdle)}},{key:"clone",value:function(){var t=new e;return t.fromJson(this.toJson()),t}}]),e}();z.defaultColorScheme=F.id,z.minOperatorLightBrightness=1,z.defaultBrightness=100;var q,G=function(){function e(){Object(O.a)(this,e),this._stageLightBrightness=void 0,this._operatorLightBrightness=void 0,this._stageColorScheme=void 0,this._operatorColorScheme=void 0,this._stageShowsPreview=void 0,this._operatorShowsIdle=void 0}return Object(y.a)(e,[{key:"getStageLightBrightness",value:function(){return this._stageLightBrightness}},{key:"setStageLightBrightness",value:function(e){this._stageLightBrightness=null!==e&&void 0!==e?Math.min(Math.max(e,0),100):void 0}},{key:"getStageColorScheme",value:function(){return this._stageColorScheme}},{key:"setStageColorScheme",value:function(e){this._stageColorScheme=e}},{key:"getOperatorLightBrightness",value:function(){return this._operatorLightBrightness}},{key:"setOperatorLightBrightness",value:function(e){var t=z.minOperatorLightBrightness;null!==e&&void 0!==e?(e<t&&(console.warn("Operator Light Brightness can not be below ".concat(t," to prevent a tally light that stays dark because of configuration, but got ").concat(e,". Using ").concat(t," instead.")),e=t),this._operatorLightBrightness=Math.min(e,100)):this._operatorLightBrightness=void 0}},{key:"getOperatorColorScheme",value:function(){return this._operatorColorScheme}},{key:"setOperatorColorScheme",value:function(e){this._operatorColorScheme=e}},{key:"getStageShowsPreview",value:function(){return this._stageShowsPreview}},{key:"setStageShowsPreview",value:function(e){this._stageShowsPreview=e}},{key:"getOperatorShowsIdle",value:function(){return this._operatorShowsIdle}},{key:"setOperatorShowsIdle",value:function(e){this._operatorShowsIdle=e}},{key:"toJson",value:function(){return{stBrightness:this._stageLightBrightness,opBrightness:this._operatorLightBrightness,stColor:this._stageColorScheme,opColor:this._operatorColorScheme,stPreview:this._stageShowsPreview,opIdle:this._operatorShowsIdle}}},{key:"fromJson",value:function(e){this.setOperatorLightBrightness(e.opBrightness),this.setStageLightBrightness(e.stBrightness),this.setStageColorScheme(e.stColor),this.setOperatorColorScheme(e.opColor),this.setStageShowsPreview(e.stPreview),this.setOperatorShowsIdle(e.opIdle)}}]),e}();!function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTED=1]="CONNECTED",e[e.MISSING=2]="MISSING"}(q||(q={}));var K=function(){function e(t,n){Object(O.a)(this,e),this.name=void 0,this.channelId=void 0,this.highlight=!1,this.logs=[],this.type=void 0,this.configuration=void 0,this.hasStageLight=!0,this.name=t,this.channelId=n,this.configuration=new G}return Object(y.a)(e,[{key:"isPatched",value:function(){return void 0!==this.channelId}},{key:"setHighlight",value:function(e){this.highlight=e}},{key:"isHighlighted",value:function(){return this.highlight}},{key:"isWebTally",value:function(){return"web"===this.type}},{key:"isUdpTally",value:function(){return"udp"===this.type}},{key:"addLog",value:function(e){return this.logs.push(e),e}},{key:"getLogs",value:function(){return this.logs}},{key:"getId",value:function(){return"".concat(this.type,"-").concat(this.name)}},{key:"isIn",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return null!==e&&(void 0!==this.channelId&&-1!==e.indexOf(this.channelId))}},{key:"setConfiguration",value:function(e){this.configuration=e}},{key:"toJsonForSave",value:function(){return Object(H.a)({name:this.name,type:this.type,channelId:this.channelId},this.configuration.toJson())}},{key:"toJson",value:function(){return Object(H.a)({name:this.name,type:this.type,channelId:this.channelId},this.configuration.toJson())}}],[{key:"fromJsonForSave",value:function(e){var t="web"===e.type?new $(e.name,e.channelId):new Y(e.name,e.channelId),n=new G;return n.fromJson(e),t.setConfiguration(n),t}},{key:"fromJson",value:function(e){return"web"===e.type?$.fromJson(e):Y.fromJson(e)}}]),e}(),Y=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(e,i,o,a){var r,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:q.DISCONNECTED;return Object(O.a)(this,n),(r=t.call(this,e,i)).address=void 0,r.port=void 0,r.state=void 0,r.type="udp",r.address=o,r.port=a,r.state=s,r}return Object(y.a)(n,[{key:"isConnected",value:function(){return void 0!==this.address&&void 0!==this.port&&this.state===q.CONNECTED}},{key:"isDisconnected",value:function(){return!this.isActive()}},{key:"isActive",value:function(){return void 0!==this.address&&void 0!==this.port&&this.state!==q.DISCONNECTED}},{key:"isMissing",value:function(){return void 0!==this.address&&void 0!==this.port&&this.state===q.MISSING}},{key:"toJson",value:function(){return Object(H.a)(Object(H.a)({},Object(J.a)(Object(A.a)(n.prototype),"toJson",this).call(this)),{},{address:this.address,port:this.port,state:this.state})}}],[{key:"fromJson",value:function(e){var t=new n(e.name,e.channelId,e.address,e.port,e.state);return t.configuration.fromJson(e),t}}]),n}(K),$=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(e,i,o){var a;return Object(O.a)(this,n),(a=t.call(this,e,i)).type="web",a.connectedClients=void 0,a.connectedClients=o||[],a.hasStageLight=!1,a}return Object(y.a)(n,[{key:"isConnected",value:function(){return this.connectedClients.length>0}},{key:"isDisconnected",value:function(){return!this.isConnected()}},{key:"isActive",value:function(){return this.isConnected()}},{key:"isMissing",value:function(){return!1}},{key:"toJson",value:function(){return Object(H.a)(Object(H.a)({},Object(J.a)(Object(A.a)(n.prototype),"toJson",this).call(this)),{},{connectedClients:this.connectedClients})}}],[{key:"fromJson",value:function(e){var t=new n(e.name,e.channelId,e.connectedClients);return t.configuration.fromJson(e),t}}]),n}(K),X=K,Q=new(function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(e,i){var o;return Object(O.a)(this,n),(o=t.call(this)).tallies=void 0,o.tallies=null,e.on("tally.state",(function(e){var t=e.tallies;o.tallies=t.map((function(e){return X.fromJson(e)})),o.emit("tallies",o.tallies)})),e.emit("events.tally.subscribe"),i.on("connected",(function(){e.emit("events.tally.subscribe")})),o}return n}(m.EventEmitter))(w,x);var Z=function(){var e=Object(o.useState)(Q.tallies),t=Object(b.a)(e,2),n=t[0],i=t[1];return Object(o.useEffect)((function(){var e=function(e){i(Array.from(e))};return Q.on("tallies",e),function(){Q.off("tallies",e)}}),[]),n},ee=n(293),te=Object(E.a)((function(e){return{root:{display:"block",overflow:"hidden",marginBottom:e.spacing(2)},select:{paddingTop:e.spacing(1)}}})),ne=function(e){var t=e.channels,n=e.value,o=void 0===n?null:n,a=e.onChange;t=t||[];var r=te(),s=null===o;return Object(i.jsxs)(ee.a,{"data-testid":"channel-selector",native:!0,autoWidth:!0,className:r.root,classes:{select:r.select},value:o||"",onChange:function(e){var t=e.target.value.toString();""===t&&(t=null),a&&a(t)},children:[Object(i.jsx)("option",{value:"",children:"(unpatched)"},null),t.map((function(e){return e.id===o&&(s=!0),Object(i.jsx)("option",{value:e.id,children:e.name||"Channel ".concat(e.id)},e.id)})),s||void 0===o?"":Object(i.jsxs)("option",{value:o,children:["Channel ",o]},o)]})},ie=function(){function e(t,n){Object(O.a)(this,e),this.id=void 0,this.name=void 0,this.id=t.toString(),this.name=n}return Object(y.a)(e,[{key:"toJson",value:function(){return{id:this.id,name:this.name}}},{key:"toString",value:function(){return this.name||this.id}}]),e}();ie.fromJson=function(e){return new ie(e.id,e.name)};var oe=ie,ae=new(function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(e,i){var o;return Object(O.a)(this,n),(o=t.call(this)).channels=void 0,o.channels=void 0,e.on("channel.state",(function(e){var t=e.channels;o.channels=t.map((function(e){return oe.fromJson(e)})),o.emit("channels",o.channels)})),e.emit("events.channel.subscribe"),i.on("connected",(function(){e.emit("events.channel.subscribe")})),o}return n}(m.EventEmitter))(w,x);var re=function(){var e=Object(o.useState)(ae.channels),t=Object(b.a)(e,2),n=t[0],i=t[1],a=function(e){i(e)};return Object(o.useEffect)((function(){return ae.on("channels",a),function(){ae.off("channels",a)}}),[]),n},se=new(function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(e,i){var o;return Object(O.a)(this,n),(o=t.call(this)).programs=void 0,o.previews=void 0,o.programs=null,o.previews=null,e.on("program.state",(function(e){var t=e.programs,n=e.previews;o.programs=t,o.previews=n,o.emit("program",o.programs,o.previews)})),e.emit("events.program.subscribe"),i.on("connected",(function(){e.emit("events.program.subscribe")})),o}return n}(m.EventEmitter))(w,x);var ce=function(){var e=Object(o.useState)(se.programs),t=Object(b.a)(e,2),n=t[0],i=t[1],a=Object(o.useState)(se.previews),r=Object(b.a)(a,2),s=r[0],c=r[1];return Object(o.useEffect)((function(){var e=function(e,t){i(e),c(t)};return se.on("program",e),function(){se.off("program",e)}}),[]),[n,s]},le=n(233),ue=n(297),de=n(237),he=n(152),ge=n(278),fe=n(279),ve=n(296),be=n(136),pe=n.n(be),je=n(138),me=n.n(je),Oe=n(137),ye=n.n(Oe),Se=n(134),xe=n.n(Se),we=n(135),Ce=n.n(we),Ie=n(88),ke=n.n(Ie),Ne=n(277),Te=n(289);var Pe=function(){function e(t){if(Object(O.a)(this,e),this.address=void 0,!function(e){if("localhost"===e)return!0;var t=e.split("."),n=Object(b.a)(t,5),i=n[0],o=n[1],a=n[2],r=n[3];return void 0===n[4]&&[i,o,a,r].every((function(e){return void 0!==e&&null!==e.match(/^\d{1,3}$/)&&parseInt(e,10)>=0&&parseInt(e,10)<=255}))}(t))throw new Error("Invalid IP address: ".concat(t));this.address=t}return Object(y.a)(e,[{key:"toString",value:function(){return this.address}}]),e}(),Ee=function(e){return new Pe(e)};var Be=function(){function e(t){if(Object(O.a)(this,e),this.port=void 0,"string"===typeof t&&(t=parseInt(t,10)),!function(e){return Number.isInteger(e)&&e>0&&e<=65535}(t))throw new Error("Invalid Port: ".concat(t));this.port=t}return Object(y.a)(e,[{key:"toNumber",value:function(){return this.port}},{key:"toString",value:function(){return this.toNumber().toString()}}]),e}(),Me=function(e){return new Be(e)},De=function(){function e(){Object(O.a)(this,e)}return Object(y.a)(e,[{key:"loadIpAddress",value:function(e,t,n){var i=n[e];if(void 0!==i&&null!==i)if("string"===typeof i)try{t(Ee(i))}catch(o){return void console.error('error loading property "'.concat(e,'" of configuration: ').concat(o))}else console.error('error loading property "'.concat(e,'": invalid type ').concat(typeof i))}},{key:"loadIpPort",value:function(e,t,n){var i=n[e];if(void 0!==i&&null!==i)if("number"===typeof i)try{t(Me(i))}catch(o){return void console.error('error loading property "'.concat(e,'" of configuration: ').concat(o))}else console.error('error loading property "'.concat(e,'": invalid type ').concat(typeof i))}},{key:"loadNumber",value:function(e,t,n){var i=n[e];if(void 0!==i&&null!==i)if("number"===typeof i)try{t(i)}catch(o){return void console.error('error loading property "'.concat(e,'" of configuration: ').concat(o))}else console.error('error loading property "'.concat(e,'": invalid type ').concat(typeof i))}},{key:"loadString",value:function(e,t,n){var i=n[e];if(void 0!==i&&null!==i)if("string"===typeof i)try{t(i)}catch(o){return void console.error('error loading property "'.concat(e,'" of configuration: ').concat(o))}else console.error('error loading property "'.concat(e,'": invalid type ').concat(typeof i))}}]),e}(),Le=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(){var e;return Object(O.a)(this,n),(e=t.call(this)).ip=void 0,e.port=void 0,e.ip=n.defaultIp,e.port=n.defaultPort,e}return Object(y.a)(n,[{key:"fromJson",value:function(e){this.loadIpAddress("ip",this.setIp.bind(this),e),this.loadIpPort("port",this.setPort.bind(this),e)}},{key:"toJson",value:function(){return{ip:this.ip.toString(),port:this.port.toNumber()}}},{key:"clone",value:function(){var e=new n;return e.fromJson(this.toJson()),e}},{key:"setIp",value:function(e){return"string"===typeof e?e=Ee(e):null===e&&(e=n.defaultIp),this.ip=e,this}},{key:"getIp",value:function(){return this.ip}},{key:"setPort",value:function(e){return"number"===typeof e||"string"===typeof e?e=Me(e):null===e&&(e=n.defaultPort),this.port=e,this}},{key:"getPort",value:function(){return this.port}}]),n}(De);Le.defaultIp=Ee("127.0.0.1"),Le.defaultPort=Me(9910);var Re=Le,_e=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(){var e;return Object(O.a)(this,n),(e=t.call(this)).channelCount=void 0,e.channelNames=void 0,e.tickTime=void 0,e.channelCount=n.defaultChannelCount,e.channelNames=n.defaultChannelNames,e.tickTime=n.defaultTickTime,e}return Object(y.a)(n,[{key:"loadStringArray",value:function(e,t,n){var i=n[e];if(void 0!==i&&null!==i)if("string"===typeof i||function(e){return!!Array.isArray(e)&&e.every((function(e){return"string"===typeof e}))}(i))try{t(i)}catch(o){return void console.error('error loading property "'.concat(e,'" of configuration: ').concat(o))}else console.error('error loading property "'.concat(e,'": invalid type ').concat(typeof i))}},{key:"fromJson",value:function(e){this.loadNumber("channelCount",this.setChannelCount.bind(this),e),this.loadStringArray("channelNames",this.setChannelNames.bind(this),e),this.loadNumber("tickTime",this.setTickTime.bind(this),e)}},{key:"toJson",value:function(){return{channelCount:this.channelCount,channelNames:this.channelNames,tickTime:this.tickTime}}},{key:"clone",value:function(){var e=new n;return e.fromJson(this.toJson()),e}},{key:"setTickTime",value:function(e){var t;if("string"===typeof e&&(e=parseInt(e,10),!Number.isFinite(e)))throw new Error('Could not parse "'.concat(e,'" into a number.'));if((t="number"===typeof e?e:n.defaultTickTime)<=0)throw new Error("tickTime needs to be a positive number, but got ".concat(t));return this.tickTime=t,this}},{key:"getTickTime",value:function(){return this.tickTime}},{key:"setChannelCount",value:function(e){if("string"===typeof e&&(e=parseInt(e,10),!Number.isFinite(e)))throw new Error('Could not parse "'.concat(e,'" into a number.'));if("number"===typeof e){if(e<0)throw new Error("channel count needs to be a positive integer, but got ".concat(e));if(!Number.isInteger(e))throw new Error("channel count needs to be an integer, but got ".concat(e));this.channelCount=e}else null===e&&(this.channelCount=n.defaultChannelCount);return this}},{key:"setChannelNames",value:function(e){return"string"===typeof e?e=e.split(","):null===e&&(e=n.defaultChannelNames),this.channelNames=e.map((function(e){return e.trim()})),this}},{key:"getChannelNames",value:function(){var e=this.getChannels().filter((function(e){return e.name})).map((function(e){return e.name}));return e.toString=function(){return e.join(", ")},e}},{key:"getChannelCount",value:function(){return this.channelCount}},{key:"getChannels",value:function(){var e=this;return Array(this.channelCount).fill(null).map((function(t,n){return new oe((n+1).toString(),e.channelNames[n])}))}}]),n}(De);_e.defaultTickTime=3e3,_e.defaultChannelCount=8,_e.defaultChannelNames=[];var Je=_e,Ae=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(){var e;return Object(O.a)(this,n),(e=t.call(this)).ip=void 0,e.port=void 0,e.liveMode=void 0,e.ip=n.defaultIp,e.port=n.defaultPort,e.liveMode=n.defaultLiveMode,e}return Object(y.a)(n,[{key:"fromJson",value:function(e){this.loadIpAddress("ip",this.setIp.bind(this),e),this.loadIpPort("port",this.setPort.bind(this),e),e.liveMode&&this.setLiveMode(e.liveMode)}},{key:"toJson",value:function(){return{ip:this.ip.toString(),port:this.port.toNumber(),liveMode:this.liveMode}}},{key:"clone",value:function(){var e=new n;return e.fromJson(this.toJson()),e}},{key:"setIp",value:function(e){return"string"===typeof e?e=Ee(e):null===e&&(e=n.defaultIp),this.ip=e,this}},{key:"getIp",value:function(){return this.ip}},{key:"setPort",value:function(e){return"number"===typeof e||"string"===typeof e?e=Me(e):null===e&&(e=n.defaultPort),this.port=e,this}},{key:"getPort",value:function(){return this.port}},{key:"setLiveMode",value:function(e){this.liveMode=e}},{key:"getLiveMode",value:function(){return this.liveMode}}],[{key:"isValidLiveMode",value:function(e){return"always"===e||"streamOrRecord"===e||"stream"===e||"record"===e}}]),n}(De);Ae.defaultIp=Ee("127.0.0.1"),Ae.defaultPort=Me(4444),Ae.defaultLiveMode="always";var He=Ae,Ve=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(){var e;return Object(O.a)(this,n),(e=t.call(this)).requestInterval=void 0,e.requestInterval=n.defaultRequestInterval,e}return Object(y.a)(n,[{key:"fromJson",value:function(e){this.loadNumber("requestInterval",this.setRequestInterval.bind(this),e)}},{key:"toJson",value:function(){return{requestInterval:this.requestInterval}}},{key:"clone",value:function(){var e=new n;return e.fromJson(this.toJson()),e}},{key:"setRequestInterval",value:function(e){if(null===e)e=n.defaultRequestInterval;else if("string"===typeof e&&(e=parseInt(e,10),!Number.isFinite(e)))throw new Error('Could not parse "'.concat(e,'" into a number.'));return this.requestInterval=e,this}},{key:"getRequestInterval",value:function(){return this.requestInterval}}]),n}(De);Ve.defaultRequestInterval=100;var Fe=Ve,We=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(){var e;return Object(O.a)(this,n),(e=t.call(this)).ip=void 0,e.port=void 0,e.requestInterval=void 0,e.ip=n.defaultIp,e.port=n.defaultPort,e.requestInterval=n.defaultRequestInterval,e}return Object(y.a)(n,[{key:"fromJson",value:function(e){this.loadIpAddress("ip",this.setIp.bind(this),e),this.loadIpPort("port",this.setPort.bind(this),e),this.loadNumber("requestInterval",this.setRequestInterval.bind(this),e)}},{key:"toJson",value:function(){return{ip:this.ip.toString(),port:this.port.toNumber(),requestInterval:this.requestInterval}}},{key:"clone",value:function(){var e=new n;return e.fromJson(this.toJson()),e}},{key:"setIp",value:function(e){return"string"===typeof e?e=Ee(e):null===e&&(e=n.defaultIp),this.ip=e,this}},{key:"getIp",value:function(){return this.ip}},{key:"setPort",value:function(e){return"number"===typeof e||"string"===typeof e?e=Me(e):null===e&&(e=n.defaultPort),this.port=e,this}},{key:"getPort",value:function(){return this.port}},{key:"setRequestInterval",value:function(e){if(null===e)e=n.defaultRequestInterval;else if("string"===typeof e&&(e=parseInt(e,10),!Number.isFinite(e)))throw new Error('Could not parse "'.concat(e,'" into a number.'));this.requestInterval=e}},{key:"getRequestInterval",value:function(){return this.requestInterval}}]),n}(De);We.defaultIp=Ee("127.0.0.1"),We.defaultPort=Me(80),We.defaultRequestInterval=250;var Ue=We,ze=function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(){var e;return Object(O.a)(this,n),(e=t.call(this)).ip=void 0,e.port=void 0,e.ip=n.defaultIp,e.port=n.defaultPort,e}return Object(y.a)(n,[{key:"fromJson",value:function(e){this.loadIpAddress("ip",this.setIp.bind(this),e),this.loadIpPort("port",this.setPort.bind(this),e)}},{key:"toJson",value:function(){return{ip:this.ip.toString(),port:this.port.toNumber()}}},{key:"clone",value:function(){var e=new n;return e.fromJson(this.toJson()),e}},{key:"setIp",value:function(e){return"string"===typeof e?e=Ee(e):null===e&&(e=n.defaultIp),this.ip=e,this}},{key:"getIp",value:function(){return this.ip}},{key:"setPort",value:function(e){return"number"===typeof e||"string"===typeof e?e=Me(e):null===e&&(e=n.defaultPort),this.port=e,this}},{key:"getPort",value:function(){return this.port}}]),n}(De);ze.defaultIp=Ee("127.0.0.1"),ze.defaultPort=Me(8099);var qe=ze,Ge=new(function(e){Object(k.a)(n,e);var t=Object(N.a)(n);function n(e){var i;return Object(O.a)(this,n),(i=t.call(this)).allowedMixers=void 0,i.mixerName=void 0,i.atemConfiguration=void 0,i.mockConfiguration=void 0,i.obsConfiguration=void 0,i.rolandV8HDConfiguration=void 0,i.rolandV60HDConfiguration=void 0,i.vmixConfiguration=void 0,i.defaultTallyConfiguration=void 0,e.on("config.state.mixer",(function(e){var t=e.mixerName,n=e.allowedMixers;i.mixerName=t,i.allowedMixers=n,i.emit("mixer",i.mixerName),i.emit("allowedMixers",i.allowedMixers)})),e.on("config.state.atem",(function(e){i.atemConfiguration=new Re,i.atemConfiguration.fromJson(e),i.emit("atem",i.atemConfiguration)})),e.on("config.state.mock",(function(e){i.mockConfiguration=new Je,i.mockConfiguration.fromJson(e),i.emit("mock",i.mockConfiguration)})),e.on("config.state.obs",(function(e){i.obsConfiguration=new He,i.obsConfiguration.fromJson(e),i.emit("obs",i.obsConfiguration)})),e.on("config.state.rolandV8HD",(function(e){i.rolandV8HDConfiguration=new Fe,i.rolandV8HDConfiguration.fromJson(e),i.emit("rolandV8HD",i.rolandV8HDConfiguration)})),e.on("config.state.rolandV60HD",(function(e){i.rolandV60HDConfiguration=new Ue,i.rolandV60HDConfiguration.fromJson(e),i.emit("rolandV60HD",i.rolandV60HDConfiguration)})),e.on("config.state.vmix",(function(e){i.vmixConfiguration=new qe,i.vmixConfiguration.fromJson(e),i.emit("vmix",i.vmixConfiguration)})),e.on("config.state.tallyconfig",(function(e){i.defaultTallyConfiguration=new z,i.defaultTallyConfiguration.fromJson(e),i.emit("tally",i.defaultTallyConfiguration)})),e.emit("events.config.subscribe"),i}return n}(m.EventEmitter))(w);function Ke(){var e=Object(o.useState)(void 0),t=Object(b.a)(e,2),n=t[0],i=t[1];return Object(o.useEffect)((function(){var e=function(e){i(e)};return Ge.on("tally",e),i(Ge.defaultTallyConfiguration),function(){Ge.off("tally",e)}}),[]),n}var Ye=n(13),$e=n(295),Xe=n(271),Qe=Object(E.a)((function(e){return{slider:{padding:e.spacing(2,0,0,0)},sliderDisabled:{"&.MuiSlider-root":{color:Object(Ye.b)(e.palette.common.white,.6)}}}})),Ze=[{value:0},{value:20},{value:40},{value:60},{value:80},{value:100}];var et=function(e){var t=e.value,n=e.testId,a=e.onChange,r=e.minValue,s=e.minMessage,c=e.disabled;r=r||0,c=c||!1;var l=Object(o.useState)(!1),u=Object(b.a)(l,2),d=u[0],h=u[1],g=Qe();return Object(i.jsxs)("div",{className:g.slider,children:[Object(i.jsx)($e.a,{"data-testid":n,value:t,min:0,max:100,marks:Ze,disabled:c,color:"primary",valueLabelDisplay:"auto",valueLabelFormat:function(e){return 0===e?"off":"".concat(e,"%")},onChange:function(e,t){t=Math.max(t,r),a&&a(t)},onFocus:function(){return h(!0)},onBlur:function(){return h(!1)},classes:{disabled:g.sliderDisabled}}),s&&d&&t===r&&Object(i.jsx)(Xe.a,{disabled:!0,children:s})]})},tt=Object(E.a)((function(e){return{root:{padding:e.spacing(0,2),height:e.spacing(4),borderRadius:e.spacing(4)/2,textTransform:"none",fontWeight:"normal",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:"0.8125rem"},contained:{color:e.palette.common.white,backgroundColor:Object(Ye.c)(e.palette.common.white,.25),"&:hover, &:focus, &:active":{backgroundColor:Object(Ye.c)(e.palette.common.white,.4)}},containedPrimary:{color:e.palette.getContrastText(e.palette.primary.main),backgroundColor:e.palette.primary.main,"&:hover, &:focus, &:active":{backgroundColor:Object(Ye.e)(e.palette.primary.main,.25)},"&.Mui-disabled":{backgroundColor:Object(Ye.c)(e.palette.primary.main,.4)}},containedSecondary:{color:e.palette.getContrastText(e.palette.secondary.main),backgroundColor:e.palette.secondary.main,"&:hover, &:focus, &:active":{backgroundColor:Object(Ye.e)(e.palette.secondary.main,.25)},"&.Mui-disabled":{backgroundColor:Object(Ye.c)(e.palette.secondary.main,.4)}}}}));var nt=function(e){var t=tt();return Object(i.jsx)(D.a,Object(H.a)({"data-selected":e.selected,variant:"contained",disableElevation:!0,color:e.selected?"primary":"default",classes:t},e))},it=Object(E.a)((function(e){return{root:{"&:hover $previewContainer":{opacity:1}},selection:{display:"flex",verticalAlign:"center",justifyContent:"space-between"},buttonGroup:{display:"inline-block",marginBottom:e.spacing(1)},button:{marginRight:e.spacing(1)},preview:{padding:e.spacing(1,1.6),display:"inline-block",height:"1em",width:"1em",verticalAlign:"middle",boxSizing:"content-box",border:"solid 1px "+e.palette.background.default,borderRadius:e.shape.borderRadius,"&:not(:last-child)":{borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},"&:not(:first-child)":{borderTopLeftRadius:0,borderBottomLeftRadius:0}},previewContainer:{opacity:1,transition:"opacity .5s"},previewContainerDim:{opacity:0}}}));var ot=function(e){var t=e.value,n=e.onChange,a=e.disabled,r=e.testId,s=it(),c=U.getAll(),l=Object(o.useState)(new Map(c.map((function(e){return[e.id,!1]})))),u=Object(b.a)(l,2),d=u[0],h=u[1],g=!!Array.from(d.values()).find((function(e){return e})),f=void 0!==t?U.getById(t):void 0;return Object(i.jsxs)("div",{className:s.root,"data-testid":r,"data-value":t,children:[Object(i.jsxs)("div",{className:s.selection,children:[Object(i.jsx)("div",{className:s.buttonGroup,children:c.map((function(e){var o=e.id===t;return Object(i.jsx)(nt,{className:s.button,"data-testid":"".concat(r,"-").concat(e.id),"data-value":t,selected:o,onClick:function(){n(e.id)},onFocus:function(){!function(e){var t=new Map(d);t.set(e.id,!0),h(t)}(e)},onBlur:function(){!function(e){var t=new Map(d);t.set(e.id,!1),h(t)}(e)},disabled:a,children:e.name},e.id)}))}),f&&Object(i.jsxs)("div",{className:s.previewContainer+(g?"":" "+s.previewContainerDim),children:[Object(i.jsx)(ve.a,{title:"On-Air color",children:Object(i.jsx)("span",{className:s.preview,style:{backgroundColor:f.program.toCss()}})}),Object(i.jsx)(ve.a,{title:"Preview color",children:Object(i.jsx)("span",{className:s.preview,style:{backgroundColor:f.preview.toCss()}})})]})]}),f&&f.description?Object(i.jsx)(Xe.a,{disabled:!0,children:f.description}):""]})},at=n(34),rt=n(272),st=n(292),ct=n(273),lt=n(52),ut=n(274),dt=n(275),ht=n(133),gt=n.n(ht),ft=Object(E.a)((function(e){return{title:{borderBottom:"1px solid "+e.palette.background.default,display:"flex",justifyContent:"space-between",alignItems:"baseline",paddingRight:e.spacing(1)},content:{overflow:"hidden"},actions:{borderTop:"1px solid "+e.palette.background.default,display:"flex",justifyContent:"space-between"},actionsLeft:{}}}));var vt=function(e){var t=e.label,n=e.onSubmit,o=e.onClose,a=e.isLoading,r=e["data-testid"],s=Object(at.a)(),c=Object(rt.a)(s.breakpoints.down("xs")),l=ft();return Object(i.jsx)(st.a,Object(H.a)(Object(H.a)({fullWidth:!0,fullScreen:c,maxWidth:"sm",scroll:"body"},e),{},{children:Object(i.jsxs)("form",{onSubmit:function(e){e.preventDefault(),n&&n()},children:[Object(i.jsxs)(ct.a,{className:l.title,disableTypography:!0,children:[Object(i.jsx)(lt.a,{variant:"h1",children:t}),Object(i.jsx)(de.a,{"aria-label":"Close Dialog",onClick:o,children:Object(i.jsx)(gt.a,{})})]}),Object(i.jsx)(ut.a,{className:l.content,children:e.children}),Object(i.jsxs)(dt.a,{className:l.actions,children:[Object(i.jsx)(D.a,{onClick:o,color:"default","data-testid":"".concat(r,"-close"),children:"Cancel"}),Object(i.jsx)(D.a,{disabled:a,color:"primary",variant:"contained","data-testid":"".concat(r,"-submit"),type:"submit",children:"Save"})]})]})}))},bt=n(276),pt=Object(E.a)((function(e){return{root:{display:"block",margin:"0 auto"}}}));var jt=function(){var e=pt();return Object(i.jsx)(bt.a,{classes:{root:e.root},color:"inherit"})},mt=Object(E.a)((function(e){return{label:{color:e.palette.common.white},labels:{display:"flex",justifyContent:"space-between",alignItems:"baseline"}}}));var Ot=function(e){var t=e.label,n=e.testId,o=e.isDefault,a=e.children,r=e.className,s=e.onChange,c=mt();return Object(i.jsxs)("div",{className:r,children:[Object(i.jsxs)("div",{className:c.labels,children:[Object(i.jsx)(lt.a,{variant:"h6",paragraph:!0,className:c.label,children:t}),Object(i.jsx)(nt,{"data-testid":"".concat(n,"-toggle"),size:"small",selected:o,onClick:function(){return s(!o)},children:o?"default":"custom"})]}),a]})},yt=Object(E.a)((function(e){return{input:{margin:e.spacing(0,0,2,0)},checkboxLabel:{fontSize:"1em"}}}));var St=function(e){var t=e.tally,n=e.open,a=e.onClose,r=Ke(),s=t.configuration,c=Object(o.useState)(s&&s.getOperatorLightBrightness()),l=Object(b.a)(c,2),u=l[0],d=l[1],h=Object(o.useState)(s&&void 0===s.getOperatorLightBrightness()),g=Object(b.a)(h,2),f=g[0],v=g[1],p=Object(o.useState)(s&&s.getStageLightBrightness()),j=Object(b.a)(p,2),m=j[0],O=j[1],y=Object(o.useState)(s&&void 0===s.getOperatorLightBrightness()),S=Object(b.a)(y,2),x=S[0],C=S[1],I=Object(o.useState)(s?s.getOperatorColorScheme():void 0),k=Object(b.a)(I,2),N=k[0],T=k[1],P=Object(o.useState)(s&&void 0===s.getOperatorColorScheme()),E=Object(b.a)(P,2),B=E[0],M=E[1],D=Object(o.useState)(s?s.getStageColorScheme():void 0),L=Object(b.a)(D,2),R=L[0],_=L[1],J=Object(o.useState)(s&&void 0===s.getStageColorScheme()),A=Object(b.a)(J,2),H=A[0],V=A[1],F=Object(o.useState)(s?s.getStageShowsPreview():void 0),W=Object(b.a)(F,2),U=W[0],q=W[1],G=Object(o.useState)(s&&void 0===s.getStageShowsPreview()),K=Object(b.a)(G,2),Y=K[0],$=K[1],X=Object(o.useState)(s?s.getOperatorShowsIdle():void 0),Q=Object(b.a)(X,2),Z=Q[0],ee=Q[1],te=Object(o.useState)(s&&void 0===s.getOperatorShowsIdle()),ne=Object(b.a)(te,2),ie=ne[0],oe=ne[1];Object(o.useMemo)((function(){r&&(f&&d(r.getOperatorLightBrightness()),x&&O(r.getStageLightBrightness()),B&&T(r.getOperatorColorScheme()),H&&_(r.getStageColorScheme()),Y&&q(r.getStageShowsPreview()),ie&&ee(r.getOperatorShowsIdle()))}),[r,f,x,B,H,Y,ie]),Object(o.useMemo)((function(){if(s){var e=void 0===s.getOperatorLightBrightness(),t=void 0===s.getStageLightBrightness(),n=void 0===s.getOperatorColorScheme(),i=void 0===s.getStageColorScheme(),o=void 0===s.getStageShowsPreview(),a=void 0===s.getOperatorShowsIdle();v(e),C(t),M(n),V(i),$(o),oe(a),e||d(s.getOperatorLightBrightness()),t||O(s.getStageLightBrightness()),n||T(s.getOperatorColorScheme()),i||_(s.getStageColorScheme()),o||q(s.getStageShowsPreview()),a||ee(s.getOperatorShowsIdle())}}),[s]);var ae=!r||!t,re=yt();return Object(i.jsx)(vt,{"data-testid":"tally-settings",open:n,onClose:a,onSubmit:function(){if(t){var e=t.configuration;e.setOperatorLightBrightness(f?void 0:u),e.setOperatorColorScheme(B?void 0:N),e.setStageLightBrightness(!t.hasStageLight||x?void 0:m),e.setStageColorScheme(!t.hasStageLight||H?void 0:R),e.setStageShowsPreview(!t.hasStageLight||Y?void 0:U),e.setOperatorShowsIdle(ie?void 0:Z),w.emit("tally.settings",t.name,t.type,e.toJson()),a&&a()}},label:"".concat(t.name," Settings"),children:ae?Object(i.jsx)(jt,{}):Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)(Ot,{label:"Operator Light Brightness",isDefault:f,onChange:v,testId:"tally-settings-ob",className:re.input,children:Object(i.jsx)(et,{testId:"tally-settings-ob",disabled:f,minValue:z.minOperatorLightBrightness,minMessage:"Operator Light can not be turned off.",value:f?r.getOperatorLightBrightness():u,onChange:function(e){d(e)}})}),Object(i.jsx)(Ot,{label:"Operator Light Colors",isDefault:B,onChange:M,testId:"tally-settings-oc",className:re.input,children:Object(i.jsx)(ot,{testId:"tally-settings-oc",value:N,onChange:function(e){T(e)},disabled:B})}),Object(i.jsx)(Ot,{label:"Operator Display",isDefault:ie,onChange:oe,testId:"tally-settings-oi",className:re.input,children:Object(i.jsx)(Ne.a,{classes:{label:re.checkboxLabel},control:Object(i.jsx)(Te.a,{"data-testid":"tally-settings-oi","data-value":ie?r.getOperatorShowsIdle():Z,checked:ie?r.getOperatorShowsIdle():Z,disabled:ie,color:"primary",onChange:function(e){ee(e.target.checked)},size:"small"}),label:"Shows Idle State"})}),t.hasStageLight&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)(Ot,{label:"Stage Light Brightness",isDefault:x,onChange:C,testId:"tally-settings-sb",className:re.input,children:Object(i.jsx)(et,{testId:"tally-settings-sb",disabled:x,value:x?r.getStageLightBrightness():m,onChange:function(e){O(e)}})}),Object(i.jsx)(Ot,{label:"Stage Light Colors",isDefault:H,onChange:V,testId:"tally-settings-sc",className:re.input,children:Object(i.jsx)(ot,{testId:"tally-settings-sc",value:R,onChange:function(e){_(e)},disabled:H})}),Object(i.jsx)(Ot,{label:"Stage Display",isDefault:Y,onChange:$,testId:"tally-settings-sp",className:re.input,children:Object(i.jsx)(Ne.a,{classes:{label:re.checkboxLabel},control:Object(i.jsx)(Te.a,{"data-testid":"tally-settings-sp","data-value":Y?r.getStageShowsPreview():U,checked:Y?r.getStageShowsPreview():U,disabled:Y,color:"primary",onChange:function(e){q(e.target.checked)},size:"small"}),label:"Shows Preview State"})})]})]})})};function xt(e){var t=e.children,n=e.to,o=e.testid,r=a.a.useMemo((function(){return a.a.forwardRef((function(e,t){return Object(i.jsx)(f.b,Object(H.a)({to:n,ref:t},e))}))}),[n]);return Object(i.jsx)("li",{children:Object(i.jsx)(ue.a,{"data-testid":o,component:r,children:t})})}var wt=function(e){var t=e.tally,n=e.className,a=Object(o.useState)(null),r=Object(b.a)(a,2),s=r[0],c=r[1],l=Object(o.useState)(!1),u=Object(b.a)(l,2),d=u[0],h=u[1],g=t.isActive(),f=!t.isConnected(),v=function(){c(null)};return Object(i.jsxs)("div",{"data-testid":"tally-".concat(t.name,"-menu"),className:n,children:[Object(i.jsx)(de.a,{size:"small",title:"".concat(t.name," Menu"),"aria-controls":"menu","aria-haspopup":"true",onClick:function(e){c(e.currentTarget)},children:Object(i.jsx)(xe.a,{})}),Object(i.jsxs)(he.a,{id:"menu",anchorEl:s,keepMounted:!0,open:Boolean(s),onClose:v,children:[t.isWebTally()&&Object(i.jsxs)(xt,{testid:"tally-".concat(t.name,"-web"),to:"/tally/".concat(t.getId()),children:[Object(i.jsx)(ge.a,{children:Object(i.jsx)(Ce.a,{fontSize:"small"})}),Object(i.jsx)(fe.a,{children:"Connect"})]}),Object(i.jsxs)(ue.a,{"data-testid":"tally-".concat(t.name,"-settings"),onClick:function(){v(),h(!0)},children:[Object(i.jsx)(ge.a,{children:Object(i.jsx)(ke.a,{fontSize:"small"})}),Object(i.jsx)(fe.a,{children:"Settings"})]}),Object(i.jsx)(St,{tally:t,open:d,onClose:function(){return h(!1)}}),Object(i.jsxs)(xt,{testid:"tally-".concat(t.name,"-logs"),to:"/tally/".concat(t.getId(),"/log"),children:[Object(i.jsx)(ge.a,{children:Object(i.jsx)(pe.a,{fontSize:"small"})}),Object(i.jsx)(fe.a,{children:"Logs"})]}),Object(i.jsx)(ve.a,{"data-testid":"tally-".concat(t.name,"-highlight"),title:g?"":"Tally is not connected",children:Object(i.jsx)("div",{children:Object(i.jsxs)(ue.a,{component:"div",disabled:!g,onClick:function(e){e.preventDefault(),g&&(w.emit("tally.highlight",t.name,t.type),v())},children:[Object(i.jsx)(ge.a,{children:Object(i.jsx)(ye.a,{fontSize:"small"})}),Object(i.jsx)(fe.a,{children:"Highlight"})]})})}),Object(i.jsx)(ve.a,{"data-testid":"tally-".concat(t.name,"-remove"),title:f?"":"Connected Tallies can not be removed",children:Object(i.jsx)("div",{children:Object(i.jsxs)(ue.a,{disabled:!f,onClick:function(e){e.preventDefault(),f&&(w.emit("tally.remove",t.name,t.type),v())},children:[Object(i.jsx)(ge.a,{children:Object(i.jsx)(me.a,{fontSize:"small"})}),Object(i.jsx)(fe.a,{children:"Remove"})]})})})]})]})},Ct=Object(E.a)((function(e){return{tally:{border:"solid 1px "+e.palette.grey[800],width:"250px",margin:e.spacing(1),backgroundColor:e.palette.grey[700],overflow:"hidden"},borderInPreview:{borderColor:e.palette.success.main},borderInProgram:{borderColor:e.palette.error.main},borderUnpatched:{borderColor:e.palette.grey[500]},bgInPreview:{backgroundColor:e.palette.success.main},bgInProgram:{backgroundColor:e.palette.error.main},bgUnpatched:{backgroundColor:e.palette.grey[500]},tallyHead:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e.spacing(1,1,1,2),borderBottom:"1px solid "+e.palette.grey[800]},tallyHeadTitle:{},tallyHeadIcon:{},tallyBody:{padding:e.spacing(2)},tallyFoot:{padding:e.spacing(1,2),borderTop:"1px solid "+e.palette.grey[800],fontSize:"0.75rem",display:"flex",justifyContent:"space-between",width:"100%",textTransform:"uppercase",fontWeight:"bold"},tallyFootMissing:{backgroundColor:e.palette.warning.main,color:e.palette.getContrastText(e.palette.warning.main)},tallyFootItem:{textAlign:"center",flexGrow:1}}}));var It=function(e){var t=e.tally,n=e.className,o=re(),a=ce(),r=Object(b.a)(a,2),s=r[0],c=r[1],l=Ct(),u=[];n&&u.push(n),u.push(l.tally);var d=[l.tallyHead],h="idle",g=!1;return t.isPatched()?s&&t.isIn(s)?(u.push(l.borderInProgram),h="program"):c&&t.isIn(c)&&(u.push(l.borderInPreview),h="preview"):(u.push(l.borderUnpatched),h="unpatched"),t.isActive()&&(g=!0,t.isPatched()?s&&t.isIn(s)?d.push(l.bgInProgram):c&&t.isIn(c)&&d.push(l.bgInPreview):d.push(l.bgUnpatched)),Object(i.jsx)(i.Fragment,{children:Object(i.jsxs)(le.a,{"data-color":h,"data-isactive":g,className:u.join(" "),"data-testid":"tally-".concat(t.name),children:[Object(i.jsx)("div",{className:d.join(" "),children:Object(i.jsxs)(i.Fragment,{children:[Object(i.jsx)("div",{className:l.tallyHeadTitle,children:t.name}),Object(i.jsx)(wt,{className:l.tallyHeadIcon,tally:t})]})}),Object(i.jsx)("div",{className:l.tallyBody,children:Object(i.jsx)(ne,{value:t.channelId,channels:o,onChange:function(e){return function(e,t){w.emit("tally.patch",e.name,e.type,t)}(t,e)}})}),Object(i.jsxs)("div",{className:l.tallyFoot+(t.isActive()&&t.isMissing()?" "+l.tallyFootMissing:""),children:[Object(i.jsx)("div",{className:l.tallyFootItem,children:t.isActive()?t.isMissing()?"missing":"connected":"disconnected"}),t.isUdpTally()&&t.address&&t.port&&Object(i.jsxs)("div",{className:l.tallyFootItem,children:[t.address,":",t.port]})]})]})})},kt=n(280),Nt=n(286),Tt=n(139),Pt=n.n(Tt),Et=n(141),Bt=n.n(Et),Mt=n(140),Dt=n.n(Mt),Lt=n(287),Rt=n(281),_t=n(290),Jt=Object(E.a)((function(e){return{root:{display:"flex",alignItems:"center",justifyContent:"center",border:"dashed 1px "+e.palette.grey[700],width:"250px",margin:e.spacing(1),padding:e.spacing(2),overflow:"hidden",background:"transparent"},alert:{marginBottom:e.spacing(2)},formWrapper:{margin:"0 auto",maxWidth:"250px"},mb:{marginBottom:e.spacing(2)}}}));function At(e){var t=e.classes,n=e.open,a=e.onClose,r=re(),s=Z(),c=Object(o.useState)(void 0),l=Object(b.a)(c,2),u=l[0],d=l[1],h=Object(o.useState)(""),g=Object(b.a)(h,2),f=g[0],v=g[1],p=!!(null===s||void 0===s?void 0:s.find((function(e){return e.isUdpTally()}))),j="";return""===f?j="Please enter a name":f.length>26?j="name must not be longer than ".concat(26," characters"):(null===s||void 0===s?void 0:s.find((function(e){return e.name===f})))&&(j="a tally with the name ".concat(f," already exists")),Object(i.jsxs)(st.a,{"data-testid":"tally-create-popup",maxWidth:"xs",open:n,onClose:a,children:[Object(i.jsx)(ct.a,{children:"Create Web Tally"}),Object(i.jsxs)(ut.a,{children:[p?"":Object(i.jsx)(Lt.a,{className:t.alert,severity:"warning",variant:"outlined","data-testid":"tally-create-warning",children:"Hardware-Tallies, based on ESP8266, will automatically register and should not be created via this form."}),Object(i.jsx)(lt.a,{paragraph:!0,children:"A Web Tally, that can be viewed in any browser."}),Object(i.jsxs)("div",{className:t.formWrapper,children:[Object(i.jsx)(_t.a,{className:t.mb,"data-testid":"tally-create-name",label:"Name",value:f,onChange:function(e){return v(e.target.value)},autoFocus:!0}),Object(i.jsx)(ne,{value:u,channels:r,onChange:d})]}),Object(i.jsxs)(dt.a,{children:[Object(i.jsx)(D.a,{onClick:a,color:"default","data-testid":"tally-create-cancel",children:"Cancel"}),Object(i.jsx)(ve.a,{title:j,children:Object(i.jsx)("div",{children:Object(i.jsx)(D.a,{disabled:!!j,color:"primary",variant:"contained","data-testid":"tally-create-ok",onClick:function(){console.log(u),function(e,t){w.emit("tally.create",e,t||void 0)}(f,u),a()},children:"Create"})})})]})]})]})}var Ht=function(){var e=Jt(),t=Object(o.useState)(!1),n=Object(b.a)(t,2),a=n[0],r=n[1];return Object(i.jsxs)(le.a,{variant:"outlined",className:e.root,children:[Object(i.jsx)(D.a,{onClick:function(){return r(!0)},"data-testid":"tally-create",children:"Create Web Tally"}),Object(i.jsx)(At,{open:a,onClose:function(){return r(!1)},classes:e})]})},Vt=Object(E.a)((function(e){return{buttons:{display:"block",marginBottom:e.spacing(2)},button:{textTransform:"none"},buttonIcon:{marginRight:e.spacing(1)},alert:{marginBottom:e.spacing(2)}}})),Ft=function(){var e=Z(),t=Object(o.useState)(!0),n=Object(b.a)(t,2),a=n[0],r=n[1],s=Object(o.useState)(!0),c=Object(b.a)(s,2),l=c[0],u=c[1],d=P(),h=I(),g=Vt(),f=function(e,t,n){return e?e.filter((function(e){return(e.isActive()||t)&&(e.isPatched()||n)})).sort((function(e,t){return e.isActive()!==t.isActive()?e.isActive()?-1:1:e.name.localeCompare(t.name)})):null}(e,a,l),v=function(e){return e?e.reduce((function(e,t){return e+(X.fromJson(t).isConnected()?1:0)}),0):null}(f);return Object(i.jsxs)(_,{testId:"index",children:[Object(i.jsx)("div",{className:g.buttons,children:Object(i.jsxs)(kt.a,{size:"small",variant:"contained",children:[Object(i.jsx)(D.a,{"data-testid":"toggle-disconnected",className:g.button,color:a?"primary":"default",onClick:function(e){r(!a)},children:"Show Disconnected"}),Object(i.jsx)(D.a,{"data-testid":"toggle-unpatched",className:g.button,color:l?"primary":"default",onClick:function(e){u(!l)},children:"Show Unpatched"}),Object(i.jsx)(ve.a,{title:"Hub "+(h?"connected":"disconnected"),children:Object(i.jsxs)(D.a,{"data-testid":"hub-connected",className:g.button,color:"default",variant:"outlined",children:[Object(i.jsx)(Pt.a,{className:g.buttonIcon})," ",h?1:0]})}),Object(i.jsx)(ve.a,{title:"Video Mixer "+(d?"connected":"disconnected"),children:Object(i.jsxs)(D.a,{"data-testid":"mixer-connected",className:g.button,color:"default",variant:"outlined",children:[Object(i.jsx)(Dt.a,{className:g.buttonIcon})," ",d?1:0]})}),Object(i.jsx)(ve.a,{title:v+" connected tallies",children:Object(i.jsxs)(D.a,{"data-testid":"tallies-connected",className:g.button,color:"default",variant:"outlined",children:[Object(i.jsx)(Bt.a,{className:g.buttonIcon})," ",null===v?"?":v]})})]})}),h?"":Object(i.jsxs)(Lt.a,{severity:"error",className:g.alert,children:[Object(i.jsx)(Rt.a,{children:"Hub disconnected"}),Object(i.jsx)(lt.a,{paragraph:!0,children:"The displayed information might be outdated."}),Object(i.jsx)(lt.a,{children:"We will try to reconnect automatically, but you might also try to reload the page."})]}),Object(i.jsx)(Nt.a,{display:"flex",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"stretch",alignContent:"flex-start",children:Object(i.jsxs)(i.Fragment,{children:[f?f.map((function(e){return Object(i.jsx)(It,{tally:e},e