(self.webpackChunksvelte_app=self.webpackChunksvelte_app||[]).push([[158],{872:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>z});var $=n(379),o=n(400),r=n(271),c=n(796),s=n(731);function a(e){let t,n,o,r=e[6](e[0])+"";return{c(){t=(0,$.fL)(e[3]),n=(0,$.Dh)(),o=(0,$.fL)(r)},m(e,r){(0,$.$T)(e,t,r),(0,$.$T)(e,n,r),(0,$.$T)(e,o,r)},p(e,n){8&n&&(0,$.rT)(t,e[3]),1&n&&r!==(r=e[6](e[0])+"")&&(0,$.rT)(o,r)},d(e){e&&(0,$.og)(t),e&&(0,$.og)(n),e&&(0,$.og)(o)}}}function i(e){let t;return{c(){t=(0,$.fL)("Message")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function l(e){let t;return{c(){t=(0,$.fL)("👍")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function f(e){let t;return{c(){t=(0,$.fL)("👎")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function p(e){let t;return{c(){t=(0,$.fL)("🔎 +")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function g(e){let t;return{c(){t=(0,$.fL)("🔎 -")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function u(e){let t;return{c(){t=(0,$.fL)("⬅️")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function m(e){let t;return{c(){t=(0,$.fL)("➡️")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function d(e){let t,n,o,c,s,a,i,d,v,y,x,h;return t=new r.zx({props:{color:"success",$$slots:{default:[l]},$$scope:{ctx:e}}}),t.$on("click",e[8]),o=new r.zx({props:{color:"danger",$$slots:{default:[f]},$$scope:{ctx:e}}}),o.$on("click",e[9]),s=new r.zx({props:{color:"warning",$$slots:{default:[p]},$$scope:{ctx:e}}}),s.$on("click",e[10]),i=new r.zx({props:{color:"warning",$$slots:{default:[g]},$$scope:{ctx:e}}}),i.$on("click",e[11]),v=new r.zx({props:{color:"warning",$$slots:{default:[u]},$$scope:{ctx:e}}}),v.$on("click",e[12]),x=new r.zx({props:{color:"warning",$$slots:{default:[m]},$$scope:{ctx:e}}}),x.$on("click",e[13]),{c(){(0,$.YC)(t.$$.fragment),n=(0,$.Dh)(),(0,$.YC)(o.$$.fragment),c=(0,$.Dh)(),(0,$.YC)(s.$$.fragment),a=(0,$.Dh)(),(0,$.YC)(i.$$.fragment),d=(0,$.Dh)(),(0,$.YC)(v.$$.fragment),y=(0,$.Dh)(),(0,$.YC)(x.$$.fragment)},m(e,r){(0,$.ye)(t,e,r),(0,$.$T)(e,n,r),(0,$.ye)(o,e,r),(0,$.$T)(e,c,r),(0,$.ye)(s,e,r),(0,$.$T)(e,a,r),(0,$.ye)(i,e,r),(0,$.$T)(e,d,r),(0,$.ye)(v,e,r),(0,$.$T)(e,y,r),(0,$.ye)(x,e,r),h=!0},p(e,n){const $={};524288&n&&($.$$scope={dirty:n,ctx:e}),t.$set($);const r={};524288&n&&(r.$$scope={dirty:n,ctx:e}),o.$set(r);const c={};524288&n&&(c.$$scope={dirty:n,ctx:e}),s.$set(c);const a={};524288&n&&(a.$$scope={dirty:n,ctx:e}),i.$set(a);const l={};524288&n&&(l.$$scope={dirty:n,ctx:e}),v.$set(l);const f={};524288&n&&(f.$$scope={dirty:n,ctx:e}),x.$set(f)},i(e){h||((0,$.Ui)(t.$$.fragment,e),(0,$.Ui)(o.$$.fragment,e),(0,$.Ui)(s.$$.fragment,e),(0,$.Ui)(i.$$.fragment,e),(0,$.Ui)(v.$$.fragment,e),(0,$.Ui)(x.$$.fragment,e),h=!0)},o(e){(0,$.et)(t.$$.fragment,e),(0,$.et)(o.$$.fragment,e),(0,$.et)(s.$$.fragment,e),(0,$.et)(i.$$.fragment,e),(0,$.et)(v.$$.fragment,e),(0,$.et)(x.$$.fragment,e),h=!1},d(e){(0,$.vp)(t,e),e&&(0,$.og)(n),(0,$.vp)(o,e),e&&(0,$.og)(c),(0,$.vp)(s,e),e&&(0,$.og)(a),(0,$.vp)(i,e),e&&(0,$.og)(d),(0,$.vp)(v,e),e&&(0,$.og)(y),(0,$.vp)(x,e)}}}function v(e){let t,n,o,c;function s(t){e[15](t)}let a={addon:!0,type:"number"};return void 0!==e[2]&&(a.value=e[2]),n=new r.II({props:a}),$.Vn.push((()=>(0,$.ak)(n,"value",s))),n.$on("keypress",e[7]),{c(){t=(0,$.bG)("div"),(0,$.YC)(n.$$.fragment),(0,$.Lj)(t,"class","limit-width svelte-12368im")},m(e,o){(0,$.$T)(e,t,o),(0,$.ye)(n,t,null),c=!0},p(e,t){const r={};!o&&4&t&&(o=!0,r.value=e[2],(0,$.hj)((()=>o=!1))),n.$set(r)},i(e){c||((0,$.Ui)(n.$$.fragment,e),c=!0)},o(e){(0,$.et)(n.$$.fragment,e),c=!1},d(e){e&&(0,$.og)(t),(0,$.vp)(n)}}}function y(e){let t,n;return t=new r.O3({props:{$$slots:{default:[v]},$$scope:{ctx:e}}}),{c(){(0,$.YC)(t.$$.fragment)},m(e,o){(0,$.ye)(t,e,o),n=!0},p(e,n){const $={};524292&n&&($.$$scope={dirty:n,ctx:e}),t.$set($)},i(e){n||((0,$.Ui)(t.$$.fragment,e),n=!0)},o(e){(0,$.et)(t.$$.fragment,e),n=!1},d(e){(0,$.vp)(t,e)}}}function x(e){let t,n,o,c,s;function a(t){e[14](t)}let i={};return void 0!==e[1]&&(i.value=e[1]),t=new r.II({props:i}),$.Vn.push((()=>(0,$.ak)(t,"value",a))),t.$on("keypress",e[7]),c=new r.wF({props:{addonType:"append",$$slots:{default:[y]},$$scope:{ctx:e}}}),{c(){(0,$.YC)(t.$$.fragment),o=(0,$.Dh)(),(0,$.YC)(c.$$.fragment)},m(e,n){(0,$.ye)(t,e,n),(0,$.$T)(e,o,n),(0,$.ye)(c,e,n),s=!0},p(e,o){const r={};!n&&2&o&&(n=!0,r.value=e[1],(0,$.hj)((()=>n=!1))),t.$set(r);const s={};524292&o&&(s.$$scope={dirty:o,ctx:e}),c.$set(s)},i(e){s||((0,$.Ui)(t.$$.fragment,e),(0,$.Ui)(c.$$.fragment,e),s=!0)},o(e){(0,$.et)(t.$$.fragment,e),(0,$.et)(c.$$.fragment,e),s=!1},d(e){(0,$.vp)(t,e),e&&(0,$.og)(o),(0,$.vp)(c,e)}}}function h(e){let t;return{c(){t=(0,$.fL)("Send")},m(e,n){(0,$.$T)(e,t,n)},d(e){e&&(0,$.og)(t)}}}function w(e){let t,n,o,c,s,a,l,f,p,g;return t=new r.__({props:{$$slots:{default:[i]},$$scope:{ctx:e}}}),c=new r.hE({props:{$$slots:{default:[d]},$$scope:{ctx:e}}}),l=new r.BZ({props:{$$slots:{default:[x]},$$scope:{ctx:e}}}),p=new r.zx({props:{$$slots:{default:[h]},$$scope:{ctx:e}}}),p.$on("click",e[16]),{c(){(0,$.YC)(t.$$.fragment),n=(0,$.Dh)(),o=(0,$.bG)("div"),(0,$.YC)(c.$$.fragment),s=(0,$.Dh)(),a=(0,$.bG)("div"),(0,$.YC)(l.$$.fragment),f=(0,$.Dh)(),(0,$.YC)(p.$$.fragment),(0,$.Lj)(o,"class","mb-2 mt-2")},m(e,r){(0,$.ye)(t,e,r),(0,$.$T)(e,n,r),(0,$.$T)(e,o,r),(0,$.ye)(c,o,null),(0,$.$T)(e,s,r),(0,$.$T)(e,a,r),(0,$.ye)(l,a,null),(0,$.R3)(a,f),(0,$.ye)(p,a,null),g=!0},p(e,n){const $={};524288&n&&($.$$scope={dirty:n,ctx:e}),t.$set($);const o={};524288&n&&(o.$$scope={dirty:n,ctx:e}),c.$set(o);const r={};524294&n&&(r.$$scope={dirty:n,ctx:e}),l.$set(r);const s={};524288&n&&(s.$$scope={dirty:n,ctx:e}),p.$set(s)},i(e){g||((0,$.Ui)(t.$$.fragment,e),(0,$.Ui)(c.$$.fragment,e),(0,$.Ui)(l.$$.fragment,e),(0,$.Ui)(p.$$.fragment,e),g=!0)},o(e){(0,$.et)(t.$$.fragment,e),(0,$.et)(c.$$.fragment,e),(0,$.et)(l.$$.fragment,e),(0,$.et)(p.$$.fragment,e),g=!1},d(e){(0,$.vp)(t,e),e&&(0,$.og)(n),e&&(0,$.og)(o),(0,$.vp)(c),e&&(0,$.og)(s),e&&(0,$.og)(a),(0,$.vp)(l),(0,$.vp)(p)}}}function T(e){let t,n,o,c;return t=new r.Ol({props:{$$slots:{default:[a]},$$scope:{ctx:e}}}),o=new r.eW({props:{$$slots:{default:[w]},$$scope:{ctx:e}}}),{c(){(0,$.YC)(t.$$.fragment),n=(0,$.Dh)(),(0,$.YC)(o.$$.fragment)},m(e,r){(0,$.ye)(t,e,r),(0,$.$T)(e,n,r),(0,$.ye)(o,e,r),c=!0},p(e,n){const $={};524297&n&&($.$$scope={dirty:n,ctx:e}),t.$set($);const r={};524294&n&&(r.$$scope={dirty:n,ctx:e}),o.$set(r)},i(e){c||((0,$.Ui)(t.$$.fragment,e),(0,$.Ui)(o.$$.fragment,e),c=!0)},o(e){(0,$.et)(t.$$.fragment,e),(0,$.et)(o.$$.fragment,e),c=!1},d(e){(0,$.vp)(t,e),e&&(0,$.og)(n),(0,$.vp)(o,e)}}}function C(e){let t,n,o;return n=new r.Zb({props:{color:e[4],inverse:!0,$$slots:{default:[T]},$$scope:{ctx:e}}}),{c(){t=(0,$.bG)("main"),(0,$.YC)(n.$$.fragment)},m(e,r){(0,$.$T)(e,t,r),(0,$.ye)(n,t,null),o=!0},p(e,[t]){const $={};16&t&&($.color=e[4]),524303&t&&($.$$scope={dirty:t,ctx:e}),n.$set($)},i(e){o||((0,$.Ui)(n.$$.fragment,e),o=!0)},o(e){(0,$.et)(n.$$.fragment,e),o=!1},d(e){e&&(0,$.og)(t),(0,$.vp)(n)}}}function U(e,t,n){let $,{camera_id:r}=t,a="4",i="⚫",l="dark";const f=s.D.subscribe((e=>{if((0,c.V)(e)){if(r<=0)return void n(3,i="📢");if(e.air===r)return n(3,i="🔴"),void n(4,l="danger");if(e.preview===r)return n(4,l="success"),void n(3,i="🟢");n(4,l="dark"),n(3,i="⚫")}}));(0,o.ev)(f);const p=(e,t,n)=>{const $={color:n,timeout:t,text:e},o={topic:"atem",message:JSON.stringify($)};r>0&&(o.camera_id=r),fetch("/api/publish",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)}).then((t=>{e=void 0}))};return e.$$set=e=>{"camera_id"in e&&n(0,r=e.camera_id)},[r,$,a,i,l,p,e=>e>0?e:"Broadcast",e=>{13===e.charCode&&p($,parseInt(a),"info")},()=>p("👍",7,"success"),()=>p("👎",7,"danger"),()=>p("🔎 +",7,"warning"),()=>p("🔎 -",7,"warning"),()=>p("⬅️",7,"warning"),()=>p("➡️",7,"warning"),function(e){$=e,n(1,$)},function(e){a=e,n(2,a)},()=>p($,parseInt(a),"info")]}class b extends $.f_{constructor(e){super(),(0,$.S1)(this,e,U,C,$.N8,{camera_id:0})}}const Y=b;function k(e,t,n){const $=e.slice();return $[0]=t[n],$[2]=n,$}function D(e){let t,n,o,r;var c=Y;function s(e){return{props:{camera_id:e[2]+1}}}return c&&(n=new c(s(e))),{c(){t=(0,$.bG)("div"),n&&(0,$.YC)(n.$$.fragment),o=(0,$.Dh)(),(0,$.Lj)(t,"class","m-2")},m(e,c){(0,$.$T)(e,t,c),n&&(0,$.ye)(n,t,null),(0,$.$T)(e,o,c),r=!0},p(e,o){if(c!==(c=Y)){if(n){(0,$.dv)();const e=n;(0,$.et)(e.$$.fragment,1,0,(()=>{(0,$.vp)(e,1)})),(0,$.gb)()}c?(n=new c(s(e)),(0,$.YC)(n.$$.fragment),(0,$.Ui)(n.$$.fragment,1),(0,$.ye)(n,t,null)):n=null}},i(e){r||(n&&(0,$.Ui)(n.$$.fragment,e),r=!0)},o(e){n&&(0,$.et)(n.$$.fragment,e),r=!1},d(e){e&&(0,$.og)(t),n&&(0,$.vp)(n),e&&(0,$.og)(o)}}}function _(e){let t,n;return t=new r.JX({props:{xs:"12",sm:"6",lg:"4",$$slots:{default:[D]},$$scope:{ctx:e}}}),{c(){(0,$.YC)(t.$$.fragment)},m(e,o){(0,$.ye)(t,e,o),n=!0},p(e,n){const $={};8&n&&($.$$scope={dirty:n,ctx:e}),t.$set($)},i(e){n||((0,$.Ui)(t.$$.fragment,e),n=!0)},o(e){(0,$.et)(t.$$.fragment,e),n=!1},d(e){(0,$.vp)(t,e)}}}function L(e){let t,n,o={length:8},r=[];for(let t=0;t<o.length;t+=1)r[t]=_(k(e,o,t));const c=e=>(0,$.et)(r[e],1,1,(()=>{r[e]=null}));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=(0,$.cS)()},m(e,o){for(let t=0;t<r.length;t+=1)r[t].m(e,o);(0,$.$T)(e,t,o),n=!0},p(e,n){if(0&n){let s;for(o={length:8},s=0;s<o.length;s+=1){const c=k(e,o,s);r[s]?(r[s].p(c,n),(0,$.Ui)(r[s],1)):(r[s]=_(c),r[s].c(),(0,$.Ui)(r[s],1),r[s].m(t.parentNode,t))}for((0,$.dv)(),s=o.length;s<r.length;s+=1)c(s);(0,$.gb)()}},i(e){if(!n){for(let e=0;e<o.length;e+=1)(0,$.Ui)(r[e]);n=!0}},o(e){r=r.filter(Boolean);for(let e=0;e<r.length;e+=1)(0,$.et)(r[e]);n=!1},d(e){(0,$.RM)(r,e),e&&(0,$.og)(t)}}}function j(e){let t,n,o,c,s;var a=Y;return a&&(n=new a({props:{camera_id:"0"}})),c=new r.X2({props:{$$slots:{default:[L]},$$scope:{ctx:e}}}),{c(){t=(0,$.bG)("div"),n&&(0,$.YC)(n.$$.fragment),o=(0,$.Dh)(),(0,$.YC)(c.$$.fragment),(0,$.Lj)(t,"class","m-2")},m(e,r){(0,$.$T)(e,t,r),n&&(0,$.ye)(n,t,null),(0,$.$T)(e,o,r),(0,$.ye)(c,e,r),s=!0},p(e,o){if(a!==(a=Y)){if(n){(0,$.dv)();const e=n;(0,$.et)(e.$$.fragment,1,0,(()=>{(0,$.vp)(e,1)})),(0,$.gb)()}a?(n=new a({props:{camera_id:"0"}}),(0,$.YC)(n.$$.fragment),(0,$.Ui)(n.$$.fragment,1),(0,$.ye)(n,t,null)):n=null}const r={};8&o&&(r.$$scope={dirty:o,ctx:e}),c.$set(r)},i(e){s||(n&&(0,$.Ui)(n.$$.fragment,e),(0,$.Ui)(c.$$.fragment,e),s=!0)},o(e){n&&(0,$.et)(n.$$.fragment,e),(0,$.et)(c.$$.fragment,e),s=!1},d(e){e&&(0,$.og)(t),n&&(0,$.vp)(n),e&&(0,$.og)(o),(0,$.vp)(c,e)}}}function S(e){let t,n,o;return n=new r.W2({props:{$$slots:{default:[j]},$$scope:{ctx:e}}}),{c(){t=(0,$.bG)("main"),(0,$.YC)(n.$$.fragment)},m(e,r){(0,$.$T)(e,t,r),(0,$.ye)(n,t,null),o=!0},p(e,[t]){const $={};8&t&&($.$$scope={dirty:t,ctx:e}),n.$set($)},i(e){o||((0,$.Ui)(n.$$.fragment,e),o=!0)},o(e){(0,$.et)(n.$$.fragment,e),o=!1},d(e){e&&(0,$.og)(t),(0,$.vp)(n)}}}function O(e){return(0,o.H3)((()=>{s.a.set(1)})),[]}class N extends $.f_{constructor(e){super(),(0,$.S1)(this,e,O,S,$.N8,{})}}const z=N},796:(e,t,n)=>{"use strict";n.d(t,{V:()=>$});let $=e=>null!=e&&void 0!==e.preview&&void 0!==e.air},731:(e,t,n)=>{"use strict";n.d(t,{a:()=>o,D:()=>r});var $=n(120);const o=(0,$.fZ)(10),r=(0,$.fZ)({});let c,s;o.subscribe((e=>{return t=e,clearTimeout(s),void(s=setTimeout((()=>{(async e=>{if(console.log(e),e<1||e>8)return;const t=await fetch("/api/register",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({camera_id:e})});let n=(await t.json()).url;console.log("Connecting to url ",n),null==c||c.close(),c=(e=>{let t=new WebSocket(e);return t.onopen=function(e){console.log("[open] Connection established")},t.onmessage=function(e){try{const t=JSON.parse(e.data);console.log(`[message] Data received from server (json): ${e.data}`),r.set(t)}catch(t){console.log(`[message] Data received from server (NOT json): ${e.data}`)}},t.onclose=function(e){e.wasClean?console.log(`[close] Connection closed cleanly, code=${e.code} reason=${e.reason}`):console.warn("[close] Connection died")},t.onerror=function(e){console.warn(`[error] ${e}`)},t})(n)})(+t)}),750));var t}))}}]);