(function(e){function t(t){for(var s,i,a=t[0],o=t[1],u=t[2],l=0,d=[];l1&&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,r){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,c=(null===(i=e.errors)||void 0===i?void 0:i[0])||e;t.notify({text:c,error:!0}),r(c)}else n(e.output)})).catch((function(e){t.notify({text:e,error:!0}),r(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)}}},c=r,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),r=2;rt?(t=r,n=[i]):r===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 c=function(e){return function(){e.close(),e.timeoutId=void 0}};this.timeoutId=setTimeout(c(this),0+this.timeout)}}});n("1e25");W.render=D,W.__scopeId="data-v-62975272";var J=W,B={name:"VoiceAssistant",components:{Modal:J},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");B.render=$;var U=B;function H(e,t,n,i,r,c){return Object(s["r"])(),Object(s["e"])("div")}var F={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")}};F.render=H;var K=F,G={name:"App",mixins:[j["a"]],components:{Pushbullet:K,Notifications:g,Events:T,VoiceAssistant:U},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(r["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");G.render=i;var Z=G,Q=n("6c02"),X=Object(s["J"])("data-v-0ba67711"),Y=X((function(e,t,n,i,r,c){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,[r.loading?(Object(s["r"])(),Object(s["e"])(a,{key:0})):Object(s["f"])("",!0),Object(s["h"])("div",{id:"dashboard",class:["columns is-mobile",c.classes],style:r.style},[(Object(s["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(r.rows,(function(e,t){return Object(s["r"])(),Object(s["e"])(u,{key:t,class:e.class,style:e.style},{default:X((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:X((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)})),ee=(n("d81d"),n("13d5"),n("b0c0"),n("b680"),n("d3b7"),n("3a5e")),te=Object(s["J"])("data-v-1b4663f2"),ne=te((function(e,t,n,i,r,c){return Object(s["r"])(),Object(s["e"])("div",{class:["row",c.classes],style:n.style},[Object(s["y"])(e.$slots,"default")],6)})),se={name:"Row",props:{class:{type:String,required:!1,default:""},style:{type:String,required:!1,default:""}},computed:{classes:function(){return this.class}}};n("6682");se.render=ne,se.__scopeId="data-v-1b4663f2";var ie=se,re=Object(s["J"])("data-v-8c529832"),ce=re((function(e,t,n,i,r,c){return Object(s["r"])(),Object(s["e"])("div",{style:n.style,class:c.classes},[Object(s["y"])(e.$slots,"default")],6)})),ae=(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");ae.render=ce,ae.__scopeId="data-v-8c529832";var oe=ae,ue={name:"Dashboard",mixins:[j["a"]],components:{Widget:oe,Loading:ee["a"],Row:ie},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],r=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,c=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:c,props:a||{}};return r.$options.components[e.nodeName]=t,o}))}})),this.loading=!1},refreshDashboard:function(){var e=this;return Object(r["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");ue.render=Y,ue.__scopeId="data-v-0ba67711";var le=ue;function de(e,t,n,i,r,c){return Object(s["r"])(),Object(s["e"])("h1",null,"Object not found")}var he={name:"NotFound"};he.render=de;var be=he,fe={class:"login-container"},pe={class:"login",method:"POST"},me={class:"description"},ve=Object(s["h"])("div",{class:"row"},[Object(s["h"])("label",null,[Object(s["h"])("input",{type:"text",name:"username",placeholder:"Username"})])],-1),Oe=Object(s["h"])("div",{class:"row"},[Object(s["h"])("label",null,[Object(s["h"])("input",{type:"password",name:"password",placeholder:"Password"})])],-1),ge={key:0,class:"row"},je=Object(s["h"])("label",null,[Object(s["h"])("input",{type:"password",name:"confirm_password",placeholder:"Confirm password"})],-1),ye={class:"row pull-right"},ke=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 we(e,t,n,i,r,c){return Object(s["r"])(),Object(s["e"])("div",fe,[Object(s["h"])("form",pe,[Object(s["h"])("div",me,Object(s["C"])(c._register?"Welcome":"Authenticate")+" to platypush ",1),ve,Oe,c._register?(Object(s["r"])(),Object(s["e"])("div",ge,[je])):Object(s["f"])("",!0),Object(s["h"])("div",ye,[Object(s["h"])("input",{type:"submit",class:"btn btn-primary",value:c._register?"Register":"Login"},null,8,["value"])]),ke])])}var xe={name:"Login",mixins:[j["a"]],props:{register:{type:Boolean,required:!1,default:!1}},computed:{_register:function(){return this.parseBoolean(this.register)}}};n("1d73");xe.render=we;var Ce=xe;function Te(e,t,n,i,r,c){var a=Object(s["z"])("Login");return Object(s["r"])(),Object(s["e"])(a,{register:!0})}var _e={name:"Register",mixins:[Ce],components:{Login:Ce},props:{register:{type:Boolean,required:!1,default:!0}}};_e.render=Te;var Ne=_e,Se=Object(s["J"])("data-v-44328a16");Object(s["u"])("data-v-44328a16");var Pe={class:"canvas"};Object(s["s"])();var Ie=Se((function(e,t,n,i,r,c){var a=Object(s["z"])("Loading"),o=Object(s["z"])("Nav");return Object(s["r"])(),Object(s["e"])("main",null,[r.loading?(Object(s["r"])(),Object(s["e"])(a,{key:0})):(Object(s["r"])(),Object(s["e"])(o,{key:1,panels:r.components,"selected-panel":r.selectedPanel,hostname:r.hostname,onSelect:t[1]||(t[1]=function(e){return r.selectedPanel=e})},null,8,["panels","selected-panel","hostname"])),Object(s["h"])("div",Pe,[(Object(s["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(r.components,(function(e,t){return Object(s["r"])(),Object(s["e"])("div",{class:"panel",key:t},[t===r.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)])})),128))])])})),Ee=(n("4160"),n("a15b"),n("fb6a"),n("4fad"),n("3ca3"),n("466d"),n("159b"),n("ddb0"),n("3835")),ze=Object(s["J"])("data-v-f1c0ba72");Object(s["u"])("data-v-f1c0ba72");var Me=Object(s["h"])("i",{class:"fas fa-bars"},null,-1),Re={class:"icon"},Ae={key:1,class:"fas fa-puzzle-piece"},Ve={key:0,class:"name"};Object(s["s"])();var $e=ze((function(e,t,n,i,r,c){return Object(s["r"])(),Object(s["e"])("nav",{class:{collapsed:r.collapsed}},[Object(s["h"])("div",{class:"toggler",onClick:t[1]||(t[1]=function(e){return r.collapsed=!r.collapsed})},[Me,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["r"])(!0),Object(s["e"])(s["a"],null,Object(s["x"])(Object.keys(n.panels),(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 c.onItemClick(e)}},[Object(s["h"])("a",{href:"/#".concat(e)},[Object(s["h"])("span",Re,[(null===(t=r.icons[e])||void 0===t?void 0:t.class)?(Object(s["r"])(),Object(s["e"])("i",{key:0,class:r.icons[e].class},null,2)):(Object(s["r"])(),Object(s["e"])("i",Ae))]),r.collapsed?Object(s["f"])("",!0):(Object(s["r"])(),Object(s["e"])("span",Ve,Object(s["C"])(c.displayName(e)),1))],8,["href"])],10,["title","onClick"])})),128))],2)})),Le=n("5056"),qe={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.isMobile()&&(this.collapsed=!0)}},data:function(){return{collapsed:!0,icons:Le["a"],host:null}},mounted:function(){this.isMobile()&&!this.$root.$route.hash.length&&(this.collapsed=!1)}};n("64c7");qe.render=$e,qe.__scopeId="data-v-f1c0ba72";var De=qe,We={name:"Panel",mixins:[j["a"]],components:{Nav:De,Loading:ee["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(r["a"])(regeneratorRuntime.mark((function t(i){var c,a,o,u,l,d;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return c=Object(Ee["a"])(i,2),a=c[0],o=c[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(r["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(r["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(Ee["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(r["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("4ef2"),n("d555");We.render=Ie,We.__scopeId="data-v-44328a16";var Je=We,Be=[{path:"/",name:"Panel",component:Je},{path:"/dashboard/:name",name:"Dashboard",component:le},{path:"/login",name:"Login",component:Ce},{path:"/register",name:"Register",component:Ne},{path:"/:catchAll(.*)",component:be}],Ue=Object(Q["a"])({history:Object(Q["b"])(),routes:Be}),He=Ue,Fe=Object(s["d"])(Z);Fe.config.globalProperties._config=window.config,Fe.use(He).mount("#app")},6305:function(e,t,n){"use strict";n("b296")},"64c7":function(e,t,n){"use strict";n("e09c")},6682:function(e,t,n){"use strict";n("9430")},"6fda":function(e,t,n){},7907:function(e,t,n){},9430:function(e,t,n){},"9a5d":function(e,t,n){"use strict";n("6fda")},"9bb9":function(e,t,n){},"9cdc":function(e,t,n){"use strict";n("c701")},b296:function(e,t,n){},c345:function(e,t,n){},c701:function(e,t,n){},c7c8: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-35b45d59"],"./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")},e09c: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.41ee3441.js.map