samvyo-js-sdk 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /*
2
- * samvyo-js-sdk v2.0.3
2
+ * samvyo-js-sdk v2.0.4
3
3
  * This is the client js sdk for cutting-edge Samvyo real-time voice/video cloud.
4
4
  * Copyright: 2017-2025 sauravkp <saurav.codes@gmail.com>
5
5
  * License: Unlicensed
6
6
  */
7
7
 
8
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).samvyo=e()}}((function(){var define,module,exports;return function e(t,r,i){function n(s,o){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!o&&c)return c(s,!0);if(a)return a(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){return n(t[s][1][e]||e)}),u,u.exports,e,t,r,i)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(e,t,r){"use strict";var i=e("./lib/JsSdk_v1"),n=e("./lib/JsSdk"),a=e("./p2p/lib/P2pSdk");t.exports={JsSdk_v1:i.JsSdk_v1,JsSdk:n.JsSdk,P2pSdk:a.P2pSdk}},{"./lib/JsSdk":2,"./lib/JsSdk_v1":3,"./p2p/lib/P2pSdk":318}],2:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.JsSdk=void 0;var a=i(e("@babel/runtime/helpers/typeof")),s=i(e("@babel/runtime/helpers/objectWithoutProperties")),o=i(e("@babel/runtime/regenerator")),c=i(e("@babel/runtime/helpers/asyncToGenerator")),d=i(e("@babel/runtime/helpers/classCallCheck")),u=i(e("@babel/runtime/helpers/createClass")),l=i(e("@babel/runtime/helpers/possibleConstructorReturn")),h=i(e("@babel/runtime/helpers/getPrototypeOf")),f=i(e("@babel/runtime/helpers/inherits")),p=i(e("@babel/runtime/helpers/defineProperty")),m=D(e("mediasoup-client")),b=i(e("bowser")),g=e("./socket"),v=e("events"),y=i(e("./Logger")),_=e("./utils/queue"),w=e("./utils/sleep"),S=e("./utils/getRandomInt"),k=e("./utils/uuidv4"),R=(e("./utils/getVidScaleUrl"),e("./utils/verifyOutputQualites")),P=i(e("./utils/randomName")),M=e("./utils/chooseMedia"),E=D(e("jsonwebtoken")),x=(e("./utils/getUSerMediaConstraints"),e("./utils/constants")),T=e("./utils/verifyfileTypes"),C=["senderPeerId","mediaTag","sender","audioStatus","videoStatus","senderParticipantType","type","producerPaused"];function I(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(I=function(e){return e?r:t})(e)}function D(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=n(e)&&"function"!=typeof e)return{default:e};var r=I(t);if(r&&r.has(e))return r.get(e);var i={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var o=a?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,r&&r.set(e,i),i}function O(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return A(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?A(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){(0,p.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function B(e,t,r){return t=(0,h.default)(t),(0,l.default)(e,N()?Reflect.construct(t,r||[],(0,h.default)(e).constructor):t.apply(e,r))}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(N=function(){return!!e})()}var F,U=new y.default("Room"),q={small:{width:{ideal:160},height:{ideal:120}},qvga:{width:{ideal:320},height:{ideal:240}},vga:{width:{ideal:640},height:{ideal:480}},hd:{width:{ideal:1280},height:{ideal:720}}},z=new _.SocketQueue;r.JsSdk=function(e){function t(e){var r,i=e.peerId,n=e.roomId,a=e.outputData;return(0,d.default)(this,t),r=B(this,t),(0,p.default)(r,"joinRoom",(0,c.default)(o.default.mark((function e(){var t,i,n,a,s,c,d,u,l,h,f,p,m,b,g,v,y,_,w,S,k,R,M,E,T,C,I,D,O,A,L,B,N,F,q,z,V,G,W,H,K,$,J,Y,X,Z,Q,ee,te,re,ie,ne,ae,se,oe,ce,de,ue,le,he,fe,pe,me,be,ge,ve,ye=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(t=ye.length>0&&void 0!==ye[0]?ye[0]:{}).peerName,n=void 0===i?null:i,a=t.produce,s=void 0===a||a,c=t.produceAudio,d=void 0===c||c,u=t.produceVideo,l=void 0===u||u,h=t.consume,f=void 0===h||h,p=t.videoResolution,m=void 0===p?"hd":p,b=t.forceVp8,g=void 0!==b&&b,v=t.forceVp9,y=void 0!==v&&v,_=t.forceH264,w=void 0!==_&&_,S=t.h264Profile,k=void 0===S?"high":S,R=t.forcePCMU,M=void 0!==R&&R,E=t.forcePCMA,T=void 0!==E&&E,C=t.forceFPS,I=void 0===C?25:C,D=t.enableWebcamLayers,O=void 0===D||D,A=t.numSimulcastStreams,L=void 0===A?3:A,B=t.autoGainControl,N=void 0===B||B,F=t.echoCancellation,q=void 0===F||F,z=t.noiseSuppression,V=void 0===z||z,G=t.sampleRate,W=void 0===G?44e3:G,H=t.channelCount,K=void 0===H?1:H,$=t.videoBitRates,J=void 0===$?[700,250,75]:$,Y=t.share,X=void 0!==Y&&Y,Z=t.shareAudio,Q=void 0!==Z&&Z,ee=t.enableSharingLayers,te=void 0===ee||ee,re=t.shareBitRates,ie=void 0===re?[2500,1250,500]:re,ne=t.audioDeviceId,ae=void 0===ne?null:ne,se=t.videoDeviceId,oe=void 0===se?null:se,ce=t.peerType,de=void 0===ce?"participant":ce,ue=t.roomType,le=void 0===ue?x._security.roomType.CONFERENCING:ue,he=t.authenticationRequired,fe=void 0!==he&&he,pe=t.password,me=void 0===pe?null:pe,be=t.roomDisplayName,ge=void 0===be?null:be,U.info("Going to join room"),["hd","vga","qvga"].includes(m)||(U.warn("Invalid video resolution value. setting it to default value of 'hd' "),m="hd"),"boolean"!=typeof s&&(U.warn("Produe should either be true or false"),s=Boolean(s)),"boolean"!=typeof d&&(U.warn("ProduceAudio should either be true or false"),d=Boolean(d)),"boolean"!=typeof l&&(U.warn("ProduceVideo should either be true or false"),l=Boolean(l)),"boolean"!=typeof f&&(U.warn("Consume should either be true or false"),f=Boolean(f)),"boolean"!=typeof g&&(U.warn("forceVp8 should either be true or false"),g=Boolean(g)),"boolean"!=typeof y&&(U.warn("forceVp9 should either be true or false"),y=Boolean(y)),"boolean"!=typeof w&&(U.warn("forceH264 should either be true or false"),w=Boolean(w)),["high","low"].includes(k.toLowerCase())||(U.warn("h264Profile should either be 'high' or 'low'"),k="high"),(!Number.isInteger(I)||Number.isInteger(I)&&(I>65||I<5))&&(U.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),I=25),"boolean"!=typeof O&&(U.warn("enableWebcamLayers should either be true or false"),O=Boolean(O)),(!Number.isInteger(L)||Number.isInteger(L)&&(L>3||L<1))&&(U.warn("numSimulcastStreams should be a number between 1 to 3, default value is 3."),L=3),Array.isArray(J)&&J.length>=1&&J.length<=3&&J.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?U.debug("videoBitRates values are correct"):(U.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[700,250,75]'"),J=[700,250,75]),"boolean"!=typeof M&&(U.warn("forcePCMU should either be true or false"),M=Boolean(M)),"boolean"!=typeof T&&(U.warn("forcePCMA should either be true or false"),T=Boolean(T)),"boolean"!=typeof N&&(U.warn("autoGainControl should either be true or false"),N=Boolean(N)),"boolean"!=typeof q&&(U.warn("echoCancellation should either be true or false"),q=Boolean(q)),"boolean"!=typeof V&&(U.warn("noiseSuppression should either be true or false"),V=Boolean(V)),(!Number.isInteger(W)||Number.isInteger(W)&&(W>64e3||W<8e3))&&(U.warn("sampleRate should be a number between 8000 to 64000, default value is 44000 Khz."),W=44e3),(!Number.isInteger(K)||Number.isInteger(K)&&(K>2||K<1))&&(U.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),K=1),"boolean"!=typeof X&&(U.warn("share should either be true or false"),X=Boolean(X)),"boolean"!=typeof Q&&(U.warn("shareAudio should either be true or false"),Q=Boolean(Q)),"boolean"!=typeof te&&(U.warn("enableSharingLayers should either be true or false"),te=Boolean(te)),Array.isArray(ie)&&ie.length>=1&&ie.length<=3&&ie.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?U.debug("shareBitRates values are correct"):(U.warn("sharebitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[2500,1250,500]'"),ie=[2500,1250,500]),["moderator","participant","attendee"].includes(de)?U.debug("peerType is valid:%s",de):(de="participant",U.debug("peerType is invalid:%s. By default set to: participant",de)),e.next=29,r.listDevicesInternal();case 29:r._videoResolution=m,r._forceVP8=Boolean(g),r._forceH264=Boolean(w),r._forceVP9=Boolean(y),r._enableWebcamLayers=Boolean(O),r._numSimulcastStreams=L,r._enableSharingLayers=Boolean(te),e.prev=36,n||(n=(0,P.default)()),r.data.inputParams=j(j({},r.data.inputParams),{},{peerName:n,produce:s,produceAudio:d,produceVideo:l,consume:f,videoResolution:m,forceVp8:g,forceVp9:y,forceH264:w,h264Profile:k,forceFPS:I,forcePCMU:M,forcePCMA:T,enableWebcamLayers:O,numSimulcastStreams:L,autoGainControl:N,echoCancellation:q,noiseSuppression:V,sampleRate:W,channelCount:K,videoBitRates:J,share:X,shareAudio:Q,enableSharingLayers:te,shareBitRates:ie,audioDeviceId:ae,videoDeviceId:oe,peerType:de,roomType:le,authenticationRequired:fe,password:me,roomDisplayName:ge}),U.info("input params are:%O",r.data.inputParams),ve={id:"joinRoom",type:"r",peerId:r.data.inputParams.peerId,participantType:"attendee"===de?"viewer":de,roomType:le,roomDisplayName:ge||"room-".concat(1e5+Math.round(9e5*Math.random())),browser:r._client,name:r.data.inputParams.peerName,room:r.data.inputParams.roomId,authenticationRequired:fe,isRoomPassword:!!me,roomPassword:me||null,usageType:"sdk"},r._sendMessage(ve),e.next=48;break;case 44:return e.prev=44,e.t0=e.catch(36),U.error("Failed to join room:",e.t0.message),e.abrupt("return",{success:!1,reason:e.t0.message});case 48:case"end":return e.stop()}}),e,null,[[36,44]])})))),(0,p.default)(r,"authenticateUser",(function(e){U.info("Moderator authentication requested:%O",e),r.emit("moderatorAuthentication",{moderatorName:e.moderatorName,requesterName:e.requesterName,requesterPeerId:e.requesterPeerId,text:e.title})})),(0,p.default)(r,"authenticationRequested",(function(e){U.info("Moderator authentication requested:%O",e),r.emit("authenticationRequested",{requesterName:e.requesterName,requesterPeerId:r.data.inputParams.peerId,text:e.title})})),(0,p.default)(r,"allowRoomJoin",(function(e){if(!e)return U.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};U.info("Allow user to join room:%O",e);var t={id:"userAuthenticated",peerId:e,roomName:r.data.inputParams.roomId,moderator:r.data.inputParams.peerId};r._sendMessage(t)})),(0,p.default)(r,"denyRoomJoin",(function(e){if(!e)return U.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};U.info("Deny user to join room:%O",e);var t={id:"userDenied",peerId:e,roomName:r.data.inputParams.roomId,moderator:r.data.inputParams.peerId};r._sendMessage(t)})),(0,p.default)(r,"hideUserAuthenticationDialog",(function(e){U.debug("authentication already done message:%o",e),r.emit("moderatorAuthStatus",{requesterId:e.requesterId,moderatorActed:e.peerId})})),(0,p.default)(r,"_createSendTransport",(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Room _createSendTransport"),e.prev=1,r._device.loaded){e.next=6;break}return U.debug("Room _createSendTransport","Going to load device with routerrtpcapabilities"),e.next=6,r._device.load({routerRtpCapabilities:r._routerRtpCapabilities});case 6:t=x.MSG_DIRECTION_SEND,r._sendTransport||r._sendMessage({id:"createTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,direction:t}),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),U.error("Room _createSendTransport",e.t0);case 13:case"end":return e.stop()}}),e,null,[[1,10]])})))),(0,p.default)(r,"_createRecvTransport",(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r._device.loaded){e.next=4;break}return U.debug("loading device for creating recv transport"),e.next=4,r._device.load({routerRtpCapabilities:r._routerRtpCapabilities});case 4:t=x.MSG_DIRECTION_RECV,r._recvTransport||(U.debug("receive transport created"),r._sendMessage({id:"createTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,direction:t}));case 6:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"handleCreateTransportRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var i,n,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Room handleCreateTransportRequest():%O",t),i=t.transportOptions,n=t.direction,a=void 0,e.prev=3,"recv"!==n){e.next=13;break}return e.next=7,r._device.createRecvTransport(i);case 7:a=e.sent,U.debug("Room","handleCreateTransportRequest() recv transport created ".concat(a.id)),r._recvTransport=a,r.handleRecvTransportListeners(),e.next=24;break;case 13:if("send"!==n){e.next=23;break}return e.next=16,r._device.createSendTransport(i);case 16:a=e.sent,U.debug("Room","handleCreateTransportRequest() send transport created [id:%s]".concat(a.id)),r._sendTransport=a,r.handleSendTransportListeners(),r.produceMedia(),e.next=24;break;case 23:throw new Error("bad transport 'direction': ".concat(n));case 24:e.next=29;break;case 26:e.prev=26,e.t0=e.catch(3),console.error("handleCreateTransportRequest() failed to create transport [error:%o]",e.t0);case 29:case"end":return e.stop()}}),e,null,[[3,26]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleSendTransportListeners",(function(){r._sendTransport.on("connect",r.handleTransportConnectEvent),r._sendTransport.on("produce",r.handleTransportProduceEvent);var e=r;r._sendTransport.on("connectionstatechange",function(){var t=(0,c.default)(o.default.mark((function t(i){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(U.debug("ConferenceRoom sendTransport connectionState ".concat(i," & socketconnection state ").concat(r._socket._ws.readyState)),"failed"!==i&&"disconnected"!==i){t.next=13;break}if(1!==r._socket._ws.readyState){t.next=6;break}e.restartIce(r._sendTransport.id,"send"),t.next=13;break;case 6:if(1===r._socket._ws.readyState){t.next=12;break}return U.debug("socket not yet ready with state- ".concat(r._socket._ws.readyState)),t.next=10,(0,w.sleep)(1500);case 10:t.next=6;break;case 12:"connected"===r._roomStatus&&r.restartIce(r._sendTransport.id,"send");case 13:U.debug("ConferenceRoom","send transport connection state change [state:%s]".concat(i));case 14:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())})),(0,p.default)(r,"handleTransportConnectEvent",(function(e,t,i){var n=e.dtlsParameters;try{z.push("connectTransport",(function(e){U.debug("connect-transport action"),t(),z.remove("connectTransport")}));var a={id:"connectTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,transportId:r._sendTransport.id,dtlsParameters:n,direction:"send"};r._sendMessage(a)}catch(e){U.error("handleTransportConnectEvent() failed [error:%o]",e),i(e)}})),(0,p.default)(r,"handleTransportProduceEvent",(function(e,t,i){var n=e.kind,a=e.rtpParameters,s=e.appData;try{z.push("produce",(function(e){U.debug("handleTransportProduceEvent callback [data:%o]",e),t({id:e.producerId}),z.remove("produce")}));var o=s.mediaTag===x.STREAM_TYPE_CAM_AUDIO&&void 0!==r.data.inputParams.audioStatus&&!r.data.inputParams.audioStatus;U.debug("handleTransportProduceEvent() | pause status->".concat(o));var c={id:"sendTrack",transportId:r._sendTransport.id,peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,kind:n,rtpParameters:a,paused:o,appData:s,clientOs:r._client.os.name,browser:r._client.browser};r._sendMessage(c)}catch(e){U.error("handleTransportProduceEvent() failed [error:%o]",e),i(e)}})),(0,p.default)(r,"produceMedia",(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.data.inputParams.produce?(r.data.inputParams.produceAudio?r.enableMic({deviceId:r.data.inputParams.audioDeviceId?r.data.inputParams.audioDeviceId:null}):U.debug("No need to produce audio!"),r._device.canProduce("video")&&(r.data.inputParams.produceVideo?r.enableCam({deviceId:r.data.inputParams.videoDeviceId?r.data.inputParams.videoDeviceId:null}):U.debug("No need to produce video!"),r.data.inputParams.share&&r.enableShare({shareAudio:r.data.inputParams.shareAudio,enableSharingLayers:r._enableSharingLayers,shareBitRates:r.data.inputParams.shareBitRates}))):U.warn("produce is false!");case 1:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"handleRecvTransportListeners",(0,c.default)(o.default.mark((function e(){var t,i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r._recvTransport.on("connect",r.handleRecvTransportConnectEvent),t=r,r._recvTransport.on("connectionstatechange",function(){var e=(0,c.default)(o.default.mark((function e(i){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("ConferenceRoom recvTransport connectionState ".concat(i," & socketconnection state ").concat(r._socket._ws.readyState)),"failed"!==i&&"disconnected"!==i){e.next=13;break}if(1!==r._socket._ws.readyState){e.next=6;break}t.restartIce(r._recvTransport.id,"recv"),e.next=13;break;case 6:if(1===r._socket._ws.readyState){e.next=12;break}return U.debug("socket not yet ready with state- ".concat(r._socket._ws.readyState)),e.next=10,(0,w.sleep)(1e3);case 10:e.next=6;break;case 12:"connected"===r._roomStatus&&t.restartIce(r._recvTransport.id,"recv");case 13:U.debug("ConferenceRoom","Recv transport connection state change [state:%s]".concat(i));case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),i={id:"transportsAvailable",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,rtpCapabilities:r._device.rtpCapabilities},r._sendMessage(i);case 5:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"handleRecvTransportConnectEvent",(function(e,t,i){var n=e.dtlsParameters;try{z.push("connectRecvTransport",(function(e){U.debug("ConferenceRoom","connect-recv-transport action"),t(),z.remove("connectRecvTransport")}));var a={id:"connectTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,transportId:r._recvTransport.id,dtlsParameters:n,direction:"recv"};r._sendMessage(a)}catch(e){U.error("handleTransportConnectEvent() failed [error:%o]",e),i(e)}})),(0,p.default)(r,"handleRecvTrackRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var i,n,a,c,d,u,l,h,f,b;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Room handleRecvTrackRequest",t),r.data.inputParams.consume){e.next=4;break}return U.warn("I do not want to consume"),e.abrupt("return");case 4:return i=t.senderPeerId,n=t.mediaTag,t.sender,t.audioStatus,t.videoStatus,t.senderParticipantType,a=t.type,c=t.producerPaused,d=(0,s.default)(t,C),U.debug("New consumer created",d),d.id=d.consumerId,delete d.consumerId,U.debug("ConferenceRoom","senderPeerId is ->".concat(i)),e.next=11,r._recvTransport.consume(j(j({},d),{},{streamId:"".concat(i,"-").concat("screen-video"===n||"screen-audio"===n?"share":"mic-webcam"),appData:{peerId:i,mediaTag:n}}));case 11:u=e.sent;case 12:if(!r._recvTransport||"connected"===r._recvTransport.connectionState){e.next=18;break}return U.debug("recv transport connstate".concat(r._recvTransport.connectionState)),e.next=16,(0,w.sleep)(100);case 16:e.next=12;break;case 18:return r._consumers.set(u.id,u),u.on("transportclose",(function(){r._consumers.delete(u.id)})),l=m.parseScalabilityMode(u.rtpParameters.encodings[0].scalabilityMode),h=l.spatialLayers,f=l.temporalLayers,b=r._peers.get(r.data.inputParams.peerId),U.debug("Consumer created for sender peerId ".concat(i," for kind ").concat(u.kind," for receiver peerId ").concat(r.data.inputParams.peerId)),U.info("The old peer data is :%O",b),b?(b["screen-video"===n||"screen-audio"===n?"ss".concat(u.kind):u.kind]={consumerId:u.id,type:a,locallyPaused:!1,remotelyPaused:c,rtpParameters:u.rtpParameters,spatialLayers:h,temporalLayers:f,preferredSpatialLayer:h-1,preferredTemporalLayer:f-1,priority:1,codec:u.rtpParameters.codecs[0].mimeType.split("/")[1],track:u.track,share:"screen-video"===n||"screen-audio"===n},U.info("The new peer data is :%O",b),r._peers.set(r.data.inputParams.peerId,b)):(U.info("Peer not found!"),r._peers.set(r.data.inputParams.peerId,(0,p.default)({},"screen-video"===n||"screen-audio"===n?"ss".concat(u.kind):u.kind,{consumerId:u.id,type:a,locallyPaused:!1,remotelyPaused:c,rtpParameters:u.rtpParameters,spatialLayers:h,temporalLayers:f,preferredSpatialLayer:h-1,preferredTemporalLayer:f-1,priority:1,codec:u.rtpParameters.codecs[0].mimeType.split("/")[1],track:u.track,share:"screen-video"===n||"screen-audio"===n}))),e.next=27,r.resumeConsumer(u);case 27:U.debug("Going to emit mic start / videostart"),"audio"===u.kind?"screen-audio"===n?r.emit("ssAudioStart",{peerId:i,audioTrack:u.track,type:"remote"}):r.emit("micStart",{peerId:i,audioTrack:u.track,type:"remote"}):"video"===u.kind&&("screen-video"===n?r.emit("ssVideoStart",{peerId:i,videoTrack:u.track,type:"remote"}):r.emit("videoStart",{peerId:i,videoTrack:u.track,type:"remote"}));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"resumeConsumer",function(){var e=(0,c.default)(o.default.mark((function e(t){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=12;break}return U.debug("resume consumer",t.appData.peerId,t.appData.mediaTag),e.prev=2,i={id:"resumeConsumer",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,consumerId:t.id},r._sendMessage(i),e.next=7,t.resume();case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error(e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleConnectTransportRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("handleTransportConnectRequest()"),e.prev=1,r=z.get("connectTransport")){e.next=5;break}throw new Error("transport-connect action was not found");case 5:return e.next=7,r(t);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.error("handleTransportConnectRequest() failed [error:%o]",e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleConnectRecvTransportRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("handleTransportConnectRequest()"),e.prev=1,r=z.get("connectRecvTransport")){e.next=5;break}throw new Error("recv transport-connect action was not found");case 5:return e.next=7,r(t);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.error("handleRecvTransportConnectRequest() failed [error:%o]",e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleSendTrackRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("ConferenceRoom","handleProduceRequest()"),e.prev=1,r=z.get("produce")){e.next=5;break}throw new Error("produce action was not found");case 5:return e.next=7,r(t);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),U.error("handleProduceRequest() failed [error:%o]",e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"mediaToggled",(function(e){switch(U.debug("Media Toggled message:%O",e),e.type){case"video":U.debug("mediaToggled() | inside case video".concat(e.videoStatus));break;case"audio":U.debug("mediaToggled() | inside case audio".concat(e.videoStatus)),e.audioStatus?r.emit("peerUnMuted",{peerId:e.peerId,type:"remote"}):r.emit("peerMuted",{peerId:e.peerId,type:"remote"})}})),(0,p.default)(r,"closeConsumer",(function(e){var t=e.consumerId,i=r._consumers.get(t);if(i){var n=i.appData,a=n.peerId,s=n.mediaTag;U.debug("Consumer closed for consumerId:%s, type:%s, appData:%o",t,null==i?void 0:i.kind,i.appData);var o="screen-audio"===s||"screen-video"===s?"ss".concat(i.kind):i.kind;i.close(),r._consumers.delete(t);var c=r._peers.get(r.data.inputParams.peerId);U.debug("Peer data before deletion:%O",c),c[o]&&c[o].consumerId===t&&delete c[o],U.debug("Peer data after deletion:%O",c),r._peers.set(r.data.inputParams.peerId,c),"audio"===(null==i?void 0:i.kind)?(U.debug("Going to emit micEnd, consumer closed for audio"),"screen-audio"===s?r.emit("ssAudioStop",{peerId:a,track:null,type:"remote"}):r.emit("micEnd",{peerId:a,track:null,type:"remote"})):"video"===(null==i?void 0:i.kind)&&(U.debug("Going to emit videoEnd, consumer closed for video"),"screen-video"===s?r.emit("ssVideoStop",{peerId:a,track:null,type:"remote"}):r.emit("videoEnd",{peerId:a,track:null,type:"remote"}))}else U.warn("Consumer with id not found!:%s",t)})),(0,p.default)(r,"peerLeft",(function(e){U.debug("Peer Left message is:%o",e);var t=e.peerId;r._peers.delete(t),r.emit("peerLeft",{peerId:t})})),(0,p.default)(r,"roomClosed",(function(){U.info("room closed by Moderator"),r._peers=null,r.emit("roomClosed",{roomId:r.data.inputParams.roomId})})),(0,p.default)(r,"leaveRoomCommon",(function(){r._sendTransport&&(r._sendTransport.close(),r._sendTransport=null),r._recvTransport&&(r._recvTransport.close(),r._recvTransport=null),r._webCamStream&&r._webCamStream.getVideoTracks().forEach((function(e){e.stop(),U.debug("Video Track stopped")})),r._micStream&&r._micStream.getAudioTracks().forEach((function(e){e.stop(),U.debug("Mic Track stopped")})),r._roomStatus="closed",r._running=!1,r._routerRtpCapabilities=null})),(0,p.default)(r,"restartIce",function(){var e=(0,c.default)(o.default.mark((function e(t,i){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("send"===i&&"connected"===r._sendTransport.connectionState||"recv"===i&&"connected"===r._recvTransport.connectionState)){e.next=3;break}return U.debug("no need to restart ICE as transport now connected"),e.abrupt("return");case 3:U.debug("websocket is ready and connectionstate is still disconnected, therefore going to restart ICE"),n={id:"restartIce",transportId:t,roomName:r.data.inputParams.roomId,peerId:r.data.inputParams.peerId},r._sendMessage(n);case 6:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),(0,p.default)(r,"restartIceResponse",(function(e){U.debug("restart ICE response:%o",e);var t=e.transportId,i=e.iceParameters;r._sendTransport&&r._sendTransport.id===t?r._sendTransport.restartIce({iceParameters:i}):r._recvTransport&&r._recvTransport.id===t&&r._recvTransport.restartIce({iceParameters:i})})),(0,p.default)(r,"startRecording",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.recordingType,i=void 0===t?null:t,n=e.outputType,a=void 0===n?null:n,s=e.outputQualities,o=void 0===s?null:s;U.debug("recording type requested is:%s,outputType:%s, outputQualties:%o",i,a,o);var c=!i||"av"!==(null==i?void 0:i.toLowerCase())&&"audiovideo"!==(null==i?void 0:i.toLowerCase())?x.MERGEA:x.MERGE;if((!a||"hls"!==a.toLowerCase()&&"mp4"!==a.toLowerCase())&&a)return U.error("Invalid outut type"),{success:!1,reason:"Invalid outputType: ".concat(a,". ")};if(a&&"hls"===a.toLowerCase()&&o&&!(0,R.isValidOutputQualities)(o))return U.error("Invalid outut qualities"),{success:!1,reason:"Invalid outputQualities: ".concat(JSON.stringify(o),". ")+"Allowed values are ".concat(Array.from(R.ALLOWED_QUALITIES).join(", "),".")};var d={id:"startRecording",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,url:window.location.hostname,type:x.RECORD,recordingStrategy:c,outputQualities:o,outputType:null==a?void 0:a.toLowerCase()};r._sendMessage(d),r._recordingStartedByMe=j(j({},r._recordingStartedByMe),{},{"main-room":{recordingNo:null}})})),(0,p.default)(r,"stopRecording",(function(){U.debug("going to stop recording for recordingStartedByMe:%o",r._recordingStartedByMe);var e="main-room";if(!r._recordingStartedByMe[e])return{success:!1,error:!0,code:"RRID001",text:"Error while trying to stop recording. Either the recording has not been started yet Or The same user need to stop recording who started it."};var t={id:"stopRecording",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,recordingNo:r._recordingStartedByMe[e].recordingNo,type:x.RECORD};r._sendMessage(t),delete r._recordingStartedByMe[e],r.emit("recordingEnded",{peerId:r.data.inputParams.peerId})})),(0,p.default)(r,"setRecordingStatusStarted",(function(e){U.debug("Recording/Streaming started by moderator!!:%O",e);e.breakOutRoom;var t=e.recordingStartTime,i=e.recordingNo,n=e.type;[x.RECORD,x.RTMPSTREAMANDRECORD].includes(n)&&(r._recordingStartedByMe["main-room"]?(U.debug("This recording has been started by me."),r._recordingStartedByMe["main-room"].recordingNo=i,r.emit("recordingStarted",{peerId:r.data.inputParams.peerId,startTime:t})):r.emit("recordingStarted",{startTime:t}))})),(0,p.default)(r,"setRecordingStatusEnded",(function(e){U.debug("Recording ended by moderator!!, data:%O",e);e.breakOutRoom;e.type===x.RTMPSTREAM||r.emit("recordingEnded",{})})),(0,p.default)(r,"startProcessing",(0,c.default)(o.default.mark((function e(){var t,i,n,a,s,c,d,u,l,h,f,m,b,g,v,y,_,w,S,k=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(t=k.length>0&&void 0!==k[0]?k[0]:{}).inputFiles,n=void 0===i?[]:i,a=t.outputQualities,s=void 0===a?null:a,c=t.bucket,d=void 0===c?null:c,u=t.cloud,l=void 0===u?null:u,h=t.region,f=void 0===h?null:h,U.debug("Processing of Files requested for:%o",n),m=Math.round(1e7*Math.random()),e.next=5,(0,T.verifyFiles)(n);case 5:if(!(b=e.sent).success){e.next=18;break}if(!s||(0,R.isValidOutputQualities)(s)){e.next=10;break}return U.error("Invalid outut qualities"),e.abrupt("return",{success:!1,reason:"Invalid outputQualities: ".concat(JSON.stringify(s),". ")+"Allowed values are ".concat(Array.from(R.ALLOWED_QUALITIES).join(", "),".")});case 10:r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},m,{})),g=O(n);try{for(g.s();!(v=g.n()).done;)y=v.value,_=y.type,w=y.url,r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},m,j(j({},r._processingStartedByMe[m]),{},(0,p.default)({},w,{type:_,url:w,status:"pending"}))))}catch(e){g.e(e)}finally{g.f()}return S={id:"processVideos",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,inputFiles:n,outputQualities:s,bucket:d,cloud:l,region:f,requestId:m,type:x.PROCESS},r._sendMessage(S),e.abrupt("return",{success:!0});case 18:return e.abrupt("return",b);case 19:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"checkProcessingStatus",(function(e){var t=e.requestId;return U.debug("Going to check processing status for request Id:%s",t),r._processingStartedByMe[t]?{success:!0,details:r._processingStartedByMe[t]}:{success:!0,details:r._processingStartedByMe}})),(0,p.default)(r,"handleProcessingStart",(function(e){var t=e.processingStartTime,i=(e.processingNo,e.requestId);U.debug("handleProcessingStart()| received message is:%o",e),r.emit("processingStarted",{processingStartTime:t,requestId:i})})),(0,p.default)(r,"handleProcessingCompletion",(function(e){var t=e.totalProcessingTime,i=e.hlsfileKey,n=e.size,a=e.originalFile,s=e.lastFile,o=e.requestId;if(U.debug("handleProcessingCompletion()| received message is:%o",e),U.debug("Before update, Total files to be processed are:%o",r._processingStartedByMe),r._processingStartedByMe[a]&&(r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},o,j(j({},r._processingStartedByMe[o]),{},(0,p.default)({},a,j(j({},r._processingStartedByMe[a]),{},{status:"completed",hlsfileKey:i,size:n,totalProcessingTime:t})))))),U.debug("After update, Total files to be processed are:%o",r._processingStartedByMe),r.emit("processingCompleted",e),s){U.debug("The last file processing has been completed! Remove all the files that has been completed with the same requesterId");var c=j({},r._processingStartedByMe);delete c[o],U.debug("After deleting the current requestId:%o",c),r._processingStartedByMe=c}})),(0,p.default)(r,"handleProcessingError",(function(e){var t=e.totalProcessingTime,i=e.hlsfileKey,n=e.size,a=e.originalFile,s=(e.lastFile,e.requestId),o=e.error;U.debug("handleProcessingCompletion()| received message is:%o",e),U.debug("Before update, Total files to be processed are:%o",r._processingStartedByMe),r._processingStartedByMe[a]&&(r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},s,j(j({},r._processingStartedByMe[s]),{},(0,p.default)({},a,j(j({},r._processingStartedByMe[a]),{},{status:"error",hlsfileKey:i,size:n,totalProcessingTime:t,error:o})))))),U.debug("After update, Total files to be processed are:%o",r._processingStartedByMe),r.emit("processingError",e)})),r._closed=!1,r._roomStatus="initialised",r._roomDisplayName=null,r._running=!1,r._cignal=null,r._socket=null,r._sendTransport=null,r._recvTransport=null,r._device=new m.Device,r._webCamProducer=null,r._micProducer=null,r._shareProducer=null,r._shareAudioProducer=null,r._producers=new Map,r._consumers=new Map,r._peers=new Map,r._data=j(j({},a),{},{inputParams:{peerId:i,roomId:n,roomType:"conferencing"}}),r._micStream=null,r._webCamStream=null,r._webcam={device:null,resolution:"hd"},r._mic={device:null},r._deviceList=F||null,r._externalVideo=null,r._externalVideoStream=null,r._forceVP8=!1,r._forceH264=!1,r._forceVP9=!1,r._enableWebcamLayers=!0,r._numSimulcastStreams=3,r._enableSharingLayers=!0,r._client=b.default.parse(window.navigator.userAgent),r._routerRtpCapabilities=null,r._recordingStartedByMe={},r._cignalConnected=!1,r._reconnectionInitiated=!1,r._restartIceInProgressSendTransport=!1,r._restartIceInProgressRecvTransport=!1,r._activeSpeaker=null,r.initLocal(),r}return(0,f.default)(t,e),(0,u.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("Setting the whole data object is not possible!")}},{key:"peers",get:function(){return this._peers},set:function(e){throw new Error("Setting the whole peers object is not possible!")}},{key:"transports",get:function(){return{produce:this._sendTransport,consume:this._recvTransport}},set:function(e){throw new Error("Setting of transport is not possible!")}},{key:"videoStream",get:function(){return this._webCamStream}},{key:"audioStream",get:function(){return this._micStream}},{key:"clientAgent",get:function(){return this._client}},{key:"activeParameters",get:function(){return this._data.inputParams}},{key:"deviceList",get:function(){return this._deviceList?this._deviceList:{videoDevices:[],audioDevices:[],audioOutputDevices:[]}},set:function(e){throw new Error("Setting of deviceList is not possible!")}},{key:"currentlyActiveSpeaker",get:function(){return this._activeSpeaker},set:function(e){throw new Error("Setting of currentActivespeaker is not possible!")}},{key:"roomDisplayName",get:function(){return this._roomDisplayName},set:function(e){throw new Error("Setting of roomDisplayName is not possible!")}},{key:"initLocal",value:(X=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=m.detectDevice(),U.debug("The device is:%O",t),e.next=4,this._initSocket();case 4:case"end":return e.stop()}}),e,this)}))),function(){return X.apply(this,arguments)})},{key:"_initSocket",value:(Y=(0,c.default)(o.default.mark((function e(){var t,r,i,n=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this,r=this.data.signallingServerUrl.replace(/^(http|https):\/\//,""),i="wss://".concat("".concat(r),"/?sessionToken=",this.data.sessionToken,"&roomId=").concat(this.data.inputParams.roomId,"&peerId=").concat(this.data.inputParams.peerId,"&roomType=").concat(this.data.inputParams.roomType),U.info("Going to create a new socket! with address: ".concat(r)),this._socket=new g.WebSocketTransport(i,!0),this._listenToSocket(),this._socket.on("notify",(function(e){var t=e.type,r=e.title,i=e.message;n.emit("notification",{eventType:t,eventText:"".concat(r,": ").concat(i),roomId:n.data.inputParams.roomId,peerId:n.data.inputParams.peerId})})),this._socket.on("roomStartedP2p",(function(e){U.info("P2P room successfully started"),n._running=!0})),this._socket.on("userError",(function(e){U.error("User Error happened with message:%O",e),t.emit("notification",{eventType:e.title,eventText:"".concat(e.text)})})),this._socket.on("validationAlert",(function(e){U.info("Validation alert happened")})),this._socket.on("alreadyActive",(function(e){e.title,e.text,n.emit("notification",{eventType:"alreadyActive",eventText:"This peer already has an active connection",roomId:n.data.inputParams.roomId,peerId:n.data.inputParams.peerId})})),this._socket.on("passwordDisabled",(function(){U.info("password disabled by moderator!"),n.emit("notification",{eventType:"passwordDisabled",eventText:"Password for this room has been disabled by moderator",roomId:n.data.inputParams.roomId})})),this._socket.on("close",(function(e){var t=e.code,r=e.reason;if(U.info("socket closed with code ".concat(t)),4500!==t&&4100!==t){var i=r||"Connection to server closed unexpectedly! Trying to reconnect.";U.info("socket close code is".concat(t," with reason ").concat(i))}else U.info("Socket is now closed!"),n.close()})),this._socket.on("connected",(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.info("Socket connected"),t.pc&&t._sendTransport&&t._recvTransport?roomType===x._security.roomType.P2P&&t.pc?(U.info("Socket seems to be reconnected in mid call! RestartIce needed for p2p call."),"failed"!==t.pc.iceConnectionState&&"disconnected"!==t.pc.iceConnectionState||t.restartICE()):(U.debug("Ice restarts for mediasoup transports for a joined peer"),t._sendTransport&&["Failed","disconnected"].includes(t._sendTransport.connectionState)?(U.debug("Restart ice for sendtransport"),t.restartIce(t._sendTransport.id,"send")):U.error("Send transport not available!"),t._recvTransport&&["Failed","disconnected"].includes(t._recvTransport.connectionState)?(U.debug("Restart ice for recvtransport"),t.restartIce(t._recvTransport.id,"recv")):U.error("Recv transport not available!")):(U.info("Connection getting connected for first time"),n.emit("initSuccess"));case 2:case"end":return e.stop()}}),e)})))),this._socket.on("defaultJoinStatus",function(){var e=(0,c.default)(o.default.mark((function e(t){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.info(" Socket defaultjoinstatus:%O",t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 15:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"_sendMessage",value:function(e){this._socket.send(j({usageType:"sdk"},e))}},{key:"_listenToSocket",value:function(){var e=this;this._socket.on("message",(function(t){try{switch("currentlyActiveSpeaker"===t.id||"allStats"===t.id||U.info("message in Room is:%O",t),t.id){case"chatMessage":e.processChatMessage(t);break;case"existingParticipants":e.onExistingParticipants(t);break;case"newPeerJoin":e.onNewPeer(t);break;case"recordingError":e.handleRecordingErrors(t);break;case"moderatorAuthentication":e.authenticateUser(t);break;case"authenticationRequested":e.authenticationRequested(t);break;case"toggleMyMic":e.toggleMyMic(t);break;case"toggleMyCamera":e.toggleMyCamera(t);break;case"logMeOut":e.logMeOutNew(t);break;case"userAlreadyAuthenticated":e.hideUserAuthenticationDialog(t);break;case"peerLeft":e.peerLeft(t);break;case"recordingStarted":e.setRecordingStatusStarted(t);break;case"recordingStopped":e.setRecordingStatusEnded(t);break;case"startDefaultRecording":e.startRecording(t);break;case"mediaToggled":e.mediaToggled(t);break;case"processingStarted":e.handleProcessingStart(t);break;case"processingCompleted":e.handleProcessingCompletion(t);break;case"processingError":e.handleProcessingError(t);break;case"createTransportResponse":e.handleCreateTransportRequest(t);break;case"connectTransportResponse":e.handleConnectTransportRequest(t);break;case"connectRecvTransportResponse":e.handleConnectRecvTransportRequest(t);break;case"sendTrackResponse":e.handleSendTrackRequest(t);break;case"recvTrackResponse":e.handleRecvTrackRequest(t);break;case"roomClosedByModerator":e.leaveRoomCommon(),e.roomClosed();break;case"currentlyActiveSpeaker":e.setCurrentlyActiveSpeaker(t);break;case"restartIceResponse":e.restartIceResponse(t);break;case"consumerClosed":e.closeConsumer(t);break;case"handRaise":e.handleHandRaise(t);break;case"upgradeParticipant":e.handleUpgradeParticipant(t);break;case"downgradeParticipant":e.handleDowngradeParticipant(t);break;case"switchMicOff":e.handleSwitchMicOff(t);break;case"screenShareLimitReached":e.handleScreenShareLimitReached(t);break;case"upgradeLimitReached":e.handleUpgradeLimitReached(t);break;case"modUpgradeReq":e.handleModUpgradeReq(t);break;case"lockUnlockRoom":e.handleLockUnlockRoom(t);break;case"peersWaiting":e.handlePeersWaiting(t);break;case"remotePeerJoin":e.handleRemotePeerJoin(t);break;case"offer":U.debug("inside offer"),e.handleOffer(t);break;case"answer":U.debug("inside answer"),e.handleAnswer(t);break;case"candidate":U.debug("inside handle candidate"),e.handleCandidate(t.candidate);break;case"p2pRoomClosed":U.debug("inside p2p room close"),e.leaveRoomNewP2p(x.ROOM_LEAVE_AND_CLOSE);break;case"p2pUserLeft":U.debug("inside p2p user left"),e.userLeftRoom(t);break;case"iceRestart":e.handleIceRestart(t);break;case"iceRestarted":e.handleIceRestartResponse(t);break;case"screenShareP2p":e.handleScreenShareP2p(t);break;default:U.warn("Unrecognized message:%o",t)}}catch(e){U.error("listentomessage:%O",e)}}))}},{key:"onNewPeer",value:function(e){var t=e.peerId,r=e.displayName,i=e.participantType;this._peers.set(t,{displayName:r,participantType:i,consumers:[]}),this.emit("newPeer",{peerId:t,peerName:r,type:this.data.inputParams.peerId===t?"local":"remote",peerRole:i})}},{key:"onExistingParticipants",value:(J=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Onexisting participant message:%O",t),this._routerRtpCapabilities=t.routerRtpCapabilities,this._roomStatus="connected",this._roomDisplayName=t.roomDisplayName,this._running=!0,this._socket._roomJoined=!0,this.emit("newPeer",{peerId:this.data.inputParams.peerId,peerName:this.data.inputParams.peerName,type:"local",peerRole:this.data.inputParams.peerType}),!this.data.inputParams.produce){e.next=12;break}return e.next=10,this._createSendTransport();case 10:e.next=13;break;case 12:U.debug("Produce is false!");case 13:if(!this.data.inputParams.consume){e.next=20;break}return e.next=16,this._createRecvTransport();case 16:r=this,t.peers&&t.peers.length>0&&t.peers.forEach((function(e){r.emit("newPeer",{peerId:e.peerId,peerName:e.name,type:"remote",peerRole:e.participantType})})),e.next=21;break;case 20:U.debug("Consume is false!");case 21:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"setCurrentlyActiveSpeaker",value:function(e){var t=e.activeSpeaker,r=t.peerId,i=t.volume;this._activeSpeaker=e.activeSpeaker,this.emit("activeSpeaker",{peerId:r,volume:i})}},{key:"close",value:function(){this._closed||(this._closed=!0,this._socket=null,this.data.inputParams={},U.info("Room close()"),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed",this._running=!1)}},{key:"leaveRoom",value:($=(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.debug("Leave room is called!!"),"connected"===this._roomStatus?(this._sendMessage({id:"leaveRoomNew",peerId:this.data.inputParams.peerId,roomLeaveType:"client"}),this.leaveRoomCommon()):U.error("The room state is:%s",this._roomStatus);case 2:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"closeRoom",value:(K=(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"connected"===this._roomStatus?(this._sendMessage({id:"leaveAndCloseRoom",peerId:this.data.inputParams.peerId,roomCloseType:"client"}),this.leaveRoomCommon()):U.error("The room state is:%s",this._roomStatus);case 1:case"end":return e.stop()}}),e,this)}))),function(){return K.apply(this,arguments)})},{key:"listDevicesInternal",value:(H=(0,c.default)(o.default.mark((function e(){var t,r=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices.ondevicechange=function(){var e=(0,c.default)(o.default.mark((function e(t){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,M.updatedDeviceList)();case 2:i=e.sent,U.info("Media devices changed!:%O",i),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioDevices=i.audioDevices),i.videoDevices&&i.videoDevices.length>0&&(r._deviceList.videoDevices=i.videoDevices),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioOutputDevices=i.audioDevicesOutput),F=r._deviceList,r.emit("deviceListUpdated");case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),!this._deviceList){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,(0,M.loadAllAvailableDevices)();case 7:if(!(t=e.sent).success){e.next=12;break}return this._deviceList=t.deviceList,F=this._deviceList,e.abrupt("return");case 12:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"enableMic",value:(W=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c,d,u,l,h,f,p=this,m=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=m.length>0&&void 0!==m[0]?m[0]:{}).deviceId,i=void 0===r?null:r,n=t.autoGainControl,a=t.noiseSuppression,s=t.echoCancellation,c=t.channelCount,d=t.sampleRate,u=t.forcePCMU,l=t.forcePCMA,U.debug("enableMic()"),this.data.inputParams.produce){e.next=7;break}return U.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID007",text:"Error while trying to start Mic/Audio. Produce flag need to set to true while joining room in order to enable Mic/Audio."});case 7:if("connected"===this._roomStatus){e.next=12;break}return U.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID008",text:"Error while trying to start Mic/Audio as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Mic? OR if you have already initiated the joinRoom process, then Mic will be enabled automatically once room join process completes."});case 12:if(!this._micProducer){e.next=17;break}return U.debug("Mic is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID002",text:"Error while trying to start Mic/Audio. Mic/Audio is already active!"});case 17:if(this._device.canProduce("audio")){e.next=20;break}return U.error("enableMic() | cannot produce audio"),e.abrupt("return",{success:!1,error:!0,code:"REID009",text:"Error while trying to start Mic/Audio. Mic/Audio couldnot be activated due to limitations on this device. If you think this device has a functional Mic and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:if(u&&"boolean"==typeof u&&(this.data.inputParams.forcePCMU=u),l&&"boolean"==typeof l&&(this.data.inputParams.forcePCMA=l),n&&"boolean"==typeof n&&(this.data.inputParams.autoGainControl=n),s&&"boolean"==typeof s&&(this.data.inputParams.echoCancellation=s),a&&"boolean"==typeof a&&(this.data.inputParams.noiseSuppression=a),d&&Number.isInteger(d)&&d<64e3&&d>8e3&&(this.data.inputParams.sampleRate=d),c&&Number.isInteger(c)&&c>0&&c<3&&(this.data.inputParams.channelCount=c),e.prev=27,this._externalVideo){e.next=48;break}if(i?(f=this._deviceList.audioDevices.find((function(e){return e.deviceId===i})))||(U.warn("Selected audio input deviceId:%s not found",i),f=this._deviceList.audioDevices[0]):f=this._deviceList.audioDevices[0],this._mic.device=f,f){e.next=34;break}return U.error("No mic device found! Can't start audio!"),e.abrupt("return",{success:!1,reason:"No mic available for starting audio!"});case 34:return i&&this.data.inputParams.audioDeviceId!==i&&(this.data.inputParams.audioDeviceId=i),U.debug("enableMic() | calling getUserMedia()"),e.prev=36,e.next=39,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:f.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 39:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0],e.next=46;break;case 43:throw e.prev=43,e.t0=e.catch(36),new Error("Error while acquiring mic. Possible issue with audio constraint values",e.t0);case 46:e.next=52;break;case 48:return e.next=50,this._getExternalVideoStream();case 50:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0].clone();case 52:return e.next=54,this._sendTransport.produce({track:h,codecOptions:this.data.inputParams.forcePCMU||this.data.inputParams.forcePCMA?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):this.data.inputParams.forcePCMA?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcma"===e.mimeType.toLowerCase()})):void 0,appData:{mediaTag:"cam-audio"}});case 54:this._micProducer=e.sent,this._producers.set("audio",{id:this._micProducer.id,paused:this._micProducer.paused,track:this._micProducer.track,rtpParameters:this._micProducer.rtpParameters,codec:this._micProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),this._micProducer.on("transportclose",(function(){p._micProducer=null})),this._micProducer.on("trackended",(function(){p.disableMic().catch((function(){}))})),e.next=66;break;case 61:e.prev=61,e.t1=e.catch(27),U.error("enableMic() | failed:%o",e.t1),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),h&&h.stop();case 66:case"end":return e.stop()}}),e,this,[[27,61],[36,43]])}))),function(){return W.apply(this,arguments)})},{key:"disableMic",value:(G=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micProducer){e.next=4;break}return e.abrupt("return");case 4:this._micProducer.close(),this._producers.delete("audio");try{t={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",producerId:this._micProducer.id},this._sendMessage(t),this.emit("micEnd",{peerId:this.data.inputParams.peerId,audioTrack:null,type:"local"})}catch(e){this.emit("error",{code:"EID003",text:"Error disabling microphone!"})}this._micProducer=null;case 8:case"end":return e.stop()}}),e,this)}))),function(){return G.apply(this,arguments)})},{key:"muteMic",value:(V=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.debug("muteMic()"),this._micProducer.pause();try{t={id:"toggleMedia",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",audioStatus:!1,producerId:this._micProducer.id},this._sendMessage(t),this.emit("peerMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){U.error("muteMic() | failed: %o",e),this.emit("error",{code:"EID004",text:"Error muting local microphone!"})}case 3:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"unmuteMic",value:(N=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.debug("unmuteMic()"),this._micProducer.resume();try{t={id:"toggleMedia",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",audioStatus:!0,producerId:this._micProducer.id},this._sendMessage(t),this.emit("peerUnMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){U.error("unmuteMic() | failed: %o",e),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"})}case 3:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"enableCam",value:(L=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c,d,u,l,h,f,p,m,b,g,v,y,_,w=this,S=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=S.length>0&&void 0!==S[0]?S[0]:{}).deviceId,i=void 0===r?null:r,n=t.videoResolution,a=t.forceVp8,s=t.forceVp9,c=t.forceH264,d=t.h264Profile,u=t.forceFPS,l=t.enableWebcamLayers,h=t.numSimulcastStreams,f=t.videoBitRates,U.debug("enableWebcam()"),this.data.inputParams.produce){e.next=7;break}return U.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID004",text:"Error while trying to start Camera. Produce flag need to set to true while joining room in order to enable Camera."});case 7:if("connected"===this._roomStatus){e.next=10;break}return U.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID005",text:"Error while trying to start Camera as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Camera? OR if you have already initiated the joinRoom process, then Camera will be enabled automatically once room join process completes."});case 10:if(!this._webcamProducer){e.next=13;break}return U.debug("Camera is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID003",text:"Error while trying to start Camera. Camera is already active!"});case 13:if(this._device.canProduce("video")){e.next=16;break}return U.error("enableWebcam() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID006",text:"Error while trying to start Camera. Camera couldnot be activated due to limitations on this device. If you think this device has a functional camera and the problem persists even after multiple retries, please contact technical support with the error code."});case 16:if(["hd","vga","qvga"].includes(n)&&(this.data.inputParams.videoResolution=n,this._webcam.resolution=n),a&&"boolean"==typeof a&&(this.data.inputParams.forceVp8=a),s&&"boolean"==typeof s&&(this.data.inputParams.forceVp9=s),c&&"boolean"==typeof c&&(this.data.inputParams.forceH264=c),d&&["high","low"].includes(d.toLowerCase())&&(this.data.inputParams.h264Profile=d),u&&Number.isInteger(u)&&u<65&&u>5&&(this.data.inputParams.forceFPS=25),l&&"boolean"==typeof l&&(this.data.inputParams.enableWebcamLayers=l,this._enableWebcamLayers=l),h&&Number.isInteger(h)&&h<4&&h>0&&(this.data.inputParams.numSimulcastStreams=h,this._numSimulcastStreams=h),Array.isArray(f)&&f.length>=1&&f.length<=3&&f.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?(U.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=f):U.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[700,250,75]'"),e.prev=25,this._externalVideo){e.next=41;break}if(i?(m=this._deviceList.videoDevices.find((function(e){return e.deviceId===i})))||(U.warn("Selected deviceId:%s not found",i),m=this._deviceList.videoDevices[0]):m=this._deviceList.videoDevices[0],this._webcam.device=m,b=this._webcam.resolution,m){e.next=33;break}return U.error("No wencam device found! Can't start video!"),e.abrupt("return",{success:!1,reason:"No Webcam available for starting video!"});case 33:return i&&this.data.inputParams.videoDeviceId!==i&&(this.data.inputParams.videoDeviceId=i),U.debug("enableWebcam() | calling getUserMedia()"),e.next=37,navigator.mediaDevices.getUserMedia({video:j(j({deviceId:{ideal:m.deviceId}},q[b]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 37:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0],e.next=46;break;case 41:return m={label:"external video"},e.next=44,this._getExternalVideoStream();case 44:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0].clone();case 46:if(y={videoGoogleStartBitrate:1e3},U.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),!this._forceVP8){e.next=54;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=52;break}throw new Error("desired VP8 codec+configuration is not supported");case 52:e.next=67;break;case 54:if(!this._forceH264){e.next=63;break}if("high"===this.data.inputParams.h264Profile?v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),v){e.next=60;break}throw new Error("desired H264 codec+configuration is not supported");case 60:U.debug("Selected h264 codec is:%O",v);case 61:e.next=67;break;case 63:if(!this._forceVP9){e.next=67;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=67;break}throw new Error("desired VP9 codec+configuration is not supported");case 67:return this._enableWebcamLayers&&(_=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&v||"video/vp9"===_.mimeType.toLowerCase()?g=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(g=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&g.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&g.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))),e.next=70,this._sendTransport.produce({track:p,encodings:g,codecOptions:y,codec:v,appData:{mediaTag:"cam-video"}});case 70:this._webcamProducer=e.sent,this._producers.set("video",{id:this._webcamProducer.id,deviceLabel:m.label,type:this._getWebcamType(m),paused:this._webcamProducer.paused,track:this._webcamProducer.track,rtpParameters:this._webcamProducer.rtpParameters,codec:this._webcamProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),this._webcamProducer.on("transportclose",(function(){w._webcamProducer=null})),this._webcamProducer.on("trackended",(function(){w.disableCam().catch((function(){}))})),e.next=82;break;case 77:e.prev=77,e.t0=e.catch(25),U.error("enableWebcam() | failed:%o",e.t0),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),p&&p.stop();case 82:case"end":return e.stop()}}),e,this,[[25,77]])}))),function(){return L.apply(this,arguments)})},{key:"disableCam",value:(A=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("disableWebcam()"),this._webcamProducer){e.next=3;break}return e.abrupt("return");case 3:this._webcamProducer.close(),this._producers.delete("video");try{t={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"video",producerId:this._webcamProducer.id},this._sendMessage(t),this.emit("videoEnd",{peerId:this.data.inputParams.peerId,videoTrack:null})}catch(e){this.emit("error",{code:"EID012",text:"Error while closing server side producer!"})}this._webcamProducer=null;case 7:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"_updateWebcams",value:(D=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return U.debug("_updateWebcams()"),this._webcams=new Map,U.debug("_updateWebcams() | calling enumerateDevices()"),e.next=5,navigator.mediaDevices.enumerateDevices();case 5:t=e.sent,r=O(t),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=16;break}if("videoinput"===(n=i.value).kind){e.next=13;break}return e.abrupt("continue",14);case 13:this._webcams.set(n.deviceId,n);case 14:e.next=9;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(7),r.e(e.t0);case 21:return e.prev=21,r.f(),e.finish(21);case 24:a=Array.from(this._webcams.values()),s=a.length,c=this._webcam.device?this._webcam.device.deviceId:void 0,U.debug("_updateWebcams() [webcams:%o]",a),0===s?this._webcam.device=null:this._webcams.has(c)||(this._webcam.device=a[0]);case 29:case"end":return e.stop()}}),e,this,[[7,18,21,24]])}))),function(){return D.apply(this,arguments)})},{key:"_getExternalVideoStream",value:(I=(0,c.default)(o.default.mark((function e(){var t=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._externalVideoStream){e.next=2;break}return e.abrupt("return",this._externalVideoStream);case 2:if(!(this._externalVideo.readyState<3)){e.next=5;break}return e.next=5,new Promise((function(e){return t._externalVideo.addEventListener("canplay",e)}));case 5:if(!this._externalVideo.captureStream){e.next=9;break}this._externalVideoStream=this._externalVideo.captureStream(),e.next=14;break;case 9:if(!this._externalVideo.mozCaptureStream){e.next=13;break}this._externalVideoStream=this._externalVideo.mozCaptureStream(),e.next=14;break;case 13:throw new Error("video.captureStream() not supported");case 14:return e.abrupt("return",this._externalVideoStream);case 15:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"_getWebcamType",value:function(e){return/(back|rear)/i.test(e.label)?(U.debug("_getWebcamType() | it seems to be a back camera"),"back"):(U.debug("_getWebcamType() | it seems to be a front camera"),"front")}},{key:"changeVideoInput",value:(_=(0,c.default)(o.default.mark((function e(t){var r,i,n,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,!this._webcamProducer){e.next=8;break}return e.next=4,this._changeVideoInput({resolution:r,deviceId:i,fps:n});case 4:return a=e.sent,e.abrupt("return",a);case 8:return U.error("No webcam producer available!"),e.abrupt("return",{success:!1,reason:"You are not sharing your camera yet. Camera Input can be changed to a new camera only when you are sharing an existing camera. "});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"_changeVideoInput",value:(y=(0,c.default)(o.default.mark((function e(t){var r,i,n,a,s,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,U.info("_changeVideoInput() | Inside"),r&&["hd","vga","qvga"].includes(r)?this._webcam.resolution=r:U.warn("Invalid video resolution value "),n&&Number.isInteger(n)&&n<65&&n>5?this.data.inputParams.forceFPS=n:U.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),a=this._deviceList.videoDevices.find((function(e){return i&&e.deviceId===i}))){e.next=8;break}return U.error("The selected deviceId not found!"),e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 8:return this._webcam.device=a,e.prev=9,this._webCamStream.getVideoTracks().forEach((function(e){return e.stop()})),this._webCamStream=null,U.debug("changeVideoInput() | calling getUserMedia()"),e.next=15,navigator.mediaDevices.getUserMedia({video:j(j({deviceId:{ideal:a.deviceId}},q[this._webcam.resolution]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 15:return this._webCamStream=e.sent,s=this._webCamStream.getVideoTracks()[0],U.debug("The new video track is:%O",s),e.next=20,this._webcamProducer.replaceTrack({track:s});case 20:return(c=this._producers.get("video")).deviceLabel=a.label,c.type=this._getWebcamType(a),c.track=this._webcamProducer.track,U.debug("Updated producer values are:%O",c),this._producers.set("video",c),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 30:return e.prev=30,e.t0=e.catch(9),U.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change video input",error:e.t0});case 34:case"end":return e.stop()}}),e,this,[[9,30]])}))),function(e){return y.apply(this,arguments)})},{key:"changeAudioInput",value:(v=(0,c.default)(o.default.mark((function e(t){var r,i,n,a,s,c,d;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,a=t.sampleRate,s=t.channelCount,c=t.deviceId,!this._micProducer){e.next=8;break}return e.next=4,this._changeAudioInput({autoGainControl:r,echoCancellation:i,noiseSuppression:n,sampleRate:a,channelCount:s,deviceId:c});case 4:return d=e.sent,e.abrupt("return",d);case 8:return e.abrupt("return",{success:!1,reason:"You are not sharing your mic yet. Mic Input can be changed to a new mic only when you are sharing an existing mic. "});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"_changeAudioInput",value:(h=(0,c.default)(o.default.mark((function e(t){var r,i,n,a,s,c,d,u,l;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,a=t.sampleRate,s=t.channelCount,c=t.deviceId,r&&"boolean"==typeof r&&(this.data.inputParams.autoGainControl=r),i&&"boolean"==typeof i&&(this.data.inputParams.echoCancellation=Boolean(i)),n&&"boolean"==typeof n&&(this.data.inputParams.noiseSuppression=Boolean(n)),a&&Number.isInteger(a)&&a<64e3&&a>8e3&&(this.data.inputParams.sampleRate=a),s&&Number.isInteger(s)&&s>0&&s<3&&(this.data.inputParams.channelCount=s),d=this._deviceList.audioDevices.find((function(e){return c&&e.deviceId===c}))){e.next=9;break}return e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 9:return this._mic.device=d,this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micStream=null,e.prev=12,e.next=15,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:d.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 15:return this._micStream=e.sent,u=this._micStream.getAudioTracks()[0],this._micProducer.replaceTrack({track:u}),(l=this._producers.get("audio")).deviceLabel=d.label,l.track=this._micProducer.track,U.debug("Updated producer values are:%O",l),this._producers.set("audio",l),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 27:return e.prev=27,e.t0=e.catch(12),U.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change audio input",err:e.t0});case 31:case"end":return e.stop()}}),e,this,[[12,27]])}))),function(e){return h.apply(this,arguments)})},{key:"enableShare",value:(l=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c,d,u,l,h,f,p,m,b=this,g=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=g.length>0&&void 0!==g[0]?g[0]:{}).shareAudio,i=void 0!==r&&r,n=t.enableSharingLayers,a=void 0===n||n,s=t.shareBitRates,c=void 0===s?[2500,1250,500]:s,U.debug("enableShare()"),this.data.inputParams.produce){e.next=7;break}return U.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID003",text:"Error while trying to start screen share. Produce flag need to set to true while joining room in order to enable screen share."});case 7:if("connected"===this._roomStatus){e.next=12;break}return U.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID001",text:"Error while trying to start screen share as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling screen share? OR if you have already initiated the joinRoom process, then try enabling screen share after some seconds."});case 12:if(!this._shareProducer){e.next=17;break}return U.debug("Screen share is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID001",text:"Error while trying to start screen share. Screen share is already active!"});case 17:if(this._device.canProduce("video")){e.next=20;break}return U.error("enableShare() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID002",text:"Error while trying to start screen share. Screen share couldnot be activated due to limitations on this device. If you think this device is capable of screen share and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:return this._enableSharingLayers="boolean"!=typeof a?Boolean(a):a,Array.isArray(c)&&c.length>=1&&c.length<=3&&c.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?this.data.inputParams.shareBitRates=c:this.data.inputParams.shareBitRates=[2500,1250,500],e.prev=22,U.debug("enableShare() | calling getDisplayMedia()"),e.next=26,navigator.mediaDevices.getDisplayMedia({audio:!!i,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});case 26:if(l=e.sent){e.next=31;break}return U.error("Unable to capture screen."),this.emit("error",{code:"EID013",text:"Error while trying to start screen share. Not able to capture screen!"}),e.abrupt("return");case 31:if(!(u=l.getAudioTracks()[0])){e.next=38;break}return e.next=35,this._sendTransport.produce({track:u,codecOptions:this.data.inputParams.forcePCMU?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):void 0,appData:{mediaTag:"screen-audio"}});case 35:this._shareAudioProducer=e.sent,this._producers.set("ssAudio",{id:this._shareAudioProducer.id,type:"shareAudio",paused:this._shareAudioProducer.paused,track:this._shareAudioProducer.track,rtpParameters:this._shareAudioProducer.rtpParameters,codec:this._shareAudioProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssAudioStart",{peerId:this.data.inputParams.peerId,audioTrack:this._shareAudioProducer.track,type:"local"});case 38:if(d=l.getVideoTracks()[0],p={videoGoogleStartBitrate:1e3},!this._forceVP8){e.next=46;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=44;break}throw new Error("desired VP8 codec+configuration is not supported");case 44:e.next=59;break;case 46:if(!this._forceH264){e.next=55;break}if("high"===this.data.inputParams.h264Profile?f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),f){e.next=52;break}throw new Error("desired H264 codec+configuration is not supported");case 52:U.debug("Selected h264 codec is:%O",f);case 53:e.next=59;break;case 55:if(!this._forceVP9){e.next=59;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=59;break}throw new Error("desired VP9 codec+configuration is not supported");case 59:return this._enableSharingLayers&&(m=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&f||"video/vp9"===m.mimeType.toLowerCase()?h=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(h=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&h.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&h.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))),e.next=62,this._sendTransport.produce({track:d,encodings:h,codecOptions:p,codec:f,appData:{mediaTag:"screen-video"}});case 62:this._shareProducer=e.sent,this._producers.set("ssVideo",{id:this._shareProducer.id,type:"shareVideo",paused:this._shareProducer.paused,track:this._shareProducer.track,rtpParameters:this._shareProducer.rtpParameters,codec:this._shareProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssVideoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._shareProducer.track,type:"local"}),this._shareProducer.on("transportclose",(function(){b._shareProducer=null})),this._shareProducer.on("trackended",(function(){b.disableShare().catch((function(){}))})),e.next=74;break;case 69:e.prev=69,e.t0=e.catch(22),U.error("enableShare() | failed:%o",e.t0),"NotAllowedError"!==e.t0.name&&this.emit("error",{code:"EID014",text:"Error while trying to start screen share. Error is: ".concat(e.t0,"!")}),d&&d.stop();case 74:case"end":return e.stop()}}),e,this,[[22,69]])}))),function(){return l.apply(this,arguments)})},{key:"disableShare",value:(n=(0,c.default)(o.default.mark((function e(){var t,r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("disableShare()"),this._shareProducer){e.next=5;break}return U.warn("Screen share doesn't seem to be on!"),this.emit("error",{code:"EID017",text:"Error while trying to stop screen share. Is the screen share on!"}),e.abrupt("return");case 5:if(this._shareProducer.close(),this._shareAudioProducer){this._shareAudioProducer.close();try{t={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",producerId:this._shareAudioProducer.id},this._sendMessage(t),this.emit("ssAudioStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"})}catch(e){this.emit("error",{code:"EID015",text:"Error while trying to stop screen share audio. Error is: ".concat(e,"!")})}}try{r={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"video",producerId:this._shareProducer.id},this._sendMessage(r),this.emit("ssVideoStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"})}catch(e){this.emit("error",{code:"EID016",text:"Error while trying to stop screen share video. Error is: ".concat(e,"!")})}this._shareAudioProducer=null,this._shareProducer=null;case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})}],[{key:"listDevices",value:(i=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!F){e.next=3;break}return U.info("Device list already exists:%O",F),e.abrupt("return",{success:!0,deviceList:F});case 3:return e.next=5,(0,M.loadAllAvailableDevices)();case 5:if(!(t=e.sent).success){e.next=11;break}return F=t.deviceList,e.abrupt("return",{success:!0,deviceList:t.deviceList});case 11:return e.abrupt("return",{success:!1,reason:t.reason});case 12:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"init",value:(r=(0,c.default)(o.default.mark((function e(){var r,i,n,s,c,d,u,l,h,f=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=(r=f.length>0&&void 0!==f[0]?f[0]:{}).sessionToken,n=r.roomId,s=r.peerId,i){e.next=3;break}throw new Error("Session token is required to join the room.");case 3:e.prev=3,U.info("session token:%s",i),e.prev=5,c=E.default.verify(i,"samvyo_tech_321",{algorithms:["HS256"]}),U.info("Decoded token:",c),e.next=26;break;case 10:if(e.prev=10,e.t0=e.catch(5),U.error("JWT verification failed:",e.t0),"JsonWebTokenError"!==e.t0.name){e.next=17;break}throw new Error("Invalid session token: "+e.t0.message);case 17:if("TokenExpiredError"!==e.t0.name){e.next=21;break}throw new Error("Session token has expired");case 21:if("NotBeforeError"!==e.t0.name){e.next=25;break}throw new Error("Session token not yet active");case 25:throw new Error("Failed to verify session token: "+e.t0.message);case 26:if(c&&"object"===(0,a.default)(c)){e.next=28;break}throw new Error("Invalid token format");case 28:if(u=(d=c).data,l=d.signallingServerUrl,u&&l){e.next=31;break}throw new Error("Missing required token data");case 31:return s||(s=(0,k.uuidv4)()),n||(n=(0,S.getRandomInt)()),h={sessionToken:i,innerSessionToken:u,signallingServerUrl:l},e.abrupt("return",new t({peerId:s,roomId:n,outputData:h}));case 37:throw e.prev=37,e.t1=e.catch(3),U.error("Failed to initialize:",e.t1.message),e.t1;case 41:case"end":return e.stop()}}),e,null,[[3,37],[5,10]])}))),function(){return r.apply(this,arguments)})}]);var r,i,n,l,h,v,y,_,I,D,A,L,N,V,G,W,H,K,$,J,Y,X}(v.EventEmitter)},{"./Logger":4,"./socket":5,"./utils/chooseMedia":12,"./utils/constants":13,"./utils/getRandomInt":14,"./utils/getUSerMediaConstraints":15,"./utils/getVidScaleUrl":16,"./utils/queue":17,"./utils/randomName":18,"./utils/sleep":19,"./utils/uuidv4":20,"./utils/verifyOutputQualites":21,"./utils/verifyfileTypes":22,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/defineProperty":27,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/objectWithoutProperties":31,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/helpers/typeof":38,"@babel/runtime/regenerator":39,bowser:61,events:91,jsonwebtoken:178,"mediasoup-client":232}],3:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.JsSdk_v1=void 0;var a=i(e("@babel/runtime/regenerator")),s=i(e("@babel/runtime/helpers/asyncToGenerator")),o=i(e("@babel/runtime/helpers/defineProperty")),c=i(e("@babel/runtime/helpers/classCallCheck")),d=i(e("@babel/runtime/helpers/createClass")),u=i(e("@babel/runtime/helpers/possibleConstructorReturn")),l=i(e("@babel/runtime/helpers/getPrototypeOf")),h=i(e("@babel/runtime/helpers/inherits")),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=n(e)&&"function"!=typeof e)return{default:e};var r=k(t);if(r&&r.has(e))return r.get(e);var i={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var o=a?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,r&&r.set(e,i),i}(e("mediasoup-client")),p=i(e("bowser")),m=i(e("./socket")),b=e("events"),g=i(e("./Logger")),v=e("./utils/getRandomInt"),y=e("./utils/uuidv4"),_=e("./utils/getVidScaleUrl"),w=i(e("./utils/randomName")),S=(e("./utils/constants"),e("./utils/chooseMedia"));function k(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(k=function(e){return e?r:t})(e)}function R(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return P(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach((function(t){(0,o.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function x(e,t,r){return t=(0,l.default)(t),(0,u.default)(e,T()?Reflect.construct(t,r||[],(0,l.default)(e).constructor):t.apply(e,r))}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(T=function(){return!!e})()}var C,I=new g.default("Room"),D={small:{width:{ideal:160},height:{ideal:120}},qvga:{width:{ideal:320},height:{ideal:240}},vga:{width:{ideal:640},height:{ideal:480}},hd:{width:{ideal:1280},height:{ideal:720}}},O={optional:[{googDscp:!0}]};r.JsSdk_v1=function(e){function t(e){var r,i=e.peerId,n=e.roomId,a=e.peerName,s=e.produce,o=e.produceAudio,d=e.produceVideo,u=e.consume,l=e.videoResolution,h=e.forceVp8,m=e.forceVp9,b=e.forceH264,g=e.h264Profile,v=e.forceFPS,y=e.forcePCMU,_=e.forcePCMA,w=e.enableWebcamLayers,S=e.numSimulcastStreams,k=e.autoGainControl,R=e.echoCancellation,P=e.noiseSuppression,M=e.sampleRate,T=e.channelCount,I=e.videoBitRates,D=e.share,O=e.shareAudio,A=e.enableSharingLayers,L=e.shareBitRates,j=e.outputData,B=e.audioDeviceId,N=e.videoDeviceId;return(0,c.default)(this,t),(r=x(this,t))._closed=!1,r._roomStatus="initialised",r._cignal=null,r._sendTransport=null,r._recvTransport=null,r._device=new f.Device,r._webCamProducer=null,r._micProducer=null,r._shareProducer=null,r._shareAudioProducer=null,r._producers=new Map,r._consumers=new Map,r._peers=new Map,r._data=E({},j),r._micStream=null,r._webCamStream=null,r._webcam={device:null,resolution:l},r._mic={device:null},r._deviceList=C||null,r._externalVideo=null,r._externalVideoStream=null,r._forceVP8=Boolean(h),r._forceH264=Boolean(b),r._forceVP9=Boolean(m),r._enableWebcamLayers=Boolean(w),r._numSimulcastStreams=S,r._enableSharingLayers=Boolean(A),r._client=p.default.parse(window.navigator.userAgent),r._cignalConnected=!1,r._reconnectionInitiated=!1,r._restartIceInProgressSendTransport=!1,r._restartIceInProgressRecvTransport=!1,r._activeSpeaker=null,r.init({roomId:n,peerId:i,peerName:a,produce:s,produceAudio:o,produceVideo:d,consume:u,videoResolution:l,forceVp8:h,forceVp9:m,forceH264:b,h264Profile:g,forceFPS:v,forcePCMU:y,forcePCMA:_,enableWebcamLayers:w,numSimulcastStreams:S,autoGainControl:k,echoCancellation:R,noiseSuppression:P,sampleRate:M,channelCount:T,videoBitRates:I,share:D,shareAudio:O,enableSharingLayers:A,shareBitRates:L,audioDeviceId:B,videoDeviceId:N}),r}return(0,h.default)(t,e),(0,d.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("Setting the whole data object is not possible!")}},{key:"peers",get:function(){return this._peers},set:function(e){throw new Error("Setting the whole peers object is not possible!")}},{key:"transports",get:function(){return{produce:this._sendTransport,consume:this._recvTransport}},set:function(e){throw new Error("Setting of transport is not possible!")}},{key:"videoStream",get:function(){return this._webCamStream}},{key:"audioStream",get:function(){return this._micStream}},{key:"clientAgent",get:function(){return this._client}},{key:"activeParameters",get:function(){return this._data.inputParams}},{key:"deviceList",get:function(){return this._deviceList?this._deviceList:{videoDevices:[],audioDevices:[],audioOutputDevices:[]}},set:function(e){throw new Error("Setting of deviceList is not possible!")}},{key:"currentlyActiveSpeaker",get:function(){return this._activeSpeaker},set:function(e){throw new Error("Setting of currentActivespeaker is not possible!")}},{key:"init",value:(H=(0,s.default)(a.default.mark((function e(t){var r;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("init() | The input parameters are:%O",t),this.data.inputParams=t,r=f.detectDevice(),I.debug("The device is:%O",r),e.next=6,this.listDevicesInternal();case 6:return e.next=8,this.join();case 8:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"close",value:function(){this._closed||(this._closed=!0,I.debug("close()"),this._cignal.close(),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed")}},{key:"leaveRoom",value:(W=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("Leave room is called!!"),"connected"!==this._roomStatus){e.next=12;break}return e.next=4,this._cignal.notify("leaveRoom",{});case 4:this._sendTransport&&(this._sendTransport.close(),this._sendTransport=null),this._recvTransport&&(this._recvTransport.close(),this._recvTransport=null),this._webCamStream&&this._webCamStream.getVideoTracks().forEach((function(e){e.stop(),I.debug("Video Track stopped")})),this._micStream&&this._micStream.getAudioTracks().forEach((function(e){e.stop(),I.debug("Mic Track stopped")})),this._roomStatus="closed",this._cignal.close(),e.next=13;break;case 12:I.error("The room state is:%s",this._roomStatus);case 13:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"closeRoom",value:(G=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._cignal.notify("closeRoom",{});case 2:this.leaveRoom();case 3:case"end":return e.stop()}}),e,this)}))),function(){return G.apply(this,arguments)})},{key:"listDevicesInternal",value:(V=(0,s.default)(a.default.mark((function e(){var t,r=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices.ondevicechange=function(){var e=(0,s.default)(a.default.mark((function e(t){var i;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,S.updatedDeviceList)();case 2:i=e.sent,I.info("Media devices changed!:%O",i),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioDevices=i.audioDevices),i.videoDevices&&i.videoDevices.length>0&&(r._deviceList.videoDevices=i.videoDevices),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioOutputDevices=i.audioDevicesOutput),C=r._deviceList,r.emit("deviceListUpdated");case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),!this._deviceList){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,(0,S.loadAllAvailableDevices)();case 7:if(!(t=e.sent).success){e.next=12;break}return this._deviceList=t.deviceList,C=this._deviceList,e.abrupt("return");case 12:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"join",value:(z=(0,s.default)(a.default.mark((function e(){var t,r=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=new m.default.SocketTransport(this.data.url,{retries:10,factor:2,minTimeout:1e3,maxTimeout:8e3}),this._cignal=new m.default.Peer(t),this._cignal.on("open",(0,s.default)(a.default.mark((function e(){var t,i;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r._cignalConnected=!0,!r._sendTransport&&!r._recvTransport){e.next=6;break}!r._sendTransport||"failed"!==r._sendTransport.connectionState&&"disconnected"!==r._sendTransport.connectionState?I.debug("Nothing to in case of socket reconnection with send transport status:%s",null===(t=r._sendTransport)||void 0===t?void 0:t.connectionState):(I.debug("Ws reconnected after network outage. Need to do ICE restarts for send transport."),r.restartIceSendTransport()),!r._recvTransport||"failed"!==r._recvTransport.connectionState&&"disconnected"!==r._recvTransport.connectionState?I.debug("Nothing to in case of socket reconnection with recv transport status:%s",null===(i=r._recvTransport)||void 0===i?void 0:i.connectionState):(I.debug("Ws reconnected after network outage. Need to do ICE restarts for recv transport."),r.restartIceRecvTransport()),e.next=9;break;case 6:return I.debug("Ws connected for first time. Need to go with the regular flow."),e.next=9,r._joinRoom();case 9:case"end":return e.stop()}}),e)})))),this._cignal.on("failed",(function(){})),this._cignal.on("disconnected",(function(){I.debug("ws disconnected!"),r._cignalConnected=!1})),this._cignal.on("close",(function(){r._closed||r._reconnectionInitiated||r.close()})),this._cignal.on("request",function(){var e=(0,s.default)(a.default.mark((function e(t,i,n){var s,c,d,u,l,h,p,m,b,g,v,y,_,w,S;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:I.debug('cignal "request" event [method:%s, data:%o]',t.method,t.data),r._cignalConnected=!0,e.t0=t.method,e.next="newConsumer"===e.t0?5:30;break;case 5:if(r.data.inputParams.consume){e.next=8;break}return n(403,"I do not want to consume"),e.abrupt("break",30);case 8:return s=t.data,c=s.peerId,d=s.producerId,u=s.id,l=s.kind,h=s.rtpParameters,p=s.type,m=s.appData,b=s.producerPaused,e.prev=9,e.next=12,r._recvTransport.consume({id:u,producerId:d,kind:l,rtpParameters:h,streamId:"".concat(c,"-").concat(m.share?"share":"mic-webcam"),appData:E(E({},m),{},{peerId:c})});case 12:g=e.sent,r._consumers.set(g.id,g),g.on("transportclose",(function(){r._consumers.delete(g.id)})),v=f.parseScalabilityMode(g.rtpParameters.encodings[0].scalabilityMode),y=v.spatialLayers,_=v.temporalLayers,w=r._peers.get(c),I.debug("Consumer created for peerId ".concat(c," for kind ").concat(g.kind)),S=E(E({},w),{},(0,o.default)({},m.share?"ss".concat(g.kind):g.kind,{consumerId:g.id,type:p,locallyPaused:!1,remotelyPaused:b,rtpParameters:g.rtpParameters,spatialLayers:y,temporalLayers:_,preferredSpatialLayer:y-1,preferredTemporalLayer:_-1,priority:1,codec:g.rtpParameters.codecs[0].mimeType.split("/")[1],track:g.track,share:m.share})),r._peers.set(c,S),i(),I.debug("Going to emit mic start / videostart"),"audio"===g.kind?m.share?r.emit("ssAudioStart",{peerId:c,audioTrack:g.track,type:"remote"}):r.emit("micStart",{peerId:c,audioTrack:g.track,type:"remote"}):"video"===g.kind&&(m.share?r.emit("ssVideoStart",{peerId:c,videoTrack:g.track,type:"remote"}):r.emit("videoStart",{peerId:c,videoTrack:g.track,type:"remote"})),e.next=29;break;case 25:throw e.prev=25,e.t1=e.catch(9),I.error('"newConsumer" request failed:%o',e.t1),e.t1;case 29:return e.abrupt("break",30);case 30:case"end":return e.stop()}}),e,null,[[9,25]])})));return function(t,r,i){return e.apply(this,arguments)}}()),this._cignal.on("notification",(function(e){switch("activeSpeaker"!==e.method&&I.debug('proto "notification" event [method:%s, data:%o]',e.method,e.data),r._cignalConnected=!0,e.method){case"producerScore":var t=e.data;t.producerId,t.score;break;case"newPeer":var i=e.data;r._peers.set(i.id,E(E({},i),{},{consumers:[]})),r.emit("newPeer",{peerId:i.id,peerName:i.displayName,type:"remote"});break;case"peerClosed":var n=e.data.peerId;r._peers.delete(n),r.emit("peerLeft",{peerId:n});break;case"roomClosed":I.debug("Room closed. No need to reconnect socket"),r.close();break;case"consumerClosed":var a=e.data.consumerId,s=r._consumers.get(a);if(I.debug("Consumer closed for consumerId:%s, type:%s",a,null==s?void 0:s.kind),!s)break;var o=s.appData,c=o.peerId,d=o.share,u=d?"ss".concat(s.kind):s.kind;s.close(),r._consumers.delete(a);var l=r._peers.get(c);I.debug("Peer data before deletion:%O",l),l[u]&&l[u].consumerId===a&&delete l[u],I.debug("Peer data after deletion:%O",l),r._peers.set(c,l),"audio"===u?(I.debug("Going to emit micEnd, consumer closed for audio"),d?r.emit("ssAudioStop",{peerId:c,track:null,type:"remote"}):r.emit("micEnd",{peerId:c,track:null,type:"remote"})):"video"===u&&(I.debug("Going to emit videoEnd, consumer closed for video"),d?r.emit("ssVideoStop",{peerId:c,track:null,type:"remote"}):r.emit("videoEnd",{peerId:c,track:null,type:"remote"}));break;case"consumerPaused":var h=e.data.consumerId,f=r._consumers.get(h);if(!f)break;f.pause();break;case"consumerResumed":var p=e.data.consumerId,m=r._consumers.get(p);if(!m)break;m.resume();break;case"consumerLayersChanged":var b=e.data,g=b.consumerId;if(b.spatialLayer,b.temporalLayer,!r._consumers.get(g))break;break;case"consumerScore":var v=e.data;v.consumerId,v.score;break;case"activeSpeaker":var y=e.data,_=y.peerId,w=y.volume;r._activeSpeaker=e.data,r.emit("activeSpeaker",{peerId:_,volume:w});break;case"peerMuted":var S=e.data.peerId;r.emit("peerMuted",{peerId:S,type:"remote"});break;case"peerUnMuted":var k=e.data.peerId;r.emit("peerUnMuted",{peerId:k,type:"remote"});break;default:I.error('unknown protoo notification.method "%s"',e.method)}}));case 8:case"end":return e.stop()}}),e,this)}))),function(){return z.apply(this,arguments)})},{key:"restartIceSendTransport",value:(q=(0,s.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("restartIce SendTransport()"),!this._restartIceInProgressSendTransport){e.next=4;break}return I.warn("Restart ice already in progress for send transport! wait 4 completion b4 next request!"),e.abrupt("return");case 4:if(e.prev=4,!this._sendTransport||"failed"!==this._sendTransport.connectionState&&"disconnected"!==this._sendTransport.connectionState){e.next=14;break}return this._restartIceInProgressSendTransport=!0,I.debug("Restarting ICE for send transport"),e.next=10,this._cignal.request("restartIce",{transportId:this._sendTransport.id,peerId:this._peerId});case 10:return t=e.sent,e.next=13,this._sendTransport.restartIce({iceParameters:t});case 13:this._restartIceInProgressSendTransport=!1;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),I.error("restartIce SendTransport() | failed:%o",e.t0);case 19:this._reconnectionInitiated=!1;case 20:case"end":return e.stop()}}),e,this,[[4,16]])}))),function(){return q.apply(this,arguments)})},{key:"restartIceRecvTransport",value:(U=(0,s.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("restartIce RecvTransport()"),!this._restartIceInProgressRecvTransport){e.next=4;break}return I.warn("Restart ice already in progress for recv transport! wait 4 completion b4 next request!"),e.abrupt("return");case 4:if(e.prev=4,!this._recvTransport||"failed"!==this._recvTransport.connectionState&&"disconnected"!==this._recvTransport.connectionState){e.next=14;break}return this._restartIceInProgressRecvTransport=!0,I.debug("Restarting ICE for recv transport"),e.next=10,this._cignal.request("restartIce",{transportId:this._recvTransport.id,peerId:this._peerId});case 10:return t=e.sent,e.next=13,this._recvTransport.restartIce({iceParameters:t});case 13:this._restartIceInProgressRecvTransport=!1;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),I.error("restartIce RecvTransport() | failed:%o",e.t0);case 19:this._reconnectionInitiated=!1;case 20:case"end":return e.stop()}}),e,this,[[4,16]])}))),function(){return U.apply(this,arguments)})},{key:"_joinRoom",value:(F=(0,s.default)(a.default.mark((function e(){var t,r,i,n,o,c,d,u,l,h,f,p,m,b,g,v,y,_,w=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("_joinRoom()"),e.prev=1,e.next=4,this._cignal.request("getRouterRtpCapabilities",{coreNumber:this.data.core});case 4:return t=e.sent,I.debug("Router rtp capabilities created:%O",t),I.debug("Input params are:",this.data.inputParams),e.next=9,this._device.load({routerRtpCapabilities:t});case 9:if(!this.data.inputParams.produce){e.next=19;break}return I.debug("Going to create webrtctransport send"),e.next=13,this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp||!1,producing:!0,consuming:!1,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0});case 13:r=e.sent,i=r.id,n=r.iceParameters,o=r.iceCandidates,c=r.dtlsParameters,d=r.sctpParameters,I.debug("Transport info is:%O",r),this._sendTransport=this._device.createSendTransport({id:i,iceParameters:n,iceCandidates:o,dtlsParameters:E(E({},c),{},{role:"auto"}),sctpParameters:d,iceServers:[],proprietaryConstraints:O,additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._sendTransport.on("connect",(function(e,t,r){var i=e.iceParameters,n=e.dtlsParameters;w._cignal.request("connectWebRtcTransport",{transportId:w._sendTransport.id,iceParameters:i,dtlsParameters:n}).then(t).catch(r)})),this._sendTransport.on("produce",function(){var e=(0,s.default)(a.default.mark((function e(t,r,i){var n,s,o,c,d;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.kind,s=t.rtpParameters,o=t.appData,e.prev=1,e.next=4,w._cignal.request("produce",{transportId:w._sendTransport.id,kind:n,rtpParameters:s,appData:o});case 4:c=e.sent,d=c.id,r({id:d}),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),i(e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r,i){return e.apply(this,arguments)}}());case 19:if(!this.data.inputParams.consume){e.next=28;break}return I.debug("Going to create webrtctransport recv"),e.next=23,this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp,producing:!1,consuming:!0,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0});case 23:u=e.sent,l=u.id,h=u.iceParameters,f=u.iceCandidates,p=u.dtlsParameters,m=u.sctpParameters,I.debug("Transport info is:%O",u),this._recvTransport=this._device.createRecvTransport({id:l,iceParameters:h,iceCandidates:f,dtlsParameters:E(E({},p),{},{role:"auto"}),sctpParameters:m,iceServers:[],additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._recvTransport.on("connect",(function(e,t,r){var i=e.iceParameters,n=e.dtlsParameters;w._cignal.request("connectWebRtcTransport",{transportId:w._recvTransport.id,iceParameters:i,dtlsParameters:n}).then(t).catch(r)}));case 28:return e.next=30,this._cignal.request("join",{displayName:this.data.inputParams.peerName,device:this._device,rtpCapabilities:this.data.inputParams.consume?this._device.rtpCapabilities:void 0,sctpCapabilities:this._useDataChannel&&this.data.inputParams.consume?this._device.sctpCapabilities:void 0});case 30:b=e.sent,g=b.peers,this.emit("newPeer",{peerId:this.data.inputParams.peerId,peerName:this.data.inputParams.peerName,type:"local"}),this._roomStatus="connected",I.debug("All availablepeers in this room are::%O",g),v=R(g);try{for(v.s();!(y=v.n()).done;)_=y.value,this._peers.set(_.id,E(E({},_),{},{consumers:[]})),I.debug("new peer is:%O",_),this.emit("newPeer",{peerId:_.id,peerName:_.displayName,type:"remote"})}catch(e){v.e(e)}finally{v.f()}this.data.inputParams.produce&&(this.data.inputParams.produceAudio?this.enableMic({deviceId:this.data.inputParams.audioDeviceId?this.data.inputParams.audioDeviceId:null}):I.debug("No need to produce audio!"),(this._device.canProduce("video")||this._externalVideo)&&(this.data.inputParams.produceVideo?this.enableCam({deviceId:this.data.inputParams.videoDeviceId?this.data.inputParams.videoDeviceId:null}):I.debug("No need to produce video!"),this.data.inputParams.share&&this.enableShare({shareAudio:this.data.inputParams.shareAudio,enableSharingLayers:this._enableSharingLayers,shareBitRates:this.data.inputParams.shareBitRates})),this._sendTransport.on("connectionstatechange",(function(e){"connected"===e&&I.debug("Send transport now connected!")}))),e.next=45;break;case 40:e.prev=40,e.t0=e.catch(1),I.error("_joinRoom() failed:%o",e.t0),this.emit("error",{code:"EJR001",text:"Join room request failed!"}),this.close();case 45:case"end":return e.stop()}}),e,this,[[1,40]])}))),function(){return F.apply(this,arguments)})},{key:"enableMic",value:(N=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c,d,u,l,h,f,p=this,m=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=m.length>0&&void 0!==m[0]?m[0]:{}).deviceId,i=void 0===r?null:r,n=t.autoGainControl,s=t.noiseSuppression,o=t.echoCancellation,c=t.channelCount,d=t.sampleRate,u=t.forcePCMU,l=t.forcePCMA,I.debug("enableMic()"),this.data.inputParams.produce){e.next=7;break}return I.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID007",text:"Error while trying to start Mic/Audio. Produce flag need to set to true while joining room in order to enable Mic/Audio."});case 7:if("connected"===this._roomStatus){e.next=12;break}return I.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID008",text:"Error while trying to start Mic/Audio as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Mic? OR if you have already initiated the joinRoom process, then Mic will be enabled automatically once room join process completes."});case 12:if(!this._micProducer){e.next=17;break}return I.debug("Mic is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID002",text:"Error while trying to start Mic/Audio. Mic/Audio is already active!"});case 17:if(this._device.canProduce("audio")){e.next=20;break}return I.error("enableMic() | cannot produce audio"),e.abrupt("return",{success:!1,error:!0,code:"REID009",text:"Error while trying to start Mic/Audio. Mic/Audio couldnot be activated due to limitations on this device. If you think this device has a functional Mic and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:if(u&&"boolean"==typeof u&&(this.data.inputParams.forcePCMU=u),l&&"boolean"==typeof l&&(this.data.inputParams.forcePCMA=l),n&&"boolean"==typeof n&&(this.data.inputParams.autoGainControl=n),o&&"boolean"==typeof o&&(this.data.inputParams.echoCancellation=o),s&&"boolean"==typeof s&&(this.data.inputParams.noiseSuppression=s),d&&Number.isInteger(d)&&d<64e3&&d>8e3&&(this.data.inputParams.sampleRate=d),c&&Number.isInteger(c)&&c>0&&c<3&&(this.data.inputParams.channelCount=c),e.prev=27,this._externalVideo){e.next=48;break}if(i?(f=this._deviceList.audioDevices.find((function(e){return e.deviceId===i})))||(I.warn("Selected audio input deviceId:%s not found",i),f=this._deviceList.audioDevices[0]):f=this._deviceList.audioDevices[0],this._mic.device=f,f){e.next=34;break}return I.error("No mic device found! Can't start audio!"),e.abrupt("return",{success:!1,reason:"No mic available for starting audio!"});case 34:return i&&this.data.inputParams.audioDeviceId!==i&&(this.data.inputParams.audioDeviceId=i),I.debug("enableMic() | calling getUserMedia()"),e.prev=36,e.next=39,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:f.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 39:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0],e.next=46;break;case 43:throw e.prev=43,e.t0=e.catch(36),new Error("Error while acquiring mic. Possible issue with audio constraint values",e.t0);case 46:e.next=52;break;case 48:return e.next=50,this._getExternalVideoStream();case 50:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0].clone();case 52:return e.next=54,this._sendTransport.produce({track:h,codecOptions:this.data.inputParams.forcePCMU||this.data.inputParams.forcePCMA?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):this.data.inputParams.forcePCMA?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcma"===e.mimeType.toLowerCase()})):void 0});case 54:this._micProducer=e.sent,this._producers.set("audio",{id:this._micProducer.id,paused:this._micProducer.paused,track:this._micProducer.track,rtpParameters:this._micProducer.rtpParameters,codec:this._micProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),this._micProducer.on("transportclose",(function(){p._micProducer=null})),this._micProducer.on("trackended",(function(){p.disableMic().catch((function(){}))})),e.next=66;break;case 61:e.prev=61,e.t1=e.catch(27),I.error("enableMic() | failed:%o",e.t1),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),h&&h.stop();case 66:case"end":return e.stop()}}),e,this,[[27,61],[36,43]])}))),function(){return N.apply(this,arguments)})},{key:"disableMic",value:(B=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micProducer){e.next=4;break}return e.abrupt("return");case 4:return this._micProducer.close(),this._producers.delete("audio"),e.prev=6,e.next=9,this._cignal.request("closeProducer",{producerId:this._micProducer.id});case 9:this.emit("micEnd",{peerId:this.data.inputParams.peerId,audioTrack:null,type:"local"}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(6),this.emit("error",{code:"EID003",text:"Error disabling microphone!"});case 15:this._micProducer=null;case 16:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return B.apply(this,arguments)})},{key:"muteMic",value:(j=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("muteMic()"),this._micProducer.pause(),e.prev=2,e.next=5,this._cignal.request("pauseProducer",{producerId:this._micProducer.id});case 5:this.emit("peerMuted",{peerId:this.data.inputParams.peerId,type:"local"}),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),I.error("muteMic() | failed: %o",e.t0),this.emit("error",{code:"EID004",text:"Error muting local microphone!"});case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return j.apply(this,arguments)})},{key:"unmuteMic",value:(L=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("unmuteMic()"),this._micProducer.resume(),e.prev=2,e.next=5,this._cignal.request("resumeProducer",{producerId:this._micProducer.id});case 5:this.emit("peerUnMuted",{peerId:this.data.inputParams.peerId,type:"local"}),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),I.error("unmuteMic() | failed: %o",e.t0),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"});case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return L.apply(this,arguments)})},{key:"enableCam",value:(A=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c,d,u,l,h,f,p,m,b,g,v,y,_,w=this,S=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=S.length>0&&void 0!==S[0]?S[0]:{}).deviceId,i=void 0===r?null:r,n=t.videoResolution,s=t.forceVp8,o=t.forceVp9,c=t.forceH264,d=t.h264Profile,u=t.forceFPS,l=t.enableWebcamLayers,h=t.numSimulcastStreams,f=t.videoBitRates,I.debug("enableWebcam()"),this.data.inputParams.produce){e.next=7;break}return I.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID004",text:"Error while trying to start Camera. Produce flag need to set to true while joining room in order to enable Camera."});case 7:if("connected"===this._roomStatus){e.next=10;break}return I.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID005",text:"Error while trying to start Camera as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Camera? OR if you have already initiated the joinRoom process, then Camera will be enabled automatically once room join process completes."});case 10:if(!this._webcamProducer){e.next=13;break}return I.debug("Camera is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID003",text:"Error while trying to start Camera. Camera is already active!"});case 13:if(this._device.canProduce("video")){e.next=16;break}return I.error("enableWebcam() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID006",text:"Error while trying to start Camera. Camera couldnot be activated due to limitations on this device. If you think this device has a functional camera and the problem persists even after multiple retries, please contact technical support with the error code."});case 16:if(["hd","vga","qvga"].includes(n)&&(this.data.inputParams.videoResolution=n,this._webcam.resolution=n),s&&"boolean"==typeof s&&(this.data.inputParams.forceVp8=s),o&&"boolean"==typeof o&&(this.data.inputParams.forceVp9=o),c&&"boolean"==typeof c&&(this.data.inputParams.forceH264=c),d&&["high","low"].includes(d.toLowerCase())&&(this.data.inputParams.h264Profile=d),u&&Number.isInteger(u)&&u<65&&u>5&&(this.data.inputParams.forceFPS=25),l&&"boolean"==typeof l&&(this.data.inputParams.enableWebcamLayers=l,this._enableWebcamLayers=l),h&&Number.isInteger(h)&&h<4&&h>0&&(this.data.inputParams.numSimulcastStreams=h,this._numSimulcastStreams=h),Array.isArray(f)&&f.length>=1&&f.length<=3&&f.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?(I.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=f):I.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[700,250,75]'"),e.prev=25,this._externalVideo){e.next=41;break}if(i?(m=this._deviceList.videoDevices.find((function(e){return e.deviceId===i})))||(I.warn("Selected deviceId:%s not found",i),m=this._deviceList.videoDevices[0]):m=this._deviceList.videoDevices[0],this._webcam.device=m,b=this._webcam.resolution,m){e.next=33;break}return I.error("No wencam device found! Can't start video!"),e.abrupt("return",{success:!1,reason:"No Webcam available for starting video!"});case 33:return i&&this.data.inputParams.videoDeviceId!==i&&(this.data.inputParams.videoDeviceId=i),I.debug("enableWebcam() | calling getUserMedia()"),e.next=37,navigator.mediaDevices.getUserMedia({video:E(E({deviceId:{ideal:m.deviceId}},D[b]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 37:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0],e.next=46;break;case 41:return m={label:"external video"},e.next=44,this._getExternalVideoStream();case 44:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0].clone();case 46:if(y={videoGoogleStartBitrate:1e3},I.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),!this._forceVP8){e.next=54;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=52;break}throw new Error("desired VP8 codec+configuration is not supported");case 52:e.next=67;break;case 54:if(!this._forceH264){e.next=63;break}if("high"===this.data.inputParams.h264Profile?v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),v){e.next=60;break}throw new Error("desired H264 codec+configuration is not supported");case 60:I.debug("Selected h264 codec is:%O",v);case 61:e.next=67;break;case 63:if(!this._forceVP9){e.next=67;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=67;break}throw new Error("desired VP9 codec+configuration is not supported");case 67:return this._enableWebcamLayers&&(_=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&v||"video/vp9"===_.mimeType.toLowerCase()?g=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(g=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&g.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&g.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))),e.next=70,this._sendTransport.produce({track:p,encodings:g,codecOptions:y,codec:v});case 70:this._webcamProducer=e.sent,this._producers.set("video",{id:this._webcamProducer.id,deviceLabel:m.label,type:this._getWebcamType(m),paused:this._webcamProducer.paused,track:this._webcamProducer.track,rtpParameters:this._webcamProducer.rtpParameters,codec:this._webcamProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),this._webcamProducer.on("transportclose",(function(){w._webcamProducer=null})),this._webcamProducer.on("trackended",(function(){w.disableWebcam().catch((function(){}))})),e.next=82;break;case 77:e.prev=77,e.t0=e.catch(25),I.error("enableWebcam() | failed:%o",e.t0),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),p&&p.stop();case 82:case"end":return e.stop()}}),e,this,[[25,77]])}))),function(){return A.apply(this,arguments)})},{key:"disableCam",value:(T=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("disableWebcam()"),this._webcamProducer){e.next=3;break}return e.abrupt("return");case 3:return this._webcamProducer.close(),this._producers.delete("video"),e.prev=5,e.next=8,this._cignal.request("closeProducer",{producerId:this._webcamProducer.id});case 8:this.emit("videoEnd",{peerId:this.data.inputParams.peerId,videoTrack:null}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),this.emit("error",{code:"EID012",text:"Error while closing server side producer!"});case 14:this._webcamProducer=null;case 15:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return T.apply(this,arguments)})},{key:"_updateWebcams",value:(M=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("_updateWebcams()"),this._webcams=new Map,I.debug("_updateWebcams() | calling enumerateDevices()"),e.next=5,navigator.mediaDevices.enumerateDevices();case 5:t=e.sent,r=R(t),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=16;break}if("videoinput"===(n=i.value).kind){e.next=13;break}return e.abrupt("continue",14);case 13:this._webcams.set(n.deviceId,n);case 14:e.next=9;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(7),r.e(e.t0);case 21:return e.prev=21,r.f(),e.finish(21);case 24:s=Array.from(this._webcams.values()),o=s.length,c=this._webcam.device?this._webcam.device.deviceId:void 0,I.debug("_updateWebcams() [webcams:%o]",s),0===o?this._webcam.device=null:this._webcams.has(c)||(this._webcam.device=s[0]);case 29:case"end":return e.stop()}}),e,this,[[7,18,21,24]])}))),function(){return M.apply(this,arguments)})},{key:"_getExternalVideoStream",value:(P=(0,s.default)(a.default.mark((function e(){var t=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._externalVideoStream){e.next=2;break}return e.abrupt("return",this._externalVideoStream);case 2:if(!(this._externalVideo.readyState<3)){e.next=5;break}return e.next=5,new Promise((function(e){return t._externalVideo.addEventListener("canplay",e)}));case 5:if(!this._externalVideo.captureStream){e.next=9;break}this._externalVideoStream=this._externalVideo.captureStream(),e.next=14;break;case 9:if(!this._externalVideo.mozCaptureStream){e.next=13;break}this._externalVideoStream=this._externalVideo.mozCaptureStream(),e.next=14;break;case 13:throw new Error("video.captureStream() not supported");case 14:return e.abrupt("return",this._externalVideoStream);case 15:case"end":return e.stop()}}),e,this)}))),function(){return P.apply(this,arguments)})},{key:"_getWebcamType",value:function(e){return/(back|rear)/i.test(e.label)?(I.debug("_getWebcamType() | it seems to be a back camera"),"back"):(I.debug("_getWebcamType() | it seems to be a front camera"),"front")}},{key:"changeVideoInput",value:(k=(0,s.default)(a.default.mark((function e(t){var r,i,n,s;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,!this._webcamProducer){e.next=8;break}return e.next=4,this._changeVideoInput({resolution:r,deviceId:i,fps:n});case 4:return s=e.sent,e.abrupt("return",s);case 8:return I.error("No webcam producer available!"),e.abrupt("return",{success:!1,reason:"You are not sharing your camera yet. Camera Input can be changed to a new camera only when you are sharing an existing camera. "});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"_changeVideoInput",value:(g=(0,s.default)(a.default.mark((function e(t){var r,i,n,s,o,c;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,I.info("_changeVideoInput() | Inside"),r&&["hd","vga","qvga"].includes(r)?this._webcam.resolution=r:I.warn("Invalid video resolution value "),n&&Number.isInteger(n)&&n<65&&n>5?this.data.inputParams.forceFPS=n:I.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),s=this._deviceList.videoDevices.find((function(e){return i&&e.deviceId===i}))){e.next=8;break}return I.error("The selected deviceId not found!"),e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 8:return this._webcam.device=s,e.prev=9,this._webCamStream.getVideoTracks().forEach((function(e){return e.stop()})),this._webCamStream=null,I.debug("changeVideoInput() | calling getUserMedia()"),e.next=15,navigator.mediaDevices.getUserMedia({video:E(E({deviceId:{ideal:s.deviceId}},D[this._webcam.resolution]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 15:return this._webCamStream=e.sent,o=this._webCamStream.getVideoTracks()[0],I.debug("The new video track is:%O",o),e.next=20,this._webcamProducer.replaceTrack({track:o});case 20:return(c=this._producers.get("video")).deviceLabel=s.label,c.type=this._getWebcamType(s),c.track=this._webcamProducer.track,I.debug("Updated producer values are:%O",c),this._producers.set("video",c),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 30:return e.prev=30,e.t0=e.catch(9),I.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change video input",error:e.t0});case 34:case"end":return e.stop()}}),e,this,[[9,30]])}))),function(e){return g.apply(this,arguments)})},{key:"changeAudioInput",value:(b=(0,s.default)(a.default.mark((function e(t){var r,i,n,s,o,c,d;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,s=t.sampleRate,o=t.channelCount,c=t.deviceId,!this._micProducer){e.next=8;break}return e.next=4,this._changeAudioInput({autoGainControl:r,echoCancellation:i,noiseSuppression:n,sampleRate:s,channelCount:o,deviceId:c});case 4:return d=e.sent,e.abrupt("return",d);case 8:return e.abrupt("return",{success:!1,reason:"You are not sharing your mic yet. Mic Input can be changed to a new mic only when you are sharing an existing mic. "});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"_changeAudioInput",value:(l=(0,s.default)(a.default.mark((function e(t){var r,i,n,s,o,c,d,u,l;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,s=t.sampleRate,o=t.channelCount,c=t.deviceId,r&&"boolean"==typeof r&&(this.data.inputParams.autoGainControl=r),i&&"boolean"==typeof i&&(this.data.inputParams.echoCancellation=Boolean(i)),n&&"boolean"==typeof n&&(this.data.inputParams.noiseSuppression=Boolean(n)),s&&Number.isInteger(s)&&s<64e3&&s>8e3&&(this.data.inputParams.sampleRate=s),o&&Number.isInteger(o)&&o>0&&o<3&&(this.data.inputParams.channelCount=o),d=this._deviceList.audioDevices.find((function(e){return c&&e.deviceId===c}))){e.next=9;break}return e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 9:return this._mic.device=d,this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micStream=null,e.prev=12,e.next=15,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:d.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 15:return this._micStream=e.sent,u=this._micStream.getAudioTracks()[0],this._micProducer.replaceTrack({track:u}),(l=this._producers.get("audio")).deviceLabel=d.label,l.track=this._micProducer.track,I.debug("Updated producer values are:%O",l),this._producers.set("audio",l),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 27:return e.prev=27,e.t0=e.catch(12),I.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change audio input",err:e.t0});case 31:case"end":return e.stop()}}),e,this,[[12,27]])}))),function(e){return l.apply(this,arguments)})},{key:"enableShare",value:(u=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c,d,u,l,h,f,p,m,b=this,g=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=g.length>0&&void 0!==g[0]?g[0]:{}).shareAudio,i=void 0!==r&&r,n=t.enableSharingLayers,s=void 0===n||n,o=t.shareBitRates,c=void 0===o?[2500,1250,500]:o,I.debug("enableShare()"),this.data.inputParams.produce){e.next=7;break}return I.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID003",text:"Error while trying to start screen share. Produce flag need to set to true while joining room in order to enable screen share."});case 7:if("connected"===this._roomStatus){e.next=12;break}return I.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID001",text:"Error while trying to start screen share as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling screen share? OR if you have already initiated the joinRoom process, then try enabling screen share after some seconds."});case 12:if(!this._shareProducer){e.next=17;break}return I.debug("Screen share is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID001",text:"Error while trying to start screen share. Screen share is already active!"});case 17:if(this._device.canProduce("video")){e.next=20;break}return I.error("enableShare() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID002",text:"Error while trying to start screen share. Screen share couldnot be activated due to limitations on this device. If you think this device is capable of screen share and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:return this._enableSharingLayers="boolean"!=typeof s?Boolean(s):s,Array.isArray(c)&&c.length>=1&&c.length<=3&&c.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?this.data.inputParams.shareBitRates=c:this.data.inputParams.shareBitRates=[2500,1250,500],e.prev=22,I.debug("enableShare() | calling getDisplayMedia()"),e.next=26,navigator.mediaDevices.getDisplayMedia({audio:!!i,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});case 26:if(l=e.sent){e.next=31;break}return I.error("Unable to capture screen."),this.emit("error",{code:"EID013",text:"Error while trying to start screen share. Not able to capture screen!"}),e.abrupt("return");case 31:if(!(u=l.getAudioTracks()[0])){e.next=38;break}return e.next=35,this._sendTransport.produce({track:u,codecOptions:this.data.inputParams.forcePCMU?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):void 0});case 35:this._shareAudioProducer=e.sent,this._producers.set("ssAudio",{id:this._shareAudioProducer.id,type:"shareAudio",paused:this._shareAudioProducer.paused,track:this._shareAudioProducer.track,rtpParameters:this._shareAudioProducer.rtpParameters,codec:this._shareAudioProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssAudioStart",{peerId:this.data.inputParams.peerId,audioTrack:this._shareAudioProducer.track,type:"local"});case 38:if(d=l.getVideoTracks()[0],p={videoGoogleStartBitrate:1e3},!this._forceVP8){e.next=46;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=44;break}throw new Error("desired VP8 codec+configuration is not supported");case 44:e.next=59;break;case 46:if(!this._forceH264){e.next=55;break}if("high"===this.data.inputParams.h264Profile?f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),f){e.next=52;break}throw new Error("desired H264 codec+configuration is not supported");case 52:I.debug("Selected h264 codec is:%O",f);case 53:e.next=59;break;case 55:if(!this._forceVP9){e.next=59;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=59;break}throw new Error("desired VP9 codec+configuration is not supported");case 59:return this._enableSharingLayers&&(m=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&f||"video/vp9"===m.mimeType.toLowerCase()?h=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(h=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&h.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&h.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))),e.next=62,this._sendTransport.produce({track:d,encodings:h,codecOptions:p,codec:f,appData:{share:!0}});case 62:this._shareProducer=e.sent,this._producers.set("ssVideo",{id:this._shareProducer.id,type:"shareVideo",paused:this._shareProducer.paused,track:this._shareProducer.track,rtpParameters:this._shareProducer.rtpParameters,codec:this._shareProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssVideoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._shareProducer.track,type:"local"}),this._shareProducer.on("transportclose",(function(){b._shareProducer=null})),this._shareProducer.on("trackended",(function(){b.disableShare().catch((function(){}))})),e.next=74;break;case 69:e.prev=69,e.t0=e.catch(22),I.error("enableShare() | failed:%o",e.t0),"NotAllowedError"!==e.t0.name&&this.emit("error",{code:"EID014",text:"Error while trying to start screen share. Error is: ".concat(e.t0,"!")}),d&&d.stop();case 74:case"end":return e.stop()}}),e,this,[[22,69]])}))),function(){return u.apply(this,arguments)})},{key:"disableShare",value:(n=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("disableShare()"),this._shareProducer){e.next=5;break}return I.warn("Screen share doesn't seem to be on!"),this.emit("error",{code:"EID017",text:"Error while trying to stop screen share. Is the screen share on!"}),e.abrupt("return");case 5:if(this._shareProducer.close(),!this._shareAudioProducer){e.next=17;break}return this._shareAudioProducer.close(),e.prev=8,e.next=11,this._cignal.request("closeProducer",{producerId:this._shareAudioProducer.id});case 11:this.emit("ssAudioStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"}),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(8),this.emit("error",{code:"EID015",text:"Error while trying to stop screen share audio. Error is: ".concat(e.t0,"!")});case 17:return e.prev=17,e.next=20,this._cignal.request("closeProducer",{producerId:this._shareProducer.id});case 20:this.emit("ssVideoStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"}),e.next=26;break;case 23:e.prev=23,e.t1=e.catch(17),this.emit("error",{code:"EID016",text:"Error while trying to stop screen share video. Error is: ".concat(e.t1,"!")});case 26:this._shareAudioProducer=null,this._shareProducer=null;case 28:case"end":return e.stop()}}),e,this,[[8,14],[17,23]])}))),function(){return n.apply(this,arguments)})}],[{key:"listDevices",value:(i=(0,s.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C){e.next=3;break}return I.info("Device list already exists:%O",C),e.abrupt("return",{success:!0,deviceList:C});case 3:return e.next=5,(0,S.loadAllAvailableDevices)();case 5:if(!(t=e.sent).success){e.next=11;break}return C=t.deviceList,e.abrupt("return",{success:!0,deviceList:t.deviceList});case 11:return e.abrupt("return",{success:!1,reason:t.reason});case 12:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"joinRoom",value:(r=(0,s.default)(a.default.mark((function e(){var r,i,n,s,o,c,d,u,l,h,f,m,b,g,S,k,R,P,M,E,x,T,C,D,O,A,L,j,B,N,F,U,q,z,V,G,W,H,K,$,J,Y,X,Z,Q,ee,te,re,ie,ne,ae,se,oe,ce,de,ue,le,he,fe,pe,me,be,ge,ve,ye,_e=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=(r=_e.length>0&&void 0!==_e[0]?_e[0]:{}).sessionToken,n=r.roomId,s=r.peerId,o=r.peerName,c=r.produce,d=void 0===c||c,u=r.produceAudio,l=void 0===u||u,h=r.produceVideo,f=void 0===h||h,m=r.consume,b=void 0===m||m,g=r.videoResolution,S=void 0===g?"hd":g,k=r.forceVp8,R=void 0!==k&&k,P=r.forceVp9,M=void 0!==P&&P,E=r.forceH264,x=void 0!==E&&E,T=r.h264Profile,C=void 0===T?"high":T,D=r.forcePCMU,O=void 0!==D&&D,A=r.forcePCMA,L=void 0!==A&&A,j=r.forceFPS,B=void 0===j?25:j,N=r.enableWebcamLayers,F=void 0===N||N,U=r.numSimulcastStreams,q=void 0===U?3:U,z=r.autoGainControl,V=void 0===z||z,G=r.echoCancellation,W=void 0===G||G,H=r.noiseSuppression,K=void 0===H||H,$=r.sampleRate,J=void 0===$?44e3:$,Y=r.channelCount,X=void 0===Y?1:Y,Z=r.videoBitRates,Q=void 0===Z?[700,250,75]:Z,ee=r.share,te=void 0!==ee&&ee,re=r.shareAudio,ie=void 0!==re&&re,ne=r.enableSharingLayers,ae=void 0===ne||ne,se=r.shareBitRates,oe=void 0===se?[2500,1250,500]:se,ce=r.audioDeviceId,de=void 0===ce?null:ce,ue=r.videoDeviceId,le=void 0===ue?null:ue,i){e.next=3;break}throw new Error("Session token is required to join the room.");case 3:return["hd","vga","qvga"].includes(S)||(I.warn("Invalid video resolution value. setting it to default value of 'hd' "),S="hd"),"boolean"!=typeof d&&(I.warn("Produe should either be true or false"),d=Boolean(d)),"boolean"!=typeof l&&(I.warn("ProduceAudio should either be true or false"),l=Boolean(l)),"boolean"!=typeof f&&(I.warn("ProduceVideo should either be true or false"),f=Boolean(f)),"boolean"!=typeof b&&(I.warn("Consume should either be true or false"),b=Boolean(b)),"boolean"!=typeof R&&(I.warn("forceVp8 should either be true or false"),R=Boolean(R)),"boolean"!=typeof M&&(I.warn("forceVp9 should either be true or false"),M=Boolean(M)),"boolean"!=typeof x&&(I.warn("forceH264 should either be true or false"),x=Boolean(x)),["high","low"].includes(C.toLowerCase())||(I.warn("h264Profile should either be 'high' or 'low'"),C="high"),(!Number.isInteger(B)||Number.isInteger(B)&&(B>65||B<5))&&(I.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),B=25),"boolean"!=typeof F&&(I.warn("enableWebcamLayers should either be true or false"),F=Boolean(F)),(!Number.isInteger(q)||Number.isInteger(q)&&(q>3||q<1))&&(I.warn("numSimulcastStreams should be a number between 1 to 3, default value is 3."),q=3),Array.isArray(Q)&&Q.length>=1&&Q.length<=3&&Q.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?I.debug("videoBitRates values are correct"):(I.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[75,250,75]'"),Q=[75,75,75]),"boolean"!=typeof O&&(I.warn("forcePCMU should either be true or false"),O=Boolean(O)),"boolean"!=typeof L&&(I.warn("forcePCMA should either be true or false"),L=Boolean(L)),"boolean"!=typeof V&&(I.warn("autoGainControl should either be true or false"),V=Boolean(V)),"boolean"!=typeof W&&(I.warn("echoCancellation should either be true or false"),W=Boolean(W)),"boolean"!=typeof K&&(I.warn("noiseSuppression should either be true or false"),K=Boolean(K)),(!Number.isInteger(J)||Number.isInteger(J)&&(J>64e3||J<8e3))&&(I.warn("sampleRate should be a number between 8000 to 64000, default value is 44000 Khz."),J=44e3),(!Number.isInteger(X)||Number.isInteger(X)&&(X>2||X<1))&&(I.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),X=1),"boolean"!=typeof te&&(I.warn("share should either be true or false"),te=Boolean(te)),"boolean"!=typeof ie&&(I.warn("shareAudio should either be true or false"),ie=Boolean(ie)),"boolean"!=typeof ae&&(I.warn("enableSharingLayers should either be true or false"),ae=Boolean(ae)),Array.isArray(oe)&&oe.length>=1&&oe.length<=3&&oe.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?I.debug("shareBitRates values are correct"):(I.warn("sharebitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[2500,1250,500]'"),oe=[2500,1250,500]),e.prev=27,I.info("session token:%s",i),s||(s=(0,y.uuidv4)()),n||(n=(0,v.getRandomInt)()),o||(o=(0,w.default)()),he=p.default.parse(window.navigator.userAgent),fe=he.browser.name,pe=he.browser.version,me=he.os.name,be={name:s,participantType:"moderator",browserName:fe,browserVersion:pe,os:me},I.info("browser details are:%O",he),ge={sessionToken:i,roomId:n,peerId:s,consumerReplicas:0,producer:d,consumer:b,participantData:be},ve={},I.debug("Received input parameters are:%O",ge),e.next=43,(0,_.getVidScaleUrl)(ge);case 43:if(!((ye=e.sent).success&&ye.wsUrl&&ye.core)){e.next=49;break}ve.url=ye.wsUrl,ve.core=ye.core,e.next=51;break;case 49:return I.warn("Vidscale returned success as false. with error:%O",ye),e.abrupt("return",ye);case 51:return I.debug("VidScale url is:",ve.url),e.abrupt("return",new t({peerId:s,roomId:n,peerName:o,produce:d,produceAudio:l,produceVideo:f,consume:b,videoResolution:S,forceVp8:R,forceVp9:M,forceH264:x,h264Profile:C,forceFPS:B,forcePCMU:O,forcePCMA:L,enableWebcamLayers:F,numSimulcastStreams:q,autoGainControl:V,echoCancellation:W,noiseSuppression:K,sampleRate:J,channelCount:X,videoBitRates:Q,share:te,shareAudio:ie,enableSharingLayers:ae,shareBitRates:oe,outputData:ve,audioDeviceId:de,videoDeviceId:le}));case 55:throw e.prev=55,e.t0=e.catch(27),I.error("Failed to join room:",e.t0.message),e.t0;case 59:case"end":return e.stop()}}),e,null,[[27,55]])}))),function(){return r.apply(this,arguments)})}]);var r,i,n,u,l,b,g,k,P,M,T,A,L,j,B,N,F,U,q,z,V,G,W,H}(b.EventEmitter)},{"./Logger":4,"./socket":5,"./utils/chooseMedia":12,"./utils/constants":13,"./utils/getRandomInt":14,"./utils/getVidScaleUrl":16,"./utils/randomName":18,"./utils/uuidv4":20,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/defineProperty":27,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/helpers/typeof":38,"@babel/runtime/regenerator":39,bowser:61,events:91,"mediasoup-client":232}],4:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/helpers/classCallCheck")),a=i(e("@babel/runtime/helpers/createClass")),s=e("debug"),o="VidScale-js",c=function(){return(0,a.default)((function e(t){(0,n.default)(this,e),t?(this._debug=s("".concat(o,":").concat(t)),this._info=s("".concat(o,":INFO:").concat(t)),this._warn=s("".concat(o,":WARN:").concat(t)),this._error=s("".concat(o,":ERROR:").concat(t))):(this._debug=s(o),this._info=s("".concat(o,":INFO")),this._warn=s("".concat(o,":WARN")),this._error=s("".concat(o,":ERROR"))),this._debug.log=console.info.bind(console),this._info.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}),[{key:"debug",get:function(){return this._debug}},{key:"info",get:function(){return this._info}},{key:"warn",get:function(){return this._warn}},{key:"error",get:function(){return this._error}}])}();t.exports=c},{"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/interopRequireDefault":30,debug:104}],5:[function(e,t,r){"use strict";var i=e("./lib/Peer"),n=e("./lib/transports/SocketTransport"),a=e("./lib/transports/WebSocketTransport");r.Peer=i,r.SocketTransport=n,r.WebSocketTransport=a},{"./lib/Peer":8,"./lib/transports/SocketTransport":9,"./lib/transports/WebSocketTransport":10}],6:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits"));function l(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,h()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var f=e("events").EventEmitter,p=e("../../Logger"),m=function(e){function t(e){var r;return(0,s.default)(this,t),(r=l(this,t)).setMaxListeners(1/0),r._logger=e||new p("EnhancedEventEmitter"),r}return(0,u.default)(t,e),(0,o.default)(t,[{key:"safeEmit",value:function(e){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];this.emit.apply(this,[e].concat(r))}catch(t){this._logger.error("safeEmit() | event listener threw an error [event:%s]:%o",e,t)}}},{key:"safeEmitAsPromise",value:(r=(0,a.default)(n.default.mark((function e(t){var r,i,a,s=this,o=arguments;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=o.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=o[a];return e.abrupt("return",new Promise((function(e,r){s.safeEmit.apply(s,[t].concat(i,[e,r]))})));case 2:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})}]);var r}(f);t.exports=m},{"../../Logger":4,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39,events:91}],7:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/helpers/typeof")),a=i(e("@babel/runtime/helpers/classCallCheck")),s=i(e("@babel/runtime/helpers/createClass")),o=e("../../Logger"),c=e("./utils").generateRandomNumber,d=new o("Message"),u=function(){return(0,s.default)((function e(){(0,a.default)(this,e)}),null,[{key:"parse",value:function(e){var t,r={};try{t=JSON.parse(e)}catch(e){return void d.error("parse() | invalid JSON: %s",e)}if("object"===(0,n.default)(t)&&!Array.isArray(t)){if(t.request){if(r.request=!0,"string"!=typeof t.method)return void d.error("parse() | missing/invalid method field");if("number"!=typeof t.id)return void d.error("parse() | missing/invalid id field");r.id=t.id,r.method=t.method,r.data=t.data||{}}else if(t.response){if(r.response=!0,"number"!=typeof t.id)return void d.error("parse() | missing/invalid id field");r.id=t.id,t.ok?(r.ok=!0,r.data=t.data||{}):(r.ok=!1,r.errorCode=t.errorCode,r.errorReason=t.errorReason)}else{if(!t.notification)return void d.error("parse() | missing request/response field");if(r.notification=!0,"string"!=typeof t.method)return void d.error("parse() | missing/invalid method field");r.method=t.method,r.data=t.data||{}}return r}d.error("parse() | not an object")}},{key:"createRequest",value:function(e,t){return{request:!0,id:c(),method:e,data:t||{}}}},{key:"createSuccessResponse",value:function(e,t){return{response:!0,id:e.id,ok:!0,data:t||{}}}},{key:"createErrorResponse",value:function(e,t,r){return{response:!0,id:e.id,ok:!1,errorCode:t,errorReason:r}}},{key:"createNotification",value:function(e,t){return{notification:!0,method:e,data:t||{}}}}])}();t.exports=u},{"../../Logger":4,"./utils":11,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/typeof":38}],8:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits"));function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return h(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function f(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,p()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}var m=e("../../Logger"),b=e("./EnhancedEventEmitter"),g=e("./Message"),v=new m("Peer"),y=function(e){function t(e){var r;return(0,s.default)(this,t),r=f(this,t,[v]),v.debug("constructor()"),r._closed=!1,r._transport=e,r._connected=!1,r._data={},r._sents=new Map,r._handleTransport(),r}return(0,u.default)(t,e),(0,o.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"connected",get:function(){return this._connected}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("cannot override data object")}},{key:"close",value:function(){if(!this._closed){v.debug("close()"),this._closed=!0,this._connected=!1,this._transport.close();var e,t=l(this._sents.values());try{for(t.s();!(e=t.n()).done;){e.value.close()}}catch(e){t.e(e)}finally{t.f()}this.safeEmit("close")}}},{key:"request",value:(i=(0,a.default)(n.default.mark((function e(t){var r,i,a=this,s=arguments;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:void 0,i=g.createRequest(t,r),this._logger.debug("request() [method:%s, id:%s]",t,i.id),e.next=5,this._transport.send(i);case 5:return e.abrupt("return",new Promise((function(e,t){var r=1500*(15+.1*a._sents.size),n={id:i.id,method:i.method,resolve:function(t){a._sents.delete(i.id)&&(clearTimeout(n.timer),e(t))},reject:function(e){a._sents.delete(i.id)&&(clearTimeout(n.timer),t(e))},timer:setTimeout((function(){a._sents.delete(i.id)&&t(new Error("request timeout"))}),r),close:function(){clearTimeout(n.timer),t(new Error("peer closed"))}};a._sents.set(i.id,n)})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"notify",value:(r=(0,a.default)(n.default.mark((function e(t){var r,i,a=arguments;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:void 0,i=g.createNotification(t,r),this._logger.debug("notify() [method:%s]",t),e.next=5,this._transport.send(i);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_handleTransport",value:function(){var e=this;if(this._transport.closed)return this._closed=!0,void setTimeout((function(){e._closed||(e._connected=!1,e.safeEmit("close"))}));this._transport.on("open",(function(){e._closed||(v.debug('emit "open"'),e._connected=!0,e.safeEmit("open"))})),this._transport.on("disconnected",(function(){e._closed||(v.debug('emit "disconnected"'),e._connected=!1,e.safeEmit("disconnected"))})),this._transport.on("failed",(function(t){e._closed||(v.debug('emit "failed" [currentAttempt:%s]',t),e._connected=!1,e.safeEmit("failed",t))})),this._transport.on("close",(function(){e._closed||(e._closed=!0,v.debug('emit "close"'),e._connected=!1,e.safeEmit("close"))})),this._transport.on("message",(function(t){t.request?e._handleRequest(t):t.response?e._handleResponse(t):t.notification&&e._handleNotification(t)}))}},{key:"_handleRequest",value:function(e){var t=this;try{this.emit("request",e,(function(r){var i=g.createSuccessResponse(e,r);t._transport.send(i).catch((function(){}))}),(function(r,i){r instanceof Error?(i=r.message,r=500):"number"==typeof r&&i instanceof Error&&(i=i.message);var n=g.createErrorResponse(e,r,i);t._transport.send(n).catch((function(){}))}))}catch(t){var r=g.createErrorResponse(e,500,String(t));this._transport.send(r).catch((function(){}))}}},{key:"_handleResponse",value:function(e){var t=this._sents.get(e.id);if(t)if(e.ok)t.resolve(e.data);else{var r=new Error(e.errorReason);r.code=e.errorCode,t.reject(r)}else v.error("received response does not match any sent request [id:%s]",e.id)}},{key:"_handleNotification",value:function(e){this.safeEmit("notification",e)}}]);var r,i}(b);t.exports=y},{"../../Logger":4,"./EnhancedEventEmitter":6,"./Message":7,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39}],9:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits"));function l(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,h()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var f=e("socket.io-client"),p=e("../utils").sleep,m=e("../../../Logger"),b=e("../EnhancedEventEmitter"),g=e("../Message"),v=new m("WebSocketTransport"),y=function(e){function t(e,r){var i;return(0,s.default)(this,t),i=l(this,t,[v]),v.debug("constructor() [url:%s, options:%o]",e,r),i._closed=!1,i._url=e,i._connected=!1,i._params=r||{},i._socket=null,i._createSocket(),i}return(0,u.default)(t,e),(0,o.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"close",value:function(){if(!this._closed){v.debug("close()"),this._closed=!0,this.safeEmit("close");try{this._socket.disconnect()}catch(e){v.error("close() | error closing the WebSocket: %o",e)}}}},{key:"send",value:(r=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=2;break}throw new Error("transport closed");case 2:e.prev=2,this._socket.send(JSON.stringify(t)),e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(2),v.warn("send() failed:%o",e.t0),e.t0;case 10:case"end":return e.stop()}}),e,this,[[2,6]])}))),function(e){return r.apply(this,arguments)})},{key:"_createSocket",value:function(){var e=this;if(!this._url)throw new Error("Cannot create socket without a valid connection url");var t=f(this._url,{rejectUnauthorized:!1});t.on("connect",(function(){e._connected?v.debug("Socket already connected!"):(v.debug("connected to socket"),e._connected=!0,e.safeEmit("open"))})),t.on("disconnect",(0,a.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v.error("socket disconnected!"),e._connected=!1,e.safeEmit("disconnected"),!e._closed){t.next=7;break}v.debug("No need to reconnect for roomClient close!"),t.next=16;break;case 7:if(!(e._reconnectionCounter>240)){t.next=10;break}return v.debug("Reconnection not needed if user disconnection for more than 2 minutes, reconnection counter:",e._reconnectionCounter),t.abrupt("return");case 10:return e._socket.close(),e._socket=null,e._createSocket(),e._reconnectionCounter+=1,t.next=16,p(500);case 16:case"end":return t.stop()}}),t)})))),t.on("reconnect",(function(){v.debug("socket reconnected after disconnect"),e.safeEmit("reconnect")})),t.on("connect_error",(function(t){v.error("socket connect error",t),e._connected=!1})),t.on("error",(function(t){v.error("Socket error",t),e._connected=!1,e.safeEmit("failed")})),t.on("message",(function(t){if(!e._closed){var r=g.parse(t);r&&(0!==e.listenerCount("message")?e.safeEmit("message",r):v.error('no listeners for WebSocket "message" event, ignoring received message'))}})),this._socket=t}}]);var r}(b);t.exports=y},{"../../../Logger":4,"../EnhancedEventEmitter":6,"../Message":7,"../utils":11,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39,"socket.io-client":298}],10:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits")),l=i(e("@babel/runtime/helpers/defineProperty"));function h(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,f()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}var p=e("../EnhancedEventEmitter"),m=e("../utils").sleep,b=new(e("../../../Logger"))("WebsocketTransport"),g=function(e){function t(e,r){var i;return(0,s.default)(this,t),i=h(this,t,[b]),(0,l.default)(i,"createAndUpdateSocket",function(){var e=(0,a.default)(n.default.mark((function e(t){var r,a,s,o,c;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.connectionType,a=void 0===r?null:r,b.info("Room close status:%s",i._closed),s=i,!i._closed){e.next=6;break}return b.info("Websocket already closed!"),e.abrupt("return");case 6:if(i._url){e.next=9;break}return b.warn("url not available!"),e.abrupt("return");case 9:o=null===a?"".concat(i._url,"&connectionType=","landing"):"".concat(i._url,"&connectionType=").concat(a),b.debug("the url is:%s",o),i._ws=new WebSocket(o),c=0,b.debug("websocketHelper createAndUpdateSocket created a new websocket"),b.debug("websocketHelper createAndUpdateSocket:%s",i._ws.readyState);case 15:if(1===i._ws.readyState||!i._socketShouldReconnect){e.next=30;break}if(3!==i._ws.readyState){e.next=22;break}return b.debug("websocketHelper createAndUpdateSocket"),e.next=20,m(2e3);case 20:i._ws=new WebSocket(o),b.debug("websocketHelper createAndUpdateSocket newly created websocket state:%s",i._ws.readyState);case 22:return e.next=24,m(500);case 24:if(!(++c>250)){e.next=28;break}return b.error("No of retries limit to connect with server exhausted!"),e.abrupt("break",30);case 28:e.next=15;break;case 30:1===i._ws.readyState&&b.debug("updated the websocket with ready state -".concat(i._ws.readyState)),i.safeEmit("connected"),b.debug("updating the websocket to redux store with ready state -".concat(i._ws.readyState)),i._ws.onopen=function(){i._closed||(b.debug("Websocket open"),i.safeEmit("open"))},i._isConnected=!0,i._ws.onmessage=function(e){if(!i._closed){var t=JSON.parse(e.data);switch(t.id){case"ping":i._lastTimerId&&clearTimeout(i._lastTimerId);var r=i;i._lastTimerId=setTimeout((function(){r._isConnected=!1,this._roomJoined?r.close(4104,"In call connections close as server is unreachable for last 5 seconds!"):r.close(4103,"Landing page socket close by client as server not reachable for a couple of seconds!"),r._socketShouldReconnect&&(r._closed=!1,r.createAndUpdateSocket({connectionType:"inCall"}))}),22e3);i._ws.send(JSON.stringify({id:"pong"}));break;case"invalidToken":b.debug("Session token invalid!"),i._socketShouldReconnect=!1,i.safeEmit("invalidToken",t);break;case"alreadyActive":i.safeEmit("alreadyActive",t);break;case"passwordDisabled":i.safeEmit("passwordDisabled",t);break;case"notify":i.safeEmit("notify",t.data);break;case"remotePeerJoin":i.safeEmit("roomStartedP2p",t);break;case"userError":i.safeEmit("userError",t);break;case"validationAlert":i.safeEmit("validationError",t);break;case"joinStatusOnLanding":i.safeEmit("defaultJoinStatus",t);break;default:i.safeEmit("message",t)}}},i._ws.onclose=function(e){s._closed||(b.warn('WebSocket "close" event [wasClean:%s, code:%s, reason:"%s"]',e.wasClean,e.code,e.reason),4503===e.code||4504===e.code?(b.error("Socket closed with reason",e.reason),s._closed=!0):4500!==e.code&&(b.debug("trying to reconnect:%s",e.code),s._closed=!1,i._roomJoined?(b.debug("Trying to join after a network reset while in a meeting"),s.createAndUpdateSocket({connectionType:"inCall"})):(b.debug("Trying to join after a network reset while on the landing page"),s.createAndUpdateSocket({connectionType:null})),clearTimeout(s._lastTimerId)),i._url=null,b.info("The websocket closed status is:%s",s._closed),s.safeEmit("close",{code:e.code,reason:e.reason}))};case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),i._closed=!1,i._url=e,i._ws=null,i._socketShouldReconnect=r,i._isConnected=!1,i._lastTimerId=null,i._roomJoined=!1,b.info("Request received to instantiate websocket transport! with url :%s",e),i.createAndUpdateSocket({connectionType:null}),i}return(0,u.default)(t,e),(0,o.default)(t,[{key:"connectionStatus",get:function(){return this._isConnected}},{key:"close",value:function(e,t){if(!this._closed){b.info("close()"),this._closed=!0,this.safeEmit("close",{code:e,reason:t});try{this._ws.onopen=null,this._ws.onclose=null,this._ws.onerror=null,this._ws.onmessage=null,clearTimeout(this._lastTimerId),e&&t?this._ws.close(e,t):this._ws.close()}catch(e){b.error("close() | error closing the WebSocket: %o",e)}}}},{key:"send",value:(r=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=3;break}return b.error("Transport closed or not yet ready. Try again later!"),e.abrupt("return");case 3:e.prev=3,this._ws.send(JSON.stringify(t)),e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(3),b.warn("send() failed:%o",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return r.apply(this,arguments)})}]);var r}(p);t.exports=g},{"../../../Logger":4,"../EnhancedEventEmitter":6,"../utils":11,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/defineProperty":27,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39}],11:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator"));r.generateRandomNumber=function(){return Math.round(1e7*Math.random())},r.sleep=function(){var e=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return setTimeout((function(){return e()}),t)})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],12:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.updatedDeviceList=r.loadAllAvailableDevices=r.getDeviceId=r.chooseMediaLabelVideo=r.chooseMediaLabelAudioOutput=r.chooseMediaLabelAudio=r.chooseMediaLabel=void 0;var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=new(i(e("../Logger")).default)("device-manager"),o=(r.chooseMediaLabel=function(){var e=(0,a.default)(n.default.mark((function e(){var t,r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var i=void 0!==e.find((function(e){return"videoinput"===e.kind})),n=void 0!==e.find((function(e){return"audioinput"===e.kind}));return new Promise((function(e,a){navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(i){navigator.mediaDevices.enumerateDevices().then((function(n){n.forEach((function(e){"audioinput"===e.kind&&("videoinput"===e.kind?(t.push(e.label),r.push(e.label)):r.push(e.label))})),i.getTracks().forEach((function(e){e.stop()})),r.length>0&&(t.length>0?e({videoLabels:t,audioLabels:r}):e({audioLabels:r}))}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),r.chooseMediaLabelAudio=function(){var e=(0,a.default)(n.default.mark((function e(){var t;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var r=void 0!==e.find((function(e){return"audioinput"===e.kind}));return new Promise((function(e,i){navigator.mediaDevices.getUserMedia({audio:r}).then((function(r){navigator.mediaDevices.enumerateDevices().then((function(i){i.forEach((function(e,r){if("audioinput"===e.kind){var i=e.label||"Mic ".concat(Number(r)+1);t.push({label:i,deviceId:e.deviceId})}})),r.getTracks().forEach((function(e){e.stop()})),e({audioDevices:t})}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),c=r.chooseMediaLabelAudioOutput=function(){var e=(0,a.default)(n.default.mark((function e(){var t;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var r=void 0!==e.find((function(e){return"audiooutput"===e.kind}));return new Promise((function(e,i){navigator.mediaDevices.getUserMedia({audio:r}).then((function(r){navigator.mediaDevices.enumerateDevices().then((function(i){i.forEach((function(e,r){if("audiooutput"===e.kind){var i=e.label||"Speaker ".concat(Number(r)+1);t.push({label:i,deviceId:e.deviceId})}})),r.getTracks().forEach((function(e){e.stop()})),e({audioDevicesOutput:t})}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),d=r.chooseMediaLabelVideo=function(){var e=(0,a.default)(n.default.mark((function e(){var t;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var r=void 0!==e.find((function(e){return"videoinput"===e.kind}));return new Promise((function(e,i){navigator.mediaDevices.getUserMedia({video:r}).then((function(r){navigator.mediaDevices.enumerateDevices().then((function(i){i.forEach((function(e,r){if("videoinput"===e.kind){var i=e.label||"Camera ".concat(Number(r)+1);t.push({label:i,deviceId:e.deviceId})}})),r.getTracks().forEach((function(e){e.stop()})),e({videoDevices:t})}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();r.getDeviceId=function(e){return new Promise((function(t){s.info("chooseMedia label->:%s",e),navigator.mediaDevices.enumerateDevices().then((function(r){r.forEach((function(r){r.label===e&&t(r.deviceId)})),r[0].label||t({error:"noLabel",reason:"Device label names not found!"})})).catch((function(e){s.error("err.name:%O ",e.message),t({error:e.name,reason:e.message})}))}))},r.updatedDeviceList=function(){var e=(0,a.default)(n.default.mark((function e(){var t,r,i;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=[],i=[],e.abrupt("return",new Promise((function(e,n){navigator.mediaDevices.enumerateDevices().then((function(n){n.forEach((function(e,n){if("audioinput"===e.kind){var a=e.label||"Mic ".concat(Number(n)+1);r.push({label:a,deviceId:e.deviceId})}if("videoinput"===e.kind){var s=e.label||"Camera ".concat(Number(n)+1);t.push({label:s,deviceId:e.deviceId})}if("audiooutput"===e.kind){var o=e.label||"Speaker ".concat(Number(n)+1);i.push({label:o,deviceId:e.deviceId})}})),e({audioDevices:r,audioDevicesOutput:i,videoDevices:t})}))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),r.loadAllAvailableDevices=function(){var e=(0,a.default)(n.default.mark((function e(){var t,r,i,a,s,u;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={videoDevices:[],audioDevices:[],audioOutputDevices:[]},e.next=3,d();case 3:if(r=e.sent,i=null,!r.error){e.next=21;break}e.t0=r.error,e.next="TypeError"===e.t0?9:"AbortError"===e.t0?10:"NotAllowedError"===e.t0?12:"NotFoundError"===e.t0?14:"NotReadableError"===e.t0?16:18;break;case 9:return e.abrupt("break",18);case 10:return i="".concat(r.error," : ").concat(r.reason,"!! Your Camera is currently being used !! If you wish to join the room with video, please close the other tab / browser wherever it is being used and refresh this page!!"),e.abrupt("break",18);case 12:return i="".concat(r.error," : ").concat(r.reason,'!! You have denied the access to your Camera!! If you wish to join the room with video, please allow the camera access by clicking on the camera icon in the address bar Or by going to " chrome://settings/content#media-stream-mic " link in your chrome.'),e.abrupt("break",18);case 14:return i="".concat(r.error," : ").concat(r.reason,"!! No Camera could be found!! If you have a camera or microphone in your computer but it is not able to detect them, please refresh your browser again or restart the browser after closing all the opened tabs."),e.abrupt("break",18);case 16:return i="".concat(r.error," : ").concat(r.reason,"!! If you have a camera in your computer but it is not able to detect it as it may have been used by some other browser / tab, please refresh your browser again after closing the tab using the camera or restart the browser after closing all the opened tabs."),e.abrupt("break",18);case 18:return e.abrupt("return",{success:!1,reason:{code:"EDV01",type:"DeviceError",text:i}});case 21:r.videoDevices&&r.videoDevices.length>0&&(t.videoDevices=r.videoDevices);case 22:return e.next=24,o();case 24:if(a=e.sent,s=null,!a.error){e.next=39;break}e.t1=a.error,e.next="NotAllowedError"===e.t1?30:"NotFoundError"===e.t1?32:"NotReadableError"===e.t1?34:36;break;case 30:return s="".concat(a.error," : ").concat(a.reason,'!! You have denied the access to your Mic!! If you wish to join the room with video, please allow the camera access by clicking on the camera icon in the address bar Or by going to " chrome://settings/content#media-stream-mic " link in your chrome.'),e.abrupt("break",36);case 32:return s="".concat(a.error," : ").concat(a.reason,"!! No Microphone could be found!! If you have a camera or microphone in your computer but it is not able to detect them, please refresh your browser again or restart the browser after closing all the opened tabs."),e.abrupt("break",36);case 34:return s="".concat(a.error," : ").concat(a.reason,"!! A hardware error occured at the OS OR browser Or Webpage level. If you have a microphone in your computer but it is not able to detect them, please refresh your browser again or restart the browser after closing all the opened tabs."),e.abrupt("break",36);case 36:return e.abrupt("return",{success:!1,reason:{code:"EDA01",type:"DeviceError",text:s}});case 39:a.audioDevices&&a.audioDevices.length>0&&(t.audioDevices=a.audioDevices);case 40:return e.next=42,c();case 42:if(!(u=e.sent).error){e.next=47;break}return e.abrupt("return",{success:!1,reason:{code:"EDAO01",type:"DeviceError",text:"Some error occured while accessing your speaker. Please try again again after some time."}});case 47:u.audioDevicesOutput&&u.audioDevicesOutput.length>0&&(t.audioOutputDevices=u.audioDevicesOutput);case 48:return e.abrupt("return",{success:!0,deviceList:t});case 49:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{"../Logger":4,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r._security=r.USER_TYPE_REGULAR=r.USER_TYPE_PRESENTER=r.USER_TYPE_MODERATOR=r.USER_TYPE_BOT=r.USER_TYPE_ADMIN=r.TOTAL_RECORDING_SPACE_AVAILABLE=r.STREAM_TYPE_SCREEN_VIDEO=r.STREAM_TYPE_SCREEN_AUDIO=r.STREAM_TYPE_CAM_VIDEO=r.STREAM_TYPE_CAM_AUDIO=r.STAGE=r.RTMPSTREAMANDRECORD=r.RTMPSTREAM=r.ROOM_STATUS_ENUM_OCUPIED=r.ROOM_STATUS_ENUM_FREE=r.ROOM_LEAVE_ONLY=r.ROOM_LEAVE_AND_CLOSE=r.ROOM_CLOSE_TYPE_CLIENT=r.ROOMTYPE_P2P=r.ROOMTYPE_EVENT=r.ROOMTYPE_CONFERENCING=r.RECORD=r.PROCESS=r.PARTICIPANT=r.MSG_TYPE_PUBLIC=r.MSG_TYPE_PRIVATE=r.MSG_SENDER_TYPE_VIEWER=r.MSG_SENDER_TYPE_PRESENTER=r.MSG_SENDER_TYPE_MODERATOR=r.MSG_SENDER_TYPE_EVERYBODY=r.MSG_DIRECTION_SEND=r.MSG_DIRECTION_RECV=r.MERGEA=r.MERGE=r.CLOUD_DO=r.CLOUD_AWS=r.BACK_STAGE=r.AMERGEA=r.AMERGE=void 0;r._security={roomType:{P2P:"p2p",CONFERENCING:"conferencing"},baseURL:"",vidScaleURL:"autoscalerv1.videoedge.io/api/vidScale/allocateResources",autoscalerURL:"autoscaler.samvyo.com",dashboardURL:"https://api.samvyo.com/api/callStats/verifySessionToken"},r.MSG_SENDER_TYPE_PRESENTER="participant",r.MSG_SENDER_TYPE_VIEWER="viewer",r.MSG_SENDER_TYPE_EVERYBODY="everybody",r.MSG_SENDER_TYPE_MODERATOR="moderator",r.MSG_TYPE_PRIVATE="private",r.MSG_TYPE_PUBLIC="public",r.MSG_DIRECTION_SEND="send",r.MSG_DIRECTION_RECV="recv",r.STREAM_TYPE_CAM_AUDIO="cam-audio",r.STREAM_TYPE_CAM_VIDEO="cam-video",r.STREAM_TYPE_SCREEN_AUDIO="screen-audio",r.STREAM_TYPE_SCREEN_VIDEO="screen-video",r.ROOM_STATUS_ENUM_FREE="free",r.ROOM_STATUS_ENUM_OCUPIED="occupied",r.ROOM_LEAVE_ONLY="leaveRoomNew",r.ROOM_LEAVE_AND_CLOSE="leaveAndCloseRoom",r.TOTAL_RECORDING_SPACE_AVAILABLE=256,r.USER_TYPE_ADMIN="admin",r.USER_TYPE_MODERATOR="moderator",r.USER_TYPE_PRESENTER="presenter",r.PARTICIPANT="participant",r.USER_TYPE_REGULAR="r",r.USER_TYPE_BOT="b",r.ROOMTYPE_P2P="p2p",r.ROOMTYPE_CONFERENCING="conferencing",r.ROOMTYPE_EVENT="event",r.ROOM_CLOSE_TYPE_CLIENT="client",r.CLOUD_AWS="aws",r.CLOUD_DO="do",r.STAGE="Stage",r.BACK_STAGE="Back-Stage",r.RECORD="record",r.RTMPSTREAM="rtmpStream",r.RTMPSTREAMANDRECORD="rtmpStreamAndRecord",r.PROCESS="process",r.MERGE="mergedAV",r.MERGEA="mergedA",r.AMERGE="AmergedAV",r.AMERGEA="AmergedA"},{}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getRandomInt=void 0;r.getRandomInt=function(){return Math.floor(1e10*Math.random())}},{}],15:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.VIDEO_ONLY_CONSTRAINTS=r.SCREEN_VIDEO_SIMULCAST_ENCODINGS=r.GENERAL_SCREENSHARE_CONSTRAINTS=r.GENERAL_AUDIO_VIDEO_CONSTRAINTS=r.GENERAL_AUDIO_ONLY_CONSTRAINTS=r.CAM_VIDEO_SIMULCAST_RECEIVE_MEDIUM=r.CAM_VIDEO_SIMULCAST_RECEIVE_LOW=r.CAM_VIDEO_SIMULCAST_ENCODINGS=r.AUDIO_VIDEO_CONSTRAINTS=r.AUDIO_ONLY_CONSTRAINTS=void 0;r.GENERAL_AUDIO_VIDEO_CONSTRAINTS={audio:!0,video:{width:{min:320,ideal:1280,max:1280},height:{min:240,ideal:720,max:720},aspectRatio:1.777777778,frameRate:{min:15,max:30}}},r.GENERAL_SCREENSHARE_CONSTRAINTS={audio:!1,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}},r.GENERAL_AUDIO_ONLY_CONSTRAINTS={audio:!0,video:!1},r.AUDIO_ONLY_CONSTRAINTS={audio:{deviceId:{exact:void 0}},video:!1},r.VIDEO_ONLY_CONSTRAINTS={audio:!1,video:{deviceId:{exact:void 0},width:{min:320,ideal:1280,max:1280},height:{min:240,ideal:720,max:720},aspectRatio:1.777777778,frameRate:{min:15,max:30}}},r.AUDIO_VIDEO_CONSTRAINTS={audio:{deviceId:{exact:void 0}},video:{deviceId:{exact:void 0},width:{min:320,ideal:1280,max:1280},height:{min:240,ideal:720,max:720},aspectRatio:1.777777778,frameRate:{min:15,max:30}}},r.CAM_VIDEO_SIMULCAST_ENCODINGS=[{maxBitrate:5e5,scaleResolutionDownBy:4,scalabilityMode:"L1T3"},{maxBitrate:1e6,scaleResolutionDownBy:2,scalabilityMode:"L1T3"},{maxBitrate:5e6,scaleResolutionDownBy:1,scalabilityMode:"L1T3"}],r.SCREEN_VIDEO_SIMULCAST_ENCODINGS=[{dtx:!0,maxBitrate:15e5},{dtx:!0,maxBitrate:6e6}],r.CAM_VIDEO_SIMULCAST_RECEIVE_LOW={spatialLayer:0,temporalLayer:0},r.CAM_VIDEO_SIMULCAST_RECEIVE_MEDIUM={spatialLayer:1,temporalLayer:1}},{}],16:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.getVidScaleUrl=function(e){return c.apply(this,arguments)};var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("axios/dist/browser/axios.cjs")),o=i(e("./constants"));new(i(e("../Logger")).default)("vidscale-url");function c(){return(c=(0,a.default)(n.default.mark((function e(t){var r,i,a,s,o,c,u,l,h,f,p;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sessionToken,i=t.roomId,a=t.peerId,s=t.consumerReplicas,o=t.producer,c=void 0===o||o,u=t.consumer,l=void 0===u||u,h=t.participantData,e.next=3,d({sessionToken:r,roomId:i,peerId:a,producer:c,consumer:l,participantData:h});case 3:if(!(f=e.sent).success){e.next=8;break}return e.abrupt("return",{success:!0,wsUrl:"wss://".concat(f.data.url,"/?roomId=").concat(i,"&peerId=").concat(a,"&consumerReplicas=").concat(s),roomUrl:"https://".concat(f.data.url),core:f.data.core});case 8:return p={success:!1,errorText:f.data.reason,errorCode:f.data.code},e.abrupt("return",p);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=function(){var e=(0,a.default)(n.default.mark((function e(t){var r,i,a,c,d,u,l;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.roomId,i=t.peerId,a=t.producer,c=t.consumer,d=t.sessionToken,u=t.participantData,e.next=3,s.default.post("".concat(o.default._security.vidScaleURL),{roomId:r,peerId:i,producer:a,consumer:c,sessionToken:d,participantData:u});case 3:return l=e.sent,e.abrupt("return",new Promise((function(e){try{e(l.data)}catch(e){}})));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{"../Logger":4,"./constants":13,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39,"axios/dist/browser/axios.cjs":58}],17:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.SocketQueue=void 0;var n=i(e("@babel/runtime/helpers/classCallCheck")),a=i(e("@babel/runtime/helpers/createClass"));r.SocketQueue=function(){return(0,a.default)((function e(){(0,n.default)(this,e),this.queue=new Map}),[{key:"push",value:function(e,t){this.queue.set(e,t)}},{key:"get",value:function(e){return this.queue.get(e)}},{key:"remove",value:function(e){this.queue.delete(e)}}])}()},{"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/interopRequireDefault":30}],18:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){return n.random("en")};var n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=i(e)&&"function"!=typeof e)return{default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var c=s?Object.getOwnPropertyDescriptor(e,o):null;c&&(c.get||c.set)?Object.defineProperty(n,o,c):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}(e("pokemon"));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}},{"@babel/runtime/helpers/typeof":38,pokemon:255}],19:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.sleep=void 0;var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator"));r.sleep=function(){var e=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return setTimeout((function(){return e()}),t)})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],20:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.uuidv4=void 0;r.uuidv4=function(){return"111-111-1111".replace(/[018]/g,(function(){return(15&crypto.getRandomValues(new Uint8Array(1))[0]).toString(16)}))}},{}],21:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ALLOWED_QUALITIES=void 0,r.isValidOutputQualities=function(e){if(!Array.isArray(e))return!1;return e.every((function(e){return i.has(e)}))};var i=r.ALLOWED_QUALITIES=new Set(["240p","360p","480p","720p","1080p","1440p","2160p"])},{}],22:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.allowedTypes=void 0,r.verifyFiles=function(e){return l.apply(this,arguments)};var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator"));function s(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}var c=new(e("../Logger"))("utils-verifyFiles"),d=r.allowedTypes=["mp4"];function u(e,t){try{return new URL(e).pathname.split(".").pop().toLowerCase()===t.toLowerCase()}catch(e){return!1}}function l(){return(l=(0,a.default)(n.default.mark((function e(t){var r,i,a,o,l;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.info("The input files are:%o, length:%s",t,t.length),!(t.length>0)){e.next=28;break}c.info("Files array length is:%s",t.length),r=s(t),e.prev=4,r.s();case 6:if((i=r.n()).done){e.next=17;break}if(a=i.value,o=a.type,l=a.url,c.info("The file detais are type:%s, url:%s",o,l),d.includes(o)){e.next=12;break}return console.warn('Type "'.concat(o,'" is not allowed.')),e.abrupt("return",{success:!1,reason:'Type "'.concat(o,'" is not allowed.')});case 12:if(u(l,o)){e.next=15;break}return console.warn("Extension mismatch for ".concat(l,"; expected .").concat(o)),e.abrupt("return",{success:!1,reason:"Extension mismatch for ".concat(l,"; expected .").concat(o)});case 15:e.next=6;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(4),r.e(e.t0);case 22:return e.prev=22,r.f(),e.finish(22);case 25:return e.abrupt("return",{success:!0});case 28:return e.abrupt("return",{success:!1,reason:"There are no files for processing!"});case 29:case"end":return e.stop()}}),e,null,[[4,19,22,25]])})))).apply(this,arguments)}},{"../Logger":4,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],23:[function(e,t,r){t.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},t.exports.__esModule=!0,t.exports.default=t.exports},{}],24:[function(e,t,r){function i(e,t,r,i,n,a,s){try{var o=e[a](s),c=o.value}catch(e){return void r(e)}o.done?t(c):Promise.resolve(c).then(i,n)}t.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var s=e.apply(t,r);function o(e){i(s,n,a,o,c,"next",e)}function c(e){i(s,n,a,o,c,"throw",e)}o(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],25:[function(e,t,r){t.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},{}],26:[function(e,t,r){var i=e("./toPropertyKey.js");function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}t.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPropertyKey.js":37}],27:[function(e,t,r){var i=e("./toPropertyKey.js");t.exports=function(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPropertyKey.js":37}],28:[function(e,t,r){function i(e){return t.exports=i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t.exports.__esModule=!0,t.exports.default=t.exports,i(e)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{}],29:[function(e,t,r){var i=e("./setPrototypeOf.js");t.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./setPrototypeOf.js":35}],30:[function(e,t,r){t.exports=function(e){return e&&e.__esModule?e:{default:e}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],31:[function(e,t,r){var i=e("./objectWithoutPropertiesLoose.js");t.exports=function(e,t){if(null==e)return{};var r,n,a=i(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a},t.exports.__esModule=!0,t.exports.default=t.exports},{"./objectWithoutPropertiesLoose.js":32}],32:[function(e,t,r){t.exports=function(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;r[i]=e[i]}return r},t.exports.__esModule=!0,t.exports.default=t.exports},{}],33:[function(e,t,r){var i=e("./typeof.js").default,n=e("./assertThisInitialized.js");t.exports=function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./assertThisInitialized.js":23,"./typeof.js":38}],34:[function(e,t,r){var i=e("./typeof.js").default;function n(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},a=Object.prototype,s=a.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},d=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,r){return e[t]=r}}function f(e,t,r,i){var n=t&&t.prototype instanceof _?t:_,a=Object.create(n.prototype),s=new O(i||[]);return o(a,"_invoke",{value:T(e,r,s)}),a}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=f;var m="suspendedStart",b="suspendedYield",g="executing",v="completed",y={};function _(){}function w(){}function S(){}var k={};h(k,d,(function(){return this}));var R=Object.getPrototypeOf,P=R&&R(R(A([])));P&&P!==a&&s.call(P,d)&&(k=P);var M=S.prototype=_.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,a,o,c){var d=p(e[n],e,a);if("throw"!==d.type){var u=d.arg,l=u.value;return l&&"object"==i(l)&&s.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,c)}),(function(e){r("throw",e,o,c)})):t.resolve(l).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,c)}))}c(d.arg)}var n;o(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(a,a):a()}})}function T(t,r,i){var n=m;return function(a,s){if(n===g)throw Error("Generator is already running");if(n===v){if("throw"===a)throw s;return{value:e,done:!0}}for(i.method=a,i.arg=s;;){var o=i.delegate;if(o){var c=C(o,i);if(c){if(c===y)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===m)throw n=v,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=g;var d=p(t,r,i);if("normal"===d.type){if(n=i.done?v:b,d.arg===y)continue;return{value:d.arg,done:i.done}}"throw"===d.type&&(n=v,i.method="throw",i.arg=d.arg)}}}function C(t,r){var i=r.method,n=t.iterator[i];if(n===e)return r.delegate=null,"throw"===i&&t.iterator.return&&(r.method="return",r.arg=e,C(t,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),y;var a=p(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var s=a.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function A(t){if(t||""===t){var r=t[d];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(s.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(i(t)+" is not iterable")}return w.prototype=S,o(M,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=h(S,l,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,h(e,l,"GeneratorFunction")),e.prototype=Object.create(M),e},r.awrap=function(e){return{__await:e}},E(x.prototype),h(x.prototype,u,(function(){return this})),r.AsyncIterator=x,r.async=function(e,t,i,n,a){void 0===a&&(a=Promise);var s=new x(f(e,t,i,n),a);return r.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},E(M),h(M,l,"Generator"),h(M,d,(function(){return this})),h(M,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var i in t)r.push(i);return r.reverse(),function e(){for(;r.length;){var i=r.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},r.values=A,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var r in this)"t"===r.charAt(0)&&s.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(i,n){return o.type="throw",o.arg=t,r.next=i,n&&(r.method="next",r.arg=e),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),d=s.call(a,"finallyLoc");if(c&&d){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!d)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var n=i;break}}n&&("break"===e||"continue"===e)&&n.tryLoc<=t&&t<=n.finallyLoc&&(n=null);var a=n?n.completion:{};return a.type=e,a.arg=t,n?(this.method="next",this.next=n.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;D(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,r,i){return this.delegate={iterator:A(t),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=e),y}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},{"./typeof.js":38}],35:[function(e,t,r){function i(e,r){return t.exports=i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t.exports.__esModule=!0,t.exports.default=t.exports,i(e,r)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{}],36:[function(e,t,r){var i=e("./typeof.js").default;t.exports=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./typeof.js":38}],37:[function(e,t,r){var i=e("./typeof.js").default,n=e("./toPrimitive.js");t.exports=function(e){var t=n(e,"string");return"symbol"==i(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPrimitive.js":36,"./typeof.js":38}],38:[function(e,t,r){function i(e){return t.exports=i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,i(e)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{}],39:[function(e,t,r){var i=e("../helpers/regeneratorRuntime")();t.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},{"../helpers/regeneratorRuntime":34}],40:[function(e,t,r){function i(e){if(e)return function(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}(e)}r.Emitter=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},i.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n=0;n<i.length;n++)if((r=i[n])===t||r.fn===t){i.splice(n,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},i.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(r){i=0;for(var n=(r=r.slice(0)).length;i<n;++i)r[i].apply(this,t)}return this},i.prototype.emitReserved=i.prototype.emit,i.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},i.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],41:[function(e,t,r){var i=r;i.bignum=e("bn.js"),i.define=e("./asn1/api").define,i.base=e("./asn1/base"),i.constants=e("./asn1/constants"),i.decoders=e("./asn1/decoders"),i.encoders=e("./asn1/encoders")},{"./asn1/api":42,"./asn1/base":44,"./asn1/constants":48,"./asn1/decoders":50,"./asn1/encoders":53,"bn.js":55}],42:[function(e,t,r){var i=e("../asn1"),n=e("inherits");function a(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}r.define=function(e,t){return new a(e,t)},a.prototype._createNamed=function(t){var r;try{r=e("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){r=function(e){this._initNamed(e)}}return n(r,t),r.prototype._initNamed=function(e){t.call(this,e)},new r(this)},a.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i.decoders[e])),this.decoders[e]},a.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},a.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i.encoders[e])),this.encoders[e]},a.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},{"../asn1":41,inherits:174,vm:316}],43:[function(e,t,r){var i=e("inherits"),n=e("../base").Reporter,a=e("buffer").Buffer;function s(e,t){n.call(this,t),a.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function o(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof o||(e=new o(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=a.byteLength(e);else{if(!a.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}i(s,n),r.DecoderBuffer=s,s.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},s.prototype.restore=function(e){var t=new s(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},s.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new s(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},s.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=o,o.prototype.join=function(e,t){return e||(e=new a(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):a.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},{"../base":44,buffer:94,inherits:174}],44:[function(e,t,r){var i=r;i.Reporter=e("./reporter").Reporter,i.DecoderBuffer=e("./buffer").DecoderBuffer,i.EncoderBuffer=e("./buffer").EncoderBuffer,i.Node=e("./node")},{"./buffer":43,"./node":45,"./reporter":46}],45:[function(e,t,r){var i=e("../base").Reporter,n=e("../base").EncoderBuffer,a=e("../base").DecoderBuffer,s=e("minimalistic-assert"),o=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],c=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(o);function d(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=d;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var e=this._baseState,t={};u.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},d.prototype._wrap=function(){var e=this._baseState;c.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},d.prototype._init=function(e){var t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),s.equal(t.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(e){var t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(s(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){d.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),o.forEach((function(e){d.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(r),this}})),d.prototype.use=function(e){s(e);var t=this._baseState;return s(null===t.use),t.use=e,this},d.prototype.optional=function(){return this._baseState.optional=!0,this},d.prototype.def=function(e){var t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},d.prototype.explicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},d.prototype.implicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},d.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},d.prototype.key=function(e){var t=this._baseState;return s(null===t.key),t.key=e,this},d.prototype.any=function(){return this._baseState.any=!0,this},d.prototype.choice=function(e){var t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},d.prototype.contains=function(e){var t=this._baseState;return s(null===t.use),t.contains=e,this},d.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var i,n=r.default,s=!0,o=null;if(null!==r.key&&(o=e.enterKey(r.key)),r.optional){var c=null;if(null!==r.explicit?c=r.explicit:null!==r.implicit?c=r.implicit:null!==r.tag&&(c=r.tag),null!==c||r.any){if(s=this._peekTag(e,c,r.any),e.isError(s))return s}else{var d=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),s=!0}catch(e){s=!1}e.restore(d)}}if(r.obj&&s&&(i=e.enterObject()),s){if(null!==r.explicit){var u=this._decodeTag(e,r.explicit);if(e.isError(u))return u;e=u}var l=e.offset;if(null===r.use&&null===r.choice){if(r.any)d=e.save();var h=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(h))return h;r.any?n=e.raw(d):e=h}if(t&&t.track&&null!==r.tag&&t.track(e.path(),l,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var f=new a(n);n=this._getUse(r.contains,e._reporterState.obj)._decode(f,t)}}return r.obj&&s&&(n=e.leaveObject(i)),null===r.key||null===n&&!0!==s?null!==o&&e.exitKey(o):e.leaveKey(o,r.key,n),n},d.prototype._decodeGeneric=function(e,t,r){var i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},d.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},d.prototype._decodeChoice=function(e,t){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(a){var s=e.save(),o=r.choice[a];try{var c=o._decode(e,t);if(e.isError(c))return!1;i={type:a,value:c},n=!0}catch(t){return e.restore(s),!1}return!0}),this),n?i:e.error("Choice not matched")},d.prototype._createEncoderBuffer=function(e){return new n(e,this.reporter)},d.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i.default||i.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},d.prototype._encodeValue=function(e,t,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new i);var a=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}var s=null,o=!1;if(n.any)a=this._createEncoderBuffer(e);else if(n.choice)a=this._encodeChoice(e,t);else if(n.contains)s=this._getUse(n.contains,r)._encode(e,t),o=!0;else if(n.children)s=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n}),this).filter((function(e){return e})),s=this._createEncoderBuffer(s);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return t.error("Too many args for : "+n.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var c=this.clone();c._baseState.implicit=null,s=this._createEncoderBuffer(e.map((function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)}),c))}else null!==n.use?a=this._getUse(n.use,r)._encode(e,t):(s=this._encodePrimitive(n.tag,e),o=!0);if(!n.any&&null===n.choice){var d=null!==n.implicit?n.implicit:n.tag,u=null===n.implicit?"universal":"context";null===d?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(a=this._encodeComposite(d,o,u,s))}return null!==n.explicit&&(a=this._encodeComposite(n.explicit,!1,"context",a)),a},d.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},d.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},d.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},d.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":44,"minimalistic-assert":239}],46:[function(e,t,r){var i=e("inherits");function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function a(e,t){this.path=e,this.rethrow(t)}r.Reporter=n,n.prototype.isError=function(e){return e instanceof a},n.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},n.prototype.leaveKey=function(e,t,r){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},n.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},n.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof a;if(t=i?e:new a(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},n.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},i(a,Error),a.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,a),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:174}],47:[function(e,t,r){var i=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=i._reverse(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=i._reverse(r.tag)},{"../constants":48}],48:[function(e,t,r){var i=r;i._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var i=e[r];t[i]=r})),t},i.der=e("./der")},{"./der":47}],49:[function(e,t,r){var i=e("inherits"),n=e("../../asn1"),a=n.base,s=n.bignum,o=n.constants.der;function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new d,this.tree._init(e.body)}function d(e){a.Node.call(this,"der",e)}function u(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=o.tagClass[r>>6],n=!(32&r);if(31&~r)r&=31;else{var a=r;for(r=0;!(128&~a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}return{cls:i,primitive:n,tag:r,tagStr:o.tag[r]}}function l(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(!(128&i))return i;var n=127&i;if(n>4)return e.error("length octect is too long");i=0;for(var a=0;a<n;a++){i<<=8;var s=e.readUInt8(r);if(e.isError(s))return s;i|=s}return i}t.exports=c,c.prototype.decode=function(e,t){return e instanceof a.DecoderBuffer||(e=new a.DecoderBuffer(e,t)),this.tree._decode(e,t)},i(d,a.Node),d.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=u(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},d.prototype._decodeTag=function(e,t,r){var i=u(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=l(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var a=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(n=e.offset-a.offset,e.restore(a),e.skip(n,'Failed to match body of: "'+t+'"'))},d.prototype._skipUntilEnd=function(e,t){for(;;){var r=u(e,t);if(e.isError(r))return r;var i,n=l(e,r.primitive,t);if(e.isError(n))return n;if(i=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===r.tagStr)break}},d.prototype._decodeList=function(e,t,r,i){for(var n=[];!e.isEmpty();){var a=this._peekTag(e,"end");if(e.isError(a))return a;var s=r.decode(e,"der",i);if(e.isError(s)&&a)break;n.push(s)}return n},d.prototype._decodeStr=function(e,t){if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}if("bmpstr"===t){var i=e.raw();if(i.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",a=0;a<i.length/2;a++)n+=String.fromCharCode(i.readUInt16BE(2*a));return n}if("numstr"===t){var s=e.raw().toString("ascii");return this._isNumstr(s)?s:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var o=e.raw().toString("ascii");return this._isPrintstr(o)?o:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},d.prototype._decodeObjid=function(e,t,r){for(var i,n=[],a=0;!e.isEmpty();){var s=e.readUInt8();a<<=7,a|=127&s,128&s||(n.push(a),a=0)}128&s&&n.push(a);var o=n[0]/40|0,c=n[0]%40;if(i=r?n:[o,c].concat(n.slice(1)),t){var d=t[i.join(" ")];void 0===d&&(d=t[i.join(".")]),void 0!==d&&(i=d)}return i},d.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var i=0|r.slice(0,4),n=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),o=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),a=0|r.slice(4,6),s=0|r.slice(6,8),o=0|r.slice(8,10),c=0|r.slice(10,12);i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,a,s,o,c,0)},d.prototype._decodeNull=function(e){return null},d.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},d.prototype._decodeInt=function(e,t){var r=e.raw(),i=new s(r);return t&&(i=t[i.toString(10)]||i),i},d.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":41,inherits:174}],50:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":49,"./pem":51}],51:[function(e,t,r){var i=e("inherits"),n=e("buffer").Buffer,a=e("./der");function s(e){a.call(this,e),this.enc="pem"}i(s,a),t.exports=s,s.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,o=-1,c=-1,d=0;d<r.length;d++){var u=r[d].match(s);if(null!==u&&u[2]===i){if(-1!==o){if("END"!==u[1])break;c=d;break}if("BEGIN"!==u[1])break;o=d}}if(-1===o||-1===c)throw new Error("PEM section not found for: "+i);var l=r.slice(o+1,c).join("");l.replace(/[^a-z0-9\+\/=]+/gi,"");var h=new n(l,"base64");return a.prototype.decode.call(this,h,t)}},{"./der":49,buffer:94,inherits:174}],52:[function(e,t,r){var i=e("inherits"),n=e("buffer").Buffer,a=e("../../asn1"),s=a.base,o=a.constants.der;function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new d,this.tree._init(e.body)}function d(e){s.Node.call(this,"der",e)}function u(e){return e<10?"0"+e:e}t.exports=c,c.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(d,s.Node),d.prototype._encodeComposite=function(e,t,r,i){var a,s=function(e,t,r,i){var n;"seqof"===e?e="seq":"setof"===e&&(e="set");if(o.tagByName.hasOwnProperty(e))n=o.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}if(n>=31)return i.error("Multi-octet tag encoding unsupported");t||(n|=32);return n|=o.tagClassByName[r||"universal"]<<6,n}(e,t,r,this.reporter);if(i.length<128)return(a=new n(2))[0]=s,a[1]=i.length,this._createEncoderBuffer([a,i]);for(var c=1,d=i.length;d>=256;d>>=8)c++;(a=new n(2+c))[0]=s,a[1]=128|c;d=1+c;for(var u=i.length;u>0;d--,u>>=8)a[d]=255&u;return this._createEncoderBuffer([a,i])},d.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new n(2*e.length),i=0;i<e.length;i++)r.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},d.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var a=0;for(i=0;i<e.length;i++){var s=e[i];for(a++;s>=128;s>>=7)a++}var o=new n(a),c=o.length-1;for(i=e.length-1;i>=0;i--){s=e[i];for(o[c--]=127&s;(s>>=7)>0;)o[c--]=128|127&s}return this._createEncoderBuffer(o)},d.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},d.prototype._encodeNull=function(){return this._createEncoderBuffer("")},d.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new n(r)}if(n.isBuffer(e)){var i=e.length;0===e.length&&i++;var a=new n(i);return e.copy(a),0===e.length&&(a[0]=0),this._createEncoderBuffer(a)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);i=1;for(var s=e;s>=256;s>>=8)i++;for(s=(a=new Array(i)).length-1;s>=0;s--)a[s]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new n(a))},d.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},d.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},d.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n.default)return!1;var a=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),a.length!==n.defaultBuffer.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==n.defaultBuffer[i])return!1;return!0}},{"../../asn1":41,buffer:94,inherits:174}],53:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":52,"./pem":54}],54:[function(e,t,r){var i=e("inherits"),n=e("./der");function a(e){n.call(this,e),this.enc="pem"}i(a,n),t.exports=a,a.prototype.encode=function(e,t){for(var r=n.prototype.encode.call(this,e).toString("base64"),i=["-----BEGIN "+t.label+"-----"],a=0;a<r.length;a+=64)i.push(r.slice(a,a+64));return i.push("-----END "+t.label+"-----"),i.join("\n")}},{"./der":52,inherits:174}],55:[function(e,t,r){!function(t,r){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var s;"object"==typeof t?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function d(e,t,r,i){for(var n=0,a=Math.min(e.length,r),s=t;s<a;s++){var o=e.charCodeAt(s)-48;n*=i,n+=o>=49?o-49+10:o>=17?o-17+10:o}return n}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,s,o=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)s=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)s=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,s=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,s=a%i,o=Math.min(a,a-s)+r,c=0,u=r;u<o;u+=i)c=d(e,u,u+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var l=1;for(c=d(e,u,e.length,t),u=0;u<s;u++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],s=n*a,o=67108863&s,c=s/67108864|0;r.words[0]=o;for(var d=1;d<i;d++){for(var u=c>>>26,l=67108863&c,h=Math.min(d,t.length-1),f=Math.max(0,d-e.length+1);f<=h;f++){var p=d-f|0;u+=(s=(n=0|e.words[p])*(a=0|t.words[f])+l)/67108864|0,l=67108863&s}r.words[d]=0|l,c=0|u}return 0!==c?r.words[d]=0|c:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,s=0;s<this.length;s++){var o=this.words[s],c=(16777215&(o<<n|a)).toString(16);r=0!==(a=o>>>24-n&16777215)||s!==this.length-1?u[6-c.length]+c+r:c+r,(n+=2)>=26&&(n-=26,s--)}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return i(void 0!==s),this.toArrayLike(s,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var s,o,c="le"===t,d=new e(a),u=this.clone();if(c){for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),d[o]=s;for(;o<a;o++)d[o]=0}else{for(o=0;o<a-n;o++)d[o]=0;for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),d[a-o-1]=s}return d},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},a.prototype.ior=function(e){return i(!(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return i(!(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return i(!(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},a.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,s=0;s<i.length;s++)a=(t=(0|r.words[s])-(0|i.words[s])+a)>>26,this.words[s]=67108863&t;for(;0!==a&&s<r.length;s++)a=(t=(0|r.words[s])+a)>>26,this.words[s]=67108863&t;if(0===a&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var i,n,a,s=e.words,o=t.words,c=r.words,d=0,u=0|s[0],l=8191&u,h=u>>>13,f=0|s[1],p=8191&f,m=f>>>13,b=0|s[2],g=8191&b,v=b>>>13,y=0|s[3],_=8191&y,w=y>>>13,S=0|s[4],k=8191&S,R=S>>>13,P=0|s[5],M=8191&P,E=P>>>13,x=0|s[6],T=8191&x,C=x>>>13,I=0|s[7],D=8191&I,O=I>>>13,A=0|s[8],L=8191&A,j=A>>>13,B=0|s[9],N=8191&B,F=B>>>13,U=0|o[0],q=8191&U,z=U>>>13,V=0|o[1],G=8191&V,W=V>>>13,H=0|o[2],K=8191&H,$=H>>>13,J=0|o[3],Y=8191&J,X=J>>>13,Z=0|o[4],Q=8191&Z,ee=Z>>>13,te=0|o[5],re=8191&te,ie=te>>>13,ne=0|o[6],ae=8191&ne,se=ne>>>13,oe=0|o[7],ce=8191&oe,de=oe>>>13,ue=0|o[8],le=8191&ue,he=ue>>>13,fe=0|o[9],pe=8191&fe,me=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(d+(i=Math.imul(l,q))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(h,q)|0))<<13)|0;d=((a=Math.imul(h,z))+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(p,q),n=(n=Math.imul(p,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ge=(d+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(h,G)|0))<<13)|0;d=((a=a+Math.imul(h,W)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(g,q),n=(n=Math.imul(g,z))+Math.imul(v,q)|0,a=Math.imul(v,z),i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var ve=(d+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,$)|0)+Math.imul(h,K)|0))<<13)|0;d=((a=a+Math.imul(h,$)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(_,q),n=(n=Math.imul(_,z))+Math.imul(w,q)|0,a=Math.imul(w,z),i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(v,G)|0,a=a+Math.imul(v,W)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,$)|0;var ye=(d+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(h,Y)|0))<<13)|0;d=((a=a+Math.imul(h,X)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(k,q),n=(n=Math.imul(k,z))+Math.imul(R,q)|0,a=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(w,G)|0,a=a+Math.imul(w,W)|0,i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,$)|0)+Math.imul(v,K)|0,a=a+Math.imul(v,$)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Y)|0,a=a+Math.imul(m,X)|0;var _e=(d+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;d=((a=a+Math.imul(h,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(M,q),n=(n=Math.imul(M,z))+Math.imul(E,q)|0,a=Math.imul(E,z),i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,$)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,$)|0,i=i+Math.imul(g,Y)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(v,Y)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,ee)|0;var we=(d+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(h,re)|0))<<13)|0;d=((a=a+Math.imul(h,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(T,q),n=(n=Math.imul(T,z))+Math.imul(C,q)|0,a=Math.imul(C,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(E,G)|0,a=a+Math.imul(E,W)|0,i=i+Math.imul(k,K)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,$)|0,i=i+Math.imul(_,Y)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Y)|0,a=a+Math.imul(w,X)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0;var Se=(d+(i=i+Math.imul(l,ae)|0)|0)+((8191&(n=(n=n+Math.imul(l,se)|0)+Math.imul(h,ae)|0))<<13)|0;d=((a=a+Math.imul(h,se)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(D,q),n=(n=Math.imul(D,z))+Math.imul(O,q)|0,a=Math.imul(O,z),i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(C,G)|0,a=a+Math.imul(C,W)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(E,K)|0,a=a+Math.imul(E,$)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,ee)|0,i=i+Math.imul(g,re)|0,n=(n=n+Math.imul(g,ie)|0)+Math.imul(v,re)|0,a=a+Math.imul(v,ie)|0,i=i+Math.imul(p,ae)|0,n=(n=n+Math.imul(p,se)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,se)|0;var ke=(d+(i=i+Math.imul(l,ce)|0)|0)+((8191&(n=(n=n+Math.imul(l,de)|0)+Math.imul(h,ce)|0))<<13)|0;d=((a=a+Math.imul(h,de)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(L,q),n=(n=Math.imul(L,z))+Math.imul(j,q)|0,a=Math.imul(j,z),i=i+Math.imul(D,G)|0,n=(n=n+Math.imul(D,W)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,W)|0,i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,$)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,$)|0,i=i+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(E,Y)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ie)|0,i=i+Math.imul(g,ae)|0,n=(n=n+Math.imul(g,se)|0)+Math.imul(v,ae)|0,a=a+Math.imul(v,se)|0,i=i+Math.imul(p,ce)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,de)|0;var Re=(d+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;d=((a=a+Math.imul(h,he)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(N,q),n=(n=Math.imul(N,z))+Math.imul(F,q)|0,a=Math.imul(F,z),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,$)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,$)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(_,ae)|0,n=(n=n+Math.imul(_,se)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,se)|0,i=i+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,de)|0)+Math.imul(v,ce)|0,a=a+Math.imul(v,de)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,he)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,he)|0;var Pe=(d+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,me)|0)+Math.imul(h,pe)|0))<<13)|0;d=((a=a+Math.imul(h,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,W))+Math.imul(F,G)|0,a=Math.imul(F,W),i=i+Math.imul(L,K)|0,n=(n=n+Math.imul(L,$)|0)+Math.imul(j,K)|0,a=a+Math.imul(j,$)|0,i=i+Math.imul(D,Y)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,X)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(M,re)|0,n=(n=n+Math.imul(M,ie)|0)+Math.imul(E,re)|0,a=a+Math.imul(E,ie)|0,i=i+Math.imul(k,ae)|0,n=(n=n+Math.imul(k,se)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,se)|0,i=i+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(w,ce)|0,a=a+Math.imul(w,de)|0,i=i+Math.imul(g,le)|0,n=(n=n+Math.imul(g,he)|0)+Math.imul(v,le)|0,a=a+Math.imul(v,he)|0;var Me=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;d=((a=a+Math.imul(m,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,$))+Math.imul(F,K)|0,a=Math.imul(F,$),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(j,Y)|0,a=a+Math.imul(j,X)|0,i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(M,ae)|0,n=(n=n+Math.imul(M,se)|0)+Math.imul(E,ae)|0,a=a+Math.imul(E,se)|0,i=i+Math.imul(k,ce)|0,n=(n=n+Math.imul(k,de)|0)+Math.imul(R,ce)|0,a=a+Math.imul(R,de)|0,i=i+Math.imul(_,le)|0,n=(n=n+Math.imul(_,he)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,he)|0;var Ee=(d+(i=i+Math.imul(g,pe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(v,pe)|0))<<13)|0;d=((a=a+Math.imul(v,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,X))+Math.imul(F,Y)|0,a=Math.imul(F,X),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,ee)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,ee)|0,i=i+Math.imul(D,re)|0,n=(n=n+Math.imul(D,ie)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ie)|0,i=i+Math.imul(T,ae)|0,n=(n=n+Math.imul(T,se)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,se)|0,i=i+Math.imul(M,ce)|0,n=(n=n+Math.imul(M,de)|0)+Math.imul(E,ce)|0,a=a+Math.imul(E,de)|0,i=i+Math.imul(k,le)|0,n=(n=n+Math.imul(k,he)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,he)|0;var xe=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;d=((a=a+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,ee))+Math.imul(F,Q)|0,a=Math.imul(F,ee),i=i+Math.imul(L,re)|0,n=(n=n+Math.imul(L,ie)|0)+Math.imul(j,re)|0,a=a+Math.imul(j,ie)|0,i=i+Math.imul(D,ae)|0,n=(n=n+Math.imul(D,se)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,se)|0,i=i+Math.imul(T,ce)|0,n=(n=n+Math.imul(T,de)|0)+Math.imul(C,ce)|0,a=a+Math.imul(C,de)|0,i=i+Math.imul(M,le)|0,n=(n=n+Math.imul(M,he)|0)+Math.imul(E,le)|0,a=a+Math.imul(E,he)|0;var Te=(d+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(R,pe)|0))<<13)|0;d=((a=a+Math.imul(R,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(N,re),n=(n=Math.imul(N,ie))+Math.imul(F,re)|0,a=Math.imul(F,ie),i=i+Math.imul(L,ae)|0,n=(n=n+Math.imul(L,se)|0)+Math.imul(j,ae)|0,a=a+Math.imul(j,se)|0,i=i+Math.imul(D,ce)|0,n=(n=n+Math.imul(D,de)|0)+Math.imul(O,ce)|0,a=a+Math.imul(O,de)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,he)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,he)|0;var Ce=(d+(i=i+Math.imul(M,pe)|0)|0)+((8191&(n=(n=n+Math.imul(M,me)|0)+Math.imul(E,pe)|0))<<13)|0;d=((a=a+Math.imul(E,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(N,ae),n=(n=Math.imul(N,se))+Math.imul(F,ae)|0,a=Math.imul(F,se),i=i+Math.imul(L,ce)|0,n=(n=n+Math.imul(L,de)|0)+Math.imul(j,ce)|0,a=a+Math.imul(j,de)|0,i=i+Math.imul(D,le)|0,n=(n=n+Math.imul(D,he)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,he)|0;var Ie=(d+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,me)|0)+Math.imul(C,pe)|0))<<13)|0;d=((a=a+Math.imul(C,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(N,ce),n=(n=Math.imul(N,de))+Math.imul(F,ce)|0,a=Math.imul(F,de),i=i+Math.imul(L,le)|0,n=(n=n+Math.imul(L,he)|0)+Math.imul(j,le)|0,a=a+Math.imul(j,he)|0;var De=(d+(i=i+Math.imul(D,pe)|0)|0)+((8191&(n=(n=n+Math.imul(D,me)|0)+Math.imul(O,pe)|0))<<13)|0;d=((a=a+Math.imul(O,me)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863,i=Math.imul(N,le),n=(n=Math.imul(N,he))+Math.imul(F,le)|0,a=Math.imul(F,he);var Oe=(d+(i=i+Math.imul(L,pe)|0)|0)+((8191&(n=(n=n+Math.imul(L,me)|0)+Math.imul(j,pe)|0))<<13)|0;d=((a=a+Math.imul(j,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Ae=(d+(i=Math.imul(N,pe))|0)+((8191&(n=(n=Math.imul(N,me))+Math.imul(F,pe)|0))<<13)|0;return d=((a=Math.imul(F,me))+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c[0]=be,c[1]=ge,c[2]=ve,c[3]=ye,c[4]=_e,c[5]=we,c[6]=Se,c[7]=ke,c[8]=Re,c[9]=Pe,c[10]=Me,c[11]=Ee,c[12]=xe,c[13]=Te,c[14]=Ce,c[15]=Ie,c[16]=De,c[17]=Oe,c[18]=Ae,0!==d&&(c[19]=d,r.length++),r};function m(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(p=f),a.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):i<63?f(this,e,t):i<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var s=n;n=0;for(var o=67108863&i,c=Math.min(a,t.length-1),d=Math.max(0,a-e.length+1);d<=c;d++){var u=a-d,l=(0|e.words[u])*(0|t.words[d]),h=67108863&l;o=67108863&(h=h+o|0),n+=(s=(s=s+(l/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[a]=o,i=s,s=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,e,t):m(this,e,t),r},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},b.prototype.permute=function(e,t,r,i,n,a){for(var s=0;s<a;s++)i[s]=t[e[s]],n[s]=r[e[s]]},b.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var s=1;s<n;s<<=1)for(var o=s<<1,c=Math.cos(2*Math.PI/o),d=Math.sin(2*Math.PI/o),u=0;u<n;u+=o)for(var l=c,h=d,f=0;f<s;f++){var p=r[u+f],m=i[u+f],b=r[u+f+s],g=i[u+f+s],v=l*b-h*g;g=l*g+h*b,b=v,r[u+f]=p+b,i[u+f]=m+g,r[u+f+s]=p-b,i[u+f+s]=m-g,f!==o&&(v=c*l-d*h,h=c*h+d*l,l=v)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},b.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},b.prototype.convert13b=function(e,t,r,n){for(var a=0,s=0;s<t;s++)a+=0|e[s],r[2*s]=8191&a,a>>>=13,r[2*s+1]=8191&a,a>>>=13;for(s=2*t;s<n;++s)r[s]=0;i(0===a),i(!(-8192&a))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),s=new Array(i),o=new Array(i),c=new Array(i),d=new Array(i),u=new Array(i),l=new Array(i),h=r.words;h.length=i,this.convert13b(e.words,e.length,s,i),this.convert13b(t.words,t.length,d,i),this.transform(s,a,o,c,i,n),this.transform(d,a,u,l,i,n);for(var f=0;f<i;f++){var p=o[f]*u[f]-c[f]*l[f];c[f]=o[f]*l[f]+c[f]*u[f],o[f]=p}return this.conjugate(o,c,i),this.transform(o,c,h,a,i,n),this.conjugate(h,a,i),this.normalize13b(h,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),m(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){i("number"==typeof e),i(e<67108864);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,a=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new a(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},a.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t<this.length;t++){var o=this.words[t]&a,c=(0|this.words[t])-o<<r;this.words[t]=c|s,s=o>>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},a.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,s=Math.min((e-a)/26,this.length),o=67108863^67108863>>>a<<a,c=r;if(n-=s,n=Math.max(0,n),c){for(var d=0;d<s;d++)c.words[d]=this.words[d];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,d=0;d<this.length;d++)this.words[d]=this.words[d+s];else this.words[0]=0,this.length=1;var u=0;for(d=this.length-1;d>=0&&(0!==u||d>=n);d--){var l=0|this.words[d];this.words[d]=u<<26-a|l>>>a,u=l&o}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},a.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var n,a,s=e.length+r;this._expand(s);var o=0;for(n=0;n<e.length;n++){a=(0|this.words[n+r])+o;var c=(0|e.words[n])*t;o=((a-=67108863&c)>>26)-(c/67108864|0),this.words[n+r]=67108863&a}for(;n<this.length-r;n++)o=(a=(0|this.words[n+r])+o)>>26,this.words[n+r]=67108863&a;if(0===o)return this.strip();for(i(-1===o),o=0,n=0;n<this.length;n++)o=(a=-(0|this.words[n])+o)>>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var o,c=i.length-n.length;if("mod"!==t){(o=new a(null)).length=c+1,o.words=new Array(o.length);for(var d=0;d<o.length;d++)o.words[d]=0}var u=i.clone()._ishlnsubmul(n,1,c);0===u.negative&&(i=u,o&&(o.words[c]=1));for(var l=c-1;l>=0;l--){var h=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(h=Math.min(h/s|0,67108863),i._ishlnsubmul(n,h,l);0!==i.negative;)h--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);o&&(o.words[l]=h)}return o&&o.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:o||null,mod:i}},a.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(n=o.div.neg()),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:n,mod:s}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(n=o.div.neg()),{div:n,mod:o.mod}):this.negative&e.negative?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:o.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,s,o},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modn=function(e){i(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},a.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new a(1),s=new a(0),o=new a(0),c=new a(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var u=r.clone(),l=t.clone();!t.isZero();){for(var h=0,f=1;!(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(u),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(u),c.isub(l)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o),s.isub(c)):(r.isub(t),o.isub(n),c.isub(s))}return{a:o,b:c,gcd:r.iushln(d)}},a.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,s=new a(1),o=new a(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,u=1;!(t.words[0]&u)&&d<26;++d,u<<=1);if(d>0)for(t.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var l=0,h=1;!(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(o)):(r.isub(t),o.isub(s))}return(n=0===t.cmpn(1)?s:o).cmpn(0)<0&&n.iadd(e),n},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return!(1&this.words[0])},a.prototype.isOdd=function(){return!(1&~this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var a=n,s=r;0!==a&&s<this.length;s++){var o=0|this.words[s];a=(o+=a)>>>26,o&=67108863,this.words[s]=o}return 0!==a&&(this.words[s]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new k(e)},a.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function R(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(y,v),y.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,n=10;n<e.length;n++){var s=0|e.words[n];e.words[n-10]=(s&r)<<4|a>>>22,a=s}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(w,v),n(S,v),S.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new _;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return g[e]=t,t},k.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){i(!(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var o=new a(1).toRed(this),c=o.redNeg(),d=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,d).cmp(c);)u.redIAdd(c);for(var l=this.pow(u,n),h=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=s;0!==f.cmp(o);){for(var m=f,b=0;0!==m.cmp(o);b++)m=m.redSqr();i(b<p);var g=this.pow(l,new a(1).iushln(p-b-1));h=h.redMul(g),l=g.redSqr(),f=f.redMul(l),p=b}return h},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],s=0,o=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],u=c-1;u>=0;u--){var l=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++o||0===i&&0===u)&&(n=this.mul(n,r[s]),o=0,s=0)):o=0}c=26}return n},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new R(e)},n(R,k),R.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},R.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},R.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},R.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},R.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:63}],56:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Logger=void 0;const i=e("debug"),n="awaitqueue";r.Logger=class{constructor(e){e?(this._debug=(0,i.default)(`${n}:${e}`),this._warn=(0,i.default)(`${n}:WARN:${e}`),this._error=(0,i.default)(`${n}:ERROR:${e}`)):(this._debug=(0,i.default)(n),this._warn=(0,i.default)(`${n}:WARN`),this._error=(0,i.default)(`${n}:ERROR`)),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}}},{debug:104}],57:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AwaitQueue=r.AwaitQueueRemovedTaskError=r.AwaitQueueStoppedError=void 0;const i=new(e("./Logger").Logger);class n extends Error{constructor(e){super(e??"AwaitQueue stopped"),this.name="AwaitQueueStoppedError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,n)}}r.AwaitQueueStoppedError=n;class a extends Error{constructor(e){super(e??"AwaitQueue task removed"),this.name="AwaitQueueRemovedTaskError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,a)}}r.AwaitQueueRemovedTaskError=a;r.AwaitQueue=class{constructor(){this.pendingTasks=new Map,this.nextTaskId=0,this.stopping=!1}get size(){return this.pendingTasks.size}async push(e,t){if(t=t??e.name,i.debug(`push() [name:${t}]`),"function"!=typeof e)throw new TypeError("given task is not a function");if(t)try{Object.defineProperty(e,"name",{value:t})}catch(e){}return new Promise(((r,n)=>{const a={id:this.nextTaskId++,task:e,name:t,enqueuedAt:Date.now(),executedAt:void 0,completed:!1,resolve:e=>{if(a.completed)return;a.completed=!0,this.pendingTasks.delete(a.id),i.debug(`resolving task [name:${a.name}]`),r(e);const[t]=this.pendingTasks.values();t&&!t.executedAt&&this.execute(t)},reject:e=>{if(!a.completed&&(a.completed=!0,this.pendingTasks.delete(a.id),i.debug(`rejecting task [name:${a.name}]: %s`,String(e)),n(e),!this.stopping)){const[e]=this.pendingTasks.values();e&&!e.executedAt&&this.execute(e)}}};this.pendingTasks.set(a.id,a),1===this.pendingTasks.size&&this.execute(a)}))}stop(){i.debug("stop()"),this.stopping=!0;for(const e of this.pendingTasks.values())i.debug(`stop() | stopping task [name:${e.name}]`),e.reject(new n);this.stopping=!1}remove(e){i.debug(`remove() [taskIdx:${e}]`);const t=Array.from(this.pendingTasks.values())[e];t?t.reject(new a):i.debug(`stop() | no task with given idx [taskIdx:${e}]`)}dump(){const e=Date.now();let t=0;return Array.from(this.pendingTasks.values()).map((r=>({idx:t++,task:r.task,name:r.name,enqueuedTime:r.executedAt?r.executedAt-r.enqueuedAt:e-r.enqueuedAt,executionTime:r.executedAt?e-r.executedAt:0})))}async execute(e){if(i.debug(`execute() [name:${e.name}]`),e.executedAt)throw new Error("task already being executed");e.executedAt=Date.now();try{const t=await e.task();e.resolve(t)}catch(t){e.reject(t)}}}},{"./Logger":56}],58:[function(e,t,r){(function(e,r){(function(){"use strict";function i(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:a}=Object,s=(o=Object.create(null),e=>{const t=n.call(e);return o[t]||(o[t]=t.slice(8,-1).toLowerCase())});var o;const c=e=>(e=e.toLowerCase(),t=>s(t)===e),d=e=>t=>typeof t===e,{isArray:u}=Array,l=d("undefined");const h=c("ArrayBuffer");const f=d("string"),p=d("function"),m=d("number"),b=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=a(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},v=c("Date"),y=c("File"),_=c("Blob"),w=c("FileList"),S=c("URLSearchParams");function k(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),u(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{const n=r?Object.getOwnPropertyNames(e):Object.keys(e),a=n.length;let s;for(i=0;i<a;i++)s=n[i],t.call(null,e[s],s,e)}}function R(e,t){t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:e,M=e=>!l(e)&&e!==P;const E=(x="undefined"!=typeof Uint8Array&&a(Uint8Array),e=>x&&e instanceof x);var x;const T=c("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),I=c("RegExp"),D=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};k(r,((r,n)=>{let a;!1!==(a=t(r,n,e))&&(i[n]=a||r)})),Object.defineProperties(e,i)},O="abcdefghijklmnopqrstuvwxyz",A="0123456789",L={DIGIT:A,ALPHA:O,ALPHA_DIGIT:O+O.toUpperCase()+A};const j=c("AsyncFunction");var B={isArray:u,isArrayBuffer:h,isBuffer:function(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||p(e.append)&&("formdata"===(t=s(e))||"object"===t&&p(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:f,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:b,isPlainObject:g,isUndefined:l,isDate:v,isFile:y,isBlob:_,isRegExp:I,isFunction:p,isStream:e=>b(e)&&p(e.pipe),isURLSearchParams:S,isTypedArray:E,isFileList:w,forEach:k,merge:function e(){const{caseless:t}=M(this)&&this||{},r={},i=(i,n)=>{const a=t&&R(r,n)||n;g(r[a])&&g(i)?r[a]=e(r[a],i):g(i)?r[a]=e({},i):u(i)?r[a]=i.slice():r[a]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&k(arguments[e],i);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(k(t,((t,n)=>{r&&p(t)?e[n]=i(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,s,o;const c={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),s=n.length;s-- >0;)o=n[s],i&&!i(o,e,t)||c[o]||(t[o]=e[o],c[o]=!0);e=!1!==r&&a(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:c,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return-1!==i&&i===r},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!m(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=r.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const i=[];for(;null!==(r=e.exec(t));)i.push(r);return i},isHTMLForm:T,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:D,freezeMethods:e=>{D(e,((t,r)=>{if(p(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];p(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach((e=>{r[e]=!0}))};return u(e)?i(e):i(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:R,global:P,isContextDefined:M,ALPHABET:L,generateString:(e=16,t=L.ALPHA_DIGIT)=>{let r="";const{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r},isSpecCompliantForm:function(e){return!!(e&&p(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(b(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=u(e)?[]:{};return k(e,((e,t)=>{const a=r(e,i+1);!l(a)&&(n[t]=a)})),t[i]=void 0,n}}return e};return r(e,0)},isAsyncFn:j,isThenable:e=>e&&(b(e)||p(e))&&p(e.then)&&p(e.catch)};function N(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}B.inherits(N,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const F=N.prototype,U={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{U[e]={value:e}})),Object.defineProperties(N,U),Object.defineProperty(F,"isAxiosError",{value:!0}),N.from=(e,t,r,i,n,a)=>{const s=Object.create(F);return B.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),N.call(s,e.message,t,r,i,n),s.cause=e,s.name=e.name,a&&Object.assign(s,a),s};function q(e){return B.isPlainObject(e)||B.isArray(e)}function z(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function V(e,t,r){return e?e.concat(t).map((function(e,t){return e=z(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const G=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)}));function W(e,t,i){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(i=B.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,a=i.visitor||u,s=i.dots,o=i.indexes,c=(i.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(a))throw new TypeError("visitor must be a function");function d(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!c&&B.isBlob(e))throw new N("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?c&&"function"==typeof Blob?new Blob([e]):r.from(e):e}function u(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(B.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(q)}(e)||(B.isFileList(e)||B.endsWith(r,"[]"))&&(a=B.toArray(e)))return r=z(r),a.forEach((function(e,i){!B.isUndefined(e)&&null!==e&&t.append(!0===o?V([r],i,s):null===o?r:r+"[]",d(e))})),!1;return!!q(e)||(t.append(V(i,r,s),d(e)),!1)}const l=[],h=Object.assign(G,{defaultVisitor:u,convertValue:d,isVisitable:q});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!B.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+i.join("."));l.push(r),B.forEach(r,(function(r,n){!0===(!(B.isUndefined(r)||null===r)&&a.call(t,r,B.isString(n)?n.trim():n,i,h))&&e(r,i?i.concat(n):[n])})),l.pop()}}(e),t}function H(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function K(e,t){this._pairs=[],e&&W(e,this,t)}const $=K.prototype;function J(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Y(e,t,r){if(!t)return e;const i=r&&r.encode||J,n=r&&r.serialize;let a;if(a=n?n(t,r):B.isURLSearchParams(t)?t.toString():new K(t,r).toString(i),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,H)}:H;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var X=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Q={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:K,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function ee(e){function t(e,r,i,n){let a=e[n++];const s=Number.isFinite(+a),o=n>=e.length;if(a=!a&&B.isArray(i)?i.length:a,o)return B.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!s;i[a]&&B.isObject(i[a])||(i[a]=[]);return t(e,r,i[a],n)&&B.isArray(i[a])&&(i[a]=function(e){const t={},r=Object.keys(e);let i;const n=r.length;let a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}(i[a])),!s}if(B.isFormData(e)&&B.isFunction(e.entries)){const r={};return B.forEachEntry(e,((e,i)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const te={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=B.isObject(e);n&&B.isHTMLForm(e)&&(e=new FormData(e));if(B.isFormData(e))return i&&i?JSON.stringify(ee(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return W(e,new Q.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,i){return Q.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=B.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return W(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),function(e,t,r){if(B.isString(e))try{return(t||JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&B.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw N.from(e,N.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Q.classes.FormData,Blob:Q.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],(e=>{te.headers[e]={}}));var re=te;const ie=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ne=Symbol("internals");function ae(e){return e&&String(e).trim().toLowerCase()}function se(e){return!1===e||null==e?e:B.isArray(e)?e.map(se):String(e)}function oe(e,t,r,i,n){return B.isFunction(i)?i.call(this,t,r):(n&&(t=r),B.isString(t)?B.isString(i)?-1!==t.indexOf(i):B.isRegExp(i)?i.test(t):void 0:void 0)}class ce{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function n(e,t,r){const n=ae(t);if(!n)throw new Error("header name must be a non-empty string");const a=B.findKey(i,n);(!a||void 0===i[a]||!0===r||void 0===r&&!1!==i[a])&&(i[a||t]=se(e))}const a=(e,t)=>B.forEach(e,((e,r)=>n(e,r,t)));return B.isPlainObject(e)||e instanceof this.constructor?a(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,i,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),r=e.substring(0,n).trim().toLowerCase(),i=e.substring(n+1).trim(),!r||t[r]&&ie[r]||("set-cookie"===r?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)})),t})(e),t):null!=e&&n(t,e,r),this}get(e,t){if(e=ae(e)){const r=B.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}(e);if(B.isFunction(t))return t.call(this,e,r);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ae(e)){const r=B.findKey(this,e);return!(!r||void 0===this[r]||t&&!oe(0,this[r],r,t))}return!1}delete(e,t){const r=this;let i=!1;function n(e){if(e=ae(e)){const n=B.findKey(r,e);!n||t&&!oe(0,r[n],n,t)||(delete r[n],i=!0)}}return B.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const n=t[r];e&&!oe(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,r={};return B.forEach(this,((i,n)=>{const a=B.findKey(r,n);if(a)return t[a]=se(i),void delete t[n];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(n):String(n).trim();s!==n&&delete t[n],t[s]=se(i),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&B.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[ne]=this[ne]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=ae(e);t[i]||(!function(e,t){const r=B.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+r,{value:function(e,r,n){return this[i].call(this,t,e,r,n)},configurable:!0})}))}(r,e),t[i]=!0)}return B.isArray(e)?e.forEach(i):i(e),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.reduceDescriptors(ce.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),B.freezeMethods(ce);var de=ce;function ue(e,t){const r=this||re,i=t||r,n=de.from(i.headers);let a=i.data;return B.forEach(e,(function(e){a=e.call(r,a,n.normalize(),t?t.status:void 0)})),n.normalize(),a}function le(e){return!(!e||!e.__CANCEL__)}function he(e,t,r){N.call(this,null==e?"canceled":e,N.ERR_CANCELED,t,r),this.name="CanceledError"}B.inherits(he,N,{__CANCEL__:!0});var fe=Q.isStandardBrowserEnv?{write:function(e,t,r,i,n,a){const s=[];s.push(e+"="+encodeURIComponent(t)),B.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),B.isString(i)&&s.push("path="+i),B.isString(n)&&s.push("domain="+n),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function pe(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var me=Q.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function i(r){let i=r;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(e){const t=B.isString(e)?i(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function be(e,t){let r=0;const i=function(e,t){e=e||10;const r=new Array(e),i=new Array(e);let n,a=0,s=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),d=i[s];n||(n=c),r[a]=o,i[a]=c;let u=s,l=0;for(;u!==a;)l+=r[u++],u%=e;if(a=(a+1)%e,a===s&&(s=(s+1)%e),c-n<t)return;const h=d&&c-d;return h?Math.round(1e3*l/h):void 0}}(50,250);return n=>{const a=n.loaded,s=n.lengthComputable?n.total:void 0,o=a-r,c=i(o);r=a;const d={loaded:a,total:s,progress:s?a/s:void 0,bytes:o,rate:c||void 0,estimated:c&&s&&a<=s?(s-a)/c:void 0,event:n};d[t?"download":"upload"]=!0,e(d)}}const ge={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let i=e.data;const n=de.from(e.headers).normalize(),a=e.responseType;let s,o;function c(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}B.isFormData(i)&&(Q.isStandardBrowserEnv||Q.isStandardBrowserWebWorkerEnv?n.setContentType(!1):n.getContentType(/^\s*multipart\/form-data/)?B.isString(o=n.getContentType())&&n.setContentType(o.replace(/^\s*(multipart\/form-data);+/,"$1")):n.setContentType("multipart/form-data"));let d=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(t+":"+r))}const u=pe(e.baseURL,e.url);function l(){if(!d)return;const i=de.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());!function(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new N("Request failed with status code "+r.status,[N.ERR_BAD_REQUEST,N.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),c()}),(function(e){r(e),c()}),{data:a&&"text"!==a&&"json"!==a?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:i,config:e,request:d}),d=null}if(d.open(e.method.toUpperCase(),Y(u,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,"onloadend"in d?d.onloadend=l:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(l)},d.onabort=function(){d&&(r(new N("Request aborted",N.ECONNABORTED,e,d)),d=null)},d.onerror=function(){r(new N("Network Error",N.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new N(t,i.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,e,d)),d=null},Q.isStandardBrowserEnv){const t=me(u)&&e.xsrfCookieName&&fe.read(e.xsrfCookieName);t&&n.set(e.xsrfHeaderName,t)}void 0===i&&n.setContentType(null),"setRequestHeader"in d&&B.forEach(n.toJSON(),(function(e,t){d.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),a&&"json"!==a&&(d.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",be(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",be(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{d&&(r(!t||t.type?new he(null,e,d):t),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const h=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);h&&-1===Q.protocols.indexOf(h)?r(new N("Unsupported protocol "+h+":",N.ERR_BAD_REQUEST,e)):d.send(i||null)}))}};B.forEach(ge,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ve=e=>`- ${e}`,ye=e=>B.isFunction(e)||null===e||!1===e;var _e=e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let r,i;const n={};for(let a=0;a<t;a++){let t;if(r=e[a],i=r,!ye(r)&&(i=ge[(t=String(r)).toLowerCase()],void 0===i))throw new N(`Unknown adapter '${t}'`);if(i)break;n[t||"#"+a]=i}if(!i){const e=Object.entries(n).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new N("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(ve).join("\n"):" "+ve(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function we(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new he(null,e)}function Se(e){we(e),e.headers=de.from(e.headers),e.data=ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _e(e.adapter||re.adapter)(e).then((function(t){return we(e),t.data=ue.call(e,e.transformResponse,t),t.headers=de.from(t.headers),t}),(function(t){return le(t)||(we(e),t&&t.response&&(t.response.data=ue.call(e,e.transformResponse,t.response),t.response.headers=de.from(t.response.headers))),Promise.reject(t)}))}const ke=e=>e instanceof de?e.toJSON():e;function Re(e,t){t=t||{};const r={};function i(e,t,r){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:r},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function n(e,t,r){return B.isUndefined(t)?B.isUndefined(e)?void 0:i(void 0,e,r):i(e,t,r)}function a(e,t){if(!B.isUndefined(t))return i(void 0,t)}function s(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function o(r,n,a){return a in t?i(r,n):a in e?i(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(e,t)=>n(ke(e),ke(t),!0)};return B.forEach(Object.keys(Object.assign({},e,t)),(function(i){const a=c[i]||n,s=a(e[i],t[i],i);B.isUndefined(s)&&a!==o||(r[i]=s)})),r}const Pe="1.6.0",Me={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Me[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Ee={};Me.transitional=function(e,t,r){function i(e,t){return"[Axios v1.6.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,a)=>{if(!1===e)throw new N(i(n," has been removed"+(t?" in "+t:"")),N.ERR_DEPRECATED);return t&&!Ee[n]&&(Ee[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,a)}};var xe={assertOptions:function(e,t,r){if("object"!=typeof e)throw new N("options must be an object",N.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const a=i[n],s=t[a];if(s){const t=e[a],r=void 0===t||s(t,a,e);if(!0!==r)throw new N("option "+a+" must be "+r,N.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new N("Unknown option "+a,N.ERR_BAD_OPTION)}},validators:Me};const Te=xe.validators;class Ce{constructor(e){this.defaults=e,this.interceptors={request:new X,response:new X}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Re(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:n}=t;void 0!==r&&xe.assertOptions(r,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean)},!1),null!=i&&(B.isFunction(i)?t.paramsSerializer={serialize:i}:xe.assertOptions(i,{encode:Te.function,serialize:Te.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=n&&B.merge(n.common,n[t.method]);n&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=de.concat(a,n);const s=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,l=0;if(!o){const e=[Se.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,d=Promise.resolve(t);l<u;)d=d.then(e[l++],e[l++]);return d}u=s.length;let h=t;for(l=0;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=Se.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,u=c.length;l<u;)d=d.then(c[l++],c[l++]);return d}getUri(e){return Y(pe((e=Re(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}B.forEach(["delete","get","head","options"],(function(e){Ce.prototype[e]=function(t,r){return this.request(Re(r||{},{method:e,url:t,data:(r||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(Re(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Ce.prototype[e]=t(),Ce.prototype[e+"Form"]=t(!0)}));var Ie=Ce;class De{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e,i,n){r.reason||(r.reason=new he(e,i,n),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new De((function(t){e=t})),cancel:e}}}var Oe=De;const Ae={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ae).forEach((([e,t])=>{Ae[t]=e}));var Le=Ae;const je=function e(t){const r=new Ie(t),n=i(Ie.prototype.request,r);return B.extend(n,Ie.prototype,r,{allOwnKeys:!0}),B.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Re(t,r))},n}(re);je.Axios=Ie,je.CanceledError=he,je.CancelToken=Oe,je.isCancel=le,je.VERSION=Pe,je.toFormData=W,je.AxiosError=N,je.Cancel=je.CanceledError,je.all=function(e){return Promise.all(e)},je.spread=function(e){return function(t){return e.apply(null,t)}},je.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},je.mergeConfig=Re,je.AxiosHeaders=de,je.formToJSON=e=>ee(B.isHTMLForm(e)?new FormData(e):e),je.getAdapter=_e,je.HttpStatusCode=Le,je.default=je,t.exports=je}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{buffer:94}],59:[function(e,t,r){"use strict";r.byteLength=function(e){var t=c(e),r=t[0],i=t[1];return 3*(r+i)/4-i},r.toByteArray=function(e){var t,r,i=c(e),s=i[0],o=i[1],d=new a(function(e,t,r){return 3*(t+r)/4-r}(0,s,o)),u=0,l=o>0?s-4:s;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],d[u++]=t>>16&255,d[u++]=t>>8&255,d[u++]=255&t;2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,d[u++]=255&t);1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,d[u++]=t>>8&255,d[u++]=255&t);return d},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,a=[],s=16383,o=0,c=r-n;o<c;o+=s)a.push(d(e,o,o+s>c?c:o+s));1===n?(t=e[r-1],a.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)i[o]=s[o],n[s.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function d(e,t,r){for(var n,a,s=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(i[(a=n)>>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},{}],60:[function(e,t,r){!function(t,r){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var s;"object"==typeof t?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function c(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function d(e,t,r,n){for(var a=0,s=0,o=Math.min(e.length,r),c=t;c<o;c++){var d=e.charCodeAt(c)-48;a*=n,s=d>=49?d-49+10:d>=17?d-17+10:d,i(d>=0&&s<n,"Invalid character"),a+=s}return a}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,s,o=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)s=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)s=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);return this._strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,s=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;this._strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,s=a%i,o=Math.min(a,a-s)+r,c=0,u=r;u<o;u+=i)c=d(e,u,u+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var l=1;for(c=d(e,u,e.length,t),u=0;u<s;u++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype._move=function(e){u(e,this)},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){a.prototype.inspect=l}else a.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,s=0;s<this.length;s++){var o=this.words[s],c=(16777215&(o<<n|a)).toString(16);a=o>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),r=0!==a||s!==this.length-1?h[6-c.length]+c+r:c+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=f[e],u=p[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(u).toString(e);r=(l=l.idivn(u)).isZero()?m+r:h[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16,2)},s&&(a.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],s=n*a,o=67108863&s,c=s/67108864|0;r.words[0]=o;for(var d=1;d<i;d++){for(var u=c>>>26,l=67108863&c,h=Math.min(d,t.length-1),f=Math.max(0,d-e.length+1);f<=h;f++){var p=d-f|0;u+=(s=(n=0|e.words[p])*(a=0|t.words[f])+l)/67108864|0,l=67108863&s}r.words[d]=0|l,c=0|u}return 0!==c?r.words[d]=0|c:r.length--,r._strip()}a.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,n),s},a.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,a=0;n<this.length;n++){var s=this.words[n]<<a|i;e[r++]=255&s,r<e.length&&(e[r++]=s>>8&255),r<e.length&&(e[r++]=s>>16&255),6===a?(r<e.length&&(e[r++]=s>>24&255),i=0,a=0):(i=s>>>24,a+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},a.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,a=0;n<this.length;n++){var s=this.words[n]<<a|i;e[r--]=255&s,r>=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===a?(r>=0&&(e[r--]=s>>24&255),i=0,a=0):(i=s>>>24,a+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},a.prototype.ior=function(e){return i(!(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},a.prototype.iand=function(e){return i(!(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},a.prototype.ixor=function(e){return i(!(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},a.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,s=0;s<i.length;s++)a=(t=(0|r.words[s])-(0|i.words[s])+a)>>26,this.words[s]=67108863&t;for(;0!==a&&s<r.length;s++)a=(t=(0|r.words[s])+a)>>26,this.words[s]=67108863&t;if(0===a&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var b=function(e,t,r){var i,n,a,s=e.words,o=t.words,c=r.words,d=0,u=0|s[0],l=8191&u,h=u>>>13,f=0|s[1],p=8191&f,m=f>>>13,b=0|s[2],g=8191&b,v=b>>>13,y=0|s[3],_=8191&y,w=y>>>13,S=0|s[4],k=8191&S,R=S>>>13,P=0|s[5],M=8191&P,E=P>>>13,x=0|s[6],T=8191&x,C=x>>>13,I=0|s[7],D=8191&I,O=I>>>13,A=0|s[8],L=8191&A,j=A>>>13,B=0|s[9],N=8191&B,F=B>>>13,U=0|o[0],q=8191&U,z=U>>>13,V=0|o[1],G=8191&V,W=V>>>13,H=0|o[2],K=8191&H,$=H>>>13,J=0|o[3],Y=8191&J,X=J>>>13,Z=0|o[4],Q=8191&Z,ee=Z>>>13,te=0|o[5],re=8191&te,ie=te>>>13,ne=0|o[6],ae=8191&ne,se=ne>>>13,oe=0|o[7],ce=8191&oe,de=oe>>>13,ue=0|o[8],le=8191&ue,he=ue>>>13,fe=0|o[9],pe=8191&fe,me=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(d+(i=Math.imul(l,q))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(h,q)|0))<<13)|0;d=((a=Math.imul(h,z))+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(p,q),n=(n=Math.imul(p,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ge=(d+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(h,G)|0))<<13)|0;d=((a=a+Math.imul(h,W)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(g,q),n=(n=Math.imul(g,z))+Math.imul(v,q)|0,a=Math.imul(v,z),i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var ve=(d+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,$)|0)+Math.imul(h,K)|0))<<13)|0;d=((a=a+Math.imul(h,$)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(_,q),n=(n=Math.imul(_,z))+Math.imul(w,q)|0,a=Math.imul(w,z),i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(v,G)|0,a=a+Math.imul(v,W)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,$)|0;var ye=(d+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(h,Y)|0))<<13)|0;d=((a=a+Math.imul(h,X)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(k,q),n=(n=Math.imul(k,z))+Math.imul(R,q)|0,a=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(w,G)|0,a=a+Math.imul(w,W)|0,i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,$)|0)+Math.imul(v,K)|0,a=a+Math.imul(v,$)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Y)|0,a=a+Math.imul(m,X)|0;var _e=(d+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;d=((a=a+Math.imul(h,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(M,q),n=(n=Math.imul(M,z))+Math.imul(E,q)|0,a=Math.imul(E,z),i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,$)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,$)|0,i=i+Math.imul(g,Y)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(v,Y)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,ee)|0;var we=(d+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(h,re)|0))<<13)|0;d=((a=a+Math.imul(h,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(T,q),n=(n=Math.imul(T,z))+Math.imul(C,q)|0,a=Math.imul(C,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(E,G)|0,a=a+Math.imul(E,W)|0,i=i+Math.imul(k,K)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,$)|0,i=i+Math.imul(_,Y)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Y)|0,a=a+Math.imul(w,X)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0;var Se=(d+(i=i+Math.imul(l,ae)|0)|0)+((8191&(n=(n=n+Math.imul(l,se)|0)+Math.imul(h,ae)|0))<<13)|0;d=((a=a+Math.imul(h,se)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(D,q),n=(n=Math.imul(D,z))+Math.imul(O,q)|0,a=Math.imul(O,z),i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(C,G)|0,a=a+Math.imul(C,W)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(E,K)|0,a=a+Math.imul(E,$)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,ee)|0,i=i+Math.imul(g,re)|0,n=(n=n+Math.imul(g,ie)|0)+Math.imul(v,re)|0,a=a+Math.imul(v,ie)|0,i=i+Math.imul(p,ae)|0,n=(n=n+Math.imul(p,se)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,se)|0;var ke=(d+(i=i+Math.imul(l,ce)|0)|0)+((8191&(n=(n=n+Math.imul(l,de)|0)+Math.imul(h,ce)|0))<<13)|0;d=((a=a+Math.imul(h,de)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(L,q),n=(n=Math.imul(L,z))+Math.imul(j,q)|0,a=Math.imul(j,z),i=i+Math.imul(D,G)|0,n=(n=n+Math.imul(D,W)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,W)|0,i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,$)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,$)|0,i=i+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(E,Y)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ie)|0,i=i+Math.imul(g,ae)|0,n=(n=n+Math.imul(g,se)|0)+Math.imul(v,ae)|0,a=a+Math.imul(v,se)|0,i=i+Math.imul(p,ce)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,de)|0;var Re=(d+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;d=((a=a+Math.imul(h,he)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(N,q),n=(n=Math.imul(N,z))+Math.imul(F,q)|0,a=Math.imul(F,z),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,$)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,$)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(_,ae)|0,n=(n=n+Math.imul(_,se)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,se)|0,i=i+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,de)|0)+Math.imul(v,ce)|0,a=a+Math.imul(v,de)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,he)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,he)|0;var Pe=(d+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,me)|0)+Math.imul(h,pe)|0))<<13)|0;d=((a=a+Math.imul(h,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,W))+Math.imul(F,G)|0,a=Math.imul(F,W),i=i+Math.imul(L,K)|0,n=(n=n+Math.imul(L,$)|0)+Math.imul(j,K)|0,a=a+Math.imul(j,$)|0,i=i+Math.imul(D,Y)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,X)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(M,re)|0,n=(n=n+Math.imul(M,ie)|0)+Math.imul(E,re)|0,a=a+Math.imul(E,ie)|0,i=i+Math.imul(k,ae)|0,n=(n=n+Math.imul(k,se)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,se)|0,i=i+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(w,ce)|0,a=a+Math.imul(w,de)|0,i=i+Math.imul(g,le)|0,n=(n=n+Math.imul(g,he)|0)+Math.imul(v,le)|0,a=a+Math.imul(v,he)|0;var Me=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;d=((a=a+Math.imul(m,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,$))+Math.imul(F,K)|0,a=Math.imul(F,$),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(j,Y)|0,a=a+Math.imul(j,X)|0,i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(M,ae)|0,n=(n=n+Math.imul(M,se)|0)+Math.imul(E,ae)|0,a=a+Math.imul(E,se)|0,i=i+Math.imul(k,ce)|0,n=(n=n+Math.imul(k,de)|0)+Math.imul(R,ce)|0,a=a+Math.imul(R,de)|0,i=i+Math.imul(_,le)|0,n=(n=n+Math.imul(_,he)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,he)|0;var Ee=(d+(i=i+Math.imul(g,pe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(v,pe)|0))<<13)|0;d=((a=a+Math.imul(v,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,X))+Math.imul(F,Y)|0,a=Math.imul(F,X),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,ee)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,ee)|0,i=i+Math.imul(D,re)|0,n=(n=n+Math.imul(D,ie)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ie)|0,i=i+Math.imul(T,ae)|0,n=(n=n+Math.imul(T,se)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,se)|0,i=i+Math.imul(M,ce)|0,n=(n=n+Math.imul(M,de)|0)+Math.imul(E,ce)|0,a=a+Math.imul(E,de)|0,i=i+Math.imul(k,le)|0,n=(n=n+Math.imul(k,he)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,he)|0;var xe=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;d=((a=a+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,ee))+Math.imul(F,Q)|0,a=Math.imul(F,ee),i=i+Math.imul(L,re)|0,n=(n=n+Math.imul(L,ie)|0)+Math.imul(j,re)|0,a=a+Math.imul(j,ie)|0,i=i+Math.imul(D,ae)|0,n=(n=n+Math.imul(D,se)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,se)|0,i=i+Math.imul(T,ce)|0,n=(n=n+Math.imul(T,de)|0)+Math.imul(C,ce)|0,a=a+Math.imul(C,de)|0,i=i+Math.imul(M,le)|0,n=(n=n+Math.imul(M,he)|0)+Math.imul(E,le)|0,a=a+Math.imul(E,he)|0;var Te=(d+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(R,pe)|0))<<13)|0;d=((a=a+Math.imul(R,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(N,re),n=(n=Math.imul(N,ie))+Math.imul(F,re)|0,a=Math.imul(F,ie),i=i+Math.imul(L,ae)|0,n=(n=n+Math.imul(L,se)|0)+Math.imul(j,ae)|0,a=a+Math.imul(j,se)|0,i=i+Math.imul(D,ce)|0,n=(n=n+Math.imul(D,de)|0)+Math.imul(O,ce)|0,a=a+Math.imul(O,de)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,he)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,he)|0;var Ce=(d+(i=i+Math.imul(M,pe)|0)|0)+((8191&(n=(n=n+Math.imul(M,me)|0)+Math.imul(E,pe)|0))<<13)|0;d=((a=a+Math.imul(E,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(N,ae),n=(n=Math.imul(N,se))+Math.imul(F,ae)|0,a=Math.imul(F,se),i=i+Math.imul(L,ce)|0,n=(n=n+Math.imul(L,de)|0)+Math.imul(j,ce)|0,a=a+Math.imul(j,de)|0,i=i+Math.imul(D,le)|0,n=(n=n+Math.imul(D,he)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,he)|0;var Ie=(d+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,me)|0)+Math.imul(C,pe)|0))<<13)|0;d=((a=a+Math.imul(C,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(N,ce),n=(n=Math.imul(N,de))+Math.imul(F,ce)|0,a=Math.imul(F,de),i=i+Math.imul(L,le)|0,n=(n=n+Math.imul(L,he)|0)+Math.imul(j,le)|0,a=a+Math.imul(j,he)|0;var De=(d+(i=i+Math.imul(D,pe)|0)|0)+((8191&(n=(n=n+Math.imul(D,me)|0)+Math.imul(O,pe)|0))<<13)|0;d=((a=a+Math.imul(O,me)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863,i=Math.imul(N,le),n=(n=Math.imul(N,he))+Math.imul(F,le)|0,a=Math.imul(F,he);var Oe=(d+(i=i+Math.imul(L,pe)|0)|0)+((8191&(n=(n=n+Math.imul(L,me)|0)+Math.imul(j,pe)|0))<<13)|0;d=((a=a+Math.imul(j,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Ae=(d+(i=Math.imul(N,pe))|0)+((8191&(n=(n=Math.imul(N,me))+Math.imul(F,pe)|0))<<13)|0;return d=((a=Math.imul(F,me))+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c[0]=be,c[1]=ge,c[2]=ve,c[3]=ye,c[4]=_e,c[5]=we,c[6]=Se,c[7]=ke,c[8]=Re,c[9]=Pe,c[10]=Me,c[11]=Ee,c[12]=xe,c[13]=Te,c[14]=Ce,c[15]=Ie,c[16]=De,c[17]=Oe,c[18]=Ae,0!==d&&(c[19]=d,r.length++),r};function g(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var s=n;n=0;for(var o=67108863&i,c=Math.min(a,t.length-1),d=Math.max(0,a-e.length+1);d<=c;d++){var u=a-d,l=(0|e.words[u])*(0|t.words[d]),h=67108863&l;o=67108863&(h=h+o|0),n+=(s=(s=s+(l/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[a]=o,i=s,s=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function v(e,t,r){return g(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(b=m),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?b(this,e,t):r<63?m(this,e,t):r<1024?g(this,e,t):v(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},y.prototype.permute=function(e,t,r,i,n,a){for(var s=0;s<a;s++)i[s]=t[e[s]],n[s]=r[e[s]]},y.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var s=1;s<n;s<<=1)for(var o=s<<1,c=Math.cos(2*Math.PI/o),d=Math.sin(2*Math.PI/o),u=0;u<n;u+=o)for(var l=c,h=d,f=0;f<s;f++){var p=r[u+f],m=i[u+f],b=r[u+f+s],g=i[u+f+s],v=l*b-h*g;g=l*g+h*b,b=v,r[u+f]=p+b,i[u+f]=m+g,r[u+f+s]=p-b,i[u+f+s]=m-g,f!==o&&(v=c*l-d*h,h=c*h+d*l,l=v)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},y.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},y.prototype.convert13b=function(e,t,r,n){for(var a=0,s=0;s<t;s++)a+=0|e[s],r[2*s]=8191&a,a>>>=13,r[2*s+1]=8191&a,a>>>=13;for(s=2*t;s<n;++s)r[s]=0;i(0===a),i(!(-8192&a))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),s=new Array(i),o=new Array(i),c=new Array(i),d=new Array(i),u=new Array(i),l=new Array(i),h=r.words;h.length=i,this.convert13b(e.words,e.length,s,i),this.convert13b(t.words,t.length,d,i),this.transform(s,a,o,c,i,n),this.transform(d,a,u,l,i,n);for(var f=0;f<i;f++){var p=o[f]*u[f]-c[f]*l[f];c[f]=o[f]*l[f]+c[f]*u[f],o[f]=p}return this.conjugate(o,c,i),this.transform(o,c,h,a,i,n),this.conjugate(h,a,i),this.normalize13b(h,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),v(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var a=(0|this.words[n])*e,s=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new a(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},a.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t<this.length;t++){var o=this.words[t]&a,c=(0|this.words[t])-o<<r;this.words[t]=c|s,s=o>>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},a.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,s=Math.min((e-a)/26,this.length),o=67108863^67108863>>>a<<a,c=r;if(n-=s,n=Math.max(0,n),c){for(var d=0;d<s;d++)c.words[d]=this.words[d];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,d=0;d<this.length;d++)this.words[d]=this.words[d+s];else this.words[0]=0,this.length=1;var u=0;for(d=this.length-1;d>=0&&(0!==u||d>=n);d--){var l=0|this.words[d];this.words[d]=u<<26-a|l>>>a,u=l&o}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},a.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this._strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var n,a,s=e.length+r;this._expand(s);var o=0;for(n=0;n<e.length;n++){a=(0|this.words[n+r])+o;var c=(0|e.words[n])*t;o=((a-=67108863&c)>>26)-(c/67108864|0),this.words[n+r]=67108863&a}for(;n<this.length-r;n++)o=(a=(0|this.words[n+r])+o)>>26,this.words[n+r]=67108863&a;if(0===o)return this._strip();for(i(-1===o),o=0,n=0;n<this.length;n++)o=(a=-(0|this.words[n])+o)>>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var o,c=i.length-n.length;if("mod"!==t){(o=new a(null)).length=c+1,o.words=new Array(o.length);for(var d=0;d<o.length;d++)o.words[d]=0}var u=i.clone()._ishlnsubmul(n,1,c);0===u.negative&&(i=u,o&&(o.words[c]=1));for(var l=c-1;l>=0;l--){var h=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(h=Math.min(h/s|0,67108863),i._ishlnsubmul(n,h,l);0!==i.negative;)h--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);o&&(o.words[l]=h)}return o&&o._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:o||null,mod:i}},a.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(n=o.div.neg()),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:n,mod:s}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(n=o.div.neg()),{div:n,mod:o.mod}):this.negative&e.negative?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:o.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,s,o},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%e;return t?-n:n},a.prototype.modn=function(e){return this.modrn(e)},a.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new a(1),s=new a(0),o=new a(0),c=new a(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var u=r.clone(),l=t.clone();!t.isZero();){for(var h=0,f=1;!(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(u),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(u),c.isub(l)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o),s.isub(c)):(r.isub(t),o.isub(n),c.isub(s))}return{a:o,b:c,gcd:r.iushln(d)}},a.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,s=new a(1),o=new a(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,u=1;!(t.words[0]&u)&&d<26;++d,u<<=1);if(d>0)for(t.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var l=0,h=1;!(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(o)):(r.isub(t),o.isub(s))}return(n=0===t.cmpn(1)?s:o).cmpn(0)<0&&n.iadd(e),n},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return!(1&this.words[0])},a.prototype.isOdd=function(){return!(1&~this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var a=n,s=r;0!==a&&s<this.length;s++){var o=0|this.words[s];a=(o+=a)>>>26,o&=67108863,this.words[s]=o}return 0!==a&&(this.words[s]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new M(e)},a.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function R(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(S,w),S.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,n=10;n<e.length;n++){var s=0|e.words[n];e.words[n-10]=(s&r)<<4|a>>>22,a=s}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(k,w),n(R,w),n(P,w),P.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new k;else if("p192"===e)t=new R;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new P}return _[e]=t,t},M.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){i(!(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var o=new a(1).toRed(this),c=o.redNeg(),d=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,d).cmp(c);)u.redIAdd(c);for(var l=this.pow(u,n),h=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=s;0!==f.cmp(o);){for(var m=f,b=0;0!==m.cmp(o);b++)m=m.redSqr();i(b<p);var g=this.pow(l,new a(1).iushln(p-b-1));h=h.redMul(g),l=g.redSqr(),f=f.redMul(l),p=b}return h},M.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},M.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],s=0,o=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],u=c-1;u>=0;u--){var l=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++o||0===i&&0===u)&&(n=this.mul(n,r[s]),o=0,s=0)):o=0}c=26}return n},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new E(e)},n(E,M),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:63}],61:[function(e,t,r){var i,n;i=this,n=function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i=r(18),n=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,i){void 0===i&&(i=!1);var n=e.getVersionPrecision(t),a=e.getVersionPrecision(r),s=Math.max(n,a),o=0,c=e.map([t,r],(function(t){var r=s-e.getVersionPrecision(t),i=t+new Array(r+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(o=s-Math.min(n,a)),s-=1;s>=o;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===o)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},e.map=function(e,t){var r,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)i.push(t(e[r]));return i},e.find=function(e,t){var r,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,i=e.length;r<i;r+=1){var n=e[r];if(t(n,r))return n}},e.assign=function(e){for(var t,r,i=e,n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(a));var o=function(){var e=a[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,r=a.length;t<r;t+=1)o();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=n,e.exports=t.default},18:function(e,t,r){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(91))&&i.__esModule?i:{default:i},a=r(18);function s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=function(){function e(){}var t,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new n.default(e,t)},e.parse=function(e){return new n.default(e).getResult()},t=e,(r=[{key:"BROWSER_MAP",get:function(){return a.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return a.ENGINE_MAP}},{key:"OS_MAP",get:function(){return a.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return a.PLATFORMS_MAP}}])&&s(t,r),e}();t.default=o,e.exports=t.default},91:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i=c(r(92)),n=c(r(93)),a=c(r(94)),s=c(r(95)),o=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=o.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=o.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=o.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=o.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return o.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},i=0,n={},a=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(n[t]=s,a+=1):"object"==typeof s&&(r[t]=s,i+=1)})),i>0){var s=Object.keys(r),c=o.default.find(s,(function(e){return t.isOS(e)}));if(c){var d=this.satisfies(r[c]);if(void 0!==d)return d}var u=o.default.find(s,(function(e){return t.isPlatform(e)}));if(u){var l=this.satisfies(r[u]);if(void 0!==l)return l}}if(a>0){var h=Object.keys(n),f=o.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==f)return this.compareVersion(n[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),n=o.default.getBrowserTypeByAlias(i);return t&&n&&(i=n.toLowerCase()),i===r},t.compareVersion=function(e){var t=[0],r=e,i=!1,n=this.getBrowserVersion();if("string"==typeof n)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(i=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(i=!0,r=e.substr(1)),t.indexOf(o.default.compareVersions(n,r,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(t,e),version:n.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:a.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=n.default.getWindowsVersionName(t);return{name:a.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:a.OS_MAP.iOS},r=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=n.default.getMacOSVersionName(t),i={name:a.OS_MAP.MacOS,version:t};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:a.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=n.default.getAndroidVersionName(t),i={name:a.OS_MAP.Android,version:t};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:a.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:a.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:a.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:a.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=n.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:a.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=n.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:a.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:a.ENGINE_MAP.Blink};var t=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:a.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:a.ENGINE_MAP.Trident},r=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:a.ENGINE_MAP.Presto},r=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:a.ENGINE_MAP.Gecko},r=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:a.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:a.ENGINE_MAP.WebKit},r=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=s,e.exports=t.default}})},"object"==typeof r&&"object"==typeof t?t.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof r?r.bowser=n():i.bowser=n()},{}],62:[function(e,t,r){var i;function n(e){this.rand=e}if(t.exports=function(e){return i||(i=new n(null)),i.generate(e)},t.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=e("crypto");if("function"!=typeof a.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return a.randomBytes(e)}}catch(e){}},{crypto:63}],63:[function(e,t,r){},{}],64:[function(e,t,r){var i=e("safe-buffer").Buffer;function n(e){i.isBuffer(e)||(e=i.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(4*n);return r}function a(e){for(;0<e.length;e++)e[0]=0}function s(e,t,r,i,n){for(var a,s,o,c,d=r[0],u=r[1],l=r[2],h=r[3],f=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],b=e[3]^t[3],g=4,v=1;v<n;v++)a=d[f>>>24]^u[p>>>16&255]^l[m>>>8&255]^h[255&b]^t[g++],s=d[p>>>24]^u[m>>>16&255]^l[b>>>8&255]^h[255&f]^t[g++],o=d[m>>>24]^u[b>>>16&255]^l[f>>>8&255]^h[255&p]^t[g++],c=d[b>>>24]^u[f>>>16&255]^l[p>>>8&255]^h[255&m]^t[g++],f=a,p=s,m=o,b=c;return a=(i[f>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&b])^t[g++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[b>>>8&255]<<8|i[255&f])^t[g++],o=(i[m>>>24]<<24|i[b>>>16&255]<<16|i[f>>>8&255]<<8|i[255&p])^t[g++],c=(i[b>>>24]<<24|i[f>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^t[g++],[a>>>=0,s>>>=0,o>>>=0,c>>>=0]}var o=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],a=[[],[],[],[]],s=0,o=0,c=0;c<256;++c){var d=o^o<<1^o<<2^o<<3^o<<4;d=d>>>8^255&d^99,r[s]=d,i[d]=s;var u=e[s],l=e[u],h=e[l],f=257*e[d]^16843008*d;n[0][s]=f<<24|f>>>8,n[1][s]=f<<16|f>>>16,n[2][s]=f<<8|f>>>24,n[3][s]=f,f=16843009*h^65537*l^257*u^16843008*s,a[0][d]=f<<24|f>>>8,a[1][d]=f<<16|f>>>16,a[2][d]=f<<8|f>>>24,a[3][d]=f,0===s?s=o=1:(s=u^e[e[e[h^u]]],o^=e[e[o]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:a}}();function d(e){this._key=n(e),this._reset()}d.blockSize=16,d.keySize=32,d.prototype.blockSize=d.blockSize,d.prototype.keySize=d.keySize,d.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=4*(r+1),n=[],a=0;a<t;a++)n[a]=e[a];for(a=t;a<i;a++){var s=n[a-1];a%t==0?(s=s<<8|s>>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s],s^=o[a/t|0]<<24):t>6&&a%t==4&&(s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s]),n[a]=n[a-t]^s}for(var d=[],u=0;u<i;u++){var l=i-u,h=n[l-(u%4?0:4)];d[u]=u<4||l<=4?h:c.INV_SUB_MIX[0][c.SBOX[h>>>24]]^c.INV_SUB_MIX[1][c.SBOX[h>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[h>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&h]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=d},d.prototype.encryptBlockRaw=function(e){return s(e=n(e),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},d.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},d.prototype.decryptBlock=function(e){var t=(e=n(e))[1];e[1]=e[3],e[3]=t;var r=s(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),a=i.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},d.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=d},{"safe-buffer":284}],65:[function(e,t,r){var i=e("./aes"),n=e("safe-buffer").Buffer,a=e("cipher-base"),s=e("inherits"),o=e("./ghash"),c=e("buffer-xor"),d=e("./incr32");function u(e,t,r,s){a.call(this);var c=n.alloc(4,0);this._cipher=new i.AES(t);var u=this._cipher.encryptBlock(c);this._ghash=new o(u),r=function(e,t,r){if(12===t.length)return e._finID=n.concat([t,n.from([0,0,0,1])]),n.concat([t,n.from([0,0,0,2])]);var i=new o(r),a=t.length,s=a%16;i.update(t),s&&(s=16-s,i.update(n.alloc(s,0))),i.update(n.alloc(8,0));var c=8*a,u=n.alloc(8);u.writeUIntBE(c,0,8),i.update(u),e._finID=i.state;var l=n.from(e._finID);return d(l),l}(this,r,u),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}s(u,a),u.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=n.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},u.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=c(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},u.prototype.getAuthTag=function(){if(this._decrypt||!n.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},u.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},u.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},t.exports=u},{"./aes":64,"./ghash":69,"./incr32":70,"buffer-xor":93,"cipher-base":95,inherits:174,"safe-buffer":284}],66:[function(e,t,r){var i=e("./encrypter"),n=e("./decrypter"),a=e("./modes/list.json");r.createCipher=r.Cipher=i.createCipher,r.createCipheriv=r.Cipheriv=i.createCipheriv,r.createDecipher=r.Decipher=n.createDecipher,r.createDecipheriv=r.Decipheriv=n.createDecipheriv,r.listCiphers=r.getCiphers=function(){return Object.keys(a)}},{"./decrypter":67,"./encrypter":68,"./modes/list.json":78}],67:[function(e,t,r){var i=e("./authCipher"),n=e("safe-buffer").Buffer,a=e("./modes"),s=e("./streamCipher"),o=e("cipher-base"),c=e("./aes"),d=e("evp_bytestokey");function u(e,t,r){o.call(this),this._cache=new l,this._last=void 0,this._cipher=new c.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}function l(){this.cache=n.allocUnsafe(0)}function h(e,t,r){var o=a[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==o.mode&&r.length!==o.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=n.from(t)),t.length!==o.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===o.type?new s(o.module,t,r,!0):"auth"===o.type?new i(o.module,t,r,!0):new u(o.module,t,r)}e("inherits")(u,o),u.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},u.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16===t)return;return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=n.concat([this.cache,e])},l.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(e,t){var r=a[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=d(t,!1,r.key,r.iv);return h(e,i.key,i.iv)},r.createDecipheriv=h},{"./aes":64,"./authCipher":65,"./modes":77,"./streamCipher":80,"cipher-base":95,evp_bytestokey:156,inherits:174,"safe-buffer":284}],68:[function(e,t,r){var i=e("./modes"),n=e("./authCipher"),a=e("safe-buffer").Buffer,s=e("./streamCipher"),o=e("cipher-base"),c=e("./aes"),d=e("evp_bytestokey");function u(e,t,r){o.call(this),this._cache=new h,this._cipher=new c.AES(t),this._prev=a.from(r),this._mode=e,this._autopadding=!0}e("inherits")(u,o),u.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return a.concat(i)};var l=a.alloc(16,16);function h(){this.cache=a.allocUnsafe(0)}function f(e,t,r){var o=i[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=a.from(t)),t.length!==o.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=a.from(r)),"GCM"!==o.mode&&r.length!==o.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===o.type?new s(o.module,t,r):"auth"===o.type?new n(o.module,t,r):new u(o.module,t,r)}u.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},h.prototype.add=function(e){this.cache=a.concat([this.cache,e])},h.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},h.prototype.flush=function(){for(var e=16-this.cache.length,t=a.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return a.concat([this.cache,t])},r.createCipheriv=f,r.createCipher=function(e,t){var r=i[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=d(t,!1,r.key,r.iv);return f(e,n.key,n.iv)}},{"./aes":64,"./authCipher":65,"./modes":77,"./streamCipher":80,"cipher-base":95,evp_bytestokey:156,inherits:174,"safe-buffer":284}],69:[function(e,t,r){var i=e("safe-buffer").Buffer,n=i.alloc(16,0);function a(e){var t=i.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function s(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}s.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},s.prototype._multiply=function(){for(var e,t,r,i=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],n=[0,0,0,0],s=-1;++s<128;){for(!!(this.state[~~(s/8)]&1<<7-s%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=!!(1&i[3]),t=3;t>0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=a(n)},s.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},s.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=s},{"safe-buffer":284}],70:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],71:[function(e,t,r){var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":93}],72:[function(e,t,r){var i=e("safe-buffer").Buffer,n=e("buffer-xor");function a(e,t,r){var a=t.length,s=n(t,e._cache);return e._cache=e._cache.slice(a),e._prev=i.concat([e._prev,r?t:s]),s}r.encrypt=function(e,t,r){for(var n,s=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){s=i.concat([s,a(e,t,r)]);break}n=e._cache.length,s=i.concat([s,a(e,t.slice(0,n),r)]),t=t.slice(n)}return s}},{"buffer-xor":93,"safe-buffer":284}],73:[function(e,t,r){var i=e("safe-buffer").Buffer;function n(e,t,r){for(var i,n,s=-1,o=0;++s<8;)i=t&1<<7-s?128:0,o+=(128&(n=e._cipher.encryptBlock(e._prev)[0]^i))>>s%8,e._prev=a(e._prev,r?i:n);return o}function a(e,t){var r=e.length,n=-1,a=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n<r;)a[n]=e[n]<<1|e[n+1]>>7;return a}r.encrypt=function(e,t,r){for(var a=t.length,s=i.allocUnsafe(a),o=-1;++o<a;)s[o]=n(e,t[o],r);return s}},{"safe-buffer":284}],74:[function(e,t,r){var i=e("safe-buffer").Buffer;function n(e,t,r){var n=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([r?t:n])]),n}r.encrypt=function(e,t,r){for(var a=t.length,s=i.allocUnsafe(a),o=-1;++o<a;)s[o]=n(e,t[o],r);return s}},{"safe-buffer":284}],75:[function(e,t,r){var i=e("buffer-xor"),n=e("safe-buffer").Buffer,a=e("../incr32");function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return a(e._prev),t}r.encrypt=function(e,t){var r=Math.ceil(t.length/16),a=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(16*r)]);for(var o=0;o<r;o++){var c=s(e),d=a+16*o;e._cache.writeUInt32BE(c[0],d+0),e._cache.writeUInt32BE(c[1],d+4),e._cache.writeUInt32BE(c[2],d+8),e._cache.writeUInt32BE(c[3],d+12)}var u=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,u)}},{"../incr32":70,"buffer-xor":93,"safe-buffer":284}],76:[function(e,t,r){r.encrypt=function(e,t){return e._cipher.encryptBlock(t)},r.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},{}],77:[function(e,t,r){var i={ECB:e("./ecb"),CBC:e("./cbc"),CFB:e("./cfb"),CFB8:e("./cfb8"),CFB1:e("./cfb1"),OFB:e("./ofb"),CTR:e("./ctr"),GCM:e("./ctr")},n=e("./list.json");for(var a in n)n[a].module=i[n[a].mode];t.exports=n},{"./cbc":71,"./cfb":72,"./cfb1":73,"./cfb8":74,"./ctr":75,"./ecb":76,"./list.json":78,"./ofb":79}],78:[function(e,t,r){t.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},{}],79:[function(e,t,r){(function(t){(function(){var i=e("buffer-xor");function n(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}r.encrypt=function(e,r){for(;e._cache.length<r.length;)e._cache=t.concat([e._cache,n(e)]);var a=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),i(r,a)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:94,"buffer-xor":93}],80:[function(e,t,r){var i=e("./aes"),n=e("safe-buffer").Buffer,a=e("cipher-base");function s(e,t,r,s){a.call(this),this._cipher=new i.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._mode=e}e("inherits")(s,a),s.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},{"./aes":64,"cipher-base":95,inherits:174,"safe-buffer":284}],81:[function(e,t,r){var i=e("browserify-des"),n=e("browserify-aes/browser"),a=e("browserify-aes/modes"),s=e("browserify-des/modes"),o=e("evp_bytestokey");function c(e,t,r){if(e=e.toLowerCase(),a[e])return n.createCipheriv(e,t,r);if(s[e])return new i({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function d(e,t,r){if(e=e.toLowerCase(),a[e])return n.createDecipheriv(e,t,r);if(s[e])return new i({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}r.createCipher=r.Cipher=function(e,t){var r,i;if(e=e.toLowerCase(),a[e])r=a[e].key,i=a[e].iv;else{if(!s[e])throw new TypeError("invalid suite type");r=8*s[e].key,i=s[e].iv}var n=o(t,!1,r,i);return c(e,n.key,n.iv)},r.createCipheriv=r.Cipheriv=c,r.createDecipher=r.Decipher=function(e,t){var r,i;if(e=e.toLowerCase(),a[e])r=a[e].key,i=a[e].iv;else{if(!s[e])throw new TypeError("invalid suite type");r=8*s[e].key,i=s[e].iv}var n=o(t,!1,r,i);return d(e,n.key,n.iv)},r.createDecipheriv=r.Decipheriv=d,r.listCiphers=r.getCiphers=function(){return Object.keys(s).concat(n.getCiphers())}},{"browserify-aes/browser":66,"browserify-aes/modes":77,"browserify-des":82,"browserify-des/modes":83,evp_bytestokey:156}],82:[function(e,t,r){var i=e("cipher-base"),n=e("des.js"),a=e("inherits"),s=e("safe-buffer").Buffer,o={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function c(e){i.call(this);var t,r=e.mode.toLowerCase(),n=o[r];t=e.decrypt?"decrypt":"encrypt";var a=e.key;s.isBuffer(a)||(a=s.from(a)),"des-ede"!==r&&"des-ede-cbc"!==r||(a=s.concat([a,a.slice(0,8)]));var c=e.iv;s.isBuffer(c)||(c=s.from(c)),this._des=n.create({key:a,iv:c,type:t})}o.des=o["des-cbc"],o.des3=o["des-ede3-cbc"],t.exports=c,a(c,i),c.prototype._update=function(e){return s.from(this._des.update(e))},c.prototype._final=function(){return s.from(this._des.final())}},{"cipher-base":95,"des.js":106,inherits:174,"safe-buffer":284}],83:[function(e,t,r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}},{}],84:[function(e,t,r){(function(r){(function(){var i=e("bn.js"),n=e("randombytes");function a(e){var t,r=e.modulus.byteLength();do{t=new i(n(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function s(e,t){var n=function(e){var t=a(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),s=t.modulus.byteLength(),o=new i(e).mul(n.blinder).umod(t.modulus),c=o.toRed(i.mont(t.prime1)),d=o.toRed(i.mont(t.prime2)),u=t.coefficient,l=t.prime1,h=t.prime2,f=c.redPow(t.exponent1).fromRed(),p=d.redPow(t.exponent2).fromRed(),m=f.isub(p).imul(u).umod(l).imul(h);return p.iadd(m).imul(n.unblinder).umod(t.modulus).toArrayLike(r,"be",s)}s.getr=a,t.exports=s}).call(this)}).call(this,e("buffer").Buffer)},{"bn.js":60,buffer:94,randombytes:266}],85:[function(e,t,r){"use strict";t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":86}],86:[function(e,t,r){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],87:[function(e,t,r){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],88:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("create-hash"),a=e("readable-stream"),s=e("inherits"),o=e("./sign"),c=e("./verify"),d=e("./algorithms.json");function u(e){a.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){a.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function h(e){return new u(e)}function f(e){return new l(e)}Object.keys(d).forEach((function(e){d[e].id=i.from(d[e].id,"hex"),d[e.toLowerCase()]=d[e]})),s(u,a.Writable),u.prototype._write=function(e,t,r){this._hash.update(e),r()},u.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},u.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),i=o(r,e,this._hashType,this._signType,this._tag);return t?i.toString(t):i},s(l,a.Writable),l.prototype._write=function(e,t,r){this._hash.update(e),r()},l.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},l.prototype.verify=function(e,t,r){var n="string"==typeof t?i.from(t,r):t;this.end();var a=this._hash.digest();return c(n,a,e,this._signType,this._tag)},t.exports={Sign:h,Verify:f,createSign:h,createVerify:f}},{"./algorithms.json":86,"./sign":89,"./verify":90,"create-hash":99,inherits:174,"readable-stream":280,"safe-buffer":284}],89:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("create-hmac"),a=e("browserify-rsa"),s=e("elliptic").ec,o=e("bn.js"),c=e("parse-asn1"),d=e("./curves.json");function u(e,t,r,a){if((e=i.from(e.toArray())).length<t.byteLength()){var s=i.alloc(t.byteLength()-e.length);e=i.concat([s,e])}var o=r.length,c=function(e,t){e=l(e,t),e=e.mod(t);var r=i.from(e.toArray());if(r.length<t.byteLength()){var n=i.alloc(t.byteLength()-r.length);r=i.concat([n,r])}return r}(r,t),d=i.alloc(o);d.fill(1);var u=i.alloc(o);return u=n(a,u).update(d).update(i.from([0])).update(e).update(c).digest(),d=n(a,u).update(d).digest(),{k:u=n(a,u).update(d).update(i.from([1])).update(e).update(c).digest(),v:d=n(a,u).update(d).digest()}}function l(e,t){var r=new o(e),i=(e.length<<3)-t.bitLength();return i>0&&r.ishrn(i),r}function h(e,t,r){var a,s;do{for(a=i.alloc(0);8*a.length<e.bitLength();)t.v=n(r,t.k).update(t.v).digest(),a=i.concat([a,t.v]);s=l(a,e),t.k=n(r,t.k).update(t.v).update(i.from([0])).digest(),t.v=n(r,t.k).update(t.v).digest()}while(-1!==s.cmp(e));return s}function f(e,t,r,i){return e.toRed(o.mont(r)).redPow(t).fromRed().mod(i)}t.exports=function(e,t,r,n,p){var m=c(t);if(m.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");return function(e,t){var r=d[t.curve.join(".")];if(!r)throw new Error("unknown curve "+t.curve.join("."));var n=new s(r).keyFromPrivate(t.privateKey),a=n.sign(e);return i.from(a.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==n)throw new Error("wrong private key type");return function(e,t,r){var n,a=t.params.priv_key,s=t.params.p,c=t.params.q,d=t.params.g,p=new o(0),m=l(e,c).mod(c),b=!1,g=u(a,c,e,r);for(;!1===b;)p=f(d,n=h(c,g,r),s,c),0===(b=n.invm(c).imul(m.add(a.mul(p))).mod(c)).cmpn(0)&&(b=!1,p=new o(0));return function(e,t){e=e.toArray(),t=t.toArray(),128&e[0]&&(e=[0].concat(e));128&t[0]&&(t=[0].concat(t));var r=e.length+t.length+4,n=[48,r,2,e.length];return n=n.concat(e,[2,t.length],t),i.from(n)}(p,b)}(e,m,r)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");if(void 0!==t.padding&&1!==t.padding)throw new Error("illegal or unsupported padding mode");e=i.concat([p,e]);for(var b=m.modulus.byteLength(),g=[0,1];e.length+g.length+1<b;)g.push(255);g.push(0);for(var v=-1;++v<e.length;)g.push(e[v]);return a(g,m)},t.exports.getKey=u,t.exports.makeKey=h},{"./curves.json":87,"bn.js":60,"browserify-rsa":84,"create-hmac":101,elliptic:119,"parse-asn1":247,"safe-buffer":284}],90:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("bn.js"),a=e("elliptic").ec,s=e("parse-asn1"),o=e("./curves.json");function c(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=0)throw new Error("invalid sig")}t.exports=function(e,t,r,d,u){var l=s(r);if("ec"===l.type){if("ecdsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");return function(e,t,r){var i=o[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new a(i),s=r.data.subjectPrivateKey.data;return n.verify(t,e,s)}(e,t,l)}if("dsa"===l.type){if("dsa"!==d)throw new Error("wrong public key type");return function(e,t,r){var i=r.data.p,a=r.data.q,o=r.data.g,d=r.data.pub_key,u=s.signature.decode(e,"der"),l=u.s,h=u.r;c(l,a),c(h,a);var f=n.mont(i),p=l.invm(a),m=o.toRed(f).redPow(new n(t).mul(p).mod(a)).fromRed().mul(d.toRed(f).redPow(h.mul(p).mod(a)).fromRed()).mod(i).mod(a);return 0===m.cmp(h)}(e,t,l)}if("rsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");t=i.concat([u,t]);for(var h=l.modulus.byteLength(),f=[1],p=0;t.length+f.length+2<h;)f.push(255),p+=1;f.push(0);for(var m=-1;++m<t.length;)f.push(t[m]);f=i.from(f);var b=n.mont(l.modulus);e=(e=new n(e).toRed(b)).redPow(new n(l.publicExponent)),e=i.from(e.fromRed().toArray());var g=p<8?1:0;for(h=Math.min(e.length,f.length),e.length!==f.length&&(g=1),m=-1;++m<h;)g|=e[m]^f[m];return 0===g}},{"./curves.json":87,"bn.js":60,elliptic:119,"parse-asn1":247,"safe-buffer":284}],91:[function(e,t,r){var i=Object.create||function(e){var t=function(){};return t.prototype=e,new t},n=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},a=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=i(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var o,c=10;try{var d={};Object.defineProperty&&Object.defineProperty(d,"x",{value:0}),o=0===d.x}catch(e){o=!1}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var a,s,o;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]):(s=e._events=i(null),e._eventsCount=0),o){if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(a=u(e))&&a>0&&o.length>a){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else o=s[t]=r,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function f(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=a.call(h,i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(!i)return[];var n=i[t];return n?"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):b(n,n.length):[]}function m(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function b(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}o?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');c=e}}):s.defaultMaxListeners=c,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){var t,r,i,n,a,s,o="error"===e;if(s=this._events)o=o&&null==s.error;else if(!o)return!1;if(o){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var c=new Error('Unhandled "error" event. ('+t+")");throw c.context=t,c}if(!(r=s[e]))return!1;var d="function"==typeof r;switch(i=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var i=e.length,n=b(e,i),a=0;a<i;++a)n[a].call(r)}(r,d,this);break;case 2:!function(e,t,r,i){if(t)e.call(r,i);else for(var n=e.length,a=b(e,n),s=0;s<n;++s)a[s].call(r,i)}(r,d,this,arguments[1]);break;case 3:!function(e,t,r,i,n){if(t)e.call(r,i,n);else for(var a=e.length,s=b(e,a),o=0;o<a;++o)s[o].call(r,i,n)}(r,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,i,n,a){if(t)e.call(r,i,n,a);else for(var s=e.length,o=b(e,s),c=0;c<s;++c)o[c].call(r,i,n,a)}(r,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(i-1),a=1;a<i;a++)n[a-1]=arguments[a];!function(e,t,r,i){if(t)e.apply(r,i);else for(var n=e.length,a=b(e,n),s=0;s<n;++s)a[s].apply(r,i)}(r,d,this,n)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,a,s,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=i(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(a=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,a=s;break}if(a<0)return this;0===a?r.shift():function(e,t){for(var r=t,i=r+1,n=e.length;i<n;r+=1,i+=1)e[r]=e[i];e.pop()}(r,a),1===r.length&&(n[e]=r[0]),n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.removeAllListeners=function(e){var t,r,a;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=i(null),this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=i(null):delete r[e]),this;if(0===arguments.length){var s,o=n(r);for(a=0;a<o.length;++a)"removeListener"!==(s=o[a])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=i(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(a=t.length-1;a>=0;a--)this.removeListener(e,t[a]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],92:[function(e,t,r){"use strict";var i=e("buffer").Buffer,n=e("buffer").SlowBuffer;function a(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}t.exports=a,a.install=function(){i.prototype.equal=n.prototype.equal=function(e){return a(this,e)}};var s=i.prototype.equal,o=n.prototype.equal;a.restore=function(){i.prototype.equal=s,n.prototype.equal=o}},{buffer:94}],93:[function(e,t,r){(function(e){(function(){t.exports=function(t,r){for(var i=Math.min(t.length,r.length),n=new e(i),a=0;a<i;++a)n[a]=t[a]^r[a];return n}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:94}],94:[function(e,t,r){(function(t){(function(){
8
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).samvyo=e()}}((function(){var define,module,exports;return function e(t,r,i){function n(s,o){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!o&&c)return c(s,!0);if(a)return a(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){return n(t[s][1][e]||e)}),u,u.exports,e,t,r,i)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(e,t,r){"use strict";var i=e("./lib/JsSdk_v1"),n=e("./lib/JsSdk"),a=e("./p2p/lib/P2pSdk");t.exports={JsSdk_v1:i.JsSdk_v1,JsSdk:n.JsSdk,P2pSdk:a.P2pSdk}},{"./lib/JsSdk":2,"./lib/JsSdk_v1":3,"./p2p/lib/P2pSdk":318}],2:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.JsSdk=void 0;var a=i(e("@babel/runtime/helpers/typeof")),s=i(e("@babel/runtime/helpers/objectWithoutProperties")),o=i(e("@babel/runtime/regenerator")),c=i(e("@babel/runtime/helpers/asyncToGenerator")),d=i(e("@babel/runtime/helpers/classCallCheck")),u=i(e("@babel/runtime/helpers/createClass")),l=i(e("@babel/runtime/helpers/possibleConstructorReturn")),h=i(e("@babel/runtime/helpers/getPrototypeOf")),f=i(e("@babel/runtime/helpers/inherits")),p=i(e("@babel/runtime/helpers/defineProperty")),m=D(e("mediasoup-client")),b=i(e("bowser")),g=e("./socket"),v=e("events"),y=i(e("./Logger")),_=e("./utils/queue"),w=e("./utils/sleep"),S=e("./utils/getRandomInt"),k=e("./utils/uuidv4"),R=(e("./utils/getVidScaleUrl"),e("./utils/verifyOutputQualites")),P=i(e("./utils/randomName")),M=e("./utils/chooseMedia"),E=D(e("jsonwebtoken")),x=(e("./utils/getUSerMediaConstraints"),e("./utils/constants")),T=e("./utils/verifyfileTypes"),C=["senderPeerId","mediaTag","sender","audioStatus","videoStatus","senderParticipantType","type","producerPaused"];function I(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(I=function(e){return e?r:t})(e)}function D(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=n(e)&&"function"!=typeof e)return{default:e};var r=I(t);if(r&&r.has(e))return r.get(e);var i={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var o=a?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,r&&r.set(e,i),i}function O(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return A(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?A(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){(0,p.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function B(e,t,r){return t=(0,h.default)(t),(0,l.default)(e,N()?Reflect.construct(t,r||[],(0,h.default)(e).constructor):t.apply(e,r))}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(N=function(){return!!e})()}var F,U=new y.default("Room"),q={small:{width:{ideal:160},height:{ideal:120}},qvga:{width:{ideal:320},height:{ideal:240}},vga:{width:{ideal:640},height:{ideal:480}},hd:{width:{ideal:1280},height:{ideal:720}}},z=new _.SocketQueue;r.JsSdk=function(e){function t(e){var r,i=e.peerId,n=e.roomId,a=e.outputData;return(0,d.default)(this,t),r=B(this,t),(0,p.default)(r,"joinRoom",(0,c.default)(o.default.mark((function e(){var t,i,n,a,s,c,d,u,l,h,f,p,m,b,g,v,y,_,w,S,k,R,M,E,T,C,I,D,O,A,L,B,N,F,q,z,V,G,W,H,K,$,J,Y,X,Z,Q,ee,te,re,ie,ne,ae,se,oe,ce,de,ue,le,he,fe,pe,me,be,ge,ve,ye=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(t=ye.length>0&&void 0!==ye[0]?ye[0]:{}).peerName,n=void 0===i?null:i,a=t.produce,s=void 0===a||a,c=t.produceAudio,d=void 0===c||c,u=t.produceVideo,l=void 0===u||u,h=t.consume,f=void 0===h||h,p=t.videoResolution,m=void 0===p?"hd":p,b=t.forceVp8,g=void 0!==b&&b,v=t.forceVp9,y=void 0!==v&&v,_=t.forceH264,w=void 0!==_&&_,S=t.h264Profile,k=void 0===S?"high":S,R=t.forcePCMU,M=void 0!==R&&R,E=t.forcePCMA,T=void 0!==E&&E,C=t.forceFPS,I=void 0===C?25:C,D=t.enableWebcamLayers,O=void 0===D||D,A=t.numSimulcastStreams,L=void 0===A?3:A,B=t.autoGainControl,N=void 0===B||B,F=t.echoCancellation,q=void 0===F||F,z=t.noiseSuppression,V=void 0===z||z,G=t.sampleRate,W=void 0===G?44e3:G,H=t.channelCount,K=void 0===H?1:H,$=t.videoBitRates,J=void 0===$?[700,250,75]:$,Y=t.share,X=void 0!==Y&&Y,Z=t.shareAudio,Q=void 0!==Z&&Z,ee=t.enableSharingLayers,te=void 0===ee||ee,re=t.shareBitRates,ie=void 0===re?[2500,1250,500]:re,ne=t.audioDeviceId,ae=void 0===ne?null:ne,se=t.videoDeviceId,oe=void 0===se?null:se,ce=t.peerType,de=void 0===ce?"participant":ce,ue=t.roomType,le=void 0===ue?x._security.roomType.CONFERENCING:ue,he=t.authenticationRequired,fe=void 0!==he&&he,pe=t.password,me=void 0===pe?null:pe,be=t.roomDisplayName,ge=void 0===be?null:be,U.info("Going to join room"),["hd","vga","qvga"].includes(m)||(U.warn("Invalid video resolution value. setting it to default value of 'hd' "),m="hd"),"boolean"!=typeof s&&(U.warn("Produe should either be true or false"),s=Boolean(s)),"boolean"!=typeof d&&(U.warn("ProduceAudio should either be true or false"),d=Boolean(d)),"boolean"!=typeof l&&(U.warn("ProduceVideo should either be true or false"),l=Boolean(l)),"boolean"!=typeof f&&(U.warn("Consume should either be true or false"),f=Boolean(f)),"boolean"!=typeof g&&(U.warn("forceVp8 should either be true or false"),g=Boolean(g)),"boolean"!=typeof y&&(U.warn("forceVp9 should either be true or false"),y=Boolean(y)),"boolean"!=typeof w&&(U.warn("forceH264 should either be true or false"),w=Boolean(w)),["high","low"].includes(k.toLowerCase())||(U.warn("h264Profile should either be 'high' or 'low'"),k="high"),(!Number.isInteger(I)||Number.isInteger(I)&&(I>65||I<5))&&(U.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),I=25),"boolean"!=typeof O&&(U.warn("enableWebcamLayers should either be true or false"),O=Boolean(O)),(!Number.isInteger(L)||Number.isInteger(L)&&(L>3||L<1))&&(U.warn("numSimulcastStreams should be a number between 1 to 3, default value is 3."),L=3),Array.isArray(J)&&J.length>=1&&J.length<=3&&J.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?U.debug("videoBitRates values are correct"):(U.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[700,250,75]'"),J=[700,250,75]),"boolean"!=typeof M&&(U.warn("forcePCMU should either be true or false"),M=Boolean(M)),"boolean"!=typeof T&&(U.warn("forcePCMA should either be true or false"),T=Boolean(T)),"boolean"!=typeof N&&(U.warn("autoGainControl should either be true or false"),N=Boolean(N)),"boolean"!=typeof q&&(U.warn("echoCancellation should either be true or false"),q=Boolean(q)),"boolean"!=typeof V&&(U.warn("noiseSuppression should either be true or false"),V=Boolean(V)),(!Number.isInteger(W)||Number.isInteger(W)&&(W>64e3||W<8e3))&&(U.warn("sampleRate should be a number between 8000 to 64000, default value is 44000 Khz."),W=44e3),(!Number.isInteger(K)||Number.isInteger(K)&&(K>2||K<1))&&(U.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),K=1),"boolean"!=typeof X&&(U.warn("share should either be true or false"),X=Boolean(X)),"boolean"!=typeof Q&&(U.warn("shareAudio should either be true or false"),Q=Boolean(Q)),"boolean"!=typeof te&&(U.warn("enableSharingLayers should either be true or false"),te=Boolean(te)),Array.isArray(ie)&&ie.length>=1&&ie.length<=3&&ie.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?U.debug("shareBitRates values are correct"):(U.warn("sharebitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[2500,1250,500]'"),ie=[2500,1250,500]),["moderator","participant","attendee"].includes(de)?U.debug("peerType is valid:%s",de):(de="participant",U.debug("peerType is invalid:%s. By default set to: participant",de)),e.next=29,r.listDevicesInternal();case 29:r._videoResolution=m,r._forceVP8=Boolean(g),r._forceH264=Boolean(w),r._forceVP9=Boolean(y),r._enableWebcamLayers=Boolean(O),r._numSimulcastStreams=L,r._enableSharingLayers=Boolean(te),e.prev=36,n||(n=(0,P.default)()),r.data.inputParams=j(j({},r.data.inputParams),{},{peerName:n,produce:s,produceAudio:d,produceVideo:l,consume:f,videoResolution:m,forceVp8:g,forceVp9:y,forceH264:w,h264Profile:k,forceFPS:I,forcePCMU:M,forcePCMA:T,enableWebcamLayers:O,numSimulcastStreams:L,autoGainControl:N,echoCancellation:q,noiseSuppression:V,sampleRate:W,channelCount:K,videoBitRates:J,share:X,shareAudio:Q,enableSharingLayers:te,shareBitRates:ie,audioDeviceId:ae,videoDeviceId:oe,peerType:de,roomType:le,authenticationRequired:fe,password:me,roomDisplayName:ge}),U.info("input params are:%O",r.data.inputParams),ve={id:"joinRoom",type:"r",peerId:r.data.inputParams.peerId,participantType:"attendee"===de?"viewer":de,roomType:le,roomDisplayName:ge||"room-".concat(1e5+Math.round(9e5*Math.random())),browser:r._client,name:r.data.inputParams.peerName,room:r.data.inputParams.roomId,authenticationRequired:fe,isRoomPassword:!!me,roomPassword:me||null,usageType:"sdk"},r._sendMessage(ve),e.next=48;break;case 44:return e.prev=44,e.t0=e.catch(36),U.error("Failed to join room:",e.t0.message),e.abrupt("return",{success:!1,reason:e.t0.message});case 48:case"end":return e.stop()}}),e,null,[[36,44]])})))),(0,p.default)(r,"authenticateUser",(function(e){U.info("Moderator authentication requested:%O",e),r.emit("moderatorAuthentication",{moderatorName:e.moderatorName,requesterName:e.requesterName,requesterPeerId:e.requesterPeerId,text:e.title})})),(0,p.default)(r,"authenticationRequested",(function(e){U.info("Moderator authentication requested:%O",e),r.emit("authenticationRequested",{requesterName:e.requesterName,requesterPeerId:r.data.inputParams.peerId,text:e.title})})),(0,p.default)(r,"allowRoomJoin",(function(e){if(!e)return U.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};U.info("Allow user to join room:%O",e);var t={id:"userAuthenticated",peerId:e,roomName:r.data.inputParams.roomId,moderator:r.data.inputParams.peerId};r._sendMessage(t)})),(0,p.default)(r,"denyRoomJoin",(function(e){if(!e)return U.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};U.info("Deny user to join room:%O",e);var t={id:"userDenied",peerId:e,roomName:r.data.inputParams.roomId,moderator:r.data.inputParams.peerId};r._sendMessage(t)})),(0,p.default)(r,"hideUserAuthenticationDialog",(function(e){U.debug("authentication already done message:%o",e),r.emit("moderatorAuthStatus",{requesterId:e.requesterId,moderatorActed:e.peerId})})),(0,p.default)(r,"sendCustomMessage",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"general",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o={id:"customMessage",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,data:e,type:t,recieverPeerId:i,senderType:n,messageType:a,customData:s};U.debug("Room sendCustomMessage",o),r._sendMessage(o)})),(0,p.default)(r,"processCustomMessage",(function(e){U.debug("Room processCustomMessage",e),r.emit("customMessage",e)})),(0,p.default)(r,"_createSendTransport",(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Room _createSendTransport"),e.prev=1,r._device.loaded){e.next=6;break}return U.debug("Room _createSendTransport","Going to load device with routerrtpcapabilities"),e.next=6,r._device.load({routerRtpCapabilities:r._routerRtpCapabilities});case 6:t=x.MSG_DIRECTION_SEND,r._sendTransport||r._sendMessage({id:"createTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,direction:t}),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),U.error("Room _createSendTransport",e.t0);case 13:case"end":return e.stop()}}),e,null,[[1,10]])})))),(0,p.default)(r,"_createRecvTransport",(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r._device.loaded){e.next=4;break}return U.debug("loading device for creating recv transport"),e.next=4,r._device.load({routerRtpCapabilities:r._routerRtpCapabilities});case 4:t=x.MSG_DIRECTION_RECV,r._recvTransport||(U.debug("receive transport created"),r._sendMessage({id:"createTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,direction:t}));case 6:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"handleCreateTransportRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var i,n,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Room handleCreateTransportRequest():%O",t),i=t.transportOptions,n=t.direction,a=void 0,e.prev=3,"recv"!==n){e.next=13;break}return e.next=7,r._device.createRecvTransport(i);case 7:a=e.sent,U.debug("Room","handleCreateTransportRequest() recv transport created ".concat(a.id)),r._recvTransport=a,r.handleRecvTransportListeners(),e.next=24;break;case 13:if("send"!==n){e.next=23;break}return e.next=16,r._device.createSendTransport(i);case 16:a=e.sent,U.debug("Room","handleCreateTransportRequest() send transport created [id:%s]".concat(a.id)),r._sendTransport=a,r.handleSendTransportListeners(),r.produceMedia(),e.next=24;break;case 23:throw new Error("bad transport 'direction': ".concat(n));case 24:e.next=29;break;case 26:e.prev=26,e.t0=e.catch(3),console.error("handleCreateTransportRequest() failed to create transport [error:%o]",e.t0);case 29:case"end":return e.stop()}}),e,null,[[3,26]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleSendTransportListeners",(function(){r._sendTransport.on("connect",r.handleTransportConnectEvent),r._sendTransport.on("produce",r.handleTransportProduceEvent);var e=r;r._sendTransport.on("connectionstatechange",function(){var t=(0,c.default)(o.default.mark((function t(i){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(U.debug("ConferenceRoom sendTransport connectionState ".concat(i," & socketconnection state ").concat(r._socket._ws.readyState)),"failed"!==i&&"disconnected"!==i){t.next=13;break}if(1!==r._socket._ws.readyState){t.next=6;break}e.restartIce(r._sendTransport.id,"send"),t.next=13;break;case 6:if(1===r._socket._ws.readyState){t.next=12;break}return U.debug("socket not yet ready with state- ".concat(r._socket._ws.readyState)),t.next=10,(0,w.sleep)(1500);case 10:t.next=6;break;case 12:"connected"===r._roomStatus&&r.restartIce(r._sendTransport.id,"send");case 13:U.debug("ConferenceRoom","send transport connection state change [state:%s]".concat(i));case 14:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())})),(0,p.default)(r,"handleTransportConnectEvent",(function(e,t,i){var n=e.dtlsParameters;try{z.push("connectTransport",(function(e){U.debug("connect-transport action"),t(),z.remove("connectTransport")}));var a={id:"connectTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,transportId:r._sendTransport.id,dtlsParameters:n,direction:"send"};r._sendMessage(a)}catch(e){U.error("handleTransportConnectEvent() failed [error:%o]",e),i(e)}})),(0,p.default)(r,"handleTransportProduceEvent",(function(e,t,i){var n=e.kind,a=e.rtpParameters,s=e.appData;try{z.push("produce",(function(e){U.debug("handleTransportProduceEvent callback [data:%o]",e),t({id:e.producerId}),z.remove("produce")}));var o=s.mediaTag===x.STREAM_TYPE_CAM_AUDIO&&void 0!==r.data.inputParams.audioStatus&&!r.data.inputParams.audioStatus;U.debug("handleTransportProduceEvent() | pause status->".concat(o));var c={id:"sendTrack",transportId:r._sendTransport.id,peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,kind:n,rtpParameters:a,paused:o,appData:s,clientOs:r._client.os.name,browser:r._client.browser};r._sendMessage(c)}catch(e){U.error("handleTransportProduceEvent() failed [error:%o]",e),i(e)}})),(0,p.default)(r,"produceMedia",(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.data.inputParams.produce?(r.data.inputParams.produceAudio?r.enableMic({deviceId:r.data.inputParams.audioDeviceId?r.data.inputParams.audioDeviceId:null}):U.debug("No need to produce audio!"),r._device.canProduce("video")&&(r.data.inputParams.produceVideo?r.enableCam({deviceId:r.data.inputParams.videoDeviceId?r.data.inputParams.videoDeviceId:null}):U.debug("No need to produce video!"),r.data.inputParams.share&&r.enableShare({shareAudio:r.data.inputParams.shareAudio,enableSharingLayers:r._enableSharingLayers,shareBitRates:r.data.inputParams.shareBitRates}))):U.warn("produce is false!");case 1:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"handleRecvTransportListeners",(0,c.default)(o.default.mark((function e(){var t,i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r._recvTransport.on("connect",r.handleRecvTransportConnectEvent),t=r,r._recvTransport.on("connectionstatechange",function(){var e=(0,c.default)(o.default.mark((function e(i){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("ConferenceRoom recvTransport connectionState ".concat(i," & socketconnection state ").concat(r._socket._ws.readyState)),"failed"!==i&&"disconnected"!==i){e.next=13;break}if(1!==r._socket._ws.readyState){e.next=6;break}t.restartIce(r._recvTransport.id,"recv"),e.next=13;break;case 6:if(1===r._socket._ws.readyState){e.next=12;break}return U.debug("socket not yet ready with state- ".concat(r._socket._ws.readyState)),e.next=10,(0,w.sleep)(1e3);case 10:e.next=6;break;case 12:"connected"===r._roomStatus&&t.restartIce(r._recvTransport.id,"recv");case 13:U.debug("ConferenceRoom","Recv transport connection state change [state:%s]".concat(i));case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),i={id:"transportsAvailable",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,rtpCapabilities:r._device.rtpCapabilities},r._sendMessage(i);case 5:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"handleRecvTransportConnectEvent",(function(e,t,i){var n=e.dtlsParameters;try{z.push("connectRecvTransport",(function(e){U.debug("ConferenceRoom","connect-recv-transport action"),t(),z.remove("connectRecvTransport")}));var a={id:"connectTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,transportId:r._recvTransport.id,dtlsParameters:n,direction:"recv"};r._sendMessage(a)}catch(e){U.error("handleTransportConnectEvent() failed [error:%o]",e),i(e)}})),(0,p.default)(r,"handleRecvTrackRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var i,n,a,c,d,u,l,h,f,b;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Room handleRecvTrackRequest",t),r.data.inputParams.consume){e.next=4;break}return U.warn("I do not want to consume"),e.abrupt("return");case 4:return i=t.senderPeerId,n=t.mediaTag,t.sender,t.audioStatus,t.videoStatus,t.senderParticipantType,a=t.type,c=t.producerPaused,d=(0,s.default)(t,C),U.debug("New consumer created",d),d.id=d.consumerId,delete d.consumerId,U.debug("ConferenceRoom","senderPeerId is ->".concat(i)),e.next=11,r._recvTransport.consume(j(j({},d),{},{streamId:"".concat(i,"-").concat("screen-video"===n||"screen-audio"===n?"share":"mic-webcam"),appData:{peerId:i,mediaTag:n}}));case 11:u=e.sent;case 12:if(!r._recvTransport||"connected"===r._recvTransport.connectionState){e.next=18;break}return U.debug("recv transport connstate".concat(r._recvTransport.connectionState)),e.next=16,(0,w.sleep)(100);case 16:e.next=12;break;case 18:return r._consumers.set(u.id,u),u.on("transportclose",(function(){r._consumers.delete(u.id)})),l=m.parseScalabilityMode(u.rtpParameters.encodings[0].scalabilityMode),h=l.spatialLayers,f=l.temporalLayers,b=r._peers.get(r.data.inputParams.peerId),U.debug("Consumer created for sender peerId ".concat(i," for kind ").concat(u.kind," for receiver peerId ").concat(r.data.inputParams.peerId)),U.info("The old peer data is :%O",b),b?(b["screen-video"===n||"screen-audio"===n?"ss".concat(u.kind):u.kind]={consumerId:u.id,type:a,locallyPaused:!1,remotelyPaused:c,rtpParameters:u.rtpParameters,spatialLayers:h,temporalLayers:f,preferredSpatialLayer:h-1,preferredTemporalLayer:f-1,priority:1,codec:u.rtpParameters.codecs[0].mimeType.split("/")[1],track:u.track,share:"screen-video"===n||"screen-audio"===n},U.info("The new peer data is :%O",b),r._peers.set(r.data.inputParams.peerId,b)):(U.info("Peer not found!"),r._peers.set(r.data.inputParams.peerId,(0,p.default)({},"screen-video"===n||"screen-audio"===n?"ss".concat(u.kind):u.kind,{consumerId:u.id,type:a,locallyPaused:!1,remotelyPaused:c,rtpParameters:u.rtpParameters,spatialLayers:h,temporalLayers:f,preferredSpatialLayer:h-1,preferredTemporalLayer:f-1,priority:1,codec:u.rtpParameters.codecs[0].mimeType.split("/")[1],track:u.track,share:"screen-video"===n||"screen-audio"===n}))),e.next=27,r.resumeConsumer(u);case 27:U.debug("Going to emit mic start / videostart"),"audio"===u.kind?"screen-audio"===n?r.emit("ssAudioStart",{peerId:i,audioTrack:u.track,type:"remote"}):r.emit("micStart",{peerId:i,audioTrack:u.track,type:"remote"}):"video"===u.kind&&("screen-video"===n?r.emit("ssVideoStart",{peerId:i,videoTrack:u.track,type:"remote"}):r.emit("videoStart",{peerId:i,videoTrack:u.track,type:"remote"}));case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"resumeConsumer",function(){var e=(0,c.default)(o.default.mark((function e(t){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=12;break}return U.debug("resume consumer",t.appData.peerId,t.appData.mediaTag),e.prev=2,i={id:"resumeConsumer",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,consumerId:t.id},r._sendMessage(i),e.next=7,t.resume();case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error(e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleConnectTransportRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("handleTransportConnectRequest()"),e.prev=1,r=z.get("connectTransport")){e.next=5;break}throw new Error("transport-connect action was not found");case 5:return e.next=7,r(t);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.error("handleTransportConnectRequest() failed [error:%o]",e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleConnectRecvTransportRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("handleTransportConnectRequest()"),e.prev=1,r=z.get("connectRecvTransport")){e.next=5;break}throw new Error("recv transport-connect action was not found");case 5:return e.next=7,r(t);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.error("handleRecvTransportConnectRequest() failed [error:%o]",e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleSendTrackRequest",function(){var e=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("ConferenceRoom","handleProduceRequest()"),e.prev=1,r=z.get("produce")){e.next=5;break}throw new Error("produce action was not found");case 5:return e.next=7,r(t);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),U.error("handleProduceRequest() failed [error:%o]",e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"mediaToggled",(function(e){switch(U.debug("Media Toggled message:%O",e),e.type){case"video":U.debug("mediaToggled() | inside case video".concat(e.videoStatus));break;case"audio":U.debug("mediaToggled() | inside case audio".concat(e.videoStatus)),e.audioStatus?r.emit("peerUnMuted",{peerId:e.peerId,type:"remote"}):r.emit("peerMuted",{peerId:e.peerId,type:"remote"})}})),(0,p.default)(r,"closeConsumer",(function(e){var t=e.consumerId,i=r._consumers.get(t);if(i){var n=i.appData,a=n.peerId,s=n.mediaTag;U.debug("Consumer closed for consumerId:%s, type:%s, appData:%o",t,null==i?void 0:i.kind,i.appData);var o="screen-audio"===s||"screen-video"===s?"ss".concat(i.kind):i.kind;i.close(),r._consumers.delete(t);var c=r._peers.get(r.data.inputParams.peerId);U.debug("Peer data before deletion:%O",c),c[o]&&c[o].consumerId===t&&delete c[o],U.debug("Peer data after deletion:%O",c),r._peers.set(r.data.inputParams.peerId,c),"audio"===(null==i?void 0:i.kind)?(U.debug("Going to emit micEnd, consumer closed for audio"),"screen-audio"===s?r.emit("ssAudioStop",{peerId:a,track:null,type:"remote"}):r.emit("micEnd",{peerId:a,track:null,type:"remote"})):"video"===(null==i?void 0:i.kind)&&(U.debug("Going to emit videoEnd, consumer closed for video"),"screen-video"===s?r.emit("ssVideoStop",{peerId:a,track:null,type:"remote"}):r.emit("videoEnd",{peerId:a,track:null,type:"remote"}))}else U.warn("Consumer with id not found!:%s",t)})),(0,p.default)(r,"peerLeft",(function(e){U.debug("Peer Left message is:%o",e);var t=e.peerId;r._peers.delete(t),r.emit("peerLeft",{peerId:t})})),(0,p.default)(r,"roomClosed",(function(){U.info("room closed by Moderator"),r._peers=null,r.emit("roomClosed",{roomId:r.data.inputParams.roomId})})),(0,p.default)(r,"leaveRoomCommon",(function(){r._sendTransport&&(r._sendTransport.close(),r._sendTransport=null),r._recvTransport&&(r._recvTransport.close(),r._recvTransport=null),r._webCamStream&&r._webCamStream.getVideoTracks().forEach((function(e){e.stop(),U.debug("Video Track stopped")})),r._micStream&&r._micStream.getAudioTracks().forEach((function(e){e.stop(),U.debug("Mic Track stopped")})),r._roomStatus="closed",r._running=!1,r._routerRtpCapabilities=null})),(0,p.default)(r,"restartIce",function(){var e=(0,c.default)(o.default.mark((function e(t,i){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("send"===i&&"connected"===r._sendTransport.connectionState||"recv"===i&&"connected"===r._recvTransport.connectionState)){e.next=3;break}return U.debug("no need to restart ICE as transport now connected"),e.abrupt("return");case 3:U.debug("websocket is ready and connectionstate is still disconnected, therefore going to restart ICE"),n={id:"restartIce",transportId:t,roomName:r.data.inputParams.roomId,peerId:r.data.inputParams.peerId},r._sendMessage(n);case 6:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),(0,p.default)(r,"restartIceResponse",(function(e){U.debug("restart ICE response:%o",e);var t=e.transportId,i=e.iceParameters;r._sendTransport&&r._sendTransport.id===t?r._sendTransport.restartIce({iceParameters:i}):r._recvTransport&&r._recvTransport.id===t&&r._recvTransport.restartIce({iceParameters:i})})),(0,p.default)(r,"startRecording",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.recordingType,i=void 0===t?null:t,n=e.outputType,a=void 0===n?null:n,s=e.outputQualities,o=void 0===s?null:s;U.debug("recording type requested is:%s,outputType:%s, outputQualties:%o",i,a,o);var c=!i||"av"!==(null==i?void 0:i.toLowerCase())&&"audiovideo"!==(null==i?void 0:i.toLowerCase())?x.MERGEA:x.MERGE;if((!a||"hls"!==a.toLowerCase()&&"mp4"!==a.toLowerCase())&&a)return U.error("Invalid outut type"),{success:!1,reason:"Invalid outputType: ".concat(a,". ")};if(a&&"hls"===a.toLowerCase()&&o&&!(0,R.isValidOutputQualities)(o))return U.error("Invalid outut qualities"),{success:!1,reason:"Invalid outputQualities: ".concat(JSON.stringify(o),". ")+"Allowed values are ".concat(Array.from(R.ALLOWED_QUALITIES).join(", "),".")};var d={id:"startRecording",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,url:window.location.hostname,type:x.RECORD,recordingStrategy:c,outputQualities:o,outputType:null==a?void 0:a.toLowerCase()};r._sendMessage(d),r._recordingStartedByMe=j(j({},r._recordingStartedByMe),{},{"main-room":{recordingNo:null}})})),(0,p.default)(r,"stopRecording",(function(){U.debug("going to stop recording for recordingStartedByMe:%o",r._recordingStartedByMe);var e="main-room";if(!r._recordingStartedByMe[e])return{success:!1,error:!0,code:"RRID001",text:"Error while trying to stop recording. Either the recording has not been started yet Or The same user need to stop recording who started it."};var t={id:"stopRecording",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,recordingNo:r._recordingStartedByMe[e].recordingNo,type:x.RECORD};r._sendMessage(t),delete r._recordingStartedByMe[e],r.emit("recordingEnded",{peerId:r.data.inputParams.peerId})})),(0,p.default)(r,"setRecordingStatusStarted",(function(e){U.debug("Recording/Streaming started by moderator!!:%O",e);e.breakOutRoom;var t=e.recordingStartTime,i=e.recordingNo,n=e.type;[x.RECORD,x.RTMPSTREAMANDRECORD].includes(n)&&(r._recordingStartedByMe["main-room"]?(U.debug("This recording has been started by me."),r._recordingStartedByMe["main-room"].recordingNo=i,r.emit("recordingStarted",{peerId:r.data.inputParams.peerId,startTime:t})):r.emit("recordingStarted",{startTime:t}))})),(0,p.default)(r,"setRecordingStatusEnded",(function(e){U.debug("Recording ended by moderator!!, data:%O",e);e.breakOutRoom;e.type===x.RTMPSTREAM||r.emit("recordingEnded",{})})),(0,p.default)(r,"startProcessing",(0,c.default)(o.default.mark((function e(){var t,i,n,a,s,c,d,u,l,h,f,m,b,g,v,y,_,w,S,k=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(t=k.length>0&&void 0!==k[0]?k[0]:{}).inputFiles,n=void 0===i?[]:i,a=t.outputQualities,s=void 0===a?null:a,c=t.bucket,d=void 0===c?null:c,u=t.cloud,l=void 0===u?null:u,h=t.region,f=void 0===h?null:h,U.debug("Processing of Files requested for:%o",n),m=Math.round(1e7*Math.random()),e.next=5,(0,T.verifyFiles)(n);case 5:if(!(b=e.sent).success){e.next=18;break}if(!s||(0,R.isValidOutputQualities)(s)){e.next=10;break}return U.error("Invalid outut qualities"),e.abrupt("return",{success:!1,reason:"Invalid outputQualities: ".concat(JSON.stringify(s),". ")+"Allowed values are ".concat(Array.from(R.ALLOWED_QUALITIES).join(", "),".")});case 10:r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},m,{})),g=O(n);try{for(g.s();!(v=g.n()).done;)y=v.value,_=y.type,w=y.url,r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},m,j(j({},r._processingStartedByMe[m]),{},(0,p.default)({},w,{type:_,url:w,status:"pending"}))))}catch(e){g.e(e)}finally{g.f()}return S={id:"processVideos",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,inputFiles:n,outputQualities:s,bucket:d,cloud:l,region:f,requestId:m,type:x.PROCESS},r._sendMessage(S),e.abrupt("return",{success:!0});case 18:return e.abrupt("return",b);case 19:case"end":return e.stop()}}),e)})))),(0,p.default)(r,"checkProcessingStatus",(function(e){var t=e.requestId;return U.debug("Going to check processing status for request Id:%s",t),r._processingStartedByMe[t]?{success:!0,details:r._processingStartedByMe[t]}:{success:!0,details:r._processingStartedByMe}})),(0,p.default)(r,"handleProcessingStart",(function(e){var t=e.processingStartTime,i=(e.processingNo,e.requestId);U.debug("handleProcessingStart()| received message is:%o",e),r.emit("processingStarted",{processingStartTime:t,requestId:i})})),(0,p.default)(r,"handleProcessingCompletion",(function(e){var t=e.totalProcessingTime,i=e.hlsfileKey,n=e.size,a=e.originalFile,s=e.lastFile,o=e.requestId;if(U.debug("handleProcessingCompletion()| received message is:%o",e),U.debug("Before update, Total files to be processed are:%o",r._processingStartedByMe),r._processingStartedByMe[a]&&(r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},o,j(j({},r._processingStartedByMe[o]),{},(0,p.default)({},a,j(j({},r._processingStartedByMe[a]),{},{status:"completed",hlsfileKey:i,size:n,totalProcessingTime:t})))))),U.debug("After update, Total files to be processed are:%o",r._processingStartedByMe),r.emit("processingCompleted",e),s){U.debug("The last file processing has been completed! Remove all the files that has been completed with the same requesterId");var c=j({},r._processingStartedByMe);delete c[o],U.debug("After deleting the current requestId:%o",c),r._processingStartedByMe=c}})),(0,p.default)(r,"handleProcessingError",(function(e){var t=e.totalProcessingTime,i=e.hlsfileKey,n=e.size,a=e.originalFile,s=(e.lastFile,e.requestId),o=e.error;U.debug("handleProcessingCompletion()| received message is:%o",e),U.debug("Before update, Total files to be processed are:%o",r._processingStartedByMe),r._processingStartedByMe[a]&&(r._processingStartedByMe=j(j({},r._processingStartedByMe),{},(0,p.default)({},s,j(j({},r._processingStartedByMe[s]),{},(0,p.default)({},a,j(j({},r._processingStartedByMe[a]),{},{status:"error",hlsfileKey:i,size:n,totalProcessingTime:t,error:o})))))),U.debug("After update, Total files to be processed are:%o",r._processingStartedByMe),r.emit("processingError",e)})),r._closed=!1,r._roomStatus="initialised",r._roomDisplayName=null,r._running=!1,r._cignal=null,r._socket=null,r._sendTransport=null,r._recvTransport=null,r._device=new m.Device,r._webCamProducer=null,r._micProducer=null,r._shareProducer=null,r._shareAudioProducer=null,r._producers=new Map,r._consumers=new Map,r._peers=new Map,r._data=j(j({},a),{},{inputParams:{peerId:i,roomId:n,roomType:"conferencing"}}),r._micStream=null,r._webCamStream=null,r._webcam={device:null,resolution:"hd"},r._mic={device:null},r._deviceList=F||null,r._externalVideo=null,r._externalVideoStream=null,r._forceVP8=!1,r._forceH264=!1,r._forceVP9=!1,r._enableWebcamLayers=!0,r._numSimulcastStreams=3,r._enableSharingLayers=!0,r._client=b.default.parse(window.navigator.userAgent),r._routerRtpCapabilities=null,r._recordingStartedByMe={},r._cignalConnected=!1,r._reconnectionInitiated=!1,r._restartIceInProgressSendTransport=!1,r._restartIceInProgressRecvTransport=!1,r._activeSpeaker=null,r.initLocal(),r}return(0,f.default)(t,e),(0,u.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("Setting the whole data object is not possible!")}},{key:"peers",get:function(){return this._peers},set:function(e){throw new Error("Setting the whole peers object is not possible!")}},{key:"transports",get:function(){return{produce:this._sendTransport,consume:this._recvTransport}},set:function(e){throw new Error("Setting of transport is not possible!")}},{key:"videoStream",get:function(){return this._webCamStream}},{key:"audioStream",get:function(){return this._micStream}},{key:"clientAgent",get:function(){return this._client}},{key:"activeParameters",get:function(){return this._data.inputParams}},{key:"deviceList",get:function(){return this._deviceList?this._deviceList:{videoDevices:[],audioDevices:[],audioOutputDevices:[]}},set:function(e){throw new Error("Setting of deviceList is not possible!")}},{key:"currentlyActiveSpeaker",get:function(){return this._activeSpeaker},set:function(e){throw new Error("Setting of currentActivespeaker is not possible!")}},{key:"roomDisplayName",get:function(){return this._roomDisplayName},set:function(e){throw new Error("Setting of roomDisplayName is not possible!")}},{key:"initLocal",value:(X=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=m.detectDevice(),U.debug("The device is:%O",t),e.next=4,this._initSocket();case 4:case"end":return e.stop()}}),e,this)}))),function(){return X.apply(this,arguments)})},{key:"_initSocket",value:(Y=(0,c.default)(o.default.mark((function e(){var t,r,i,n=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this,r=this.data.signallingServerUrl.replace(/^(http|https):\/\//,""),i="wss://".concat("".concat(r),"/?sessionToken=",this.data.sessionToken,"&roomId=").concat(this.data.inputParams.roomId,"&peerId=").concat(this.data.inputParams.peerId,"&roomType=").concat(this.data.inputParams.roomType),U.info("Going to create a new socket! with address: ".concat(r)),this._socket=new g.WebSocketTransport(i,!0),this._listenToSocket(),this._socket.on("notify",(function(e){var t=e.type,r=e.title,i=e.message;n.emit("notification",{eventType:t,eventText:"".concat(r,": ").concat(i),roomId:n.data.inputParams.roomId,peerId:n.data.inputParams.peerId})})),this._socket.on("roomStartedP2p",(function(e){U.info("P2P room successfully started"),n._running=!0})),this._socket.on("userError",(function(e){U.error("User Error happened with message:%O",e),t.emit("notification",{eventType:e.title,eventText:"".concat(e.text)})})),this._socket.on("validationAlert",(function(e){U.info("Validation alert happened")})),this._socket.on("alreadyActive",(function(e){e.title,e.text,n.emit("notification",{eventType:"alreadyActive",eventText:"This peer already has an active connection",roomId:n.data.inputParams.roomId,peerId:n.data.inputParams.peerId})})),this._socket.on("passwordDisabled",(function(){U.info("password disabled by moderator!"),n.emit("notification",{eventType:"passwordDisabled",eventText:"Password for this room has been disabled by moderator",roomId:n.data.inputParams.roomId})})),this._socket.on("close",(function(e){var t=e.code,r=e.reason;if(U.info("socket closed with code ".concat(t)),4500!==t&&4100!==t){var i=r||"Connection to server closed unexpectedly! Trying to reconnect.";U.info("socket close code is".concat(t," with reason ").concat(i))}else U.info("Socket is now closed!"),n.close()})),this._socket.on("connected",(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.info("Socket connected"),t.pc&&t._sendTransport&&t._recvTransport?roomType===x._security.roomType.P2P&&t.pc?(U.info("Socket seems to be reconnected in mid call! RestartIce needed for p2p call."),"failed"!==t.pc.iceConnectionState&&"disconnected"!==t.pc.iceConnectionState||t.restartICE()):(U.debug("Ice restarts for mediasoup transports for a joined peer"),t._sendTransport&&["Failed","disconnected"].includes(t._sendTransport.connectionState)?(U.debug("Restart ice for sendtransport"),t.restartIce(t._sendTransport.id,"send")):U.error("Send transport not available!"),t._recvTransport&&["Failed","disconnected"].includes(t._recvTransport.connectionState)?(U.debug("Restart ice for recvtransport"),t.restartIce(t._recvTransport.id,"recv")):U.error("Recv transport not available!")):(U.info("Connection getting connected for first time"),n.emit("initSuccess"));case 2:case"end":return e.stop()}}),e)})))),this._socket.on("defaultJoinStatus",function(){var e=(0,c.default)(o.default.mark((function e(t){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.info(" Socket defaultjoinstatus:%O",t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 15:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"_sendMessage",value:function(e){this._socket.send(j({usageType:"sdk"},e))}},{key:"_listenToSocket",value:function(){var e=this;this._socket.on("message",(function(t){try{switch("currentlyActiveSpeaker"===t.id||"allStats"===t.id||U.info("message in Room is:%O",t),t.id){case"chatMessage":e.processChatMessage(t);break;case"customMessage":e.processCustomMessage(t);break;case"existingParticipants":e.onExistingParticipants(t);break;case"newPeerJoin":e.onNewPeer(t);break;case"recordingError":e.handleRecordingErrors(t);break;case"moderatorAuthentication":e.authenticateUser(t);break;case"authenticationRequested":e.authenticationRequested(t);break;case"toggleMyMic":e.toggleMyMic(t);break;case"toggleMyCamera":e.toggleMyCamera(t);break;case"logMeOut":e.logMeOutNew(t);break;case"userAlreadyAuthenticated":e.hideUserAuthenticationDialog(t);break;case"peerLeft":e.peerLeft(t);break;case"recordingStarted":e.setRecordingStatusStarted(t);break;case"recordingStopped":e.setRecordingStatusEnded(t);break;case"startDefaultRecording":e.startRecording(t);break;case"mediaToggled":e.mediaToggled(t);break;case"processingStarted":e.handleProcessingStart(t);break;case"processingCompleted":e.handleProcessingCompletion(t);break;case"processingError":e.handleProcessingError(t);break;case"createTransportResponse":e.handleCreateTransportRequest(t);break;case"connectTransportResponse":e.handleConnectTransportRequest(t);break;case"connectRecvTransportResponse":e.handleConnectRecvTransportRequest(t);break;case"sendTrackResponse":e.handleSendTrackRequest(t);break;case"recvTrackResponse":e.handleRecvTrackRequest(t);break;case"roomClosedByModerator":e.leaveRoomCommon(),e.roomClosed();break;case"currentlyActiveSpeaker":e.setCurrentlyActiveSpeaker(t);break;case"restartIceResponse":e.restartIceResponse(t);break;case"consumerClosed":e.closeConsumer(t);break;case"handRaise":e.handleHandRaise(t);break;case"upgradeParticipant":e.handleUpgradeParticipant(t);break;case"downgradeParticipant":e.handleDowngradeParticipant(t);break;case"switchMicOff":e.handleSwitchMicOff(t);break;case"screenShareLimitReached":e.handleScreenShareLimitReached(t);break;case"upgradeLimitReached":e.handleUpgradeLimitReached(t);break;case"modUpgradeReq":e.handleModUpgradeReq(t);break;case"lockUnlockRoom":e.handleLockUnlockRoom(t);break;case"peersWaiting":e.handlePeersWaiting(t);break;case"remotePeerJoin":e.handleRemotePeerJoin(t);break;case"offer":U.debug("inside offer"),e.handleOffer(t);break;case"answer":U.debug("inside answer"),e.handleAnswer(t);break;case"candidate":U.debug("inside handle candidate"),e.handleCandidate(t.candidate);break;case"p2pRoomClosed":U.debug("inside p2p room close"),e.leaveRoomNewP2p(x.ROOM_LEAVE_AND_CLOSE);break;case"p2pUserLeft":U.debug("inside p2p user left"),e.userLeftRoom(t);break;case"iceRestart":e.handleIceRestart(t);break;case"iceRestarted":e.handleIceRestartResponse(t);break;case"screenShareP2p":e.handleScreenShareP2p(t);break;default:U.warn("Unrecognized message:%o",t)}}catch(e){U.error("listentomessage:%O",e)}}))}},{key:"onNewPeer",value:function(e){var t=e.peerId,r=e.displayName,i=e.participantType;this._peers.set(t,{displayName:r,participantType:i,consumers:[]}),this.emit("newPeer",{peerId:t,peerName:r,type:this.data.inputParams.peerId===t?"local":"remote",peerRole:i})}},{key:"onExistingParticipants",value:(J=(0,c.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("Onexisting participant message:%O",t),this._routerRtpCapabilities=t.routerRtpCapabilities,this._roomStatus="connected",this._roomDisplayName=t.roomDisplayName,this._running=!0,this._socket._roomJoined=!0,this.emit("newPeer",{peerId:this.data.inputParams.peerId,peerName:this.data.inputParams.peerName,type:"local",peerRole:this.data.inputParams.peerType}),!this.data.inputParams.produce){e.next=12;break}return e.next=10,this._createSendTransport();case 10:e.next=13;break;case 12:U.debug("Produce is false!");case 13:if(!this.data.inputParams.consume){e.next=20;break}return e.next=16,this._createRecvTransport();case 16:r=this,t.peers&&t.peers.length>0&&t.peers.forEach((function(e){r.emit("newPeer",{peerId:e.peerId,peerName:e.name,type:"remote",peerRole:e.participantType})})),e.next=21;break;case 20:U.debug("Consume is false!");case 21:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"setCurrentlyActiveSpeaker",value:function(e){var t=e.activeSpeaker,r=t.peerId,i=t.volume;this._activeSpeaker=e.activeSpeaker,this.emit("activeSpeaker",{peerId:r,volume:i})}},{key:"close",value:function(){this._closed||(this._closed=!0,this._socket=null,this.data.inputParams={},U.info("Room close()"),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed",this._running=!1)}},{key:"leaveRoom",value:($=(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.debug("Leave room is called!!"),"connected"===this._roomStatus?(this._sendMessage({id:"leaveRoomNew",peerId:this.data.inputParams.peerId,roomLeaveType:"client"}),this.leaveRoomCommon()):U.error("The room state is:%s",this._roomStatus);case 2:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"closeRoom",value:(K=(0,c.default)(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"connected"===this._roomStatus?(this._sendMessage({id:"leaveAndCloseRoom",peerId:this.data.inputParams.peerId,roomCloseType:"client"}),this.leaveRoomCommon()):U.error("The room state is:%s",this._roomStatus);case 1:case"end":return e.stop()}}),e,this)}))),function(){return K.apply(this,arguments)})},{key:"listDevicesInternal",value:(H=(0,c.default)(o.default.mark((function e(){var t,r=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices.ondevicechange=function(){var e=(0,c.default)(o.default.mark((function e(t){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,M.updatedDeviceList)();case 2:i=e.sent,U.info("Media devices changed!:%O",i),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioDevices=i.audioDevices),i.videoDevices&&i.videoDevices.length>0&&(r._deviceList.videoDevices=i.videoDevices),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioOutputDevices=i.audioDevicesOutput),F=r._deviceList,r.emit("deviceListUpdated");case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),!this._deviceList){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,(0,M.loadAllAvailableDevices)();case 7:if(!(t=e.sent).success){e.next=12;break}return this._deviceList=t.deviceList,F=this._deviceList,e.abrupt("return");case 12:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"enableMic",value:(W=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c,d,u,l,h,f,p=this,m=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=m.length>0&&void 0!==m[0]?m[0]:{}).deviceId,i=void 0===r?null:r,n=t.autoGainControl,a=t.noiseSuppression,s=t.echoCancellation,c=t.channelCount,d=t.sampleRate,u=t.forcePCMU,l=t.forcePCMA,U.debug("enableMic()"),this.data.inputParams.produce){e.next=7;break}return U.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID007",text:"Error while trying to start Mic/Audio. Produce flag need to set to true while joining room in order to enable Mic/Audio."});case 7:if("connected"===this._roomStatus){e.next=12;break}return U.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID008",text:"Error while trying to start Mic/Audio as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Mic? OR if you have already initiated the joinRoom process, then Mic will be enabled automatically once room join process completes."});case 12:if(!this._micProducer){e.next=17;break}return U.debug("Mic is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID002",text:"Error while trying to start Mic/Audio. Mic/Audio is already active!"});case 17:if(this._device.canProduce("audio")){e.next=20;break}return U.error("enableMic() | cannot produce audio"),e.abrupt("return",{success:!1,error:!0,code:"REID009",text:"Error while trying to start Mic/Audio. Mic/Audio couldnot be activated due to limitations on this device. If you think this device has a functional Mic and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:if(u&&"boolean"==typeof u&&(this.data.inputParams.forcePCMU=u),l&&"boolean"==typeof l&&(this.data.inputParams.forcePCMA=l),n&&"boolean"==typeof n&&(this.data.inputParams.autoGainControl=n),s&&"boolean"==typeof s&&(this.data.inputParams.echoCancellation=s),a&&"boolean"==typeof a&&(this.data.inputParams.noiseSuppression=a),d&&Number.isInteger(d)&&d<64e3&&d>8e3&&(this.data.inputParams.sampleRate=d),c&&Number.isInteger(c)&&c>0&&c<3&&(this.data.inputParams.channelCount=c),e.prev=27,this._externalVideo){e.next=48;break}if(i?(f=this._deviceList.audioDevices.find((function(e){return e.deviceId===i})))||(U.warn("Selected audio input deviceId:%s not found",i),f=this._deviceList.audioDevices[0]):f=this._deviceList.audioDevices[0],this._mic.device=f,f){e.next=34;break}return U.error("No mic device found! Can't start audio!"),e.abrupt("return",{success:!1,reason:"No mic available for starting audio!"});case 34:return i&&this.data.inputParams.audioDeviceId!==i&&(this.data.inputParams.audioDeviceId=i),U.debug("enableMic() | calling getUserMedia()"),e.prev=36,e.next=39,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:f.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 39:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0],e.next=46;break;case 43:throw e.prev=43,e.t0=e.catch(36),new Error("Error while acquiring mic. Possible issue with audio constraint values",e.t0);case 46:e.next=52;break;case 48:return e.next=50,this._getExternalVideoStream();case 50:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0].clone();case 52:return e.next=54,this._sendTransport.produce({track:h,codecOptions:this.data.inputParams.forcePCMU||this.data.inputParams.forcePCMA?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):this.data.inputParams.forcePCMA?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcma"===e.mimeType.toLowerCase()})):void 0,appData:{mediaTag:"cam-audio"}});case 54:this._micProducer=e.sent,this._producers.set("audio",{id:this._micProducer.id,paused:this._micProducer.paused,track:this._micProducer.track,rtpParameters:this._micProducer.rtpParameters,codec:this._micProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),this._micProducer.on("transportclose",(function(){p._micProducer=null})),this._micProducer.on("trackended",(function(){p.disableMic().catch((function(){}))})),e.next=66;break;case 61:e.prev=61,e.t1=e.catch(27),U.error("enableMic() | failed:%o",e.t1),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),h&&h.stop();case 66:case"end":return e.stop()}}),e,this,[[27,61],[36,43]])}))),function(){return W.apply(this,arguments)})},{key:"disableMic",value:(G=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micProducer){e.next=4;break}return e.abrupt("return");case 4:this._micProducer.close(),this._producers.delete("audio");try{t={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",producerId:this._micProducer.id},this._sendMessage(t),this.emit("micEnd",{peerId:this.data.inputParams.peerId,audioTrack:null,type:"local"})}catch(e){this.emit("error",{code:"EID003",text:"Error disabling microphone!"})}this._micProducer=null;case 8:case"end":return e.stop()}}),e,this)}))),function(){return G.apply(this,arguments)})},{key:"muteMic",value:(V=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.debug("muteMic()"),this._micProducer.pause();try{t={id:"toggleMedia",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",audioStatus:!1,producerId:this._micProducer.id},this._sendMessage(t),this.emit("peerMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){U.error("muteMic() | failed: %o",e),this.emit("error",{code:"EID004",text:"Error muting local microphone!"})}case 3:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"unmuteMic",value:(N=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.debug("unmuteMic()"),this._micProducer.resume();try{t={id:"toggleMedia",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",audioStatus:!0,producerId:this._micProducer.id},this._sendMessage(t),this.emit("peerUnMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){U.error("unmuteMic() | failed: %o",e),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"})}case 3:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"enableCam",value:(L=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c,d,u,l,h,f,p,m,b,g,v,y,_,w=this,S=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=S.length>0&&void 0!==S[0]?S[0]:{}).deviceId,i=void 0===r?null:r,n=t.videoResolution,a=t.forceVp8,s=t.forceVp9,c=t.forceH264,d=t.h264Profile,u=t.forceFPS,l=t.enableWebcamLayers,h=t.numSimulcastStreams,f=t.videoBitRates,U.debug("enableWebcam()"),this.data.inputParams.produce){e.next=7;break}return U.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID004",text:"Error while trying to start Camera. Produce flag need to set to true while joining room in order to enable Camera."});case 7:if("connected"===this._roomStatus){e.next=10;break}return U.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID005",text:"Error while trying to start Camera as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Camera? OR if you have already initiated the joinRoom process, then Camera will be enabled automatically once room join process completes."});case 10:if(!this._webcamProducer){e.next=13;break}return U.debug("Camera is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID003",text:"Error while trying to start Camera. Camera is already active!"});case 13:if(this._device.canProduce("video")){e.next=16;break}return U.error("enableWebcam() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID006",text:"Error while trying to start Camera. Camera couldnot be activated due to limitations on this device. If you think this device has a functional camera and the problem persists even after multiple retries, please contact technical support with the error code."});case 16:if(["hd","vga","qvga"].includes(n)&&(this.data.inputParams.videoResolution=n,this._webcam.resolution=n),a&&"boolean"==typeof a&&(this.data.inputParams.forceVp8=a),s&&"boolean"==typeof s&&(this.data.inputParams.forceVp9=s),c&&"boolean"==typeof c&&(this.data.inputParams.forceH264=c),d&&["high","low"].includes(d.toLowerCase())&&(this.data.inputParams.h264Profile=d),u&&Number.isInteger(u)&&u<65&&u>5&&(this.data.inputParams.forceFPS=25),l&&"boolean"==typeof l&&(this.data.inputParams.enableWebcamLayers=l,this._enableWebcamLayers=l),h&&Number.isInteger(h)&&h<4&&h>0&&(this.data.inputParams.numSimulcastStreams=h,this._numSimulcastStreams=h),Array.isArray(f)&&f.length>=1&&f.length<=3&&f.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?(U.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=f):U.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[700,250,75]'"),e.prev=25,this._externalVideo){e.next=41;break}if(i?(m=this._deviceList.videoDevices.find((function(e){return e.deviceId===i})))||(U.warn("Selected deviceId:%s not found",i),m=this._deviceList.videoDevices[0]):m=this._deviceList.videoDevices[0],this._webcam.device=m,b=this._webcam.resolution,m){e.next=33;break}return U.error("No wencam device found! Can't start video!"),e.abrupt("return",{success:!1,reason:"No Webcam available for starting video!"});case 33:return i&&this.data.inputParams.videoDeviceId!==i&&(this.data.inputParams.videoDeviceId=i),U.debug("enableWebcam() | calling getUserMedia()"),e.next=37,navigator.mediaDevices.getUserMedia({video:j(j({deviceId:{ideal:m.deviceId}},q[b]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 37:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0],e.next=46;break;case 41:return m={label:"external video"},e.next=44,this._getExternalVideoStream();case 44:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0].clone();case 46:if(y={videoGoogleStartBitrate:1e3},U.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),!this._forceVP8){e.next=54;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=52;break}throw new Error("desired VP8 codec+configuration is not supported");case 52:e.next=67;break;case 54:if(!this._forceH264){e.next=63;break}if("high"===this.data.inputParams.h264Profile?v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),v){e.next=60;break}throw new Error("desired H264 codec+configuration is not supported");case 60:U.debug("Selected h264 codec is:%O",v);case 61:e.next=67;break;case 63:if(!this._forceVP9){e.next=67;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=67;break}throw new Error("desired VP9 codec+configuration is not supported");case 67:return this._enableWebcamLayers&&(_=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&v||"video/vp9"===_.mimeType.toLowerCase()?g=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(g=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&g.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&g.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))),e.next=70,this._sendTransport.produce({track:p,encodings:g,codecOptions:y,codec:v,appData:{mediaTag:"cam-video"}});case 70:this._webcamProducer=e.sent,this._producers.set("video",{id:this._webcamProducer.id,deviceLabel:m.label,type:this._getWebcamType(m),paused:this._webcamProducer.paused,track:this._webcamProducer.track,rtpParameters:this._webcamProducer.rtpParameters,codec:this._webcamProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),this._webcamProducer.on("transportclose",(function(){w._webcamProducer=null})),this._webcamProducer.on("trackended",(function(){w.disableCam().catch((function(){}))})),e.next=82;break;case 77:e.prev=77,e.t0=e.catch(25),U.error("enableWebcam() | failed:%o",e.t0),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),p&&p.stop();case 82:case"end":return e.stop()}}),e,this,[[25,77]])}))),function(){return L.apply(this,arguments)})},{key:"disableCam",value:(A=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("disableWebcam()"),this._webcamProducer){e.next=3;break}return e.abrupt("return");case 3:this._webcamProducer.close(),this._producers.delete("video");try{t={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"video",producerId:this._webcamProducer.id},this._sendMessage(t),this.emit("videoEnd",{peerId:this.data.inputParams.peerId,videoTrack:null})}catch(e){this.emit("error",{code:"EID012",text:"Error while closing server side producer!"})}this._webcamProducer=null;case 7:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"_updateWebcams",value:(D=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return U.debug("_updateWebcams()"),this._webcams=new Map,U.debug("_updateWebcams() | calling enumerateDevices()"),e.next=5,navigator.mediaDevices.enumerateDevices();case 5:t=e.sent,r=O(t),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=16;break}if("videoinput"===(n=i.value).kind){e.next=13;break}return e.abrupt("continue",14);case 13:this._webcams.set(n.deviceId,n);case 14:e.next=9;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(7),r.e(e.t0);case 21:return e.prev=21,r.f(),e.finish(21);case 24:a=Array.from(this._webcams.values()),s=a.length,c=this._webcam.device?this._webcam.device.deviceId:void 0,U.debug("_updateWebcams() [webcams:%o]",a),0===s?this._webcam.device=null:this._webcams.has(c)||(this._webcam.device=a[0]);case 29:case"end":return e.stop()}}),e,this,[[7,18,21,24]])}))),function(){return D.apply(this,arguments)})},{key:"_getExternalVideoStream",value:(I=(0,c.default)(o.default.mark((function e(){var t=this;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._externalVideoStream){e.next=2;break}return e.abrupt("return",this._externalVideoStream);case 2:if(!(this._externalVideo.readyState<3)){e.next=5;break}return e.next=5,new Promise((function(e){return t._externalVideo.addEventListener("canplay",e)}));case 5:if(!this._externalVideo.captureStream){e.next=9;break}this._externalVideoStream=this._externalVideo.captureStream(),e.next=14;break;case 9:if(!this._externalVideo.mozCaptureStream){e.next=13;break}this._externalVideoStream=this._externalVideo.mozCaptureStream(),e.next=14;break;case 13:throw new Error("video.captureStream() not supported");case 14:return e.abrupt("return",this._externalVideoStream);case 15:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"_getWebcamType",value:function(e){return/(back|rear)/i.test(e.label)?(U.debug("_getWebcamType() | it seems to be a back camera"),"back"):(U.debug("_getWebcamType() | it seems to be a front camera"),"front")}},{key:"changeVideoInput",value:(_=(0,c.default)(o.default.mark((function e(t){var r,i,n,a;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,!this._webcamProducer){e.next=8;break}return e.next=4,this._changeVideoInput({resolution:r,deviceId:i,fps:n});case 4:return a=e.sent,e.abrupt("return",a);case 8:return U.error("No webcam producer available!"),e.abrupt("return",{success:!1,reason:"You are not sharing your camera yet. Camera Input can be changed to a new camera only when you are sharing an existing camera. "});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"_changeVideoInput",value:(y=(0,c.default)(o.default.mark((function e(t){var r,i,n,a,s,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,U.info("_changeVideoInput() | Inside"),r&&["hd","vga","qvga"].includes(r)?this._webcam.resolution=r:U.warn("Invalid video resolution value "),n&&Number.isInteger(n)&&n<65&&n>5?this.data.inputParams.forceFPS=n:U.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),a=this._deviceList.videoDevices.find((function(e){return i&&e.deviceId===i}))){e.next=8;break}return U.error("The selected deviceId not found!"),e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 8:return this._webcam.device=a,e.prev=9,this._webCamStream.getVideoTracks().forEach((function(e){return e.stop()})),this._webCamStream=null,U.debug("changeVideoInput() | calling getUserMedia()"),e.next=15,navigator.mediaDevices.getUserMedia({video:j(j({deviceId:{ideal:a.deviceId}},q[this._webcam.resolution]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 15:return this._webCamStream=e.sent,s=this._webCamStream.getVideoTracks()[0],U.debug("The new video track is:%O",s),e.next=20,this._webcamProducer.replaceTrack({track:s});case 20:return(c=this._producers.get("video")).deviceLabel=a.label,c.type=this._getWebcamType(a),c.track=this._webcamProducer.track,U.debug("Updated producer values are:%O",c),this._producers.set("video",c),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 30:return e.prev=30,e.t0=e.catch(9),U.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change video input",error:e.t0});case 34:case"end":return e.stop()}}),e,this,[[9,30]])}))),function(e){return y.apply(this,arguments)})},{key:"changeAudioInput",value:(v=(0,c.default)(o.default.mark((function e(t){var r,i,n,a,s,c,d;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,a=t.sampleRate,s=t.channelCount,c=t.deviceId,!this._micProducer){e.next=8;break}return e.next=4,this._changeAudioInput({autoGainControl:r,echoCancellation:i,noiseSuppression:n,sampleRate:a,channelCount:s,deviceId:c});case 4:return d=e.sent,e.abrupt("return",d);case 8:return e.abrupt("return",{success:!1,reason:"You are not sharing your mic yet. Mic Input can be changed to a new mic only when you are sharing an existing mic. "});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"_changeAudioInput",value:(h=(0,c.default)(o.default.mark((function e(t){var r,i,n,a,s,c,d,u,l;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,a=t.sampleRate,s=t.channelCount,c=t.deviceId,r&&"boolean"==typeof r&&(this.data.inputParams.autoGainControl=r),i&&"boolean"==typeof i&&(this.data.inputParams.echoCancellation=Boolean(i)),n&&"boolean"==typeof n&&(this.data.inputParams.noiseSuppression=Boolean(n)),a&&Number.isInteger(a)&&a<64e3&&a>8e3&&(this.data.inputParams.sampleRate=a),s&&Number.isInteger(s)&&s>0&&s<3&&(this.data.inputParams.channelCount=s),d=this._deviceList.audioDevices.find((function(e){return c&&e.deviceId===c}))){e.next=9;break}return e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 9:return this._mic.device=d,this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micStream=null,e.prev=12,e.next=15,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:d.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 15:return this._micStream=e.sent,u=this._micStream.getAudioTracks()[0],this._micProducer.replaceTrack({track:u}),(l=this._producers.get("audio")).deviceLabel=d.label,l.track=this._micProducer.track,U.debug("Updated producer values are:%O",l),this._producers.set("audio",l),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 27:return e.prev=27,e.t0=e.catch(12),U.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change audio input",err:e.t0});case 31:case"end":return e.stop()}}),e,this,[[12,27]])}))),function(e){return h.apply(this,arguments)})},{key:"enableShare",value:(l=(0,c.default)(o.default.mark((function e(){var t,r,i,n,a,s,c,d,u,l,h,f,p,m,b=this,g=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=g.length>0&&void 0!==g[0]?g[0]:{}).shareAudio,i=void 0!==r&&r,n=t.enableSharingLayers,a=void 0===n||n,s=t.shareBitRates,c=void 0===s?[2500,1250,500]:s,U.debug("enableShare()"),this.data.inputParams.produce){e.next=7;break}return U.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID003",text:"Error while trying to start screen share. Produce flag need to set to true while joining room in order to enable screen share."});case 7:if("connected"===this._roomStatus){e.next=12;break}return U.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID001",text:"Error while trying to start screen share as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling screen share? OR if you have already initiated the joinRoom process, then try enabling screen share after some seconds."});case 12:if(!this._shareProducer){e.next=17;break}return U.debug("Screen share is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID001",text:"Error while trying to start screen share. Screen share is already active!"});case 17:if(this._device.canProduce("video")){e.next=20;break}return U.error("enableShare() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID002",text:"Error while trying to start screen share. Screen share couldnot be activated due to limitations on this device. If you think this device is capable of screen share and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:return this._enableSharingLayers="boolean"!=typeof a?Boolean(a):a,Array.isArray(c)&&c.length>=1&&c.length<=3&&c.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?this.data.inputParams.shareBitRates=c:this.data.inputParams.shareBitRates=[2500,1250,500],e.prev=22,U.debug("enableShare() | calling getDisplayMedia()"),e.next=26,navigator.mediaDevices.getDisplayMedia({audio:!!i,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});case 26:if(l=e.sent){e.next=31;break}return U.error("Unable to capture screen."),this.emit("error",{code:"EID013",text:"Error while trying to start screen share. Not able to capture screen!"}),e.abrupt("return");case 31:if(!(u=l.getAudioTracks()[0])){e.next=38;break}return e.next=35,this._sendTransport.produce({track:u,codecOptions:this.data.inputParams.forcePCMU?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):void 0,appData:{mediaTag:"screen-audio"}});case 35:this._shareAudioProducer=e.sent,this._producers.set("ssAudio",{id:this._shareAudioProducer.id,type:"shareAudio",paused:this._shareAudioProducer.paused,track:this._shareAudioProducer.track,rtpParameters:this._shareAudioProducer.rtpParameters,codec:this._shareAudioProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssAudioStart",{peerId:this.data.inputParams.peerId,audioTrack:this._shareAudioProducer.track,type:"local"});case 38:if(d=l.getVideoTracks()[0],p={videoGoogleStartBitrate:1e3},!this._forceVP8){e.next=46;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=44;break}throw new Error("desired VP8 codec+configuration is not supported");case 44:e.next=59;break;case 46:if(!this._forceH264){e.next=55;break}if("high"===this.data.inputParams.h264Profile?f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),f){e.next=52;break}throw new Error("desired H264 codec+configuration is not supported");case 52:U.debug("Selected h264 codec is:%O",f);case 53:e.next=59;break;case 55:if(!this._forceVP9){e.next=59;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=59;break}throw new Error("desired VP9 codec+configuration is not supported");case 59:return this._enableSharingLayers&&(m=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&f||"video/vp9"===m.mimeType.toLowerCase()?h=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(h=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&h.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&h.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))),e.next=62,this._sendTransport.produce({track:d,encodings:h,codecOptions:p,codec:f,appData:{mediaTag:"screen-video"}});case 62:this._shareProducer=e.sent,this._producers.set("ssVideo",{id:this._shareProducer.id,type:"shareVideo",paused:this._shareProducer.paused,track:this._shareProducer.track,rtpParameters:this._shareProducer.rtpParameters,codec:this._shareProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssVideoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._shareProducer.track,type:"local"}),this._shareProducer.on("transportclose",(function(){b._shareProducer=null})),this._shareProducer.on("trackended",(function(){b.disableShare().catch((function(){}))})),e.next=74;break;case 69:e.prev=69,e.t0=e.catch(22),U.error("enableShare() | failed:%o",e.t0),"NotAllowedError"!==e.t0.name&&this.emit("error",{code:"EID014",text:"Error while trying to start screen share. Error is: ".concat(e.t0,"!")}),d&&d.stop();case 74:case"end":return e.stop()}}),e,this,[[22,69]])}))),function(){return l.apply(this,arguments)})},{key:"disableShare",value:(n=(0,c.default)(o.default.mark((function e(){var t,r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.debug("disableShare()"),this._shareProducer){e.next=5;break}return U.warn("Screen share doesn't seem to be on!"),this.emit("error",{code:"EID017",text:"Error while trying to stop screen share. Is the screen share on!"}),e.abrupt("return");case 5:if(this._shareProducer.close(),this._shareAudioProducer){this._shareAudioProducer.close();try{t={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",producerId:this._shareAudioProducer.id},this._sendMessage(t),this.emit("ssAudioStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"})}catch(e){this.emit("error",{code:"EID015",text:"Error while trying to stop screen share audio. Error is: ".concat(e,"!")})}}try{r={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"video",producerId:this._shareProducer.id},this._sendMessage(r),this.emit("ssVideoStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"})}catch(e){this.emit("error",{code:"EID016",text:"Error while trying to stop screen share video. Error is: ".concat(e,"!")})}this._shareAudioProducer=null,this._shareProducer=null;case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})}],[{key:"listDevices",value:(i=(0,c.default)(o.default.mark((function e(){var t;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!F){e.next=3;break}return U.info("Device list already exists:%O",F),e.abrupt("return",{success:!0,deviceList:F});case 3:return e.next=5,(0,M.loadAllAvailableDevices)();case 5:if(!(t=e.sent).success){e.next=11;break}return F=t.deviceList,e.abrupt("return",{success:!0,deviceList:t.deviceList});case 11:return e.abrupt("return",{success:!1,reason:t.reason});case 12:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"init",value:(r=(0,c.default)(o.default.mark((function e(){var r,i,n,s,c,d,u,l,h,f=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=(r=f.length>0&&void 0!==f[0]?f[0]:{}).sessionToken,n=r.roomId,s=r.peerId,i){e.next=3;break}throw new Error("Session token is required to join the room.");case 3:e.prev=3,U.info("session token:%s",i),e.prev=5,c=E.default.verify(i,"samvyo_tech_321",{algorithms:["HS256"]}),U.info("Decoded token:",c),e.next=26;break;case 10:if(e.prev=10,e.t0=e.catch(5),U.error("JWT verification failed:",e.t0),"JsonWebTokenError"!==e.t0.name){e.next=17;break}throw new Error("Invalid session token: "+e.t0.message);case 17:if("TokenExpiredError"!==e.t0.name){e.next=21;break}throw new Error("Session token has expired");case 21:if("NotBeforeError"!==e.t0.name){e.next=25;break}throw new Error("Session token not yet active");case 25:throw new Error("Failed to verify session token: "+e.t0.message);case 26:if(c&&"object"===(0,a.default)(c)){e.next=28;break}throw new Error("Invalid token format");case 28:if(u=(d=c).data,l=d.signallingServerUrl,u&&l){e.next=31;break}throw new Error("Missing required token data");case 31:return s||(s=(0,k.uuidv4)()),n||(n=(0,S.getRandomInt)()),h={sessionToken:i,innerSessionToken:u,signallingServerUrl:l},e.abrupt("return",new t({peerId:s,roomId:n,outputData:h}));case 37:throw e.prev=37,e.t1=e.catch(3),U.error("Failed to initialize:",e.t1.message),e.t1;case 41:case"end":return e.stop()}}),e,null,[[3,37],[5,10]])}))),function(){return r.apply(this,arguments)})}]);var r,i,n,l,h,v,y,_,I,D,A,L,N,V,G,W,H,K,$,J,Y,X}(v.EventEmitter)},{"./Logger":4,"./socket":5,"./utils/chooseMedia":12,"./utils/constants":13,"./utils/getRandomInt":14,"./utils/getUSerMediaConstraints":15,"./utils/getVidScaleUrl":16,"./utils/queue":17,"./utils/randomName":18,"./utils/sleep":19,"./utils/uuidv4":20,"./utils/verifyOutputQualites":21,"./utils/verifyfileTypes":22,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/defineProperty":27,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/objectWithoutProperties":31,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/helpers/typeof":38,"@babel/runtime/regenerator":39,bowser:61,events:91,jsonwebtoken:178,"mediasoup-client":232}],3:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.JsSdk_v1=void 0;var a=i(e("@babel/runtime/regenerator")),s=i(e("@babel/runtime/helpers/asyncToGenerator")),o=i(e("@babel/runtime/helpers/defineProperty")),c=i(e("@babel/runtime/helpers/classCallCheck")),d=i(e("@babel/runtime/helpers/createClass")),u=i(e("@babel/runtime/helpers/possibleConstructorReturn")),l=i(e("@babel/runtime/helpers/getPrototypeOf")),h=i(e("@babel/runtime/helpers/inherits")),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=n(e)&&"function"!=typeof e)return{default:e};var r=k(t);if(r&&r.has(e))return r.get(e);var i={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var o=a?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,r&&r.set(e,i),i}(e("mediasoup-client")),p=i(e("bowser")),m=i(e("./socket")),b=e("events"),g=i(e("./Logger")),v=e("./utils/getRandomInt"),y=e("./utils/uuidv4"),_=e("./utils/getVidScaleUrl"),w=i(e("./utils/randomName")),S=(e("./utils/constants"),e("./utils/chooseMedia"));function k(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(k=function(e){return e?r:t})(e)}function R(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return P(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach((function(t){(0,o.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function x(e,t,r){return t=(0,l.default)(t),(0,u.default)(e,T()?Reflect.construct(t,r||[],(0,l.default)(e).constructor):t.apply(e,r))}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(T=function(){return!!e})()}var C,I=new g.default("Room"),D={small:{width:{ideal:160},height:{ideal:120}},qvga:{width:{ideal:320},height:{ideal:240}},vga:{width:{ideal:640},height:{ideal:480}},hd:{width:{ideal:1280},height:{ideal:720}}},O={optional:[{googDscp:!0}]};r.JsSdk_v1=function(e){function t(e){var r,i=e.peerId,n=e.roomId,a=e.peerName,s=e.produce,o=e.produceAudio,d=e.produceVideo,u=e.consume,l=e.videoResolution,h=e.forceVp8,m=e.forceVp9,b=e.forceH264,g=e.h264Profile,v=e.forceFPS,y=e.forcePCMU,_=e.forcePCMA,w=e.enableWebcamLayers,S=e.numSimulcastStreams,k=e.autoGainControl,R=e.echoCancellation,P=e.noiseSuppression,M=e.sampleRate,T=e.channelCount,I=e.videoBitRates,D=e.share,O=e.shareAudio,A=e.enableSharingLayers,L=e.shareBitRates,j=e.outputData,B=e.audioDeviceId,N=e.videoDeviceId;return(0,c.default)(this,t),(r=x(this,t))._closed=!1,r._roomStatus="initialised",r._cignal=null,r._sendTransport=null,r._recvTransport=null,r._device=new f.Device,r._webCamProducer=null,r._micProducer=null,r._shareProducer=null,r._shareAudioProducer=null,r._producers=new Map,r._consumers=new Map,r._peers=new Map,r._data=E({},j),r._micStream=null,r._webCamStream=null,r._webcam={device:null,resolution:l},r._mic={device:null},r._deviceList=C||null,r._externalVideo=null,r._externalVideoStream=null,r._forceVP8=Boolean(h),r._forceH264=Boolean(b),r._forceVP9=Boolean(m),r._enableWebcamLayers=Boolean(w),r._numSimulcastStreams=S,r._enableSharingLayers=Boolean(A),r._client=p.default.parse(window.navigator.userAgent),r._cignalConnected=!1,r._reconnectionInitiated=!1,r._restartIceInProgressSendTransport=!1,r._restartIceInProgressRecvTransport=!1,r._activeSpeaker=null,r.init({roomId:n,peerId:i,peerName:a,produce:s,produceAudio:o,produceVideo:d,consume:u,videoResolution:l,forceVp8:h,forceVp9:m,forceH264:b,h264Profile:g,forceFPS:v,forcePCMU:y,forcePCMA:_,enableWebcamLayers:w,numSimulcastStreams:S,autoGainControl:k,echoCancellation:R,noiseSuppression:P,sampleRate:M,channelCount:T,videoBitRates:I,share:D,shareAudio:O,enableSharingLayers:A,shareBitRates:L,audioDeviceId:B,videoDeviceId:N}),r}return(0,h.default)(t,e),(0,d.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("Setting the whole data object is not possible!")}},{key:"peers",get:function(){return this._peers},set:function(e){throw new Error("Setting the whole peers object is not possible!")}},{key:"transports",get:function(){return{produce:this._sendTransport,consume:this._recvTransport}},set:function(e){throw new Error("Setting of transport is not possible!")}},{key:"videoStream",get:function(){return this._webCamStream}},{key:"audioStream",get:function(){return this._micStream}},{key:"clientAgent",get:function(){return this._client}},{key:"activeParameters",get:function(){return this._data.inputParams}},{key:"deviceList",get:function(){return this._deviceList?this._deviceList:{videoDevices:[],audioDevices:[],audioOutputDevices:[]}},set:function(e){throw new Error("Setting of deviceList is not possible!")}},{key:"currentlyActiveSpeaker",get:function(){return this._activeSpeaker},set:function(e){throw new Error("Setting of currentActivespeaker is not possible!")}},{key:"init",value:(H=(0,s.default)(a.default.mark((function e(t){var r;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("init() | The input parameters are:%O",t),this.data.inputParams=t,r=f.detectDevice(),I.debug("The device is:%O",r),e.next=6,this.listDevicesInternal();case 6:return e.next=8,this.join();case 8:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"close",value:function(){this._closed||(this._closed=!0,I.debug("close()"),this._cignal.close(),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed")}},{key:"leaveRoom",value:(W=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("Leave room is called!!"),"connected"!==this._roomStatus){e.next=12;break}return e.next=4,this._cignal.notify("leaveRoom",{});case 4:this._sendTransport&&(this._sendTransport.close(),this._sendTransport=null),this._recvTransport&&(this._recvTransport.close(),this._recvTransport=null),this._webCamStream&&this._webCamStream.getVideoTracks().forEach((function(e){e.stop(),I.debug("Video Track stopped")})),this._micStream&&this._micStream.getAudioTracks().forEach((function(e){e.stop(),I.debug("Mic Track stopped")})),this._roomStatus="closed",this._cignal.close(),e.next=13;break;case 12:I.error("The room state is:%s",this._roomStatus);case 13:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"closeRoom",value:(G=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._cignal.notify("closeRoom",{});case 2:this.leaveRoom();case 3:case"end":return e.stop()}}),e,this)}))),function(){return G.apply(this,arguments)})},{key:"listDevicesInternal",value:(V=(0,s.default)(a.default.mark((function e(){var t,r=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices.ondevicechange=function(){var e=(0,s.default)(a.default.mark((function e(t){var i;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,S.updatedDeviceList)();case 2:i=e.sent,I.info("Media devices changed!:%O",i),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioDevices=i.audioDevices),i.videoDevices&&i.videoDevices.length>0&&(r._deviceList.videoDevices=i.videoDevices),i.audioDevices&&i.audioDevices.length>0&&(r._deviceList.audioOutputDevices=i.audioDevicesOutput),C=r._deviceList,r.emit("deviceListUpdated");case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),!this._deviceList){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,(0,S.loadAllAvailableDevices)();case 7:if(!(t=e.sent).success){e.next=12;break}return this._deviceList=t.deviceList,C=this._deviceList,e.abrupt("return");case 12:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"join",value:(z=(0,s.default)(a.default.mark((function e(){var t,r=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=new m.default.SocketTransport(this.data.url,{retries:10,factor:2,minTimeout:1e3,maxTimeout:8e3}),this._cignal=new m.default.Peer(t),this._cignal.on("open",(0,s.default)(a.default.mark((function e(){var t,i;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r._cignalConnected=!0,!r._sendTransport&&!r._recvTransport){e.next=6;break}!r._sendTransport||"failed"!==r._sendTransport.connectionState&&"disconnected"!==r._sendTransport.connectionState?I.debug("Nothing to in case of socket reconnection with send transport status:%s",null===(t=r._sendTransport)||void 0===t?void 0:t.connectionState):(I.debug("Ws reconnected after network outage. Need to do ICE restarts for send transport."),r.restartIceSendTransport()),!r._recvTransport||"failed"!==r._recvTransport.connectionState&&"disconnected"!==r._recvTransport.connectionState?I.debug("Nothing to in case of socket reconnection with recv transport status:%s",null===(i=r._recvTransport)||void 0===i?void 0:i.connectionState):(I.debug("Ws reconnected after network outage. Need to do ICE restarts for recv transport."),r.restartIceRecvTransport()),e.next=9;break;case 6:return I.debug("Ws connected for first time. Need to go with the regular flow."),e.next=9,r._joinRoom();case 9:case"end":return e.stop()}}),e)})))),this._cignal.on("failed",(function(){})),this._cignal.on("disconnected",(function(){I.debug("ws disconnected!"),r._cignalConnected=!1})),this._cignal.on("close",(function(){r._closed||r._reconnectionInitiated||r.close()})),this._cignal.on("request",function(){var e=(0,s.default)(a.default.mark((function e(t,i,n){var s,c,d,u,l,h,p,m,b,g,v,y,_,w,S;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:I.debug('cignal "request" event [method:%s, data:%o]',t.method,t.data),r._cignalConnected=!0,e.t0=t.method,e.next="newConsumer"===e.t0?5:30;break;case 5:if(r.data.inputParams.consume){e.next=8;break}return n(403,"I do not want to consume"),e.abrupt("break",30);case 8:return s=t.data,c=s.peerId,d=s.producerId,u=s.id,l=s.kind,h=s.rtpParameters,p=s.type,m=s.appData,b=s.producerPaused,e.prev=9,e.next=12,r._recvTransport.consume({id:u,producerId:d,kind:l,rtpParameters:h,streamId:"".concat(c,"-").concat(m.share?"share":"mic-webcam"),appData:E(E({},m),{},{peerId:c})});case 12:g=e.sent,r._consumers.set(g.id,g),g.on("transportclose",(function(){r._consumers.delete(g.id)})),v=f.parseScalabilityMode(g.rtpParameters.encodings[0].scalabilityMode),y=v.spatialLayers,_=v.temporalLayers,w=r._peers.get(c),I.debug("Consumer created for peerId ".concat(c," for kind ").concat(g.kind)),S=E(E({},w),{},(0,o.default)({},m.share?"ss".concat(g.kind):g.kind,{consumerId:g.id,type:p,locallyPaused:!1,remotelyPaused:b,rtpParameters:g.rtpParameters,spatialLayers:y,temporalLayers:_,preferredSpatialLayer:y-1,preferredTemporalLayer:_-1,priority:1,codec:g.rtpParameters.codecs[0].mimeType.split("/")[1],track:g.track,share:m.share})),r._peers.set(c,S),i(),I.debug("Going to emit mic start / videostart"),"audio"===g.kind?m.share?r.emit("ssAudioStart",{peerId:c,audioTrack:g.track,type:"remote"}):r.emit("micStart",{peerId:c,audioTrack:g.track,type:"remote"}):"video"===g.kind&&(m.share?r.emit("ssVideoStart",{peerId:c,videoTrack:g.track,type:"remote"}):r.emit("videoStart",{peerId:c,videoTrack:g.track,type:"remote"})),e.next=29;break;case 25:throw e.prev=25,e.t1=e.catch(9),I.error('"newConsumer" request failed:%o',e.t1),e.t1;case 29:return e.abrupt("break",30);case 30:case"end":return e.stop()}}),e,null,[[9,25]])})));return function(t,r,i){return e.apply(this,arguments)}}()),this._cignal.on("notification",(function(e){switch("activeSpeaker"!==e.method&&I.debug('proto "notification" event [method:%s, data:%o]',e.method,e.data),r._cignalConnected=!0,e.method){case"producerScore":var t=e.data;t.producerId,t.score;break;case"newPeer":var i=e.data;r._peers.set(i.id,E(E({},i),{},{consumers:[]})),r.emit("newPeer",{peerId:i.id,peerName:i.displayName,type:"remote"});break;case"peerClosed":var n=e.data.peerId;r._peers.delete(n),r.emit("peerLeft",{peerId:n});break;case"roomClosed":I.debug("Room closed. No need to reconnect socket"),r.close();break;case"consumerClosed":var a=e.data.consumerId,s=r._consumers.get(a);if(I.debug("Consumer closed for consumerId:%s, type:%s",a,null==s?void 0:s.kind),!s)break;var o=s.appData,c=o.peerId,d=o.share,u=d?"ss".concat(s.kind):s.kind;s.close(),r._consumers.delete(a);var l=r._peers.get(c);I.debug("Peer data before deletion:%O",l),l[u]&&l[u].consumerId===a&&delete l[u],I.debug("Peer data after deletion:%O",l),r._peers.set(c,l),"audio"===u?(I.debug("Going to emit micEnd, consumer closed for audio"),d?r.emit("ssAudioStop",{peerId:c,track:null,type:"remote"}):r.emit("micEnd",{peerId:c,track:null,type:"remote"})):"video"===u&&(I.debug("Going to emit videoEnd, consumer closed for video"),d?r.emit("ssVideoStop",{peerId:c,track:null,type:"remote"}):r.emit("videoEnd",{peerId:c,track:null,type:"remote"}));break;case"consumerPaused":var h=e.data.consumerId,f=r._consumers.get(h);if(!f)break;f.pause();break;case"consumerResumed":var p=e.data.consumerId,m=r._consumers.get(p);if(!m)break;m.resume();break;case"consumerLayersChanged":var b=e.data,g=b.consumerId;if(b.spatialLayer,b.temporalLayer,!r._consumers.get(g))break;break;case"consumerScore":var v=e.data;v.consumerId,v.score;break;case"activeSpeaker":var y=e.data,_=y.peerId,w=y.volume;r._activeSpeaker=e.data,r.emit("activeSpeaker",{peerId:_,volume:w});break;case"peerMuted":var S=e.data.peerId;r.emit("peerMuted",{peerId:S,type:"remote"});break;case"peerUnMuted":var k=e.data.peerId;r.emit("peerUnMuted",{peerId:k,type:"remote"});break;default:I.error('unknown protoo notification.method "%s"',e.method)}}));case 8:case"end":return e.stop()}}),e,this)}))),function(){return z.apply(this,arguments)})},{key:"restartIceSendTransport",value:(q=(0,s.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("restartIce SendTransport()"),!this._restartIceInProgressSendTransport){e.next=4;break}return I.warn("Restart ice already in progress for send transport! wait 4 completion b4 next request!"),e.abrupt("return");case 4:if(e.prev=4,!this._sendTransport||"failed"!==this._sendTransport.connectionState&&"disconnected"!==this._sendTransport.connectionState){e.next=14;break}return this._restartIceInProgressSendTransport=!0,I.debug("Restarting ICE for send transport"),e.next=10,this._cignal.request("restartIce",{transportId:this._sendTransport.id,peerId:this._peerId});case 10:return t=e.sent,e.next=13,this._sendTransport.restartIce({iceParameters:t});case 13:this._restartIceInProgressSendTransport=!1;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),I.error("restartIce SendTransport() | failed:%o",e.t0);case 19:this._reconnectionInitiated=!1;case 20:case"end":return e.stop()}}),e,this,[[4,16]])}))),function(){return q.apply(this,arguments)})},{key:"restartIceRecvTransport",value:(U=(0,s.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("restartIce RecvTransport()"),!this._restartIceInProgressRecvTransport){e.next=4;break}return I.warn("Restart ice already in progress for recv transport! wait 4 completion b4 next request!"),e.abrupt("return");case 4:if(e.prev=4,!this._recvTransport||"failed"!==this._recvTransport.connectionState&&"disconnected"!==this._recvTransport.connectionState){e.next=14;break}return this._restartIceInProgressRecvTransport=!0,I.debug("Restarting ICE for recv transport"),e.next=10,this._cignal.request("restartIce",{transportId:this._recvTransport.id,peerId:this._peerId});case 10:return t=e.sent,e.next=13,this._recvTransport.restartIce({iceParameters:t});case 13:this._restartIceInProgressRecvTransport=!1;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),I.error("restartIce RecvTransport() | failed:%o",e.t0);case 19:this._reconnectionInitiated=!1;case 20:case"end":return e.stop()}}),e,this,[[4,16]])}))),function(){return U.apply(this,arguments)})},{key:"_joinRoom",value:(F=(0,s.default)(a.default.mark((function e(){var t,r,i,n,o,c,d,u,l,h,f,p,m,b,g,v,y,_,w=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("_joinRoom()"),e.prev=1,e.next=4,this._cignal.request("getRouterRtpCapabilities",{coreNumber:this.data.core});case 4:return t=e.sent,I.debug("Router rtp capabilities created:%O",t),I.debug("Input params are:",this.data.inputParams),e.next=9,this._device.load({routerRtpCapabilities:t});case 9:if(!this.data.inputParams.produce){e.next=19;break}return I.debug("Going to create webrtctransport send"),e.next=13,this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp||!1,producing:!0,consuming:!1,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0});case 13:r=e.sent,i=r.id,n=r.iceParameters,o=r.iceCandidates,c=r.dtlsParameters,d=r.sctpParameters,I.debug("Transport info is:%O",r),this._sendTransport=this._device.createSendTransport({id:i,iceParameters:n,iceCandidates:o,dtlsParameters:E(E({},c),{},{role:"auto"}),sctpParameters:d,iceServers:[],proprietaryConstraints:O,additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._sendTransport.on("connect",(function(e,t,r){var i=e.iceParameters,n=e.dtlsParameters;w._cignal.request("connectWebRtcTransport",{transportId:w._sendTransport.id,iceParameters:i,dtlsParameters:n}).then(t).catch(r)})),this._sendTransport.on("produce",function(){var e=(0,s.default)(a.default.mark((function e(t,r,i){var n,s,o,c,d;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.kind,s=t.rtpParameters,o=t.appData,e.prev=1,e.next=4,w._cignal.request("produce",{transportId:w._sendTransport.id,kind:n,rtpParameters:s,appData:o});case 4:c=e.sent,d=c.id,r({id:d}),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),i(e.t0);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r,i){return e.apply(this,arguments)}}());case 19:if(!this.data.inputParams.consume){e.next=28;break}return I.debug("Going to create webrtctransport recv"),e.next=23,this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp,producing:!1,consuming:!0,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0});case 23:u=e.sent,l=u.id,h=u.iceParameters,f=u.iceCandidates,p=u.dtlsParameters,m=u.sctpParameters,I.debug("Transport info is:%O",u),this._recvTransport=this._device.createRecvTransport({id:l,iceParameters:h,iceCandidates:f,dtlsParameters:E(E({},p),{},{role:"auto"}),sctpParameters:m,iceServers:[],additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._recvTransport.on("connect",(function(e,t,r){var i=e.iceParameters,n=e.dtlsParameters;w._cignal.request("connectWebRtcTransport",{transportId:w._recvTransport.id,iceParameters:i,dtlsParameters:n}).then(t).catch(r)}));case 28:return e.next=30,this._cignal.request("join",{displayName:this.data.inputParams.peerName,device:this._device,rtpCapabilities:this.data.inputParams.consume?this._device.rtpCapabilities:void 0,sctpCapabilities:this._useDataChannel&&this.data.inputParams.consume?this._device.sctpCapabilities:void 0});case 30:b=e.sent,g=b.peers,this.emit("newPeer",{peerId:this.data.inputParams.peerId,peerName:this.data.inputParams.peerName,type:"local"}),this._roomStatus="connected",I.debug("All availablepeers in this room are::%O",g),v=R(g);try{for(v.s();!(y=v.n()).done;)_=y.value,this._peers.set(_.id,E(E({},_),{},{consumers:[]})),I.debug("new peer is:%O",_),this.emit("newPeer",{peerId:_.id,peerName:_.displayName,type:"remote"})}catch(e){v.e(e)}finally{v.f()}this.data.inputParams.produce&&(this.data.inputParams.produceAudio?this.enableMic({deviceId:this.data.inputParams.audioDeviceId?this.data.inputParams.audioDeviceId:null}):I.debug("No need to produce audio!"),(this._device.canProduce("video")||this._externalVideo)&&(this.data.inputParams.produceVideo?this.enableCam({deviceId:this.data.inputParams.videoDeviceId?this.data.inputParams.videoDeviceId:null}):I.debug("No need to produce video!"),this.data.inputParams.share&&this.enableShare({shareAudio:this.data.inputParams.shareAudio,enableSharingLayers:this._enableSharingLayers,shareBitRates:this.data.inputParams.shareBitRates})),this._sendTransport.on("connectionstatechange",(function(e){"connected"===e&&I.debug("Send transport now connected!")}))),e.next=45;break;case 40:e.prev=40,e.t0=e.catch(1),I.error("_joinRoom() failed:%o",e.t0),this.emit("error",{code:"EJR001",text:"Join room request failed!"}),this.close();case 45:case"end":return e.stop()}}),e,this,[[1,40]])}))),function(){return F.apply(this,arguments)})},{key:"enableMic",value:(N=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c,d,u,l,h,f,p=this,m=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=m.length>0&&void 0!==m[0]?m[0]:{}).deviceId,i=void 0===r?null:r,n=t.autoGainControl,s=t.noiseSuppression,o=t.echoCancellation,c=t.channelCount,d=t.sampleRate,u=t.forcePCMU,l=t.forcePCMA,I.debug("enableMic()"),this.data.inputParams.produce){e.next=7;break}return I.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID007",text:"Error while trying to start Mic/Audio. Produce flag need to set to true while joining room in order to enable Mic/Audio."});case 7:if("connected"===this._roomStatus){e.next=12;break}return I.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID008",text:"Error while trying to start Mic/Audio as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Mic? OR if you have already initiated the joinRoom process, then Mic will be enabled automatically once room join process completes."});case 12:if(!this._micProducer){e.next=17;break}return I.debug("Mic is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID002",text:"Error while trying to start Mic/Audio. Mic/Audio is already active!"});case 17:if(this._device.canProduce("audio")){e.next=20;break}return I.error("enableMic() | cannot produce audio"),e.abrupt("return",{success:!1,error:!0,code:"REID009",text:"Error while trying to start Mic/Audio. Mic/Audio couldnot be activated due to limitations on this device. If you think this device has a functional Mic and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:if(u&&"boolean"==typeof u&&(this.data.inputParams.forcePCMU=u),l&&"boolean"==typeof l&&(this.data.inputParams.forcePCMA=l),n&&"boolean"==typeof n&&(this.data.inputParams.autoGainControl=n),o&&"boolean"==typeof o&&(this.data.inputParams.echoCancellation=o),s&&"boolean"==typeof s&&(this.data.inputParams.noiseSuppression=s),d&&Number.isInteger(d)&&d<64e3&&d>8e3&&(this.data.inputParams.sampleRate=d),c&&Number.isInteger(c)&&c>0&&c<3&&(this.data.inputParams.channelCount=c),e.prev=27,this._externalVideo){e.next=48;break}if(i?(f=this._deviceList.audioDevices.find((function(e){return e.deviceId===i})))||(I.warn("Selected audio input deviceId:%s not found",i),f=this._deviceList.audioDevices[0]):f=this._deviceList.audioDevices[0],this._mic.device=f,f){e.next=34;break}return I.error("No mic device found! Can't start audio!"),e.abrupt("return",{success:!1,reason:"No mic available for starting audio!"});case 34:return i&&this.data.inputParams.audioDeviceId!==i&&(this.data.inputParams.audioDeviceId=i),I.debug("enableMic() | calling getUserMedia()"),e.prev=36,e.next=39,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:f.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 39:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0],e.next=46;break;case 43:throw e.prev=43,e.t0=e.catch(36),new Error("Error while acquiring mic. Possible issue with audio constraint values",e.t0);case 46:e.next=52;break;case 48:return e.next=50,this._getExternalVideoStream();case 50:this._micStream=e.sent,h=this._micStream.getAudioTracks()[0].clone();case 52:return e.next=54,this._sendTransport.produce({track:h,codecOptions:this.data.inputParams.forcePCMU||this.data.inputParams.forcePCMA?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):this.data.inputParams.forcePCMA?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcma"===e.mimeType.toLowerCase()})):void 0});case 54:this._micProducer=e.sent,this._producers.set("audio",{id:this._micProducer.id,paused:this._micProducer.paused,track:this._micProducer.track,rtpParameters:this._micProducer.rtpParameters,codec:this._micProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),this._micProducer.on("transportclose",(function(){p._micProducer=null})),this._micProducer.on("trackended",(function(){p.disableMic().catch((function(){}))})),e.next=66;break;case 61:e.prev=61,e.t1=e.catch(27),I.error("enableMic() | failed:%o",e.t1),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),h&&h.stop();case 66:case"end":return e.stop()}}),e,this,[[27,61],[36,43]])}))),function(){return N.apply(this,arguments)})},{key:"disableMic",value:(B=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micProducer){e.next=4;break}return e.abrupt("return");case 4:return this._micProducer.close(),this._producers.delete("audio"),e.prev=6,e.next=9,this._cignal.request("closeProducer",{producerId:this._micProducer.id});case 9:this.emit("micEnd",{peerId:this.data.inputParams.peerId,audioTrack:null,type:"local"}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(6),this.emit("error",{code:"EID003",text:"Error disabling microphone!"});case 15:this._micProducer=null;case 16:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(){return B.apply(this,arguments)})},{key:"muteMic",value:(j=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("muteMic()"),this._micProducer.pause(),e.prev=2,e.next=5,this._cignal.request("pauseProducer",{producerId:this._micProducer.id});case 5:this.emit("peerMuted",{peerId:this.data.inputParams.peerId,type:"local"}),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),I.error("muteMic() | failed: %o",e.t0),this.emit("error",{code:"EID004",text:"Error muting local microphone!"});case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return j.apply(this,arguments)})},{key:"unmuteMic",value:(L=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("unmuteMic()"),this._micProducer.resume(),e.prev=2,e.next=5,this._cignal.request("resumeProducer",{producerId:this._micProducer.id});case 5:this.emit("peerUnMuted",{peerId:this.data.inputParams.peerId,type:"local"}),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),I.error("unmuteMic() | failed: %o",e.t0),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"});case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return L.apply(this,arguments)})},{key:"enableCam",value:(A=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c,d,u,l,h,f,p,m,b,g,v,y,_,w=this,S=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=S.length>0&&void 0!==S[0]?S[0]:{}).deviceId,i=void 0===r?null:r,n=t.videoResolution,s=t.forceVp8,o=t.forceVp9,c=t.forceH264,d=t.h264Profile,u=t.forceFPS,l=t.enableWebcamLayers,h=t.numSimulcastStreams,f=t.videoBitRates,I.debug("enableWebcam()"),this.data.inputParams.produce){e.next=7;break}return I.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID004",text:"Error while trying to start Camera. Produce flag need to set to true while joining room in order to enable Camera."});case 7:if("connected"===this._roomStatus){e.next=10;break}return I.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID005",text:"Error while trying to start Camera as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling Camera? OR if you have already initiated the joinRoom process, then Camera will be enabled automatically once room join process completes."});case 10:if(!this._webcamProducer){e.next=13;break}return I.debug("Camera is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID003",text:"Error while trying to start Camera. Camera is already active!"});case 13:if(this._device.canProduce("video")){e.next=16;break}return I.error("enableWebcam() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID006",text:"Error while trying to start Camera. Camera couldnot be activated due to limitations on this device. If you think this device has a functional camera and the problem persists even after multiple retries, please contact technical support with the error code."});case 16:if(["hd","vga","qvga"].includes(n)&&(this.data.inputParams.videoResolution=n,this._webcam.resolution=n),s&&"boolean"==typeof s&&(this.data.inputParams.forceVp8=s),o&&"boolean"==typeof o&&(this.data.inputParams.forceVp9=o),c&&"boolean"==typeof c&&(this.data.inputParams.forceH264=c),d&&["high","low"].includes(d.toLowerCase())&&(this.data.inputParams.h264Profile=d),u&&Number.isInteger(u)&&u<65&&u>5&&(this.data.inputParams.forceFPS=25),l&&"boolean"==typeof l&&(this.data.inputParams.enableWebcamLayers=l,this._enableWebcamLayers=l),h&&Number.isInteger(h)&&h<4&&h>0&&(this.data.inputParams.numSimulcastStreams=h,this._numSimulcastStreams=h),Array.isArray(f)&&f.length>=1&&f.length<=3&&f.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?(I.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=f):I.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[700,250,75]'"),e.prev=25,this._externalVideo){e.next=41;break}if(i?(m=this._deviceList.videoDevices.find((function(e){return e.deviceId===i})))||(I.warn("Selected deviceId:%s not found",i),m=this._deviceList.videoDevices[0]):m=this._deviceList.videoDevices[0],this._webcam.device=m,b=this._webcam.resolution,m){e.next=33;break}return I.error("No wencam device found! Can't start video!"),e.abrupt("return",{success:!1,reason:"No Webcam available for starting video!"});case 33:return i&&this.data.inputParams.videoDeviceId!==i&&(this.data.inputParams.videoDeviceId=i),I.debug("enableWebcam() | calling getUserMedia()"),e.next=37,navigator.mediaDevices.getUserMedia({video:E(E({deviceId:{ideal:m.deviceId}},D[b]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 37:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0],e.next=46;break;case 41:return m={label:"external video"},e.next=44,this._getExternalVideoStream();case 44:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0].clone();case 46:if(y={videoGoogleStartBitrate:1e3},I.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),!this._forceVP8){e.next=54;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=52;break}throw new Error("desired VP8 codec+configuration is not supported");case 52:e.next=67;break;case 54:if(!this._forceH264){e.next=63;break}if("high"===this.data.inputParams.h264Profile?v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),v){e.next=60;break}throw new Error("desired H264 codec+configuration is not supported");case 60:I.debug("Selected h264 codec is:%O",v);case 61:e.next=67;break;case 63:if(!this._forceVP9){e.next=67;break}if(v=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=67;break}throw new Error("desired VP9 codec+configuration is not supported");case 67:return this._enableWebcamLayers&&(_=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&v||"video/vp9"===_.mimeType.toLowerCase()?g=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(g=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&g.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&g.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))),e.next=70,this._sendTransport.produce({track:p,encodings:g,codecOptions:y,codec:v});case 70:this._webcamProducer=e.sent,this._producers.set("video",{id:this._webcamProducer.id,deviceLabel:m.label,type:this._getWebcamType(m),paused:this._webcamProducer.paused,track:this._webcamProducer.track,rtpParameters:this._webcamProducer.rtpParameters,codec:this._webcamProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),this._webcamProducer.on("transportclose",(function(){w._webcamProducer=null})),this._webcamProducer.on("trackended",(function(){w.disableWebcam().catch((function(){}))})),e.next=82;break;case 77:e.prev=77,e.t0=e.catch(25),I.error("enableWebcam() | failed:%o",e.t0),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),p&&p.stop();case 82:case"end":return e.stop()}}),e,this,[[25,77]])}))),function(){return A.apply(this,arguments)})},{key:"disableCam",value:(T=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("disableWebcam()"),this._webcamProducer){e.next=3;break}return e.abrupt("return");case 3:return this._webcamProducer.close(),this._producers.delete("video"),e.prev=5,e.next=8,this._cignal.request("closeProducer",{producerId:this._webcamProducer.id});case 8:this.emit("videoEnd",{peerId:this.data.inputParams.peerId,videoTrack:null}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),this.emit("error",{code:"EID012",text:"Error while closing server side producer!"});case 14:this._webcamProducer=null;case 15:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return T.apply(this,arguments)})},{key:"_updateWebcams",value:(M=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I.debug("_updateWebcams()"),this._webcams=new Map,I.debug("_updateWebcams() | calling enumerateDevices()"),e.next=5,navigator.mediaDevices.enumerateDevices();case 5:t=e.sent,r=R(t),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=16;break}if("videoinput"===(n=i.value).kind){e.next=13;break}return e.abrupt("continue",14);case 13:this._webcams.set(n.deviceId,n);case 14:e.next=9;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(7),r.e(e.t0);case 21:return e.prev=21,r.f(),e.finish(21);case 24:s=Array.from(this._webcams.values()),o=s.length,c=this._webcam.device?this._webcam.device.deviceId:void 0,I.debug("_updateWebcams() [webcams:%o]",s),0===o?this._webcam.device=null:this._webcams.has(c)||(this._webcam.device=s[0]);case 29:case"end":return e.stop()}}),e,this,[[7,18,21,24]])}))),function(){return M.apply(this,arguments)})},{key:"_getExternalVideoStream",value:(P=(0,s.default)(a.default.mark((function e(){var t=this;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._externalVideoStream){e.next=2;break}return e.abrupt("return",this._externalVideoStream);case 2:if(!(this._externalVideo.readyState<3)){e.next=5;break}return e.next=5,new Promise((function(e){return t._externalVideo.addEventListener("canplay",e)}));case 5:if(!this._externalVideo.captureStream){e.next=9;break}this._externalVideoStream=this._externalVideo.captureStream(),e.next=14;break;case 9:if(!this._externalVideo.mozCaptureStream){e.next=13;break}this._externalVideoStream=this._externalVideo.mozCaptureStream(),e.next=14;break;case 13:throw new Error("video.captureStream() not supported");case 14:return e.abrupt("return",this._externalVideoStream);case 15:case"end":return e.stop()}}),e,this)}))),function(){return P.apply(this,arguments)})},{key:"_getWebcamType",value:function(e){return/(back|rear)/i.test(e.label)?(I.debug("_getWebcamType() | it seems to be a back camera"),"back"):(I.debug("_getWebcamType() | it seems to be a front camera"),"front")}},{key:"changeVideoInput",value:(k=(0,s.default)(a.default.mark((function e(t){var r,i,n,s;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,!this._webcamProducer){e.next=8;break}return e.next=4,this._changeVideoInput({resolution:r,deviceId:i,fps:n});case 4:return s=e.sent,e.abrupt("return",s);case 8:return I.error("No webcam producer available!"),e.abrupt("return",{success:!1,reason:"You are not sharing your camera yet. Camera Input can be changed to a new camera only when you are sharing an existing camera. "});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"_changeVideoInput",value:(g=(0,s.default)(a.default.mark((function e(t){var r,i,n,s,o,c;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,i=t.deviceId,n=t.fps,I.info("_changeVideoInput() | Inside"),r&&["hd","vga","qvga"].includes(r)?this._webcam.resolution=r:I.warn("Invalid video resolution value "),n&&Number.isInteger(n)&&n<65&&n>5?this.data.inputParams.forceFPS=n:I.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),s=this._deviceList.videoDevices.find((function(e){return i&&e.deviceId===i}))){e.next=8;break}return I.error("The selected deviceId not found!"),e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 8:return this._webcam.device=s,e.prev=9,this._webCamStream.getVideoTracks().forEach((function(e){return e.stop()})),this._webCamStream=null,I.debug("changeVideoInput() | calling getUserMedia()"),e.next=15,navigator.mediaDevices.getUserMedia({video:E(E({deviceId:{ideal:s.deviceId}},D[this._webcam.resolution]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 15:return this._webCamStream=e.sent,o=this._webCamStream.getVideoTracks()[0],I.debug("The new video track is:%O",o),e.next=20,this._webcamProducer.replaceTrack({track:o});case 20:return(c=this._producers.get("video")).deviceLabel=s.label,c.type=this._getWebcamType(s),c.track=this._webcamProducer.track,I.debug("Updated producer values are:%O",c),this._producers.set("video",c),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 30:return e.prev=30,e.t0=e.catch(9),I.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change video input",error:e.t0});case 34:case"end":return e.stop()}}),e,this,[[9,30]])}))),function(e){return g.apply(this,arguments)})},{key:"changeAudioInput",value:(b=(0,s.default)(a.default.mark((function e(t){var r,i,n,s,o,c,d;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,s=t.sampleRate,o=t.channelCount,c=t.deviceId,!this._micProducer){e.next=8;break}return e.next=4,this._changeAudioInput({autoGainControl:r,echoCancellation:i,noiseSuppression:n,sampleRate:s,channelCount:o,deviceId:c});case 4:return d=e.sent,e.abrupt("return",d);case 8:return e.abrupt("return",{success:!1,reason:"You are not sharing your mic yet. Mic Input can be changed to a new mic only when you are sharing an existing mic. "});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"_changeAudioInput",value:(l=(0,s.default)(a.default.mark((function e(t){var r,i,n,s,o,c,d,u,l;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,i=t.echoCancellation,n=t.noiseSuppression,s=t.sampleRate,o=t.channelCount,c=t.deviceId,r&&"boolean"==typeof r&&(this.data.inputParams.autoGainControl=r),i&&"boolean"==typeof i&&(this.data.inputParams.echoCancellation=Boolean(i)),n&&"boolean"==typeof n&&(this.data.inputParams.noiseSuppression=Boolean(n)),s&&Number.isInteger(s)&&s<64e3&&s>8e3&&(this.data.inputParams.sampleRate=s),o&&Number.isInteger(o)&&o>0&&o<3&&(this.data.inputParams.channelCount=o),d=this._deviceList.audioDevices.find((function(e){return c&&e.deviceId===c}))){e.next=9;break}return e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 9:return this._mic.device=d,this._micStream&&this._micStream.getAudioTracks().forEach((function(e){return e.stop()})),this._micStream=null,e.prev=12,e.next=15,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:d.deviceId},echoCancellation:this.data.inputParams.echoCancellation,noiseSuppression:this.data.inputParams.noiseSuppression,autoGainControl:this.data.inputParams.autoGainControl,sampleRate:this.data.inputParams.sampleRate,channelCount:this.data.inputParams.channelCount}});case 15:return this._micStream=e.sent,u=this._micStream.getAudioTracks()[0],this._micProducer.replaceTrack({track:u}),(l=this._producers.get("audio")).deviceLabel=d.label,l.track=this._micProducer.track,I.debug("Updated producer values are:%O",l),this._producers.set("audio",l),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 27:return e.prev=27,e.t0=e.catch(12),I.error("Error while changing input:%O",e.t0),e.abrupt("return",{success:!1,reason:"Couldn't change audio input",err:e.t0});case 31:case"end":return e.stop()}}),e,this,[[12,27]])}))),function(e){return l.apply(this,arguments)})},{key:"enableShare",value:(u=(0,s.default)(a.default.mark((function e(){var t,r,i,n,s,o,c,d,u,l,h,f,p,m,b=this,g=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=g.length>0&&void 0!==g[0]?g[0]:{}).shareAudio,i=void 0!==r&&r,n=t.enableSharingLayers,s=void 0===n||n,o=t.shareBitRates,c=void 0===o?[2500,1250,500]:o,I.debug("enableShare()"),this.data.inputParams.produce){e.next=7;break}return I.debug("Produce status is set to false!"),e.abrupt("return",{success:!1,error:!0,code:"REID003",text:"Error while trying to start screen share. Produce flag need to set to true while joining room in order to enable screen share."});case 7:if("connected"===this._roomStatus){e.next=12;break}return I.debug("Room status is not connected yet!"),e.abrupt("return",{success:!1,error:!0,code:"REID001",text:"Error while trying to start screen share as room not in connected status. Current room status:!".concat(this._roomStatus),possibleReasons:"Did you forget to call joinRoom before enabling screen share? OR if you have already initiated the joinRoom process, then try enabling screen share after some seconds."});case 12:if(!this._shareProducer){e.next=17;break}return I.debug("Screen share is already active!"),e.abrupt("return",{success:!1,warning:!0,code:"RWID001",text:"Error while trying to start screen share. Screen share is already active!"});case 17:if(this._device.canProduce("video")){e.next=20;break}return I.error("enableShare() | cannot produce video"),e.abrupt("return",{success:!1,error:!0,code:"REID002",text:"Error while trying to start screen share. Screen share couldnot be activated due to limitations on this device. If you think this device is capable of screen share and the problem persists even after multiple retries, please contact technical support with the error code."});case 20:return this._enableSharingLayers="boolean"!=typeof s?Boolean(s):s,Array.isArray(c)&&c.length>=1&&c.length<=3&&c.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?this.data.inputParams.shareBitRates=c:this.data.inputParams.shareBitRates=[2500,1250,500],e.prev=22,I.debug("enableShare() | calling getDisplayMedia()"),e.next=26,navigator.mediaDevices.getDisplayMedia({audio:!!i,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});case 26:if(l=e.sent){e.next=31;break}return I.error("Unable to capture screen."),this.emit("error",{code:"EID013",text:"Error while trying to start screen share. Not able to capture screen!"}),e.abrupt("return");case 31:if(!(u=l.getAudioTracks()[0])){e.next=38;break}return e.next=35,this._sendTransport.produce({track:u,codecOptions:this.data.inputParams.forcePCMU?void 0:{opusStereo:!1,opusDtx:!0,opusFec:!0,opusNack:!0},codec:this.data.inputParams.forcePCMU?this._device.rtpCapabilities.codecs.find((function(e){return"audio/pcmu"===e.mimeType.toLowerCase()})):void 0});case 35:this._shareAudioProducer=e.sent,this._producers.set("ssAudio",{id:this._shareAudioProducer.id,type:"shareAudio",paused:this._shareAudioProducer.paused,track:this._shareAudioProducer.track,rtpParameters:this._shareAudioProducer.rtpParameters,codec:this._shareAudioProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssAudioStart",{peerId:this.data.inputParams.peerId,audioTrack:this._shareAudioProducer.track,type:"local"});case 38:if(d=l.getVideoTracks()[0],p={videoGoogleStartBitrate:1e3},!this._forceVP8){e.next=46;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp8"===e.mimeType.toLowerCase()}))){e.next=44;break}throw new Error("desired VP8 codec+configuration is not supported");case 44:e.next=59;break;case 46:if(!this._forceH264){e.next=55;break}if("high"===this.data.inputParams.h264Profile?f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]})):"low"===this.data.inputParams.h264Profile&&(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]}))),f){e.next=52;break}throw new Error("desired H264 codec+configuration is not supported");case 52:I.debug("Selected h264 codec is:%O",f);case 53:e.next=59;break;case 55:if(!this._forceVP9){e.next=59;break}if(f=this._device.rtpCapabilities.codecs.find((function(e){return"video/vp9"===e.mimeType.toLowerCase()}))){e.next=59;break}throw new Error("desired VP9 codec+configuration is not supported");case 59:return this._enableSharingLayers&&(m=this._device.rtpCapabilities.codecs.find((function(e){return"video"===e.kind})),this._forceVP9&&f||"video/vp9"===m.mimeType.toLowerCase()?h=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(h=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&h.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&h.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))),e.next=62,this._sendTransport.produce({track:d,encodings:h,codecOptions:p,codec:f,appData:{share:!0}});case 62:this._shareProducer=e.sent,this._producers.set("ssVideo",{id:this._shareProducer.id,type:"shareVideo",paused:this._shareProducer.paused,track:this._shareProducer.track,rtpParameters:this._shareProducer.rtpParameters,codec:this._shareProducer.rtpParameters.codecs[0].mimeType.split("/")[1]}),this.emit("ssVideoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._shareProducer.track,type:"local"}),this._shareProducer.on("transportclose",(function(){b._shareProducer=null})),this._shareProducer.on("trackended",(function(){b.disableShare().catch((function(){}))})),e.next=74;break;case 69:e.prev=69,e.t0=e.catch(22),I.error("enableShare() | failed:%o",e.t0),"NotAllowedError"!==e.t0.name&&this.emit("error",{code:"EID014",text:"Error while trying to start screen share. Error is: ".concat(e.t0,"!")}),d&&d.stop();case 74:case"end":return e.stop()}}),e,this,[[22,69]])}))),function(){return u.apply(this,arguments)})},{key:"disableShare",value:(n=(0,s.default)(a.default.mark((function e(){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.debug("disableShare()"),this._shareProducer){e.next=5;break}return I.warn("Screen share doesn't seem to be on!"),this.emit("error",{code:"EID017",text:"Error while trying to stop screen share. Is the screen share on!"}),e.abrupt("return");case 5:if(this._shareProducer.close(),!this._shareAudioProducer){e.next=17;break}return this._shareAudioProducer.close(),e.prev=8,e.next=11,this._cignal.request("closeProducer",{producerId:this._shareAudioProducer.id});case 11:this.emit("ssAudioStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"}),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(8),this.emit("error",{code:"EID015",text:"Error while trying to stop screen share audio. Error is: ".concat(e.t0,"!")});case 17:return e.prev=17,e.next=20,this._cignal.request("closeProducer",{producerId:this._shareProducer.id});case 20:this.emit("ssVideoStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"}),e.next=26;break;case 23:e.prev=23,e.t1=e.catch(17),this.emit("error",{code:"EID016",text:"Error while trying to stop screen share video. Error is: ".concat(e.t1,"!")});case 26:this._shareAudioProducer=null,this._shareProducer=null;case 28:case"end":return e.stop()}}),e,this,[[8,14],[17,23]])}))),function(){return n.apply(this,arguments)})}],[{key:"listDevices",value:(i=(0,s.default)(a.default.mark((function e(){var t;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C){e.next=3;break}return I.info("Device list already exists:%O",C),e.abrupt("return",{success:!0,deviceList:C});case 3:return e.next=5,(0,S.loadAllAvailableDevices)();case 5:if(!(t=e.sent).success){e.next=11;break}return C=t.deviceList,e.abrupt("return",{success:!0,deviceList:t.deviceList});case 11:return e.abrupt("return",{success:!1,reason:t.reason});case 12:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"joinRoom",value:(r=(0,s.default)(a.default.mark((function e(){var r,i,n,s,o,c,d,u,l,h,f,m,b,g,S,k,R,P,M,E,x,T,C,D,O,A,L,j,B,N,F,U,q,z,V,G,W,H,K,$,J,Y,X,Z,Q,ee,te,re,ie,ne,ae,se,oe,ce,de,ue,le,he,fe,pe,me,be,ge,ve,ye,_e=arguments;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=(r=_e.length>0&&void 0!==_e[0]?_e[0]:{}).sessionToken,n=r.roomId,s=r.peerId,o=r.peerName,c=r.produce,d=void 0===c||c,u=r.produceAudio,l=void 0===u||u,h=r.produceVideo,f=void 0===h||h,m=r.consume,b=void 0===m||m,g=r.videoResolution,S=void 0===g?"hd":g,k=r.forceVp8,R=void 0!==k&&k,P=r.forceVp9,M=void 0!==P&&P,E=r.forceH264,x=void 0!==E&&E,T=r.h264Profile,C=void 0===T?"high":T,D=r.forcePCMU,O=void 0!==D&&D,A=r.forcePCMA,L=void 0!==A&&A,j=r.forceFPS,B=void 0===j?25:j,N=r.enableWebcamLayers,F=void 0===N||N,U=r.numSimulcastStreams,q=void 0===U?3:U,z=r.autoGainControl,V=void 0===z||z,G=r.echoCancellation,W=void 0===G||G,H=r.noiseSuppression,K=void 0===H||H,$=r.sampleRate,J=void 0===$?44e3:$,Y=r.channelCount,X=void 0===Y?1:Y,Z=r.videoBitRates,Q=void 0===Z?[700,250,75]:Z,ee=r.share,te=void 0!==ee&&ee,re=r.shareAudio,ie=void 0!==re&&re,ne=r.enableSharingLayers,ae=void 0===ne||ne,se=r.shareBitRates,oe=void 0===se?[2500,1250,500]:se,ce=r.audioDeviceId,de=void 0===ce?null:ce,ue=r.videoDeviceId,le=void 0===ue?null:ue,i){e.next=3;break}throw new Error("Session token is required to join the room.");case 3:return["hd","vga","qvga"].includes(S)||(I.warn("Invalid video resolution value. setting it to default value of 'hd' "),S="hd"),"boolean"!=typeof d&&(I.warn("Produe should either be true or false"),d=Boolean(d)),"boolean"!=typeof l&&(I.warn("ProduceAudio should either be true or false"),l=Boolean(l)),"boolean"!=typeof f&&(I.warn("ProduceVideo should either be true or false"),f=Boolean(f)),"boolean"!=typeof b&&(I.warn("Consume should either be true or false"),b=Boolean(b)),"boolean"!=typeof R&&(I.warn("forceVp8 should either be true or false"),R=Boolean(R)),"boolean"!=typeof M&&(I.warn("forceVp9 should either be true or false"),M=Boolean(M)),"boolean"!=typeof x&&(I.warn("forceH264 should either be true or false"),x=Boolean(x)),["high","low"].includes(C.toLowerCase())||(I.warn("h264Profile should either be 'high' or 'low'"),C="high"),(!Number.isInteger(B)||Number.isInteger(B)&&(B>65||B<5))&&(I.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),B=25),"boolean"!=typeof F&&(I.warn("enableWebcamLayers should either be true or false"),F=Boolean(F)),(!Number.isInteger(q)||Number.isInteger(q)&&(q>3||q<1))&&(I.warn("numSimulcastStreams should be a number between 1 to 3, default value is 3."),q=3),Array.isArray(Q)&&Q.length>=1&&Q.length<=3&&Q.every((function(e){return Number.isInteger(e)&&e>=75&&e<=800}))?I.debug("videoBitRates values are correct"):(I.warn("videobitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[75,250,75]'"),Q=[75,75,75]),"boolean"!=typeof O&&(I.warn("forcePCMU should either be true or false"),O=Boolean(O)),"boolean"!=typeof L&&(I.warn("forcePCMA should either be true or false"),L=Boolean(L)),"boolean"!=typeof V&&(I.warn("autoGainControl should either be true or false"),V=Boolean(V)),"boolean"!=typeof W&&(I.warn("echoCancellation should either be true or false"),W=Boolean(W)),"boolean"!=typeof K&&(I.warn("noiseSuppression should either be true or false"),K=Boolean(K)),(!Number.isInteger(J)||Number.isInteger(J)&&(J>64e3||J<8e3))&&(I.warn("sampleRate should be a number between 8000 to 64000, default value is 44000 Khz."),J=44e3),(!Number.isInteger(X)||Number.isInteger(X)&&(X>2||X<1))&&(I.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),X=1),"boolean"!=typeof te&&(I.warn("share should either be true or false"),te=Boolean(te)),"boolean"!=typeof ie&&(I.warn("shareAudio should either be true or false"),ie=Boolean(ie)),"boolean"!=typeof ae&&(I.warn("enableSharingLayers should either be true or false"),ae=Boolean(ae)),Array.isArray(oe)&&oe.length>=1&&oe.length<=3&&oe.every((function(e){return Number.isInteger(e)&&e>=500&&e<=2500}))?I.debug("shareBitRates values are correct"):(I.warn("sharebitrates values should be an integer array with maximum 3 elements and minimum 1 element. The values in the array are '[2500,1250,500]'"),oe=[2500,1250,500]),e.prev=27,I.info("session token:%s",i),s||(s=(0,y.uuidv4)()),n||(n=(0,v.getRandomInt)()),o||(o=(0,w.default)()),he=p.default.parse(window.navigator.userAgent),fe=he.browser.name,pe=he.browser.version,me=he.os.name,be={name:s,participantType:"moderator",browserName:fe,browserVersion:pe,os:me},I.info("browser details are:%O",he),ge={sessionToken:i,roomId:n,peerId:s,consumerReplicas:0,producer:d,consumer:b,participantData:be},ve={},I.debug("Received input parameters are:%O",ge),e.next=43,(0,_.getVidScaleUrl)(ge);case 43:if(!((ye=e.sent).success&&ye.wsUrl&&ye.core)){e.next=49;break}ve.url=ye.wsUrl,ve.core=ye.core,e.next=51;break;case 49:return I.warn("Vidscale returned success as false. with error:%O",ye),e.abrupt("return",ye);case 51:return I.debug("VidScale url is:",ve.url),e.abrupt("return",new t({peerId:s,roomId:n,peerName:o,produce:d,produceAudio:l,produceVideo:f,consume:b,videoResolution:S,forceVp8:R,forceVp9:M,forceH264:x,h264Profile:C,forceFPS:B,forcePCMU:O,forcePCMA:L,enableWebcamLayers:F,numSimulcastStreams:q,autoGainControl:V,echoCancellation:W,noiseSuppression:K,sampleRate:J,channelCount:X,videoBitRates:Q,share:te,shareAudio:ie,enableSharingLayers:ae,shareBitRates:oe,outputData:ve,audioDeviceId:de,videoDeviceId:le}));case 55:throw e.prev=55,e.t0=e.catch(27),I.error("Failed to join room:",e.t0.message),e.t0;case 59:case"end":return e.stop()}}),e,null,[[27,55]])}))),function(){return r.apply(this,arguments)})}]);var r,i,n,u,l,b,g,k,P,M,T,A,L,j,B,N,F,U,q,z,V,G,W,H}(b.EventEmitter)},{"./Logger":4,"./socket":5,"./utils/chooseMedia":12,"./utils/constants":13,"./utils/getRandomInt":14,"./utils/getVidScaleUrl":16,"./utils/randomName":18,"./utils/uuidv4":20,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/defineProperty":27,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/helpers/typeof":38,"@babel/runtime/regenerator":39,bowser:61,events:91,"mediasoup-client":232}],4:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/helpers/classCallCheck")),a=i(e("@babel/runtime/helpers/createClass")),s=e("debug"),o="VidScale-js",c=function(){return(0,a.default)((function e(t){(0,n.default)(this,e),t?(this._debug=s("".concat(o,":").concat(t)),this._info=s("".concat(o,":INFO:").concat(t)),this._warn=s("".concat(o,":WARN:").concat(t)),this._error=s("".concat(o,":ERROR:").concat(t))):(this._debug=s(o),this._info=s("".concat(o,":INFO")),this._warn=s("".concat(o,":WARN")),this._error=s("".concat(o,":ERROR"))),this._debug.log=console.info.bind(console),this._info.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}),[{key:"debug",get:function(){return this._debug}},{key:"info",get:function(){return this._info}},{key:"warn",get:function(){return this._warn}},{key:"error",get:function(){return this._error}}])}();t.exports=c},{"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/interopRequireDefault":30,debug:104}],5:[function(e,t,r){"use strict";var i=e("./lib/Peer"),n=e("./lib/transports/SocketTransport"),a=e("./lib/transports/WebSocketTransport");r.Peer=i,r.SocketTransport=n,r.WebSocketTransport=a},{"./lib/Peer":8,"./lib/transports/SocketTransport":9,"./lib/transports/WebSocketTransport":10}],6:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits"));function l(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,h()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var f=e("events").EventEmitter,p=e("../../Logger"),m=function(e){function t(e){var r;return(0,s.default)(this,t),(r=l(this,t)).setMaxListeners(1/0),r._logger=e||new p("EnhancedEventEmitter"),r}return(0,u.default)(t,e),(0,o.default)(t,[{key:"safeEmit",value:function(e){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];this.emit.apply(this,[e].concat(r))}catch(t){this._logger.error("safeEmit() | event listener threw an error [event:%s]:%o",e,t)}}},{key:"safeEmitAsPromise",value:(r=(0,a.default)(n.default.mark((function e(t){var r,i,a,s=this,o=arguments;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=o.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=o[a];return e.abrupt("return",new Promise((function(e,r){s.safeEmit.apply(s,[t].concat(i,[e,r]))})));case 2:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})}]);var r}(f);t.exports=m},{"../../Logger":4,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39,events:91}],7:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/helpers/typeof")),a=i(e("@babel/runtime/helpers/classCallCheck")),s=i(e("@babel/runtime/helpers/createClass")),o=e("../../Logger"),c=e("./utils").generateRandomNumber,d=new o("Message"),u=function(){return(0,s.default)((function e(){(0,a.default)(this,e)}),null,[{key:"parse",value:function(e){var t,r={};try{t=JSON.parse(e)}catch(e){return void d.error("parse() | invalid JSON: %s",e)}if("object"===(0,n.default)(t)&&!Array.isArray(t)){if(t.request){if(r.request=!0,"string"!=typeof t.method)return void d.error("parse() | missing/invalid method field");if("number"!=typeof t.id)return void d.error("parse() | missing/invalid id field");r.id=t.id,r.method=t.method,r.data=t.data||{}}else if(t.response){if(r.response=!0,"number"!=typeof t.id)return void d.error("parse() | missing/invalid id field");r.id=t.id,t.ok?(r.ok=!0,r.data=t.data||{}):(r.ok=!1,r.errorCode=t.errorCode,r.errorReason=t.errorReason)}else{if(!t.notification)return void d.error("parse() | missing request/response field");if(r.notification=!0,"string"!=typeof t.method)return void d.error("parse() | missing/invalid method field");r.method=t.method,r.data=t.data||{}}return r}d.error("parse() | not an object")}},{key:"createRequest",value:function(e,t){return{request:!0,id:c(),method:e,data:t||{}}}},{key:"createSuccessResponse",value:function(e,t){return{response:!0,id:e.id,ok:!0,data:t||{}}}},{key:"createErrorResponse",value:function(e,t,r){return{response:!0,id:e.id,ok:!1,errorCode:t,errorReason:r}}},{key:"createNotification",value:function(e,t){return{notification:!0,method:e,data:t||{}}}}])}();t.exports=u},{"../../Logger":4,"./utils":11,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/typeof":38}],8:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits"));function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return h(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function f(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,p()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}var m=e("../../Logger"),b=e("./EnhancedEventEmitter"),g=e("./Message"),v=new m("Peer"),y=function(e){function t(e){var r;return(0,s.default)(this,t),r=f(this,t,[v]),v.debug("constructor()"),r._closed=!1,r._transport=e,r._connected=!1,r._data={},r._sents=new Map,r._handleTransport(),r}return(0,u.default)(t,e),(0,o.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"connected",get:function(){return this._connected}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("cannot override data object")}},{key:"close",value:function(){if(!this._closed){v.debug("close()"),this._closed=!0,this._connected=!1,this._transport.close();var e,t=l(this._sents.values());try{for(t.s();!(e=t.n()).done;){e.value.close()}}catch(e){t.e(e)}finally{t.f()}this.safeEmit("close")}}},{key:"request",value:(i=(0,a.default)(n.default.mark((function e(t){var r,i,a=this,s=arguments;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:void 0,i=g.createRequest(t,r),this._logger.debug("request() [method:%s, id:%s]",t,i.id),e.next=5,this._transport.send(i);case 5:return e.abrupt("return",new Promise((function(e,t){var r=1500*(15+.1*a._sents.size),n={id:i.id,method:i.method,resolve:function(t){a._sents.delete(i.id)&&(clearTimeout(n.timer),e(t))},reject:function(e){a._sents.delete(i.id)&&(clearTimeout(n.timer),t(e))},timer:setTimeout((function(){a._sents.delete(i.id)&&t(new Error("request timeout"))}),r),close:function(){clearTimeout(n.timer),t(new Error("peer closed"))}};a._sents.set(i.id,n)})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"notify",value:(r=(0,a.default)(n.default.mark((function e(t){var r,i,a=arguments;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:void 0,i=g.createNotification(t,r),this._logger.debug("notify() [method:%s]",t),e.next=5,this._transport.send(i);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_handleTransport",value:function(){var e=this;if(this._transport.closed)return this._closed=!0,void setTimeout((function(){e._closed||(e._connected=!1,e.safeEmit("close"))}));this._transport.on("open",(function(){e._closed||(v.debug('emit "open"'),e._connected=!0,e.safeEmit("open"))})),this._transport.on("disconnected",(function(){e._closed||(v.debug('emit "disconnected"'),e._connected=!1,e.safeEmit("disconnected"))})),this._transport.on("failed",(function(t){e._closed||(v.debug('emit "failed" [currentAttempt:%s]',t),e._connected=!1,e.safeEmit("failed",t))})),this._transport.on("close",(function(){e._closed||(e._closed=!0,v.debug('emit "close"'),e._connected=!1,e.safeEmit("close"))})),this._transport.on("message",(function(t){t.request?e._handleRequest(t):t.response?e._handleResponse(t):t.notification&&e._handleNotification(t)}))}},{key:"_handleRequest",value:function(e){var t=this;try{this.emit("request",e,(function(r){var i=g.createSuccessResponse(e,r);t._transport.send(i).catch((function(){}))}),(function(r,i){r instanceof Error?(i=r.message,r=500):"number"==typeof r&&i instanceof Error&&(i=i.message);var n=g.createErrorResponse(e,r,i);t._transport.send(n).catch((function(){}))}))}catch(t){var r=g.createErrorResponse(e,500,String(t));this._transport.send(r).catch((function(){}))}}},{key:"_handleResponse",value:function(e){var t=this._sents.get(e.id);if(t)if(e.ok)t.resolve(e.data);else{var r=new Error(e.errorReason);r.code=e.errorCode,t.reject(r)}else v.error("received response does not match any sent request [id:%s]",e.id)}},{key:"_handleNotification",value:function(e){this.safeEmit("notification",e)}}]);var r,i}(b);t.exports=y},{"../../Logger":4,"./EnhancedEventEmitter":6,"./Message":7,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39}],9:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits"));function l(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,h()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var f=e("socket.io-client"),p=e("../utils").sleep,m=e("../../../Logger"),b=e("../EnhancedEventEmitter"),g=e("../Message"),v=new m("WebSocketTransport"),y=function(e){function t(e,r){var i;return(0,s.default)(this,t),i=l(this,t,[v]),v.debug("constructor() [url:%s, options:%o]",e,r),i._closed=!1,i._url=e,i._connected=!1,i._params=r||{},i._socket=null,i._createSocket(),i}return(0,u.default)(t,e),(0,o.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"close",value:function(){if(!this._closed){v.debug("close()"),this._closed=!0,this.safeEmit("close");try{this._socket.disconnect()}catch(e){v.error("close() | error closing the WebSocket: %o",e)}}}},{key:"send",value:(r=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=2;break}throw new Error("transport closed");case 2:e.prev=2,this._socket.send(JSON.stringify(t)),e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(2),v.warn("send() failed:%o",e.t0),e.t0;case 10:case"end":return e.stop()}}),e,this,[[2,6]])}))),function(e){return r.apply(this,arguments)})},{key:"_createSocket",value:function(){var e=this;if(!this._url)throw new Error("Cannot create socket without a valid connection url");var t=f(this._url,{rejectUnauthorized:!1});t.on("connect",(function(){e._connected?v.debug("Socket already connected!"):(v.debug("connected to socket"),e._connected=!0,e.safeEmit("open"))})),t.on("disconnect",(0,a.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v.error("socket disconnected!"),e._connected=!1,e.safeEmit("disconnected"),!e._closed){t.next=7;break}v.debug("No need to reconnect for roomClient close!"),t.next=16;break;case 7:if(!(e._reconnectionCounter>240)){t.next=10;break}return v.debug("Reconnection not needed if user disconnection for more than 2 minutes, reconnection counter:",e._reconnectionCounter),t.abrupt("return");case 10:return e._socket.close(),e._socket=null,e._createSocket(),e._reconnectionCounter+=1,t.next=16,p(500);case 16:case"end":return t.stop()}}),t)})))),t.on("reconnect",(function(){v.debug("socket reconnected after disconnect"),e.safeEmit("reconnect")})),t.on("connect_error",(function(t){v.error("socket connect error",t),e._connected=!1})),t.on("error",(function(t){v.error("Socket error",t),e._connected=!1,e.safeEmit("failed")})),t.on("message",(function(t){if(!e._closed){var r=g.parse(t);r&&(0!==e.listenerCount("message")?e.safeEmit("message",r):v.error('no listeners for WebSocket "message" event, ignoring received message'))}})),this._socket=t}}]);var r}(b);t.exports=y},{"../../../Logger":4,"../EnhancedEventEmitter":6,"../Message":7,"../utils":11,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39,"socket.io-client":298}],10:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("@babel/runtime/helpers/classCallCheck")),o=i(e("@babel/runtime/helpers/createClass")),c=i(e("@babel/runtime/helpers/possibleConstructorReturn")),d=i(e("@babel/runtime/helpers/getPrototypeOf")),u=i(e("@babel/runtime/helpers/inherits")),l=i(e("@babel/runtime/helpers/defineProperty"));function h(e,t,r){return t=(0,d.default)(t),(0,c.default)(e,f()?Reflect.construct(t,r||[],(0,d.default)(e).constructor):t.apply(e,r))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}var p=e("../EnhancedEventEmitter"),m=e("../utils").sleep,b=new(e("../../../Logger"))("WebsocketTransport"),g=function(e){function t(e,r){var i;return(0,s.default)(this,t),i=h(this,t,[b]),(0,l.default)(i,"createAndUpdateSocket",function(){var e=(0,a.default)(n.default.mark((function e(t){var r,a,s,o,c;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.connectionType,a=void 0===r?null:r,b.info("Room close status:%s",i._closed),s=i,!i._closed){e.next=6;break}return b.info("Websocket already closed!"),e.abrupt("return");case 6:if(i._url){e.next=9;break}return b.warn("url not available!"),e.abrupt("return");case 9:o=null===a?"".concat(i._url,"&connectionType=","landing"):"".concat(i._url,"&connectionType=").concat(a),b.debug("the url is:%s",o),i._ws=new WebSocket(o),c=0,b.debug("websocketHelper createAndUpdateSocket created a new websocket"),b.debug("websocketHelper createAndUpdateSocket:%s",i._ws.readyState);case 15:if(1===i._ws.readyState||!i._socketShouldReconnect){e.next=30;break}if(3!==i._ws.readyState){e.next=22;break}return b.debug("websocketHelper createAndUpdateSocket"),e.next=20,m(2e3);case 20:i._ws=new WebSocket(o),b.debug("websocketHelper createAndUpdateSocket newly created websocket state:%s",i._ws.readyState);case 22:return e.next=24,m(500);case 24:if(!(++c>250)){e.next=28;break}return b.error("No of retries limit to connect with server exhausted!"),e.abrupt("break",30);case 28:e.next=15;break;case 30:1===i._ws.readyState&&b.debug("updated the websocket with ready state -".concat(i._ws.readyState)),i.safeEmit("connected"),b.debug("updating the websocket to redux store with ready state -".concat(i._ws.readyState)),i._ws.onopen=function(){i._closed||(b.debug("Websocket open"),i.safeEmit("open"))},i._isConnected=!0,i._ws.onmessage=function(e){if(!i._closed){var t=JSON.parse(e.data);switch(t.id){case"ping":i._lastTimerId&&clearTimeout(i._lastTimerId);var r=i;i._lastTimerId=setTimeout((function(){r._isConnected=!1,this._roomJoined?r.close(4104,"In call connections close as server is unreachable for last 5 seconds!"):r.close(4103,"Landing page socket close by client as server not reachable for a couple of seconds!"),r._socketShouldReconnect&&(r._closed=!1,r.createAndUpdateSocket({connectionType:"inCall"}))}),22e3);i._ws.send(JSON.stringify({id:"pong"}));break;case"invalidToken":b.debug("Session token invalid!"),i._socketShouldReconnect=!1,i.safeEmit("invalidToken",t);break;case"alreadyActive":i.safeEmit("alreadyActive",t);break;case"passwordDisabled":i.safeEmit("passwordDisabled",t);break;case"notify":i.safeEmit("notify",t.data);break;case"remotePeerJoin":i.safeEmit("roomStartedP2p",t);break;case"userError":i.safeEmit("userError",t);break;case"validationAlert":i.safeEmit("validationError",t);break;case"joinStatusOnLanding":i.safeEmit("defaultJoinStatus",t);break;default:i.safeEmit("message",t)}}},i._ws.onclose=function(e){s._closed||(b.warn('WebSocket "close" event [wasClean:%s, code:%s, reason:"%s"]',e.wasClean,e.code,e.reason),4503===e.code||4504===e.code?(b.error("Socket closed with reason",e.reason),s._closed=!0):4500!==e.code&&(b.debug("trying to reconnect:%s",e.code),s._closed=!1,i._roomJoined?(b.debug("Trying to join after a network reset while in a meeting"),s.createAndUpdateSocket({connectionType:"inCall"})):(b.debug("Trying to join after a network reset while on the landing page"),s.createAndUpdateSocket({connectionType:null})),clearTimeout(s._lastTimerId)),i._url=null,b.info("The websocket closed status is:%s",s._closed),s.safeEmit("close",{code:e.code,reason:e.reason}))};case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),i._closed=!1,i._url=e,i._ws=null,i._socketShouldReconnect=r,i._isConnected=!1,i._lastTimerId=null,i._roomJoined=!1,b.info("Request received to instantiate websocket transport! with url :%s",e),i.createAndUpdateSocket({connectionType:null}),i}return(0,u.default)(t,e),(0,o.default)(t,[{key:"connectionStatus",get:function(){return this._isConnected}},{key:"close",value:function(e,t){if(!this._closed){b.info("close()"),this._closed=!0,this.safeEmit("close",{code:e,reason:t});try{this._ws.onopen=null,this._ws.onclose=null,this._ws.onerror=null,this._ws.onmessage=null,clearTimeout(this._lastTimerId),e&&t?this._ws.close(e,t):this._ws.close()}catch(e){b.error("close() | error closing the WebSocket: %o",e)}}}},{key:"send",value:(r=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=3;break}return b.error("Transport closed or not yet ready. Try again later!"),e.abrupt("return");case 3:e.prev=3,this._ws.send(JSON.stringify(t)),e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(3),b.warn("send() failed:%o",e.t0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return r.apply(this,arguments)})}]);var r}(p);t.exports=g},{"../../../Logger":4,"../EnhancedEventEmitter":6,"../utils":11,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/defineProperty":27,"@babel/runtime/helpers/getPrototypeOf":28,"@babel/runtime/helpers/inherits":29,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/helpers/possibleConstructorReturn":33,"@babel/runtime/regenerator":39}],11:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault"),n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator"));r.generateRandomNumber=function(){return Math.round(1e7*Math.random())},r.sleep=function(){var e=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return setTimeout((function(){return e()}),t)})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],12:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.updatedDeviceList=r.loadAllAvailableDevices=r.getDeviceId=r.chooseMediaLabelVideo=r.chooseMediaLabelAudioOutput=r.chooseMediaLabelAudio=r.chooseMediaLabel=void 0;var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=new(i(e("../Logger")).default)("device-manager"),o=(r.chooseMediaLabel=function(){var e=(0,a.default)(n.default.mark((function e(){var t,r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var i=void 0!==e.find((function(e){return"videoinput"===e.kind})),n=void 0!==e.find((function(e){return"audioinput"===e.kind}));return new Promise((function(e,a){navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(i){navigator.mediaDevices.enumerateDevices().then((function(n){n.forEach((function(e){"audioinput"===e.kind&&("videoinput"===e.kind?(t.push(e.label),r.push(e.label)):r.push(e.label))})),i.getTracks().forEach((function(e){e.stop()})),r.length>0&&(t.length>0?e({videoLabels:t,audioLabels:r}):e({audioLabels:r}))}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),r.chooseMediaLabelAudio=function(){var e=(0,a.default)(n.default.mark((function e(){var t;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var r=void 0!==e.find((function(e){return"audioinput"===e.kind}));return new Promise((function(e,i){navigator.mediaDevices.getUserMedia({audio:r}).then((function(r){navigator.mediaDevices.enumerateDevices().then((function(i){i.forEach((function(e,r){if("audioinput"===e.kind){var i=e.label||"Mic ".concat(Number(r)+1);t.push({label:i,deviceId:e.deviceId})}})),r.getTracks().forEach((function(e){e.stop()})),e({audioDevices:t})}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()),c=r.chooseMediaLabelAudioOutput=function(){var e=(0,a.default)(n.default.mark((function e(){var t;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var r=void 0!==e.find((function(e){return"audiooutput"===e.kind}));return new Promise((function(e,i){navigator.mediaDevices.getUserMedia({audio:r}).then((function(r){navigator.mediaDevices.enumerateDevices().then((function(i){i.forEach((function(e,r){if("audiooutput"===e.kind){var i=e.label||"Speaker ".concat(Number(r)+1);t.push({label:i,deviceId:e.deviceId})}})),r.getTracks().forEach((function(e){e.stop()})),e({audioDevicesOutput:t})}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),d=r.chooseMediaLabelVideo=function(){var e=(0,a.default)(n.default.mark((function e(){var t;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.abrupt("return",navigator.mediaDevices.enumerateDevices().then((function(e){var r=void 0!==e.find((function(e){return"videoinput"===e.kind}));return new Promise((function(e,i){navigator.mediaDevices.getUserMedia({video:r}).then((function(r){navigator.mediaDevices.enumerateDevices().then((function(i){i.forEach((function(e,r){if("videoinput"===e.kind){var i=e.label||"Camera ".concat(Number(r)+1);t.push({label:i,deviceId:e.deviceId})}})),r.getTracks().forEach((function(e){e.stop()})),e({videoDevices:t})}))})).catch((function(t){console.log(t.name+": "+t.message),e({error:t.name,reason:t.message})}))}))})).catch((function(e){console.log(e.name+": "+e.message)})));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();r.getDeviceId=function(e){return new Promise((function(t){s.info("chooseMedia label->:%s",e),navigator.mediaDevices.enumerateDevices().then((function(r){r.forEach((function(r){r.label===e&&t(r.deviceId)})),r[0].label||t({error:"noLabel",reason:"Device label names not found!"})})).catch((function(e){s.error("err.name:%O ",e.message),t({error:e.name,reason:e.message})}))}))},r.updatedDeviceList=function(){var e=(0,a.default)(n.default.mark((function e(){var t,r,i;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=[],i=[],e.abrupt("return",new Promise((function(e,n){navigator.mediaDevices.enumerateDevices().then((function(n){n.forEach((function(e,n){if("audioinput"===e.kind){var a=e.label||"Mic ".concat(Number(n)+1);r.push({label:a,deviceId:e.deviceId})}if("videoinput"===e.kind){var s=e.label||"Camera ".concat(Number(n)+1);t.push({label:s,deviceId:e.deviceId})}if("audiooutput"===e.kind){var o=e.label||"Speaker ".concat(Number(n)+1);i.push({label:o,deviceId:e.deviceId})}})),e({audioDevices:r,audioDevicesOutput:i,videoDevices:t})}))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),r.loadAllAvailableDevices=function(){var e=(0,a.default)(n.default.mark((function e(){var t,r,i,a,s,u;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={videoDevices:[],audioDevices:[],audioOutputDevices:[]},e.next=3,d();case 3:if(r=e.sent,i=null,!r.error){e.next=21;break}e.t0=r.error,e.next="TypeError"===e.t0?9:"AbortError"===e.t0?10:"NotAllowedError"===e.t0?12:"NotFoundError"===e.t0?14:"NotReadableError"===e.t0?16:18;break;case 9:return e.abrupt("break",18);case 10:return i="".concat(r.error," : ").concat(r.reason,"!! Your Camera is currently being used !! If you wish to join the room with video, please close the other tab / browser wherever it is being used and refresh this page!!"),e.abrupt("break",18);case 12:return i="".concat(r.error," : ").concat(r.reason,'!! You have denied the access to your Camera!! If you wish to join the room with video, please allow the camera access by clicking on the camera icon in the address bar Or by going to " chrome://settings/content#media-stream-mic " link in your chrome.'),e.abrupt("break",18);case 14:return i="".concat(r.error," : ").concat(r.reason,"!! No Camera could be found!! If you have a camera or microphone in your computer but it is not able to detect them, please refresh your browser again or restart the browser after closing all the opened tabs."),e.abrupt("break",18);case 16:return i="".concat(r.error," : ").concat(r.reason,"!! If you have a camera in your computer but it is not able to detect it as it may have been used by some other browser / tab, please refresh your browser again after closing the tab using the camera or restart the browser after closing all the opened tabs."),e.abrupt("break",18);case 18:return e.abrupt("return",{success:!1,reason:{code:"EDV01",type:"DeviceError",text:i}});case 21:r.videoDevices&&r.videoDevices.length>0&&(t.videoDevices=r.videoDevices);case 22:return e.next=24,o();case 24:if(a=e.sent,s=null,!a.error){e.next=39;break}e.t1=a.error,e.next="NotAllowedError"===e.t1?30:"NotFoundError"===e.t1?32:"NotReadableError"===e.t1?34:36;break;case 30:return s="".concat(a.error," : ").concat(a.reason,'!! You have denied the access to your Mic!! If you wish to join the room with video, please allow the camera access by clicking on the camera icon in the address bar Or by going to " chrome://settings/content#media-stream-mic " link in your chrome.'),e.abrupt("break",36);case 32:return s="".concat(a.error," : ").concat(a.reason,"!! No Microphone could be found!! If you have a camera or microphone in your computer but it is not able to detect them, please refresh your browser again or restart the browser after closing all the opened tabs."),e.abrupt("break",36);case 34:return s="".concat(a.error," : ").concat(a.reason,"!! A hardware error occured at the OS OR browser Or Webpage level. If you have a microphone in your computer but it is not able to detect them, please refresh your browser again or restart the browser after closing all the opened tabs."),e.abrupt("break",36);case 36:return e.abrupt("return",{success:!1,reason:{code:"EDA01",type:"DeviceError",text:s}});case 39:a.audioDevices&&a.audioDevices.length>0&&(t.audioDevices=a.audioDevices);case 40:return e.next=42,c();case 42:if(!(u=e.sent).error){e.next=47;break}return e.abrupt("return",{success:!1,reason:{code:"EDAO01",type:"DeviceError",text:"Some error occured while accessing your speaker. Please try again again after some time."}});case 47:u.audioDevicesOutput&&u.audioDevicesOutput.length>0&&(t.audioOutputDevices=u.audioDevicesOutput);case 48:return e.abrupt("return",{success:!0,deviceList:t});case 49:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{"../Logger":4,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r._security=r.USER_TYPE_REGULAR=r.USER_TYPE_PRESENTER=r.USER_TYPE_MODERATOR=r.USER_TYPE_BOT=r.USER_TYPE_ADMIN=r.TOTAL_RECORDING_SPACE_AVAILABLE=r.STREAM_TYPE_SCREEN_VIDEO=r.STREAM_TYPE_SCREEN_AUDIO=r.STREAM_TYPE_CAM_VIDEO=r.STREAM_TYPE_CAM_AUDIO=r.STAGE=r.RTMPSTREAMANDRECORD=r.RTMPSTREAM=r.ROOM_STATUS_ENUM_OCUPIED=r.ROOM_STATUS_ENUM_FREE=r.ROOM_LEAVE_ONLY=r.ROOM_LEAVE_AND_CLOSE=r.ROOM_CLOSE_TYPE_CLIENT=r.ROOMTYPE_P2P=r.ROOMTYPE_EVENT=r.ROOMTYPE_CONFERENCING=r.RECORD=r.PROCESS=r.PARTICIPANT=r.MSG_TYPE_PUBLIC=r.MSG_TYPE_PRIVATE=r.MSG_SENDER_TYPE_VIEWER=r.MSG_SENDER_TYPE_PRESENTER=r.MSG_SENDER_TYPE_MODERATOR=r.MSG_SENDER_TYPE_EVERYBODY=r.MSG_DIRECTION_SEND=r.MSG_DIRECTION_RECV=r.MERGEA=r.MERGE=r.CLOUD_DO=r.CLOUD_AWS=r.BACK_STAGE=r.AMERGEA=r.AMERGE=void 0;r._security={roomType:{P2P:"p2p",CONFERENCING:"conferencing"},baseURL:"",vidScaleURL:"autoscalerv1.videoedge.io/api/vidScale/allocateResources",autoscalerURL:"autoscaler.samvyo.com",dashboardURL:"https://api.samvyo.com/api/callStats/verifySessionToken"},r.MSG_SENDER_TYPE_PRESENTER="participant",r.MSG_SENDER_TYPE_VIEWER="viewer",r.MSG_SENDER_TYPE_EVERYBODY="everybody",r.MSG_SENDER_TYPE_MODERATOR="moderator",r.MSG_TYPE_PRIVATE="private",r.MSG_TYPE_PUBLIC="public",r.MSG_DIRECTION_SEND="send",r.MSG_DIRECTION_RECV="recv",r.STREAM_TYPE_CAM_AUDIO="cam-audio",r.STREAM_TYPE_CAM_VIDEO="cam-video",r.STREAM_TYPE_SCREEN_AUDIO="screen-audio",r.STREAM_TYPE_SCREEN_VIDEO="screen-video",r.ROOM_STATUS_ENUM_FREE="free",r.ROOM_STATUS_ENUM_OCUPIED="occupied",r.ROOM_LEAVE_ONLY="leaveRoomNew",r.ROOM_LEAVE_AND_CLOSE="leaveAndCloseRoom",r.TOTAL_RECORDING_SPACE_AVAILABLE=256,r.USER_TYPE_ADMIN="admin",r.USER_TYPE_MODERATOR="moderator",r.USER_TYPE_PRESENTER="presenter",r.PARTICIPANT="participant",r.USER_TYPE_REGULAR="r",r.USER_TYPE_BOT="b",r.ROOMTYPE_P2P="p2p",r.ROOMTYPE_CONFERENCING="conferencing",r.ROOMTYPE_EVENT="event",r.ROOM_CLOSE_TYPE_CLIENT="client",r.CLOUD_AWS="aws",r.CLOUD_DO="do",r.STAGE="Stage",r.BACK_STAGE="Back-Stage",r.RECORD="record",r.RTMPSTREAM="rtmpStream",r.RTMPSTREAMANDRECORD="rtmpStreamAndRecord",r.PROCESS="process",r.MERGE="mergedAV",r.MERGEA="mergedA",r.AMERGE="AmergedAV",r.AMERGEA="AmergedA"},{}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getRandomInt=void 0;r.getRandomInt=function(){return Math.floor(1e10*Math.random())}},{}],15:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.VIDEO_ONLY_CONSTRAINTS=r.SCREEN_VIDEO_SIMULCAST_ENCODINGS=r.GENERAL_SCREENSHARE_CONSTRAINTS=r.GENERAL_AUDIO_VIDEO_CONSTRAINTS=r.GENERAL_AUDIO_ONLY_CONSTRAINTS=r.CAM_VIDEO_SIMULCAST_RECEIVE_MEDIUM=r.CAM_VIDEO_SIMULCAST_RECEIVE_LOW=r.CAM_VIDEO_SIMULCAST_ENCODINGS=r.AUDIO_VIDEO_CONSTRAINTS=r.AUDIO_ONLY_CONSTRAINTS=void 0;r.GENERAL_AUDIO_VIDEO_CONSTRAINTS={audio:!0,video:{width:{min:320,ideal:1280,max:1280},height:{min:240,ideal:720,max:720},aspectRatio:1.777777778,frameRate:{min:15,max:30}}},r.GENERAL_SCREENSHARE_CONSTRAINTS={audio:!1,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}},r.GENERAL_AUDIO_ONLY_CONSTRAINTS={audio:!0,video:!1},r.AUDIO_ONLY_CONSTRAINTS={audio:{deviceId:{exact:void 0}},video:!1},r.VIDEO_ONLY_CONSTRAINTS={audio:!1,video:{deviceId:{exact:void 0},width:{min:320,ideal:1280,max:1280},height:{min:240,ideal:720,max:720},aspectRatio:1.777777778,frameRate:{min:15,max:30}}},r.AUDIO_VIDEO_CONSTRAINTS={audio:{deviceId:{exact:void 0}},video:{deviceId:{exact:void 0},width:{min:320,ideal:1280,max:1280},height:{min:240,ideal:720,max:720},aspectRatio:1.777777778,frameRate:{min:15,max:30}}},r.CAM_VIDEO_SIMULCAST_ENCODINGS=[{maxBitrate:5e5,scaleResolutionDownBy:4,scalabilityMode:"L1T3"},{maxBitrate:1e6,scaleResolutionDownBy:2,scalabilityMode:"L1T3"},{maxBitrate:5e6,scaleResolutionDownBy:1,scalabilityMode:"L1T3"}],r.SCREEN_VIDEO_SIMULCAST_ENCODINGS=[{dtx:!0,maxBitrate:15e5},{dtx:!0,maxBitrate:6e6}],r.CAM_VIDEO_SIMULCAST_RECEIVE_LOW={spatialLayer:0,temporalLayer:0},r.CAM_VIDEO_SIMULCAST_RECEIVE_MEDIUM={spatialLayer:1,temporalLayer:1}},{}],16:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.getVidScaleUrl=function(e){return c.apply(this,arguments)};var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator")),s=i(e("axios/dist/browser/axios.cjs")),o=i(e("./constants"));new(i(e("../Logger")).default)("vidscale-url");function c(){return(c=(0,a.default)(n.default.mark((function e(t){var r,i,a,s,o,c,u,l,h,f,p;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sessionToken,i=t.roomId,a=t.peerId,s=t.consumerReplicas,o=t.producer,c=void 0===o||o,u=t.consumer,l=void 0===u||u,h=t.participantData,e.next=3,d({sessionToken:r,roomId:i,peerId:a,producer:c,consumer:l,participantData:h});case 3:if(!(f=e.sent).success){e.next=8;break}return e.abrupt("return",{success:!0,wsUrl:"wss://".concat(f.data.url,"/?roomId=").concat(i,"&peerId=").concat(a,"&consumerReplicas=").concat(s),roomUrl:"https://".concat(f.data.url),core:f.data.core});case 8:return p={success:!1,errorText:f.data.reason,errorCode:f.data.code},e.abrupt("return",p);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=function(){var e=(0,a.default)(n.default.mark((function e(t){var r,i,a,c,d,u,l;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.roomId,i=t.peerId,a=t.producer,c=t.consumer,d=t.sessionToken,u=t.participantData,e.next=3,s.default.post("".concat(o.default._security.vidScaleURL),{roomId:r,peerId:i,producer:a,consumer:c,sessionToken:d,participantData:u});case 3:return l=e.sent,e.abrupt("return",new Promise((function(e){try{e(l.data)}catch(e){}})));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{"../Logger":4,"./constants":13,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39,"axios/dist/browser/axios.cjs":58}],17:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.SocketQueue=void 0;var n=i(e("@babel/runtime/helpers/classCallCheck")),a=i(e("@babel/runtime/helpers/createClass"));r.SocketQueue=function(){return(0,a.default)((function e(){(0,n.default)(this,e),this.queue=new Map}),[{key:"push",value:function(e,t){this.queue.set(e,t)}},{key:"get",value:function(e){return this.queue.get(e)}},{key:"remove",value:function(e){this.queue.delete(e)}}])}()},{"@babel/runtime/helpers/classCallCheck":25,"@babel/runtime/helpers/createClass":26,"@babel/runtime/helpers/interopRequireDefault":30}],18:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){return n.random("en")};var n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=i(e)&&"function"!=typeof e)return{default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var c=s?Object.getOwnPropertyDescriptor(e,o):null;c&&(c.get||c.set)?Object.defineProperty(n,o,c):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}(e("pokemon"));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}},{"@babel/runtime/helpers/typeof":38,pokemon:255}],19:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.sleep=void 0;var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator"));r.sleep=function(){var e=(0,a.default)(n.default.mark((function e(t){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return setTimeout((function(){return e()}),t)})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],20:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.uuidv4=void 0;r.uuidv4=function(){return"111-111-1111".replace(/[018]/g,(function(){return(15&crypto.getRandomValues(new Uint8Array(1))[0]).toString(16)}))}},{}],21:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ALLOWED_QUALITIES=void 0,r.isValidOutputQualities=function(e){if(!Array.isArray(e))return!1;return e.every((function(e){return i.has(e)}))};var i=r.ALLOWED_QUALITIES=new Set(["240p","360p","480p","720p","1080p","1440p","2160p"])},{}],22:[function(e,t,r){"use strict";var i=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.allowedTypes=void 0,r.verifyFiles=function(e){return l.apply(this,arguments)};var n=i(e("@babel/runtime/regenerator")),a=i(e("@babel/runtime/helpers/asyncToGenerator"));function s(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}var c=new(e("../Logger"))("utils-verifyFiles"),d=r.allowedTypes=["mp4"];function u(e,t){try{return new URL(e).pathname.split(".").pop().toLowerCase()===t.toLowerCase()}catch(e){return!1}}function l(){return(l=(0,a.default)(n.default.mark((function e(t){var r,i,a,o,l;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.info("The input files are:%o, length:%s",t,t.length),!(t.length>0)){e.next=28;break}c.info("Files array length is:%s",t.length),r=s(t),e.prev=4,r.s();case 6:if((i=r.n()).done){e.next=17;break}if(a=i.value,o=a.type,l=a.url,c.info("The file detais are type:%s, url:%s",o,l),d.includes(o)){e.next=12;break}return console.warn('Type "'.concat(o,'" is not allowed.')),e.abrupt("return",{success:!1,reason:'Type "'.concat(o,'" is not allowed.')});case 12:if(u(l,o)){e.next=15;break}return console.warn("Extension mismatch for ".concat(l,"; expected .").concat(o)),e.abrupt("return",{success:!1,reason:"Extension mismatch for ".concat(l,"; expected .").concat(o)});case 15:e.next=6;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(4),r.e(e.t0);case 22:return e.prev=22,r.f(),e.finish(22);case 25:return e.abrupt("return",{success:!0});case 28:return e.abrupt("return",{success:!1,reason:"There are no files for processing!"});case 29:case"end":return e.stop()}}),e,null,[[4,19,22,25]])})))).apply(this,arguments)}},{"../Logger":4,"@babel/runtime/helpers/asyncToGenerator":24,"@babel/runtime/helpers/interopRequireDefault":30,"@babel/runtime/regenerator":39}],23:[function(e,t,r){t.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},t.exports.__esModule=!0,t.exports.default=t.exports},{}],24:[function(e,t,r){function i(e,t,r,i,n,a,s){try{var o=e[a](s),c=o.value}catch(e){return void r(e)}o.done?t(c):Promise.resolve(c).then(i,n)}t.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var s=e.apply(t,r);function o(e){i(s,n,a,o,c,"next",e)}function c(e){i(s,n,a,o,c,"throw",e)}o(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],25:[function(e,t,r){t.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},{}],26:[function(e,t,r){var i=e("./toPropertyKey.js");function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}t.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPropertyKey.js":37}],27:[function(e,t,r){var i=e("./toPropertyKey.js");t.exports=function(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPropertyKey.js":37}],28:[function(e,t,r){function i(e){return t.exports=i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t.exports.__esModule=!0,t.exports.default=t.exports,i(e)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{}],29:[function(e,t,r){var i=e("./setPrototypeOf.js");t.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./setPrototypeOf.js":35}],30:[function(e,t,r){t.exports=function(e){return e&&e.__esModule?e:{default:e}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],31:[function(e,t,r){var i=e("./objectWithoutPropertiesLoose.js");t.exports=function(e,t){if(null==e)return{};var r,n,a=i(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a},t.exports.__esModule=!0,t.exports.default=t.exports},{"./objectWithoutPropertiesLoose.js":32}],32:[function(e,t,r){t.exports=function(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;r[i]=e[i]}return r},t.exports.__esModule=!0,t.exports.default=t.exports},{}],33:[function(e,t,r){var i=e("./typeof.js").default,n=e("./assertThisInitialized.js");t.exports=function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./assertThisInitialized.js":23,"./typeof.js":38}],34:[function(e,t,r){var i=e("./typeof.js").default;function n(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},a=Object.prototype,s=a.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},d=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,r){return e[t]=r}}function f(e,t,r,i){var n=t&&t.prototype instanceof _?t:_,a=Object.create(n.prototype),s=new O(i||[]);return o(a,"_invoke",{value:T(e,r,s)}),a}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=f;var m="suspendedStart",b="suspendedYield",g="executing",v="completed",y={};function _(){}function w(){}function S(){}var k={};h(k,d,(function(){return this}));var R=Object.getPrototypeOf,P=R&&R(R(A([])));P&&P!==a&&s.call(P,d)&&(k=P);var M=S.prototype=_.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,a,o,c){var d=p(e[n],e,a);if("throw"!==d.type){var u=d.arg,l=u.value;return l&&"object"==i(l)&&s.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,c)}),(function(e){r("throw",e,o,c)})):t.resolve(l).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,c)}))}c(d.arg)}var n;o(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(a,a):a()}})}function T(t,r,i){var n=m;return function(a,s){if(n===g)throw Error("Generator is already running");if(n===v){if("throw"===a)throw s;return{value:e,done:!0}}for(i.method=a,i.arg=s;;){var o=i.delegate;if(o){var c=C(o,i);if(c){if(c===y)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===m)throw n=v,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=g;var d=p(t,r,i);if("normal"===d.type){if(n=i.done?v:b,d.arg===y)continue;return{value:d.arg,done:i.done}}"throw"===d.type&&(n=v,i.method="throw",i.arg=d.arg)}}}function C(t,r){var i=r.method,n=t.iterator[i];if(n===e)return r.delegate=null,"throw"===i&&t.iterator.return&&(r.method="return",r.arg=e,C(t,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),y;var a=p(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var s=a.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function A(t){if(t||""===t){var r=t[d];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(s.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(i(t)+" is not iterable")}return w.prototype=S,o(M,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=h(S,l,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,h(e,l,"GeneratorFunction")),e.prototype=Object.create(M),e},r.awrap=function(e){return{__await:e}},E(x.prototype),h(x.prototype,u,(function(){return this})),r.AsyncIterator=x,r.async=function(e,t,i,n,a){void 0===a&&(a=Promise);var s=new x(f(e,t,i,n),a);return r.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},E(M),h(M,l,"Generator"),h(M,d,(function(){return this})),h(M,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var i in t)r.push(i);return r.reverse(),function e(){for(;r.length;){var i=r.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},r.values=A,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var r in this)"t"===r.charAt(0)&&s.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(i,n){return o.type="throw",o.arg=t,r.next=i,n&&(r.method="next",r.arg=e),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),d=s.call(a,"finallyLoc");if(c&&d){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!d)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var n=i;break}}n&&("break"===e||"continue"===e)&&n.tryLoc<=t&&t<=n.finallyLoc&&(n=null);var a=n?n.completion:{};return a.type=e,a.arg=t,n?(this.method="next",this.next=n.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;D(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,r,i){return this.delegate={iterator:A(t),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=e),y}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},{"./typeof.js":38}],35:[function(e,t,r){function i(e,r){return t.exports=i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t.exports.__esModule=!0,t.exports.default=t.exports,i(e,r)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{}],36:[function(e,t,r){var i=e("./typeof.js").default;t.exports=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./typeof.js":38}],37:[function(e,t,r){var i=e("./typeof.js").default,n=e("./toPrimitive.js");t.exports=function(e){var t=n(e,"string");return"symbol"==i(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPrimitive.js":36,"./typeof.js":38}],38:[function(e,t,r){function i(e){return t.exports=i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,i(e)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{}],39:[function(e,t,r){var i=e("../helpers/regeneratorRuntime")();t.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},{"../helpers/regeneratorRuntime":34}],40:[function(e,t,r){function i(e){if(e)return function(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}(e)}r.Emitter=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},i.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n=0;n<i.length;n++)if((r=i[n])===t||r.fn===t){i.splice(n,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},i.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(r){i=0;for(var n=(r=r.slice(0)).length;i<n;++i)r[i].apply(this,t)}return this},i.prototype.emitReserved=i.prototype.emit,i.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},i.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],41:[function(e,t,r){var i=r;i.bignum=e("bn.js"),i.define=e("./asn1/api").define,i.base=e("./asn1/base"),i.constants=e("./asn1/constants"),i.decoders=e("./asn1/decoders"),i.encoders=e("./asn1/encoders")},{"./asn1/api":42,"./asn1/base":44,"./asn1/constants":48,"./asn1/decoders":50,"./asn1/encoders":53,"bn.js":55}],42:[function(e,t,r){var i=e("../asn1"),n=e("inherits");function a(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}r.define=function(e,t){return new a(e,t)},a.prototype._createNamed=function(t){var r;try{r=e("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){r=function(e){this._initNamed(e)}}return n(r,t),r.prototype._initNamed=function(e){t.call(this,e)},new r(this)},a.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i.decoders[e])),this.decoders[e]},a.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},a.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i.encoders[e])),this.encoders[e]},a.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},{"../asn1":41,inherits:174,vm:316}],43:[function(e,t,r){var i=e("inherits"),n=e("../base").Reporter,a=e("buffer").Buffer;function s(e,t){n.call(this,t),a.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function o(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof o||(e=new o(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=a.byteLength(e);else{if(!a.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}i(s,n),r.DecoderBuffer=s,s.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},s.prototype.restore=function(e){var t=new s(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},s.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new s(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},s.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=o,o.prototype.join=function(e,t){return e||(e=new a(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):a.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},{"../base":44,buffer:94,inherits:174}],44:[function(e,t,r){var i=r;i.Reporter=e("./reporter").Reporter,i.DecoderBuffer=e("./buffer").DecoderBuffer,i.EncoderBuffer=e("./buffer").EncoderBuffer,i.Node=e("./node")},{"./buffer":43,"./node":45,"./reporter":46}],45:[function(e,t,r){var i=e("../base").Reporter,n=e("../base").EncoderBuffer,a=e("../base").DecoderBuffer,s=e("minimalistic-assert"),o=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],c=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(o);function d(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=d;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var e=this._baseState,t={};u.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},d.prototype._wrap=function(){var e=this._baseState;c.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},d.prototype._init=function(e){var t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),s.equal(t.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(e){var t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(s(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){d.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),o.forEach((function(e){d.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(r),this}})),d.prototype.use=function(e){s(e);var t=this._baseState;return s(null===t.use),t.use=e,this},d.prototype.optional=function(){return this._baseState.optional=!0,this},d.prototype.def=function(e){var t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},d.prototype.explicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},d.prototype.implicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},d.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},d.prototype.key=function(e){var t=this._baseState;return s(null===t.key),t.key=e,this},d.prototype.any=function(){return this._baseState.any=!0,this},d.prototype.choice=function(e){var t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},d.prototype.contains=function(e){var t=this._baseState;return s(null===t.use),t.contains=e,this},d.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var i,n=r.default,s=!0,o=null;if(null!==r.key&&(o=e.enterKey(r.key)),r.optional){var c=null;if(null!==r.explicit?c=r.explicit:null!==r.implicit?c=r.implicit:null!==r.tag&&(c=r.tag),null!==c||r.any){if(s=this._peekTag(e,c,r.any),e.isError(s))return s}else{var d=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),s=!0}catch(e){s=!1}e.restore(d)}}if(r.obj&&s&&(i=e.enterObject()),s){if(null!==r.explicit){var u=this._decodeTag(e,r.explicit);if(e.isError(u))return u;e=u}var l=e.offset;if(null===r.use&&null===r.choice){if(r.any)d=e.save();var h=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(h))return h;r.any?n=e.raw(d):e=h}if(t&&t.track&&null!==r.tag&&t.track(e.path(),l,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var f=new a(n);n=this._getUse(r.contains,e._reporterState.obj)._decode(f,t)}}return r.obj&&s&&(n=e.leaveObject(i)),null===r.key||null===n&&!0!==s?null!==o&&e.exitKey(o):e.leaveKey(o,r.key,n),n},d.prototype._decodeGeneric=function(e,t,r){var i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},d.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},d.prototype._decodeChoice=function(e,t){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(a){var s=e.save(),o=r.choice[a];try{var c=o._decode(e,t);if(e.isError(c))return!1;i={type:a,value:c},n=!0}catch(t){return e.restore(s),!1}return!0}),this),n?i:e.error("Choice not matched")},d.prototype._createEncoderBuffer=function(e){return new n(e,this.reporter)},d.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i.default||i.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},d.prototype._encodeValue=function(e,t,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new i);var a=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}var s=null,o=!1;if(n.any)a=this._createEncoderBuffer(e);else if(n.choice)a=this._encodeChoice(e,t);else if(n.contains)s=this._getUse(n.contains,r)._encode(e,t),o=!0;else if(n.children)s=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n}),this).filter((function(e){return e})),s=this._createEncoderBuffer(s);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return t.error("Too many args for : "+n.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var c=this.clone();c._baseState.implicit=null,s=this._createEncoderBuffer(e.map((function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)}),c))}else null!==n.use?a=this._getUse(n.use,r)._encode(e,t):(s=this._encodePrimitive(n.tag,e),o=!0);if(!n.any&&null===n.choice){var d=null!==n.implicit?n.implicit:n.tag,u=null===n.implicit?"universal":"context";null===d?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(a=this._encodeComposite(d,o,u,s))}return null!==n.explicit&&(a=this._encodeComposite(n.explicit,!1,"context",a)),a},d.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},d.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},d.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},d.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":44,"minimalistic-assert":239}],46:[function(e,t,r){var i=e("inherits");function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function a(e,t){this.path=e,this.rethrow(t)}r.Reporter=n,n.prototype.isError=function(e){return e instanceof a},n.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},n.prototype.leaveKey=function(e,t,r){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},n.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},n.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof a;if(t=i?e:new a(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},n.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},i(a,Error),a.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,a),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:174}],47:[function(e,t,r){var i=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=i._reverse(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=i._reverse(r.tag)},{"../constants":48}],48:[function(e,t,r){var i=r;i._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var i=e[r];t[i]=r})),t},i.der=e("./der")},{"./der":47}],49:[function(e,t,r){var i=e("inherits"),n=e("../../asn1"),a=n.base,s=n.bignum,o=n.constants.der;function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new d,this.tree._init(e.body)}function d(e){a.Node.call(this,"der",e)}function u(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=o.tagClass[r>>6],n=!(32&r);if(31&~r)r&=31;else{var a=r;for(r=0;!(128&~a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}return{cls:i,primitive:n,tag:r,tagStr:o.tag[r]}}function l(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(!(128&i))return i;var n=127&i;if(n>4)return e.error("length octect is too long");i=0;for(var a=0;a<n;a++){i<<=8;var s=e.readUInt8(r);if(e.isError(s))return s;i|=s}return i}t.exports=c,c.prototype.decode=function(e,t){return e instanceof a.DecoderBuffer||(e=new a.DecoderBuffer(e,t)),this.tree._decode(e,t)},i(d,a.Node),d.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=u(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},d.prototype._decodeTag=function(e,t,r){var i=u(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=l(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var a=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(n=e.offset-a.offset,e.restore(a),e.skip(n,'Failed to match body of: "'+t+'"'))},d.prototype._skipUntilEnd=function(e,t){for(;;){var r=u(e,t);if(e.isError(r))return r;var i,n=l(e,r.primitive,t);if(e.isError(n))return n;if(i=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===r.tagStr)break}},d.prototype._decodeList=function(e,t,r,i){for(var n=[];!e.isEmpty();){var a=this._peekTag(e,"end");if(e.isError(a))return a;var s=r.decode(e,"der",i);if(e.isError(s)&&a)break;n.push(s)}return n},d.prototype._decodeStr=function(e,t){if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}if("bmpstr"===t){var i=e.raw();if(i.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",a=0;a<i.length/2;a++)n+=String.fromCharCode(i.readUInt16BE(2*a));return n}if("numstr"===t){var s=e.raw().toString("ascii");return this._isNumstr(s)?s:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var o=e.raw().toString("ascii");return this._isPrintstr(o)?o:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},d.prototype._decodeObjid=function(e,t,r){for(var i,n=[],a=0;!e.isEmpty();){var s=e.readUInt8();a<<=7,a|=127&s,128&s||(n.push(a),a=0)}128&s&&n.push(a);var o=n[0]/40|0,c=n[0]%40;if(i=r?n:[o,c].concat(n.slice(1)),t){var d=t[i.join(" ")];void 0===d&&(d=t[i.join(".")]),void 0!==d&&(i=d)}return i},d.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var i=0|r.slice(0,4),n=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),o=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),a=0|r.slice(4,6),s=0|r.slice(6,8),o=0|r.slice(8,10),c=0|r.slice(10,12);i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,a,s,o,c,0)},d.prototype._decodeNull=function(e){return null},d.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},d.prototype._decodeInt=function(e,t){var r=e.raw(),i=new s(r);return t&&(i=t[i.toString(10)]||i),i},d.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":41,inherits:174}],50:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":49,"./pem":51}],51:[function(e,t,r){var i=e("inherits"),n=e("buffer").Buffer,a=e("./der");function s(e){a.call(this,e),this.enc="pem"}i(s,a),t.exports=s,s.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,o=-1,c=-1,d=0;d<r.length;d++){var u=r[d].match(s);if(null!==u&&u[2]===i){if(-1!==o){if("END"!==u[1])break;c=d;break}if("BEGIN"!==u[1])break;o=d}}if(-1===o||-1===c)throw new Error("PEM section not found for: "+i);var l=r.slice(o+1,c).join("");l.replace(/[^a-z0-9\+\/=]+/gi,"");var h=new n(l,"base64");return a.prototype.decode.call(this,h,t)}},{"./der":49,buffer:94,inherits:174}],52:[function(e,t,r){var i=e("inherits"),n=e("buffer").Buffer,a=e("../../asn1"),s=a.base,o=a.constants.der;function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new d,this.tree._init(e.body)}function d(e){s.Node.call(this,"der",e)}function u(e){return e<10?"0"+e:e}t.exports=c,c.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(d,s.Node),d.prototype._encodeComposite=function(e,t,r,i){var a,s=function(e,t,r,i){var n;"seqof"===e?e="seq":"setof"===e&&(e="set");if(o.tagByName.hasOwnProperty(e))n=o.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}if(n>=31)return i.error("Multi-octet tag encoding unsupported");t||(n|=32);return n|=o.tagClassByName[r||"universal"]<<6,n}(e,t,r,this.reporter);if(i.length<128)return(a=new n(2))[0]=s,a[1]=i.length,this._createEncoderBuffer([a,i]);for(var c=1,d=i.length;d>=256;d>>=8)c++;(a=new n(2+c))[0]=s,a[1]=128|c;d=1+c;for(var u=i.length;u>0;d--,u>>=8)a[d]=255&u;return this._createEncoderBuffer([a,i])},d.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new n(2*e.length),i=0;i<e.length;i++)r.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},d.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var a=0;for(i=0;i<e.length;i++){var s=e[i];for(a++;s>=128;s>>=7)a++}var o=new n(a),c=o.length-1;for(i=e.length-1;i>=0;i--){s=e[i];for(o[c--]=127&s;(s>>=7)>0;)o[c--]=128|127&s}return this._createEncoderBuffer(o)},d.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},d.prototype._encodeNull=function(){return this._createEncoderBuffer("")},d.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new n(r)}if(n.isBuffer(e)){var i=e.length;0===e.length&&i++;var a=new n(i);return e.copy(a),0===e.length&&(a[0]=0),this._createEncoderBuffer(a)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);i=1;for(var s=e;s>=256;s>>=8)i++;for(s=(a=new Array(i)).length-1;s>=0;s--)a[s]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new n(a))},d.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},d.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},d.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n.default)return!1;var a=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),a.length!==n.defaultBuffer.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==n.defaultBuffer[i])return!1;return!0}},{"../../asn1":41,buffer:94,inherits:174}],53:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":52,"./pem":54}],54:[function(e,t,r){var i=e("inherits"),n=e("./der");function a(e){n.call(this,e),this.enc="pem"}i(a,n),t.exports=a,a.prototype.encode=function(e,t){for(var r=n.prototype.encode.call(this,e).toString("base64"),i=["-----BEGIN "+t.label+"-----"],a=0;a<r.length;a+=64)i.push(r.slice(a,a+64));return i.push("-----END "+t.label+"-----"),i.join("\n")}},{"./der":52,inherits:174}],55:[function(e,t,r){!function(t,r){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var s;"object"==typeof t?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function d(e,t,r,i){for(var n=0,a=Math.min(e.length,r),s=t;s<a;s++){var o=e.charCodeAt(s)-48;n*=i,n+=o>=49?o-49+10:o>=17?o-17+10:o}return n}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,s,o=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)s=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)s=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,s=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,s=a%i,o=Math.min(a,a-s)+r,c=0,u=r;u<o;u+=i)c=d(e,u,u+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var l=1;for(c=d(e,u,e.length,t),u=0;u<s;u++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],s=n*a,o=67108863&s,c=s/67108864|0;r.words[0]=o;for(var d=1;d<i;d++){for(var u=c>>>26,l=67108863&c,h=Math.min(d,t.length-1),f=Math.max(0,d-e.length+1);f<=h;f++){var p=d-f|0;u+=(s=(n=0|e.words[p])*(a=0|t.words[f])+l)/67108864|0,l=67108863&s}r.words[d]=0|l,c=0|u}return 0!==c?r.words[d]=0|c:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,s=0;s<this.length;s++){var o=this.words[s],c=(16777215&(o<<n|a)).toString(16);r=0!==(a=o>>>24-n&16777215)||s!==this.length-1?u[6-c.length]+c+r:c+r,(n+=2)>=26&&(n-=26,s--)}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:u[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return i(void 0!==s),this.toArrayLike(s,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var s,o,c="le"===t,d=new e(a),u=this.clone();if(c){for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),d[o]=s;for(;o<a;o++)d[o]=0}else{for(o=0;o<a-n;o++)d[o]=0;for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),d[a-o-1]=s}return d},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},a.prototype.ior=function(e){return i(!(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return i(!(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return i(!(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},a.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,s=0;s<i.length;s++)a=(t=(0|r.words[s])-(0|i.words[s])+a)>>26,this.words[s]=67108863&t;for(;0!==a&&s<r.length;s++)a=(t=(0|r.words[s])+a)>>26,this.words[s]=67108863&t;if(0===a&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var i,n,a,s=e.words,o=t.words,c=r.words,d=0,u=0|s[0],l=8191&u,h=u>>>13,f=0|s[1],p=8191&f,m=f>>>13,b=0|s[2],g=8191&b,v=b>>>13,y=0|s[3],_=8191&y,w=y>>>13,S=0|s[4],k=8191&S,R=S>>>13,P=0|s[5],M=8191&P,E=P>>>13,x=0|s[6],T=8191&x,C=x>>>13,I=0|s[7],D=8191&I,O=I>>>13,A=0|s[8],L=8191&A,j=A>>>13,B=0|s[9],N=8191&B,F=B>>>13,U=0|o[0],q=8191&U,z=U>>>13,V=0|o[1],G=8191&V,W=V>>>13,H=0|o[2],K=8191&H,$=H>>>13,J=0|o[3],Y=8191&J,X=J>>>13,Z=0|o[4],Q=8191&Z,ee=Z>>>13,te=0|o[5],re=8191&te,ie=te>>>13,ne=0|o[6],ae=8191&ne,se=ne>>>13,oe=0|o[7],ce=8191&oe,de=oe>>>13,ue=0|o[8],le=8191&ue,he=ue>>>13,fe=0|o[9],pe=8191&fe,me=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(d+(i=Math.imul(l,q))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(h,q)|0))<<13)|0;d=((a=Math.imul(h,z))+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(p,q),n=(n=Math.imul(p,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ge=(d+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(h,G)|0))<<13)|0;d=((a=a+Math.imul(h,W)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(g,q),n=(n=Math.imul(g,z))+Math.imul(v,q)|0,a=Math.imul(v,z),i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var ve=(d+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,$)|0)+Math.imul(h,K)|0))<<13)|0;d=((a=a+Math.imul(h,$)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(_,q),n=(n=Math.imul(_,z))+Math.imul(w,q)|0,a=Math.imul(w,z),i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(v,G)|0,a=a+Math.imul(v,W)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,$)|0;var ye=(d+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(h,Y)|0))<<13)|0;d=((a=a+Math.imul(h,X)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(k,q),n=(n=Math.imul(k,z))+Math.imul(R,q)|0,a=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(w,G)|0,a=a+Math.imul(w,W)|0,i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,$)|0)+Math.imul(v,K)|0,a=a+Math.imul(v,$)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Y)|0,a=a+Math.imul(m,X)|0;var _e=(d+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;d=((a=a+Math.imul(h,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(M,q),n=(n=Math.imul(M,z))+Math.imul(E,q)|0,a=Math.imul(E,z),i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,$)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,$)|0,i=i+Math.imul(g,Y)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(v,Y)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,ee)|0;var we=(d+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(h,re)|0))<<13)|0;d=((a=a+Math.imul(h,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(T,q),n=(n=Math.imul(T,z))+Math.imul(C,q)|0,a=Math.imul(C,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(E,G)|0,a=a+Math.imul(E,W)|0,i=i+Math.imul(k,K)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,$)|0,i=i+Math.imul(_,Y)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Y)|0,a=a+Math.imul(w,X)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0;var Se=(d+(i=i+Math.imul(l,ae)|0)|0)+((8191&(n=(n=n+Math.imul(l,se)|0)+Math.imul(h,ae)|0))<<13)|0;d=((a=a+Math.imul(h,se)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(D,q),n=(n=Math.imul(D,z))+Math.imul(O,q)|0,a=Math.imul(O,z),i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(C,G)|0,a=a+Math.imul(C,W)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(E,K)|0,a=a+Math.imul(E,$)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,ee)|0,i=i+Math.imul(g,re)|0,n=(n=n+Math.imul(g,ie)|0)+Math.imul(v,re)|0,a=a+Math.imul(v,ie)|0,i=i+Math.imul(p,ae)|0,n=(n=n+Math.imul(p,se)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,se)|0;var ke=(d+(i=i+Math.imul(l,ce)|0)|0)+((8191&(n=(n=n+Math.imul(l,de)|0)+Math.imul(h,ce)|0))<<13)|0;d=((a=a+Math.imul(h,de)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(L,q),n=(n=Math.imul(L,z))+Math.imul(j,q)|0,a=Math.imul(j,z),i=i+Math.imul(D,G)|0,n=(n=n+Math.imul(D,W)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,W)|0,i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,$)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,$)|0,i=i+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(E,Y)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ie)|0,i=i+Math.imul(g,ae)|0,n=(n=n+Math.imul(g,se)|0)+Math.imul(v,ae)|0,a=a+Math.imul(v,se)|0,i=i+Math.imul(p,ce)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,de)|0;var Re=(d+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;d=((a=a+Math.imul(h,he)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(N,q),n=(n=Math.imul(N,z))+Math.imul(F,q)|0,a=Math.imul(F,z),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,$)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,$)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(_,ae)|0,n=(n=n+Math.imul(_,se)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,se)|0,i=i+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,de)|0)+Math.imul(v,ce)|0,a=a+Math.imul(v,de)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,he)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,he)|0;var Pe=(d+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,me)|0)+Math.imul(h,pe)|0))<<13)|0;d=((a=a+Math.imul(h,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,W))+Math.imul(F,G)|0,a=Math.imul(F,W),i=i+Math.imul(L,K)|0,n=(n=n+Math.imul(L,$)|0)+Math.imul(j,K)|0,a=a+Math.imul(j,$)|0,i=i+Math.imul(D,Y)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,X)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(M,re)|0,n=(n=n+Math.imul(M,ie)|0)+Math.imul(E,re)|0,a=a+Math.imul(E,ie)|0,i=i+Math.imul(k,ae)|0,n=(n=n+Math.imul(k,se)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,se)|0,i=i+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(w,ce)|0,a=a+Math.imul(w,de)|0,i=i+Math.imul(g,le)|0,n=(n=n+Math.imul(g,he)|0)+Math.imul(v,le)|0,a=a+Math.imul(v,he)|0;var Me=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;d=((a=a+Math.imul(m,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,$))+Math.imul(F,K)|0,a=Math.imul(F,$),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(j,Y)|0,a=a+Math.imul(j,X)|0,i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(M,ae)|0,n=(n=n+Math.imul(M,se)|0)+Math.imul(E,ae)|0,a=a+Math.imul(E,se)|0,i=i+Math.imul(k,ce)|0,n=(n=n+Math.imul(k,de)|0)+Math.imul(R,ce)|0,a=a+Math.imul(R,de)|0,i=i+Math.imul(_,le)|0,n=(n=n+Math.imul(_,he)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,he)|0;var Ee=(d+(i=i+Math.imul(g,pe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(v,pe)|0))<<13)|0;d=((a=a+Math.imul(v,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,X))+Math.imul(F,Y)|0,a=Math.imul(F,X),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,ee)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,ee)|0,i=i+Math.imul(D,re)|0,n=(n=n+Math.imul(D,ie)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ie)|0,i=i+Math.imul(T,ae)|0,n=(n=n+Math.imul(T,se)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,se)|0,i=i+Math.imul(M,ce)|0,n=(n=n+Math.imul(M,de)|0)+Math.imul(E,ce)|0,a=a+Math.imul(E,de)|0,i=i+Math.imul(k,le)|0,n=(n=n+Math.imul(k,he)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,he)|0;var xe=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;d=((a=a+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,ee))+Math.imul(F,Q)|0,a=Math.imul(F,ee),i=i+Math.imul(L,re)|0,n=(n=n+Math.imul(L,ie)|0)+Math.imul(j,re)|0,a=a+Math.imul(j,ie)|0,i=i+Math.imul(D,ae)|0,n=(n=n+Math.imul(D,se)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,se)|0,i=i+Math.imul(T,ce)|0,n=(n=n+Math.imul(T,de)|0)+Math.imul(C,ce)|0,a=a+Math.imul(C,de)|0,i=i+Math.imul(M,le)|0,n=(n=n+Math.imul(M,he)|0)+Math.imul(E,le)|0,a=a+Math.imul(E,he)|0;var Te=(d+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(R,pe)|0))<<13)|0;d=((a=a+Math.imul(R,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(N,re),n=(n=Math.imul(N,ie))+Math.imul(F,re)|0,a=Math.imul(F,ie),i=i+Math.imul(L,ae)|0,n=(n=n+Math.imul(L,se)|0)+Math.imul(j,ae)|0,a=a+Math.imul(j,se)|0,i=i+Math.imul(D,ce)|0,n=(n=n+Math.imul(D,de)|0)+Math.imul(O,ce)|0,a=a+Math.imul(O,de)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,he)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,he)|0;var Ce=(d+(i=i+Math.imul(M,pe)|0)|0)+((8191&(n=(n=n+Math.imul(M,me)|0)+Math.imul(E,pe)|0))<<13)|0;d=((a=a+Math.imul(E,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(N,ae),n=(n=Math.imul(N,se))+Math.imul(F,ae)|0,a=Math.imul(F,se),i=i+Math.imul(L,ce)|0,n=(n=n+Math.imul(L,de)|0)+Math.imul(j,ce)|0,a=a+Math.imul(j,de)|0,i=i+Math.imul(D,le)|0,n=(n=n+Math.imul(D,he)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,he)|0;var Ie=(d+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,me)|0)+Math.imul(C,pe)|0))<<13)|0;d=((a=a+Math.imul(C,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(N,ce),n=(n=Math.imul(N,de))+Math.imul(F,ce)|0,a=Math.imul(F,de),i=i+Math.imul(L,le)|0,n=(n=n+Math.imul(L,he)|0)+Math.imul(j,le)|0,a=a+Math.imul(j,he)|0;var De=(d+(i=i+Math.imul(D,pe)|0)|0)+((8191&(n=(n=n+Math.imul(D,me)|0)+Math.imul(O,pe)|0))<<13)|0;d=((a=a+Math.imul(O,me)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863,i=Math.imul(N,le),n=(n=Math.imul(N,he))+Math.imul(F,le)|0,a=Math.imul(F,he);var Oe=(d+(i=i+Math.imul(L,pe)|0)|0)+((8191&(n=(n=n+Math.imul(L,me)|0)+Math.imul(j,pe)|0))<<13)|0;d=((a=a+Math.imul(j,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Ae=(d+(i=Math.imul(N,pe))|0)+((8191&(n=(n=Math.imul(N,me))+Math.imul(F,pe)|0))<<13)|0;return d=((a=Math.imul(F,me))+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c[0]=be,c[1]=ge,c[2]=ve,c[3]=ye,c[4]=_e,c[5]=we,c[6]=Se,c[7]=ke,c[8]=Re,c[9]=Pe,c[10]=Me,c[11]=Ee,c[12]=xe,c[13]=Te,c[14]=Ce,c[15]=Ie,c[16]=De,c[17]=Oe,c[18]=Ae,0!==d&&(c[19]=d,r.length++),r};function m(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(p=f),a.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):i<63?f(this,e,t):i<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var s=n;n=0;for(var o=67108863&i,c=Math.min(a,t.length-1),d=Math.max(0,a-e.length+1);d<=c;d++){var u=a-d,l=(0|e.words[u])*(0|t.words[d]),h=67108863&l;o=67108863&(h=h+o|0),n+=(s=(s=s+(l/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[a]=o,i=s,s=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,e,t):m(this,e,t),r},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},b.prototype.permute=function(e,t,r,i,n,a){for(var s=0;s<a;s++)i[s]=t[e[s]],n[s]=r[e[s]]},b.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var s=1;s<n;s<<=1)for(var o=s<<1,c=Math.cos(2*Math.PI/o),d=Math.sin(2*Math.PI/o),u=0;u<n;u+=o)for(var l=c,h=d,f=0;f<s;f++){var p=r[u+f],m=i[u+f],b=r[u+f+s],g=i[u+f+s],v=l*b-h*g;g=l*g+h*b,b=v,r[u+f]=p+b,i[u+f]=m+g,r[u+f+s]=p-b,i[u+f+s]=m-g,f!==o&&(v=c*l-d*h,h=c*h+d*l,l=v)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},b.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},b.prototype.convert13b=function(e,t,r,n){for(var a=0,s=0;s<t;s++)a+=0|e[s],r[2*s]=8191&a,a>>>=13,r[2*s+1]=8191&a,a>>>=13;for(s=2*t;s<n;++s)r[s]=0;i(0===a),i(!(-8192&a))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),s=new Array(i),o=new Array(i),c=new Array(i),d=new Array(i),u=new Array(i),l=new Array(i),h=r.words;h.length=i,this.convert13b(e.words,e.length,s,i),this.convert13b(t.words,t.length,d,i),this.transform(s,a,o,c,i,n),this.transform(d,a,u,l,i,n);for(var f=0;f<i;f++){var p=o[f]*u[f]-c[f]*l[f];c[f]=o[f]*l[f]+c[f]*u[f],o[f]=p}return this.conjugate(o,c,i),this.transform(o,c,h,a,i,n),this.conjugate(h,a,i),this.normalize13b(h,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),m(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){i("number"==typeof e),i(e<67108864);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,a=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new a(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},a.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t<this.length;t++){var o=this.words[t]&a,c=(0|this.words[t])-o<<r;this.words[t]=c|s,s=o>>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},a.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,s=Math.min((e-a)/26,this.length),o=67108863^67108863>>>a<<a,c=r;if(n-=s,n=Math.max(0,n),c){for(var d=0;d<s;d++)c.words[d]=this.words[d];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,d=0;d<this.length;d++)this.words[d]=this.words[d+s];else this.words[0]=0,this.length=1;var u=0;for(d=this.length-1;d>=0&&(0!==u||d>=n);d--){var l=0|this.words[d];this.words[d]=u<<26-a|l>>>a,u=l&o}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},a.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var n,a,s=e.length+r;this._expand(s);var o=0;for(n=0;n<e.length;n++){a=(0|this.words[n+r])+o;var c=(0|e.words[n])*t;o=((a-=67108863&c)>>26)-(c/67108864|0),this.words[n+r]=67108863&a}for(;n<this.length-r;n++)o=(a=(0|this.words[n+r])+o)>>26,this.words[n+r]=67108863&a;if(0===o)return this.strip();for(i(-1===o),o=0,n=0;n<this.length;n++)o=(a=-(0|this.words[n])+o)>>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var o,c=i.length-n.length;if("mod"!==t){(o=new a(null)).length=c+1,o.words=new Array(o.length);for(var d=0;d<o.length;d++)o.words[d]=0}var u=i.clone()._ishlnsubmul(n,1,c);0===u.negative&&(i=u,o&&(o.words[c]=1));for(var l=c-1;l>=0;l--){var h=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(h=Math.min(h/s|0,67108863),i._ishlnsubmul(n,h,l);0!==i.negative;)h--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);o&&(o.words[l]=h)}return o&&o.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:o||null,mod:i}},a.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(n=o.div.neg()),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:n,mod:s}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(n=o.div.neg()),{div:n,mod:o.mod}):this.negative&e.negative?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:o.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,s,o},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modn=function(e){i(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},a.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new a(1),s=new a(0),o=new a(0),c=new a(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var u=r.clone(),l=t.clone();!t.isZero();){for(var h=0,f=1;!(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(u),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(u),c.isub(l)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o),s.isub(c)):(r.isub(t),o.isub(n),c.isub(s))}return{a:o,b:c,gcd:r.iushln(d)}},a.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,s=new a(1),o=new a(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,u=1;!(t.words[0]&u)&&d<26;++d,u<<=1);if(d>0)for(t.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var l=0,h=1;!(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(o)):(r.isub(t),o.isub(s))}return(n=0===t.cmpn(1)?s:o).cmpn(0)<0&&n.iadd(e),n},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return!(1&this.words[0])},a.prototype.isOdd=function(){return!(1&~this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var a=n,s=r;0!==a&&s<this.length;s++){var o=0|this.words[s];a=(o+=a)>>>26,o&=67108863,this.words[s]=o}return 0!==a&&(this.words[s]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new k(e)},a.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function R(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(y,v),y.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,n=10;n<e.length;n++){var s=0|e.words[n];e.words[n-10]=(s&r)<<4|a>>>22,a=s}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(w,v),n(S,v),S.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new _;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return g[e]=t,t},k.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){i(!(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var o=new a(1).toRed(this),c=o.redNeg(),d=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,d).cmp(c);)u.redIAdd(c);for(var l=this.pow(u,n),h=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=s;0!==f.cmp(o);){for(var m=f,b=0;0!==m.cmp(o);b++)m=m.redSqr();i(b<p);var g=this.pow(l,new a(1).iushln(p-b-1));h=h.redMul(g),l=g.redSqr(),f=f.redMul(l),p=b}return h},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],s=0,o=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],u=c-1;u>=0;u--){var l=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++o||0===i&&0===u)&&(n=this.mul(n,r[s]),o=0,s=0)):o=0}c=26}return n},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new R(e)},n(R,k),R.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},R.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},R.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},R.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},R.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:63}],56:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Logger=void 0;const i=e("debug"),n="awaitqueue";r.Logger=class{constructor(e){e?(this._debug=(0,i.default)(`${n}:${e}`),this._warn=(0,i.default)(`${n}:WARN:${e}`),this._error=(0,i.default)(`${n}:ERROR:${e}`)):(this._debug=(0,i.default)(n),this._warn=(0,i.default)(`${n}:WARN`),this._error=(0,i.default)(`${n}:ERROR`)),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}}},{debug:104}],57:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AwaitQueue=r.AwaitQueueRemovedTaskError=r.AwaitQueueStoppedError=void 0;const i=new(e("./Logger").Logger);class n extends Error{constructor(e){super(e??"AwaitQueue stopped"),this.name="AwaitQueueStoppedError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,n)}}r.AwaitQueueStoppedError=n;class a extends Error{constructor(e){super(e??"AwaitQueue task removed"),this.name="AwaitQueueRemovedTaskError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,a)}}r.AwaitQueueRemovedTaskError=a;r.AwaitQueue=class{constructor(){this.pendingTasks=new Map,this.nextTaskId=0,this.stopping=!1}get size(){return this.pendingTasks.size}async push(e,t){if(t=t??e.name,i.debug(`push() [name:${t}]`),"function"!=typeof e)throw new TypeError("given task is not a function");if(t)try{Object.defineProperty(e,"name",{value:t})}catch(e){}return new Promise(((r,n)=>{const a={id:this.nextTaskId++,task:e,name:t,enqueuedAt:Date.now(),executedAt:void 0,completed:!1,resolve:e=>{if(a.completed)return;a.completed=!0,this.pendingTasks.delete(a.id),i.debug(`resolving task [name:${a.name}]`),r(e);const[t]=this.pendingTasks.values();t&&!t.executedAt&&this.execute(t)},reject:e=>{if(!a.completed&&(a.completed=!0,this.pendingTasks.delete(a.id),i.debug(`rejecting task [name:${a.name}]: %s`,String(e)),n(e),!this.stopping)){const[e]=this.pendingTasks.values();e&&!e.executedAt&&this.execute(e)}}};this.pendingTasks.set(a.id,a),1===this.pendingTasks.size&&this.execute(a)}))}stop(){i.debug("stop()"),this.stopping=!0;for(const e of this.pendingTasks.values())i.debug(`stop() | stopping task [name:${e.name}]`),e.reject(new n);this.stopping=!1}remove(e){i.debug(`remove() [taskIdx:${e}]`);const t=Array.from(this.pendingTasks.values())[e];t?t.reject(new a):i.debug(`stop() | no task with given idx [taskIdx:${e}]`)}dump(){const e=Date.now();let t=0;return Array.from(this.pendingTasks.values()).map((r=>({idx:t++,task:r.task,name:r.name,enqueuedTime:r.executedAt?r.executedAt-r.enqueuedAt:e-r.enqueuedAt,executionTime:r.executedAt?e-r.executedAt:0})))}async execute(e){if(i.debug(`execute() [name:${e.name}]`),e.executedAt)throw new Error("task already being executed");e.executedAt=Date.now();try{const t=await e.task();e.resolve(t)}catch(t){e.reject(t)}}}},{"./Logger":56}],58:[function(e,t,r){(function(e,r){(function(){"use strict";function i(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:a}=Object,s=(o=Object.create(null),e=>{const t=n.call(e);return o[t]||(o[t]=t.slice(8,-1).toLowerCase())});var o;const c=e=>(e=e.toLowerCase(),t=>s(t)===e),d=e=>t=>typeof t===e,{isArray:u}=Array,l=d("undefined");const h=c("ArrayBuffer");const f=d("string"),p=d("function"),m=d("number"),b=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=a(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},v=c("Date"),y=c("File"),_=c("Blob"),w=c("FileList"),S=c("URLSearchParams");function k(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),u(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{const n=r?Object.getOwnPropertyNames(e):Object.keys(e),a=n.length;let s;for(i=0;i<a;i++)s=n[i],t.call(null,e[s],s,e)}}function R(e,t){t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:e,M=e=>!l(e)&&e!==P;const E=(x="undefined"!=typeof Uint8Array&&a(Uint8Array),e=>x&&e instanceof x);var x;const T=c("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),I=c("RegExp"),D=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};k(r,((r,n)=>{let a;!1!==(a=t(r,n,e))&&(i[n]=a||r)})),Object.defineProperties(e,i)},O="abcdefghijklmnopqrstuvwxyz",A="0123456789",L={DIGIT:A,ALPHA:O,ALPHA_DIGIT:O+O.toUpperCase()+A};const j=c("AsyncFunction");var B={isArray:u,isArrayBuffer:h,isBuffer:function(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||p(e.append)&&("formdata"===(t=s(e))||"object"===t&&p(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:f,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:b,isPlainObject:g,isUndefined:l,isDate:v,isFile:y,isBlob:_,isRegExp:I,isFunction:p,isStream:e=>b(e)&&p(e.pipe),isURLSearchParams:S,isTypedArray:E,isFileList:w,forEach:k,merge:function e(){const{caseless:t}=M(this)&&this||{},r={},i=(i,n)=>{const a=t&&R(r,n)||n;g(r[a])&&g(i)?r[a]=e(r[a],i):g(i)?r[a]=e({},i):u(i)?r[a]=i.slice():r[a]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&k(arguments[e],i);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(k(t,((t,n)=>{r&&p(t)?e[n]=i(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,s,o;const c={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),s=n.length;s-- >0;)o=n[s],i&&!i(o,e,t)||c[o]||(t[o]=e[o],c[o]=!0);e=!1!==r&&a(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:c,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return-1!==i&&i===r},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!m(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=r.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const i=[];for(;null!==(r=e.exec(t));)i.push(r);return i},isHTMLForm:T,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:D,freezeMethods:e=>{D(e,((t,r)=>{if(p(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];p(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach((e=>{r[e]=!0}))};return u(e)?i(e):i(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:R,global:P,isContextDefined:M,ALPHABET:L,generateString:(e=16,t=L.ALPHA_DIGIT)=>{let r="";const{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r},isSpecCompliantForm:function(e){return!!(e&&p(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(b(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=u(e)?[]:{};return k(e,((e,t)=>{const a=r(e,i+1);!l(a)&&(n[t]=a)})),t[i]=void 0,n}}return e};return r(e,0)},isAsyncFn:j,isThenable:e=>e&&(b(e)||p(e))&&p(e.then)&&p(e.catch)};function N(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}B.inherits(N,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const F=N.prototype,U={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{U[e]={value:e}})),Object.defineProperties(N,U),Object.defineProperty(F,"isAxiosError",{value:!0}),N.from=(e,t,r,i,n,a)=>{const s=Object.create(F);return B.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),N.call(s,e.message,t,r,i,n),s.cause=e,s.name=e.name,a&&Object.assign(s,a),s};function q(e){return B.isPlainObject(e)||B.isArray(e)}function z(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function V(e,t,r){return e?e.concat(t).map((function(e,t){return e=z(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const G=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)}));function W(e,t,i){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(i=B.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,a=i.visitor||u,s=i.dots,o=i.indexes,c=(i.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(a))throw new TypeError("visitor must be a function");function d(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!c&&B.isBlob(e))throw new N("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?c&&"function"==typeof Blob?new Blob([e]):r.from(e):e}function u(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(B.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(q)}(e)||(B.isFileList(e)||B.endsWith(r,"[]"))&&(a=B.toArray(e)))return r=z(r),a.forEach((function(e,i){!B.isUndefined(e)&&null!==e&&t.append(!0===o?V([r],i,s):null===o?r:r+"[]",d(e))})),!1;return!!q(e)||(t.append(V(i,r,s),d(e)),!1)}const l=[],h=Object.assign(G,{defaultVisitor:u,convertValue:d,isVisitable:q});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!B.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+i.join("."));l.push(r),B.forEach(r,(function(r,n){!0===(!(B.isUndefined(r)||null===r)&&a.call(t,r,B.isString(n)?n.trim():n,i,h))&&e(r,i?i.concat(n):[n])})),l.pop()}}(e),t}function H(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function K(e,t){this._pairs=[],e&&W(e,this,t)}const $=K.prototype;function J(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Y(e,t,r){if(!t)return e;const i=r&&r.encode||J,n=r&&r.serialize;let a;if(a=n?n(t,r):B.isURLSearchParams(t)?t.toString():new K(t,r).toString(i),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,H)}:H;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var X=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Q={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:K,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function ee(e){function t(e,r,i,n){let a=e[n++];const s=Number.isFinite(+a),o=n>=e.length;if(a=!a&&B.isArray(i)?i.length:a,o)return B.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!s;i[a]&&B.isObject(i[a])||(i[a]=[]);return t(e,r,i[a],n)&&B.isArray(i[a])&&(i[a]=function(e){const t={},r=Object.keys(e);let i;const n=r.length;let a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}(i[a])),!s}if(B.isFormData(e)&&B.isFunction(e.entries)){const r={};return B.forEachEntry(e,((e,i)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const te={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=B.isObject(e);n&&B.isHTMLForm(e)&&(e=new FormData(e));if(B.isFormData(e))return i&&i?JSON.stringify(ee(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return W(e,new Q.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,i){return Q.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=B.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return W(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),function(e,t,r){if(B.isString(e))try{return(t||JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&B.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw N.from(e,N.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Q.classes.FormData,Blob:Q.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],(e=>{te.headers[e]={}}));var re=te;const ie=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ne=Symbol("internals");function ae(e){return e&&String(e).trim().toLowerCase()}function se(e){return!1===e||null==e?e:B.isArray(e)?e.map(se):String(e)}function oe(e,t,r,i,n){return B.isFunction(i)?i.call(this,t,r):(n&&(t=r),B.isString(t)?B.isString(i)?-1!==t.indexOf(i):B.isRegExp(i)?i.test(t):void 0:void 0)}class ce{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function n(e,t,r){const n=ae(t);if(!n)throw new Error("header name must be a non-empty string");const a=B.findKey(i,n);(!a||void 0===i[a]||!0===r||void 0===r&&!1!==i[a])&&(i[a||t]=se(e))}const a=(e,t)=>B.forEach(e,((e,r)=>n(e,r,t)));return B.isPlainObject(e)||e instanceof this.constructor?a(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,i,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),r=e.substring(0,n).trim().toLowerCase(),i=e.substring(n+1).trim(),!r||t[r]&&ie[r]||("set-cookie"===r?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)})),t})(e),t):null!=e&&n(t,e,r),this}get(e,t){if(e=ae(e)){const r=B.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}(e);if(B.isFunction(t))return t.call(this,e,r);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ae(e)){const r=B.findKey(this,e);return!(!r||void 0===this[r]||t&&!oe(0,this[r],r,t))}return!1}delete(e,t){const r=this;let i=!1;function n(e){if(e=ae(e)){const n=B.findKey(r,e);!n||t&&!oe(0,r[n],n,t)||(delete r[n],i=!0)}}return B.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const n=t[r];e&&!oe(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,r={};return B.forEach(this,((i,n)=>{const a=B.findKey(r,n);if(a)return t[a]=se(i),void delete t[n];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(n):String(n).trim();s!==n&&delete t[n],t[s]=se(i),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&B.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[ne]=this[ne]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=ae(e);t[i]||(!function(e,t){const r=B.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+r,{value:function(e,r,n){return this[i].call(this,t,e,r,n)},configurable:!0})}))}(r,e),t[i]=!0)}return B.isArray(e)?e.forEach(i):i(e),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.reduceDescriptors(ce.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),B.freezeMethods(ce);var de=ce;function ue(e,t){const r=this||re,i=t||r,n=de.from(i.headers);let a=i.data;return B.forEach(e,(function(e){a=e.call(r,a,n.normalize(),t?t.status:void 0)})),n.normalize(),a}function le(e){return!(!e||!e.__CANCEL__)}function he(e,t,r){N.call(this,null==e?"canceled":e,N.ERR_CANCELED,t,r),this.name="CanceledError"}B.inherits(he,N,{__CANCEL__:!0});var fe=Q.isStandardBrowserEnv?{write:function(e,t,r,i,n,a){const s=[];s.push(e+"="+encodeURIComponent(t)),B.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),B.isString(i)&&s.push("path="+i),B.isString(n)&&s.push("domain="+n),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function pe(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var me=Q.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function i(r){let i=r;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(e){const t=B.isString(e)?i(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function be(e,t){let r=0;const i=function(e,t){e=e||10;const r=new Array(e),i=new Array(e);let n,a=0,s=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),d=i[s];n||(n=c),r[a]=o,i[a]=c;let u=s,l=0;for(;u!==a;)l+=r[u++],u%=e;if(a=(a+1)%e,a===s&&(s=(s+1)%e),c-n<t)return;const h=d&&c-d;return h?Math.round(1e3*l/h):void 0}}(50,250);return n=>{const a=n.loaded,s=n.lengthComputable?n.total:void 0,o=a-r,c=i(o);r=a;const d={loaded:a,total:s,progress:s?a/s:void 0,bytes:o,rate:c||void 0,estimated:c&&s&&a<=s?(s-a)/c:void 0,event:n};d[t?"download":"upload"]=!0,e(d)}}const ge={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let i=e.data;const n=de.from(e.headers).normalize(),a=e.responseType;let s,o;function c(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}B.isFormData(i)&&(Q.isStandardBrowserEnv||Q.isStandardBrowserWebWorkerEnv?n.setContentType(!1):n.getContentType(/^\s*multipart\/form-data/)?B.isString(o=n.getContentType())&&n.setContentType(o.replace(/^\s*(multipart\/form-data);+/,"$1")):n.setContentType("multipart/form-data"));let d=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(t+":"+r))}const u=pe(e.baseURL,e.url);function l(){if(!d)return;const i=de.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());!function(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new N("Request failed with status code "+r.status,[N.ERR_BAD_REQUEST,N.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),c()}),(function(e){r(e),c()}),{data:a&&"text"!==a&&"json"!==a?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:i,config:e,request:d}),d=null}if(d.open(e.method.toUpperCase(),Y(u,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,"onloadend"in d?d.onloadend=l:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(l)},d.onabort=function(){d&&(r(new N("Request aborted",N.ECONNABORTED,e,d)),d=null)},d.onerror=function(){r(new N("Network Error",N.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new N(t,i.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,e,d)),d=null},Q.isStandardBrowserEnv){const t=me(u)&&e.xsrfCookieName&&fe.read(e.xsrfCookieName);t&&n.set(e.xsrfHeaderName,t)}void 0===i&&n.setContentType(null),"setRequestHeader"in d&&B.forEach(n.toJSON(),(function(e,t){d.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),a&&"json"!==a&&(d.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",be(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",be(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{d&&(r(!t||t.type?new he(null,e,d):t),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const h=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);h&&-1===Q.protocols.indexOf(h)?r(new N("Unsupported protocol "+h+":",N.ERR_BAD_REQUEST,e)):d.send(i||null)}))}};B.forEach(ge,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ve=e=>`- ${e}`,ye=e=>B.isFunction(e)||null===e||!1===e;var _e=e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let r,i;const n={};for(let a=0;a<t;a++){let t;if(r=e[a],i=r,!ye(r)&&(i=ge[(t=String(r)).toLowerCase()],void 0===i))throw new N(`Unknown adapter '${t}'`);if(i)break;n[t||"#"+a]=i}if(!i){const e=Object.entries(n).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new N("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(ve).join("\n"):" "+ve(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function we(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new he(null,e)}function Se(e){we(e),e.headers=de.from(e.headers),e.data=ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _e(e.adapter||re.adapter)(e).then((function(t){return we(e),t.data=ue.call(e,e.transformResponse,t),t.headers=de.from(t.headers),t}),(function(t){return le(t)||(we(e),t&&t.response&&(t.response.data=ue.call(e,e.transformResponse,t.response),t.response.headers=de.from(t.response.headers))),Promise.reject(t)}))}const ke=e=>e instanceof de?e.toJSON():e;function Re(e,t){t=t||{};const r={};function i(e,t,r){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:r},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function n(e,t,r){return B.isUndefined(t)?B.isUndefined(e)?void 0:i(void 0,e,r):i(e,t,r)}function a(e,t){if(!B.isUndefined(t))return i(void 0,t)}function s(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function o(r,n,a){return a in t?i(r,n):a in e?i(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(e,t)=>n(ke(e),ke(t),!0)};return B.forEach(Object.keys(Object.assign({},e,t)),(function(i){const a=c[i]||n,s=a(e[i],t[i],i);B.isUndefined(s)&&a!==o||(r[i]=s)})),r}const Pe="1.6.0",Me={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Me[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Ee={};Me.transitional=function(e,t,r){function i(e,t){return"[Axios v1.6.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,a)=>{if(!1===e)throw new N(i(n," has been removed"+(t?" in "+t:"")),N.ERR_DEPRECATED);return t&&!Ee[n]&&(Ee[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,a)}};var xe={assertOptions:function(e,t,r){if("object"!=typeof e)throw new N("options must be an object",N.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const a=i[n],s=t[a];if(s){const t=e[a],r=void 0===t||s(t,a,e);if(!0!==r)throw new N("option "+a+" must be "+r,N.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new N("Unknown option "+a,N.ERR_BAD_OPTION)}},validators:Me};const Te=xe.validators;class Ce{constructor(e){this.defaults=e,this.interceptors={request:new X,response:new X}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Re(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:n}=t;void 0!==r&&xe.assertOptions(r,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean)},!1),null!=i&&(B.isFunction(i)?t.paramsSerializer={serialize:i}:xe.assertOptions(i,{encode:Te.function,serialize:Te.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=n&&B.merge(n.common,n[t.method]);n&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=de.concat(a,n);const s=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,l=0;if(!o){const e=[Se.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,d=Promise.resolve(t);l<u;)d=d.then(e[l++],e[l++]);return d}u=s.length;let h=t;for(l=0;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=Se.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,u=c.length;l<u;)d=d.then(c[l++],c[l++]);return d}getUri(e){return Y(pe((e=Re(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}B.forEach(["delete","get","head","options"],(function(e){Ce.prototype[e]=function(t,r){return this.request(Re(r||{},{method:e,url:t,data:(r||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(Re(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Ce.prototype[e]=t(),Ce.prototype[e+"Form"]=t(!0)}));var Ie=Ce;class De{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e,i,n){r.reason||(r.reason=new he(e,i,n),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new De((function(t){e=t})),cancel:e}}}var Oe=De;const Ae={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ae).forEach((([e,t])=>{Ae[t]=e}));var Le=Ae;const je=function e(t){const r=new Ie(t),n=i(Ie.prototype.request,r);return B.extend(n,Ie.prototype,r,{allOwnKeys:!0}),B.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Re(t,r))},n}(re);je.Axios=Ie,je.CanceledError=he,je.CancelToken=Oe,je.isCancel=le,je.VERSION=Pe,je.toFormData=W,je.AxiosError=N,je.Cancel=je.CanceledError,je.all=function(e){return Promise.all(e)},je.spread=function(e){return function(t){return e.apply(null,t)}},je.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},je.mergeConfig=Re,je.AxiosHeaders=de,je.formToJSON=e=>ee(B.isHTMLForm(e)?new FormData(e):e),je.getAdapter=_e,je.HttpStatusCode=Le,je.default=je,t.exports=je}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{buffer:94}],59:[function(e,t,r){"use strict";r.byteLength=function(e){var t=c(e),r=t[0],i=t[1];return 3*(r+i)/4-i},r.toByteArray=function(e){var t,r,i=c(e),s=i[0],o=i[1],d=new a(function(e,t,r){return 3*(t+r)/4-r}(0,s,o)),u=0,l=o>0?s-4:s;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],d[u++]=t>>16&255,d[u++]=t>>8&255,d[u++]=255&t;2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,d[u++]=255&t);1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,d[u++]=t>>8&255,d[u++]=255&t);return d},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,a=[],s=16383,o=0,c=r-n;o<c;o+=s)a.push(d(e,o,o+s>c?c:o+s));1===n?(t=e[r-1],a.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)i[o]=s[o],n[s.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function d(e,t,r){for(var n,a,s=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(i[(a=n)>>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},{}],60:[function(e,t,r){!function(t,r){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var s;"object"==typeof t?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function c(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function d(e,t,r,n){for(var a=0,s=0,o=Math.min(e.length,r),c=t;c<o;c++){var d=e.charCodeAt(c)-48;a*=n,s=d>=49?d-49+10:d>=17?d-17+10:d,i(d>=0&&s<n,"Invalid character"),a+=s}return a}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,s,o=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)s=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)s=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);return this._strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,s=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;this._strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,s=a%i,o=Math.min(a,a-s)+r,c=0,u=r;u<o;u+=i)c=d(e,u,u+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var l=1;for(c=d(e,u,e.length,t),u=0;u<s;u++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype._move=function(e){u(e,this)},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){a.prototype.inspect=l}else a.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,s=0;s<this.length;s++){var o=this.words[s],c=(16777215&(o<<n|a)).toString(16);a=o>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),r=0!==a||s!==this.length-1?h[6-c.length]+c+r:c+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=f[e],u=p[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(u).toString(e);r=(l=l.idivn(u)).isZero()?m+r:h[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16,2)},s&&(a.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],s=n*a,o=67108863&s,c=s/67108864|0;r.words[0]=o;for(var d=1;d<i;d++){for(var u=c>>>26,l=67108863&c,h=Math.min(d,t.length-1),f=Math.max(0,d-e.length+1);f<=h;f++){var p=d-f|0;u+=(s=(n=0|e.words[p])*(a=0|t.words[f])+l)/67108864|0,l=67108863&s}r.words[d]=0|l,c=0|u}return 0!==c?r.words[d]=0|c:r.length--,r._strip()}a.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,n),s},a.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,a=0;n<this.length;n++){var s=this.words[n]<<a|i;e[r++]=255&s,r<e.length&&(e[r++]=s>>8&255),r<e.length&&(e[r++]=s>>16&255),6===a?(r<e.length&&(e[r++]=s>>24&255),i=0,a=0):(i=s>>>24,a+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},a.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,a=0;n<this.length;n++){var s=this.words[n]<<a|i;e[r--]=255&s,r>=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===a?(r>=0&&(e[r--]=s>>24&255),i=0,a=0):(i=s>>>24,a+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},a.prototype.ior=function(e){return i(!(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},a.prototype.iand=function(e){return i(!(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},a.prototype.ixor=function(e){return i(!(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},a.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,s=0;s<i.length;s++)a=(t=(0|r.words[s])-(0|i.words[s])+a)>>26,this.words[s]=67108863&t;for(;0!==a&&s<r.length;s++)a=(t=(0|r.words[s])+a)>>26,this.words[s]=67108863&t;if(0===a&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var b=function(e,t,r){var i,n,a,s=e.words,o=t.words,c=r.words,d=0,u=0|s[0],l=8191&u,h=u>>>13,f=0|s[1],p=8191&f,m=f>>>13,b=0|s[2],g=8191&b,v=b>>>13,y=0|s[3],_=8191&y,w=y>>>13,S=0|s[4],k=8191&S,R=S>>>13,P=0|s[5],M=8191&P,E=P>>>13,x=0|s[6],T=8191&x,C=x>>>13,I=0|s[7],D=8191&I,O=I>>>13,A=0|s[8],L=8191&A,j=A>>>13,B=0|s[9],N=8191&B,F=B>>>13,U=0|o[0],q=8191&U,z=U>>>13,V=0|o[1],G=8191&V,W=V>>>13,H=0|o[2],K=8191&H,$=H>>>13,J=0|o[3],Y=8191&J,X=J>>>13,Z=0|o[4],Q=8191&Z,ee=Z>>>13,te=0|o[5],re=8191&te,ie=te>>>13,ne=0|o[6],ae=8191&ne,se=ne>>>13,oe=0|o[7],ce=8191&oe,de=oe>>>13,ue=0|o[8],le=8191&ue,he=ue>>>13,fe=0|o[9],pe=8191&fe,me=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(d+(i=Math.imul(l,q))|0)+((8191&(n=(n=Math.imul(l,z))+Math.imul(h,q)|0))<<13)|0;d=((a=Math.imul(h,z))+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(p,q),n=(n=Math.imul(p,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ge=(d+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,W)|0)+Math.imul(h,G)|0))<<13)|0;d=((a=a+Math.imul(h,W)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(g,q),n=(n=Math.imul(g,z))+Math.imul(v,q)|0,a=Math.imul(v,z),i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,W)|0;var ve=(d+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,$)|0)+Math.imul(h,K)|0))<<13)|0;d=((a=a+Math.imul(h,$)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(_,q),n=(n=Math.imul(_,z))+Math.imul(w,q)|0,a=Math.imul(w,z),i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(v,G)|0,a=a+Math.imul(v,W)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,$)|0;var ye=(d+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(h,Y)|0))<<13)|0;d=((a=a+Math.imul(h,X)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(k,q),n=(n=Math.imul(k,z))+Math.imul(R,q)|0,a=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(w,G)|0,a=a+Math.imul(w,W)|0,i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,$)|0)+Math.imul(v,K)|0,a=a+Math.imul(v,$)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Y)|0,a=a+Math.imul(m,X)|0;var _e=(d+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;d=((a=a+Math.imul(h,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(M,q),n=(n=Math.imul(M,z))+Math.imul(E,q)|0,a=Math.imul(E,z),i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,W)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,$)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,$)|0,i=i+Math.imul(g,Y)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(v,Y)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,ee)|0;var we=(d+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(h,re)|0))<<13)|0;d=((a=a+Math.imul(h,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(T,q),n=(n=Math.imul(T,z))+Math.imul(C,q)|0,a=Math.imul(C,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(E,G)|0,a=a+Math.imul(E,W)|0,i=i+Math.imul(k,K)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,$)|0,i=i+Math.imul(_,Y)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Y)|0,a=a+Math.imul(w,X)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0;var Se=(d+(i=i+Math.imul(l,ae)|0)|0)+((8191&(n=(n=n+Math.imul(l,se)|0)+Math.imul(h,ae)|0))<<13)|0;d=((a=a+Math.imul(h,se)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(D,q),n=(n=Math.imul(D,z))+Math.imul(O,q)|0,a=Math.imul(O,z),i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(C,G)|0,a=a+Math.imul(C,W)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(E,K)|0,a=a+Math.imul(E,$)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,ee)|0,i=i+Math.imul(g,re)|0,n=(n=n+Math.imul(g,ie)|0)+Math.imul(v,re)|0,a=a+Math.imul(v,ie)|0,i=i+Math.imul(p,ae)|0,n=(n=n+Math.imul(p,se)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,se)|0;var ke=(d+(i=i+Math.imul(l,ce)|0)|0)+((8191&(n=(n=n+Math.imul(l,de)|0)+Math.imul(h,ce)|0))<<13)|0;d=((a=a+Math.imul(h,de)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(L,q),n=(n=Math.imul(L,z))+Math.imul(j,q)|0,a=Math.imul(j,z),i=i+Math.imul(D,G)|0,n=(n=n+Math.imul(D,W)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,W)|0,i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,$)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,$)|0,i=i+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(E,Y)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ie)|0,i=i+Math.imul(g,ae)|0,n=(n=n+Math.imul(g,se)|0)+Math.imul(v,ae)|0,a=a+Math.imul(v,se)|0,i=i+Math.imul(p,ce)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,de)|0;var Re=(d+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;d=((a=a+Math.imul(h,he)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(N,q),n=(n=Math.imul(N,z))+Math.imul(F,q)|0,a=Math.imul(F,z),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,W)|0,i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,$)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,$)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(_,ae)|0,n=(n=n+Math.imul(_,se)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,se)|0,i=i+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,de)|0)+Math.imul(v,ce)|0,a=a+Math.imul(v,de)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,he)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,he)|0;var Pe=(d+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,me)|0)+Math.imul(h,pe)|0))<<13)|0;d=((a=a+Math.imul(h,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,W))+Math.imul(F,G)|0,a=Math.imul(F,W),i=i+Math.imul(L,K)|0,n=(n=n+Math.imul(L,$)|0)+Math.imul(j,K)|0,a=a+Math.imul(j,$)|0,i=i+Math.imul(D,Y)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,X)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(M,re)|0,n=(n=n+Math.imul(M,ie)|0)+Math.imul(E,re)|0,a=a+Math.imul(E,ie)|0,i=i+Math.imul(k,ae)|0,n=(n=n+Math.imul(k,se)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,se)|0,i=i+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(w,ce)|0,a=a+Math.imul(w,de)|0,i=i+Math.imul(g,le)|0,n=(n=n+Math.imul(g,he)|0)+Math.imul(v,le)|0,a=a+Math.imul(v,he)|0;var Me=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;d=((a=a+Math.imul(m,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(N,K),n=(n=Math.imul(N,$))+Math.imul(F,K)|0,a=Math.imul(F,$),i=i+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(j,Y)|0,a=a+Math.imul(j,X)|0,i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(M,ae)|0,n=(n=n+Math.imul(M,se)|0)+Math.imul(E,ae)|0,a=a+Math.imul(E,se)|0,i=i+Math.imul(k,ce)|0,n=(n=n+Math.imul(k,de)|0)+Math.imul(R,ce)|0,a=a+Math.imul(R,de)|0,i=i+Math.imul(_,le)|0,n=(n=n+Math.imul(_,he)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,he)|0;var Ee=(d+(i=i+Math.imul(g,pe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(v,pe)|0))<<13)|0;d=((a=a+Math.imul(v,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(N,Y),n=(n=Math.imul(N,X))+Math.imul(F,Y)|0,a=Math.imul(F,X),i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,ee)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,ee)|0,i=i+Math.imul(D,re)|0,n=(n=n+Math.imul(D,ie)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ie)|0,i=i+Math.imul(T,ae)|0,n=(n=n+Math.imul(T,se)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,se)|0,i=i+Math.imul(M,ce)|0,n=(n=n+Math.imul(M,de)|0)+Math.imul(E,ce)|0,a=a+Math.imul(E,de)|0,i=i+Math.imul(k,le)|0,n=(n=n+Math.imul(k,he)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,he)|0;var xe=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;d=((a=a+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(N,Q),n=(n=Math.imul(N,ee))+Math.imul(F,Q)|0,a=Math.imul(F,ee),i=i+Math.imul(L,re)|0,n=(n=n+Math.imul(L,ie)|0)+Math.imul(j,re)|0,a=a+Math.imul(j,ie)|0,i=i+Math.imul(D,ae)|0,n=(n=n+Math.imul(D,se)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,se)|0,i=i+Math.imul(T,ce)|0,n=(n=n+Math.imul(T,de)|0)+Math.imul(C,ce)|0,a=a+Math.imul(C,de)|0,i=i+Math.imul(M,le)|0,n=(n=n+Math.imul(M,he)|0)+Math.imul(E,le)|0,a=a+Math.imul(E,he)|0;var Te=(d+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(R,pe)|0))<<13)|0;d=((a=a+Math.imul(R,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(N,re),n=(n=Math.imul(N,ie))+Math.imul(F,re)|0,a=Math.imul(F,ie),i=i+Math.imul(L,ae)|0,n=(n=n+Math.imul(L,se)|0)+Math.imul(j,ae)|0,a=a+Math.imul(j,se)|0,i=i+Math.imul(D,ce)|0,n=(n=n+Math.imul(D,de)|0)+Math.imul(O,ce)|0,a=a+Math.imul(O,de)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,he)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,he)|0;var Ce=(d+(i=i+Math.imul(M,pe)|0)|0)+((8191&(n=(n=n+Math.imul(M,me)|0)+Math.imul(E,pe)|0))<<13)|0;d=((a=a+Math.imul(E,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(N,ae),n=(n=Math.imul(N,se))+Math.imul(F,ae)|0,a=Math.imul(F,se),i=i+Math.imul(L,ce)|0,n=(n=n+Math.imul(L,de)|0)+Math.imul(j,ce)|0,a=a+Math.imul(j,de)|0,i=i+Math.imul(D,le)|0,n=(n=n+Math.imul(D,he)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,he)|0;var Ie=(d+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,me)|0)+Math.imul(C,pe)|0))<<13)|0;d=((a=a+Math.imul(C,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(N,ce),n=(n=Math.imul(N,de))+Math.imul(F,ce)|0,a=Math.imul(F,de),i=i+Math.imul(L,le)|0,n=(n=n+Math.imul(L,he)|0)+Math.imul(j,le)|0,a=a+Math.imul(j,he)|0;var De=(d+(i=i+Math.imul(D,pe)|0)|0)+((8191&(n=(n=n+Math.imul(D,me)|0)+Math.imul(O,pe)|0))<<13)|0;d=((a=a+Math.imul(O,me)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863,i=Math.imul(N,le),n=(n=Math.imul(N,he))+Math.imul(F,le)|0,a=Math.imul(F,he);var Oe=(d+(i=i+Math.imul(L,pe)|0)|0)+((8191&(n=(n=n+Math.imul(L,me)|0)+Math.imul(j,pe)|0))<<13)|0;d=((a=a+Math.imul(j,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Ae=(d+(i=Math.imul(N,pe))|0)+((8191&(n=(n=Math.imul(N,me))+Math.imul(F,pe)|0))<<13)|0;return d=((a=Math.imul(F,me))+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,c[0]=be,c[1]=ge,c[2]=ve,c[3]=ye,c[4]=_e,c[5]=we,c[6]=Se,c[7]=ke,c[8]=Re,c[9]=Pe,c[10]=Me,c[11]=Ee,c[12]=xe,c[13]=Te,c[14]=Ce,c[15]=Ie,c[16]=De,c[17]=Oe,c[18]=Ae,0!==d&&(c[19]=d,r.length++),r};function g(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var s=n;n=0;for(var o=67108863&i,c=Math.min(a,t.length-1),d=Math.max(0,a-e.length+1);d<=c;d++){var u=a-d,l=(0|e.words[u])*(0|t.words[d]),h=67108863&l;o=67108863&(h=h+o|0),n+=(s=(s=s+(l/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[a]=o,i=s,s=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function v(e,t,r){return g(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(b=m),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?b(this,e,t):r<63?m(this,e,t):r<1024?g(this,e,t):v(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},y.prototype.permute=function(e,t,r,i,n,a){for(var s=0;s<a;s++)i[s]=t[e[s]],n[s]=r[e[s]]},y.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var s=1;s<n;s<<=1)for(var o=s<<1,c=Math.cos(2*Math.PI/o),d=Math.sin(2*Math.PI/o),u=0;u<n;u+=o)for(var l=c,h=d,f=0;f<s;f++){var p=r[u+f],m=i[u+f],b=r[u+f+s],g=i[u+f+s],v=l*b-h*g;g=l*g+h*b,b=v,r[u+f]=p+b,i[u+f]=m+g,r[u+f+s]=p-b,i[u+f+s]=m-g,f!==o&&(v=c*l-d*h,h=c*h+d*l,l=v)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},y.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},y.prototype.convert13b=function(e,t,r,n){for(var a=0,s=0;s<t;s++)a+=0|e[s],r[2*s]=8191&a,a>>>=13,r[2*s+1]=8191&a,a>>>=13;for(s=2*t;s<n;++s)r[s]=0;i(0===a),i(!(-8192&a))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),s=new Array(i),o=new Array(i),c=new Array(i),d=new Array(i),u=new Array(i),l=new Array(i),h=r.words;h.length=i,this.convert13b(e.words,e.length,s,i),this.convert13b(t.words,t.length,d,i),this.transform(s,a,o,c,i,n),this.transform(d,a,u,l,i,n);for(var f=0;f<i;f++){var p=o[f]*u[f]-c[f]*l[f];c[f]=o[f]*l[f]+c[f]*u[f],o[f]=p}return this.conjugate(o,c,i),this.transform(o,c,h,a,i,n),this.conjugate(h,a,i),this.normalize13b(h,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),v(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var a=(0|this.words[n])*e,s=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new a(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},a.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t<this.length;t++){var o=this.words[t]&a,c=(0|this.words[t])-o<<r;this.words[t]=c|s,s=o>>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},a.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,s=Math.min((e-a)/26,this.length),o=67108863^67108863>>>a<<a,c=r;if(n-=s,n=Math.max(0,n),c){for(var d=0;d<s;d++)c.words[d]=this.words[d];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,d=0;d<this.length;d++)this.words[d]=this.words[d+s];else this.words[0]=0,this.length=1;var u=0;for(d=this.length-1;d>=0&&(0!==u||d>=n);d--){var l=0|this.words[d];this.words[d]=u<<26-a|l>>>a,u=l&o}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},a.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this._strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var n,a,s=e.length+r;this._expand(s);var o=0;for(n=0;n<e.length;n++){a=(0|this.words[n+r])+o;var c=(0|e.words[n])*t;o=((a-=67108863&c)>>26)-(c/67108864|0),this.words[n+r]=67108863&a}for(;n<this.length-r;n++)o=(a=(0|this.words[n+r])+o)>>26,this.words[n+r]=67108863&a;if(0===o)return this._strip();for(i(-1===o),o=0,n=0;n<this.length;n++)o=(a=-(0|this.words[n])+o)>>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var o,c=i.length-n.length;if("mod"!==t){(o=new a(null)).length=c+1,o.words=new Array(o.length);for(var d=0;d<o.length;d++)o.words[d]=0}var u=i.clone()._ishlnsubmul(n,1,c);0===u.negative&&(i=u,o&&(o.words[c]=1));for(var l=c-1;l>=0;l--){var h=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(h=Math.min(h/s|0,67108863),i._ishlnsubmul(n,h,l);0!==i.negative;)h--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);o&&(o.words[l]=h)}return o&&o._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:o||null,mod:i}},a.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(n=o.div.neg()),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:n,mod:s}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(n=o.div.neg()),{div:n,mod:o.mod}):this.negative&e.negative?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:o.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,s,o},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%e;return t?-n:n},a.prototype.modn=function(e){return this.modrn(e)},a.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new a(1),s=new a(0),o=new a(0),c=new a(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var u=r.clone(),l=t.clone();!t.isZero();){for(var h=0,f=1;!(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(u),s.isub(l)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(u),c.isub(l)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o),s.isub(c)):(r.isub(t),o.isub(n),c.isub(s))}return{a:o,b:c,gcd:r.iushln(d)}},a.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,s=new a(1),o=new a(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,u=1;!(t.words[0]&u)&&d<26;++d,u<<=1);if(d>0)for(t.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var l=0,h=1;!(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(o)):(r.isub(t),o.isub(s))}return(n=0===t.cmpn(1)?s:o).cmpn(0)<0&&n.iadd(e),n},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return!(1&this.words[0])},a.prototype.isOdd=function(){return!(1&~this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var a=n,s=r;0!==a&&s<this.length;s++){var o=0|this.words[s];a=(o+=a)>>>26,o&=67108863,this.words[s]=o}return 0!==a&&(this.words[s]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new M(e)},a.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function R(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(S,w),S.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n<i;n++)t.words[n]=e.words[n];if(t.length=i,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,n=10;n<e.length;n++){var s=0|e.words[n];e.words[n-10]=(s&r)<<4|a>>>22,a=s}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(k,w),n(R,w),n(P,w),P.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new k;else if("p192"===e)t=new R;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new P}return _[e]=t,t},M.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){i(!(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var o=new a(1).toRed(this),c=o.redNeg(),d=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,d).cmp(c);)u.redIAdd(c);for(var l=this.pow(u,n),h=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=s;0!==f.cmp(o);){for(var m=f,b=0;0!==m.cmp(o);b++)m=m.redSqr();i(b<p);var g=this.pow(l,new a(1).iushln(p-b-1));h=h.redMul(g),l=g.redSqr(),f=f.redMul(l),p=b}return h},M.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},M.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],s=0,o=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],u=c-1;u>=0;u--){var l=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==s?(s<<=1,s|=l,(4===++o||0===i&&0===u)&&(n=this.mul(n,r[s]),o=0,s=0)):o=0}c=26}return n},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new E(e)},n(E,M),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:63}],61:[function(e,t,r){var i,n;i=this,n=function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i=r(18),n=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,i){void 0===i&&(i=!1);var n=e.getVersionPrecision(t),a=e.getVersionPrecision(r),s=Math.max(n,a),o=0,c=e.map([t,r],(function(t){var r=s-e.getVersionPrecision(t),i=t+new Array(r+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(o=s-Math.min(n,a)),s-=1;s>=o;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===o)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},e.map=function(e,t){var r,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)i.push(t(e[r]));return i},e.find=function(e,t){var r,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,i=e.length;r<i;r+=1){var n=e[r];if(t(n,r))return n}},e.assign=function(e){for(var t,r,i=e,n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(a));var o=function(){var e=a[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,r=a.length;t<r;t+=1)o();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=n,e.exports=t.default},18:function(e,t,r){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(91))&&i.__esModule?i:{default:i},a=r(18);function s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=function(){function e(){}var t,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new n.default(e,t)},e.parse=function(e){return new n.default(e).getResult()},t=e,(r=[{key:"BROWSER_MAP",get:function(){return a.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return a.ENGINE_MAP}},{key:"OS_MAP",get:function(){return a.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return a.PLATFORMS_MAP}}])&&s(t,r),e}();t.default=o,e.exports=t.default},91:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i=c(r(92)),n=c(r(93)),a=c(r(94)),s=c(r(95)),o=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=o.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=o.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=o.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=o.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return o.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},i=0,n={},a=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(n[t]=s,a+=1):"object"==typeof s&&(r[t]=s,i+=1)})),i>0){var s=Object.keys(r),c=o.default.find(s,(function(e){return t.isOS(e)}));if(c){var d=this.satisfies(r[c]);if(void 0!==d)return d}var u=o.default.find(s,(function(e){return t.isPlatform(e)}));if(u){var l=this.satisfies(r[u]);if(void 0!==l)return l}}if(a>0){var h=Object.keys(n),f=o.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==f)return this.compareVersion(n[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),n=o.default.getBrowserTypeByAlias(i);return t&&n&&(i=n.toLowerCase()),i===r},t.compareVersion=function(e){var t=[0],r=e,i=!1,n=this.getBrowserVersion();if("string"==typeof n)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(i=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(i=!0,r=e.substr(1)),t.indexOf(o.default.compareVersions(n,r,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(t,e),version:n.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:a.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=n.default.getWindowsVersionName(t);return{name:a.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:a.OS_MAP.iOS},r=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=n.default.getMacOSVersionName(t),i={name:a.OS_MAP.MacOS,version:t};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:a.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=n.default.getAndroidVersionName(t),i={name:a.OS_MAP.Android,version:t};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:a.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:a.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:a.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:a.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=n.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:a.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=n.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:a.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:a.ENGINE_MAP.Blink};var t=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:a.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:a.ENGINE_MAP.Trident},r=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:a.ENGINE_MAP.Presto},r=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:a.ENGINE_MAP.Gecko},r=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:a.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:a.ENGINE_MAP.WebKit},r=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=s,e.exports=t.default}})},"object"==typeof r&&"object"==typeof t?t.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof r?r.bowser=n():i.bowser=n()},{}],62:[function(e,t,r){var i;function n(e){this.rand=e}if(t.exports=function(e){return i||(i=new n(null)),i.generate(e)},t.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=e("crypto");if("function"!=typeof a.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return a.randomBytes(e)}}catch(e){}},{crypto:63}],63:[function(e,t,r){},{}],64:[function(e,t,r){var i=e("safe-buffer").Buffer;function n(e){i.isBuffer(e)||(e=i.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(4*n);return r}function a(e){for(;0<e.length;e++)e[0]=0}function s(e,t,r,i,n){for(var a,s,o,c,d=r[0],u=r[1],l=r[2],h=r[3],f=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],b=e[3]^t[3],g=4,v=1;v<n;v++)a=d[f>>>24]^u[p>>>16&255]^l[m>>>8&255]^h[255&b]^t[g++],s=d[p>>>24]^u[m>>>16&255]^l[b>>>8&255]^h[255&f]^t[g++],o=d[m>>>24]^u[b>>>16&255]^l[f>>>8&255]^h[255&p]^t[g++],c=d[b>>>24]^u[f>>>16&255]^l[p>>>8&255]^h[255&m]^t[g++],f=a,p=s,m=o,b=c;return a=(i[f>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&b])^t[g++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[b>>>8&255]<<8|i[255&f])^t[g++],o=(i[m>>>24]<<24|i[b>>>16&255]<<16|i[f>>>8&255]<<8|i[255&p])^t[g++],c=(i[b>>>24]<<24|i[f>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^t[g++],[a>>>=0,s>>>=0,o>>>=0,c>>>=0]}var o=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],a=[[],[],[],[]],s=0,o=0,c=0;c<256;++c){var d=o^o<<1^o<<2^o<<3^o<<4;d=d>>>8^255&d^99,r[s]=d,i[d]=s;var u=e[s],l=e[u],h=e[l],f=257*e[d]^16843008*d;n[0][s]=f<<24|f>>>8,n[1][s]=f<<16|f>>>16,n[2][s]=f<<8|f>>>24,n[3][s]=f,f=16843009*h^65537*l^257*u^16843008*s,a[0][d]=f<<24|f>>>8,a[1][d]=f<<16|f>>>16,a[2][d]=f<<8|f>>>24,a[3][d]=f,0===s?s=o=1:(s=u^e[e[e[h^u]]],o^=e[e[o]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:a}}();function d(e){this._key=n(e),this._reset()}d.blockSize=16,d.keySize=32,d.prototype.blockSize=d.blockSize,d.prototype.keySize=d.keySize,d.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=4*(r+1),n=[],a=0;a<t;a++)n[a]=e[a];for(a=t;a<i;a++){var s=n[a-1];a%t==0?(s=s<<8|s>>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s],s^=o[a/t|0]<<24):t>6&&a%t==4&&(s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s]),n[a]=n[a-t]^s}for(var d=[],u=0;u<i;u++){var l=i-u,h=n[l-(u%4?0:4)];d[u]=u<4||l<=4?h:c.INV_SUB_MIX[0][c.SBOX[h>>>24]]^c.INV_SUB_MIX[1][c.SBOX[h>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[h>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&h]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=d},d.prototype.encryptBlockRaw=function(e){return s(e=n(e),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},d.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},d.prototype.decryptBlock=function(e){var t=(e=n(e))[1];e[1]=e[3],e[3]=t;var r=s(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),a=i.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},d.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=d},{"safe-buffer":284}],65:[function(e,t,r){var i=e("./aes"),n=e("safe-buffer").Buffer,a=e("cipher-base"),s=e("inherits"),o=e("./ghash"),c=e("buffer-xor"),d=e("./incr32");function u(e,t,r,s){a.call(this);var c=n.alloc(4,0);this._cipher=new i.AES(t);var u=this._cipher.encryptBlock(c);this._ghash=new o(u),r=function(e,t,r){if(12===t.length)return e._finID=n.concat([t,n.from([0,0,0,1])]),n.concat([t,n.from([0,0,0,2])]);var i=new o(r),a=t.length,s=a%16;i.update(t),s&&(s=16-s,i.update(n.alloc(s,0))),i.update(n.alloc(8,0));var c=8*a,u=n.alloc(8);u.writeUIntBE(c,0,8),i.update(u),e._finID=i.state;var l=n.from(e._finID);return d(l),l}(this,r,u),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}s(u,a),u.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=n.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},u.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=c(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},u.prototype.getAuthTag=function(){if(this._decrypt||!n.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},u.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},u.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},t.exports=u},{"./aes":64,"./ghash":69,"./incr32":70,"buffer-xor":93,"cipher-base":95,inherits:174,"safe-buffer":284}],66:[function(e,t,r){var i=e("./encrypter"),n=e("./decrypter"),a=e("./modes/list.json");r.createCipher=r.Cipher=i.createCipher,r.createCipheriv=r.Cipheriv=i.createCipheriv,r.createDecipher=r.Decipher=n.createDecipher,r.createDecipheriv=r.Decipheriv=n.createDecipheriv,r.listCiphers=r.getCiphers=function(){return Object.keys(a)}},{"./decrypter":67,"./encrypter":68,"./modes/list.json":78}],67:[function(e,t,r){var i=e("./authCipher"),n=e("safe-buffer").Buffer,a=e("./modes"),s=e("./streamCipher"),o=e("cipher-base"),c=e("./aes"),d=e("evp_bytestokey");function u(e,t,r){o.call(this),this._cache=new l,this._last=void 0,this._cipher=new c.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}function l(){this.cache=n.allocUnsafe(0)}function h(e,t,r){var o=a[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==o.mode&&r.length!==o.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=n.from(t)),t.length!==o.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===o.type?new s(o.module,t,r,!0):"auth"===o.type?new i(o.module,t,r,!0):new u(o.module,t,r)}e("inherits")(u,o),u.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},u.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16===t)return;return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=n.concat([this.cache,e])},l.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(e,t){var r=a[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=d(t,!1,r.key,r.iv);return h(e,i.key,i.iv)},r.createDecipheriv=h},{"./aes":64,"./authCipher":65,"./modes":77,"./streamCipher":80,"cipher-base":95,evp_bytestokey:156,inherits:174,"safe-buffer":284}],68:[function(e,t,r){var i=e("./modes"),n=e("./authCipher"),a=e("safe-buffer").Buffer,s=e("./streamCipher"),o=e("cipher-base"),c=e("./aes"),d=e("evp_bytestokey");function u(e,t,r){o.call(this),this._cache=new h,this._cipher=new c.AES(t),this._prev=a.from(r),this._mode=e,this._autopadding=!0}e("inherits")(u,o),u.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return a.concat(i)};var l=a.alloc(16,16);function h(){this.cache=a.allocUnsafe(0)}function f(e,t,r){var o=i[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=a.from(t)),t.length!==o.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=a.from(r)),"GCM"!==o.mode&&r.length!==o.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===o.type?new s(o.module,t,r):"auth"===o.type?new n(o.module,t,r):new u(o.module,t,r)}u.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},h.prototype.add=function(e){this.cache=a.concat([this.cache,e])},h.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},h.prototype.flush=function(){for(var e=16-this.cache.length,t=a.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return a.concat([this.cache,t])},r.createCipheriv=f,r.createCipher=function(e,t){var r=i[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=d(t,!1,r.key,r.iv);return f(e,n.key,n.iv)}},{"./aes":64,"./authCipher":65,"./modes":77,"./streamCipher":80,"cipher-base":95,evp_bytestokey:156,inherits:174,"safe-buffer":284}],69:[function(e,t,r){var i=e("safe-buffer").Buffer,n=i.alloc(16,0);function a(e){var t=i.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function s(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}s.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},s.prototype._multiply=function(){for(var e,t,r,i=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],n=[0,0,0,0],s=-1;++s<128;){for(!!(this.state[~~(s/8)]&1<<7-s%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=!!(1&i[3]),t=3;t>0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=a(n)},s.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},s.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=s},{"safe-buffer":284}],70:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],71:[function(e,t,r){var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":93}],72:[function(e,t,r){var i=e("safe-buffer").Buffer,n=e("buffer-xor");function a(e,t,r){var a=t.length,s=n(t,e._cache);return e._cache=e._cache.slice(a),e._prev=i.concat([e._prev,r?t:s]),s}r.encrypt=function(e,t,r){for(var n,s=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){s=i.concat([s,a(e,t,r)]);break}n=e._cache.length,s=i.concat([s,a(e,t.slice(0,n),r)]),t=t.slice(n)}return s}},{"buffer-xor":93,"safe-buffer":284}],73:[function(e,t,r){var i=e("safe-buffer").Buffer;function n(e,t,r){for(var i,n,s=-1,o=0;++s<8;)i=t&1<<7-s?128:0,o+=(128&(n=e._cipher.encryptBlock(e._prev)[0]^i))>>s%8,e._prev=a(e._prev,r?i:n);return o}function a(e,t){var r=e.length,n=-1,a=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n<r;)a[n]=e[n]<<1|e[n+1]>>7;return a}r.encrypt=function(e,t,r){for(var a=t.length,s=i.allocUnsafe(a),o=-1;++o<a;)s[o]=n(e,t[o],r);return s}},{"safe-buffer":284}],74:[function(e,t,r){var i=e("safe-buffer").Buffer;function n(e,t,r){var n=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([r?t:n])]),n}r.encrypt=function(e,t,r){for(var a=t.length,s=i.allocUnsafe(a),o=-1;++o<a;)s[o]=n(e,t[o],r);return s}},{"safe-buffer":284}],75:[function(e,t,r){var i=e("buffer-xor"),n=e("safe-buffer").Buffer,a=e("../incr32");function s(e){var t=e._cipher.encryptBlockRaw(e._prev);return a(e._prev),t}r.encrypt=function(e,t){var r=Math.ceil(t.length/16),a=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(16*r)]);for(var o=0;o<r;o++){var c=s(e),d=a+16*o;e._cache.writeUInt32BE(c[0],d+0),e._cache.writeUInt32BE(c[1],d+4),e._cache.writeUInt32BE(c[2],d+8),e._cache.writeUInt32BE(c[3],d+12)}var u=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,u)}},{"../incr32":70,"buffer-xor":93,"safe-buffer":284}],76:[function(e,t,r){r.encrypt=function(e,t){return e._cipher.encryptBlock(t)},r.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},{}],77:[function(e,t,r){var i={ECB:e("./ecb"),CBC:e("./cbc"),CFB:e("./cfb"),CFB8:e("./cfb8"),CFB1:e("./cfb1"),OFB:e("./ofb"),CTR:e("./ctr"),GCM:e("./ctr")},n=e("./list.json");for(var a in n)n[a].module=i[n[a].mode];t.exports=n},{"./cbc":71,"./cfb":72,"./cfb1":73,"./cfb8":74,"./ctr":75,"./ecb":76,"./list.json":78,"./ofb":79}],78:[function(e,t,r){t.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},{}],79:[function(e,t,r){(function(t){(function(){var i=e("buffer-xor");function n(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}r.encrypt=function(e,r){for(;e._cache.length<r.length;)e._cache=t.concat([e._cache,n(e)]);var a=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),i(r,a)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:94,"buffer-xor":93}],80:[function(e,t,r){var i=e("./aes"),n=e("safe-buffer").Buffer,a=e("cipher-base");function s(e,t,r,s){a.call(this),this._cipher=new i.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._mode=e}e("inherits")(s,a),s.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},{"./aes":64,"cipher-base":95,inherits:174,"safe-buffer":284}],81:[function(e,t,r){var i=e("browserify-des"),n=e("browserify-aes/browser"),a=e("browserify-aes/modes"),s=e("browserify-des/modes"),o=e("evp_bytestokey");function c(e,t,r){if(e=e.toLowerCase(),a[e])return n.createCipheriv(e,t,r);if(s[e])return new i({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function d(e,t,r){if(e=e.toLowerCase(),a[e])return n.createDecipheriv(e,t,r);if(s[e])return new i({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}r.createCipher=r.Cipher=function(e,t){var r,i;if(e=e.toLowerCase(),a[e])r=a[e].key,i=a[e].iv;else{if(!s[e])throw new TypeError("invalid suite type");r=8*s[e].key,i=s[e].iv}var n=o(t,!1,r,i);return c(e,n.key,n.iv)},r.createCipheriv=r.Cipheriv=c,r.createDecipher=r.Decipher=function(e,t){var r,i;if(e=e.toLowerCase(),a[e])r=a[e].key,i=a[e].iv;else{if(!s[e])throw new TypeError("invalid suite type");r=8*s[e].key,i=s[e].iv}var n=o(t,!1,r,i);return d(e,n.key,n.iv)},r.createDecipheriv=r.Decipheriv=d,r.listCiphers=r.getCiphers=function(){return Object.keys(s).concat(n.getCiphers())}},{"browserify-aes/browser":66,"browserify-aes/modes":77,"browserify-des":82,"browserify-des/modes":83,evp_bytestokey:156}],82:[function(e,t,r){var i=e("cipher-base"),n=e("des.js"),a=e("inherits"),s=e("safe-buffer").Buffer,o={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function c(e){i.call(this);var t,r=e.mode.toLowerCase(),n=o[r];t=e.decrypt?"decrypt":"encrypt";var a=e.key;s.isBuffer(a)||(a=s.from(a)),"des-ede"!==r&&"des-ede-cbc"!==r||(a=s.concat([a,a.slice(0,8)]));var c=e.iv;s.isBuffer(c)||(c=s.from(c)),this._des=n.create({key:a,iv:c,type:t})}o.des=o["des-cbc"],o.des3=o["des-ede3-cbc"],t.exports=c,a(c,i),c.prototype._update=function(e){return s.from(this._des.update(e))},c.prototype._final=function(){return s.from(this._des.final())}},{"cipher-base":95,"des.js":106,inherits:174,"safe-buffer":284}],83:[function(e,t,r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}},{}],84:[function(e,t,r){(function(r){(function(){var i=e("bn.js"),n=e("randombytes");function a(e){var t,r=e.modulus.byteLength();do{t=new i(n(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function s(e,t){var n=function(e){var t=a(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),s=t.modulus.byteLength(),o=new i(e).mul(n.blinder).umod(t.modulus),c=o.toRed(i.mont(t.prime1)),d=o.toRed(i.mont(t.prime2)),u=t.coefficient,l=t.prime1,h=t.prime2,f=c.redPow(t.exponent1).fromRed(),p=d.redPow(t.exponent2).fromRed(),m=f.isub(p).imul(u).umod(l).imul(h);return p.iadd(m).imul(n.unblinder).umod(t.modulus).toArrayLike(r,"be",s)}s.getr=a,t.exports=s}).call(this)}).call(this,e("buffer").Buffer)},{"bn.js":60,buffer:94,randombytes:266}],85:[function(e,t,r){"use strict";t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":86}],86:[function(e,t,r){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],87:[function(e,t,r){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],88:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("create-hash"),a=e("readable-stream"),s=e("inherits"),o=e("./sign"),c=e("./verify"),d=e("./algorithms.json");function u(e){a.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){a.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function h(e){return new u(e)}function f(e){return new l(e)}Object.keys(d).forEach((function(e){d[e].id=i.from(d[e].id,"hex"),d[e.toLowerCase()]=d[e]})),s(u,a.Writable),u.prototype._write=function(e,t,r){this._hash.update(e),r()},u.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},u.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),i=o(r,e,this._hashType,this._signType,this._tag);return t?i.toString(t):i},s(l,a.Writable),l.prototype._write=function(e,t,r){this._hash.update(e),r()},l.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},l.prototype.verify=function(e,t,r){var n="string"==typeof t?i.from(t,r):t;this.end();var a=this._hash.digest();return c(n,a,e,this._signType,this._tag)},t.exports={Sign:h,Verify:f,createSign:h,createVerify:f}},{"./algorithms.json":86,"./sign":89,"./verify":90,"create-hash":99,inherits:174,"readable-stream":280,"safe-buffer":284}],89:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("create-hmac"),a=e("browserify-rsa"),s=e("elliptic").ec,o=e("bn.js"),c=e("parse-asn1"),d=e("./curves.json");function u(e,t,r,a){if((e=i.from(e.toArray())).length<t.byteLength()){var s=i.alloc(t.byteLength()-e.length);e=i.concat([s,e])}var o=r.length,c=function(e,t){e=l(e,t),e=e.mod(t);var r=i.from(e.toArray());if(r.length<t.byteLength()){var n=i.alloc(t.byteLength()-r.length);r=i.concat([n,r])}return r}(r,t),d=i.alloc(o);d.fill(1);var u=i.alloc(o);return u=n(a,u).update(d).update(i.from([0])).update(e).update(c).digest(),d=n(a,u).update(d).digest(),{k:u=n(a,u).update(d).update(i.from([1])).update(e).update(c).digest(),v:d=n(a,u).update(d).digest()}}function l(e,t){var r=new o(e),i=(e.length<<3)-t.bitLength();return i>0&&r.ishrn(i),r}function h(e,t,r){var a,s;do{for(a=i.alloc(0);8*a.length<e.bitLength();)t.v=n(r,t.k).update(t.v).digest(),a=i.concat([a,t.v]);s=l(a,e),t.k=n(r,t.k).update(t.v).update(i.from([0])).digest(),t.v=n(r,t.k).update(t.v).digest()}while(-1!==s.cmp(e));return s}function f(e,t,r,i){return e.toRed(o.mont(r)).redPow(t).fromRed().mod(i)}t.exports=function(e,t,r,n,p){var m=c(t);if(m.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");return function(e,t){var r=d[t.curve.join(".")];if(!r)throw new Error("unknown curve "+t.curve.join("."));var n=new s(r).keyFromPrivate(t.privateKey),a=n.sign(e);return i.from(a.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==n)throw new Error("wrong private key type");return function(e,t,r){var n,a=t.params.priv_key,s=t.params.p,c=t.params.q,d=t.params.g,p=new o(0),m=l(e,c).mod(c),b=!1,g=u(a,c,e,r);for(;!1===b;)p=f(d,n=h(c,g,r),s,c),0===(b=n.invm(c).imul(m.add(a.mul(p))).mod(c)).cmpn(0)&&(b=!1,p=new o(0));return function(e,t){e=e.toArray(),t=t.toArray(),128&e[0]&&(e=[0].concat(e));128&t[0]&&(t=[0].concat(t));var r=e.length+t.length+4,n=[48,r,2,e.length];return n=n.concat(e,[2,t.length],t),i.from(n)}(p,b)}(e,m,r)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");if(void 0!==t.padding&&1!==t.padding)throw new Error("illegal or unsupported padding mode");e=i.concat([p,e]);for(var b=m.modulus.byteLength(),g=[0,1];e.length+g.length+1<b;)g.push(255);g.push(0);for(var v=-1;++v<e.length;)g.push(e[v]);return a(g,m)},t.exports.getKey=u,t.exports.makeKey=h},{"./curves.json":87,"bn.js":60,"browserify-rsa":84,"create-hmac":101,elliptic:119,"parse-asn1":247,"safe-buffer":284}],90:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("bn.js"),a=e("elliptic").ec,s=e("parse-asn1"),o=e("./curves.json");function c(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=0)throw new Error("invalid sig")}t.exports=function(e,t,r,d,u){var l=s(r);if("ec"===l.type){if("ecdsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");return function(e,t,r){var i=o[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new a(i),s=r.data.subjectPrivateKey.data;return n.verify(t,e,s)}(e,t,l)}if("dsa"===l.type){if("dsa"!==d)throw new Error("wrong public key type");return function(e,t,r){var i=r.data.p,a=r.data.q,o=r.data.g,d=r.data.pub_key,u=s.signature.decode(e,"der"),l=u.s,h=u.r;c(l,a),c(h,a);var f=n.mont(i),p=l.invm(a),m=o.toRed(f).redPow(new n(t).mul(p).mod(a)).fromRed().mul(d.toRed(f).redPow(h.mul(p).mod(a)).fromRed()).mod(i).mod(a);return 0===m.cmp(h)}(e,t,l)}if("rsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");t=i.concat([u,t]);for(var h=l.modulus.byteLength(),f=[1],p=0;t.length+f.length+2<h;)f.push(255),p+=1;f.push(0);for(var m=-1;++m<t.length;)f.push(t[m]);f=i.from(f);var b=n.mont(l.modulus);e=(e=new n(e).toRed(b)).redPow(new n(l.publicExponent)),e=i.from(e.fromRed().toArray());var g=p<8?1:0;for(h=Math.min(e.length,f.length),e.length!==f.length&&(g=1),m=-1;++m<h;)g|=e[m]^f[m];return 0===g}},{"./curves.json":87,"bn.js":60,elliptic:119,"parse-asn1":247,"safe-buffer":284}],91:[function(e,t,r){var i=Object.create||function(e){var t=function(){};return t.prototype=e,new t},n=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},a=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=i(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var o,c=10;try{var d={};Object.defineProperty&&Object.defineProperty(d,"x",{value:0}),o=0===d.x}catch(e){o=!1}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var a,s,o;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]):(s=e._events=i(null),e._eventsCount=0),o){if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(a=u(e))&&a>0&&o.length>a){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else o=s[t]=r,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function f(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=a.call(h,i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(!i)return[];var n=i[t];return n?"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):b(n,n.length):[]}function m(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function b(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}o?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');c=e}}):s.defaultMaxListeners=c,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){var t,r,i,n,a,s,o="error"===e;if(s=this._events)o=o&&null==s.error;else if(!o)return!1;if(o){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var c=new Error('Unhandled "error" event. ('+t+")");throw c.context=t,c}if(!(r=s[e]))return!1;var d="function"==typeof r;switch(i=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var i=e.length,n=b(e,i),a=0;a<i;++a)n[a].call(r)}(r,d,this);break;case 2:!function(e,t,r,i){if(t)e.call(r,i);else for(var n=e.length,a=b(e,n),s=0;s<n;++s)a[s].call(r,i)}(r,d,this,arguments[1]);break;case 3:!function(e,t,r,i,n){if(t)e.call(r,i,n);else for(var a=e.length,s=b(e,a),o=0;o<a;++o)s[o].call(r,i,n)}(r,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,i,n,a){if(t)e.call(r,i,n,a);else for(var s=e.length,o=b(e,s),c=0;c<s;++c)o[c].call(r,i,n,a)}(r,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(i-1),a=1;a<i;a++)n[a-1]=arguments[a];!function(e,t,r,i){if(t)e.apply(r,i);else for(var n=e.length,a=b(e,n),s=0;s<n;++s)a[s].apply(r,i)}(r,d,this,n)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,a,s,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=i(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(a=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,a=s;break}if(a<0)return this;0===a?r.shift():function(e,t){for(var r=t,i=r+1,n=e.length;i<n;r+=1,i+=1)e[r]=e[i];e.pop()}(r,a),1===r.length&&(n[e]=r[0]),n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.removeAllListeners=function(e){var t,r,a;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=i(null),this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=i(null):delete r[e]),this;if(0===arguments.length){var s,o=n(r);for(a=0;a<o.length;++a)"removeListener"!==(s=o[a])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=i(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(a=t.length-1;a>=0;a--)this.removeListener(e,t[a]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],92:[function(e,t,r){"use strict";var i=e("buffer").Buffer,n=e("buffer").SlowBuffer;function a(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}t.exports=a,a.install=function(){i.prototype.equal=n.prototype.equal=function(e){return a(this,e)}};var s=i.prototype.equal,o=n.prototype.equal;a.restore=function(){i.prototype.equal=s,n.prototype.equal=o}},{buffer:94}],93:[function(e,t,r){(function(e){(function(){t.exports=function(t,r){for(var i=Math.min(t.length,r.length),n=new e(i),a=0;a<i;++a)n[a]=t[a]^r[a];return n}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:94}],94:[function(e,t,r){(function(t){(function(){
9
9
  /*!
10
10
  * The buffer module from node.js, for the browser.
11
11
  *