text: !(function(){"use strict";function t(t){return t&&t.__esModule?t.default:t}function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t,e){var n=e.authToken,r=e.host;return xe({authToken:n,host:r,isValidating:!0,isInvalid:!1,errorMessage:""})}function r(){return Ve.getInitialState()}function i(t,e){var n=e.errorMessage;return t.withMutations((function(t){return t.set("isValidating",!1).set("isInvalid",!0).set("errorMessage",n)}))}function o(t,e){var n=e.authToken,r=e.host;return Fe({authToken:n,host:r})}function u(){return Ge.getInitialState()}function a(t,e){var n=e.rememberAuth;return n}function s(t){return t.withMutations((function(t){t.set("isStreaming",!0).set("hasError",!1)}))}function c(t){return t.withMutations((function(t){t.set("isStreaming",!1).set("hasError",!0)}))}function f(){return Xe.getInitialState()}function h(t){return{type:"auth",api_password:t}}function l(){return{type:"get_states"}}function p(){return{type:"get_config"}}function _(){return{type:"get_services"}}function d(){return{type:"get_panels"}}function v(t,e,n){var r={type:"call_service",domain:t,service:e};return n&&(r.service_data=n),r}function y(t){var e={type:"subscribe_events"};return t&&(e.event_type=t),e}function m(t){return{type:"unsubscribe_events",subscription:t}}function g(){return{type:"ping"}}function S(t,e){return{type:"result",success:!1,error:{code:t,message:e}}}function b(t){return t.result}function E(t,e){var n=new tn(t,e);return n.connect()}function I(t,e,n,r){void 0===r&&(r=null);var i=t.evaluate(Mo.authInfo),o=i.host+"/api/"+n;return new Promise(function(t,n){var u=new XMLHttpRequest;u.open(e,o,!0),u.setRequestHeader("X-HA-access",i.authToken),u.onload=function(){var e;try{e="application/json"===u.getResponseHeader("content-type")?JSON.parse(u.responseText):u.responseText}catch(t){e=u.responseText}u.status>199&&u.status<300?t(e):n(e)},u.onerror=function(){return n({})},r?(u.setRequestHeader("Content-Type","application/json;charset=UTF-8"),u.send(JSON.stringify(r))):u.send()})}function O(t,e){var n=e.model,r=e.result,i=e.params,o=n.entity;if(!r)return t;var u=i.replace?sn({}):t.get(o),a=Array.isArray(r)?r:[r],s=n.fromJSON||sn;return t.set(o,u.withMutations((function(t){for(var e=0;e<a.length;e++){var n=s(a[e]);t.set(n.id,n)}})))}function w(t,e){var n=e.model,r=e.params;return t.removeIn([n.entity,r.id])}function T(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function A(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==r.join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(t){i[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}function D(t){var e={};return e.incrementData=function(e,n,r){void 0===r&&(r={}),C(e,t,r,n)},e.replaceData=function(e,n,r){void 0===r&&(r={}),C(e,t,ln({},r,{replace:!0}),n)},e.removeData=function(e,n){j(e,t,{id:n})},t.fetch&&(e.fetch=function(e,n){return void 0===n&&(n={}),e.dispatch(un.API_FETCH_START,{model:t,params:n,method:"fetch"}),t.fetch(e,n).then(C.bind(null,e,t,n),z.bind(null,e,t,n))}),e.fetchAll=function(e,n){return void 0===n&&(n={}),e.dispatch(un.API_FETCH_START,{model:t,params:n,method:"fetchAll"}),t.fetchAll(e,n).then(C.bind(null,e,t,ln({},n,{replace:!0})),z.bind(null,e,t,n))},t.save&&(e.save=function(e,n){return void 0===n&&(n={}),e.dispatch(un.API_SAVE_START,{params:n}),t.save(e,n).then(R.bind(null,e,t,n),M.bind(null,e,t,n))}),t.delete&&(e.delete=function(e,n){return void 0===n&&(n={}),e.dispatch(un.API_DELETE_START,{params:n}),t.delete(e,n).then(j.bind(null,e,t,n),L.bind(null,e,t,n))}),e}function C(t,e,n,r){return t.dispatch(un.API_FETCH_SUCCESS,{model:e,params:n,result:r}),r}function z(t,e,n,r){return t.dispatch(un.API_FETCH_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}function R(t,e,n,r){return t.dispatch(un.API_SAVE_SUCCESS,{model:e,params:n,result:r}),r}function M(t,e,n,r){return t.dispatch(un.API_SAVE_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}function j(t,e,n,r){return t.dispatch(un.API_DELETE_SUCCESS,{model:e,params:n,result:r}),r}function L(t,e,n,r){return t.dispatch(un.API_DELETE_FAIL,{model:e,params:n,reason:r}),Promise.reject(r)}function N(t){t.registerStores({restApiCache:cn})}function k(t){return[["restApiCache",t.entity],function(t){return!!t}]}function P(t){return[["restApiCache",t.entity],function(t){return t||pn({})}]}function U(t){return function(e){return["restApiCache",t.entity,e]}}function H(t){return new Date(t)}function x(t,e){var n=e.message;return t.set(t.size,n)}function V(){return kn.getInitialState()}function q(t,e){t.dispatch(jn.NOTIFICATION_CREATED,{message:e})}function F(t){t.registerStores({notifications:kn})}function G(t,e){if("lock"===t)return!0;if("garage_door"===t)return!0;var n=e.get(t);return!!n&&n.services.has("turn_on")}function K(t,e){return!!t&&("group"===t.domain?"on"===t.state||"off"===t.state:G(t.domain,e))}function B(t,e){return[Qn(t),function(t){return!!t&&t.services.has(e)}]}function Y(t){return[Rn.byId(t),Xn,K]}function J(t,e){var n=e.component;return t.push(n)}function W(t,e){var n=e.components;return yr(n)}function X(){return mr.getInitialState()}function Q(t,e){var n=e.latitude,r=e.longitude,i=e.location_name,o=e.unit_system,u=e.time_zone,a=e.config_dir,s=e.version;return Sr({latitude:n,longitude:r,location_name:i,unit_system:o,time_zone:u,config_dir:a,serverVersion:s})}function Z(){return br.getInitialState()}function $(t,e){t.dispatch(dr.SERVER_CONFIG_LOADED,e)}function tt(t){on(t,"GET","config").then((function(e){return $(t,e)}))}function et(t,e){t.dispatch(dr.COMPONENT_LOADED,{component:e})}function nt(t){return[["serverComponent"],function(e){return e.contains(t)}]}function rt(t){t.registerStores({serverComponent:mr,serverConfig:br})}function it(t,e){var n=e.pane;return n}function ot(){return jr.getInitialState()}function ut(t,e){var n=e.panels;return Nr(n)}function at(){return kr.getInitialState()}function st(t,e){var n=e.show;return!!n}function ct(){return Ur.getInitialState()}function ft(t,e){t.dispatch(Rr.SHOW_SIDEBAR,{show:e})}function ht(t,e){t.dispatch(Rr.NAVIGATE,{pane:e})}function lt(t,e){t.dispatch(Rr.PANELS_LOADED,{panels:e})}function pt(t,e){var n=e.entityId;return n}function _t(){return Yr.getInitialState()}function dt(t,e){t.dispatch(Kr.SELECT_ENTITY,{entityId:e})}function vt(t){t.dispatch(Kr.SELECT_ENTITY,{entityId:null})}function yt(t){return!t||(new Date).getTime()-t>6e4}function mt(t,e){var n=e.date;return n.toISOString()}function gt(){return Qr.getInitialState()}function St(t,e){var n=e.date,r=e.stateHistory;return 0===r.length?t.set(n,$r({})):t.withMutations((function(t){r.forEach((function(e){return t.setIn([n,e[0].entity_id],$r(e.map(In.fromJSON)))}))}))}function bt(){return ti.getInitialState()}function Et(t,e){var n=e.stateHistory;return t.withMutations((function(t){n.forEach((function(e){return t.set(e[0].entity_id,ii(e.map(In.fromJSON)))}))}))}function It(){return oi.getInitialState()}function Ot(t,e){var n=e.stateHistory,r=(new Date).getTime();return t.withMutations((function(t){n.forEach((function(e){return t.set(e[0].entity_id,r)})),history.length>1&&t.set(si,r)}))}function wt(){return ci.getInitialState()}function Tt(t,e){t.dispatch(Wr.ENTITY_HISTORY_DATE_SELECTED,{date:e})}function At(t,e){void 0===e&&(e=null),t.dispatch(Wr.RECENT_ENTITY_HISTORY_FETCH_START,{});var n="history/period";return null!==e&&(n+="?filter_entity_id="+e),on(t,"GET",n).then((function(e){return t.dispatch(Wr.RECENT_ENTITY_HISTORY_FETCH_SUCCESS,{stateHistory:e})}),(function(){return t.dispatch(Wr.RECENT_ENTITY_HISTORY_FETCH_ERROR,{})}))}function Dt(t,e){return t.dispatch(Wr.ENTITY_HISTORY_FETCH_START,{date:e}),on(t,"GET","history/period/"+e).then((function(n){return t.dispatch(Wr.ENTITY_HISTORY_FETCH_SUCCESS,{date:e,stateHistory:n})}),(function(){return t.dispatch(Wr.ENTITY_HISTORY_FETCH_ERROR,{})}))}function Ct(t){var e=t.evaluate(li);return Dt(t,e)}function zt(t){t.registerStores({currentEntityHistoryDate:Qr,entityHistory:ti,isLoadingEntityHistory:ni,recentEntityHistory:oi,recentEntityHistoryUpdated:ci})}function Rt(t){t.registerStores({moreInfoEntityId:Yr})}function Mt(t,e){var n=e.model,r=e.result,i=e.params;if(null===t||"entity"!==n.entity||!i.replace)return t;for(var o=0;o<r.length;o++)if(r[o].entity_id===t)return t;return null}function jt(t,e){t.dispatch(Mi.SELECT_VIEW,{view:e})}function Lt(t,e,n,r){void 0===r&&(r=!0),n.attributes.entity_id.forEach((function(n){if(!t.has(n)){var i=e.get(n);i&&!i.attributes.hidden&&(t.set(n,i),"group"===i.domain&&r&&Lt(t,e,i,!1))}}))}function Nt(t){t.registerStores({currentView:Li})}function kt(t){return Ji[t.hassId]}function Pt(t,e){var n={pane:t};return"states"===t&&(n.view=e||null),n}function Ut(t,e){return"states"===t&&e?"/"+t+"/"+e:"/"+t}function Ht(t){var e,n;if("/"===window.location.pathname)e=t.evaluate(Vr),n=t.evaluate(Gi.currentView);else{var r=window.location.pathname.substr(1).split("/");e=r[0],n=r[1],t.batch((function(){ht(t,e),n&&Fi.selectView(t,n)}))}history.replaceState(Pt(e,n),Yi,Ut(e,n))}function xt(t,e){var n=e.state,r=n.pane,i=n.view;t.evaluate(zi.hasCurrentEntityId)?(kt(t).ignoreNextDeselectEntity=!0,Ci.deselectEntity(t)):r===t.evaluate(Vr)&&i===t.evaluate(Gi.currentView)||t.batch((function(){ht(t,r),void 0!==i&&Fi.selectView(t,i)}))}function Vt(t){if(Bi){Ht(t);var e={ignoreNextDeselectEntity:!1,popstateChangeListener:xt.bind(null,t),unwatchNavigationObserver:t.observe(Vr,(function(t){t!==history.state.pane&&history.pushState(Pt(t,history.state.view),Yi,Ut(t,history.state.view))})),unwatchViewObserver:t.observe(Gi.currentView,(function(t){t!==history.state.view&&history.pushState(Pt(history.state.pane,t),Yi,Ut(history.state.pane,t))})),unwatchMoreInfoObserver:t.observe(zi.hasCurrentEntityId,(function(t){t?history.pushState(history.state,Yi,window.location.pathname):e.ignoreNextDeselectEntity?e.ignoreNextDeselectEntity=!1:setTimeout((function(){return history.back()}),0)}))};Ji[t.hassId]=e,window.addEventListener("popstate",e.popstateChangeListener)}}function qt(t){if(Bi){var e=kt(t);e&&(e.unwatchNavigationObserver(),e.unwatchViewObserver(),e.unwatchMoreInfoObserver(),window.removeEventListener("popstate",e.popstateChangeListener),Ji[t.hassId]=!1)}}function Ft(t){t.registerStores({currentPanel:jr,panels:kr,showSidebar:Ur})}function Gt(t){return t.dispatch(en.API_FETCH_ALL_START,{}),on(t,"GET","bootstrap").then((function(e){t.batch((function(){zn.replaceData(t,e.states),tr.replaceData(t,e.services),lr.replaceData(t,e.events),Dr.configLoaded(t,e.config),Xi.panelsLoaded(t,e.panels),t.dispatch(en.API_FETCH_ALL_SUCCESS,{})}))}),(function(e){return t.dispatch(en.API_FETCH_ALL_FAIL,{message:e}),Promise.reject(e)}))}function Kt(t){t.registerStores({isFetchingData:rn})}function Bt(t,e,n){function r(){var c=(new Date).getTime()-a;c<e&&c>0?i=setTimeout(r,e-c):(i=null,n||(s=t.apply(u,o),i||(u=o=null)))}var i,o,u,a,s;null==e&&(e=100);var c=function(){u=this,o=arguments,a=(new Date).getTime();var c=n&&!i;return i||(i=setTimeout(r,e)),c&&(s=t.apply(u,o),u=o=null),s};return c.clear=function(){i&&(clearTimeout(i),i=null)},c}function Yt(t){var e=fo[t.hassId];e&&(e.scheduleHealthCheck.clear(),e.conn.close(),fo[t.hassId]=!1)}function Jt(t,e){void 0===e&&(e={});var n=e.syncOnInitialConnect;void 0===n&&(n=!0),Yt(t);var r=t.evaluate(Mo.authToken),i="https:"===document.location.protocol?"wss://":"ws://";i+=document.location.hostname,document.location.port&&(i+=":"+document.location.port),i+="/api/websocket",E(i,{authToken:r}).then((function(e){var r=Bt((function(){return e.ping()}),so);r(),e.socket.addEventListener("message",r),fo[t.hassId]={conn:e,scheduleHealthCheck:r},co.forEach((function(n){return e.subscribeEvents(ao.bind(null,t),n)})),t.batch((function(){t.dispatch(Ye.STREAM_START),n&&io.fetchAll(t)})),e.addEventListener("disconnected",(function(){t.dispatch(Ye.STREAM_ERROR)})),e.addEventListener("ready",(function(){t.batch((function(){t.dispatch(Ye.STREAM_START),io.fetchAll(t)}))}))}))}function Wt(t){t.registerStores({streamStatus:Xe})}function Xt(t,e,n){void 0===n&&(n={});var r=n.rememberAuth;void 0===r&&(r=!1);var i=n.host;void 0===i&&(i=""),t.dispatch(Ue.VALIDATING_AUTH_TOKEN,{authToken:e,host:i}),io.fetchAll(t).then((function(){t.dispatch(Ue.VALID_AUTH_TOKEN,{authToken:e,host:i,rememberAuth:r}),vo.start(t,{syncOnInitialConnect:!1})}),(function(e){void 0===e&&(e={});var n=e.message;void 0===n&&(n=go),t.dispatch(Ue.INVALID_AUTH_TOKEN,{errorMessage:n})}))}function Qt(t){t.dispatch(Ue.LOG_OUT,{})}function Zt(t){t.registerStores({authAttempt:Ve,authCurrent:Ge,rememberAuth:Be})}function $t(){if(!("localStorage"in window))return{};var t=window.localStorage,e="___test";try{return t.setItem(e,e),t.removeItem(e),t}catch(t){return{}}}function te(){var t=new Uo({debug:!1});return t.hassId=Ho++,t}function ee(t,e,n){Object.keys(n).forEach((function(r){var i=n[r];if("register"in i&&i.register(e),"getters"in i&&Object.defineProperty(t,r+"Getters",{value:i.getters,enumerable:!0}),"actions"in i){var o={};Object.getOwnPropertyNames(i.actions).forEach((function(t){"function"==typeof i.actions[t]&&Object.defineProperty(o,t,{value:i.actions[t].bind(null,e),enumerable:!0})})),Object.defineProperty(t,r+"Actions",{value:o,enumerable:!0})}}))}function ne(t,e){return xo(t.attributes.entity_id.map((function(t){return e.get(t)})).filter((function(t){return!!t})))}function re(t){return on(t,"GET","error_log")}function ie(t,e){var n=e.date;return n.toISOString()}function oe(){return Jo.getInitialState()}function ue(t,e){var n=e.date,r=e.entries;return t.set(n,eu(r.map($o.fromJSON)))}function ae(){return nu.getInitialState()}function se(t,e){var n=e.date;return t.set(n,(new Date).getTime())}function ce(){return ou.getInitialState()}function fe(t,e){t.dispatch(Bo.LOGBOOK_DATE_SELECTED,{date:e})}function he(t,e){t.dispatch(Bo.LOGBOOK_ENTRIES_FETCH_START,{date:e}),on(t,"GET","logbook/"+e).then((function(n){return t.dispatch(Bo.LOGBOOK_ENTRIES_FETCH_SUCCESS,{date:e,entries:n})}),(function(){return t.dispatch(Bo.LOGBOOK_ENTRIES_FETCH_ERROR,{})}))}function le(t){return!t||(new Date).getTime()-t>su}function pe(t){t.registerStores({currentLogbookDate:Jo,isLoadingLogbookEntries:Xo,logbookEntries:nu,logbookEntriesUpdated:ou})}function _e(t){return t.set("active",!0)}function de(t){return t.set("active",!1)}function ve(){return Su.getInitialState()}function ye(t){return navigator.serviceWorker.getRegistration().then((function(t){if(!t)throw new Error("No service worker registered.");return t.pushManager.subscribe({userVisibleOnly:!0})})).then((function(e){var n;return n=navigator.userAgent.toLowerCase().indexOf("firefox")>-1?"firefox":"chrome",on(t,"POST","notify.html5",{subscription:e,browser:n}).then((function(){return t.dispatch(yu.PUSH_NOTIFICATIONS_SUBSCRIBE,{})})).then((function(){return!0}))})).catch((function(e){var n;return n=e.message&&e.message.indexOf("gcm_sender_id")!==-1?"Please setup the notify.html5 platform.":"Notification registration failed.",console.error(e),Vn.createNotification(t,n),!1}))}function me(t){return navigator.serviceWorker.getRegistration().then((function(t){if(!t)throw new Error("No service worker registered");return t.pushManager.subscribe({userVisibleOnly:!0})})).then((function(e){return on(t,"DELETE","notify.html5",{subscription:e}).then((function(){return e.unsubscribe()})).then((function(){return t.dispatch(yu.PUSH_NOTIFICATIONS_UNSUBSCRIBE,{})})).then((function(){return!0}))})).catch((function(e){var n="Failed unsubscribing for push notifications.";return console.error(e),Vn.createNotification(t,n),!1}))}function ge(t){t.registerStores({pushNotifications:Su})}function Se(t,e){return on(t,"POST","template",{template:e})}function be(t){return t.set("isListening",!0)}function Ee(t,e){var n=e.interimTranscript,r=e.finalTranscript;return t.withMutations((function(t){return t.set("isListening",!0).set("isTransmitting",!1).set("interimTranscript",n).set("finalTranscript",r)}))}function Ie(t,e){var n=e.finalTranscript;return t.withMutations((function(t){return t.set("isListening",!1).set("isTransmitting",!0).set("interimTranscript","").set("finalTranscript",n)}))}function Oe(){return ku.getInitialState()}function we(){return ku.getInitialState()}function Te(){return ku.getInitialState()}function Ae(t){return Pu[t.hassId]}function De(t){var e=Ae(t);if(e){var n=e.finalTranscript||e.interimTranscript;t.dispatch(ju.VOICE_TRANSMITTING,{finalTranscript:n}),tr.callService(t,"conversation","process",{text:n}).then((function(){t.dispatch(ju.VOICE_DONE)}),(function(){t.dispatch(ju.VOICE_ERROR)}))}}function Ce(t){var e=Ae(t);e&&(e.recognition.stop(),Pu[t.hassId]=!1)}function ze(t){De(t),Ce(t)}function Re(t){var e=ze.bind(null,t);e();var n=new webkitSpeechRecognition;Pu[t.hassId]={recognition:n,interimTranscript:"",finalTranscript:""},n.interimResults=!0,n.onstart=function(){return t.dispatch(ju.VOICE_START)},n.onerror=function(){return t.dispatch(ju.VOICE_ERROR)},n.onend=e,n.onresult=function(e){var n=Ae(t);if(n){for(var r="",i="",o=e.resultIndex;o<e.results.length;o++)e.results[o].isFinal?r+=e.results[o][0].transcript:i+=e.results[o][0].transcript;n.interimTranscript=i,n.finalTranscript+=r,t.dispatch(ju.VOICE_RESULT,{interimTranscript:i,finalTranscript:n.finalTranscript})}},n.start()}function Me(t){t.registerStores({currentVoiceCommand:ku,isVoiceSupported:Mu})}var je="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Le=e((function(t,e){!(function(n,r){"object"==typeof e&&"object"==typeof t?t.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof e?e.Nuclear=r():n.Nuclear=r()})(je,(function(){return (function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)})([function(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),n(1);var i=n(2),o=r(i),u=n(6),a=r(u),s=n(3),c=r(s),f=n(5),h=n(11),l=n(10),p=n(7),_=r(p);e.default={Reactor:a.default,Store:o.default,Immutable:c.default,isKeyPath:h.isKeyPath,isGetter:l.isGetter,toJS:f.toJS,toImmutable:f.toImmutable,isImmutable:f.isImmutable,createReactMixin:_.default},t.exports=e.default},function(t,e){try{window.console&&console.log||(console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){}})}catch(t){}},function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){return t instanceof c}Object.defineProperty(e,"__esModule",{value:!0});var o=(function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}})();e.isStore=i;var u=n(3),a=n(4),s=n(5),c=(function(){function t(e){r(this,t),this.__handlers=(0,u.Map)({}),e&&(0,a.extend)(this,e),this.initialize()}return o(t,[{key:"initialize",value:function(){}},{key:"getInitialState",value:function(){return(0,u.Map)()}},{key:"handle",value:function(t,e,n){var r=this.__handlers.get(e);return"function"==typeof r?r.call(this,t,n,e):t}},{key:"handleReset",value:function(t){return this.getInitialState()}},{key:"on",value:function(t,e){this.__handlers=this.__handlers.set(t,e)}},{key:"serialize",value:function(t){return(0,s.toJS)(t)}},{key:"deserialize",value:function(t){return(0,s.toImmutable)(t)}}]),t})();e.default=(0,a.toFactory)(c)},function(t,e,n){!(function(e,n){t.exports=n()})(this,(function(){function t(t,e){e&&(t.prototype=Object.create(e.prototype)),t.prototype.constructor=t}function e(t){return t.value=!1,t}function n(t){t&&(t.value=!0)}function r(){}function i(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=new Array(n),i=0;i<n;i++)r[i]=t[i+e];return r}function o(t){return void 0===t.size&&(t.size=t.__iterate(a)),t.size}function u(t,e){if("number"!=typeof e){var n=+e;if(""+n!==e)return NaN;e=n}return e<0?o(t)+e:e}function a(){return!0}function s(t,e,n){return(0===t||void 0!==n&&t<=-n)&&(void 0===e||void 0!==n&&e>=n)}function c(t,e){return h(t,e,0)}function f(t,e){return h(t,e,e)}function h(t,e,n){return void 0===t?n:t<0?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function l(t){return v(t)?t:C(t)}function p(t){return y(t)?t:z(t)}function _(t){return m(t)?t:R(t)}function d(t){return v(t)&&!g(t)?t:M(t)}function v(t){return!(!t||!t[dn])}function y(t){return!(!t||!t[vn])}function m(t){return!(!t||!t[yn])}function g(t){return y(t)||m(t)}function S(t){return!(!t||!t[mn])}function b(t){this.next=t}function E(t,e,n,r){var i=0===t?e:1===t?n:[e,n];return r?r.value=i:r={value:i,done:!1},r}function I(){return{value:void 0,done:!0}}function O(t){return!!A(t)}function w(t){return t&&"function"==typeof t.next}function T(t){var e=A(t);return e&&e.call(t)}function A(t){var e=t&&(En&&t[En]||t[In]);if("function"==typeof e)return e}function D(t){return t&&"number"==typeof t.length}function C(t){return null===t||void 0===t?U():v(t)?t.toSeq():V(t)}function z(t){return null===t||void 0===t?U().toKeyedSeq():v(t)?y(t)?t.toSeq():t.fromEntrySeq():H(t)}function R(t){return null===t||void 0===t?U():v(t)?y(t)?t.entrySeq():t.toIndexedSeq():x(t)}function M(t){return(null===t||void 0===t?U():v(t)?y(t)?t.entrySeq():t:x(t)).toSetSeq()}function j(t){this._array=t,this.size=t.length}function L(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function N(t){this._iterable=t,this.size=t.length||t.size}function k(t){this._iterator=t,this._iteratorCache=[]}function P(t){return!(!t||!t[wn])}function U(){return Tn||(Tn=new j([]))}function H(t){var e=Array.isArray(t)?new j(t).fromEntrySeq():w(t)?new k(t).fromEntrySeq():O(t)?new N(t).fromEntrySeq():"object"==typeof t?new L(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function x(t){var e=q(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function V(t){var e=q(t)||"object"==typeof t&&new L(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function q(t){return D(t)?new j(t):w(t)?new k(t):O(t)?new N(t):void 0}function F(t,e,n,r){var i=t._cache;if(i){for(var o=i.length-1,u=0;u<=o;u++){var a=i[n?o-u:u];if(e(a[1],r?a[0]:u,t)===!1)return u+1}return u}return t.__iterateUncached(e,n)}function G(t,e,n,r){var i=t._cache;if(i){var o=i.length-1,u=0;return new b(function(){var t=i[n?o-u:u];return u++>o?I():E(e,r?t[0]:u-1,t[1])})}return t.__iteratorUncached(e,n)}function K(){throw TypeError("Abstract")}function B(){}function Y(){}function J(){}function W(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function X(t,e){return e?Q(e,t,"",{"":t}):Z(t)}function Q(t,e,n,r){return Array.isArray(e)?t.call(r,n,R(e).map((function(n,r){return Q(t,n,r,e)}))):$(e)?t.call(r,n,z(e).map((function(n,r){return Q(t,n,r,e)}))):e}function Z(t){return Array.isArray(t)?R(t).map(Z).toList():$(t)?z(t).map(Z).toMap():t}function $(t){return t&&(t.constructor===Object||void 0===t.constructor)}function tt(t){return t>>>1&1073741824|3221225471&t}function et(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){var n=0|t;for(n!==t&&(n^=4294967295*t);t>4294967295;)t/=4294967295,n^=t;return tt(n)}return"string"===e?t.length>Ln?nt(t):rt(t):"function"==typeof t.hashCode?t.hashCode():it(t)}function nt(t){var e=Pn[t];return void 0===e&&(e=rt(t),kn===Nn&&(kn=0,Pn={}),kn++,Pn[t]=e),e}function rt(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return tt(e)}function it(t){var e;if(Rn&&(e=An.get(t),void 0!==e))return e;if(e=t[jn],void 0!==e)return e;if(!zn){if(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[jn],void 0!==e)return e;if(e=ot(t),void 0!==e)return e}if(e=++Mn,1073741824&Mn&&(Mn=0),Rn)An.set(t,e);else{if(void 0!==Cn&&Cn(t)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(zn)Object.defineProperty(t,jn,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[jn]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[jn]=e}}return e}function ot(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function ut(t,e){if(!t)throw new Error(e)}function at(t){ut(t!==1/0,"Cannot perform this action with an infinite size.")}function st(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ct(t){this._iter=t,this.size=t.size}function ft(t){this._iter=t,this.size=t.size}function ht(t){this._iter=t,this.size=t.size}function lt(t){var e=jt(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=Lt,e.__iterateUncached=function(e,n){var r=this;return t.__iterate((function(t,n){return e(n,t,r)!==!1}),n)},e.__iteratorUncached=function(e,n){if(e===bn){var r=t.__iterator(e,n);return new b(function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===Sn?gn:Sn,n)},e}function pt(t,e,n){var r=jt(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,i){var o=t.get(r,ln);return o===ln?i:e.call(n,o,r,t)},r.__iterateUncached=function(r,i){var o=this;return t.__iterate((function(t,i,u){return r(e.call(n,t,i,u),i,o)!==!1}),i)},r.__iteratorUncached=function(r,i){var o=t.__iterator(bn,i);return new b(function(){var i=o.next();if(i.done)return i;var u=i.value,a=u[0];return E(r,a,e.call(n,u[1],a,t),i)})},r}function _t(t,e){var n=jt(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=lt(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=Lt,n.__iterate=function(e,n){var r=this;return t.__iterate((function(t,n){return e(t,n,r)}),!n)},n.__iterator=function(e,n){return t.__iterator(e,!n)},n}function dt(t,e,n,r){var i=jt(t);return r&&(i.has=function(r){var i=t.get(r,ln);return i!==ln&&!!e.call(n,i,r,t)},i.get=function(r,i){var o=t.get(r,ln);return o!==ln&&e.call(n,o,r,t)?o:i}),i.__iterateUncached=function(i,o){var u=this,a=0;return t.__iterate((function(t,o,s){if(e.call(n,t,o,s))return a++,i(t,r?o:a-1,u)}),o),a},i.__iteratorUncached=function(i,o){var u=t.__iterator(bn,o),a=0;return new b(function(){for(;;){var o=u.next();if(o.done)return o;var s=o.value,c=s[0],f=s[1];if(e.call(n,f,c,t))return E(i,r?c:a++,f,o)}})},i}function vt(t,e,n){var r=Pt().asMutable();return t.__iterate((function(i,o){r.update(e.call(n,i,o,t),0,(function(t){return t+1}))})),r.asImmutable()}function yt(t,e,n){var r=y(t),i=(S(t)?Ie():Pt()).asMutable();t.__iterate((function(o,u){i.update(e.call(n,o,u,t),(function(t){return t=t||[],t.push(r?[u,o]:o),t}))}));var o=Mt(t);return i.map((function(e){return Ct(t,o(e))}))}function mt(t,e,n,r){var i=t.size;if(void 0!==e&&(e|=0),void 0!==n&&(n|=0),s(e,n,i))return t;var o=c(e,i),a=f(n,i);if(o!==o||a!==a)return mt(t.toSeq().cacheResult(),e,n,r);var h,l=a-o;l===l&&(h=l<0?0:l);var p=jt(t);return p.size=0===h?h:t.size&&h||void 0,!r&&P(t)&&h>=0&&(p.get=function(e,n){return e=u(this,e),e>=0&&e<h?t.get(e+o,n):n}),p.__iterateUncached=function(e,n){var i=this;if(0===h)return 0;if(n)return this.cacheResult().__iterate(e,n);var u=0,a=!0,s=0;return t.__iterate((function(t,n){if(!a||!(a=u++<o))return s++,e(t,r?n:s-1,i)!==!1&&s!==h})),s},p.__iteratorUncached=function(e,n){if(0!==h&&n)return this.cacheResult().__iterator(e,n);var i=0!==h&&t.__iterator(e,n),u=0,a=0;return new b(function(){for(;u++<o;)i.next();if(++a>h)return I();var t=i.next();return r||e===Sn?t:e===gn?E(e,a-1,void 0,t):E(e,a-1,t.value[1],t)})},p}function gt(t,e,n){var r=jt(t);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var u=0;return t.__iterate((function(t,i,a){return e.call(n,t,i,a)&&++u&&r(t,i,o)})),u},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var u=t.__iterator(bn,i),a=!0;return new b(function(){if(!a)return I();var t=u.next();if(t.done)return t;var i=t.value,s=i[0],c=i[1];return e.call(n,c,s,o)?r===bn?t:E(r,s,c,t):(a=!1,I())})},r}function St(t,e,n,r){var i=jt(t);return i.__iterateUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterate(i,o);var a=!0,s=0;return t.__iterate((function(t,o,c){if(!a||!(a=e.call(n,t,o,c)))return s++,i(t,r?o:s-1,u)})),s},i.__iteratorUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterator(i,o);var a=t.__iterator(bn,o),s=!0,c=0;return new b(function(){var t,o,f;do{if(t=a.next(),t.done)return r||i===Sn?t:i===gn?E(i,c++,void 0,t):E(i,c++,t.value[1],t);var h=t.value;o=h[0],f=h[1],s&&(s=e.call(n,f,o,u))}while(s);return i===bn?t:E(i,o,f,t)})},i}function bt(t,e){var n=y(t),r=[t].concat(e).map((function(t){return v(t)?n&&(t=p(t)):t=n?H(t):x(Array.isArray(t)?t:[t]),t})).filter((function(t){return 0!==t.size}));if(0===r.length)return t;if(1===r.length){var i=r[0];if(i===t||n&&y(i)||m(t)&&m(i))return i}var o=new j(r);return n?o=o.toKeyedSeq():m(t)||(o=o.toSetSeq()),o=o.flatten(!0),o.size=r.reduce((function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}}),0),o}function Et(t,e,n){var r=jt(t);return r.__iterateUncached=function(r,i){function o(t,s){var c=this;t.__iterate((function(t,i){return(!e||s<e)&&v(t)?o(t,s+1):r(t,n?i:u++,c)===!1&&(a=!0),!a}),i)}var u=0,a=!1;return o(t,0),u},r.__iteratorUncached=function(r,i){var o=t.__iterator(r,i),u=[],a=0;return new b(function(){for(;o;){var t=o.next();if(t.done===!1){var s=t.value;if(r===bn&&(s=s[1]),e&&!(u.length<e)||!v(s))return n?t:E(r,a++,s,t);u.push(o),o=s.__iterator(r,i)}else o=u.pop()}return I()})},r}function It(t,e,n){var r=Mt(t);return t.toSeq().map((function(i,o){return r(e.call(n,i,o,t))})).flatten(!0)}function Ot(t,e){var n=jt(t);return n.size=t.size&&2*t.size-1,n.__iterateUncached=function(n,r){var i=this,o=0;return t.__iterate((function(t,r){return(!o||n(e,o++,i)!==!1)&&n(t,o++,i)!==!1}),r),o},n.__iteratorUncached=function(n,r){var i,o=t.__iterator(Sn,r),u=0;return new b(function(){return(!i||u%2)&&(i=o.next(),i.done)?i:u%2?E(n,u++,e):E(n,u++,i.value,i)})},n}function wt(t,e,n){e||(e=Nt);var r=y(t),i=0,o=t.toSeq().map((function(e,r){return[r,e,i++,n?n(e,r,t):e]})).toArray();return o.sort((function(t,n){return e(t[3],n[3])||t[2]-n[2]})).forEach(r?function(t,e){o[e].length=2}:function(t,e){o[e]=t[1]}),r?z(o):m(t)?R(o):M(o)}function Tt(t,e,n){if(e||(e=Nt),n){var r=t.toSeq().map((function(e,r){return[e,n(e,r,t)]})).reduce((function(t,n){return At(e,t[1],n[1])?n:t}));return r&&r[0]}return t.reduce((function(t,n){return At(e,t,n)?n:t}))}function At(t,e,n){var r=t(n,e);return 0===r&&n!==e&&(void 0===n||null===n||n!==n)||r>0}function Dt(t,e,n){var r=jt(t);return r.size=new j(n).map((function(t){return t.size})).min(),r.__iterate=function(t,e){for(var n,r=this,i=this.__iterator(Sn,e),o=0;!(n=i.next()).done&&t(n.value,o++,r)!==!1;);return o},r.__iteratorUncached=function(t,r){var i=n.map((function(t){return t=l(t),T(r?t.reverse():t)})),o=0,u=!1;
  return new b(function(){var n;return u||(n=i.map((function(t){return t.next()})),u=n.some((function(t){return t.done}))),u?I():E(t,o++,e.apply(null,n.map((function(t){return t.value}))))})},r}function Ct(t,e){return P(t)?e:t.constructor(e)}function zt(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function Rt(t){return at(t.size),o(t)}function Mt(t){return y(t)?p:m(t)?_:d}function jt(t){return Object.create((y(t)?z:m(t)?R:M).prototype)}function Lt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):C.prototype.cacheResult.call(this)}function Nt(t,e){return t>e?1:t<e?-1:0}function kt(t){var e=T(t);if(!e){if(!D(t))throw new TypeError("Expected iterable or array-like: "+t);e=T(l(t))}return e}function Pt(t){return null===t||void 0===t?Jt():Ut(t)&&!S(t)?t:Jt().withMutations((function(e){var n=p(t);at(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function Ut(t){return!(!t||!t[Un])}function Ht(t,e){this.ownerID=t,this.entries=e}function xt(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n}function Vt(t,e,n){this.ownerID=t,this.count=e,this.nodes=n}function qt(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n}function Ft(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n}function Gt(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&Bt(t._root)}function Kt(t,e){return E(t,e[0],e[1])}function Bt(t,e){return{node:t,index:0,__prev:e}}function Yt(t,e,n,r){var i=Object.create(Hn);return i.size=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Jt(){return xn||(xn=Yt(0))}function Wt(t,n,r){var i,o;if(t._root){var u=e(pn),a=e(_n);if(i=Xt(t._root,t.__ownerID,0,void 0,n,r,u,a),!a.value)return t;o=t.size+(u.value?r===ln?-1:1:0)}else{if(r===ln)return t;o=1,i=new Ht(t.__ownerID,[[n,r]])}return t.__ownerID?(t.size=o,t._root=i,t.__hash=void 0,t.__altered=!0,t):i?Yt(o,i):Jt()}function Xt(t,e,r,i,o,u,a,s){return t?t.update(e,r,i,o,u,a,s):u===ln?t:(n(s),n(a),new Ft(e,i,[o,u]))}function Qt(t){return t.constructor===Ft||t.constructor===qt}function Zt(t,e,n,r,i){if(t.keyHash===r)return new qt(e,r,[t.entry,i]);var o,u=(0===n?t.keyHash:t.keyHash>>>n)&hn,a=(0===n?r:r>>>n)&hn,s=u===a?[Zt(t,e,n+cn,r,i)]:(o=new Ft(e,r,i),u<a?[t,o]:[o,t]);return new xt(e,1<<u|1<<a,s)}function $t(t,e,n,i){t||(t=new r);for(var o=new Ft(t,et(n),[n,i]),u=0;u<e.length;u++){var a=e[u];o=o.update(t,0,void 0,a[0],a[1])}return o}function te(t,e,n,r){for(var i=0,o=0,u=new Array(n),a=0,s=1,c=e.length;a<c;a++,s<<=1){var f=e[a];void 0!==f&&a!==r&&(i|=s,u[o++]=f)}return new xt(t,i,u)}function ee(t,e,n,r,i){for(var o=0,u=new Array(fn),a=0;0!==n;a++,n>>>=1)u[a]=1&n?e[o++]:void 0;return u[r]=i,new Vt(t,o+1,u)}function ne(t,e,n){for(var r=[],i=0;i<n.length;i++){var o=n[i],u=p(o);v(o)||(u=u.map((function(t){return X(t)}))),r.push(u)}return ie(t,e,r)}function re(t){return function(e,n,r){return e&&e.mergeDeepWith&&v(n)?e.mergeDeepWith(t,n):t?t(e,n,r):n}}function ie(t,e,n){return n=n.filter((function(t){return 0!==t.size})),0===n.length?t:0!==t.size||t.__ownerID||1!==n.length?t.withMutations((function(t){for(var r=e?function(n,r){t.update(r,ln,(function(t){return t===ln?n:e(t,n,r)}))}:function(e,n){t.set(n,e)},i=0;i<n.length;i++)n[i].forEach(r)})):t.constructor(n[0])}function oe(t,e,n,r){var i=t===ln,o=e.next();if(o.done){var u=i?n:t,a=r(u);return a===u?t:a}ut(i||t&&t.set,"invalid keyPath");var s=o.value,c=i?ln:t.get(s,ln),f=oe(c,e,n,r);return f===c?t:f===ln?t.remove(s):(i?Jt():t).set(s,f)}function ue(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function ae(t,e,n,r){var o=r?t:i(t);return o[e]=n,o}function se(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var o=new Array(i),u=0,a=0;a<i;a++)a===e?(o[a]=n,u=-1):o[a]=t[a+u];return o}function ce(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=new Array(r),o=0,u=0;u<r;u++)u===e&&(o=1),i[u]=t[u+o];return i}function fe(t){var e=de();if(null===t||void 0===t)return e;if(he(t))return t;var n=_(t),r=n.size;return 0===r?e:(at(r),r>0&&r<fn?_e(0,r,cn,null,new le(n.toArray())):e.withMutations((function(t){t.setSize(r),n.forEach((function(e,n){return t.set(n,e)}))})))}function he(t){return!(!t||!t[Gn])}function le(t,e){this.array=t,this.ownerID=e}function pe(t,e){function n(t,e,n){return 0===e?r(t,n):i(t,e,n)}function r(t,n){var r=n===a?s&&s.array:t&&t.array,i=n>o?0:o-n,c=u-n;return c>fn&&(c=fn),function(){if(i===c)return Yn;var t=e?--c:i++;return r&&r[t]}}function i(t,r,i){var a,s=t&&t.array,c=i>o?0:o-i>>r,f=(u-i>>r)+1;return f>fn&&(f=fn),function(){for(;;){if(a){var t=a();if(t!==Yn)return t;a=null}if(c===f)return Yn;var o=e?--f:c++;a=n(s&&s[o],r-cn,i+(o<<r))}}}var o=t._origin,u=t._capacity,a=Ee(u),s=t._tail;return n(t._root,t._level,0)}function _e(t,e,n,r,i,o,u){var a=Object.create(Kn);return a.size=e-t,a._origin=t,a._capacity=e,a._level=n,a._root=r,a._tail=i,a.__ownerID=o,a.__hash=u,a.__altered=!1,a}function de(){return Bn||(Bn=_e(0,0,cn))}function ve(t,n,r){if(n=u(t,n),n!==n)return t;if(n>=t.size||n<0)return t.withMutations((function(t){n<0?Se(t,n).set(0,r):Se(t,0,n+1).set(n,r)}));n+=t._origin;var i=t._tail,o=t._root,a=e(_n);return n>=Ee(t._capacity)?i=ye(i,t.__ownerID,0,n,r,a):o=ye(o,t.__ownerID,t._level,n,r,a),a.value?t.__ownerID?(t._root=o,t._tail=i,t.__hash=void 0,t.__altered=!0,t):_e(t._origin,t._capacity,t._level,o,i):t}function ye(t,e,r,i,o,u){var a=i>>>r&hn,s=t&&a<t.array.length;if(!s&&void 0===o)return t;var c;if(r>0){var f=t&&t.array[a],h=ye(f,e,r-cn,i,o,u);return h===f?t:(c=me(t,e),c.array[a]=h,c)}return s&&t.array[a]===o?t:(n(u),c=me(t,e),void 0===o&&a===c.array.length-1?c.array.pop():c.array[a]=o,c)}function me(t,e){return e&&t&&e===t.ownerID?t:new le(t?t.array.slice():[],e)}function ge(t,e){if(e>=Ee(t._capacity))return t._tail;if(e<1<<t._level+cn){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&hn],r-=cn;return n}}function Se(t,e,n){void 0!==e&&(e|=0),void 0!==n&&(n|=0);var i=t.__ownerID||new r,o=t._origin,u=t._capacity,a=o+e,s=void 0===n?u:n<0?u+n:o+n;if(a===o&&s===u)return t;if(a>=s)return t.clear();for(var c=t._level,f=t._root,h=0;a+h<0;)f=new le(f&&f.array.length?[void 0,f]:[],i),c+=cn,h+=1<<c;h&&(a+=h,o+=h,s+=h,u+=h);for(var l=Ee(u),p=Ee(s);p>=1<<c+cn;)f=new le(f&&f.array.length?[f]:[],i),c+=cn;var _=t._tail,d=p<l?ge(t,s-1):p>l?new le([],i):_;if(_&&p>l&&a<u&&_.array.length){f=me(f,i);for(var v=f,y=c;y>cn;y-=cn){var m=l>>>y&hn;v=v.array[m]=me(v.array[m],i)}v.array[l>>>cn&hn]=_}if(s<u&&(d=d&&d.removeAfter(i,0,s)),a>=p)a-=p,s-=p,c=cn,f=null,d=d&&d.removeBefore(i,0,a);else if(a>o||p<l){for(h=0;f;){var g=a>>>c&hn;if(g!==p>>>c&hn)break;g&&(h+=(1<<c)*g),c-=cn,f=f.array[g]}f&&a>o&&(f=f.removeBefore(i,c,a-h)),f&&p<l&&(f=f.removeAfter(i,c,p-h)),h&&(a-=h,s-=h)}return t.__ownerID?(t.size=s-a,t._origin=a,t._capacity=s,t._level=c,t._root=f,t._tail=d,t.__hash=void 0,t.__altered=!0,t):_e(a,s,c,f,d)}function be(t,e,n){for(var r=[],i=0,o=0;o<n.length;o++){var u=n[o],a=_(u);a.size>i&&(i=a.size),v(u)||(a=a.map((function(t){return X(t)}))),r.push(a)}return i>t.size&&(t=t.setSize(i)),ie(t,e,r)}function Ee(t){return t<fn?0:t-1>>>cn<<cn}function Ie(t){return null===t||void 0===t?Te():Oe(t)?t:Te().withMutations((function(e){var n=p(t);at(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function Oe(t){return Ut(t)&&S(t)}function we(t,e,n,r){var i=Object.create(Ie.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=n,i.__hash=r,i}function Te(){return Jn||(Jn=we(Jt(),de()))}function Ae(t,e,n){var r,i,o=t._map,u=t._list,a=o.get(e),s=void 0!==a;if(n===ln){if(!s)return t;u.size>=fn&&u.size>=2*o.size?(i=u.filter((function(t,e){return void 0!==t&&a!==e})),r=i.toKeyedSeq().map((function(t){return t[0]})).flip().toMap(),t.__ownerID&&(r.__ownerID=i.__ownerID=t.__ownerID)):(r=o.remove(e),i=a===u.size-1?u.pop():u.set(a,void 0))}else if(s){if(n===u.get(a)[1])return t;r=o,i=u.set(a,[e,n])}else r=o.set(e,u.size),i=u.set(u.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=i,t.__hash=void 0,t):we(r,i)}function De(t){return null===t||void 0===t?Re():Ce(t)?t:Re().unshiftAll(t)}function Ce(t){return!(!t||!t[Wn])}function ze(t,e,n,r){var i=Object.create(Xn);return i.size=t,i._head=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Re(){return Qn||(Qn=ze(0))}function Me(t){return null===t||void 0===t?ke():je(t)&&!S(t)?t:ke().withMutations((function(e){var n=d(t);at(n.size),n.forEach((function(t){return e.add(t)}))}))}function je(t){return!(!t||!t[Zn])}function Le(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function Ne(t,e){var n=Object.create($n);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function ke(){return tr||(tr=Ne(Jt()))}function Pe(t){return null===t||void 0===t?xe():Ue(t)?t:xe().withMutations((function(e){var n=d(t);at(n.size),n.forEach((function(t){return e.add(t)}))}))}function Ue(t){return je(t)&&S(t)}function He(t,e){var n=Object.create(er);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function xe(){return nr||(nr=He(Te()))}function Ve(t,e){var n,r=function(o){if(o instanceof r)return o;if(!(this instanceof r))return new r(o);if(!n){n=!0;var u=Object.keys(t);Ge(i,u),i.size=u.length,i._name=e,i._keys=u,i._defaultValues=t}this._map=Pt(o)},i=r.prototype=Object.create(rr);return i.constructor=r,r}function qe(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function Fe(t){return t._name||t.constructor.name||"Record"}function Ge(t,e){try{e.forEach(Ke.bind(void 0,t))}catch(t){}}function Ke(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){ut(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function Be(t,e){if(t===e)return!0;if(!v(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||y(t)!==y(e)||m(t)!==m(e)||S(t)!==S(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!g(t);if(S(t)){var r=t.entries();return e.every((function(t,e){var i=r.next().value;return i&&W(i[1],t)&&(n||W(i[0],e))}))&&r.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var o=t;t=e,e=o}var u=!0,a=e.__iterate((function(e,r){if(n?!t.has(e):i?!W(e,t.get(r,ln)):!W(t.get(r,ln),e))return u=!1,!1}));return u&&t.size===a}function Ye(t,e,n){if(!(this instanceof Ye))return new Ye(t,e,n);if(ut(0!==n,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),n=void 0===n?1:Math.abs(n),e<t&&(n=-n),this._start=t,this._end=e,this._step=n,this.size=Math.max(0,Math.ceil((e-t)/n-1)+1),0===this.size){if(ir)return ir;ir=this}}function Je(t,e){if(!(this instanceof Je))return new Je(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(or)return or;or=this}}function We(t,e){var n=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(n),t}function Xe(t,e){return e}function Qe(t,e){return[e,t]}function Ze(t){return function(){return!t.apply(this,arguments)}}function $e(t){return function(){return-t.apply(this,arguments)}}function tn(t){return"string"==typeof t?JSON.stringify(t):t}function en(){return i(arguments)}function nn(t,e){return t<e?1:t>e?-1:0}function rn(t){if(t.size===1/0)return 0;var e=S(t),n=y(t),r=e?1:0,i=t.__iterate(n?e?function(t,e){r=31*r+un(et(t),et(e))|0}:function(t,e){r=r+un(et(t),et(e))|0}:e?function(t){r=31*r+et(t)|0}:function(t){r=r+et(t)|0});return on(i,r)}function on(t,e){return e=Dn(e,3432918353),e=Dn(e<<15|e>>>-15,461845907),e=Dn(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=Dn(e^e>>>16,2246822507),e=Dn(e^e>>>13,3266489909),e=tt(e^e>>>16)}function un(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var an=Array.prototype.slice,sn="delete",cn=5,fn=1<<cn,hn=fn-1,ln={},pn={value:!1},_n={value:!1};t(p,l),t(_,l),t(d,l),l.isIterable=v,l.isKeyed=y,l.isIndexed=m,l.isAssociative=g,l.isOrdered=S,l.Keyed=p,l.Indexed=_,l.Set=d;var dn="@@__IMMUTABLE_ITERABLE__@@",vn="@@__IMMUTABLE_KEYED__@@",yn="@@__IMMUTABLE_INDEXED__@@",mn="@@__IMMUTABLE_ORDERED__@@",gn=0,Sn=1,bn=2,En="function"==typeof Symbol&&Symbol.iterator,In="@@iterator",On=En||In;b.prototype.toString=function(){return"[Iterator]"},b.KEYS=gn,b.VALUES=Sn,b.ENTRIES=bn,b.prototype.inspect=b.prototype.toSource=function(){return this.toString()},b.prototype[On]=function(){return this},t(C,l),C.of=function(){return C(arguments)},C.prototype.toSeq=function(){return this},C.prototype.toString=function(){return this.__toString("Seq {","}")},C.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},C.prototype.__iterate=function(t,e){return F(this,t,e,!0)},C.prototype.__iterator=function(t,e){return G(this,t,e,!0)},t(z,C),z.prototype.toKeyedSeq=function(){return this},t(R,C),R.of=function(){return R(arguments)},R.prototype.toIndexedSeq=function(){return this},R.prototype.toString=function(){return this.__toString("Seq [","]")},R.prototype.__iterate=function(t,e){return F(this,t,e,!1)},R.prototype.__iterator=function(t,e){return G(this,t,e,!1)},t(M,C),M.of=function(){return M(arguments)},M.prototype.toSetSeq=function(){return this},C.isSeq=P,C.Keyed=z,C.Set=M,C.Indexed=R;var wn="@@__IMMUTABLE_SEQ__@@";C.prototype[wn]=!0,t(j,R),j.prototype.get=function(t,e){return this.has(t)?this._array[u(this,t)]:e},j.prototype.__iterate=function(t,e){for(var n=this,r=this._array,i=r.length-1,o=0;o<=i;o++)if(t(r[e?i-o:o],o,n)===!1)return o+1;return o},j.prototype.__iterator=function(t,e){var n=this._array,r=n.length-1,i=0;return new b(function(){return i>r?I():E(t,i,n[e?r-i++:i++])})},t(L,z),L.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},L.prototype.has=function(t){return this._object.hasOwnProperty(t)},L.prototype.__iterate=function(t,e){for(var n=this,r=this._object,i=this._keys,o=i.length-1,u=0;u<=o;u++){var a=i[e?o-u:u];if(t(r[a],a,n)===!1)return u+1}return u},L.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,i=r.length-1,o=0;return new b(function(){var u=r[e?i-o:o];return o++>i?I():E(t,u,n[u])})},L.prototype[mn]=!0,t(N,R),N.prototype.__iterateUncached=function(t,e){var n=this;if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,i=T(r),o=0;if(w(i))for(var u;!(u=i.next()).done&&t(u.value,o++,n)!==!1;);return o},N.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterable,r=T(n);if(!w(r))return new b(I);var i=0;return new b(function(){var e=r.next();return e.done?e:E(t,i++,e.value)})},t(k,R),k.prototype.__iterateUncached=function(t,e){var n=this;if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,i=this._iteratorCache,o=0;o<i.length;)if(t(i[o],o++,n)===!1)return o;for(var u;!(u=r.next()).done;){var a=u.value;if(i[o]=a,t(a,o++,n)===!1)break}return o},k.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterator,r=this._iteratorCache,i=0;return new b(function(){if(i>=r.length){var e=n.next();if(e.done)return e;r[i]=e.value}return E(t,i,r[i++])})};var Tn;t(K,l),t(B,K),t(Y,K),t(J,K),K.Keyed=B,K.Indexed=Y,K.Set=J;var An,Dn="function"==typeof Math.imul&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t|=0,e|=0;var n=65535&t,r=65535&e;return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0},Cn=Object.isExtensible,zn=(function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}})(),Rn="function"==typeof WeakMap;Rn&&(An=new WeakMap);var Mn=0,jn="__immutablehash__";"function"==typeof Symbol&&(jn=Symbol(jn));var Ln=16,Nn=255,kn=0,Pn={};t(st,z),st.prototype.get=function(t,e){return this._iter.get(t,e)},st.prototype.has=function(t){return this._iter.has(t)},st.prototype.valueSeq=function(){return this._iter.valueSeq()},st.prototype.reverse=function(){var t=this,e=_t(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},st.prototype.map=function(t,e){var n=this,r=pt(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},st.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?Rt(this):0,function(i){return t(i,e?--n:n++,r)}),e)},st.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(Sn,e),r=e?Rt(this):0;return new b(function(){var i=n.next();return i.done?i:E(t,e?--r:r++,i.value,i)})},st.prototype[mn]=!0,t(ct,R),ct.prototype.includes=function(t){return this._iter.includes(t)},ct.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate((function(e){return t(e,r++,n)}),e)},ct.prototype.__iterator=function(t,e){var n=this._iter.__iterator(Sn,e),r=0;return new b(function(){var e=n.next();return e.done?e:E(t,r++,e.value,e)})},t(ft,M),ft.prototype.has=function(t){return this._iter.includes(t)},ft.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){return t(e,e,n)}),e)},ft.prototype.__iterator=function(t,e){var n=this._iter.__iterator(Sn,e);return new b(function(){var e=n.next();return e.done?e:E(t,e.value,e.value,e)})},t(ht,z),ht.prototype.entrySeq=function(){return this._iter.toSeq()},ht.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){if(e){zt(e);var r=v(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}}),e)},ht.prototype.__iterator=function(t,e){var n=this._iter.__iterator(Sn,e);return new b(function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){zt(r);var i=v(r);return E(t,i?r.get(0):r[0],i?r.get(1):r[1],e)}}})},ct.prototype.cacheResult=st.prototype.cacheResult=ft.prototype.cacheResult=ht.prototype.cacheResult=Lt,t(Pt,B),Pt.prototype.toString=function(){return this.__toString("Map {","}")},Pt.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},Pt.prototype.set=function(t,e){return Wt(this,t,e)},Pt.prototype.setIn=function(t,e){return this.updateIn(t,ln,(function(){return e}))},Pt.prototype.remove=function(t){return Wt(this,t,ln)},Pt.prototype.deleteIn=function(t){return this.updateIn(t,(function(){return ln}))},Pt.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},Pt.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=oe(this,kt(t),e,n);return r===ln?void 0:r},Pt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Jt()},Pt.prototype.merge=function(){return ne(this,void 0,arguments)},Pt.prototype.mergeWith=function(t){var e=an.call(arguments,1);return ne(this,t,e)},Pt.prototype.mergeIn=function(t){var e=an.call(arguments,1);return this.updateIn(t,Jt(),(function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]}))},Pt.prototype.mergeDeep=function(){return ne(this,re(void 0),arguments)},Pt.prototype.mergeDeepWith=function(t){var e=an.call(arguments,1);return ne(this,re(t),e)},Pt.prototype.mergeDeepIn=function(t){var e=an.call(arguments,1);return this.updateIn(t,Jt(),(function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]}))},Pt.prototype.sort=function(t){return Ie(wt(this,t))},Pt.prototype.sortBy=function(t,e){return Ie(wt(this,e,t))},Pt.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},Pt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new r)},Pt.prototype.asImmutable=function(){return this.__ensureOwner()},Pt.prototype.wasAltered=function(){return this.__altered},Pt.prototype.__iterator=function(t,e){return new Gt(this,t,e)},Pt.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate((function(e){return r++,t(e[1],e[0],n)}),e),r},Pt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Yt(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Pt.isMap=Ut;var Un="@@__IMMUTABLE_MAP__@@",Hn=Pt.prototype;Hn[Un]=!0,Hn[sn]=Hn.remove,Hn.removeIn=Hn.deleteIn,Ht.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,u=i.length;o<u;o++)if(W(n,i[o][0]))return i[o][1];return r},Ht.prototype.update=function(t,e,r,o,u,a,s){for(var c=u===ln,f=this.entries,h=0,l=f.length;h<l&&!W(o,f[h][0]);h++);var p=h<l;if(p?f[h][1]===u:c)return this;if(n(s),(c||!p)&&n(a),!c||1!==f.length){if(!p&&!c&&f.length>=Vn)return $t(t,f,o,u);var _=t&&t===this.ownerID,d=_?f:i(f);return p?c?h===l-1?d.pop():d[h]=d.pop():d[h]=[o,u]:d.push([o,u]),_?(this.entries=d,this):new Ht(t,d)}},xt.prototype.get=function(t,e,n,r){void 0===e&&(e=et(n));var i=1<<((0===t?e:e>>>t)&hn),o=this.bitmap;return 0===(o&i)?r:this.nodes[ue(o&i-1)].get(t+cn,e,n,r)},xt.prototype.update=function(t,e,n,r,i,o,u){void 0===n&&(n=et(r));var a=(0===e?n:n>>>e)&hn,s=1<<a,c=this.bitmap,f=0!==(c&s);if(!f&&i===ln)return this;var h=ue(c&s-1),l=this.nodes,p=f?l[h]:void 0,_=Xt(p,t,e+cn,n,r,i,o,u);if(_===p)return this;if(!f&&_&&l.length>=qn)return ee(t,l,c,a,_);if(f&&!_&&2===l.length&&Qt(l[1^h]))return l[1^h];if(f&&_&&1===l.length&&Qt(_))return _;var d=t&&t===this.ownerID,v=f?_?c:c^s:c|s,y=f?_?ae(l,h,_,d):ce(l,h,d):se(l,h,_,d);return d?(this.bitmap=v,this.nodes=y,this):new xt(t,v,y)},Vt.prototype.get=function(t,e,n,r){void 0===e&&(e=et(n));var i=(0===t?e:e>>>t)&hn,o=this.nodes[i];return o?o.get(t+cn,e,n,r):r},Vt.prototype.update=function(t,e,n,r,i,o,u){void 0===n&&(n=et(r));var a=(0===e?n:n>>>e)&hn,s=i===ln,c=this.nodes,f=c[a];if(s&&!f)return this;var h=Xt(f,t,e+cn,n,r,i,o,u);if(h===f)return this;var l=this.count;if(f){if(!h&&(l--,l<Fn))return te(t,c,l,a)}else l++;var p=t&&t===this.ownerID,_=ae(c,a,h,p);return p?(this.count=l,this.nodes=_,this):new Vt(t,l,_)},qt.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,u=i.length;o<u;o++)if(W(n,i[o][0]))return i[o][1];return r},qt.prototype.update=function(t,e,r,o,u,a,s){void 0===r&&(r=et(o));var c=u===ln;if(r!==this.keyHash)return c?this:(n(s),n(a),Zt(this,t,e,r,[o,u]));for(var f=this.entries,h=0,l=f.length;h<l&&!W(o,f[h][0]);h++);var p=h<l;if(p?f[h][1]===u:c)return this;if(n(s),(c||!p)&&n(a),c&&2===l)return new Ft(t,this.keyHash,f[1^h]);var _=t&&t===this.ownerID,d=_?f:i(f);return p?c?h===l-1?d.pop():d[h]=d.pop():d[h]=[o,u]:d.push([o,u]),_?(this.entries=d,this):new qt(t,this.keyHash,d)},Ft.prototype.get=function(t,e,n,r){return W(n,this.entry[0])?this.entry[1]:r},Ft.prototype.update=function(t,e,r,i,o,u,a){var s=o===ln,c=W(i,this.entry[0]);return(c?o===this.entry[1]:s)?this:(n(a),s?void n(u):c?t&&t===this.ownerID?(this.entry[1]=o,this):new Ft(t,this.keyHash,[i,o]):(n(u),Zt(this,t,e,et(i),[i,o])))},Ht.prototype.iterate=qt.prototype.iterate=function(t,e){for(var n=this.entries,r=0,i=n.length-1;r<=i;r++)if(t(n[e?i-r:r])===!1)return!1},xt.prototype.iterate=Vt.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,i=n.length-1;r<=i;r++){var o=n[e?i-r:r];if(o&&o.iterate(t,e)===!1)return!1}},Ft.prototype.iterate=function(t,e){return t(this.entry)},t(Gt,b),Gt.prototype.next=function(){for(var t=this,e=this._type,n=this._stack;n;){var r,i=n.node,o=n.index++;if(i.entry){if(0===o)return Kt(e,i.entry)}else if(i.entries){if(r=i.entries.length-1,o<=r)return Kt(e,i.entries[t._reverse?r-o:o])}else if(r=i.nodes.length-1,o<=r){var u=i.nodes[t._reverse?r-o:o];if(u){if(u.entry)return Kt(e,u.entry);n=t._stack=Bt(u,n)}continue}n=t._stack=t._stack.__prev}return I()};var xn,Vn=fn/4,qn=fn/2,Fn=fn/4;t(fe,Y),fe.of=function(){return this(arguments)},fe.prototype.toString=function(){return this.__toString("List [","]")},fe.prototype.get=function(t,e){if(t=u(this,t),t>=0&&t<this.size){t+=this._origin;var n=ge(this,t);return n&&n.array[t&hn]}return e},fe.prototype.set=function(t,e){return ve(this,t,e)},fe.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},fe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=cn,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):de()},fe.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations((function(n){Se(n,0,e+t.length);for(var r=0;r<t.length;r++)n.set(e+r,t[r])}))},fe.prototype.pop=function(){return Se(this,0,-1)},fe.prototype.unshift=function(){var t=arguments;return this.withMutations((function(e){Se(e,-t.length);for(var n=0;n<t.length;n++)e.set(n,t[n])}))},fe.prototype.shift=function(){return Se(this,1)},fe.prototype.merge=function(){return be(this,void 0,arguments)},fe.prototype.mergeWith=function(t){var e=an.call(arguments,1);return be(this,t,e)},fe.prototype.mergeDeep=function(){return be(this,re(void 0),arguments)},fe.prototype.mergeDeepWith=function(t){var e=an.call(arguments,1);return be(this,re(t),e)},fe.prototype.setSize=function(t){return Se(this,0,t)},fe.prototype.slice=function(t,e){var n=this.size;return s(t,e,n)?this:Se(this,c(t,n),f(e,n))},fe.prototype.__iterator=function(t,e){var n=0,r=pe(this,e);return new b(function(){var e=r();return e===Yn?I():E(t,n++,e)})},fe.prototype.__iterate=function(t,e){for(var n,r=this,i=0,o=pe(this,e);(n=o())!==Yn&&t(n,i++,r)!==!1;);return i},fe.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?_e(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)},fe.isList=he;var Gn="@@__IMMUTABLE_LIST__@@",Kn=fe.prototype;Kn[Gn]=!0,Kn[sn]=Kn.remove,Kn.setIn=Hn.setIn,Kn.deleteIn=Kn.removeIn=Hn.removeIn,Kn.update=Hn.update,Kn.updateIn=Hn.updateIn,Kn.mergeIn=Hn.mergeIn,Kn.mergeDeepIn=Hn.mergeDeepIn,Kn.withMutations=Hn.withMutations,Kn.asMutable=Hn.asMutable,Kn.asImmutable=Hn.asImmutable,Kn.wasAltered=Hn.wasAltered,le.prototype.removeBefore=function(t,e,n){if(n===e?1<<e:0===this.array.length)return this;var r=n>>>e&hn;if(r>=this.array.length)return new le([],t);var i,o=0===r;if(e>0){var u=this.array[r];if(i=u&&u.removeBefore(t,e-cn,n),i===u&&o)return this}if(o&&!i)return this;var a=me(this,t);if(!o)for(var s=0;s<r;s++)a.array[s]=void 0;return i&&(a.array[r]=i),a},le.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e:0)||0===this.array.length)return this;var r=n-1>>>e&hn;if(r>=this.array.length)return this;var i;if(e>0){var o=this.array[r];if(i=o&&o.removeAfter(t,e-cn,n),i===o&&r===this.array.length-1)return this}var u=me(this,t);return u.array.splice(r+1),i&&(u.array[r]=i),u};var Bn,Yn={};t(Ie,Pt),Ie.of=function(){return this(arguments)},Ie.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ie.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Ie.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Te()},Ie.prototype.set=function(t,e){return Ae(this,t,e)},Ie.prototype.remove=function(t){return Ae(this,t,ln)},Ie.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ie.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate((function(e){return e&&t(e[1],e[0],n)}),e)},Ie.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Ie.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?we(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Ie.isOrderedMap=Oe,Ie.prototype[mn]=!0,Ie.prototype[sn]=Ie.prototype.remove;var Jn;t(De,Y),De.of=function(){return this(arguments)},De.prototype.toString=function(){return this.__toString("Stack [","]")},De.prototype.get=function(t,e){var n=this._head;for(t=u(this,t);n&&t--;)n=n.next;return n?n.value:e},De.prototype.peek=function(){return this._head&&this._head.value},De.prototype.push=function(){var t=arguments;if(0===arguments.length)return this;for(var e=this.size+arguments.length,n=this._head,r=arguments.length-1;r>=0;r--)n={value:t[r],next:n};return this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):ze(e,n)},De.prototype.pushAll=function(t){if(t=_(t),0===t.size)return this;at(t.size);var e=this.size,n=this._head;return t.reverse().forEach((function(t){e++,n={value:t,next:n}})),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):ze(e,n)},De.prototype.pop=function(){return this.slice(1)},De.prototype.unshift=function(){return this.push.apply(this,arguments)},De.prototype.unshiftAll=function(t){return this.pushAll(t)},De.prototype.shift=function(){return this.pop.apply(this,arguments)},De.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Re()},De.prototype.slice=function(t,e){if(s(t,e,this.size))return this;var n=c(t,this.size),r=f(e,this.size);if(r!==this.size)return Y.prototype.slice.call(this,t,e);for(var i=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):ze(i,o)},De.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?ze(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},De.prototype.__iterate=function(t,e){var n=this;if(e)return this.reverse().__iterate(t);for(var r=0,i=this._head;i&&t(i.value,r++,n)!==!1;)i=i.next;return r},De.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new b(function(){if(r){var e=r.value;return r=r.next,E(t,n++,e)}return I()})},De.isStack=Ce;var Wn="@@__IMMUTABLE_STACK__@@",Xn=De.prototype;Xn[Wn]=!0,Xn.withMutations=Hn.withMutations,Xn.asMutable=Hn.asMutable,Xn.asImmutable=Hn.asImmutable,Xn.wasAltered=Hn.wasAltered;var Qn;t(Me,J),Me.of=function(){return this(arguments)},Me.fromKeys=function(t){return this(p(t).keySeq())},Me.prototype.toString=function(){return this.__toString("Set {","}")},Me.prototype.has=function(t){return this._map.has(t)},Me.prototype.add=function(t){return Le(this,this._map.set(t,!0))},Me.prototype.remove=function(t){return Le(this,this._map.remove(t))},Me.prototype.clear=function(){return Le(this,this._map.clear())},Me.prototype.union=function(){var t=an.call(arguments,0);return t=t.filter((function(t){return 0!==t.size})),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations((function(e){for(var n=0;n<t.length;n++)d(t[n]).forEach((function(t){return e.add(t)}))})):this.constructor(t[0])},Me.prototype.intersect=function(){var t=an.call(arguments,0);if(0===t.length)return this;t=t.map((function(t){return d(t)}));var e=this;return this.withMutations((function(n){e.forEach((function(e){t.every((function(t){return t.includes(e)}))||n.remove(e)}))}))},Me.prototype.subtract=function(){var t=an.call(arguments,0);if(0===t.length)return this;t=t.map((function(t){return d(t)}));var e=this;return this.withMutations((function(n){e.forEach((function(e){t.some((function(t){return t.includes(e)}))&&n.remove(e)}))}))},Me.prototype.merge=function(){return this.union.apply(this,arguments)},Me.prototype.mergeWith=function(t){var e=an.call(arguments,1);return this.union.apply(this,e)},Me.prototype.sort=function(t){return Pe(wt(this,t))},Me.prototype.sortBy=function(t,e){return Pe(wt(this,e,t))},Me.prototype.wasAltered=function(){return this._map.wasAltered()},Me.prototype.__iterate=function(t,e){var n=this;return this._map.__iterate((function(e,r){return t(r,r,n)}),e)},Me.prototype.__iterator=function(t,e){return this._map.map((function(t,e){return e})).__iterator(t,e)},Me.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)},Me.isSet=je;var Zn="@@__IMMUTABLE_SET__@@",$n=Me.prototype;$n[Zn]=!0,$n[sn]=$n.remove,$n.mergeDeep=$n.merge,$n.mergeDeepWith=$n.mergeWith,$n.withMutations=Hn.withMutations,$n.asMutable=Hn.asMutable,$n.asImmutable=Hn.asImmutable,$n.__empty=ke,$n.__make=Ne;var tr;t(Pe,Me),Pe.of=function(){return this(arguments)},Pe.fromKeys=function(t){return this(p(t).keySeq())},Pe.prototype.toString=function(){
  return this.__toString("OrderedSet {","}")},Pe.isOrderedSet=Ue;var er=Pe.prototype;er[mn]=!0,er.__empty=xe,er.__make=He;var nr;t(Ve,B),Ve.prototype.toString=function(){return this.__toString(Fe(this)+" {","}")},Ve.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},Ve.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._defaultValues[t];return this._map?this._map.get(t,n):n},Ve.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=qe(this,Jt()))},Ve.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Fe(this));var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:qe(this,n)},Ve.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:qe(this,e)},Ve.prototype.wasAltered=function(){return this._map.wasAltered()},Ve.prototype.__iterator=function(t,e){var n=this;return p(this._defaultValues).map((function(t,e){return n.get(e)})).__iterator(t,e)},Ve.prototype.__iterate=function(t,e){var n=this;return p(this._defaultValues).map((function(t,e){return n.get(e)})).__iterate(t,e)},Ve.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?qe(this,e,t):(this.__ownerID=t,this._map=e,this)};var rr=Ve.prototype;rr[sn]=rr.remove,rr.deleteIn=rr.removeIn=Hn.removeIn,rr.merge=Hn.merge,rr.mergeWith=Hn.mergeWith,rr.mergeIn=Hn.mergeIn,rr.mergeDeep=Hn.mergeDeep,rr.mergeDeepWith=Hn.mergeDeepWith,rr.mergeDeepIn=Hn.mergeDeepIn,rr.setIn=Hn.setIn,rr.update=Hn.update,rr.updateIn=Hn.updateIn,rr.withMutations=Hn.withMutations,rr.asMutable=Hn.asMutable,rr.asImmutable=Hn.asImmutable,t(Ye,R),Ye.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},Ye.prototype.get=function(t,e){return this.has(t)?this._start+u(this,t)*this._step:e},Ye.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e<this.size&&e===Math.floor(e)},Ye.prototype.slice=function(t,e){return s(t,e,this.size)?this:(t=c(t,this.size),e=f(e,this.size),e<=t?new Ye(0,0):new Ye(this.get(t,this._end),this.get(e,this._end),this._step))},Ye.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&n<this.size)return n}return-1},Ye.prototype.lastIndexOf=function(t){return this.indexOf(t)},Ye.prototype.__iterate=function(t,e){for(var n=this,r=this.size-1,i=this._step,o=e?this._start+r*i:this._start,u=0;u<=r;u++){if(t(o,u,n)===!1)return u+1;o+=e?-i:i}return u},Ye.prototype.__iterator=function(t,e){var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,o=0;return new b(function(){var u=i;return i+=e?-r:r,o>n?I():E(t,o++,u)})},Ye.prototype.equals=function(t){return t instanceof Ye?this._start===t._start&&this._end===t._end&&this._step===t._step:Be(this,t)};var ir;t(Je,R),Je.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Je.prototype.get=function(t,e){return this.has(t)?this._value:e},Je.prototype.includes=function(t){return W(this._value,t)},Je.prototype.slice=function(t,e){var n=this.size;return s(t,e,n)?this:new Je(this._value,f(e,n)-c(t,n))},Je.prototype.reverse=function(){return this},Je.prototype.indexOf=function(t){return W(this._value,t)?0:-1},Je.prototype.lastIndexOf=function(t){return W(this._value,t)?this.size:-1},Je.prototype.__iterate=function(t,e){for(var n=this,r=0;r<this.size;r++)if(t(n._value,r,n)===!1)return r+1;return r},Je.prototype.__iterator=function(t,e){var n=this,r=0;return new b(function(){return r<n.size?E(t,r++,n._value):I()})},Je.prototype.equals=function(t){return t instanceof Je?W(this._value,t._value):Be(t)};var or;l.Iterator=b,We(l,{toArray:function(){at(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate((function(e,n){t[n]=e})),t},toIndexedSeq:function(){return new ct(this)},toJS:function(){return this.toSeq().map((function(t){return t&&"function"==typeof t.toJS?t.toJS():t})).__toJS()},toJSON:function(){return this.toSeq().map((function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t})).__toJS()},toKeyedSeq:function(){return new st(this,!0)},toMap:function(){return Pt(this.toKeyedSeq())},toObject:function(){at(this.size);var t={};return this.__iterate((function(e,n){t[n]=e})),t},toOrderedMap:function(){return Ie(this.toKeyedSeq())},toOrderedSet:function(){return Pe(y(this)?this.valueSeq():this)},toSet:function(){return Me(y(this)?this.valueSeq():this)},toSetSeq:function(){return new ft(this)},toSeq:function(){return m(this)?this.toIndexedSeq():y(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return De(y(this)?this.valueSeq():this)},toList:function(){return fe(y(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){var t=an.call(arguments,0);return Ct(this,bt(this,t))},includes:function(t){return this.some((function(e){return W(e,t)}))},entries:function(){return this.__iterator(bn)},every:function(t,e){at(this.size);var n=!0;return this.__iterate((function(r,i,o){if(!t.call(e,r,i,o))return n=!1,!1})),n},filter:function(t,e){return Ct(this,dt(this,t,e,!0))},find:function(t,e,n){var r=this.findEntry(t,e);return r?r[1]:n},findEntry:function(t,e){var n;return this.__iterate((function(r,i,o){if(t.call(e,r,i,o))return n=[i,r],!1})),n},findLastEntry:function(t,e){return this.toSeq().reverse().findEntry(t,e)},forEach:function(t,e){return at(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){at(this.size),t=void 0!==t?""+t:",";var e="",n=!0;return this.__iterate((function(r){n?n=!1:e+=t,e+=null!==r&&void 0!==r?r.toString():""})),e},keys:function(){return this.__iterator(gn)},map:function(t,e){return Ct(this,pt(this,t,e))},reduce:function(t,e,n){at(this.size);var r,i;return arguments.length<2?i=!0:r=e,this.__iterate((function(e,o,u){i?(i=!1,r=e):r=t.call(n,r,e,o,u)})),r},reduceRight:function(t,e,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Ct(this,_t(this,!0))},slice:function(t,e){return Ct(this,mt(this,t,e,!0))},some:function(t,e){return!this.every(Ze(t),e)},sort:function(t){return Ct(this,wt(this,t))},values:function(){return this.__iterator(Sn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(t,e){return o(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return vt(this,t,e)},equals:function(t){return Be(this,t)},entrySeq:function(){var t=this;if(t._cache)return new j(t._cache);var e=t.toSeq().map(Qe).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Ze(t),e)},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},first:function(){return this.find(a)},flatMap:function(t,e){return Ct(this,It(this,t,e))},flatten:function(t){return Ct(this,Et(this,t,!0))},fromEntrySeq:function(){return new ht(this)},get:function(t,e){return this.find((function(e,n){return W(n,t)}),void 0,e)},getIn:function(t,e){for(var n,r=this,i=kt(t);!(n=i.next()).done;){var o=n.value;if(r=r&&r.get?r.get(o,ln):ln,r===ln)return e}return r},groupBy:function(t,e){return yt(this,t,e)},has:function(t){return this.get(t,ln)!==ln},hasIn:function(t){return this.getIn(t,ln)!==ln},isSubset:function(t){return t="function"==typeof t.includes?t:l(t),this.every((function(e){return t.includes(e)}))},isSuperset:function(t){return t="function"==typeof t.isSubset?t:l(t),t.isSubset(this)},keySeq:function(){return this.toSeq().map(Xe).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(t){return Tt(this,t)},maxBy:function(t,e){return Tt(this,e,t)},min:function(t){return Tt(this,t?$e(t):nn)},minBy:function(t,e){return Tt(this,e?$e(e):nn,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return Ct(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return Ct(this,St(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Ze(t),e)},sortBy:function(t,e){return Ct(this,wt(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return Ct(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return Ct(this,gt(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Ze(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=rn(this))}});var ur=l.prototype;ur[dn]=!0,ur[On]=ur.values,ur.__toJS=ur.toArray,ur.__toStringMapper=tn,ur.inspect=ur.toSource=function(){return this.toString()},ur.chain=ur.flatMap,ur.contains=ur.includes,(function(){try{Object.defineProperty(ur,"length",{get:function(){if(!l.noLengthWarning){var t;try{throw new Error}catch(e){t=e.stack}if(t.indexOf("_wrapObject")===-1)return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+t),this.size}}})}catch(t){}})(),We(p,{flip:function(){return Ct(this,lt(this))},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLastKey:function(t,e){return this.toSeq().reverse().findKey(t,e)},keyOf:function(t){return this.findKey((function(e){return W(e,t)}))},lastKeyOf:function(t){return this.findLastKey((function(e){return W(e,t)}))},mapEntries:function(t,e){var n=this,r=0;return Ct(this,this.toSeq().map((function(i,o){return t.call(e,[o,i],r++,n)})).fromEntrySeq())},mapKeys:function(t,e){var n=this;return Ct(this,this.toSeq().flip().map((function(r,i){return t.call(e,r,i,n)})).flip())}});var ar=p.prototype;ar[vn]=!0,ar[On]=ur.entries,ar.__toJS=ur.toObject,ar.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+tn(t)},We(_,{toKeyedSeq:function(){return new st(this,!1)},filter:function(t,e){return Ct(this,dt(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.toKeyedSeq().keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){return this.toSeq().reverse().indexOf(t)},reverse:function(){return Ct(this,_t(this,!1))},slice:function(t,e){return Ct(this,mt(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=c(t,t<0?this.count():this.size);var r=this.slice(0,t);return Ct(this,1===n?r:r.concat(i(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.toKeyedSeq().findLastKey(t,e);return void 0===n?-1:n},first:function(){return this.get(0)},flatten:function(t){return Ct(this,Et(this,t,!1))},get:function(t,e){return t=u(this,t),t<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find((function(e,n){return n===t}),void 0,e)},has:function(t){return t=u(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t<this.size:this.indexOf(t)!==-1)},interpose:function(t){return Ct(this,Ot(this,t))},interleave:function(){var t=[this].concat(i(arguments)),e=Dt(this.toSeq(),R.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),Ct(this,n)},last:function(){return this.get(-1)},skipWhile:function(t,e){return Ct(this,St(this,t,e,!1))},zip:function(){var t=[this].concat(i(arguments));return Ct(this,Dt(this,en,t))},zipWith:function(t){var e=i(arguments);return e[0]=this,Ct(this,Dt(this,t,e))}}),_.prototype[yn]=!0,_.prototype[mn]=!0,We(d,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}}),d.prototype.has=ur.includes,We(z,p.prototype),We(R,_.prototype),We(M,d.prototype),We(B,p.prototype),We(Y,_.prototype),We(J,d.prototype);var sr={Iterable:l,Seq:C,Collection:K,Map:Pt,OrderedMap:Ie,List:fe,Stack:De,Set:Me,OrderedSet:Pe,Record:Ve,Range:Ye,Repeat:Je,is:W,fromJS:X};return sr}))},function(t,e){function n(t){return t&&"object"==typeof t&&toString.call(t)}function r(t){return"number"==typeof t&&t>-1&&t%1===0&&t<=Number.MAX_VALUE}var i=Function.prototype.bind;e.isString=function(t){return"string"==typeof t||"[object String]"===n(t)},e.isArray=Array.isArray||function(t){return"[object Array]"===n(t)},"function"!=typeof/./&&"object"!=typeof Int8Array?e.isFunction=function(t){return"function"==typeof t||!1}:e.isFunction=function(t){return"[object Function]"===toString.call(t)},e.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},e.extend=function(t){var e=arguments,n=arguments.length;if(!t||n<2)return t||{};for(var r=1;r<n;r++)for(var i=e[r],o=Object.keys(i),u=o.length,a=0;a<u;a++){var s=o[a];t[s]=i[s]}return t},e.clone=function(t){return e.isObject(t)?e.isArray(t)?t.slice():e.extend({},t):t},e.each=function(t,e,n){var i,o,u=t?t.length:0,a=-1;if(n&&(o=e,e=function(t,e,r){return o.call(n,t,e,r)}),r(u))for(;++a<u&&e(t[a],a,t)!==!1;);else for(i=Object.keys(t),u=i.length;++a<u&&e(t[i[a]],i[a],t)!==!1;);return t},e.partial=function(t){var e=Array.prototype.slice,n=e.call(arguments,1);return function(){return t.apply(this,n.concat(e.call(arguments)))}},e.toFactory=function(t){var e=function(){for(var e=arguments,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=e[o];return new(i.apply(t,[null].concat(r)))};return e.__proto__=t,e.prototype=t.prototype,e}},function(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}function i(t){return c.default.Iterable.isIterable(t)}function o(t){return i(t)||!(0,f.isObject)(t)}function u(t){return i(t)?t.toJS():t}function a(t){return i(t)?t:c.default.fromJS(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.isImmutable=i,e.isImmutableValue=o,e.toJS=u,e.toImmutable=a;var s=n(3),c=r(s),f=n(4)},function(t,e,n){function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function i(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=(function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}})(),s=n(3),c=i(s),f=n(7),h=i(f),l=n(8),p=r(l),_=n(11),d=n(10),v=n(5),y=n(4),m=n(12),g=(function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];u(this,t);var n=!!e.debug,r=n?m.DEBUG_OPTIONS:m.PROD_OPTIONS,i=new m.ReactorState({debug:n,options:r.merge(e.options||{})});this.prevReactorState=i,this.reactorState=i,this.observerState=new m.ObserverState,this.ReactMixin=(0,h.default)(this),this.__batchDepth=0,this.__isDispatching=!1}return a(t,[{key:"evaluate",value:function(t){var e=p.evaluate(this.reactorState,t),n=e.result,r=e.reactorState;return this.reactorState=r,n}},{key:"evaluateToJS",value:function(t){return(0,v.toJS)(this.evaluate(t))}},{key:"observe",value:function(t,e){var n=this;1===arguments.length&&(e=t,t=[]);var r=p.addObserver(this.observerState,t,e),i=r.observerState,o=r.entry;return this.observerState=i,function(){n.observerState=p.removeObserverByEntry(n.observerState,o)}}},{key:"unobserve",value:function(t,e){if(0===arguments.length)throw new Error("Must call unobserve with a Getter");if(!(0,d.isGetter)(t)&&!(0,_.isKeyPath)(t))throw new Error("Must call unobserve with a Getter");this.observerState=p.removeObserver(this.observerState,t,e)}},{key:"dispatch",value:function(t,e){if(0===this.__batchDepth){if(p.getOption(this.reactorState,"throwOnDispatchInDispatch")&&this.__isDispatching)throw this.__isDispatching=!1,new Error("Dispatch may not be called while a dispatch is in progress");this.__isDispatching=!0}try{this.reactorState=p.dispatch(this.reactorState,t,e)}catch(t){throw this.__isDispatching=!1,t}try{this.__notify()}finally{this.__isDispatching=!1}}},{key:"batch",value:function(t){this.batchStart(),t(),this.batchEnd()}},{key:"registerStore",value:function(t,e){console.warn("Deprecation warning: `registerStore` will no longer be supported in 1.1, use `registerStores` instead"),this.registerStores(o({},t,e))}},{key:"registerStores",value:function(t){this.reactorState=p.registerStores(this.reactorState,t),this.__notify()}},{key:"replaceStores",value:function(t){this.reactorState=p.replaceStores(this.reactorState,t)}},{key:"serialize",value:function(){return p.serialize(this.reactorState)}},{key:"loadState",value:function(t){this.reactorState=p.loadState(this.reactorState,t),this.__notify()}},{key:"reset",value:function(){var t=p.reset(this.reactorState);this.reactorState=t,this.prevReactorState=t,this.observerState=new m.ObserverState}},{key:"__notify",value:function(){var t=this;if(!(this.__batchDepth>0)){var e=this.reactorState.get("dirtyStores");if(0!==e.size){var n=c.default.Set().withMutations((function(n){n.union(t.observerState.get("any")),e.forEach((function(e){var r=t.observerState.getIn(["stores",e]);r&&n.union(r)}))}));n.forEach((function(e){var n=t.observerState.getIn(["observersMap",e]);if(n){var r=n.get("getter"),i=n.get("handler"),o=p.evaluate(t.prevReactorState,r),u=p.evaluate(t.reactorState,r);t.prevReactorState=o.reactorState,t.reactorState=u.reactorState;var a=o.result,s=u.result;c.default.is(a,s)||i.call(null,s)}}));var r=p.resetDirtyStores(this.reactorState);this.prevReactorState=r,this.reactorState=r}}}},{key:"batchStart",value:function(){this.__batchDepth++}},{key:"batchEnd",value:function(){if(this.__batchDepth--,this.__batchDepth<=0){this.__isDispatching=!0;try{this.__notify()}catch(t){throw this.__isDispatching=!1,t}this.__isDispatching=!1}}}]),t})();e.default=(0,y.toFactory)(g),t.exports=e.default},function(t,e,n){function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n={};return(0,o.each)(e,(function(e,r){n[r]=t.evaluate(e)})),n}Object.defineProperty(e,"__esModule",{value:!0});var o=n(4);e.default=function(t){return{getInitialState:function(){return i(t,this.getDataBindings())},componentDidMount:function(){var e=this;this.__unwatchFns=[],(0,o.each)(this.getDataBindings(),(function(n,i){var o=t.observe(n,(function(t){e.setState(r({},i,t))}));e.__unwatchFns.push(o)}))},componentWillUnmount:function(){for(var t=this;this.__unwatchFns.length;)t.__unwatchFns.shift()()}}},t.exports=e.default},function(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){return new M({result:t,reactorState:e})}function o(t,e){return t.withMutations((function(t){(0,R.each)(e,(function(e,n){t.getIn(["stores",n])&&console.warn("Store already defined for id = "+n);var r=e.getInitialState();if(void 0===r&&f(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store getInitialState() must return a value, did you forget a return statement");if(f(t,"throwOnNonImmutableStore")&&!(0,D.isImmutableValue)(r))throw new Error("Store getInitialState() must return an immutable value, did you forget to call toImmutable");t.update("stores",(function(t){return t.set(n,e)})).update("state",(function(t){return t.set(n,r)})).update("dirtyStores",(function(t){return t.add(n)})).update("storeStates",(function(t){return I(t,[n])}))})),E(t)}))}function u(t,e){return t.withMutations((function(t){(0,R.each)(e,(function(e,n){t.update("stores",(function(t){return t.set(n,e)}))}))}))}function a(t,e,n){if(void 0===e&&f(t,"throwOnUndefinedActionType"))throw new Error("`dispatch` cannot be called with an `undefined` action type.");var r=t.get("state"),i=t.get("dirtyStores"),o=r.withMutations((function(r){A.default.dispatchStart(t,e,n),t.get("stores").forEach((function(o,u){var a=r.get(u),s=void 0;try{s=o.handle(a,e,n)}catch(e){throw A.default.dispatchError(t,e.message),e}if(void 0===s&&f(t,"throwOnUndefinedStoreReturnValue")){var c="Store handler must return a value, did you forget a return statement";throw A.default.dispatchError(t,c),new Error(c)}r.set(u,s),a!==s&&(i=i.add(u))})),A.default.dispatchEnd(t,r,i)})),u=t.set("state",o).set("dirtyStores",i).update("storeStates",(function(t){return I(t,i)}));return E(u)}function s(t,e){var n=[],r=(0,D.toImmutable)({}).withMutations((function(r){(0,R.each)(e,(function(e,i){var o=t.getIn(["stores",i]);if(o){var u=o.deserialize(e);void 0!==u&&(r.set(i,u),n.push(i))}}))})),i=w.default.Set(n);return t.update("state",(function(t){return t.merge(r)})).update("dirtyStores",(function(t){return t.union(i)})).update("storeStates",(function(t){return I(t,n)}))}function c(t,e,n){var r=e;(0,z.isKeyPath)(e)&&(e=(0,C.fromKeyPath)(e));var i=t.get("nextId"),o=(0,C.getStoreDeps)(e),u=w.default.Map({id:i,storeDeps:o,getterKey:r,getter:e,handler:n}),a=void 0;return a=0===o.size?t.update("any",(function(t){return t.add(i)})):t.withMutations((function(t){o.forEach((function(e){var n=["stores",e];t.hasIn(n)||t.setIn(n,w.default.Set()),t.updateIn(["stores",e],(function(t){return t.add(i)}))}))})),a=a.set("nextId",i+1).setIn(["observersMap",i],u),{observerState:a,entry:u}}function f(t,e){var n=t.getIn(["options",e]);if(void 0===n)throw new Error("Invalid option: "+e);return n}function h(t,e,n){var r=t.get("observersMap").filter((function(t){var r=t.get("getterKey"),i=!n||t.get("handler")===n;return!!i&&((0,z.isKeyPath)(e)&&(0,z.isKeyPath)(r)?(0,z.isEqual)(e,r):e===r)}));return t.withMutations((function(t){r.forEach((function(e){return l(t,e)}))}))}function l(t,e){return t.withMutations((function(t){var n=e.get("id"),r=e.get("storeDeps");0===r.size?t.update("any",(function(t){return t.remove(n)})):r.forEach((function(e){t.updateIn(["stores",e],(function(t){return t?t.remove(n):t}))})),t.removeIn(["observersMap",n])}))}function p(t){var e=t.get("state");return t.withMutations((function(t){var n=t.get("stores"),r=n.keySeq().toJS();n.forEach((function(n,r){var i=e.get(r),o=n.handleReset(i);if(void 0===o&&f(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store handleReset() must return a value, did you forget a return statement");if(f(t,"throwOnNonImmutableStore")&&!(0,D.isImmutableValue)(o))throw new Error("Store reset state must be an immutable value, did you forget to call toImmutable");t.setIn(["state",r],o)})),t.update("storeStates",(function(t){return I(t,r)})),v(t)}))}function _(t,e){var n=t.get("state");if((0,z.isKeyPath)(e))return i(n.getIn(e),t);if(!(0,C.isGetter)(e))throw new Error("evaluate must be passed a keyPath or Getter");if(g(t,e))return i(b(t,e),t);var r=(0,C.getDeps)(e).map((function(e){return _(t,e).result})),o=(0,C.getComputeFn)(e).apply(null,r);return i(o,S(t,e,o))}function d(t){var e={};return t.get("stores").forEach((function(n,r){var i=t.getIn(["state",r]),o=n.serialize(i);void 0!==o&&(e[r]=o)})),e}function v(t){return t.set("dirtyStores",w.default.Set())}function y(t){return t}function m(t,e){var n=y(e);return t.getIn(["cache",n])}function g(t,e){var n=m(t,e);if(!n)return!1;var r=n.get("storeStates");return 0!==r.size&&r.every((function(e,n){return t.getIn(["storeStates",n])===e}))}function S(t,e,n){var r=y(e),i=t.get("dispatchId"),o=(0,C.getStoreDeps)(e),u=(0,D.toImmutable)({}).withMutations((function(e){o.forEach((function(n){var r=t.getIn(["storeStates",n]);e.set(n,r)}))}));return t.setIn(["cache",r],w.default.Map({value:n,storeStates:u,dispatchId:i}))}function b(t,e){var n=y(e);return t.getIn(["cache",n,"value"])}function E(t){return t.update("dispatchId",(function(t){return t+1}))}function I(t,e){return t.withMutations((function(t){e.forEach((function(e){var n=t.has(e)?t.get(e)+1:1;t.set(e,n)}))}))}Object.defineProperty(e,"__esModule",{value:!0}),e.registerStores=o,e.replaceStores=u,e.dispatch=a,e.loadState=s,e.addObserver=c,e.getOption=f,e.removeObserver=h,e.removeObserverByEntry=l,e.reset=p,e.evaluate=_,e.serialize=d,e.resetDirtyStores=v;var O=n(3),w=r(O),T=n(9),A=r(T),D=n(5),C=n(10),z=n(11),R=n(4),M=w.default.Record({result:null,reactorState:null})},function(t,e,n){var r=n(8);e.dispatchStart=function(t,e,n){(0,r.getOption)(t,"logDispatches")&&console.group&&(console.groupCollapsed("Dispatch: %s",e),console.group("payload"),console.debug(n),console.groupEnd())},e.dispatchError=function(t,e){(0,r.getOption)(t,"logDispatches")&&console.group&&(console.debug("Dispatch error: "+e),console.groupEnd())},e.dispatchEnd=function(t,e,n){(0,r.getOption)(t,"logDispatches")&&console.group&&((0,r.getOption)(t,"logDirtyStores")&&console.log("Stores updated:",n.toList().toJS()),(0,r.getOption)(t,"logAppState")&&console.debug("Dispatch done, new state: ",e.toJS()),console.groupEnd())}},function(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}function i(t){return(0,l.isArray)(t)&&(0,l.isFunction)(t[t.length-1])}function o(t){return t[t.length-1]}function u(t){return t.slice(0,t.length-1)}function a(t,e){e||(e=h.default.Set());var n=h.default.Set().withMutations((function(e){if(!i(t))throw new Error("getFlattenedDeps must be passed a Getter");u(t).forEach((function(t){if((0,p.isKeyPath)(t))e.add((0,f.List)(t));else{if(!i(t))throw new Error("Invalid getter, each dependency must be a KeyPath or Getter");e.union(a(t))}}))}));return e.union(n)}function s(t){if(!(0,p.isKeyPath)(t))throw new Error("Cannot create Getter from KeyPath: "+t);return[t,_]}function c(t){if(t.hasOwnProperty("__storeDeps"))return t.__storeDeps;var e=a(t).map((function(t){return t.first()})).filter((function(t){return!!t}));return Object.defineProperty(t,"__storeDeps",{enumerable:!1,configurable:!1,writable:!1,value:e}),e}Object.defineProperty(e,"__esModule",{value:!0});var f=n(3),h=r(f),l=n(4),p=n(11),_=function(t){return t};e.default={isGetter:i,getComputeFn:o,getFlattenedDeps:a,getStoreDeps:c,getDeps:u,fromKeyPath:s},t.exports=e.default},function(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}function i(t){return(0,s.isArray)(t)&&!(0,s.isFunction)(t[t.length-1])}function o(t,e){var n=a.default.List(t),r=a.default.List(e);return a.default.is(n,r)}Object.defineProperty(e,"__esModule",{value:!0}),e.isKeyPath=i,e.isEqual=o;var u=n(3),a=r(u),s=n(4)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(0,r.Map)({logDispatches:!1,logAppState:!1,logDirtyStores:!1,throwOnUndefinedActionType:!1,throwOnUndefinedStoreReturnValue:!1,throwOnNonImmutableStore:!1,throwOnDispatchInDispatch:!1});e.PROD_OPTIONS=i;var o=(0,r.Map)({logDispatches:!0,logAppState:!0,logDirtyStores:!0,throwOnUndefinedActionType:!0,throwOnUndefinedStoreReturnValue:!0,throwOnNonImmutableStore:!0,throwOnDispatchInDispatch:!0});e.DEBUG_OPTIONS=o;var u=(0,r.Record)({dispatchId:0,state:(0,r.Map)(),stores:(0,r.Map)(),cache:(0,r.Map)(),storeStates:(0,r.Map)(),dirtyStores:(0,r.Set)(),debug:!1,options:i});e.ReactorState=u;var a=(0,r.Record)({any:(0,r.Set)(),stores:(0,r.Map)({}),observersMap:(0,r.Map)({}),nextId:1});e.ObserverState=a}])}))})),Ne=t(Le),ke=function(t){var e,n={};if(!(t instanceof Object)||Array.isArray(t))throw new Error("keyMirror(...): Argument must be an object.");for(e in t)t.hasOwnProperty(e)&&(n[e]=e);return n},Pe=ke,Ue=Pe({VALIDATING_AUTH_TOKEN:null,VALID_AUTH_TOKEN:null,INVALID_AUTH_TOKEN:null,LOG_OUT:null}),He=Ne.Store,xe=Ne.toImmutable,Ve=new He({getInitialState:function(){return xe({isValidating:!1,authToken:!1,host:null,isInvalid:!1,errorMessage:""})},initialize:function(){this.on(Ue.VALIDATING_AUTH_TOKEN,n),this.on(Ue.VALID_AUTH_TOKEN,r),this.on(Ue.INVALID_AUTH_TOKEN,i)}}),qe=Ne.Store,Fe=Ne.toImmutable,Ge=new qe({getInitialState:function(){return Fe({authToken:null,host:""})},initialize:function(){this.on(Ue.VALID_AUTH_TOKEN,o),this.on(Ue.LOG_OUT,u)}}),Ke=Ne.Store,Be=new Ke({getInitialState:function(){return!0},initialize:function(){this.on(Ue.VALID_AUTH_TOKEN,a)}}),Ye=Pe({STREAM_START:null,STREAM_STOP:null,STREAM_ERROR:null}),Je=Ne.Store,We=Ne.toImmutable,Xe=new Je({getInitialState:function(){return We({isStreaming:!1,hasError:!1})},initialize:function(){this.on(Ye.STREAM_START,s),this.on(Ye.STREAM_ERROR,c),this.on(Ye.LOG_OUT,f)}}),Qe=1,Ze=2,$e=3,tn=function(t,e){this.url=t,this.options=e||{},this.commandId=1,this.commands={},this.connectionTries=0,this.eventListeners={},this.closeRequested=!1};tn.prototype.addEventListener=function(t,e){var n=this.eventListeners[t];n||(n=this.eventListeners[t]=[]),n.push(e)},tn.prototype.fireEvent=function(t){var e=this;(this.eventListeners[t]||[]).forEach((function(t){return t(e)}))},tn.prototype.connect=function(){var t=this;return new Promise(function(e,n){var r=t.commands;Object.keys(r).forEach((function(t){var e=r[t];e.reject&&e.reject(S($e,"Connection lost"))}));var i=!1;t.connectionTries+=1,t.socket=new WebSocket(t.url),t.socket.addEventListener("open",(function(){t.connectionTries=0})),t.socket.addEventListener("message",(function(o){var u=JSON.parse(o.data);switch(u.type){case"event":t.commands[u.id].eventCallback(u.event);break;case"result":u.success?t.commands[u.id].resolve(u):t.commands[u.id].reject(u.error),delete t.commands[u.id];break;case"pong":break;case"auth_required":t.sendMessage(h(t.options.authToken));break;case"auth_invalid":n(Ze),i=!0;break;case"auth_ok":e(t),t.fireEvent("ready"),t.commandId=1,t.commands={},Object.keys(r).forEach((function(e){var n=r[e];n.eventType&&t.subscribeEvents(n.eventCallback,n.eventType).then((function(t){n.unsubscribe=t}))}))}})),t.socket.addEventListener("close",(function(){if(!i&&!t.closeRequested){0===t.connectionTries?t.fireEvent("disconnected"):n(Qe);var e=1e3*Math.min(t.connectionTries,5);setTimeout((function(){return t.connect()}),e)}}))})},tn.prototype.close=function(){this.closeRequested=!0,this.socket.close()},tn.prototype.getStates=function(){return this.sendMessagePromise(l()).then(b)},tn.prototype.getServices=function(){return this.sendMessagePromise(_()).then(b)},tn.prototype.getPanels=function(){return this.sendMessagePromise(d()).then(b)},tn.prototype.getConfig=function(){return this.sendMessagePromise(p()).then(b)},tn.prototype.callService=function(t,e,n){return this.sendMessagePromise(v(t,e,n))},tn.prototype.subscribeEvents=function(t,e){var n=this;return this.sendMessagePromise(y(e)).then((function(r){var i={eventCallback:t,eventType:e,unsubscribe:function(){return n.sendMessagePromise(m(r.id)).then((function(){delete n.commands[r.id]}))}};return n.commands[r.id]=i,function(){return i.unsubscribe()}}))},tn.prototype.ping=function(){return this.sendMessagePromise(g())},tn.prototype.sendMessage=function(t){this.socket.send(JSON.stringify(t))},tn.prototype.sendMessagePromise=function(t){var e=this;return new Promise(function(n,r){e.commandId+=1;var i=e.commandId;t.id=i,e.commands[i]={resolve:n,reject:r},e.sendMessage(t)})};var en=Pe({API_FETCH_ALL_START:null,API_FETCH_ALL_SUCCESS:null,API_FETCH_ALL_FAIL:null,SYNC_SCHEDULED:null,SYNC_SCHEDULE_CANCELLED:null}),nn=Ne.Store,rn=new nn({getInitialState:function(){return!0},initialize:function(){this.on(en.API_FETCH_ALL_START,(function(){return!0})),this.on(en.API_FETCH_ALL_SUCCESS,(function(){return!1})),this.on(en.API_FETCH_ALL_FAIL,(function(){return!1})),this.on(en.LOG_OUT,(function(){return!1}))}}),on=I,un=Pe({API_FETCH_SUCCESS:null,API_FETCH_START:null,API_FETCH_FAIL:null,API_SAVE_SUCCESS:null,API_SAVE_START:null,API_SAVE_FAIL:null,API_DELETE_SUCCESS:null,API_DELETE_START:null,API_DELETE_FAIL:null,LOG_OUT:null}),an=Ne.Store,sn=Ne.toImmutable,cn=new an({getInitialState:function(){return sn({})},initialize:function(){var t=this;this.on(un.API_FETCH_SUCCESS,O),this.on(un.API_SAVE_SUCCESS,O),this.on(un.API_DELETE_SUCCESS,w),this.on(un.LOG_OUT,(function(){return t.getInitialState()}))}}),fn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,ln=A()?Object.assign:function(t,e){for(var n,r,i=arguments,o=T(t),u=1;u<arguments.length;u++){n=Object(i[u]);for(var a in n)fn.call(n,a)&&(o[a]=n[a]);if(Object.getOwnPropertySymbols){r=Object.getOwnPropertySymbols(n);for(var s=0;s<r.length;s++)hn.call(n,r[s])&&(o[r[s]]=n[r[s]]);
  }}return o},pn=Ne.toImmutable,_n=D,dn=Object.freeze({createApiActions:_n,register:N,createHasDataGetter:k,createEntityMapGetter:P,createByIdGetter:U}),vn=["playing","paused","unknown"],yn=function(t,e){this.serviceActions=t.serviceActions,this.stateObj=e},mn={isOff:{},isIdle:{},isMuted:{},isPaused:{},isPlaying:{},isMusic:{},isTVShow:{},hasMediaControl:{},volumeSliderValue:{},showProgress:{},currentProgress:{},supportsPause:{},supportsVolumeSet:{},supportsVolumeMute:{},supportsPreviousTrack:{},supportsNextTrack:{},supportsTurnOn:{},supportsTurnOff:{},supportsPlayMedia:{},supportsVolumeButtons:{},supportsPlay:{},primaryText:{},secondaryText:{}};mn.isOff.get=function(){return"off"===this.stateObj.state},mn.isIdle.get=function(){return"idle"===this.stateObj.state},mn.isMuted.get=function(){return this.stateObj.attributes.is_volume_muted},mn.isPaused.get=function(){return"paused"===this.stateObj.state},mn.isPlaying.get=function(){return"playing"===this.stateObj.state},mn.isMusic.get=function(){return"music"===this.stateObj.attributes.media_content_type},mn.isTVShow.get=function(){return"tvshow"===this.stateObj.attributes.media_content_type},mn.hasMediaControl.get=function(){return vn.indexOf(this.stateObj.state)!==-1},mn.volumeSliderValue.get=function(){return 100*this.stateObj.attributes.volume_level},mn.showProgress.get=function(){return(this.isPlaying||this.isPaused)&&"media_position"in this.stateObj.attributes&&"media_position_updated_at"in this.stateObj.attributes},mn.currentProgress.get=function(){return this.stateObj.attributes.media_position+(Date.now()-new Date(this.stateObj.attributes.media_position_updated_at))/1e3},mn.supportsPause.get=function(){return 0!==(1&this.stateObj.attributes.supported_media_commands)},mn.supportsVolumeSet.get=function(){return 0!==(4&this.stateObj.attributes.supported_media_commands)},mn.supportsVolumeMute.get=function(){return 0!==(8&this.stateObj.attributes.supported_media_commands)},mn.supportsPreviousTrack.get=function(){return 0!==(16&this.stateObj.attributes.supported_media_commands)},mn.supportsNextTrack.get=function(){return 0!==(32&this.stateObj.attributes.supported_media_commands)},mn.supportsTurnOn.get=function(){return 0!==(128&this.stateObj.attributes.supported_media_commands)},mn.supportsTurnOff.get=function(){return 0!==(256&this.stateObj.attributes.supported_media_commands)},mn.supportsPlayMedia.get=function(){return 0!==(512&this.stateObj.attributes.supported_media_commands)},mn.supportsVolumeButtons.get=function(){return 0!==(1024&this.stateObj.attributes.supported_media_commands)},mn.supportsPlay.get=function(){return 0!==(16384&this.stateObj.attributes.supported_media_commands)},mn.primaryText.get=function(){return this.stateObj.attributes.media_title||this.stateObj.stateDisplay},mn.secondaryText.get=function(){if(this.isMusic)return this.stateObj.attributes.media_artist;if(this.isTVShow){var t=this.stateObj.attributes.media_series_title;return this.stateObj.attributes.media_season&&(t+=" S"+this.stateObj.attributes.media_season,this.stateObj.attributes.media_episode&&(t+="E"+this.stateObj.attributes.media_episode)),t}return this.stateObj.attributes.app_name?this.stateObj.attributes.app_name:""},yn.prototype.mediaPlayPause=function(){this.callService("media_play_pause")},yn.prototype.nextTrack=function(){this.callService("media_next_track")},yn.prototype.playbackControl=function(){this.callService("media_play_pause")},yn.prototype.previousTrack=function(){this.callService("media_previous_track")},yn.prototype.setVolume=function(t){this.callService("volume_set",{volume_level:t})},yn.prototype.togglePower=function(){this.isOff?this.turnOn():this.turnOff()},yn.prototype.turnOff=function(){this.callService("turn_off")},yn.prototype.turnOn=function(){this.callService("turn_on")},yn.prototype.volumeDown=function(){this.callService("volume_down")},yn.prototype.volumeMute=function(t){if(!this.supportsVolumeMute)throw new Error("Muting volume not supported");this.callService("volume_mute",{is_volume_muted:t})},yn.prototype.volumeUp=function(){this.callService("volume_down")},yn.prototype.callService=function(t,e){var n=e||{};n.entity_id=this.stateObj.entityId,this.serviceActions.callService("media_player",t,n)},Object.defineProperties(yn.prototype,mn);var gn=Ne.Immutable,Sn=Ne.toJS,bn="entity",En=new gn.Record({entityId:null,domain:null,objectId:null,state:null,entityDisplay:null,stateDisplay:null,lastChanged:null,lastChangedAsDate:null,lastUpdated:null,lastUpdatedAsDate:null,attributes:{},isCustomGroup:null},"Entity"),In=(function(t){function e(e,n,r,i,o){void 0===o&&(o={});var u=e.split("."),a=u[0],s=u[1],c=n.replace(/_/g," ");o.unit_of_measurement&&(c+=" "+o.unit_of_measurement),t.call(this,{entityId:e,domain:a,objectId:s,state:n,stateDisplay:c,lastChanged:r,lastUpdated:i,attributes:o,entityDisplay:o.friendly_name||s.replace(/_/g," "),lastChangedAsDate:H(r),lastUpdatedAsDate:H(i),isCustomGroup:"group"===a&&!o.auto})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={id:{}};return n.id.get=function(){return this.entityId},e.prototype.domainModel=function(t){if("media_player"!==this.domain)throw new Error("Domain does not have a model");return new yn(t,this)},e.delete=function(t,e){return on(t,"DELETE","states/"+e.entityId)},e.save=function(t,e){var n=Sn(e),r=n.entityId,i=n.state,o=n.attributes;void 0===o&&(o={});var u={state:i,attributes:o};return on(t,"POST","states/"+r,u)},e.fetch=function(t,e){return on(t,"GET","states/"+e)},e.fetchAll=function(t){return on(t,"GET","states")},e.fromJSON=function(t){var n=t.entity_id,r=t.state,i=t.last_changed,o=t.last_updated,u=t.attributes;return new e(n,r,i,o,u)},Object.defineProperties(e.prototype,n),e})(En);In.entity=bn;var On=_n(In),wn=k(In),Tn=P(In),An=U(In),Dn=[Tn,function(t){return t.filter((function(t){return!t.attributes.hidden}))}],Cn=Object.freeze({hasData:wn,entityMap:Tn,byId:An,visibleEntityMap:Dn}),zn=On,Rn=Cn,Mn=Object.freeze({actions:zn,getters:Rn}),jn=Pe({NOTIFICATION_CREATED:null}),Ln=Ne.Store,Nn=Ne.Immutable,kn=new Ln({getInitialState:function(){return new Nn.OrderedMap},initialize:function(){this.on(jn.NOTIFICATION_CREATED,x),this.on(jn.LOG_OUT,V)}}),Pn=Object.freeze({createNotification:q}),Un=["notifications"],Hn=[Un,function(t){return t.last()}],xn=Object.freeze({notificationMap:Un,lastNotificationMessage:Hn}),Vn=Pn,qn=xn,Fn=Object.freeze({register:F,actions:Vn,getters:qn}),Gn=Ne.Immutable,Kn=Ne.toImmutable,Bn="service",Yn=new Gn.Record({domain:null,services:[]},"ServiceDomain"),Jn=(function(t){function e(e,n){t.call(this,{domain:e,services:n})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={id:{}};return n.id.get=function(){return this.domain},e.fetchAll=function(){return on("GET","services")},e.fromJSON=function(t){var n=t.domain,r=t.services;return new e(n,Kn(r))},Object.defineProperties(e.prototype,n),e})(Yn);Jn.entity=Bn;var Wn=k(Jn),Xn=P(Jn),Qn=U(Jn),Zn=Object.freeze({hasData:Wn,entityMap:Xn,byDomain:Qn,hasService:B,canToggleEntity:Y}),$n=_n(Jn);$n.serviceRegistered=function(t,e,n){var r=t.evaluateToJS(Qn(e));if(r)r.services[n]={};else{var i;r={domain:e,services:(i={},i[n]={},i)}}$n.incrementData(t,r)},$n.callTurnOn=function(t,e,n){return void 0===n&&(n={}),$n.callService(t,"homeassistant","turn_on",ln({},n,{entity_id:e}))},$n.callTurnOff=function(t,e,n){return void 0===n&&(n={}),$n.callService(t,"homeassistant","turn_off",ln({},n,{entity_id:e}))},$n.callService=function(t,e,n,r){return void 0===r&&(r={}),on(t,"POST","services/"+e+"/"+n,r).then((function(i){"turn_on"===n&&r.entity_id?Vn.createNotification(t,"Turned on "+r.entity_id+"."):"turn_off"===n&&r.entity_id?Vn.createNotification(t,"Turned off "+r.entity_id+"."):Vn.createNotification(t,"Service "+e+"/"+n+" called."),zn.incrementData(t,i)}))};var tr=$n,er=Zn,nr=Object.freeze({actions:tr,getters:er}),rr=Ne.Immutable,ir="event",or=new rr.Record({event:null,listenerCount:0},"Event"),ur=(function(t){function e(e,n){void 0===n&&(n=0),t.call(this,{event:e,listenerCount:n})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={id:{}};return n.id.get=function(){return this.event},e.fetchAll=function(t){return on(t,"GET","events")},e.fromJSON=function(t){var n=t.event,r=t.listener_count;return new e(n,r)},Object.defineProperties(e.prototype,n),e})(or);ur.entity=ir;var ar=_n(ur);ar.fireEvent=function(t,e,n){return void 0===n&&(n={}),on(t,"POST","events/"+e,n).then((function(){Vn.createNotification(t,"Event "+e+" successful fired!")}))};var sr=k(ur),cr=P(ur),fr=U(ur),hr=Object.freeze({hasData:sr,entityMap:cr,byId:fr}),lr=ar,pr=hr,_r=Object.freeze({actions:lr,getters:pr}),dr=Pe({SERVER_CONFIG_LOADED:null,COMPONENT_LOADED:null,LOG_OUT:null}),vr=Ne.Store,yr=Ne.toImmutable,mr=new vr({getInitialState:function(){return yr([])},initialize:function(){this.on(dr.COMPONENT_LOADED,J),this.on(dr.SERVER_CONFIG_LOADED,W),this.on(dr.LOG_OUT,X)}}),gr=Ne.Store,Sr=Ne.toImmutable,br=new gr({getInitialState:function(){return Sr({latitude:null,longitude:null,location_name:"Home",unit_system:"metric",time_zone:"UTC",config_dir:null,serverVersion:"unknown"})},initialize:function(){this.on(dr.SERVER_CONFIG_LOADED,Q),this.on(dr.LOG_OUT,Z)}}),Er=Object.freeze({configLoaded:$,fetchAll:tt,componentLoaded:et}),Ir=[["serverConfig","latitude"],["serverConfig","longitude"],function(t,e){return{latitude:t,longitude:e}}],Or=["serverConfig","location_name"],wr=["serverConfig","config_dir"],Tr=["serverConfig","serverVersion"],Ar=Object.freeze({locationGPS:Ir,locationName:Or,configDir:wr,serverVersion:Tr,isComponentLoaded:nt}),Dr=Er,Cr=Ar,zr=Object.freeze({register:rt,actions:Dr,getters:Cr}),Rr=Pe({NAVIGATE:null,SHOW_SIDEBAR:null,PANELS_LOADED:null,LOG_OUT:null}),Mr=Ne.Store,jr=new Mr({getInitialState:function(){return"states"},initialize:function(){this.on(Rr.NAVIGATE,it),this.on(Rr.LOG_OUT,ot)}}),Lr=Ne.Store,Nr=Ne.toImmutable,kr=new Lr({getInitialState:function(){return Nr({})},initialize:function(){this.on(Rr.PANELS_LOADED,ut),this.on(Rr.LOG_OUT,at)}}),Pr=Ne.Store,Ur=new Pr({getInitialState:function(){return!1},initialize:function(){this.on(Rr.SHOW_SIDEBAR,st),this.on(Rr.LOG_OUT,ct)}}),Hr=Object.freeze({showSidebar:ft,navigate:ht,panelsLoaded:lt}),xr=["panels"],Vr=["currentPanel"],qr=[xr,Vr,function(t,e){return t.get(e)||null}],Fr=["showSidebar"],Gr=Object.freeze({panels:xr,activePanelName:Vr,activePanel:qr,showSidebar:Fr}),Kr=Pe({SELECT_ENTITY:null,LOG_OUT:null}),Br=Ne.Store,Yr=new Br({getInitialState:function(){return null},initialize:function(){this.on(Kr.SELECT_ENTITY,pt),this.on(Kr.LOG_OUT,_t)}}),Jr=Object.freeze({selectEntity:dt,deselectEntity:vt}),Wr=Pe({ENTITY_HISTORY_DATE_SELECTED:null,ENTITY_HISTORY_FETCH_START:null,ENTITY_HISTORY_FETCH_ERROR:null,ENTITY_HISTORY_FETCH_SUCCESS:null,RECENT_ENTITY_HISTORY_FETCH_START:null,RECENT_ENTITY_HISTORY_FETCH_ERROR:null,RECENT_ENTITY_HISTORY_FETCH_SUCCESS:null,LOG_OUT:null}),Xr=Ne.Store,Qr=new Xr({getInitialState:function(){var t=new Date;return t.setDate(t.getDate()-1),t.setHours(0,0,0,0),t.toISOString()},initialize:function(){this.on(Wr.ENTITY_HISTORY_DATE_SELECTED,mt),this.on(Wr.LOG_OUT,gt)}}),Zr=Ne.Store,$r=Ne.toImmutable,ti=new Zr({getInitialState:function(){return $r({})},initialize:function(){this.on(Wr.ENTITY_HISTORY_FETCH_SUCCESS,St),this.on(Wr.LOG_OUT,bt)}}),ei=Ne.Store,ni=new ei({getInitialState:function(){return!1},initialize:function(){this.on(Wr.ENTITY_HISTORY_FETCH_START,(function(){return!0})),this.on(Wr.ENTITY_HISTORY_FETCH_SUCCESS,(function(){return!1})),this.on(Wr.ENTITY_HISTORY_FETCH_ERROR,(function(){return!1})),this.on(Wr.RECENT_ENTITY_HISTORY_FETCH_START,(function(){return!0})),this.on(Wr.RECENT_ENTITY_HISTORY_FETCH_SUCCESS,(function(){return!1})),this.on(Wr.RECENT_ENTITY_HISTORY_FETCH_ERROR,(function(){return!1})),this.on(Wr.LOG_OUT,(function(){return!1}))}}),ri=Ne.Store,ii=Ne.toImmutable,oi=new ri({getInitialState:function(){return ii({})},initialize:function(){this.on(Wr.RECENT_ENTITY_HISTORY_FETCH_SUCCESS,Et),this.on(Wr.LOG_OUT,It)}}),ui=Ne.Store,ai=Ne.toImmutable,si="ALL_ENTRY_FETCH",ci=new ui({getInitialState:function(){return ai({})},initialize:function(){this.on(Wr.RECENT_ENTITY_HISTORY_FETCH_SUCCESS,Ot),this.on(Wr.LOG_OUT,wt)}}),fi=Ne.toImmutable,hi=["isLoadingEntityHistory"],li=["currentEntityHistoryDate"],pi=["entityHistory"],_i=[li,pi,function(t,e){return e.get(t)||fi({})}],di=[li,pi,function(t,e){return!!e.get(t)}],vi=["recentEntityHistory"],yi=["recentEntityHistory"],mi=Object.freeze({isLoadingEntityHistory:hi,currentDate:li,entityHistoryMap:pi,entityHistoryForCurrentDate:_i,hasDataForCurrentDate:di,recentEntityHistoryMap:vi,recentEntityHistoryUpdatedMap:yi}),gi=Object.freeze({changeCurrentDate:Tt,fetchRecent:At,fetchDate:Dt,fetchSelectedDate:Ct}),Si=gi,bi=mi,Ei=Object.freeze({register:zt,actions:Si,getters:bi}),Ii=["moreInfoEntityId"],Oi=[Ii,function(t){return null!==t}],wi=[Ii,Rn.entityMap,function(t,e){return e.get(t)||null}],Ti=[Ii,bi.recentEntityHistoryMap,function(t,e){return e.get(t)}],Ai=[Ii,bi.recentEntityHistoryUpdatedMap,function(t,e){return yt(e.get(t))}],Di=Object.freeze({currentEntityId:Ii,hasCurrentEntityId:Oi,currentEntity:wi,currentEntityHistory:Ti,isCurrentEntityHistoryStale:Ai}),Ci=Jr,zi=Di,Ri=Object.freeze({register:Rt,actions:Ci,getters:zi}),Mi=Pe({SELECT_VIEW:null}),ji=Ne.Store,Li=new ji({getInitialState:function(){return null},initialize:function(){this.on(Mi.SELECT_VIEW,(function(t,e){var n=e.view;return n})),this.on(un.API_FETCH_SUCCESS,Mt)}}),Ni=Object.freeze({selectView:jt}),ki=Ne.Immutable,Pi="group.default_view",Ui=["persistent_notification","configurator"],Hi=["currentView"],xi=[Rn.entityMap,function(t){return t.filter((function(t){return"group"===t.domain&&t.attributes.view&&t.entityId!==Pi}))}],Vi=[Rn.entityMap,Hi,function(t,e){var n;return n=e?t.get(e):t.get(Pi),n?(new ki.Map).withMutations((function(e){Lt(e,t,n),t.valueSeq().forEach((function(t,n){Ui.indexOf(t.domain)!==-1&&e.set(n,t)}))})):t.filter((function(t){return!t.attributes.hidden}))}],qi=Object.freeze({currentView:Hi,views:xi,currentViewEntities:Vi}),Fi=Ni,Gi=qi,Ki=Object.freeze({register:Nt,actions:Fi,getters:Gi}),Bi=history.pushState&&!0,Yi="Home Assistant",Ji={},Wi=Object.freeze({startSync:Vt,stopSync:qt}),Xi=Hr,Qi=Gr,Zi=Wi,$i=Object.freeze({register:Ft,actions:Xi,getters:Qi,urlSync:Zi}),to=Object.freeze({fetchAll:Gt}),eo=[Rn.hasData,pr.hasData,er.hasData,function(t,e,n){return t&&e&&n}],no=["isFetchingData"],ro=Object.freeze({isDataLoaded:eo,isFetching:no}),io=to,oo=ro,uo=Object.freeze({register:Kt,actions:io,getters:oo}),ao=function(t,e){switch(e.event_type){case"state_changed":e.data.new_state?zn.incrementData(t,e.data.new_state):zn.removeData(t,e.data.entity_id);break;case"component_loaded":Dr.componentLoaded(t,e.data.component);break;case"service_registered":tr.serviceRegistered(t,e.data.domain,e.data.service)}},so=6e4,co=["state_changed","component_loaded","service_registered"],fo={},ho=Object.freeze({start:Jt}),lo=["streamStatus","isStreaming"],po=["streamStatus","hasError"],_o=Object.freeze({isStreamingEvents:lo,hasStreamingEventsError:po}),vo=ho,yo=_o,mo=Object.freeze({register:Wt,actions:vo,getters:yo}),go="Unexpected error",So=Object.freeze({validate:Xt,logOut:Qt}),bo=["authAttempt","isValidating"],Eo=["authAttempt","isInvalid"],Io=["authAttempt","errorMessage"],Oo=["rememberAuth"],wo=[["authAttempt","authToken"],["authAttempt","host"],function(t,e){return{authToken:t,host:e}}],To=["authCurrent","authToken"],Ao=[To,["authCurrent","host"],function(t,e){return{authToken:t,host:e}}],Do=[bo,["authAttempt","authToken"],["authCurrent","authToken"],function(t,e,n){return t?e:n}],Co=[bo,wo,Ao,function(t,e,n){return t?e:n}],zo=Object.freeze({isValidating:bo,isInvalidAttempt:Eo,attemptErrorMessage:Io,rememberAuth:Oo,attemptAuthInfo:wo,currentAuthToken:To,currentAuthInfo:Ao,authToken:Do,authInfo:Co}),Ro=So,Mo=zo,jo=Object.freeze({register:Zt,actions:Ro,getters:Mo}),Lo=$t(),No={authToken:{getter:[Mo.currentAuthToken,Mo.rememberAuth,function(t,e){return e?t:null}],defaultValue:null},showSidebar:{getter:Qi.showSidebar,defaultValue:!1}},ko={};Object.keys(No).forEach((function(t){t in Lo||(Lo[t]=No[t].defaultValue),Object.defineProperty(ko,t,{get:function(){try{return JSON.parse(Lo[t])}catch(e){return No[t].defaultValue}}})})),ko.startSync=function(t){Object.keys(No).forEach((function(e){var n=No[e],r=n.getter,i=function(t){Lo[e]=JSON.stringify(t)};t.observe(r,i),i(t.evaluate(r))}))};var Po=ko,Uo=Ne.Reactor,Ho=0,xo=Ne.toImmutable,Vo={UNIT_TEMP_C:"°C",UNIT_TEMP_F:"°F"},qo={expandGroup:ne,isStaleTime:yt,parseDateTime:H,temperatureUnits:Vo},Fo=Object.freeze({fetchErrorLog:re}),Go=Fo,Ko=Object.freeze({actions:Go}),Bo=Pe({LOGBOOK_DATE_SELECTED:null,LOGBOOK_ENTRIES_FETCH_START:null,LOGBOOK_ENTRIES_FETCH_ERROR:null,LOGBOOK_ENTRIES_FETCH_SUCCESS:null}),Yo=Ne.Store,Jo=new Yo({getInitialState:function(){var t=new Date;return t.setHours(0,0,0,0),t.toISOString()},initialize:function(){this.on(Bo.LOGBOOK_DATE_SELECTED,ie),this.on(Bo.LOG_OUT,oe)}}),Wo=Ne.Store,Xo=new Wo({getInitialState:function(){return!1},initialize:function(){this.on(Bo.LOGBOOK_ENTRIES_FETCH_START,(function(){return!0})),this.on(Bo.LOGBOOK_ENTRIES_FETCH_SUCCESS,(function(){return!1})),this.on(Bo.LOGBOOK_ENTRIES_FETCH_ERROR,(function(){return!1})),this.on(Bo.LOG_OUT,(function(){return!1}))}}),Qo=Ne.Immutable,Zo=new Qo.Record({when:null,name:null,message:null,domain:null,entityId:null},"LogbookEntry"),$o=(function(t){function e(e,n,r,i,o){t.call(this,{when:e,name:n,message:r,domain:i,entityId:o})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fromJSON=function(t){var n=t.when,r=t.name,i=t.message,o=t.domain,u=t.entity_id;return new e(H(n),r,i,o,u)},e})(Zo),tu=Ne.Store,eu=Ne.toImmutable,nu=new tu({getInitialState:function(){return eu({})},initialize:function(){this.on(Bo.LOGBOOK_ENTRIES_FETCH_SUCCESS,ue),this.on(Bo.LOG_OUT,ae)}}),ru=Ne.Store,iu=Ne.toImmutable,ou=new ru({getInitialState:function(){return iu({})},initialize:function(){this.on(Bo.LOGBOOK_ENTRIES_FETCH_SUCCESS,se),this.on(Bo.LOG_OUT,ce)}}),uu=Object.freeze({changeCurrentDate:fe,fetchDate:he}),au=Ne.toImmutable,su=6e4,cu=["currentLogbookDate"],fu=[cu,["logbookEntriesUpdated"],function(t,e){return le(e.get(t))}],hu=[cu,["logbookEntries"],function(t,e){return e.get(t)||au([])}],lu=["isLoadingLogbookEntries"],pu=Object.freeze({currentDate:cu,isCurrentStale:fu,currentEntries:hu,isLoadingEntries:lu}),_u=uu,du=pu,vu=Object.freeze({register:pe,actions:_u,getters:du}),yu=Pe({PUSH_NOTIFICATIONS_SUBSCRIBE:null,PUSH_NOTIFICATIONS_UNSUBSCRIBE:null}),mu=Ne.Store,gu=Ne.toImmutable,Su=new mu({getInitialState:function(){return gu({supported:"PushManager"in window&&("https:"===document.location.protocol||"localhost"===document.location.hostname||"127.0.0.1"===document.location.hostname),active:"Notification"in window&&"granted"===Notification.permission})},initialize:function(){this.on(yu.PUSH_NOTIFICATIONS_SUBSCRIBE,_e),this.on(yu.PUSH_NOTIFICATIONS_UNSUBSCRIBE,de),this.on(yu.LOG_OUT,ve)}}),bu=Object.freeze({subscribePushNotifications:ye,unsubscribePushNotifications:me}),Eu=["pushNotifications","supported"],Iu=["pushNotifications","active"],Ou=Object.freeze({isSupported:Eu,isActive:Iu}),wu=bu,Tu=Ou,Au=Object.freeze({register:ge,actions:wu,getters:Tu}),Du=Object.freeze({render:Se}),Cu=Du,zu=Object.freeze({actions:Cu}),Ru=Ne.Store,Mu=new Ru({getInitialState:function(){return"webkitSpeechRecognition"in window}}),ju=Pe({VOICE_START:null,VOICE_RESULT:null,VOICE_TRANSMITTING:null,VOICE_DONE:null,VOICE_ERROR:null}),Lu=Ne.Store,Nu=Ne.toImmutable,ku=new Lu({getInitialState:function(){return Nu({isListening:!1,isTransmitting:!1,interimTranscript:"",finalTranscript:""})},initialize:function(){this.on(ju.VOICE_START,be),this.on(ju.VOICE_RESULT,Ee),this.on(ju.VOICE_TRANSMITTING,Ie),this.on(ju.VOICE_DONE,Oe),this.on(ju.VOICE_ERROR,we),this.on(ju.LOG_OUT,Te)}}),Pu={},Uu=Object.freeze({stop:Ce,finish:ze,listen:Re}),Hu=["isVoiceSupported"],xu=["currentVoiceCommand","isListening"],Vu=["currentVoiceCommand","isTransmitting"],qu=["currentVoiceCommand","interimTranscript"],Fu=["currentVoiceCommand","finalTranscript"],Gu=[qu,Fu,function(t,e){return t.slice(e.length)}],Ku=Object.freeze({isVoiceSupported:Hu,isListening:xu,isTransmitting:Vu,interimTranscript:qu,finalTranscript:Fu,extraInterimTranscript:Gu}),Bu=Uu,Yu=Ku,Ju=Object.freeze({register:Me,actions:Bu,getters:Yu}),Wu=function(){var t=te();Object.defineProperties(this,{demo:{value:!1,enumerable:!0},dev:{value:!1,enumerable:!0},localStoragePreferences:{value:Po,enumerable:!0},reactor:{value:t,enumerable:!0},util:{value:qo,enumerable:!0},callApi:{value:on.bind(null,t)},startLocalStoragePreferencesSync:{value:Po.startSync.bind(Po,t)},startUrlSync:{value:Zi.startSync.bind(null,t)},stopUrlSync:{value:Zi.stopSync.bind(null,t)}}),ee(this,t,{auth:jo,config:zr,entity:Mn,entityHistory:Ei,errorLog:Ko,event:_r,logbook:vu,moreInfo:Ri,navigation:$i,notification:Fn,pushNotification:Au,restApi:dn,service:nr,stream:mo,sync:uo,template:zu,view:Ki,voice:Ju})},Xu=new Wu;window.validateAuth=function(t,e){Xu.authActions.validate(t,{rememberAuth:e,useStreaming:Xu.localStoragePreferences.useStreaming})},window.removeInitMsg=function(){var t=document.getElementById("ha-init-skeleton");t&&t.parentElement.removeChild(t)},Xu.reactor.batch((function(){Xu.navigationActions.showSidebar(Xu.localStoragePreferences.showSidebar),window.noAuth?window.validateAuth("",!1):Xu.localStoragePreferences.authToken&&window.validateAuth(Xu.localStoragePreferences.authToken,!0)})),setTimeout(Xu.startLocalStoragePreferencesSync,5e3),"serviceWorker"in navigator&&window.addEventListener("load",(function(){navigator.serviceWorker.register("/service_worker.js")})),window.hass=Xu})();
  