{"version":3,"sources":["src/angular-websocket.js"],"names":["$WebSocketProvider","$rootScope","$q","$timeout","$websocketBackend","$WebSocket","url","protocols","options","isObject","isArray","undefined","this","ssl","test","scope","rootScopeFailover","useApplyAsync","initialTimeout","maxTimeout","reconnectIfNotNormalClose","_reconnectAttempts","sendQueue","onOpenCallbacks","onMessageCallbacks","onErrorCallbacks","onCloseCallbacks","objectFreeze","_readyStateConstants","_connect","_setInternalState","prototype","CONNECTING","OPEN","CLOSING","CLOSED","RECONNECT_ABORTED","_normalCloseCode","_reconnectableStatusCodes","safeDigest","autoApply","$$phase","$digest","bindToScope","self","$on","force","socket","readyState","create","onmessage","angular","bind","_onMessageHandler","onopen","_onOpenHandler","onerror","_onErrorHandler","onclose","_onCloseHandler","fireQueue","length","data","shift","send","isString","message","JSON","stringify","deferred","resolve","notifyOpenCallbacks","event","i","call","notifyCloseCallbacks","notifyErrorCallbacks","onOpen","cb","push","onClose","onError","onMessage","callback","isFunction","Error","isDefined","filter","RegExp","fn","pattern","code","indexOf","reconnect","applyAsyncOrDigest","args","arraySlice","arguments","$applyAsync","apply","currentCallback","exec","close","bufferedAmount","cancelableify","promise","cancel","then","newPromise","reason","splice","reject","defer","isMocked","isConnected","mockSend","backoffDelay","_getBackoffDelay","backoffDelaySeconds","console","log","attempt","R","Math","random","T","F","N","M","floor","min","pow","state","objectDefineProperty","_internalConnectionState","forEach","pending","get","set","$WebSocketBackendProvider","$window","$log","Socket","ws","match","exports","require","Client","client","e","WebSocket","MozWebSocket","createWebSocketBackend","warn","noop","Object","freeze","defineProperty","Array","slice","elt","len","from","Number","ceil","module","factory","service","define"],"mappings":"CAAC,WACC,YA8BA,SAASA,GAAmBC,EAAYC,EAAIC,EAAUC,GAEpD,QAASC,GAAWC,EAAKC,EAAWC,GAC7BA,IAAWC,EAASF,IAAeG,EAAQH,KAC9CC,EAAUD,EACVA,EAAYI,QAGdC,KAAKL,UAAYA,EACjBK,KAAKN,IAAMA,GAAO,cAClBM,KAAKC,IA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