magcore-app-weather
Version:
Weather application for Ministra TV Platform.
1 lines • 70.7 kB
JavaScript
!function(e){var t={};function i(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(s,n,function(t){return e[t]}.bind(null,n));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=13)}([function(e,t,i){"use strict";var s=i(9);s.back=s.backspace,s.channelNext=s.tab,s.channelPrev=s.tab+"s",s.ok=s.enter,s.exit=s.escape,s.volumeUp=107,s.volumeDown=109,s.f1="112c",s.f2="113c",s.f3="114c",s.f4="115c",s.refresh="116c",s.frame="117c",s.phone="119c",s.set="120c",s.tv="121c",s.menu="122c",s.app="123c",s.rewind="66a",s.forward="70a",s.audio="71a",s.standby="74a",s.keyboard="76a",s.usbMounted="80a",s.usbUnmounted="81a",s.playPause="82a",s.play=-1,s.pause=-1,s.stop="83a",s.power="85a",s.record="87a",s.info="89a",s.mute="192a",s.digit0=48,s.digit1=49,s.digit2=50,s.digit3=51,s.digit4=52,s.digit5=53,s.digit6=54,s.digit7=55,s.digit8=56,s.digit9=57,e.exports=s},function(e,t,i){"use strict";e.exports=i(3)},function(e,t,i){"use strict";var s=i(4),n=i(15).parse,a=new s;a.query=n(document.location.search.substring(1)),a.config=i(6),a.activePage=null,a.route=function(e,t){var i,s=a.activePage;return!(!e||e.active)&&(e.name,e.id,e.name,e.id,(i=a.activePage)&&i.active&&(i.$node.classList.remove("active"),i.active=!1,a.activePage=null,i.name,i.id,i.name,i.id,i.events["hide"]&&i.emit("hide")),function(e,t){!e||e.active||(e.$node.classList.add("active"),e.active=!0,a.activePage=e,e.name,e.id,e.name,e.id,e.events["show"]&&e.emit("show",{data:t}))}(e,t),this.events["route"]&&this.emit("route",{from:s,to:e}),!0)},e.exports=a},function(e,t,i){"use strict";var s=i(2),n=i(4),a=0;function o(e){var t,i=this;if(e=e||{},this.visible=!0,this.focusable=!0,this.$node=null,this.$body=null,this.parent=null,this.children=[],this.propagate=!!e.propagate,n.call(this),this.$node=e.$node||document.createElement("div"),this.$body=e.$body||this.$node,this.$node.className=this.name+" "+(e.className||""),this.id=e.id||this.$node.id||"cid"+a++,e.parent&&e.parent.add(this),!1===e.visible&&this.hide(),!1===e.focusable&&(this.focusable=!1),this.defaultEvents)for(t in e.events=e.events||{},this.defaultEvents)e.events[t]=e.events[t]||this.defaultEvents[t];e.events&&Object.keys(e.events).forEach(function(t){i.addListener(t,e.events[t])}),e.children&&this.add.apply(this,e.children),this.$node.addEventListener("click",function(e){i.focus(),i.events["click"]&&i.emit("click",e),e.stopPropagation()}),this.name,this.id,this.name,this.id}o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.prototype.defaultEvents=null,o.prototype.add=function(e){var t;for(t=0;t<arguments.length;t++)e=arguments[t],this.children.push(e),e.parent=this,e.$node&&null===e.$node.parentNode&&this.$body.appendChild(e.$node),e.name,e.id,this.name,this.id,this.name,this.id,e.name,e.id,this.events["add"]&&this.emit("add",{item:e})},o.prototype.remove=function(){this.parent&&(s.activePage.activeComponent===this&&(this.blur(),this.parent.focus()),this.parent.children.splice(this.parent.children.indexOf(this),1)),this.children.forEach(function(e){e.remove()}),this.$node.parentNode.removeChild(this.$node),this.events["remove"]&&this.emit("remove"),this.events={},this.name,this.id,this.name,this.id},o.prototype.focus=function(e){var t=s.activePage,i=t.activeComponent;return!(!this.focusable||this===i)&&(i&&i.blur(),t.activeComponent=i=this,i.$node.classList.add("focus"),this.name,this.id,this.name,this.id,i.events["focus"]&&i.emit("focus",e),!0)},o.prototype.blur=function(){var e=s.activePage,t=e.activeComponent;return this.$node.classList.remove("focus"),this===t?(e.activeComponent=null,this.name,this.id,this.name,this.id,this.events["blur"]&&this.emit("blur"),!0):(this.name,this.id,this.name,this.id,!1)},o.prototype.show=function(e,t){return!this.visible&&(this.$node.classList.remove("hidden"),this.visible=!0,this.name,this.id,this.name,this.id,this.events["show"]&&this.emit("show",e),"function"==typeof t&&setTimeout(t),!0)},o.prototype.hide=function(e){return!!this.visible&&(this.$node.classList.add("hidden"),this.visible=!1,this.name,this.id,this.name,this.id,this.events["hide"]&&this.emit("hide"),"function"==typeof e&&setTimeout(e),!0)},e.exports=o},function(e,t,i){"use strict";function s(){this.events={}}s.prototype={addListener:function(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)},once:function(e,t){var i=this;this.events[e]=this.events[e]||[],this.events[e].push(function s(){i.removeListener(e,s),t.apply(i,arguments)})},addListeners:function(e){var t;for(t in e)e.hasOwnProperty(t)&&this.addListener(t,e[t])},removeListener:function(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(function(e){return e!==t}),0===this.events[e].length&&(this.events[e]=void 0))},emit:function(e){var t,i=this.events[e];if(i)for(t=0;t<i.length;t++)i[t].apply(this,Array.prototype.slice.call(arguments,1))}},s.prototype.constructor=s,e.exports=s},function(e,t,i){"use strict";var s=i(14);e.exports=s},function(e,t,i){"use strict";e.exports={searchInputDelay:400,weatherServerURL:"http://weather.infomir.com.ua/",getGeo:"getGeo.php"}},function(e,t,i){"use strict";var s=i(2);e.exports=function(e){var t=document.createElement("link");t.rel="stylesheet",t.href="css/"+e+"."+s.metrics.height+".css",document.head.appendChild(t)}},function(e,t,i){"use strict";var s=new(i(4));function n(e,t){var i=null,n=core.environment.language,a=new XMLHttpRequest;a.open("GET","http://nominatim.openstreetmap.org/reverse?format=json&lat="+e.lat+"&zoom=18&addressdetails=1&lon="+e.lon+"&accept-language="+n),a.onload=function(){if(200===this.status)try{i=JSON.parse(this.responseText)}catch(e){}null!==i&&(s.location=i),s.emit("load",s.location),t(s.location)},a.send(null)}e.exports=s,s.location={displayName:"",lat:0,lon:0,address:{city:"",state:"",country:""}},s.load=function(e,t){var i,a=new XMLHttpRequest;if(e.lat&&e.lon)return s.location.lat=+e.lat,s.location.lon=+e.lon,void(e.name?(e.displayName=e.name,s.location=JSON.parse(JSON.stringify(e)),i=s.location.name.split(","),s.location.address.city=i[0],s.location.address.state=i[1],s.location.address.country=i[2],s.emit("load",s.location)):n(s.location));a.open("GET","http://weather.infomir.com.ua/getGeo.php"),a.onload=function(){var e={data:{lon:0,lat:0}};if(200===this.status){try{e=JSON.parse(this.responseText)}catch(e){}s.location.lat=+e.data.lat,s.location.lon=+e.data.lon,n(s.location,t)}else s.emit("load",s.location)},a.send(null)},s.search=function(e,t){var i=new XMLHttpRequest;i.open("GET","http://nominatim.openstreetmap.org/search?format=json&addressdetails=1&limit=5&accept-language="+e.language+"&q="+e.query),i.onload=function(){if(200===this.status)try{t(JSON.parse(this.responseText),!1)}catch(e){t(null,404)}else t(null,this.status)},i.onerror=function(){t(null,this.status)},i.send(null)}},function(e,t,i){"use strict";e.exports={backspace:8,tab:9,enter:13,escape:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,del:46}},function(e,t,i){"use strict";var s=i(11),n=i(27);function a(e){var t=this;e=e||{},this.handlers={},this.links={},this.$noData=null,e.propagate=void 0===e.propagate||e.propagate,this.fixedData=e.fixedData||!1,e.$body=document.createElement("div"),e.$body.className="body",this.$noData=document.createElement("div"),this.$noData.className="noData hidden",s.call(this,e),this.$node.appendChild(this.$body),this.$node.appendChild(this.$noData),this.addListener("click:item",function(e){e.$item.layout.children.length&&!e.inner&&e.$item.layout.children[e.$item.layout.focusIndex].focus(),e.inner&&(t.focus(),t.focusItem(e.$item)),t.handlers[e.$item.index]&&t.handlers[e.$item.index](e.$item)})}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-layout-list",a.prototype.renderItemDefault=function(e,t){var i,s,a,o,r;if(e.ready&&this.fixedData)for(r=0;r<t.items.length;r++)"string"!=typeof(o=t.items[r]).value&&void 0!==o.value||((a=e.layout.$node.childNodes[r]).innerText=o.value||"",a.className=o.className||"");else{for(;e.firstChild;)e.removeChild(e.firstChild);s={focusable:!1,data:t.items},t.className&&(s.className=t.className),i=new n(s),t.name&&(this.links[t.name]=i),e.appendChild(i.$node),e.layout=i,i.parent=this,i.$parentItem=e,i.addListener("click",function(){i.parent.emit("click:item",{$item:e,inner:!0})}),t.click&&(this.handlers[e.index]=t.click),e.ready=!0}e.value=t.value||{}},a.prototype.setData=function(e){this.links={},s.prototype.setData.call(this,e),e.data&&e.data.length?this.$noData.classList.add("hidden"):this.$noData.classList.remove("hidden")},a.prototype.init=function(e){var t;s.prototype.init.call(this,e),e.noData&&(this.$noData.innerHTML="",e.noData instanceof Element?this.$noData.appendChild(e.noData):"string"==typeof e.noData&&((t=document.createElement("div")).innerText=e.noData,this.$noData.appendChild(t))),e.data&&e.data.length?this.$noData.classList.add("hidden"):this.$noData.classList.remove("hidden")},a.prototype.renderItem=a.prototype.renderItemDefault,e.exports=a},function(e,t,i){"use strict";var s=i(1),n=i(0);function a(e){e=e||{},this.$focusItem=null,this.viewIndex=null,this.data=[],this.type=this.TYPE_VERTICAL,this.size=5,this.cycle=!1,this.scroll=null,e.type&&(this.type=e.type),this.provider=null,this.type===this.TYPE_HORIZONTAL&&(e.className+=" horizontal"),s.call(this,e),this.init(e)}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-list",a.prototype.TYPE_VERTICAL=1,a.prototype.TYPE_HORIZONTAL=2,a.prototype.renderItemDefault=function(e,t){e.innerText=t.value},a.prototype.renderItem=a.prototype.renderItemDefault,a.prototype.defaultEvents={mousewheel:function(e){this.type===this.TYPE_VERTICAL&&e.wheelDeltaY&&this.move(e.wheelDeltaY>0?n.up:n.down),this.type===this.TYPE_HORIZONTAL&&e.wheelDeltaX&&this.move(e.wheelDeltaX>0?n.left:n.right)},keydown:function(e){switch(e.code){case n.up:case n.down:case n.right:case n.left:case n.pageUp:case n.pageDown:case n.home:case n.end:this.move(e.code);break;case n.enter:this.events["click:item"]&&this.$focusItem&&this.emit("click:item",{$item:this.$focusItem,event:e})}}},a.prototype.init=function(e){var t,i,s=this,n=this.$body.children.length,a=function(e){this.data&&(s.focusItem(this),s.events["click:item"]&&s.emit("click:item",{$item:this,event:e}))};if(void 0!==e.cycle&&(this.cycle=e.cycle),e.scroll&&(this.scroll=e.scroll),e.provider&&(this.provider=e.provider),e.render&&(this.renderItem=e.render),e.size&&(this.size=e.size),e.events&&Object.keys(e.events).forEach(function(t){s.events[t]=null,s.addListener(t,e.events[t])}),this.size!==n)for(n>0&&(this.$body.innerText=null),i=0;i<this.size;i++)(t=document.createElement("div")).index=i,t.className="item",t.addEventListener("click",a),this.$body.appendChild(t);if(this.provider){if(this.provider.blocked)return;this.provider.get(null,function(t,i){t?s.events["data:error"]&&s.emit("data:error",t):(i&&(e.data=i,s.setData(e),s.scroll&&s.scroll.init({realSize:s.provider.maxCount,viewSize:s.provider.size,value:s.provider.head+s.provider.pos})),s.events["data:get"]&&s.emit("data:get"))})}else e.data&&this.setData(e)},a.prototype.setData=function(e){e.data&&(this.data=function(e){var t;for(t=0;t<e.length;t++)"object"!=typeof e[t]&&(e[t]={value:e[t]});return e}(e.data)),this.viewIndex=null,this.$focusItem&&this.blurItem(this.$focusItem),this.scroll&&(this.provider?this.scroll.realSize!==this.provider.maxCount&&this.scroll.init({realSize:this.provider.maxCount,viewSize:this.provider.size,value:this.provider.head+this.provider.pos}):this.scroll.init({realSize:this.data.length,viewSize:this.size,value:e.viewIndex||0})),void 0!==e.focusIndex&&this.data.length?this.focusIndex(e.focusIndex):this.renderView(e.viewIndex||0)},a.prototype.renderView=function(e){var t,i,s,n,a;if(this.viewIndex!==e){for(n=this.viewIndex,this.viewIndex=a=e,i=0;i<this.size;i++)t=this.$body.children[i],(s=this.data[e])?(t.data=s,t.index=e,this.renderItem(t,s),s.mark?t.classList.add("mark"):t.classList.remove("mark")):(t.data=t.index=void 0,t.innerHTML=" ",t.ready=!1),e++;return this.events["move:view"]&&this.emit("move:view",{prevIndex:n,currIndex:a}),this.events["select:item"]&&this.emit("select:item",{$item:t}),this.scroll&&this.scroll.scrollTo(this.provider?this.provider.head+this.provider.pos:this.viewIndex),!0}return!1},a.prototype.move=function(e){var t=this,i=!1;if(this.data.length)switch(e){case n.left:if(this.type!==this.TYPE_HORIZONTAL)break;i=!0;case n.up:if(i||this.type===this.TYPE_VERTICAL)if(this.$focusItem&&this.$focusItem.index>0)this.$focusItem===this.$body.firstChild?this.renderView(this.viewIndex-1):this.focusItem(this.$focusItem.previousSibling);else if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,s){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:s||0===s?s:t.$focusItem.index})})}else this.cycle&&this.move(n.end),this.events["overflow"]&&this.emit("overflow",{direction:e,cycle:this.cycle});break;case n.right:if(this.type!==this.TYPE_HORIZONTAL)break;i=!0;case n.down:if(i||this.type===this.TYPE_VERTICAL)if(this.$focusItem&&this.$focusItem.index<this.data.length-1)this.$focusItem===this.$body.lastChild?this.renderView(this.viewIndex+1):this.focusItem(this.$focusItem.nextSibling);else if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,s){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:s||0===s?s:t.$focusItem.index})})}else this.cycle&&this.move(n.home),this.events["overflow"]&&this.emit("overflow",{direction:e,cycle:this.cycle});break;case n.pageUp:if(this.provider){if(this.provider.blocked)return;return void this.provider.get(e,function(e,i,s){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:s||0})})}this.viewIndex<this.size?this.renderView(0):this.renderView(this.viewIndex-this.size+1),this.focusItem(this.$body.firstChild);break;case n.pageDown:if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,s){var n;e?t.events["data:error"]&&t.emit("data:error",e):i&&(n=s||0===s?s:i.length<t.size?i.length-1:t.size-1,t.setData({data:i,focusIndex:n}))});break}this.data.length>this.size?(this.viewIndex>this.data.length-2*this.size?this.renderView(this.data.length-this.size):this.renderView(this.viewIndex+this.size-1),this.focusItem(this.$body.lastChild)):this.focusItem(this.$body.children[this.data.length-1]);break;case n.home:if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,s){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:s||0})});break}this.renderView(0),this.focusItem(this.$body.firstChild);break;case n.end:if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,s){var n;e?t.events["data:error"]&&t.emit("data:error",e):i&&(n=s||0===s?s:i.length<t.size?i.length-1:t.size-1,t.setData({data:i,focusIndex:n}))});break}this.data.length>this.size?(this.renderView(this.data.length-this.size),this.focusItem(this.$body.lastChild)):this.focusItem(this.$body.children[this.data.length-1])}},a.prototype.focusItem=function(e){var t=this.$focusItem;return!(!e||t===e)&&(null!==t&&(t.classList.remove("focus"),this.events["blur:item"]&&this.emit("blur:item",{$item:t})),this.$focusItem=e,this.$focusItem.data=this.data[this.$focusItem.index],e.classList.add("focus"),this.events["focus:item"]&&this.emit("focus:item",{$prev:t,$curr:e}),this.events["select:item"]&&this.emit("select:item",{$item:e}),!0)},a.prototype.blurItem=function(e){return!!e&&(e===this.$focusItem&&(this.$focusItem=null),e.classList.remove("focus"),this.events["blur:item"]&&this.emit("blur:item",{$item:e}),!0)},a.prototype.focusIndex=function(e){var t=this.viewIndex||0;e>=t+this.size?(e=e<this.data.length-1?e:this.data.length-1,this.renderView(e-this.size+1),this.focusItem(this.$body.lastChild)):e<t?(e=e>0?e:0,this.renderView(e),this.focusItem(this.$body.firstChild)):(null===this.viewIndex&&this.renderView(0),this.focusItem(this.$body.children[e-t]))},a.prototype.markItem=function(e,t){t?e.classList.add("mark"):e.classList.remove("mark"),e.data.mark=t},e.exports=a},function(e,t,i){"use strict";var s=i(28),n=i(1),a=i(0);function o(e){var t,i,n,o=this;(e=e||{}).events=e.events||{},e.focusable=e.focusable||!1,e.visible=e.visible||!1,e.events.click=e.events.click||function(){o.hide()},n=e.events.keydown,e.events.keydown=function(e){n&&n.call(this,e),e.code!==a.back&&e.code!==a.menu||(e.stop=!0,o.hide())},s.call(this,e),this.$node.appendChild(document.createElement("div")),this.$node.firstChild.classList.add("alignBox"),this.$node.firstChild.appendChild(document.createElement("div")),this.$header=document.createElement("div"),this.$header.className="header",this.$text=this.$header.appendChild(document.createElement("div")),this.$text.classList.add("text"),this.$text.innerText=e.title||"",e.icon&&(this.$icon=this.$header.appendChild(document.createElement("div")),this.$icon.className="icon "+e.icon),(t=document.createElement("div")).className="overlay",i=this.$body.parentNode.removeChild(this.$body),this.$node.firstChild.firstChild.appendChild(this.$header),this.$node.firstChild.firstChild.appendChild(i),this.$node.firstChild.firstChild.appendChild(t)}o.prototype=Object.create(s.prototype),o.prototype.constructor=o,o.prototype.name="mag-component-modal",o.prototype.focus=function(){this.$node.classList.add("active"),s.prototype.focus.call(this),this.children[0]&&this.children[0]instanceof n&&this.children[0].focus()},o.prototype.blur=function(){this.$node.classList.remove("active"),s.prototype.blur.call(this)},e.exports=o},function(e,t,i){"use strict";var s=i(5);s.once("load",function(){var e=i(8);s.userStore=core.state||null,i(21).load({name:core.environment.language},function(){s.pages={main:i(23)},e.load({},function(e){s.route(s.pages.main,{currentLocation:e}),s.ready()})})})},function(e,t,i){"use strict";var s=i(2),n=i(16);window.core=window.parent.getCoreInstance(window,s),i(17),i(18),i(7)("sdk"),i(20),i(7)("app"),s.platform="mag",s.ready=function(){window.core.call("app:ready")},s.exit=function(){s.events["exit"]&&s.emit("exit"),core.call("exit")},n.load=function(e){document.body.setAttribute("platform",s.platform),core.ready?s.events["load"]&&s.emit("load",{}):core.once("load",function(){s.events[e.type]&&s.emit(e.type,e)})},n.contextmenu=function(e){e.preventDefault()},Object.keys(n).forEach(function(e){window.addEventListener(e,n[e])}),e.exports=s},function(e,t,i){"use strict";e.exports={parse:function(e){var t={};return e.split("&").forEach(function(e){2===(e=e.split("=")).length&&(t[e[0]]=decodeURIComponent(e[1]))}),t},stringify:function(e){var t=[];return Object.keys(e).forEach(function(i){t.push(i+"="+encodeURIComponent(e[i]))}),t.join("&")}}},function(e,t,i){"use strict";var s=i(2);e.exports={DOMContentLoaded:function(e){s.events["dom"]&&s.emit("dom",e)},load:function(e){s.events[e.type]&&s.emit(e.type,e)},unload:function(e){s.events[e.type]&&s.emit(e.type,e)},error:function(e){},keydown:function(e){var t,i=s.activePage,n={code:e.keyCode,stop:!1};e.ctrlKey&&(n.code+="c"),e.altKey&&(n.code+="a"),e.shiftKey&&(n.code+="s"),(t=i.activeComponent)&&t!==i&&(t.events[e.type]&&t.emit(e.type,n,e),!n.stop&&t.propagate&&t.parent&&t.parent.events[e.type]&&t.parent.emit(e.type,n,e)),n.stop||(i.events[e.type]&&i.emit(e.type,n,e),e.stop||s.events[e.type]&&s.emit(e.type,n,e))},keypress:function(e){var t=s.activePage;t.activeComponent&&t.activeComponent!==t&&t.activeComponent.events[e.type]&&t.activeComponent.emit(e.type,e)},mousewheel:function(e){var t=s.activePage;t.activeComponent&&t.activeComponent!==t&&t.activeComponent.events[e.type]&&t.activeComponent.emit(e.type,e),e.stop||t.events[e.type]&&t.emit(e.type,e)}}},function(e,t,i){"use strict";if(!document.documentElement.classList){var s=Array.prototype,n=s.indexOf,a=s.slice,o=s.push,r=s.splice,c=s.join;window.DOMTokenList=function(e){if(this._element=e,e.className!==this._classCache){if(this._classCache=e.className,!this._classCache)return;var t,i=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(t=0;t<i.length;t++)o.call(this,i[t])}},window.DOMTokenList.prototype={add:function(e){this.contains(e)||(o.call(this,e),this._element.className=a.call(this,0).join(" "))},contains:function(e){return-1!==n.call(this,e)},item:function(e){return this[e]||null},remove:function(e){var t=n.call(this,e);-1!==t&&(r.call(this,t,1),this._element.className=a.call(this,0).join(" "))},toString:function(){return c.call(this," ")},toggle:function(e){return this.contains(e)?this.remove(e):this.add(e),this.contains(e)}},Object.defineProperty(Element.prototype,"classList",{get:function(){return new window.DOMTokenList(this)}})}},function(e,t,i){"use strict";var s=i(2),n=i(19);s.metrics=n[s.query.screenHeight]||n[screen.height]||n[720],s.metrics.availHeight=s.metrics.height-(s.metrics.availTop+s.metrics.availBottom),s.metrics.availWidth=s.metrics.width-(s.metrics.availLeft+s.metrics.availRight)},function(e,t,i){"use strict";e.exports={480:{height:480,width:720,availTop:24,availBottom:24,availRight:32,availLeft:48},576:{height:576,width:720,availTop:24,availBottom:24,availRight:26,availLeft:54},720:{height:720,width:1280,availTop:30,availBottom:30,availRight:40,availLeft:40},1080:{height:1080,width:1920,availTop:45,availBottom:45,availRight:60,availLeft:60}}},function(e,t,i){"use strict";var s,n=i(2);(s=document.createElement("link")).rel="stylesheet",s.href=window.core.theme.path+n.metrics.height+".css",document.head.appendChild(s),e.exports=s},function(e,t,i){"use strict";var s=i(4),n=i(22),a=new s;function o(e){var t=new n(e);return window.gettext=window._=t.gettext,window.pgettext=t.pgettext,window.ngettext=t.ngettext,t}a.defaultLanguage="en",a.load=function(e,t){var i;return e.ext=e.ext||"json",e.path=e.path||"lang",e.name===a.defaultLanguage?(o(),t(null),!1):((i=new XMLHttpRequest).onload=function(){try{o(JSON.parse(i.responseText)),t(null),a.events["load"]&&a.emit("load")}catch(e){i.onerror(e)}},i.ontimeout=i.onerror=function(e){o(),t(e),a.events["error"]&&a.emit("error",e)},i.open("GET",e.path+"/"+e.name+"."+e.ext,!0),i.send(null),!0)},e.exports=a},function(module,exports,__webpack_require__){"use strict";function Gettext(config){var data,meta;config=config||{},data=config.data||{},data[""]=data[""]||{},meta=config.meta,this.gettext=function(e){return data[""][e]||e},this.pgettext=function(e,t){return data[e]&&data[e][t]||t},this.ngettext=function(msgId,plural,value){var n,evalResult;return data&&meta&&data[""][msgId]?(evalResult=eval("n = "+value+"; "+meta.plural),"boolean"==typeof evalResult&&(evalResult=+evalResult),data[""][msgId][evalResult]):1===value?msgId:plural}}Gettext.prototype.constructor=Gettext,module.exports=Gettext},function(e,t,i){"use strict";var s,n,a,o,r,c,d,l,h,u,p,m=i(5),f=i(0),y=i(24),v=i(26),g=i(10),x=i(12),b=i(30),$=i(32),w=i(34),C=i(35),D=i(36),I=i(37),N=i(8),E=i(41),S=i(6),k=i(42),T=i(43),L=new(i(45))({$node:window["pageMain"]}),z={},M=[],P={},O={},B="°C",R="°F",_="";function H(){o.$node.classList.remove("itemsNewProportions"),s.hide(),L.modals.search.show(),L.modals.search.focus()}function A(){L.modals.search.hide(),L.modals.settingsTemperature.hide(),L.modals.settingsWindSpeedUnits.hide(),L.modals.locationContextMenu.hide(),s.focus(),m.flags.isSettingsModalShown=!1,m.flags.isAddCityModalShown=!1,m.flags.isContextMenuModalShown=!1,m.isDisplaySettings||L.footer.show()}function F(e){var t;try{t=z[e]}catch(e){}return t}function j(){(O.temperature&&c.temperature!==O.temperature||O.windSpeedUnits&&c.windSpeedUnits!==O.windSpeedUnits)&&(O.temperature&&c.temperature!==O.temperature&&(c.temperature=O.temperature),O.windSpeedUnits&&c.windSpeedUnits!==O.windSpeedUnits&&(c.windSpeedUnits=O.windSpeedUnits),m.saveData(),L.forecastBlock.forecastId&&T.setForecast(L.forecastBlock,F(L.forecastBlock.forecastId)))}function U(e,t,i,n,a,c){var d={items:[{className:"theme-icon theme-icon-plus"+(t.length?" theme-header":"")},{value:gettext("Add city"),className:t.length?"theme-header":""}],click:H},l=[{items:[{className:"theme-icon theme-icon-settings theme-footer"},{value:gettext("Settings"),className:"theme-footer"}],click:function(){m.isDisplaySettings||(p.tmp=p.innerText,p.innerText=gettext("settings"),L.forecastBlock.hide(),h.show(),o.$node.classList.add("itemsNewProportions"),L.footer.hide(),m.isDisplaySettings=!0)}},{items:[{className:"theme-icon theme-icon-exit"},{value:gettext("Exit")}],click:function(){s.blur(),E.goExit()}}],u={scroll:t.length<=n?null:a,size:i,data:t||[],focusIndex:t.length-1};e===r&&(u.data.unshift(d),u.data=u.data.concat(l)),c&&Object.keys(c).forEach(function(e){u[e]=c[e]}),a&&(u.data.length>n?e.scroller||(e.scroller=1,a.init({realSize:u.data.length}),a.$node.style.display=""):(e.scroller=0,a.$node.style.display="none")),e.init(u)}function V(e){e&&N.search({language:core.environment.language,query:e},function(e){e&&e.length?(m.flags.isSearchPlaceSuccess=!0,U(n,e.map(function(e){var t,i,a=(t=e.display_name,i=/^[^,]+/,/^[^,]+$/.test(t)?t:[t.match(i)[0],t.replace(i,"").slice(2)]),c=Array.isArray(a),f=c?a[0]:a,y={lat:e.lat,lon:e.lon},v=("id"+Math.random()*Date.now()).replace(".","");return{items:[{value:f,className:"placeTitleListBlock"},{value:c?a[1]:"",className:"placeRestListBlock"}],click:function(){var t,i,a=!0;for(i=d.length;i--;)if(d[i].lat===y.lat&&d[i].lon===y.lon){a=!1;break}a&&(_="",t={items:[{className:"theme-icon theme-icon-cloud-sun-2 "+v},{value:f,className:"addPlaceTitle"}],value:{id:v,lat:y.lat,lon:y.lon,fullName:e.display_name},click:function(){m.isDisplaySettings&&(j(),p.innerText=p.tmp,h.hide(),L.forecastBlock.show(),o.$node.classList.remove("itemsNewProportions"),L.footer.show(),m.isDisplaySettings=!1,r.emit("focus:item",{$curr:{index:r.$focusItem.index}}))}},P[v]=t,M.push(t),U(r,M.slice(),M.length>4?7:M.length+3,7,l,{focusIndex:M.length}),d.push({fullName:e.display_name,shortName:f,lat:y.lat,lon:y.lon}),m.saveData(),new I({location:y},function(e){var t;for(z[v]=e,t=M.length;t--;)M[t].value.id===v&&(M[t]=P[v]);L.forecastBlock.forecastId=v,T.setForecast(L.forecastBlock,F(v))})),n.init({size:5,data:[]}),u.$body.children[0].children[0].children[1].innerText=u.$body.children[0].children[0].children[1].parentNode.parentNode.data.value.defaultValue,s.show(),A()}}}),5,5,null),n.blurItem(n.$focusItem)):(m.flags.isSearchPlaceSuccess=!1,U(n,[],5,5,null))})}function W(){core.notify({title:gettext("Are you sure you want to delete this location?"),icon:"info",type:"",buttons:[{value:gettext("Cancel")},{value:gettext("Ok"),click:function(){var e,t=r.$focusItem,i=t.data.value.id;for(e=d.length;e--;)if(d[e].lat===t.data.value.lat&&d[e].lon===t.data.value.lon){d.splice(e,1);break}m.saveData(),delete P[i],delete z[i],M=M.filter(function(e){return e.value.id!==i}),U(r,M.slice(),M.length>4?7:M.length+3,7,l,{focusIndex:M.length?t.index:0}),M.length||(T.setNoData(L.forecastBlock),p.innerText=gettext("No cities")),A()}}]})}function Y(e){return[{items:[{className:"theme-icon theme-icon-rc-f2"},gettext("Add city")],click:function(){H.itemToReturn={idx:r.$focusItem.index},A(),H()}},{items:[{className:"theme-icon theme-icon-rc-f1"},gettext("Delete city")],click:W},{items:[{className:"theme-icon theme-icon-up"},gettext("Move up")],click:function(){var e,t=r.$focusItem.index-1;e=M[t-1],M[t-1]=M[t],M[t]=e,U(r,M.slice(),M.length>4?7:M.length+3,7,l,{focusIndex:t}),A()}},{items:[{className:"theme-icon theme-icon-down"},gettext("Move down")],click:function(){var e,t=r.$focusItem.index-1;e=M[t+1],M[t+1]=M[t],M[t]=e,U(r,M.slice(),M.length>4?7:M.length+3,7,l,{focusIndex:t+2}),A()}}].filter(function(t,i){return+e[i]})}function q(e,t){var i,d,I=e.length,N=S.searchInputDelay,z={keydown:function(e){g.prototype.defaultEvents.keydown.call(this,e),e.code!==f.back&&e.code!==f.menu||(e.stop=!0,A())}},P=[{items:[{className:"theme-icon theme-icon-plus"+(e.length?" theme-header":"")},{value:gettext("Add city"),className:e.length?"theme-header":""}],click:H}],j=[{items:[{className:"theme-icon theme-icon-settings theme-footer"},{value:gettext("Settings"),className:"theme-footer"}],click:function(){m.isDisplaySettings||(p.tmp=p.innerText,p.innerText=gettext("settings"),L.forecastBlock.hide(),h.show(),o.$node.classList.add("itemsNewProportions"),L.footer.hide(),m.isDisplaySettings=!0)}},{items:[{value:"",className:"theme-icon theme-icon-exit"},{value:gettext("Exit"),className:""}],click:function(){s.blur(),E.goExit()}}];function U(){var e;r.$focusItem.data&&r.$focusItem.data.value&&r.$focusItem.data.value.fullName?(e=r.$focusItem.data.value.id,p.innerText=r.$focusItem.data.value.fullName,L.footer.init(L.footer.onCityConfig),L.forecastBlock.forecastId=e,T.setForecast(L.forecastBlock,F(e))):L.footer.init(L.footer.noCityConfig)}L.modals={},L.footer=new w({parent:L}),L.footer.noCityConfig={left:{code:f.menu,action:function(){d.init({size:1,data:Y("1000"),events:z}),s.blur(),setTimeout(function(){L.modals.locationContextMenu.show()},0),L.footer.hide()}},middle:[{code:f.f2,title:gettext("Add city"),action:H}]},L.footer.onCityConfig={left:{code:f.menu,action:function(){var e=r.$focusItem;M.length>1?1===e.index?d.init({size:3,data:Y("1101"),events:z}):e.index-1==M.length-1?d.init({size:3,data:Y("1110"),events:z}):d.init({size:4,data:Y("1111"),events:z}):d.init({size:2,data:Y("1100"),events:z}),s.blur(),setTimeout(function(){L.modals.locationContextMenu.show()},0),L.footer.hide()}},middle:[{code:f.f1,title:gettext("Delete"),action:W},{code:f.f2,title:gettext("Add city"),action:H}]},i=[{items:[{value:gettext("temperature")},{value:t&&t.temperature?"C"===t.temperature?B:R:B,className:"optionTemperatureIndicator theme-text-disabled"}],click:function(){s.blur(),L.modals.settingsTemperature.show(),L.modals.settingsTemperature.focus(),m.flags.isSettingsModalShown=!0}},{items:[{value:gettext("Wind speed")},{value:t&&t.windSpeedUnits?gettext(t.windSpeedUnits):gettext("m/s"),className:"optionWindSpeedIndicator theme-text-disabled"}],click:function(){s.blur(),L.modals.settingsWindSpeedUnits.show(),L.modals.settingsWindSpeedUnits.focus(),m.flags.isSettingsModalShown=!0}}],l=new $({viewSize:7,realSize:I}),L.modals.search=new x({className:"searchPlaceModalWindow",title:gettext("Add city"),events:{show:function(){u.focusIndex(0),k({title:gettext("Add city"),elemSelector:u.$body.children[0].children[0].children[1],value:_},function(e){setTimeout(function(){V(_=e.value.trim())},N)}),m.flags.isAddCityModalShown=!0,L.footer.hide()},hide:function(){s.show(),s.focus(),L.footer.show()}},children:[u=new g({size:1,data:[{items:[{value:"",className:"theme-icon theme-icon-search"},{value:gettext("Search"),className:"inputSearch"}],value:{defaultValue:gettext("Search")},click:function(){k({title:gettext("Add city"),elemSelector:u.$body.children[0].children[0].children[1],value:_},function(e){setTimeout(function(){V(_=e.value.trim())},N)})}}],events:{overflow:function(e){e.direction===f.down&&m.flags.isSearchPlaceSuccess&&(this.blurItem(this.$focusItem),n.focus(),n.focusIndex(0))}}}),n=new g({className:"padded",events:{overflow:function(e){e.direction===f.up&&(n.blurItem(n.$focusItem),u.focus(),u.focusIndex(0))}}})]}),L.modals.settingsTemperature=new x({title:gettext("units"),events:{show:function(){L.modals.settingsTemperature.children[0].focus(),m.flags.isSettingsModalShown=!0}},children:[new b({focusIndex:0,size:2,events:{"click:item":function(e){e.$item.value?(h.$focusItem.children[0].children[1].innerText=R,O.temperature="F"):(h.$focusItem.children[0].children[1].innerText=B,O.temperature="C"),A()}},data:[{state:!c||"C"===c.temperature,title:gettext("Celsius"),value:0},{state:!!c&&"F"===c.temperature,title:gettext("Fahrenheit"),value:1}]})]}),L.modals.settingsWindSpeedUnits=new x({title:gettext("units"),events:{show:function(){L.modals.settingsWindSpeedUnits.children[0].focus(),m.flags.isSettingsModalShown=!0}},children:[new b({focusIndex:0,size:3,events:{"click:item":function(e){2===e.$item.value?(h.$focusItem.children[0].children[1].innerText=gettext("m/h"),O.windSpeedUnits="m/h"):1===e.$item.value?(h.$focusItem.children[0].children[1].innerText=gettext("km/h"),O.windSpeedUnits="km/h"):(h.$focusItem.children[0].children[1].innerText=gettext("m/s"),O.windSpeedUnits="m/s"),A()}},data:[{state:!c||"m/s"===c.windSpeedUnits,title:gettext("m/s"),value:0},{state:!!c&&"km/h"===c.windSpeedUnits,title:gettext("km/h"),value:1},{state:!!c&&"m/h"===c.windSpeedUnits,title:gettext("m/h"),value:2}]})]}),L.modals.locationContextMenu=new x({title:gettext("actions"),events:{show:function(){L.modals.locationContextMenu.focus(),d.focusIndex(0),m.flags.isContextMenuModalShown=!0},hide:A},children:[d=new g({cycle:!0,focusIndex:0,size:0,data:[]})]}),L.forecastBlock=new C({propagate:!0}),L.add(L.modals.search),L.add(L.modals.settingsTemperature),L.add(L.modals.settingsWindSpeedUnits),L.add(L.modals.locationContextMenu),L.add(s=new v({panels:[a=new y({size:1,title:gettext("menu"),children:[r=new g({cycle:!0,size:e.length>4?7:e.length+3,focusIndex:+!!e.length,data:P.concat(e,j),scroll:l,events:{"focus:item":function(e){m.mainPanelSet&&!m.isDisplaySettings&&(e.$curr&&e.$curr.index?U():L.footer.init(L.footer.noCityConfig))},"move:view":function(e){m.mainPanelSet&&!m.isDisplaySettings&&(1===e.currIndex||e.currIndex>1&&e.prevIndex?U():L.footer.init(L.footer.noCityConfig))}}})],events:{focus:function(e){y.prototype.defaultEvents.focus.call(this,e),r.$focusItem&&L.footer.init(L.footer[(r.$focusItem.data.value?"on":"no")+"CityConfig"])}}}),o=new y({size:2,title:[{className:"forecastLocationInfo"},D.tag("div",{className:"amountContainer"},D.tag("div",{className:"forecastUpdateInfo"},""))],main:!0,children:[L.forecastBlock,h=new g({className:"padded",cycle:!0,visible:!1,focusIndex:0,size:2,data:i})],events:{focus:function(e){y.prototype.defaultEvents.focus.call(this,e),L.footer.init(L.footer[(M.length?"on":"no")+"CityConfig"])}}})]})),T.init(L.forecastBlock,e[0]),m.mainPanelSet=s,p=o.title.$node.children[0],a.$body.appendChild(l.$node),e.length?(L.footer.init(L.footer.onCityConfig),o.focus(),p.innerText=e[0].value.fullName):(L.footer.init(L.footer.noCityConfig),a.focus(),p.innerText=gettext("No cities")),L.footer.show(),o.add(L.forecastBlock),e.length<=4&&(l.$node.style.display="none"),o.addListener("focus",function(){m.isDisplaySettings&&h.focus()}),u.$body.firstElementChild.classList.add("bgDarken")}m.flags={isContextMenuModalShown:!1,isAddCityModalShown:!1,isSettingsModalShown:!1,isDisplaySettings:!1,isSearchPlaceSuccess:!1},m.saveData=function(){core.state=m.userStore},L.once("show",function(){var e;document.getElementById("forecast").classList.add("hiddenBlock"),m.userStore?(d=m.userStore.locations||[],c=m.userStore.settings||{},d.length&&document.getElementById("forecast").classList.remove("hiddenBlock"),q((e=d)?e.map(function(e,t){var i=("id"+Math.random()*Date.now()).replace(".",""),s={items:[{className:"theme-icon theme-icon-cloud-sun-2 "+i},{value:e.shortName,className:"addPlaceTitle"}],value:{id:i,lat:e.lat,lon:e.lon,fullName:e.fullName},click:function(){m.isDisplaySettings&&(j(),p.innerText=p.tmp,h.hide(),L.forecastBlock.show(),o.$node.classList.remove("itemsNewProportions"),L.footer.show(),m.isDisplaySettings=!1,r.emit("focus:item",{$curr:{index:r.$focusItem.index}}))}};return P[i]=s,M.push(s),new I({location:{lat:e.lat,lon:e.lon}},function(e){z[i]=e,M.length=0,Object.keys(P).forEach(function(e){M.push(P[e])}),L.forecastBlock.forecastId=i,t===r.$focusItem.index-1&&T.setForecast(L.forecastBlock,F(i))}),s}):[],c)):(q([],null),m.userStore={},d=m.userStore.locations=[],c=m.userStore.settings={}),c.temperature=c.temperature||"C",c.windSpeedUnits=c.windSpeedUnits||"m/s",m.saveData()}),L.addListener("keydown",function(e){switch(e.code){case f.back:m.flags.isSettingsModalShown||m.flags.isAddCityModalShown||m.flags.isContextMenuModalShown?(m.flags.isAddCityModalShown&&(_="",n.init({size:5,data:[]}),u.$body.children[0].children[0].children[1].innerText=u.$body.children[0].children[0].children[1].parentNode.parentNode.data.value.defaultValue),A(),s.show(),H.itemToReturn&&(o.focus(),(void 0).focusIndex(H.itemToReturn.idx),H.itemToReturn=null)):E.goBack()}}),e.exports=L},function(e,t,i){"use strict";var s=i(1),n=i(25);function a(e){var t;e=e||{},this.size=1,this.main=!1,this.index=0,e.$body=document.createElement("div"),e.$body.className="body",s.call(this,e),e.size&&(this.size=e.size,this.$node.classList.add("size"+e.size)),e.main&&(this.main=!0,this.$node.classList.add("main")),this.shadows={$left:document.createElement("div"),$right:document.createElement("div")},this.shadows.$left.className="shadow left",this.$node.appendChild(this.shadows.$left),this.shadows.$right.className="shadow right",this.$node.appendChild(this.shadows.$right),e.title&&(Array.isArray(e.title)||(e.title=[e.title]),this.title=new n({className:"title",data:e.title,focusable:!1}),this.$node.appendChild(this.title.$node)),this.$node.appendChild(this.$body),(t=document.createElement("div")).className="overlay",this.$node.appendChild(t)}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-panel",a.prototype.defaultEvents={focus:function(){this.children.length&&this.children[0].focus()}},a.prototype.focus=function(){this.focusable&&(this.parent.panels[this.parent.focusIndex].$node.classList.remove("active"),this.parent.panels[this.parent.focusIndex].$node.classList.remove("top"),s.prototype.focus.call(this),this.parent.focusIndex=this.index,this.$node.classList.add("active"),this.$node.classList.add("top"),0===this.index&&this.parent.panels[1]&&this.parent.panels[1].main?(this.parent.panels[1].$node.classList.remove("position-left"),this.parent.panels[1].$node.classList.add("position-right"),this.parent.panels[2]&&this.parent.panels[2].$node.classList.remove("expand"),this.$node.classList.add("expand")):2===this.index&&this.parent.panels[1].main&&(this.parent.panels[1].$node.classList.remove("position-right"),this.parent.panels[1].$node.classList.add("position-left"),this.parent.panels[0].$node.classList.remove("expand"),this.$node.classList.add("expand")))},a.prototype.blur=function(){this.parent.panels[this.parent.focusIndex].$node.classList.remove("active"),s.prototype.blur.call(this)},e.exports=a},function(e,t,i){"use strict";var s=i(1),n=i(0);function a(e){var t=this;e=e||{},this.focusIndex=0,this.data=[],s.call(this,e),this.init(e),this.addListener("keydown",function(e){switch(e.code){case n.right:t.children.length&&t.focusIndex<t.children.length-1&&t.children[++t.focusIndex].focus();break;case n.left:t.children.length&&t.focusIndex>0&&t.children[--t.focusIndex].focus();break;case n.back:t.parent&&(t.parent.focus(),t.$parentItem&&t.parent.focusItem(t.$parentItem))}})}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-layout",a.prototype.init=function(e){for(var t,i,n,a=this,o=function(e){var t,i;for(t=0;t<e.length;t++)"object"==typeof(i=e[t])?i instanceof s||i instanceof HTMLElement?e[t]={value:i,wrap:!1}:e[t].wrap=!0:e[t]={value:e[t],wrap:!0};return e}(e.data);this.$node.firstChild;)this.$node.removeChild(this.$node.firstChild);function r(){a.focusIndex=this.index}for(this.data=o,n=0;n<o.length;n++)"string"==typeof(t=o[n]).value?((i=document.createElement("div")).textContent=t.value,t.className&&(i.className=t.className),this.$node.appendChild(i)):t.value instanceof HTMLElement?t.wrap?(i=document.createElement("div"),t.className&&(i.className=t.className),i.appendChild(t.value),this.$node.appendChild(i)):this.$node.appendChild(t.value):t.value instanceof s?(t.value.propagate=!0,t.value.index=this.children.length,t.value.addListener("click",r),t.wrap?(i=document.createElement("div"),t.className&&(i.className=t.className),i.appendChild(t.value.$node),this.$node.appendChild(i),this.children.push(t.value),t.value.parent=this):this.add(t.value)):(i=document.createElement("div"),t.className&&(i.className=t.className),this.$node.appendChild(i))},e.exports=a},function(e,t,i){"use strict";var s=i(1),n=i(0);function a(e){var t,i=this;function a(e){switch(e.code){case n.left:i.focusIndex>0&&i.panels[i.focusIndex-1].focus();break;case n.right:i.focusIndex<i.panels.length-1&&i.panels[i.focusIndex+1].focus()}}for((e=e||{}).focusable=e.focusable||!1,s.call(this,e),this.panels=e.panels,this.focusIndex=0,e.panels&&!e.panels[0].main&&(e.panels[0].$node.classList.add("left"),e.panels[0].$node.classList.add("expand")),e.panels&&e.panels[1]&&e.panels[1].main&&e.panels[1].$node.classList.add("position-right"),e.panels&&e.panels[2]&&e.panels[1].main&&e.panels[2].$node.classList.add("right"),e.panels&&this.add.apply(this,e.panels),t=0;t<this.panels.length;t++)this.panels[t].addListeners({keydown:a}),this.panels[t].index=t}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-panel-set",a.prototype.focus=function(){s.prototype.focus.call(this),this.panels[this.focusIndex].focus()},a.prototype.blur=function(){this.panels[this.focusIndex].blur()},e.exports=a},function(e,t,i){"use strict";var s=i(1),n=i(0);function a(e){var t=this;e=e||{},this.focusIndex=0,this.data=[],this.links={},s.call(this,e),this.init(e),this.addListener("keydown",function(e){switch(e.code){case n.right:t.children.length&&t.focusIndex<t.children.length-1&&t.children[++t.focusIndex].focus();break;case n.left:t.children.length&&t.focusIndex>0&&t.children[--t.focusIndex].focus();break;case n.back:t.parent&&(t.parent.focus(),t.$parentItem&&t.parent.focusItem(t.$parentItem))}})}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-layout",a.prototype.init=function(e){for(var t,i,n,a=this,o=function(e){var t,i;for(t=0;t<e.length;t++)"object"==typeof(i=e[t])?i instanceof s||i instanceof HTMLElement?e[t]={value:i,wrap:!1}:e[t].wrap=!0:e[t]={value:e[t],wrap:!0};return e}(e.data);this.$node.firstChild;)this.$node.removeChild(this.$node.firstChild);function r(){a.focusIndex=this.index}for(this.data=o,n=0;n<o.length;n++)"string"==typeof(t=o[n]).value?((i=document.createElement("div")).textContent=t.value,t.className&&(i.className=t.className),this.$node.appendChild(i),t.name&&(this.links[t.name]=i)):t.value instanceof HTMLElement?t.wrap?(i=document.createElement("div"),t.className&&(i.className=t.className),i.appendChild(t.value),this.$node.appendChild(i),t.name&&(this.links[t.name]=i)):(this.$node.appendChild(t.value),t.name&&(this.links[t.name]=t.value)):t.value instanceof s?(t.value.propagate=!0,t.value.index=this.children.length,t.value.addListener("click",r),t.wrap?(i=document.createElement("div"),t.className&&(i.className=t.className),i.appendChild(t.value.$node),this.$node.appendChild(i),this.children.push(t.value),t.value.parent=this,t.name&&(this.links[t.name]=i)):(this.add(t.value),t.name&&(this.links[t.name]=t.value))):(i=document.createElement("div"),t.className&&(i.className=t.className),this.$node.appendChild(i),t.name&&(this.links[t.name]=i))},e.exports=a},function(e,t,i){"use strict";e.exports=i(29),e.exports.prototype.name="stb-component-modal"},function(e,t,i){"use strict";var s=i(3);function n(e){(e=e||{}).$body=document.createElement("div"),e.$body.className="body",s.call(this,e),this.$node.appendChild(document.createElement("div").appendChild(this.$body).parentNode)}n.prototype=Object.create(s.prototype),n.prototype.constructor=n,n.prototype.name="spa-component-modal",e.exports=n},function(e,t,i){"use strict";var s=i(11),n=i(31),a=0;function o(e){var t=this;this.group="group "+a++,this.$checkedData=null,s.call(this,e),this.addListener("click:item",function(e){var i=e.$item;i.checkBox.set(!0),i.state=i.checkBox.value,i.data.state=i.checkBox.value,t.$checkedData!==i.data&&(t.emit("select",{$last:t.$checkedData,$curr:i}),t.$checkedData&&(t.$checkedData.state=!1),t.$checkedData=i.data)})}o.prototype=Object.create(s.prototype),o.prototype.constructor=o,o.prototype.name="mag-component-radio-list",o.prototype.group=0,o.prototype.renderItemDefault=function(e,t){var i=document.createElement("table"),s=document.createElement("tr"),a=document.createElement("td"),o=new n({group:this.group});e.innerHTML="",t.state&&(o.set(!0),this.$checkedData=t),i.appendChild(s),a.appendChild(o.$node),a.className="checkBoxWrapper",s.appendChild(a),(a=document.createElement("td")).className="title",a.innerText=t.title||"",s.appendChild(a),e.checkBox=o,e.state=o.value,e.value=t.value,e.appendChild(i)},o.prototype.renderItem=o.prototype.renderItemDefault,e.exports=o},function(e,t,i){"use strict";var s=i(3),n=i(9),a={};function o(e){e=e||{},this.value=!!e.value,this.value&&(e.className+=" checked"),this.group=null,e.group&&(e.className+=" grouped",this.group=e.group,void 0===a[e.group]?a[e.group]=[this]:a[e.group].push(this)),s.call(this,e)}o.prototype=Object.create(s.prototype),o.prototype.constructor=o,o.prototype.name="spa-component-checkbox",o.prototype.defaultEvents={click:function(){this.set(!this.value)},keydown:function(e){e.code===n.enter&&this.set(!this.value)}},o.prototype.set=function(e){var t,i;if(this.value!==e){if(!this.value&&null!==this.group)for(t=0,i=a[this.group].length;t<i;t++)a[this.group][t].set(!1);return this.value=!this.value,this.$node.classList.toggle("checked"),this.events["change"]&&this.emit("change",{value:this.value}),!0}return!1},e.exports=o},function(e,t,i){"use strict";e.exports=i(33),e.exports.prototype.name="stb-component-scrollbar"},function(e,t,i){"use strict";var s=i(3);function n(e){e=e||{},this.viewSize=10,this.realSize=100,this.value=0,this.type=this.TYPE_VERTICAL,this.thumbRect=null,this.trackRect=null,e.focusable=e.focusable||!1,e.type&&(this.type=e.type),this.type===this.TYPE_HORIZONTAL&&(e.className+=" horizontal"),s.call(this,e),this.$thumb=this.$body.appendChild(document.createElement("div")),this.$thumb.className="thumb",this.init(e)}n.prototype=Object.create(s.prototype),n.prototype.constructor=n,n.prototype.name="spa-component-scrollbar",n.prototype.TYPE_VERTICAL=1,n.prototype.TYPE_HORIZONTAL=2,n.prototype.init=function(e){void 0!==(e=e||{}).realSize&&(this.realSize=e.realSize),void 0!==e.viewSize&&(this.viewSize=e.viewSize),this.viewSize>=this.realSize?this.$thumb.classList.add("hidden"):this.$thumb.classList.remove("hidden"),void 0!==e.value&&this.scrollTo(e.value),this.type===this.TYPE_VERTICAL?this.$thumb.style.height=this.viewSize/this.realSize*100+"%":this.$thumb.style.width=this.viewSize/this.realSize*100+"%",this.thumbRect=this.$thumb.getBoundingClientRect(),this.trackRect=this.$node.getBoundingClientRect()},n.prototype.scrollTo=function(e){return this.value!==e&&(0!==this.thumbRect.height&&0!==this.thumbRect.width||(this.trackRect=this.$node.getBoundingClientRect(),this.thumbRect=this.$thumb.getBoundingClientRect()),this.type===this.TYPE_VERTICAL?this.$thumb.style.marginTop=(this.trackRect.height-this.thumbRect.height)*e/(this.realSize-this.viewSize)+"px":this.$thumb.style.marginLeft=(this.trackRect.width-this.thumbRect.width)*e/(this.realSize-this.viewSize)+"px",this.events["change"]&&this.emit("change",{curr:e,prev:this.value}),e>=this.realSize&&(e=this.realSize,this.events["done"]&&this.emit("done")),this.value=e,!0)},e.exports=n},function(e,t,i){"use strict";var s=i(1),n=i(0),a={};function o(e){var t=0,i=this;(e=e||{}).focusable=!1,e.visible=e.visible||!1,e.$body=document.createElement("div"),e.$body.className="body",s.call(this,e),this.tabs=[{codes:{}},{codes:{}},{codes:{}},{codes:{}}],this.tab=0,this.$table=this.$node.appendChild(document.createElement("table")),this.$table.insertRow(),this.$table.rows[0].insertCell(-1),this.$left=this.$table.rows[0].cells[0].appendChild(document.createElement("div")),this.$left.className="theme-icon",this.$table.rows[0].insertCell(-1),this.$table.rows[0].cells[1].className="central",this.tabs[t].$body=this.$table.rows[0].cells[1].appendChild(document.createElement("div")),this.tabs[t].$body.className="wrapper hidden",this.tabs[t].$body.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.className="button",this.tabs[t].$body.lastChild.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.lastChild.className="title",++t,this.tabs[t].$body=this.$table.rows[0].cells[1].appendChild(document.createElement("div")),this.tabs[t].$body.className="wrapper hidden",this.tabs[t].$body.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.className="button",this.tabs[t].$body.lastChild.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.lastChild.className="title",this.tabs[t].$body.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.className="button",this.tabs[t].$body.lastChild.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.appendChild(document.createElement("div")),this.tabs[t].$body.lastChild.lastChild.className="title",++t,this.tabs[t].$body=this.$table.rows[0].cells[1].appendChild(document.createElement("div")),this.tabs[t].$body.className="wrapper hidden",this.tabs[t].$body.appendChild(document.createElement("div