platypush/platypush/backend/http/dist/static/js/app.3770dd06.js

2 lines
34 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(e){function t(t){for(var s,i,a=t[0],o=t[1],u=t[2],l=0,d=[];l<a.length;l++)i=a[l],Object.prototype.hasOwnProperty.call(c,i)&&c[i]&&d.push(c[i][0]),c[i]=0;for(s in o)Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);h&&h(t);while(d.length)d.shift()();return r.push.apply(r,u||[]),n()}function n(){for(var e,t=0;t<r.length;t++){for(var n=r[t],s=!0,i=1;i<n.length;i++){var a=n[i];0!==c[a]&&(s=!1)}s&&(r.splice(t--,1),e=o(o.s=n[0]))}return e}var s={},i={app:0},c={app:0},r=[];function a(e){return o.p+"static/js/"+({}[e]||e)+"."+{"chunk-3b44ec4e":"904c7e10","chunk-4bbbb9a3":"251fff37","chunk-4c0b0f48":"366980a2","chunk-4eeb8349":"5c94d58c","chunk-2d2091df":"1e51ae4c","chunk-5fea187e":"4466d92f","chunk-2d21da1a":"adf909a2","chunk-53360c78":"51ee7c96","chunk-24ff873d":"691c883d","chunk-45939517":"c0034c6b","chunk-62a3d08e":"17d3c86d","chunk-d8561e02":"1e366cb3","chunk-e8078048":"ce29b8d4"}[e]+".js"}function o(t){if(s[t])return s[t].exports;var n=s[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(e){var t=[],n={"chunk-3b44ec4e":1,"chunk-4bbbb9a3":1,"chunk-4c0b0f48":1,"chunk-4eeb8349":1,"chunk-5fea187e":1,"chunk-53360c78":1,"chunk-24ff873d":1,"chunk-45939517":1,"chunk-62a3d08e":1,"chunk-d8561e02":1,"chunk-e8078048":1};i[e]?t.push(i[e]):0!==i[e]&&n[e]&&t.push(i[e]=new Promise((function(t,n){for(var s="static/css/"+({}[e]||e)+"."+{"chunk-3b44ec4e":"0c4a18da","chunk-4bbbb9a3":"3108d379","chunk-4c0b0f48":"009b6a70","chunk-4eeb8349":"2026dd4f","chunk-2d2091df":"31d6cfe0","chunk-5fea187e":"d6e3f8eb","chunk-2d21da1a":"31d6cfe0","chunk-53360c78":"c486a396","chunk-24ff873d":"64d9bc0b","chunk-45939517":"e4a1ddf3","chunk-62a3d08e":"6cb54f10","chunk-d8561e02":"b52f89a0","chunk-e8078048":"c6785c78"}[e]+".css",c=o.p+s,r=document.getElementsByTagName("link"),a=0;a<r.length;a++){var u=r[a],l=u.getAttribute("data-href")||u.getAttribute("href");if("stylesheet"===u.rel&&(l===s||l===c))return t()}var d=document.getElementsByTagName("style");for(a=0;a<d.length;a++){u=d[a],l=u.getAttribute("data-href");if(l===s||l===c)return t()}var h=document.createElement("link");h.rel="stylesheet",h.type="text/css",h.onload=t,h.onerror=function(t){var s=t&&t.target&&t.target.src||c,r=new Error("Loading CSS chunk "+e+" failed.\n("+s+")");r.code="CSS_CHUNK_LOAD_FAILED",r.request=s,delete i[e],h.parentNode.removeChild(h),n(r)},h.href=c;var b=document.getElementsByTagName("head")[0];b.appendChild(h)})).then((function(){i[e]=0})));var s=c[e];if(0!==s)if(s)t.push(s[2]);else{var r=new Promise((function(t,n){s=c[e]=[t,n]}));t.push(s[2]=r);var u,l=document.createElement("script");l.charset="utf-8",l.timeout=120,o.nc&&l.setAttribute("nonce",o.nc),l.src=a(e);var d=new Error;u=function(t){l.onerror=l.onload=null,clearTimeout(h);var n=c[e];if(0!==n){if(n){var s=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;d.message="Loading chunk "+e+" failed.\n("+s+": "+i+")",d.name="ChunkLoadError",d.type=s,d.request=i,n[1](d)}c[e]=void 0}};var h=setTimeout((function(){u({type:"timeout",target:l})}),12e4);l.onerror=l.onload=u,document.head.appendChild(l)}return Promise.all(t)},o.m=e,o.c=s,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)o.d(n,s,function(t){return e[t]}.bind(null,s));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o.oe=function(e){throw console.error(e),e};var u=window["webpackJsonp"]=window["webpackJsonp"]||[],l=u.push.bind(u);u.push=t,u=u.slice();for(var d=0;d<u.length;d++)t(u[d]);var h=l;r.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("56d7")},"01e1":function(e,t,n){},"0f0c":function(e,t,n){var s={"./Light/Index":["cf99","chunk-4c0b0f48","chunk-4eeb8349"],"./LightHue/Index":["a84f","chunk-4c0b0f48","chunk-4eeb8349","chunk-2d2091df"],"./Music/Index":["0d41","chunk-4c0b0f48","chunk-5fea187e"],"./MusicMpd/Index":["d1b9","chunk-4c0b0f48","chunk-5fea187e","chunk-2d21da1a"]};function i(e){if(!n.o(s,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return Promise.all(t.slice(1).map(n.e)).then((function(){return n(i)}))}i.keys=function(){return Object.keys(s)},i.id="0f0c",e.exports=i},1061:function(e,t,n){"use strict";n("c345")},"1d73":function(e,t,n){"use strict";n("4876")},"1daf":function(e,t,n){"use strict";n("3399")},"2e56":function(e,t,n){"use strict";n("7907")},3399:function(e,t,n){},"3a5e":function(e,t,n){"use strict";var s=n("7a23"),i=Object(s["K"])("data-v-4d9c871b");Object(s["u"])("data-v-4d9c871b");var c={class:"loading"},r={class:"icon"};Object(s["s"])();var a=i((function(e,t,n,i,a,o){return Object(s["r"])(),Object(s["e"])("div",c,[Object(s["h"])("div",r,[(Object(s["r"])(),Object(s["e"])(s["a"],null,Object(s["x"])(4,(function(e){return Object(s["h"])("div",{key:e})})),64))])])}));n("4f22");const o={};o.render=a,o.__scopeId="data-v-4d9c871b";t["a"]=o},"3e54":function(e,t,n){"use strict";n("d3b7");var s=n("bc3a"),i=n.n(s),c={name:"Api",methods:{execute:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6e4,s={};return"target"in e&&e["target"]||(e["target"]="localhost"),"type"in e&&e["type"]||(e["type"]="request"),n&&(s.timeout=n),new Promise((function(n,c){i.a.post("/execute",e,s).then((function(e){var s;if(e=e.data.response,null===(s=e.errors)||void 0===s?void 0:s.length){var i,r=(null===(i=e.errors)||void 0===i?void 0:i[0])||e;t.notify({text:r,error:!0}),c(r)}else n(e.output)})).catch((function(e){t.notify({text:e,error:!0}),c(e)}))}))},request:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6e4;return this.execute({type:"request",action:e,args:t},n)}}},r=c,a={name:"DateTime",methods:{formatDate:function(e){return e.toDateString().substring(0,10)},formatTime:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.toTimeString().substring(0,t?8:5)}}},o=a,u=(n("4160"),n("159b"),n("ddb0"),n("2909")),l=n("f5ef"),d={name:"Events",computed:{_eventsReady:function(){var e;return null===(e=this.$root.$refs.events)||void 0===e?void 0:e.initialized}},methods:{subscribe:function(e,t){for(var n=this,s=arguments.length,i=new Array(s>2?s-2:0),c=2;c<s;c++)i[c-2]=arguments[c];var r=function(){l["a"].emit("subscribe",{events:i,handler:e,handlerName:t||n.generateId()})};if(this._eventsReady)r();else var a=this,o=this.$watch((function(){return a._eventsReady}),(function(e){e&&(r(),o())}))},unsubscribe:function(e){l["a"].emit("unsubscribe",e)},generateId:function(){return btoa(Object(u["a"])(Array(16).keys()).forEach((function(){return String.fromCharCode(Math.round(255*Math.random()))})))}}},h=d,b={name:"Notification",methods:{notify:function(e){l["a"].emit("notification-create",e)},warn:function(e){this.notify({text:e,warning:!0})},error:function(e){throw this.notify({text:e,error:!0}),e}}},f=b,p={name:"Screen",methods:{isMobile:function(){return window.matchMedia("only screen and (max-width: 760px)").matches},isTablet:function(){return!this.isMobile()&&window.matchMedia("only screen and (max-width: 960px)").matches},isDesktop:function(){return window.matchMedia("only screen and (min-width: 1152px)").matches}}},m=p,v={name:"Types",methods:{parseBoolean:function(e){return"string"===typeof e?(e=e.toLowerCase(),"true"===e||"false"!==e&&!!parseInt(e)):!!e}}},O=v,g={name:"Utils",mixins:[r,f,h,o,m,O]};t["a"]=g},4212:function(e,t,n){"use strict";n("8e4a")},4876:function(e,t,n){},"4f22":function(e,t,n){"use strict";n("d4c7")},5056:function(e){e.exports=JSON.parse('{"a":{"light.hue":{"class":"fas fa-lightbulb"},"music.mpd":{"class":"fas fa-music"}}}')},"56d7":function(e,t,n){"use strict";n.r(t);n("e260"),n("e6cf"),n("cca6"),n("a79d");var s=n("7a23");function i(e,t,n,i,c,r){var a=Object(s["z"])("Events"),o=Object(s["z"])("Notifications"),u=Object(s["z"])("VoiceAssistant"),l=Object(s["z"])("Pushbullet"),d=Object(s["z"])("router-view");return Object(s["r"])(),Object(s["e"])(s["a"],null,[r.hasWebsocket?(Object(s["r"])(),Object(s["e"])(a,{key:0,ref:"events","ws-port":c.config["backend.http"].websocket_port},null,8,["ws-port"])):Object(s["f"])("",!0),Object(s["h"])(o,{ref:"notifications"},null,512),r.hasAssistant?(Object(s["r"])(),Object(s["e"])(u,{key:1,ref:"voice-assistant"},null,512)):Object(s["f"])("",!0),r.hasPushbullet?(Object(s["r"])(),Object(s["e"])(l,{key:2,ref:"pushbullet"},null,512)):Object(s["f"])("",!0),Object(s["h"])(d)],64)}n("96cf");var c=n("1da1"),r=(n("9911"),Object(s["K"])("data-v-6dc8bebc"));Object(s["u"])("data-v-6dc8bebc");var a={class:"notifications"};Object(s["s"])();var o=r((function(e,t,n,i,c,r){var o=Object(s["z"])("Notification");return Object(s["r"])(),Object(s["e"])("div",a,[(Object(s["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(e.notifications,(function(e,t,n){return Object(s["r"])(),Object(s["e"])(o,{key:n,id:t,text:e.text,html:e.html,title:e.title,link:e.link,image:e.image,warning:e.warning,error:e.error,onClicked:r.destroy},null,8,["id","text","html","title","link","image","warning","error","onClicked"])})),128))])})),u=(n("a9e3"),Object(s["K"])("data-v-7646705e"));Object(s["u"])("data-v-7646705e");var l={class:"body"},d={key:0,class:"image col-3"},h={class:"row"},b={key:3,class:"fa fa-exclamation"},f={key:4,class:"fa fa-times"};Object(s["s"])();var p=u((function(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("div",{class:["notification fade-in",{warning:n.warning,error:n.error}],onClick:t[1]||(t[1]=function(){return r.clicked.apply(r,arguments)})},[n.title?(Object(s["r"])(),Object(s["e"])("div",{key:0,class:"title",textContent:Object(s["C"])(n.title)},null,8,["textContent"])):Object(s["f"])("",!0),Object(s["h"])("div",l,[n.image||n.warning||n.error?(Object(s["r"])(),Object(s["e"])("div",d,[Object(s["h"])("div",h,[n.image&&n.image.src?(Object(s["r"])(),Object(s["e"])("img",{key:0,src:n.image.src,alt:""},null,8,["src"])):n.image&&n.image.icon?(Object(s["r"])(),Object(s["e"])("i",{key:1,class:["fa","fa-"+n.image.icon],style:n.image.color?"--color: "+n.image.color:""},null,6)):n.image&&n.image.iconClass?(Object(s["r"])(),Object(s["e"])("i",{key:2,class:n.image.iconClass,style:n.image.color?"--color: "+n.image.color:""},null,6)):n.warning?(Object(s["r"])(),Object(s["e"])("i",b)):n.error?(Object(s["r"])(),Object(s["e"])("i",f)):Object(s["f"])("",!0)])])):Object(s["f"])("",!0),n.text&&n.image?(Object(s["r"])(),Object(s["e"])("div",{key:1,class:"text col-9",textContent:Object(s["C"])(n.text)},null,8,["textContent"])):Object(s["f"])("",!0),n.html&&n.image?(Object(s["r"])(),Object(s["e"])("div",{key:2,class:"text col-9",innerHTML:n.html},null,8,["innerHTML"])):Object(s["f"])("",!0),n.text&&!n.image?(Object(s["r"])(),Object(s["e"])("div",{key:3,class:"text row horizontal-center",textContent:Object(s["C"])(n.text)},null,8,["textContent"])):Object(s["f"])("",!0),n.html&&!n.image?(Object(s["r"])(),Object(s["e"])("div",{key:4,class:"text row horizontal-center",innerHTML:n.html},null,8,["innerHTML"])):Object(s["f"])("",!0)])],2)})),m={name:"Notification",props:["id","text","html","title","image","link","error","warning"],methods:{clicked:function(){this.link&&window.open(this.link,"_blank"),this.$emit("clicked",this.id)}}};n("f34e");m.render=p,m.__scopeId="data-v-7646705e";var v=m,O={name:"Notifications",components:{Notification:v},props:{duration:{type:Number,default:1e4}},data:function(){return{index:0,notifications:{},timeouts:{}}},methods:{create:function(e){var t=this.index++;this.notifications[t]=e,null==e.duration&&(e.duration=this.duration);var n=e.duration?parseInt(e.duration):0;n&&(this.timeouts[t]=setTimeout(this.destroy.bind(null,t),n))},destroy:function(e){delete this.notifications[e],delete this.timeouts[e]}}};n("2e56");O.render=o,O.__scopeId="data-v-6dc8bebc";var g=O,j=n("3e54");function y(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("div")}n("99af"),n("b64b"),n("07ac");var k=n("b85c"),w=n("2909"),x=n("f5ef"),C={name:"Events",props:{wsPort:{type:Number,default:8009}},data:function(){return{ws:null,initialized:!1,pending:!1,opened:!1,timeout:null,reconnectMsecs:3e4,handlers:{},handlerNameToEventTypes:{}}},methods:{onWebsocketTimeout:function(){console.log("Websocket reconnection timed out, retrying"),this.pending=!1,this.ws&&this.ws.close(),this.onClose()},onMessage:function(e){var t=[];if(e=e.data,"string"===typeof e)try{e=JSON.parse(e)}catch(c){console.warn("Received invalid non-JSON event"),console.warn(e)}if(console.debug(e),"event"===e.type){null in this.handlers&&t.push(this.handlers[null]),e.args.type in this.handlers&&t.push.apply(t,Object(w["a"])(Object.values(this.handlers[e.args.type])));for(var n=0,s=t;n<s.length;n++){var i=s[n];i instanceof Array&&(i=i[0]),i(e.args)}}},onOpen:function(){this.opened&&(console.log("There's already an opened websocket connection, closing the newly opened one"),this.ws&&(this.ws.onclose=function(){},this.ws.close())),console.log("Websocket connection successful"),this.opened=!0,this.pending&&(this.pending=!1),this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0)},onError:function(e){console.error("Websocket error"),console.error(e)},onClose:function(e){e&&console.log("Websocket closed - code: "+e.code+" - reason: "+e.reason),this.opened=!1,this.pending||(this.pending=!0,this.init())},init:function(){try{var e="https:"===location.protocol?"wss:":"ws",t="".concat(e,"://").concat(location.hostname,":").concat(this.wsPort);this.ws=new WebSocket(t)}catch(n){return console.error("Websocket initialization error"),void console.error(n)}this.pending=!0,this.timeout=setTimeout(this.onWebsocketTimeout,this.reconnectMsecs),this.ws.onmessage=this.onMessage,this.ws.onopen=this.onOpen,this.ws.onerror=this.onError,this.ws.onclose=this.onClose,this.initialized=!0},subscribe:function(e){var t,n=this,s=e.handler,i=e.events.length?e.events:[null],c=e.handlerName,r=Object(k["a"])(i);try{for(r.s();!(t=r.n()).done;){var a=t.value;a in this.handlers||(this.handlers[a]={}),c in this.handlerNameToEventTypes||(this.handlerNameToEventTypes[c]=i),this.handlers[a][c]=s}}catch(o){r.e(o)}finally{r.f()}return function(){n.unsubscribe(c)}},unsubscribe:function(e){var t=this.handlerNameToEventTypes[e];if(t){var n,s=Object(k["a"])(t);try{for(s.s();!(n=s.n()).done;){var i,c=n.value;(null===(i=this.handlers[c])||void 0===i?void 0:i[e])&&(delete this.handlers[c][e],Object.keys(this.handlers[c]).length||delete this.handlers[c])}}catch(r){s.e(r)}finally{s.f()}delete this.handlerNameToEventTypes[e]}}},created:function(){x["a"].on("subscribe",this.subscribe),x["a"].on("unsubscribe",this.unsubscribe),this.init()}};C.render=y;var T=C,_={class:"assistant-modal"},N={class:"icon"},I={key:0,class:"fa fa-bell"},P={key:1,class:"fa fa-volume-up"},S={key:2,class:"fa fa-comment-dots"},E={key:3,class:"fa fa-microphone"},M={class:"text"},z={key:0,class:"listening"},R=Object(s["h"])("span",null,"Assistant listening",-1),A={key:1,class:"speech-recognized"},$={key:2,class:"responding"};function V(e,t,n,i,c,r){var a=Object(s["z"])("Modal");return Object(s["r"])(),Object(s["e"])("div",_,[Object(s["h"])(a,{ref:"assistantModal"},{default:Object(s["H"])((function(){return[Object(s["h"])("div",N,[c.state.alerting?(Object(s["r"])(),Object(s["e"])("i",I)):c.state.responding?(Object(s["r"])(),Object(s["e"])("i",P)):c.state.speechRecognized?(Object(s["r"])(),Object(s["e"])("i",S)):(Object(s["r"])(),Object(s["e"])("i",E))]),Object(s["h"])("div",M,[c.state.listening?(Object(s["r"])(),Object(s["e"])("div",z,[R])):c.state.speechRecognized?(Object(s["r"])(),Object(s["e"])("div",A,[Object(s["h"])("span",{textContent:Object(s["C"])(c.phrase)},null,8,["textContent"])])):c.state.responding?(Object(s["r"])(),Object(s["e"])("div",$,[Object(s["h"])("span",{textContent:Object(s["C"])(c.responseText)},null,8,["textContent"])])):Object(s["f"])("",!0)])]})),_:1},512)])}var L=n("714b"),q={name:"VoiceAssistant",components:{Modal:L["a"]},mixins:[j["a"]],data:function(){return{responseText:"",phrase:"",hideTimeout:void 0,state:{listening:!1,speechRecognized:!1,responding:!1,alerting:!1}}},methods:{reset:function(){this.state.listening=!1,this.state.speechRecognized=!1,this.state.responding=!1,this.state.alerting=!1,this.phrase="",this.responseText=""},conversationStart:function(){this.reset(),this.state.listening=!0,this.$refs.assistantModal.show(),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=void 0)},conversationEnd:function(){var e=this,t=this;this.hideTimeout=setTimeout((function(){e.reset(),t.$refs.assistantModal.close(),t.hideTimeout=void 0}),4e3)},speechRecognized:function(e){this.reset(),this.state.speechRecognized=!0,this.phrase=e.phrase,this.$refs.assistantModal.show()},response:function(e){this.reset(),this.state.responding=!0,this.responseText=e.response_text,this.$refs.assistantModal.show()},alertOn:function(){this.reset(),this.state.alerting=!0,this.$refs.assistantModal.show()},alertOff:function(){this.reset(),this.state.alerting=!1,this.$refs.assistantModal.close()},registerHandlers:function(){this.subscribe(this.conversationStart,null,"platypush.message.event.assistant.ConversationStartEvent"),this.subscribe(this.alertOn,null,"platypush.message.event.assistant.AlertStartedEvent"),this.subscribe(this.alertOff,null,"platypush.message.event.assistant.AlertEndEvent"),this.subscribe(this.speechRecognized,null,"platypush.message.event.assistant.SpeechRecognizedEvent"),this.subscribe(this.response,null,"platypush.message.event.assistant.ResponseEvent"),this.subscribe(this.conversationEnd,null,"platypush.message.event.assistant.ConversationEndEvent","platypush.message.event.assistant.NoResponseEvent","platypush.message.event.assistant.ConversationTimeoutEvent")}},mounted:function(){this.registerHandlers()}};n("6305");q.render=V;var D=q;function W(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("div")}var K={name:"Pushbullet",mixins:[j["a"]],methods:{onMessage:function(e){"mirror"===e.push_type&&this.notify({title:e.title,text:e.body,image:{src:e.icon?"data:image/png;base64, "+e.icon:void 0,icon:e.icon?void 0:"bell"}})}},mounted:function(){this.subscribe(this.onMessage,null,"platypush.message.event.pushbullet.PushbulletEvent")}};K.render=W;var B=K,H={name:"App",mixins:[j["a"]],components:{Pushbullet:B,Notifications:g,Events:T,VoiceAssistant:D},data:function(){return{config:{},userAuthenticated:!1}},computed:{hasWebsocket:function(){return this.userAuthenticated&&"backend.http"in this.config},hasAssistant:function(){return this.hasWebsocket},hasPushbullet:function(){return this.hasWebsocket&&("pushbullet"in this.config||"backend.pushbullet"in this.config)}},methods:{onNotification:function(e){this.$refs.notifications.create(e)},initConfig:function(){var e=this;return Object(c["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.request("config.get");case 2:e.config=t.sent,e.userAuthenticated=!0;case 4:case"end":return t.stop()}}),t)})))()}},created:function(){this.initConfig()},mounted:function(){x["a"].on("notification-create",this.onNotification)}};n("9cdc");H.render=i;var U=H,F=n("6c02"),J=Object(s["K"])("data-v-0ba67711"),Z=J((function(e,t,n,i,c,r){var a=Object(s["z"])("Loading"),o=Object(s["z"])("Widget"),u=Object(s["z"])("Row");return Object(s["r"])(),Object(s["e"])(s["a"],null,[c.loading?(Object(s["r"])(),Object(s["e"])(a,{key:0})):Object(s["f"])("",!0),Object(s["h"])("div",{id:"dashboard",class:["columns is-mobile",r.classes],style:c.style},[(Object(s["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(c.rows,(function(e,t){return Object(s["r"])(),Object(s["e"])(u,{key:t,class:e.class,style:e.style},{default:J((function(){return[(Object(s["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(e.widgets,(function(e,t){return Object(s["r"])(),Object(s["e"])(s["b"],{key:t},[Object(s["h"])(o,{style:e.style,class:e.class},{default:J((function(){return[(Object(s["r"])(),Object(s["e"])(Object(s["A"])(e.component),e.props,null,16))]})),_:2},1032,["style","class"])],1024)})),128))]})),_:2},1032,["class","style"])})),128))],6)],64)})),G=(n("d81d"),n("13d5"),n("b0c0"),n("b680"),n("d3b7"),n("3a5e")),Q=Object(s["K"])("data-v-1b4663f2"),X=Q((function(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("div",{class:["row",r.classes],style:n.style},[Object(s["y"])(e.$slots,"default")],6)})),Y={name:"Row",props:{class:{type:String,required:!1,default:""},style:{type:String,required:!1,default:""}},computed:{classes:function(){return this.class}}};n("6682");Y.render=X,Y.__scopeId="data-v-1b4663f2";var ee=Y,te=Object(s["K"])("data-v-8c529832"),ne=te((function(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("div",{style:n.style,class:r.classes},[Object(s["y"])(e.$slots,"default")],6)})),se=(n("ac1f"),n("1276"),{name:"Widget",props:{style:{type:String,required:!1,default:""},class:{type:String,required:!1,default:""}},computed:{classes:function(){return(this.class&&this.class.length?this.class.split(" "):["col-3"]).concat(["widget","column"])}}});n("1061");se.render=ne,se.__scopeId="data-v-8c529832";var ie=se,ce={name:"Dashboard",mixins:[j["a"]],components:{Widget:ie,Loading:G["a"],Row:ee},props:{refreshSeconds:{type:Number,required:!1,default:0}},data:function(){return{rows:[],loading:!1,style:void 0,class:void 0}},computed:{classes:function(){return this.class}},methods:{parseTemplate:function(e,t){var i=(new DOMParser).parseFromString(t,"text/xml").childNodes[0],c=this;this.style=i.attributes.style?i.attributes.style.nodeValue:void 0,this.class=i.attributes.class?i.attributes.class.nodeValue:void 0,this.rows=Object(w["a"])(i.getElementsByTagName("Row")).map((function(e){return{style:e.attributes.style?e.attributes.style.nodeValue:void 0,class:e.attributes.class?e.attributes.class.nodeValue:void 0,widgets:Object(w["a"])(e.children).map((function(e){var t=Object(s["i"])((function(){return n("cdb9")("./".concat(e.nodeName,"/Index"))})),i=e.attributes.style?e.attributes.style.nodeValue:void 0,r=e.attributes.class?e.attributes.class.nodeValue:void 0,a=Object(w["a"])(e.attributes).reduce((function(e,t){return"style"!==t.nodeName&&(e[t.nodeName]=t.nodeValue),e}),{}),o={component:t,style:i,class:r,props:a||{}};return c.$options.components[e.nodeName]=t,o}))}})),this.loading=!1},refreshDashboard:function(){var e=this;return Object(c["a"])(regeneratorRuntime.mark((function t(){var n,s;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,e.widgets=[],n=e.$route.params.name,t.next=5,e.request("config.get_dashboard",{name:n});case 5:s=t.sent,s||e.error("Dashboard ".concat(n," not found")),e.parseTemplate(n,s);case 8:case"end":return t.stop()}}),t)})))()}},mounted:function(){if(this.refreshDashboard(),this.refreshSeconds){var e=this;setInterval((function(){e.refreshDashboard()}),parseInt((1e3*this.refreshSeconds).toFixed(0)))}}};n("1daf"),n("9a5d");ce.render=Z,ce.__scopeId="data-v-0ba67711";var re=ce;function ae(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("h1",null,"Object not found")}var oe={name:"NotFound"};oe.render=ae;var ue=oe,le={class:"login-container"},de={class:"login",method:"POST"},he={class:"description"},be=Object(s["h"])("div",{class:"row"},[Object(s["h"])("label",null,[Object(s["h"])("input",{type:"text",name:"username",placeholder:"Username"})])],-1),fe=Object(s["h"])("div",{class:"row"},[Object(s["h"])("label",null,[Object(s["h"])("input",{type:"password",name:"password",placeholder:"Password"})])],-1),pe={key:0,class:"row"},me=Object(s["h"])("label",null,[Object(s["h"])("input",{type:"password",name:"confirm_password",placeholder:"Confirm password"})],-1),ve={class:"row pull-right"},Oe=Object(s["h"])("div",{class:"row pull-right"},[Object(s["h"])("label",{class:"checkbox"},[Object(s["h"])("input",{type:"checkbox",name:"remember"}),Object(s["g"])("  Keep me logged in on this device   ")])],-1);function ge(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("div",le,[Object(s["h"])("form",de,[Object(s["h"])("div",he,Object(s["C"])(r._register?"Welcome":"Authenticate")+" to platypush ",1),be,fe,r._register?(Object(s["r"])(),Object(s["e"])("div",pe,[me])):Object(s["f"])("",!0),Object(s["h"])("div",ve,[Object(s["h"])("input",{type:"submit",class:"btn btn-primary",value:r._register?"Register":"Login"},null,8,["value"])]),Oe])])}var je={name:"Login",mixins:[j["a"]],props:{register:{type:Boolean,required:!1,default:!1}},computed:{_register:function(){return this.parseBoolean(this.register)}}};n("1d73");je.render=ge;var ye=je;function ke(e,t,n,i,c,r){var a=Object(s["z"])("Login");return Object(s["r"])(),Object(s["e"])(a,{register:!0})}var we={name:"Register",mixins:[ye],components:{Login:ye},props:{register:{type:Boolean,required:!1,default:!0}}};we.render=ke;var xe=we,Ce=Object(s["K"])("data-v-6e3b2a94");Object(s["u"])("data-v-6e3b2a94");var Te={class:"canvas"};Object(s["s"])();var _e=Ce((function(e,t,n,i,c,r){var a=Object(s["z"])("Loading"),o=Object(s["z"])("Nav");return Object(s["r"])(),Object(s["e"])("main",null,[c.loading?(Object(s["r"])(),Object(s["e"])(a,{key:0})):(Object(s["r"])(),Object(s["e"])(o,{key:1,panels:c.components,"selected-panel":c.selectedPanel,hostname:c.hostname,onSelect:t[1]||(t[1]=function(e){return c.selectedPanel=e})},null,8,["panels","selected-panel","hostname"])),Object(s["h"])("div",Te,[(Object(s["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(c.components,(function(e,t){return Object(s["r"])(),Object(s["e"])("div",{class:["panel",{hidden:t!==c.selectedPanel}],key:t},[t===c.selectedPanel?(Object(s["r"])(),Object(s["e"])(Object(s["A"])(e.component),{key:0,config:e.config,"plugin-name":t},null,8,["config","plugin-name"])):Object(s["f"])("",!0)],2)})),128))])])})),Ne=(n("4160"),n("a15b"),n("fb6a"),n("4fad"),n("3ca3"),n("466d"),n("159b"),n("ddb0"),n("3835")),Ie=Object(s["K"])("data-v-b1e39ec4");Object(s["u"])("data-v-b1e39ec4");var Pe=Object(s["h"])("i",{class:"fas fa-bars"},null,-1),Se={class:"icon"},Ee={key:1,class:"fas fa-puzzle-piece"},Me={key:0,class:"name"};Object(s["s"])();var ze=Ie((function(e,t,n,i,c,r){return Object(s["r"])(),Object(s["e"])("nav",{class:{collapsed:c.collapsed}},[Object(s["h"])("div",{class:"toggler",onClick:t[1]||(t[1]=function(e){return c.collapsed=!c.collapsed})},[Pe,n.hostname?(Object(s["r"])(),Object(s["e"])("span",{key:0,class:"hostname",textContent:Object(s["C"])(n.hostname)},null,8,["textContent"])):Object(s["f"])("",!0)]),Object(s["h"])("ul",null,[(Object(s["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(Object.keys(n.panels).sort(),(function(e){var t;return Object(s["r"])(),Object(s["e"])("li",{key:e,class:["entry",{selected:e===n.selectedPanel}],title:e,onClick:function(t){return r.onItemClick(e)}},[Object(s["h"])("a",{href:"/#".concat(e)},[Object(s["h"])("span",Se,[(null===(t=c.icons[e])||void 0===t?void 0:t.class)?(Object(s["r"])(),Object(s["e"])("i",{key:0,class:c.icons[e].class},null,2)):(Object(s["r"])(),Object(s["e"])("i",Ee))]),c.collapsed?Object(s["f"])("",!0):(Object(s["r"])(),Object(s["e"])("span",Me,Object(s["C"])(r.displayName(e)),1))],8,["href"])],10,["title","onClick"])})),128))])],2)})),Re=n("5056"),Ae={name:"Nav",emits:["select"],mixins:[j["a"]],props:{panels:{type:Object,required:!0},selectedPanel:{type:String},hostname:{type:String}},methods:{displayName:function(e){return e.split(".").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join(" ")},onItemClick:function(e){this.$emit("select",e),this.collapsed=!0}},data:function(){return{collapsed:!0,icons:Re["a"],host:null}},mounted:function(){this.isMobile()&&!this.$root.$route.hash.length&&(this.collapsed=!1)}};n("5915");Ae.render=ze,Ae.__scopeId="data-v-b1e39ec4";var $e=Ae,Ve={name:"Panel",mixins:[j["a"]],components:{Nav:$e,Loading:G["a"]},data:function(){return{loading:!1,plugins:{},backends:{},procedures:{},components:{},hostname:void 0,selectedPanel:void 0}},methods:{initSelectedPanel:function(){var e=this.$route.hash.match("#?([a-zA-Z0-9.]+)[?]?(.*)");if(e){var t=e[1];(null===t||void 0===t?void 0:t.length)&&(this.selectedPanel=t)}},initPanels:function(){var e=this;this.components={},Object.entries(this.plugins).forEach(function(){var t=Object(c["a"])(regeneratorRuntime.mark((function t(i){var r,a,o,u,l,d;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return r=Object(Ne["a"])(i,2),a=r[0],o=r[1],u=a.split(".").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join(""),l=null,t.prev=3,t.next=6,n("0f0c")("./".concat(u,"/Index"));case 6:l=t.sent,t.next=12;break;case 9:return t.prev=9,t.t0=t["catch"](3),t.abrupt("return");case 12:d=Object(s["i"])(Object(c["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",l);case 1:case"end":return e.stop()}}),e)})))),e.$options.components[a]=d,e.components[a]={component:d,pluginName:a,config:o};case 15:case"end":return t.stop()}}),t,null,[[3,9]])})));return function(e){return t.apply(this,arguments)}}())},parseConfig:function(){var e=this;return Object(c["a"])(regeneratorRuntime.mark((function t(){var n,s;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([e.request("config.get_plugins"),e.request("config.get_backends"),e.request("config.get_procedures"),e.request("config.get_device_id")]);case 2:n=t.sent,s=Object(Ne["a"])(n,4),e.plugins=s[0],e.backends=s[1],e.procedures=s[2],e.hostname=s[3];case 8:case"end":return t.stop()}}),t)})))()}},mounted:function(){var e=this;return Object(c["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.prev=1,t.next=4,e.parseConfig();case 4:e.initPanels(),e.initSelectedPanel();case 6:return t.prev=6,e.loading=!1,t.finish(6);case 9:case"end":return t.stop()}}),t,null,[[1,,6,9]])})))()}};n("4212"),n("d555");Ve.render=_e,Ve.__scopeId="data-v-6e3b2a94";var Le=Ve,qe=[{path:"/",name:"Panel",component:Le},{path:"/dashboard/:name",name:"Dashboard",component:re},{path:"/login",name:"Login",component:ye},{path:"/register",name:"Register",component:xe},{path:"/:catchAll(.*)",component:ue}],De=Object(F["a"])({history:Object(F["b"])(),routes:qe}),We=De,Ke=Object(s["d"])(U);Ke.config.globalProperties._config=window.config,Ke.use(We).mount("#app")},5915:function(e,t,n){"use strict";n("c34e")},6305:function(e,t,n){"use strict";n("b296")},6682:function(e,t,n){"use strict";n("9430")},"6fda":function(e,t,n){},"714b":function(e,t,n){"use strict";var s=n("7a23"),i=Object(s["K"])("data-v-7f25e347");Object(s["u"])("data-v-7f25e347");var c={class:"modal"},r={class:"body"};Object(s["s"])();var a=i((function(e,t,n,i,a,o){return Object(s["r"])(),Object(s["e"])("div",{class:["modal-container fade-in",{hidden:!a.isVisible}],id:n.id,style:{"--z-index":o.zIndex},onClick:t[3]||(t[3]=function(){return o.close.apply(o,arguments)})},[Object(s["h"])("div",c,[Object(s["h"])("div",{class:"content",style:{"--width":n.width,"--height":n.height},onClick:t[2]||(t[2]=function(e){return e.stopPropagation()})},[n.title?(Object(s["r"])(),Object(s["e"])("div",{key:0,class:"header",textContent:Object(s["C"])(n.title)},null,8,["textContent"])):Object(s["f"])("",!0),Object(s["h"])("div",r,[Object(s["y"])(e.$slots,"default",{onModalClose:t[1]||(t[1]=function(){return o.close.apply(o,arguments)})})])],4)])],14,["id"])})),o=(n("c975"),n("a9e3"),n("b85c")),u={name:"Modal",emits:["close","open"],props:{id:{type:String},title:{type:String},width:{type:[Number,String]},height:{type:[Number,String]},visible:{type:Boolean,default:!1},timeout:{type:[Number,String]},level:{type:Number,default:1}},data:function(){return{timeoutId:void 0,prevVisible:this.visible,isVisible:this.visible}},computed:{zIndex:function(){return 500+this.level}},methods:{close:function(){this.prevVisible=this.isVisible,this.isVisible=!1},show:function(){this.prevVisible=this.isVisible,this.isVisible=!0},toggle:function(){this.isVisible?this.close():this.show()}},mounted:function(){var e=this,t=this,n=function(e){e?t.$emit("open"):t.$emit("close")};this.$watch((function(){return e.visible}),n),this.$watch((function(){return e.isVisible}),n)},updated:function(){if(this.prevVisible=this.isVisible,this.isVisible){var e,t=parseInt(getComputedStyle(this.$el).zIndex),n=[],s=Object(o["a"])(document.querySelectorAll(".modal-container:not(.hidden)"));try{for(s.s();!(e=s.n()).done;){var i=e.value,c=parseInt(getComputedStyle(i).zIndex);c>t?(t=c,n=[i]):c===t&&n.push(i)}}catch(a){s.e(a)}finally{s.f()}(n.indexOf(this.$el)<0||n.length>1)&&(this.$el.style.zIndex=t+1)}if(this.isVisible&&this.timeout&&!this.timeoutId){var r=function(e){return function(){e.close(),e.timeoutId=void 0}};this.timeoutId=setTimeout(r(this),0+this.timeout)}}};n("b6d5");u.render=a,u.__scopeId="data-v-7f25e347";t["a"]=u},7907:function(e,t,n){},"8e4a":function(e,t,n){},9430:function(e,t,n){},"9a5d":function(e,t,n){"use strict";n("6fda")},"9cdc":function(e,t,n){"use strict";n("c701")},b296:function(e,t,n){},b6d5:function(e,t,n){"use strict";n("ec05")},c345:function(e,t,n){},c34e:function(e,t,n){},c701:function(e,t,n){},cdb9:function(e,t,n){var s={"./Calendar/Index":["3c97","chunk-62a3d08e"],"./DateTime/Index":["365a","chunk-4bbbb9a3"],"./DateTimeWeather/Index":["3737","chunk-53360c78","chunk-4bbbb9a3","chunk-45939517"],"./ImageCarousel/Index":["c845","chunk-53360c78","chunk-4bbbb9a3","chunk-24ff873d"],"./Music/Index":["bcf7","chunk-3b44ec4e"],"./Plugin/Index":["dabe","chunk-d8561e02"],"./RssNews/Index":["c306","chunk-e8078048"],"./Weather/Index":["5b43","chunk-53360c78"]};function i(e){if(!n.o(s,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return Promise.all(t.slice(1).map(n.e)).then((function(){return n(i)}))}i.keys=function(){return Object.keys(s)},i.id="cdb9",e.exports=i},d4c7:function(e,t,n){},d555:function(e,t,n){"use strict";n("01e1")},ec05:function(e,t,n){},f34e:function(e,t,n){"use strict";n("f5d6")},f5d6:function(e,t,n){},f5ef:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var s=n("14b7"),i=Object(s["a"])()}});
//# sourceMappingURL=app.3770dd06.js.map