// actioncable@5.2.8 downloaded from https://ga.jspm.io/npm:actioncable@5.2.8-1/lib/assets/compiled/action_cable.js var t="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:global;var n={};(function(){var o=this||t;(function(){(function(){var n=[].slice;(this||t).ActionCable={INTERNAL:{message_types:{welcome:"welcome",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},WebSocket:window.WebSocket,logger:window.console,createConsumer:function(n){var o;null==n&&(n=null!=(o=this.getConfig("url"))?o:(this||t).INTERNAL.default_mount_path);return new e.Consumer(this.createWebSocketURL(n))},getConfig:function(t){var n;n=document.head.querySelector("meta[name='action-cable-"+t+"']");return null!=n?n.getAttribute("content"):void 0},createWebSocketURL:function(t){var n;if(t&&!/^wss?:/i.test(t)){n=document.createElement("a");n.href=t;n.href=n.href;n.protocol=n.protocol.replace("http","ws");return n.href}return t},startDebugging:function(){return(this||t).debugging=true},stopDebugging:function(){return(this||t).debugging=null},log:function(){var o,e;o=1<=arguments.length?n.call(arguments,0):[];if((this||t).debugging){o.push(Date.now());return(e=(this||t).logger).log.apply(e,["[ActionCable]"].concat(n.call(o)))}}}}).call(this||t)}).call(o);var e=o.ActionCable;(function(){(function(){var bind=function(t,n){return function(){return t.apply(n,arguments)}};e.ConnectionMonitor=function(){var n,o,i;ConnectionMonitor.pollInterval={min:3,max:30};ConnectionMonitor.staleThreshold=6;function ConnectionMonitor(n){(this||t).connection=n;(this||t).visibilityDidChange=bind((this||t).visibilityDidChange,this||t);(this||t).reconnectAttempts=0}ConnectionMonitor.prototype.start=function(){if(!this.isRunning()){(this||t).startedAt=o();delete(this||t).stoppedAt;this.startPolling();document.addEventListener("visibilitychange",(this||t).visibilityDidChange);return e.log("ConnectionMonitor started. pollInterval = "+this.getPollInterval()+" ms")}};ConnectionMonitor.prototype.stop=function(){if(this.isRunning()){(this||t).stoppedAt=o();this.stopPolling();document.removeEventListener("visibilitychange",(this||t).visibilityDidChange);return e.log("ConnectionMonitor stopped")}};ConnectionMonitor.prototype.isRunning=function(){return null!=(this||t).startedAt&&null==(this||t).stoppedAt};ConnectionMonitor.prototype.recordPing=function(){return(this||t).pingedAt=o()};ConnectionMonitor.prototype.recordConnect=function(){(this||t).reconnectAttempts=0;this.recordPing();delete(this||t).disconnectedAt;return e.log("ConnectionMonitor recorded connect")};ConnectionMonitor.prototype.recordDisconnect=function(){(this||t).disconnectedAt=o();return e.log("ConnectionMonitor recorded disconnect")};ConnectionMonitor.prototype.startPolling=function(){this.stopPolling();return this.poll()};ConnectionMonitor.prototype.stopPolling=function(){return clearTimeout((this||t).pollTimeout)};ConnectionMonitor.prototype.poll=function(){return(this||t).pollTimeout=setTimeout(function(t){return function(){t.reconnectIfStale();return t.poll()}}(this||t),this.getPollInterval())};ConnectionMonitor.prototype.getPollInterval=function(){var o,e,i,r;r=(this||t).constructor.pollInterval,i=r.min,e=r.max;o=5*Math.log((this||t).reconnectAttempts+1);return Math.round(1e3*n(o,i,e))};ConnectionMonitor.prototype.reconnectIfStale=function(){if(this.connectionIsStale()){e.log("ConnectionMonitor detected stale connection. reconnectAttempts = "+(this||t).reconnectAttempts+", pollInterval = "+this.getPollInterval()+" ms, time disconnected = "+i((this||t).disconnectedAt)+" s, stale threshold = "+(this||t).constructor.staleThreshold+" s");(this||t).reconnectAttempts++;if(this.disconnectedRecently())return e.log("ConnectionMonitor skipping reopening recent disconnect");e.log("ConnectionMonitor reopening");return(this||t).connection.reopen()}};ConnectionMonitor.prototype.connectionIsStale=function(){var n;return i(null!=(n=(this||t).pingedAt)?n:(this||t).startedAt)>(this||t).constructor.staleThreshold};ConnectionMonitor.prototype.disconnectedRecently=function(){return(this||t).disconnectedAt&&i((this||t).disconnectedAt)<(this||t).constructor.staleThreshold};ConnectionMonitor.prototype.visibilityDidChange=function(){if("visible"===document.visibilityState)return setTimeout(function(t){return function(){if(t.connectionIsStale()||!t.connection.isOpen()){e.log("ConnectionMonitor reopening stale connection on visibilitychange. visbilityState = "+document.visibilityState);return t.connection.reopen()}}}(this||t),200)};o=function(){return(new Date).getTime()};i=function(t){return(o()-t)/1e3};n=function(t,n,o){return Math.max(n,Math.min(o,t))};return ConnectionMonitor}()}).call(this||t);(function(){var n,o,i,r,s,c=[].slice,bind=function(t,n){return function(){return t.apply(n,arguments)}},u=[].indexOf||function(n){for(var o=0,e=(this||t).length;o=0};Connection.prototype.isState=function(){var t,n;n=1<=arguments.length?c.call(arguments,0):[];return t=this.getState(),u.call(n,t)>=0};Connection.prototype.getState=function(){var n,o,e;for(o in WebSocket){e=WebSocket[o];if(e===(null!=(n=(this||t).webSocket)?n.readyState:void 0))return o.toLowerCase()}return null};Connection.prototype.installEventHandlers=function(){var n,o;for(n in(this||t).events){o=(this||t).events[n].bind(this||t);(this||t).webSocket["on"+n]=o}};Connection.prototype.uninstallEventHandlers=function(){var n;for(n in(this||t).events)(this||t).webSocket["on"+n]=function(){}};Connection.prototype.events={message:function(n){var e,i,r,s;if(this.isProtocolSupported()){r=JSON.parse(n.data),e=r.identifier,i=r.message,s=r.type;switch(s){case o.welcome:(this||t).monitor.recordConnect();return(this||t).subscriptions.reload();case o.ping:return(this||t).monitor.recordPing();case o.confirmation:return(this||t).subscriptions.notify(e,"connected");case o.rejection:return(this||t).subscriptions.reject(e);default:return(this||t).subscriptions.notify(e,"received",i)}}},open:function(){e.log("WebSocket onopen event, using '"+this.getProtocol()+"' subprotocol");(this||t).disconnected=false;if(!this.isProtocolSupported()){e.log("Protocol is unsupported. Stopping monitor and disconnecting.");return this.close({allowReconnect:false})}},close:function(n){e.log("WebSocket onclose event");if(!(this||t).disconnected){(this||t).disconnected=true;(this||t).monitor.recordDisconnect();return(this||t).subscriptions.notifyAll("disconnected",{willAttemptReconnect:(this||t).monitor.isRunning()})}},error:function(){return e.log("WebSocket onerror event")}};return Connection}()}).call(this||t);(function(){var n=[].slice;e.Subscriptions=function(){function Subscriptions(n){(this||t).consumer=n;(this||t).subscriptions=[]}Subscriptions.prototype.create=function(n,o){var i,r,s;i=n;r="object"===typeof i?i:{channel:i};s=new e.Subscription((this||t).consumer,r,o);return this.add(s)};Subscriptions.prototype.add=function(n){(this||t).subscriptions.push(n);(this||t).consumer.ensureActiveConnection();this.notify(n,"initialized");this.sendCommand(n,"subscribe");return n};Subscriptions.prototype.remove=function(t){this.forget(t);this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe");return t};Subscriptions.prototype.reject=function(t){var n,o,e,i,r;e=this.findAll(t);i=[];for(n=0,o=e.length;n