1!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="1837541f-4172-4b97-8056-c84e1e7e8758",t._sentryDebugIdIdentifier="sentry-dbid-1837541f-4172-4b97-8056-c84e1e7e8758")}catch(t){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5781],{95781:function(t,e,n){n.d(e,{ActionCableClient:function(){return k}});var i={logger:"undefined"!=typeof console?console:void 0,WebSocket:"undefined"!=typeof WebSocket?WebSocket:void 0},s={log(...t){this.enabled&&(t.push(Date.now()),i.logger.log("[ActionCable]",...t))}};let o=()=>(new Date).getTime(),r=t=>(o()-t)/1e3;class c{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=o(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),s.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=o(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),s.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=o()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,s.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=o(),s.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor;return 1e3*t*Math.pow(1+e,Math.min(this.reconnectAttempts,10))*(1+(0===this.reconnectAttempts?1:e)*Math.random())}reconnectIfStale(){this.connectionIsStale()&&(s.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${r(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?s.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${r(this.disconnectedAt)} s`):(s.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return r(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&r(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){"visible"===document.visibilityState&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(s.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}}c.staleThreshold=6,c.reconnectionBackoffRate=.15;var l={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]};let{message_types:u,protocols:a}=l,h=a.slice(0,a.length-1),d=[].indexOf;class p{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new c(this),this.disconnected=!0}send(t){return!!this.isOpen()&&(this.webSocket.send(JSON.stringify(t)),!0)}open(){if(this.isActive())return s.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let t=[...a,...this.consumer.subprotocols||[]];return s.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new i.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(s.log(`Reopening WebSocket, current state is ${this.get
1State()}`),!this.isActive())return this.open();try{return this.close()}catch(t){s.log("Failed to reopen WebSocket",t)}finally{s.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return d.call(h,this.getProtocol())>=0}isState(...t){return d.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in i.WebSocket)if(i.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}}p.reopenDelay=500,p.prototype.events={message(t){if(!this.isProtocolSupported())return;let{identifier:e,message:n,reason:i,reconnect:o,type:r}=JSON.parse(t.data);switch(this.monitor.recordMessage(),r){case u.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case u.disconnect:return s.log(`Disconnecting. Reason: ${i}`),this.close({allowReconnect:o});case u.ping:return null;case u.confirmation:if(this.subscriptions.confirmSubscription(e),this.reconnectAttempted)return this.reconnectAttempted=!1,this.subscriptions.notify(e,"connected",{reconnected:!0});return this.subscriptions.notify(e,"connected",{reconnected:!1});case u.rejection:return this.subscriptions.reject(e);default:return this.subscriptions.notify(e,"received",n)}},open(){if(s.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return s.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(t){if(s.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){s.log("WebSocket onerror event")}};let b=function(t,e){if(null!=e)for(let n in e){let i=e[n];t[n]=i}return t};class g{constructor(t,e={},n){this.consumer=t,this.identifier=JSON.stringify(e),b(this,n)}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}class f{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){-1==this.pendingSubscriptions.indexOf(t)?(s.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):s.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){s.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==t)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&"function"==typeof this.subscriptions.subscribe&&this.pendingSubscriptions.map(t=>{s.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)})},500)}}class m{constructor(t){this.consumer=t,this.guarantor=new f(this),this.subscriptions=[]}create(t,e){let n=new g(this.consumer,"object"==typeof t?t:{channel:t},e);return this.add(n)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(t=>(this.forget(t),this.notify(t,"rejected"),t))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(n=>this.notify(n,t,...e))}notify(t,e,...n){return("string"==typeof t?this.findAll(t):[t]).map(t=>"function"==typeof t[e]?t[e](...n):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){s.log(`Subscription confirmed ${t}`),this.findAll(t).map(t=>this.guarantor.forget(t))}sendCommand(t,e){let{identifier:n}=t;return this.consumer.send({command:e,identifier:n})}}class S{constructor(t){this._url=t,this.subscriptions=new m(this),this.connection=new p(this),this.subprotocols=[]}get url(){return function(t){if("function"==typeof t&&(t=t()),!t||/^wss?:/i.test(t))return t;{let e=document.createElement("a");return e.href=t,e.href=e.href,e.protocol=e.protocol.replace("http","ws"),e.href}}(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t]}}var v=n(69090),y=n(79119),A=n(96010);let w=t=>{var e,n;let i=JSON.stringify({name:t.operationName,query:null!==(e=t.query)&&void 0!==e?e:"",variables:null!==(n=t.variables)&&void 0!==n?n:{}}),s=0;for(let t=0;t<i.length;t++)s=(s<<5)-s+i.charCodeAt(t)|0;return s.toString(16)};class k{async disconnectConsumerAndCleanup(){this.activeSubscriptions.forEach(t=>{t.unsubscribe()}),this.activeSubscriptions.clear(),this.consumer.disconnect()}onOperationRequest(t){return new v.y(e=>{let n=w(t),i=this.actionName,s=t.operationName;if(this.activeSubscriptions.has(n))return e.error(Error("Duplicate subscription attempt")),()=>{};let o=this.consumer.subscriptions.create({channel:this.channelName,...this.connectionParams,channelId:n},{connected:function(){var e;this.perform(i,{operationName:s,variables:t.variables,query:null!==(e=t.query)&&void 0!==e?e:null})},received:function(t){let{result:n,more:i}=t;(n.data||n.errors)&&(n.data&&(n.data=(0,A.k)(n.data)),e.next(n)),i||this.unsubscribe()},disconnected:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];C("Subscription disconnected",...e)},unsubscribe:function(){e.complete()}});return this.activeSubscriptions.set(n,o),()=>{this.activeSubscriptions.get(n)===o&&(o.unsubscribe(),this.activeSubscriptions.delete(n))}})}constructor({authToken:t,endpointUrl:e,connectionParams:n={},actionName:i="execute",channelName:o="GraphqlChannel"}){let r="".concat(e,"/cable?token=").concat(t);this.consumer=function(t=function(t){let e=document.head.querySelector("meta[name='action-cable-url']");if(e)return e.getAttribute("content")}(0)||l.default_mount_path){return new S(t)}(r),this.currentAuthToken=t,this.endpointUrl=e,this.channelName=o,this.actionName=i,this.connectionParams=n,this.activeSubscriptions=new Map,s.enabled=!0}}let C=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];let{isProdEnv:i}=(0,y.i)();i||console.log(...e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.