samvyo-js-sdk 2.0.8 → 2.0.10

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,30 +1,13 @@
1
- /*
2
- * samvyo-js-sdk v2.0.8
3
- * This is the client js sdk for cutting-edge Samvyo real-time voice/video cloud.
4
- * Copyright: 2017-2025 sauravkp <saurav.codes@gmail.com>
5
- * License: Unlicensed
6
- */
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,n){function i(o,s){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=r[o]={exports:{}};t[o][0].call(d.exports,function(e){return i(t[o][1][e]||e)},d,d.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";var n=e("./lib/JsSdk_v1"),i=e("./lib/JsSdk"),a=e("./p2p/lib/P2pSdk");t.exports={JsSdk_v1:n.JsSdk_v1,JsSdk:i.JsSdk,P2pSdk:a.P2pSdk}},{"./lib/JsSdk":2,"./lib/JsSdk_v1":3,"./p2p/lib/P2pSdk":463}],2:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.JsSdk=void 0;var a=n(e("@babel/runtime/helpers/typeof")),o=n(e("@babel/runtime/helpers/objectWithoutProperties")),s=n(e("@babel/runtime/helpers/asyncToGenerator")),c=n(e("@babel/runtime/helpers/classCallCheck")),u=n(e("@babel/runtime/helpers/createClass")),d=n(e("@babel/runtime/helpers/possibleConstructorReturn")),l=n(e("@babel/runtime/helpers/getPrototypeOf")),f=n(e("@babel/runtime/helpers/inherits")),p=n(e("@babel/runtime/helpers/defineProperty")),h=n(e("@babel/runtime/regenerator")),m=T(e("mediasoup-client")),b=n(e("bowser")),v=e("./socket"),g=e("events"),y=n(e("./Logger")),_=e("./utils/queue"),w=e("./utils/sleep"),k=e("./utils/getRandomInt"),S=e("./utils/uuidv4"),x=(e("./utils/getVidScaleUrl"),e("./utils/verifyOutputQualites")),E=n(e("./utils/randomName")),P=e("./utils/chooseMedia"),R=T(e("jsonwebtoken")),M=(e("./utils/getUSerMediaConstraints"),e("./utils/constants")),C=e("./utils/verifyfileTypes");function T(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return(T=function(e,t){if(!t&&e&&e.__esModule)return e;var a,o,s={__proto__:null,default:e};if(null===e||"object"!=i(e)&&"function"!=typeof e)return s;if(a=t?n:r){if(a.has(e))return a.get(e);a.set(e,s)}for(var c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((o=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(o.get||o.set)?a(s,c,o):s[c]=e[c]);return s})(e,t)}var A=["senderPeerId","mediaTag","sender","audioStatus","videoStatus","senderParticipantType","type","producerPaused"];function I(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach(function(t){(0,p.default)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!e})()}var B,N=new y.default("Room"),F={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}}},U=new _.SocketQueue;r.JsSdk=function(e){function t(e){var r,n,i,a,u=e.peerId,f=e.roomId,v=e.outputData;return(0,c.default)(this,t),n=this,i=t,i=(0,l.default)(i),r=(0,d.default)(n,L()?Reflect.construct(i,a||[],(0,l.default)(n).constructor):i.apply(n,a)),(0,p.default)(r,"joinRoom",(0,s.default)(h.default.mark(function e(){var t,n,i,a,o,s,c,u,d,l,f,p,m,b,v,g,y,_,w,k,S,x,P,R,C,T,A,I,O,j,L,B,F,U,q,z,V,W,G,H,K,$,J,Y,X,Z,Q,ee,te,re,ne,ie,ae,oe,se,ce,ue,de,le,fe,pe,he,me,be,ve,ge,ye,_e=arguments;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=(t=_e.length>0&&void 0!==_e[0]?_e[0]:{}).peerName,i=void 0===n?null:n,a=t.produce,o=void 0===a||a,s=t.produceAudio,c=void 0===s||s,u=t.produceVideo,d=void 0===u||u,l=t.consume,f=void 0===l||l,p=t.videoResolution,m=void 0===p?"hd":p,b=t.forceVp8,v=void 0!==b&&b,g=t.forceVp9,y=void 0!==g&&g,_=t.forceH264,w=void 0!==_&&_,k=t.h264Profile,S=void 0===k?"high":k,x=t.forcePCMU,P=void 0!==x&&x,R=t.forcePCMA,C=void 0!==R&&R,T=t.forceFPS,A=void 0===T?25:T,I=t.enableWebcamLayers,O=void 0===I||I,j=t.numSimulcastStreams,L=void 0===j?3:j,B=t.autoGainControl,F=void 0===B||B,U=t.echoCancellation,q=void 0===U||U,z=t.noiseSuppression,V=void 0===z||z,W=t.sampleRate,G=void 0===W?44e3:W,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,ne=void 0===re?[2500,1250,500]:re,ie=t.audioDeviceId,ae=void 0===ie?null:ie,oe=t.videoDeviceId,se=void 0===oe?null:oe,ce=t.peerType,ue=void 0===ce?"participant":ce,de=t.roomType,le=void 0===de?M._security.roomType.CONFERENCING:de,fe=t.authenticationRequired,pe=void 0!==fe&&fe,he=t.password,me=void 0===he?null:he,be=t.roomDisplayName,ve=void 0===be?null:be,N.info("Going to join room"),["hd","vga","qvga"].includes(m)||(N.warn("Invalid video resolution value. setting it to default value of 'hd' "),m="hd"),"boolean"!=typeof o&&(N.warn("Produe should either be true or false"),o=Boolean(o)),"boolean"!=typeof c&&(N.warn("ProduceAudio should either be true or false"),c=Boolean(c)),"boolean"!=typeof d&&(N.warn("ProduceVideo should either be true or false"),d=Boolean(d)),"boolean"!=typeof f&&(N.warn("Consume should either be true or false"),f=Boolean(f)),"boolean"!=typeof v&&(N.warn("forceVp8 should either be true or false"),v=Boolean(v)),"boolean"!=typeof y&&(N.warn("forceVp9 should either be true or false"),y=Boolean(y)),"boolean"!=typeof w&&(N.warn("forceH264 should either be true or false"),w=Boolean(w)),["high","low"].includes(S.toLowerCase())||(N.warn("h264Profile should either be 'high' or 'low'"),S="high"),(!Number.isInteger(A)||Number.isInteger(A)&&(A>65||A<5))&&(N.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),A=25),"boolean"!=typeof O&&(N.warn("enableWebcamLayers should either be true or false"),O=Boolean(O)),(!Number.isInteger(L)||Number.isInteger(L)&&(L>3||L<1))&&(N.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})?N.debug("videoBitRates values are correct"):(N.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 P&&(N.warn("forcePCMU should either be true or false"),P=Boolean(P)),"boolean"!=typeof C&&(N.warn("forcePCMA should either be true or false"),C=Boolean(C)),"boolean"!=typeof F&&(N.warn("autoGainControl should either be true or false"),F=Boolean(F)),"boolean"!=typeof q&&(N.warn("echoCancellation should either be true or false"),q=Boolean(q)),"boolean"!=typeof V&&(N.warn("noiseSuppression should either be true or false"),V=Boolean(V)),(!Number.isInteger(G)||Number.isInteger(G)&&(G>64e3||G<8e3))&&(N.warn("sampleRate should be a number between 8000 to 64000, default value is 44000 Khz."),G=44e3),(!Number.isInteger(K)||Number.isInteger(K)&&(K>2||K<1))&&(N.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),K=1),"boolean"!=typeof X&&(N.warn("share should either be true or false"),X=Boolean(X)),"boolean"!=typeof Q&&(N.warn("shareAudio should either be true or false"),Q=Boolean(Q)),"boolean"!=typeof te&&(N.warn("enableSharingLayers should either be true or false"),te=Boolean(te)),Array.isArray(ne)&&ne.length>=1&&ne.length<=3&&ne.every(function(e){return Number.isInteger(e)&&e>=500&&e<=2500})?N.debug("shareBitRates values are correct"):(N.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]'"),ne=[2500,1250,500]),["moderator","participant","attendee"].includes(ue)?N.debug("peerType is valid:%s",ue):(ue="participant",N.debug("peerType is invalid:%s. By default set to: participant",ue)),e.next=1,r.listDevicesInternal();case 1:r._videoResolution=m,r._forceVP8=Boolean(v),r._forceH264=Boolean(w),r._forceVP9=Boolean(y),r._enableWebcamLayers=Boolean(O),r._numSimulcastStreams=L,r._enableSharingLayers=Boolean(te),e.prev=2,i||(i=(0,E.default)()),r.data.inputParams=D(D({},r.data.inputParams),{},{peerName:i,produce:o,produceAudio:c,produceVideo:d,consume:f,videoResolution:m,forceVp8:v,forceVp9:y,forceH264:w,h264Profile:S,forceFPS:A,forcePCMU:P,forcePCMA:C,enableWebcamLayers:O,numSimulcastStreams:L,autoGainControl:F,echoCancellation:q,noiseSuppression:V,sampleRate:G,channelCount:K,videoBitRates:J,share:X,shareAudio:Q,enableSharingLayers:te,shareBitRates:ne,audioDeviceId:ae,videoDeviceId:se,peerType:ue,roomType:le,authenticationRequired:pe,password:me,roomDisplayName:ve}),N.info("input params are:%O",r.data.inputParams),ge={id:"joinRoom",type:"r",peerId:r.data.inputParams.peerId,participantType:"attendee"===ue?"viewer":ue,roomType:le,roomDisplayName:ve||"room-".concat(1e5+Math.round(9e5*Math.random())),browser:r._client,name:r.data.inputParams.peerName,room:r.data.inputParams.roomId,authenticationRequired:pe,isRoomPassword:!!me,roomPassword:me||null,usageType:"sdk"},r._sendMessage(ge),e.next=4;break;case 3:return e.prev=3,ye=e.catch(2),N.error("Failed to join room:",ye.message),e.abrupt("return",{success:!1,reason:ye.message});case 4:case"end":return e.stop()}},e,null,[[2,3]])}))),(0,p.default)(r,"authenticateUser",function(e){N.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){N.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 N.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};N.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 N.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};N.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){N.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",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s={id:"customMessage",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,data:e,type:t,recieverPeerId:n,senderType:i,messageType:a,customData:o};N.debug("Room sendCustomMessage",s),r._sendMessage(s)}),(0,p.default)(r,"processCustomMessage",function(e){N.debug("Room processCustomMessage",e),r.emit("customMessage",e)}),(0,p.default)(r,"updateCId",function(e){N.debug("Received updateCId message",e),e.targetPeerId!==r.data.inputParams.peerId&&e.targetPeerId||r.emit("updateCId",{message:e,cId:e.cId,peerId:r.data.inputParams.peerId,isMyCId:e.targetPeerId===r.data.inputParams.peerId})}),(0,p.default)(r,"_createSendTransport",(0,s.default)(h.default.mark(function e(){var t,n;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("Room _createSendTransport"),e.prev=1,r._device.loaded){e.next=2;break}return N.debug("Room _createSendTransport","Going to load device with routerrtpcapabilities"),e.next=2,r._device.load({routerRtpCapabilities:r._routerRtpCapabilities});case 2:t=M.MSG_DIRECTION_SEND,r._sendTransport||r._sendMessage({id:"createTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,direction:t}),e.next=4;break;case 3:e.prev=3,n=e.catch(1),N.error("Room _createSendTransport",n);case 4:case"end":return e.stop()}},e,null,[[1,3]])}))),(0,p.default)(r,"_createRecvTransport",(0,s.default)(h.default.mark(function e(){var t;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r._device.loaded){e.next=1;break}return N.debug("loading device for creating recv transport"),e.next=1,r._device.load({routerRtpCapabilities:r._routerRtpCapabilities});case 1:t=M.MSG_DIRECTION_RECV,r._recvTransport||(N.debug("receive transport created"),r._sendMessage({id:"createTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,direction:t}));case 2:case"end":return e.stop()}},e)}))),(0,p.default)(r,"handleCreateTransportRequest",function(){var e=(0,s.default)(h.default.mark(function e(t){var n,i,a,o;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("Room handleCreateTransportRequest():%O",t),n=t.transportOptions,i=t.direction,a=void 0,e.prev=1,"recv"!==i){e.next=3;break}return e.next=2,r._device.createRecvTransport(n);case 2:a=e.sent,N.debug("Room","handleCreateTransportRequest() recv transport created ".concat(a.id)),r._recvTransport=a,r.handleRecvTransportListeners(),e.next=6;break;case 3:if("send"!==i){e.next=5;break}return e.next=4,r._device.createSendTransport(n);case 4:a=e.sent,N.debug("Room","handleCreateTransportRequest() send transport created [id:%s]".concat(a.id)),r._sendTransport=a,r.handleSendTransportListeners(),r.produceMedia(),e.next=6;break;case 5:throw new Error("bad transport 'direction': ".concat(i));case 6:e.next=8;break;case 7:e.prev=7,o=e.catch(1),console.error("handleCreateTransportRequest() failed to create transport [error:%o]",o);case 8:case"end":return e.stop()}},e,null,[[1,7]])}));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,s.default)(h.default.mark(function t(n){return h.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(N.debug("ConferenceRoom sendTransport connectionState ".concat(n," & socketconnection state ").concat(r._socket._ws.readyState)),"failed"!==n&&"disconnected"!==n){t.next=4;break}if(1!==r._socket._ws.readyState){t.next=1;break}e.restartIce(r._sendTransport.id,"send"),t.next=4;break;case 1:if(1===r._socket._ws.readyState){t.next=3;break}return N.debug("socket not yet ready with state- ".concat(r._socket._ws.readyState)),t.next=2,(0,w.sleep)(1500);case 2:t.next=1;break;case 3:"connected"===r._roomStatus&&r.restartIce(r._sendTransport.id,"send");case 4:N.debug("ConferenceRoom","send transport connection state change [state:%s]".concat(n));case 5:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}),(0,p.default)(r,"handleTransportConnectEvent",function(e,t,n){var i=e.dtlsParameters;try{U.push("connectTransport",function(e){N.debug("connect-transport action"),t(),U.remove("connectTransport")});var a={id:"connectTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,transportId:r._sendTransport.id,dtlsParameters:i,direction:"send"};r._sendMessage(a)}catch(e){N.error("handleTransportConnectEvent() failed [error:%o]",e),n(e)}}),(0,p.default)(r,"handleTransportProduceEvent",function(e,t,n){var i=e.kind,a=e.rtpParameters,o=e.appData;try{U.push("produce",function(e){N.debug("handleTransportProduceEvent callback [data:%o]",e),t({id:e.producerId}),U.remove("produce")});var s=o.mediaTag===M.STREAM_TYPE_CAM_AUDIO&&void 0!==r.data.inputParams.audioStatus&&!r.data.inputParams.audioStatus;N.debug("handleTransportProduceEvent() | pause status->".concat(s));var c={id:"sendTrack",transportId:r._sendTransport.id,peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,kind:i,rtpParameters:a,paused:s,appData:o,clientOs:r._client.os.name,browser:r._client.browser};r._sendMessage(c)}catch(e){N.error("handleTransportProduceEvent() failed [error:%o]",e),n(e)}}),(0,p.default)(r,"produceMedia",(0,s.default)(h.default.mark(function e(){return h.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}):N.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}):N.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}))):N.warn("produce is false!");case 1:case"end":return e.stop()}},e)}))),(0,p.default)(r,"handleRecvTransportListeners",(0,s.default)(h.default.mark(function e(){var t,n;return h.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,s.default)(h.default.mark(function e(n){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("ConferenceRoom recvTransport connectionState ".concat(n," & socketconnection state ").concat(r._socket._ws.readyState)),"failed"!==n&&"disconnected"!==n){e.next=4;break}if(1!==r._socket._ws.readyState){e.next=1;break}t.restartIce(r._recvTransport.id,"recv"),e.next=4;break;case 1:if(1===r._socket._ws.readyState){e.next=3;break}return N.debug("socket not yet ready with state- ".concat(r._socket._ws.readyState)),e.next=2,(0,w.sleep)(1e3);case 2:e.next=1;break;case 3:"connected"===r._roomStatus&&t.restartIce(r._recvTransport.id,"recv");case 4:N.debug("ConferenceRoom","Recv transport connection state change [state:%s]".concat(n));case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),n={id:"transportsAvailable",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,rtpCapabilities:r._device.rtpCapabilities},r._sendMessage(n);case 1:case"end":return e.stop()}},e)}))),(0,p.default)(r,"handleRecvTransportConnectEvent",function(e,t,n){var i=e.dtlsParameters;try{U.push("connectRecvTransport",function(e){N.debug("ConferenceRoom","connect-recv-transport action"),t(),U.remove("connectRecvTransport")});var a={id:"connectTransport",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,transportId:r._recvTransport.id,dtlsParameters:i,direction:"recv"};r._sendMessage(a)}catch(e){N.error("handleTransportConnectEvent() failed [error:%o]",e),n(e)}}),(0,p.default)(r,"handleRecvTrackRequest",function(){var e=(0,s.default)(h.default.mark(function e(t){var n,i,a,s,c,u,d,l,f,b;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("Room handleRecvTrackRequest",t),r.data.inputParams.consume){e.next=1;break}return N.warn("I do not want to consume"),e.abrupt("return");case 1:return n=t.senderPeerId,i=t.mediaTag,t.sender,t.audioStatus,t.videoStatus,t.senderParticipantType,a=t.type,s=t.producerPaused,c=(0,o.default)(t,A),N.debug("New consumer created",c),c.id=c.consumerId,delete c.consumerId,N.debug("ConferenceRoom","senderPeerId is ->".concat(n)),e.next=2,r._recvTransport.consume(D(D({},c),{},{streamId:"".concat(n,"-").concat("screen-video"===i||"screen-audio"===i?"share":"mic-webcam"),appData:{peerId:n,mediaTag:i}}));case 2:u=e.sent;case 3:if(!r._recvTransport||"connected"===r._recvTransport.connectionState){e.next=5;break}return N.debug("recv transport connstate".concat(r._recvTransport.connectionState)),e.next=4,(0,w.sleep)(100);case 4:e.next=3;break;case 5:return r._consumers.set(u.id,u),u.on("transportclose",function(){r._consumers.delete(u.id)}),d=m.parseScalabilityMode(u.rtpParameters.encodings[0].scalabilityMode),l=d.spatialLayers,f=d.temporalLayers,b=r._peers.get(r.data.inputParams.peerId),N.debug("Consumer created for sender peerId ".concat(n," for kind ").concat(u.kind," for receiver peerId ").concat(r.data.inputParams.peerId)),N.info("The old peer data is :%O",b),b?(b["screen-video"===i||"screen-audio"===i?"ss".concat(u.kind):u.kind]={consumerId:u.id,type:a,locallyPaused:!1,remotelyPaused:s,rtpParameters:u.rtpParameters,spatialLayers:l,temporalLayers:f,preferredSpatialLayer:l-1,preferredTemporalLayer:f-1,priority:1,codec:u.rtpParameters.codecs[0].mimeType.split("/")[1],track:u.track,share:"screen-video"===i||"screen-audio"===i},N.info("The new peer data is :%O",b),r._peers.set(r.data.inputParams.peerId,b)):(N.info("Peer not found!"),r._peers.set(r.data.inputParams.peerId,(0,p.default)({},"screen-video"===i||"screen-audio"===i?"ss".concat(u.kind):u.kind,{consumerId:u.id,type:a,locallyPaused:!1,remotelyPaused:s,rtpParameters:u.rtpParameters,spatialLayers:l,temporalLayers:f,preferredSpatialLayer:l-1,preferredTemporalLayer:f-1,priority:1,codec:u.rtpParameters.codecs[0].mimeType.split("/")[1],track:u.track,share:"screen-video"===i||"screen-audio"===i}))),e.next=6,r.resumeConsumer(u);case 6:N.debug("Going to emit mic start / videostart"),"audio"===u.kind?"screen-audio"===i?r.emit("ssAudioStart",{peerId:n,audioTrack:u.track,type:"remote"}):r.emit("micStart",{peerId:n,audioTrack:u.track,type:"remote"}):"video"===u.kind&&("screen-video"===i?r.emit("ssVideoStart",{peerId:n,videoTrack:u.track,type:"remote"}):r.emit("videoStart",{peerId:n,videoTrack:u.track,type:"remote"}));case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"resumeConsumer",function(){var e=(0,s.default)(h.default.mark(function e(t){var n,i;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return N.debug("resume consumer",t.appData.peerId,t.appData.mediaTag),e.prev=1,n={id:"resumeConsumer",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,consumerId:t.id},r._sendMessage(n),e.next=2,t.resume();case 2:e.next=4;break;case 3:e.prev=3,i=e.catch(1),console.error(i);case 4:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleConnectTransportRequest",function(){var e=(0,s.default)(h.default.mark(function e(t){var r,n;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("handleTransportConnectRequest()"),e.prev=1,r=U.get("connectTransport")){e.next=2;break}throw new Error("transport-connect action was not found");case 2:return e.next=3,r(t);case 3:e.next=5;break;case 4:e.prev=4,n=e.catch(1),console.error("handleTransportConnectRequest() failed [error:%o]",n);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleConnectRecvTransportRequest",function(){var e=(0,s.default)(h.default.mark(function e(t){var r,n;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("handleTransportConnectRequest()"),e.prev=1,r=U.get("connectRecvTransport")){e.next=2;break}throw new Error("recv transport-connect action was not found");case 2:return e.next=3,r(t);case 3:e.next=5;break;case 4:e.prev=4,n=e.catch(1),console.error("handleRecvTransportConnectRequest() failed [error:%o]",n);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"handleSendTrackRequest",function(){var e=(0,s.default)(h.default.mark(function e(t){var r,n;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("ConferenceRoom","handleProduceRequest()"),e.prev=1,r=U.get("produce")){e.next=2;break}throw new Error("produce action was not found");case 2:return e.next=3,r(t);case 3:e.next=5;break;case 4:e.prev=4,n=e.catch(1),N.error("handleProduceRequest() failed [error:%o]",n);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}()),(0,p.default)(r,"mediaToggled",function(e){switch(N.debug("Media Toggled message:%O",e),e.type){case"video":N.debug("mediaToggled() | inside case video".concat(e.videoStatus));break;case"audio":N.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,n=r._consumers.get(t);if(n){var i=n.appData,a=i.peerId,o=i.mediaTag;N.debug("Consumer closed for consumerId:%s, type:%s, appData:%o",t,null==n?void 0:n.kind,n.appData);var s="screen-audio"===o||"screen-video"===o?"ss".concat(n.kind):n.kind;n.close(),r._consumers.delete(t);var c=r._peers.get(r.data.inputParams.peerId);N.debug("Peer data before deletion:%O",c),c[s]&&c[s].consumerId===t&&delete c[s],N.debug("Peer data after deletion:%O",c),r._peers.set(r.data.inputParams.peerId,c),"audio"===(null==n?void 0:n.kind)?(N.debug("Going to emit micEnd, consumer closed for audio"),"screen-audio"===o?r.emit("ssAudioStop",{peerId:a,track:null,type:"remote"}):r.emit("micEnd",{peerId:a,track:null,type:"remote"})):"video"===(null==n?void 0:n.kind)&&(N.debug("Going to emit videoEnd, consumer closed for video"),"screen-video"===o?r.emit("ssVideoStop",{peerId:a,track:null,type:"remote"}):r.emit("videoEnd",{peerId:a,track:null,type:"remote"}))}else N.warn("Consumer with id not found!:%s",t)}),(0,p.default)(r,"peerLeft",function(e){N.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(){N.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(),N.debug("Video Track stopped")}),r._micStream&&r._micStream.getAudioTracks().forEach(function(e){e.stop(),N.debug("Mic Track stopped")}),r._roomStatus="closed",r._running=!1,r._routerRtpCapabilities=null}),(0,p.default)(r,"restartIce",function(){var e=(0,s.default)(h.default.mark(function e(t,n){var i;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!("send"===n&&"connected"===r._sendTransport.connectionState||"recv"===n&&"connected"===r._recvTransport.connectionState)){e.next=1;break}return N.debug("no need to restart ICE as transport now connected"),e.abrupt("return");case 1:N.debug("websocket is ready and connectionstate is still disconnected, therefore going to restart ICE"),i={id:"restartIce",transportId:t,roomName:r.data.inputParams.roomId,peerId:r.data.inputParams.peerId},r._sendMessage(i);case 2:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),(0,p.default)(r,"restartIceResponse",function(e){N.debug("restart ICE response:%o",e);var t=e.transportId,n=e.iceParameters;r._sendTransport&&r._sendTransport.id===t?r._sendTransport.restartIce({iceParameters:n}):r._recvTransport&&r._recvTransport.id===t&&r._recvTransport.restartIce({iceParameters:n})}),(0,p.default)(r,"startRecording",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.recordingType,n=void 0===t?null:t,i=e.outputType,a=void 0===i?null:i,o=e.outputQualities,s=void 0===o?null:o;N.debug("recording type requested is:%s,outputType:%s, outputQualties:%o",n,a,s);var c=!n||"av"!==(null==n?void 0:n.toLowerCase())&&"audiovideo"!==(null==n?void 0:n.toLowerCase())?M.MERGEA:M.MERGE;if((!a||"hls"!==a.toLowerCase()&&"mp4"!==a.toLowerCase())&&a)return N.error("Invalid outut type"),{success:!1,reason:"Invalid outputType: ".concat(a,". ")};if(a&&"hls"===a.toLowerCase()&&s&&!(0,x.isValidOutputQualities)(s))return N.error("Invalid outut qualities"),{success:!1,reason:"Invalid outputQualities: ".concat(JSON.stringify(s),". ")+"Allowed values are ".concat(Array.from(x.ALLOWED_QUALITIES).join(", "),".")};var u={id:"startRecording",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,url:window.location.hostname,type:M.RECORD,recordingStrategy:c,outputQualities:s,outputType:null==a?void 0:a.toLowerCase()};r._sendMessage(u),r._recordingStartedByMe=D(D({},r._recordingStartedByMe),{},{"main-room":{recordingNo:null}})}),(0,p.default)(r,"stopRecording",function(){N.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:M.RECORD};r._sendMessage(t),delete r._recordingStartedByMe[e],r.emit("recordingEnded",{peerId:r.data.inputParams.peerId})}),(0,p.default)(r,"setRecordingStatusStarted",function(e){N.debug("Recording/Streaming started by moderator!!:%O",e);e.breakOutRoom;var t=e.recordingStartTime,n=e.recordingNo,i=e.type;[M.RECORD,M.RTMPSTREAMANDRECORD].includes(i)&&(r._recordingStartedByMe["main-room"]?(N.debug("This recording has been started by me."),r._recordingStartedByMe["main-room"].recordingNo=n,r.emit("recordingStarted",{peerId:r.data.inputParams.peerId,startTime:t})):r.emit("recordingStarted",{startTime:t}))}),(0,p.default)(r,"setRecordingStatusEnded",function(e){N.debug("Recording ended by moderator!!, data:%O",e);e.breakOutRoom;e.type===M.RTMPSTREAM||r.emit("recordingEnded",{})}),(0,p.default)(r,"startProcessing",(0,s.default)(h.default.mark(function e(){var t,n,i,a,o,s,c,u,d,l,f,m,b,v,g,y,_,w,k,S=arguments;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=(t=S.length>0&&void 0!==S[0]?S[0]:{}).inputFiles,i=void 0===n?[]:n,a=t.outputQualities,o=void 0===a?null:a,s=t.bucket,c=void 0===s?null:s,u=t.cloud,d=void 0===u?null:u,l=t.region,f=void 0===l?null:l,N.debug("Processing of Files requested for:%o",i),m=Math.round(1e7*Math.random()),e.next=1,(0,C.verifyFiles)(i);case 1:if(!(b=e.sent).success){e.next=3;break}if(!o||(0,x.isValidOutputQualities)(o)){e.next=2;break}return N.error("Invalid outut qualities"),e.abrupt("return",{success:!1,reason:"Invalid outputQualities: ".concat(JSON.stringify(o),". ")+"Allowed values are ".concat(Array.from(x.ALLOWED_QUALITIES).join(", "),".")});case 2:r._processingStartedByMe=D(D({},r._processingStartedByMe),{},(0,p.default)({},m,{})),v=I(i);try{for(v.s();!(g=v.n()).done;)y=g.value,_=y.type,w=y.url,r._processingStartedByMe=D(D({},r._processingStartedByMe),{},(0,p.default)({},m,D(D({},r._processingStartedByMe[m]),{},(0,p.default)({},w,{type:_,url:w,status:"pending"}))))}catch(e){v.e(e)}finally{v.f()}return k={id:"processVideos",peerId:r.data.inputParams.peerId,roomName:r.data.inputParams.roomId,inputFiles:i,outputQualities:o,bucket:c,cloud:d,region:f,requestId:m,type:M.PROCESS},r._sendMessage(k),e.abrupt("return",{success:!0});case 3:return e.abrupt("return",b);case 4:case"end":return e.stop()}},e)}))),(0,p.default)(r,"checkProcessingStatus",function(e){var t=e.requestId;return N.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,n=(e.processingNo,e.requestId);N.debug("handleProcessingStart()| received message is:%o",e),r.emit("processingStarted",{processingStartTime:t,requestId:n})}),(0,p.default)(r,"handleProcessingCompletion",function(e){var t=e.totalProcessingTime,n=e.hlsfileKey,i=e.size,a=e.originalFile,o=e.lastFile,s=e.requestId;if(N.debug("handleProcessingCompletion()| received message is:%o",e),N.debug("Before update, Total files to be processed are:%o",r._processingStartedByMe),r._processingStartedByMe[a]&&(r._processingStartedByMe=D(D({},r._processingStartedByMe),{},(0,p.default)({},s,D(D({},r._processingStartedByMe[s]),{},(0,p.default)({},a,D(D({},r._processingStartedByMe[a]),{},{status:"completed",hlsfileKey:n,size:i,totalProcessingTime:t})))))),N.debug("After update, Total files to be processed are:%o",r._processingStartedByMe),r.emit("processingCompleted",e),o){N.debug("The last file processing has been completed! Remove all the files that has been completed with the same requesterId");var c=D({},r._processingStartedByMe);delete c[s],N.debug("After deleting the current requestId:%o",c),r._processingStartedByMe=c}}),(0,p.default)(r,"handleProcessingError",function(e){var t=e.totalProcessingTime,n=e.hlsfileKey,i=e.size,a=e.originalFile,o=(e.lastFile,e.requestId),s=e.error;N.debug("handleProcessingCompletion()| received message is:%o",e),N.debug("Before update, Total files to be processed are:%o",r._processingStartedByMe),r._processingStartedByMe[a]&&(r._processingStartedByMe=D(D({},r._processingStartedByMe),{},(0,p.default)({},o,D(D({},r._processingStartedByMe[o]),{},(0,p.default)({},a,D(D({},r._processingStartedByMe[a]),{},{status:"error",hlsfileKey:n,size:i,totalProcessingTime:t,error:s})))))),N.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=D(D({},v),{},{inputParams:{peerId:u,roomId:f,roomType:"conferencing"}}),r._micStream=null,r._webCamStream=null,r._webcam={device:null,resolution:"hd"},r._mic={device:null},r._deviceList=B||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:(Q=(0,s.default)(h.default.mark(function e(){var t;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=m.detectDevice(),N.debug("The device is:%O",t),e.next=1,this._initSocket();case 1:case"end":return e.stop()}},e,this)})),function(){return Q.apply(this,arguments)})},{key:"_initSocket",value:(Z=(0,s.default)(h.default.mark(function e(){var t,r,n,i=this;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this,r=this.data.signallingServerUrl.replace(/^(http|https):\/\//,""),n="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),N.info("Going to create a new socket! with address: ".concat(r)),this._socket=new v.WebSocketTransport(n,!0),this._listenToSocket(),this._socket.on("notify",function(e){var t=e.type,r=e.title,n=e.message;i.emit("notification",{eventType:t,eventText:"".concat(r,": ").concat(n),roomId:i.data.inputParams.roomId,peerId:i.data.inputParams.peerId})}),this._socket.on("roomStartedP2p",function(e){N.info("P2P room successfully started"),i._running=!0}),this._socket.on("userError",function(e){N.error("User Error happened with message:%O",e),t.emit("notification",{eventType:e.title,eventText:"".concat(e.text)})}),this._socket.on("validationAlert",function(e){N.info("Validation alert happened")}),this._socket.on("alreadyActive",function(e){e.title,e.text,i.emit("notification",{eventType:"alreadyActive",eventText:"This peer already has an active connection",roomId:i.data.inputParams.roomId,peerId:i.data.inputParams.peerId})}),this._socket.on("passwordDisabled",function(){N.info("password disabled by moderator!"),i.emit("notification",{eventType:"passwordDisabled",eventText:"Password for this room has been disabled by moderator",roomId:i.data.inputParams.roomId})}),this._socket.on("close",function(e){var t=e.code,r=e.reason;if(N.info("socket closed with code ".concat(t)),4500!==t&&4100!==t){var n=r||"Connection to server closed unexpectedly! Trying to reconnect.";N.info("socket close code is".concat(t," with reason ").concat(n))}else N.info("Socket is now closed!"),i.close()}),this._socket.on("connected",(0,s.default)(h.default.mark(function e(){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:N.info("Socket connected"),t.pc&&t._sendTransport&&t._recvTransport?roomType===M._security.roomType.P2P&&t.pc?(N.info("Socket seems to be reconnected in mid call! RestartIce needed for p2p call."),"failed"!==t.pc.iceConnectionState&&"disconnected"!==t.pc.iceConnectionState||t.restartICE()):(N.debug("Ice restarts for mediasoup transports for a joined peer"),t._sendTransport&&["Failed","disconnected"].includes(t._sendTransport.connectionState)?(N.debug("Restart ice for sendtransport"),t.restartIce(t._sendTransport.id,"send")):N.error("Send transport not available!"),t._recvTransport&&["Failed","disconnected"].includes(t._recvTransport.connectionState)?(N.debug("Restart ice for recvtransport"),t.restartIce(t._recvTransport.id,"recv")):N.error("Recv transport not available!")):(N.info("Connection getting connected for first time"),i.emit("initSuccess"));case 1:case"end":return e.stop()}},e)}))),this._socket.on("defaultJoinStatus",function(){var e=(0,s.default)(h.default.mark(function e(t){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:N.info(" Socket defaultjoinstatus:%O",t);case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}},e,this)})),function(){return Z.apply(this,arguments)})},{key:"_sendMessage",value:function(e){this._socket.send(D({usageType:"sdk"},e))}},{key:"_listenToSocket",value:function(){var e=this;this._socket.on("message",function(t){try{switch("currentlyActiveSpeaker"===t.id||"allStats"===t.id||N.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"updateCId":e.updateCId(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":N.debug("inside offer"),e.handleOffer(t);break;case"answer":N.debug("inside answer"),e.handleAnswer(t);break;case"candidate":N.debug("inside handle candidate"),e.handleCandidate(t.candidate);break;case"p2pRoomClosed":N.debug("inside p2p room close"),e.leaveRoomNewP2p(M.ROOM_LEAVE_AND_CLOSE);break;case"p2pUserLeft":N.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:N.warn("Unrecognized message:%o",t)}}catch(e){N.error("listentomessage:%O",e)}})}},{key:"onNewPeer",value:function(e){var t=e.peerId,r=e.displayName,n=e.participantType;this._peers.set(t,{displayName:r,participantType:n,consumers:[]}),this.emit("newPeer",{peerId:t,peerName:r,type:this.data.inputParams.peerId===t?"local":"remote",peerRole:n})}},{key:"onExistingParticipants",value:(X=(0,s.default)(h.default.mark(function e(t){var r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.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=2;break}return e.next=1,this._createSendTransport();case 1:e.next=3;break;case 2:N.debug("Produce is false!");case 3:if(!this.data.inputParams.consume){e.next=5;break}return e.next=4,this._createRecvTransport();case 4: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=6;break;case 5:N.debug("Consume is false!");case 6:case"end":return e.stop()}},e,this)})),function(e){return X.apply(this,arguments)})},{key:"setCurrentlyActiveSpeaker",value:function(e){var t=e.activeSpeaker,r=t.peerId,n=t.volume;this._activeSpeaker=e.activeSpeaker,this.emit("activeSpeaker",{peerId:r,volume:n})}},{key:"close",value:function(){this._closed||(this._closed=!0,this._socket=null,this.data.inputParams={},N.info("Room close()"),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed",this._running=!1)}},{key:"leaveRoom",value:(Y=(0,s.default)(h.default.mark(function e(){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:N.debug("Leave room is called!!"),"connected"===this._roomStatus?(this._sendMessage({id:"leaveRoomNew",peerId:this.data.inputParams.peerId,roomLeaveType:"client"}),this.leaveRoomCommon()):N.error("The room state is:%s",this._roomStatus);case 1:case"end":return e.stop()}},e,this)})),function(){return Y.apply(this,arguments)})},{key:"closeRoom",value:(J=(0,s.default)(h.default.mark(function e(){return h.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()):N.error("The room state is:%s",this._roomStatus);case 1:case"end":return e.stop()}},e,this)})),function(){return J.apply(this,arguments)})},{key:"listDevicesInternal",value:($=(0,s.default)(h.default.mark(function e(){var t,r=this;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices.ondevicechange=function(){var e=(0,s.default)(h.default.mark(function e(t){var n;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,(0,P.updatedDeviceList)();case 1:n=e.sent,N.info("Media devices changed!:%O",n),n.audioDevices&&n.audioDevices.length>0&&(r._deviceList.audioDevices=n.audioDevices),n.videoDevices&&n.videoDevices.length>0&&(r._deviceList.videoDevices=n.videoDevices),n.audioDevices&&n.audioDevices.length>0&&(r._deviceList.audioOutputDevices=n.audioDevicesOutput),B=r._deviceList,r.emit("deviceListUpdated");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!this._deviceList){e.next=1;break}return e.abrupt("return");case 1:return e.next=2,(0,P.loadAllAvailableDevices)();case 2:if(!(t=e.sent).success){e.next=3;break}return this._deviceList=t.deviceList,B=this._deviceList,e.abrupt("return");case 3:case"end":return e.stop()}},e,this)})),function(){return $.apply(this,arguments)})},{key:"enableMic",value:(K=(0,s.default)(h.default.mark(function e(){var t,r,n,i,a,o,s,c,u,d,l,f,p,m,b=this,v=arguments;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=v.length>0&&void 0!==v[0]?v[0]:{}).deviceId,n=void 0===r?null:r,i=t.autoGainControl,a=t.noiseSuppression,o=t.echoCancellation,s=t.channelCount,c=t.sampleRate,u=t.forcePCMU,d=t.forcePCMA,N.debug("enableMic()"),this.data.inputParams.produce){e.next=1;break}return N.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 1:if("connected"===this._roomStatus){e.next=2;break}return N.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 2:if(!this._micProducer){e.next=3;break}return N.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 3:if(this._device.canProduce("audio")){e.next=4;break}return N.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 4:if(u&&"boolean"==typeof u&&(this.data.inputParams.forcePCMU=u),d&&"boolean"==typeof d&&(this.data.inputParams.forcePCMA=d),i&&"boolean"==typeof i&&(this.data.inputParams.autoGainControl=i),o&&"boolean"==typeof o&&(this.data.inputParams.echoCancellation=o),a&&"boolean"==typeof a&&(this.data.inputParams.noiseSuppression=a),c&&Number.isInteger(c)&&c<64e3&&c>8e3&&(this.data.inputParams.sampleRate=c),s&&Number.isInteger(s)&&s>0&&s<3&&(this.data.inputParams.channelCount=s),e.prev=5,this._externalVideo){e.next=11;break}if(n?(f=this._deviceList.audioDevices.find(function(e){return e.deviceId===n}))||(N.warn("Selected audio input deviceId:%s not found",n),f=this._deviceList.audioDevices[0]):f=this._deviceList.audioDevices[0],this._mic.device=f,f){e.next=6;break}return N.error("No mic device found! Can't start audio!"),e.abrupt("return",{success:!1,reason:"No mic available for starting audio!"});case 6:return n&&this.data.inputParams.audioDeviceId!==n&&(this.data.inputParams.audioDeviceId=n),N.debug("enableMic() | calling getUserMedia()"),e.prev=7,e.next=8,navigator.mediaDevices.getUserMedia({audio:{deviceId:{exact: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 8:this._micStream=e.sent,l=this._micStream.getAudioTracks()[0],e.next=10;break;case 9:throw e.prev=9,p=e.catch(7),new Error("Error while acquiring mic. Possible issue with audio constraint values",p);case 10:e.next=13;break;case 11:return e.next=12,this._getExternalVideoStream();case 12:this._micStream=e.sent,l=this._micStream.getAudioTracks()[0].clone();case 13:return e.next=14,this._sendTransport.produce({track:l,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 14: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(){b._micProducer=null}),this._micProducer.on("trackended",function(){b.disableMic().catch(function(){})}),e.next=16;break;case 15:e.prev=15,m=e.catch(5),N.error("enableMic() | failed:%o",m),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),l&&l.stop();case 16:case"end":return e.stop()}},e,this,[[5,15],[7,9]])})),function(){return K.apply(this,arguments)})},{key:"disableMic",value:(H=(0,s.default)(h.default.mark(function e(){var t;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach(function(e){return e.stop()}),this._micProducer){e.next=1;break}return e.abrupt("return");case 1: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 2:case"end":return e.stop()}},e,this)})),function(){return H.apply(this,arguments)})},{key:"muteMic",value:(G=(0,s.default)(h.default.mark(function e(){var t;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:N.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){N.error("muteMic() | failed: %o",e),this.emit("error",{code:"EID004",text:"Error muting local microphone!"})}case 1:case"end":return e.stop()}},e,this)})),function(){return G.apply(this,arguments)})},{key:"unmuteMic",value:(W=(0,s.default)(h.default.mark(function e(){var t;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:N.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){N.error("unmuteMic() | failed: %o",e),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"})}case 1:case"end":return e.stop()}},e,this)})),function(){return W.apply(this,arguments)})},{key:"enableCam",value:(V=(0,s.default)(h.default.mark(function e(){var t,r,n,i,a,o,s,c,u,d,l,f,p,m,b,v,g,y,_,w,k=this,S=arguments;return h.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,n=void 0===r?null:r,i=t.videoResolution,a=t.forceVp8,o=t.forceVp9,s=t.forceH264,c=t.h264Profile,u=t.forceFPS,d=t.enableWebcamLayers,l=t.numSimulcastStreams,f=t.videoBitRates,N.debug("enableWebcam()"),this.data.inputParams.produce){e.next=1;break}return N.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 1:if("connected"===this._roomStatus){e.next=2;break}return N.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 2:if(!this._webcamProducer){e.next=3;break}return N.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 3:if(this._device.canProduce("video")){e.next=4;break}return N.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 4:if(["hd","vga","qvga"].includes(i)&&(this.data.inputParams.videoResolution=i,this._webcam.resolution=i),a&&"boolean"==typeof a&&(this.data.inputParams.forceVp8=a),o&&"boolean"==typeof o&&(this.data.inputParams.forceVp9=o),s&&"boolean"==typeof s&&(this.data.inputParams.forceH264=s),c&&["high","low"].includes(c.toLowerCase())&&(this.data.inputParams.h264Profile=c),u&&Number.isInteger(u)&&u<65&&u>5&&(this.data.inputParams.forceFPS=25),d&&"boolean"==typeof d&&(this.data.inputParams.enableWebcamLayers=d,this._enableWebcamLayers=d),l&&Number.isInteger(l)&&l<4&&l>0&&(this.data.inputParams.numSimulcastStreams=l,this._numSimulcastStreams=l),Array.isArray(f)&&f.length>=1&&f.length<=3&&f.every(function(e){return Number.isInteger(e)&&e>=75&&e<=800})?(N.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=f):N.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=5,this._externalVideo){e.next=8;break}if(n?(m=this._deviceList.videoDevices.find(function(e){return e.deviceId===n}))||(N.warn("Selected deviceId:%s not found",n),m=this._deviceList.videoDevices[0]):m=this._deviceList.videoDevices[0],this._webcam.device=m,b=this._webcam.resolution,m){e.next=6;break}return N.error("No wencam device found! Can't start video!"),e.abrupt("return",{success:!1,reason:"No Webcam available for starting video!"});case 6:return n&&this.data.inputParams.videoDeviceId!==n&&(this.data.inputParams.videoDeviceId=n),N.debug("enableWebcam() | calling getUserMedia()"),e.next=7,navigator.mediaDevices.getUserMedia({video:D(D({deviceId:{exact:m.deviceId}},F[b]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 7:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0],e.next=10;break;case 8:return m={label:"external video"},e.next=9,this._getExternalVideoStream();case 9:this._webCamStream=e.sent,p=this._webCamStream.getVideoTracks()[0].clone();case 10:if(y={videoGoogleStartBitrate:1e3},N.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),!this._forceVP8){e.next=12;break}if(g=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp8"===e.mimeType.toLowerCase()})){e.next=11;break}throw new Error("desired VP8 codec+configuration is not supported");case 11:e.next=16;break;case 12:if(!this._forceH264){e.next=15;break}if("high"===this.data.inputParams.h264Profile?g=this._device.rtpCapabilities.codecs.find(function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]}):"low"===this.data.inputParams.h264Profile&&(g=this._device.rtpCapabilities.codecs.find(function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]})),g){e.next=13;break}throw new Error("desired H264 codec+configuration is not supported");case 13:N.debug("Selected h264 codec is:%O",g);case 14:e.next=16;break;case 15:if(!this._forceVP9){e.next=16;break}if(g=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp9"===e.mimeType.toLowerCase()})){e.next=16;break}throw new Error("desired VP9 codec+configuration is not supported");case 16:return this._enableWebcamLayers&&(_=this._device.rtpCapabilities.codecs.find(function(e){return"video"===e.kind}),this._forceVP9&&g||"video/vp9"===_.mimeType.toLowerCase()?v=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(v=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&v.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&v.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))),e.next=17,this._sendTransport.produce({track:p,encodings:v,codecOptions:y,codec:g,appData:{mediaTag:"cam-video"}});case 17: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(){k._webcamProducer=null}),this._webcamProducer.on("trackended",function(){k.disableCam().catch(function(){})}),e.next=19;break;case 18:e.prev=18,w=e.catch(5),N.error("enableWebcam() | failed:%o",w),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),p&&p.stop();case 19:case"end":return e.stop()}},e,this,[[5,18]])})),function(){return V.apply(this,arguments)})},{key:"disableCam",value:(z=(0,s.default)(h.default.mark(function e(){var t;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("disableWebcam()"),this._webcamProducer){e.next=1;break}return e.abrupt("return");case 1: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 2:case"end":return e.stop()}},e,this)})),function(){return z.apply(this,arguments)})},{key:"_updateWebcams",value:(q=(0,s.default)(h.default.mark(function e(){var t,r,n,i,a,o,s,c;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return N.debug("_updateWebcams()"),this._webcams=new Map,N.debug("_updateWebcams() | calling enumerateDevices()"),e.next=1,navigator.mediaDevices.enumerateDevices();case 1:t=e.sent,r=I(t),e.prev=2,r.s();case 3:if((n=r.n()).done){e.next=6;break}if("videoinput"===(i=n.value).kind){e.next=4;break}return e.abrupt("continue",5);case 4:this._webcams.set(i.deviceId,i);case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,c=e.catch(2),r.e(c);case 8:return e.prev=8,r.f(),e.finish(8);case 9:a=Array.from(this._webcams.values()),o=a.length,s=this._webcam.device?this._webcam.device.deviceId:void 0,N.debug("_updateWebcams() [webcams:%o]",a),0===o?this._webcam.device=null:this._webcams.has(s)||(this._webcam.device=a[0]);case 10:case"end":return e.stop()}},e,this,[[2,7,8,9]])})),function(){return q.apply(this,arguments)})},{key:"_getExternalVideoStream",value:(j=(0,s.default)(h.default.mark(function e(){var t=this;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._externalVideoStream){e.next=1;break}return e.abrupt("return",this._externalVideoStream);case 1:if(!(this._externalVideo.readyState<3)){e.next=2;break}return e.next=2,new Promise(function(e){return t._externalVideo.addEventListener("canplay",e)});case 2:if(!this._externalVideo.captureStream){e.next=3;break}this._externalVideoStream=this._externalVideo.captureStream(),e.next=5;break;case 3:if(!this._externalVideo.mozCaptureStream){e.next=4;break}this._externalVideoStream=this._externalVideo.mozCaptureStream(),e.next=5;break;case 4:throw new Error("video.captureStream() not supported");case 5:return e.abrupt("return",this._externalVideoStream);case 6:case"end":return e.stop()}},e,this)})),function(){return j.apply(this,arguments)})},{key:"_getWebcamType",value:function(e){return/(back|rear)/i.test(e.label)?(N.debug("_getWebcamType() | it seems to be a back camera"),"back"):(N.debug("_getWebcamType() | it seems to be a front camera"),"front")}},{key:"changeVideoInput",value:(O=(0,s.default)(h.default.mark(function e(t){var r,n,i,a;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,n=t.deviceId,i=t.fps,!this._webcamProducer){e.next=2;break}return e.next=1,this._changeVideoInput({resolution:r,deviceId:n,fps:i});case 1:return a=e.sent,e.abrupt("return",a);case 2:return N.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 3:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"_changeVideoInput",value:(T=(0,s.default)(h.default.mark(function e(t){var r,n,i,a,o,s,c;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,n=t.deviceId,i=t.fps,N.info("_changeVideoInput() | Inside"),r&&["hd","vga","qvga"].includes(r)?this._webcam.resolution=r:N.warn("Invalid video resolution value "),i&&Number.isInteger(i)&&i<65&&i>5?this.data.inputParams.forceFPS=i:N.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),a=this._deviceList.videoDevices.find(function(e){return n&&e.deviceId===n})){e.next=1;break}return N.error("The selected deviceId not found!"),e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 1:return this._webcam.device=a,e.prev=2,this._webCamStream.getVideoTracks().forEach(function(e){return e.stop()}),this._webCamStream=null,N.debug("changeVideoInput() | calling getUserMedia()"),e.next=3,navigator.mediaDevices.getUserMedia({video:D(D({deviceId:{exact:a.deviceId}},F[this._webcam.resolution]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 3:return this._webCamStream=e.sent,o=this._webCamStream.getVideoTracks()[0],N.debug("The new video track is:%O",o),e.next=4,this._webcamProducer.replaceTrack({track:o});case 4:return(s=this._producers.get("video")).deviceLabel=a.label,s.type=this._getWebcamType(a),s.track=this._webcamProducer.track,N.debug("Updated producer values are:%O",s),this._producers.set("video",s),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 5:return e.prev=5,c=e.catch(2),N.error("Error while changing input:%O",c),e.abrupt("return",{success:!1,reason:"Couldn't change video input",error:c});case 6:case"end":return e.stop()}},e,this,[[2,5]])})),function(e){return T.apply(this,arguments)})},{key:"changeAudioInput",value:(_=(0,s.default)(h.default.mark(function e(t){var r,n,i,a,o,s,c;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,n=t.echoCancellation,i=t.noiseSuppression,a=t.sampleRate,o=t.channelCount,s=t.deviceId,!this._micProducer){e.next=2;break}return e.next=1,this._changeAudioInput({autoGainControl:r,echoCancellation:n,noiseSuppression:i,sampleRate:a,channelCount:o,deviceId:s});case 1:return c=e.sent,e.abrupt("return",c);case 2: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 3:case"end":return e.stop()}},e,this)})),function(e){return _.apply(this,arguments)})},{key:"_changeAudioInput",value:(y=(0,s.default)(h.default.mark(function e(t){var r,n,i,a,o,s,c,u,d,l;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,n=t.echoCancellation,i=t.noiseSuppression,a=t.sampleRate,o=t.channelCount,s=t.deviceId,r&&"boolean"==typeof r&&(this.data.inputParams.autoGainControl=r),n&&"boolean"==typeof n&&(this.data.inputParams.echoCancellation=Boolean(n)),i&&"boolean"==typeof i&&(this.data.inputParams.noiseSuppression=Boolean(i)),a&&Number.isInteger(a)&&a<64e3&&a>8e3&&(this.data.inputParams.sampleRate=a),o&&Number.isInteger(o)&&o>0&&o<3&&(this.data.inputParams.channelCount=o),c=this._deviceList.audioDevices.find(function(e){return s&&e.deviceId===s})){e.next=1;break}return e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 1:return this._mic.device=c,this._micStream&&this._micStream.getAudioTracks().forEach(function(e){return e.stop()}),this._micStream=null,e.prev=2,e.next=3,navigator.mediaDevices.getUserMedia({audio:{deviceId:{exact:c.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 3:return this._micStream=e.sent,u=this._micStream.getAudioTracks()[0],this._micProducer.replaceTrack({track:u}),(d=this._producers.get("audio")).deviceLabel=c.label,d.track=this._micProducer.track,N.debug("Updated producer values are:%O",d),this._producers.set("audio",d),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 4:return e.prev=4,l=e.catch(2),N.error("Error while changing input:%O",l),e.abrupt("return",{success:!1,reason:"Couldn't change audio input",err:l});case 5:case"end":return e.stop()}},e,this,[[2,4]])})),function(e){return y.apply(this,arguments)})},{key:"enableShare",value:(g=(0,s.default)(h.default.mark(function e(){var t,r,n,i,a,o,s,c,u,d,l,f,p,m,b,v=this,g=arguments;return h.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,n=void 0!==r&&r,i=t.enableSharingLayers,a=void 0===i||i,o=t.shareBitRates,s=void 0===o?[2500,1250,500]:o,N.debug("enableShare()"),this.data.inputParams.produce){e.next=1;break}return N.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 1:if("connected"===this._roomStatus){e.next=2;break}return N.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 2:if(!this._shareProducer){e.next=3;break}return N.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 3:if(this._device.canProduce("video")){e.next=4;break}return N.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 4:return this._enableSharingLayers="boolean"!=typeof a?Boolean(a):a,Array.isArray(s)&&s.length>=1&&s.length<=3&&s.every(function(e){return Number.isInteger(e)&&e>=500&&e<=2500})?this.data.inputParams.shareBitRates=s:this.data.inputParams.shareBitRates=[2500,1250,500],e.prev=5,N.debug("enableShare() | calling getDisplayMedia()"),e.next=6,navigator.mediaDevices.getDisplayMedia({audio:!!n,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});case 6:if(d=e.sent){e.next=7;break}return N.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 7:if(!(u=d.getAudioTracks()[0])){e.next=9;break}return e.next=8,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 8: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 9:if(c=d.getVideoTracks()[0],p={videoGoogleStartBitrate:1e3},!this._forceVP8){e.next=11;break}if(f=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp8"===e.mimeType.toLowerCase()})){e.next=10;break}throw new Error("desired VP8 codec+configuration is not supported");case 10:e.next=15;break;case 11:if(!this._forceH264){e.next=14;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=12;break}throw new Error("desired H264 codec+configuration is not supported");case 12:N.debug("Selected h264 codec is:%O",f);case 13:e.next=15;break;case 14:if(!this._forceVP9){e.next=15;break}if(f=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp9"===e.mimeType.toLowerCase()})){e.next=15;break}throw new Error("desired VP9 codec+configuration is not supported");case 15:return this._enableSharingLayers&&(m=this._device.rtpCapabilities.codecs.find(function(e){return"video"===e.kind}),this._forceVP9&&f||"video/vp9"===m.mimeType.toLowerCase()?l=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(l=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&l.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&l.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))),e.next=16,this._sendTransport.produce({track:c,encodings:l,codecOptions:p,codec:f,appData:{mediaTag:"screen-video"}});case 16: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(){v._shareProducer=null}),this._shareProducer.on("trackended",function(){v.disableShare().catch(function(){})}),e.next=18;break;case 17:e.prev=17,b=e.catch(5),N.error("enableShare() | failed:%o",b),"NotAllowedError"!==b.name&&this.emit("error",{code:"EID014",text:"Error while trying to start screen share. Error is: ".concat(b,"!")}),c&&c.stop();case 18:case"end":return e.stop()}},e,this,[[5,17]])})),function(){return g.apply(this,arguments)})},{key:"disableShare",value:(i=(0,s.default)(h.default.mark(function e(){var t,r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(N.debug("disableShare()"),this._shareProducer){e.next=1;break}return N.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 1: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 2:case"end":return e.stop()}},e,this)})),function(){return i.apply(this,arguments)})}],[{key:"listDevices",value:(n=(0,s.default)(h.default.mark(function e(){var t;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!B){e.next=1;break}return N.info("Device list already exists:%O",B),e.abrupt("return",{success:!0,deviceList:B});case 1:return e.next=2,(0,P.loadAllAvailableDevices)();case 2:if(!(t=e.sent).success){e.next=3;break}return B=t.deviceList,e.abrupt("return",{success:!0,deviceList:t.deviceList});case 3:return e.abrupt("return",{success:!1,reason:t.reason});case 4:case"end":return e.stop()}},e)})),function(){return n.apply(this,arguments)})},{key:"init",value:(r=(0,s.default)(h.default.mark(function e(){var r,n,i,o,s,c,u,d,l,f,p,m=arguments;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(r=m.length>0&&void 0!==m[0]?m[0]:{}).sessionToken,i=r.roomId,o=r.peerId,n){e.next=1;break}throw new Error("Session token is required to join the room.");case 1:e.prev=1,N.info("session token:%s",n),e.prev=2,s=R.default.verify(n,"samvyo_tech_321",{algorithms:["HS256"]}),N.info("Decoded token:",s),e.next=7;break;case 3:if(e.prev=3,f=e.catch(2),N.error("JWT verification failed:",f),"JsonWebTokenError"!==f.name){e.next=4;break}throw new Error("Invalid session token: "+f.message);case 4:if("TokenExpiredError"!==f.name){e.next=5;break}throw new Error("Session token has expired");case 5:if("NotBeforeError"!==f.name){e.next=6;break}throw new Error("Session token not yet active");case 6:throw new Error("Failed to verify session token: "+f.message);case 7:if(s&&"object"===(0,a.default)(s)){e.next=8;break}throw new Error("Invalid token format");case 8:if(u=(c=s).data,d=c.signallingServerUrl,u&&d){e.next=9;break}throw new Error("Missing required token data");case 9:return o||(o=(0,S.uuidv4)()),i||(i=(0,k.getRandomInt)()),l={sessionToken:n,innerSessionToken:u,signallingServerUrl:d},e.abrupt("return",new t({peerId:o,roomId:i,outputData:l}));case 10:throw e.prev=10,p=e.catch(1),N.error("Failed to initialize:",p.message),p;case 11:case"end":return e.stop()}},e,null,[[1,10],[2,3]])})),function(){return r.apply(this,arguments)})}]);var r,n,i,g,y,_,T,O,j,q,z,V,W,G,H,K,$,J,Y,X,Z,Q}(g.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":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/objectWithoutProperties":43,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/helpers/typeof":60,"@babel/runtime/regenerator":63,bowser:89,events:205,jsonwebtoken:251,"mediasoup-client":319}],3:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.JsSdk_v1=void 0;var a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/defineProperty")),s=n(e("@babel/runtime/helpers/classCallCheck")),c=n(e("@babel/runtime/helpers/createClass")),u=n(e("@babel/runtime/helpers/possibleConstructorReturn")),d=n(e("@babel/runtime/helpers/getPrototypeOf")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/regenerator")),p=function(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var a,o,s={__proto__:null,default:e};if(null===e||"object"!=i(e)&&"function"!=typeof e)return s;if(a=t?n:r){if(a.has(e))return a.get(e);a.set(e,s)}for(var c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((o=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(o.get||o.set)?a(s,c,o):s[c]=e[c]);return s}(e,t)}(e("mediasoup-client")),h=n(e("bowser")),m=n(e("./socket")),b=e("events"),v=n(e("./Logger")),g=e("./utils/getRandomInt"),y=e("./utils/uuidv4"),_=e("./utils/getVidScaleUrl"),w=n(e("./utils/randomName")),k=(e("./utils/constants"),e("./utils/chooseMedia"));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 x(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)?x(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach(function(t){(0,o.default)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}var M,C=new v.default("Room"),T={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}}},A={optional:[{googDscp:!0}]};r.JsSdk_v1=function(e){function t(e){var r,n,i,a,o=e.peerId,c=e.roomId,l=e.peerName,f=e.produce,m=e.produceAudio,b=e.produceVideo,v=e.consume,g=e.videoResolution,y=e.forceVp8,_=e.forceVp9,w=e.forceH264,k=e.h264Profile,S=e.forceFPS,x=e.forcePCMU,E=e.forcePCMA,C=e.enableWebcamLayers,T=e.numSimulcastStreams,A=e.autoGainControl,I=e.echoCancellation,O=e.noiseSuppression,j=e.sampleRate,D=e.channelCount,L=e.videoBitRates,B=e.share,N=e.shareAudio,F=e.enableSharingLayers,U=e.shareBitRates,q=e.outputData,z=e.audioDeviceId,V=e.videoDeviceId;return(0,s.default)(this,t),n=this,i=t,i=(0,d.default)(i),(r=(0,u.default)(n,R()?Reflect.construct(i,a||[],(0,d.default)(n).constructor):i.apply(n,a)))._closed=!1,r._roomStatus="initialised",r._cignal=null,r._sendTransport=null,r._recvTransport=null,r._device=new p.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=P({},q),r._micStream=null,r._webCamStream=null,r._webcam={device:null,resolution:g},r._mic={device:null},r._deviceList=M||null,r._externalVideo=null,r._externalVideoStream=null,r._forceVP8=Boolean(y),r._forceH264=Boolean(w),r._forceVP9=Boolean(_),r._enableWebcamLayers=Boolean(C),r._numSimulcastStreams=T,r._enableSharingLayers=Boolean(F),r._client=h.default.parse(window.navigator.userAgent),r._cignalConnected=!1,r._reconnectionInitiated=!1,r._restartIceInProgressSendTransport=!1,r._restartIceInProgressRecvTransport=!1,r._activeSpeaker=null,r.init({roomId:c,peerId:o,peerName:l,produce:f,produceAudio:m,produceVideo:b,consume:v,videoResolution:g,forceVp8:y,forceVp9:_,forceH264:w,h264Profile:k,forceFPS:S,forcePCMU:x,forcePCMA:E,enableWebcamLayers:C,numSimulcastStreams:T,autoGainControl:A,echoCancellation:I,noiseSuppression:O,sampleRate:j,channelCount:D,videoBitRates:L,share:B,shareAudio:N,enableSharingLayers:F,shareBitRates:U,audioDeviceId:z,videoDeviceId:V}),r}return(0,l.default)(t,e),(0,c.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:($=(0,a.default)(f.default.mark(function e(t){var r;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return C.debug("init() | The input parameters are:%O",t),this.data.inputParams=t,r=p.detectDevice(),C.debug("The device is:%O",r),e.next=1,this.listDevicesInternal();case 1:return e.next=2,this.join();case 2:case"end":return e.stop()}},e,this)})),function(e){return $.apply(this,arguments)})},{key:"close",value:function(){this._closed||(this._closed=!0,C.debug("close()"),this._cignal.close(),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed")}},{key:"leaveRoom",value:(K=(0,a.default)(f.default.mark(function e(){return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(C.debug("Leave room is called!!"),"connected"!==this._roomStatus){e.next=2;break}return e.next=1,this._cignal.notify("leaveRoom",{});case 1: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(),C.debug("Video Track stopped")}),this._micStream&&this._micStream.getAudioTracks().forEach(function(e){e.stop(),C.debug("Mic Track stopped")}),this._roomStatus="closed",this._cignal.close(),e.next=3;break;case 2:C.error("The room state is:%s",this._roomStatus);case 3:case"end":return e.stop()}},e,this)})),function(){return K.apply(this,arguments)})},{key:"closeRoom",value:(H=(0,a.default)(f.default.mark(function e(){return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,this._cignal.notify("closeRoom",{});case 1:this.leaveRoom();case 2:case"end":return e.stop()}},e,this)})),function(){return H.apply(this,arguments)})},{key:"listDevicesInternal",value:(G=(0,a.default)(f.default.mark(function e(){var t,r=this;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices.ondevicechange=function(){var e=(0,a.default)(f.default.mark(function e(t){var n;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,(0,k.updatedDeviceList)();case 1:n=e.sent,C.info("Media devices changed!:%O",n),n.audioDevices&&n.audioDevices.length>0&&(r._deviceList.audioDevices=n.audioDevices),n.videoDevices&&n.videoDevices.length>0&&(r._deviceList.videoDevices=n.videoDevices),n.audioDevices&&n.audioDevices.length>0&&(r._deviceList.audioOutputDevices=n.audioDevicesOutput),M=r._deviceList,r.emit("deviceListUpdated");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!this._deviceList){e.next=1;break}return e.abrupt("return");case 1:return e.next=2,(0,k.loadAllAvailableDevices)();case 2:if(!(t=e.sent).success){e.next=3;break}return this._deviceList=t.deviceList,M=this._deviceList,e.abrupt("return");case 3:case"end":return e.stop()}},e,this)})),function(){return G.apply(this,arguments)})},{key:"join",value:(W=(0,a.default)(f.default.mark(function e(){var t,r=this;return f.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,a.default)(f.default.mark(function e(){var t,n;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r._cignalConnected=!0,!r._sendTransport&&!r._recvTransport){e.next=1;break}!r._sendTransport||"failed"!==r._sendTransport.connectionState&&"disconnected"!==r._sendTransport.connectionState?C.debug("Nothing to in case of socket reconnection with send transport status:%s",null===(t=r._sendTransport)||void 0===t?void 0:t.connectionState):(C.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?C.debug("Nothing to in case of socket reconnection with recv transport status:%s",null===(n=r._recvTransport)||void 0===n?void 0:n.connectionState):(C.debug("Ws reconnected after network outage. Need to do ICE restarts for recv transport."),r.restartIceRecvTransport()),e.next=2;break;case 1:return C.debug("Ws connected for first time. Need to go with the regular flow."),e.next=2,r._joinRoom();case 2:case"end":return e.stop()}},e)}))),this._cignal.on("failed",function(){}),this._cignal.on("disconnected",function(){C.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,a.default)(f.default.mark(function e(t,n,i){var a,s,c,u,d,l,h,m,b,v,g,y,_,w,k,S,x;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:C.debug('cignal "request" event [method:%s, data:%o]',t.method,t.data),r._cignalConnected=!0,S=t.method,e.next="newConsumer"===S?1:7;break;case 1:if(r.data.inputParams.consume){e.next=2;break}return i(403,"I do not want to consume"),e.abrupt("continue",7);case 2:return a=t.data,s=a.peerId,c=a.producerId,u=a.id,d=a.kind,l=a.rtpParameters,h=a.type,m=a.appData,b=a.producerPaused,e.prev=3,e.next=4,r._recvTransport.consume({id:u,producerId:c,kind:d,rtpParameters:l,streamId:"".concat(s,"-").concat(m.share?"share":"mic-webcam"),appData:P(P({},m),{},{peerId:s})});case 4:v=e.sent,r._consumers.set(v.id,v),v.on("transportclose",function(){r._consumers.delete(v.id)}),g=p.parseScalabilityMode(v.rtpParameters.encodings[0].scalabilityMode),y=g.spatialLayers,_=g.temporalLayers,w=r._peers.get(s),C.debug("Consumer created for peerId ".concat(s," for kind ").concat(v.kind)),k=P(P({},w),{},(0,o.default)({},m.share?"ss".concat(v.kind):v.kind,{consumerId:v.id,type:h,locallyPaused:!1,remotelyPaused:b,rtpParameters:v.rtpParameters,spatialLayers:y,temporalLayers:_,preferredSpatialLayer:y-1,preferredTemporalLayer:_-1,priority:1,codec:v.rtpParameters.codecs[0].mimeType.split("/")[1],track:v.track,share:m.share})),r._peers.set(s,k),n(),C.debug("Going to emit mic start / videostart"),"audio"===v.kind?m.share?r.emit("ssAudioStart",{peerId:s,audioTrack:v.track,type:"remote"}):r.emit("micStart",{peerId:s,audioTrack:v.track,type:"remote"}):"video"===v.kind&&(m.share?r.emit("ssVideoStart",{peerId:s,videoTrack:v.track,type:"remote"}):r.emit("videoStart",{peerId:s,videoTrack:v.track,type:"remote"})),e.next=6;break;case 5:throw e.prev=5,x=e.catch(3),C.error('"newConsumer" request failed:%o',x),x;case 6:return e.abrupt("continue",7);case 7:case"end":return e.stop()}},e,null,[[3,5]])}));return function(t,r,n){return e.apply(this,arguments)}}()),this._cignal.on("notification",function(e){switch("activeSpeaker"!==e.method&&C.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 n=e.data;r._peers.set(n.id,P(P({},n),{},{consumers:[]})),r.emit("newPeer",{peerId:n.id,peerName:n.displayName,type:"remote"});break;case"peerClosed":var i=e.data.peerId;r._peers.delete(i),r.emit("peerLeft",{peerId:i});break;case"roomClosed":C.debug("Room closed. No need to reconnect socket"),r.close();break;case"consumerClosed":var a=e.data.consumerId,o=r._consumers.get(a);if(C.debug("Consumer closed for consumerId:%s, type:%s",a,null==o?void 0:o.kind),!o)break;var s=o.appData,c=s.peerId,u=s.share,d=u?"ss".concat(o.kind):o.kind;o.close(),r._consumers.delete(a);var l=r._peers.get(c);C.debug("Peer data before deletion:%O",l),l[d]&&l[d].consumerId===a&&delete l[d],C.debug("Peer data after deletion:%O",l),r._peers.set(c,l),"audio"===d?(C.debug("Going to emit micEnd, consumer closed for audio"),u?r.emit("ssAudioStop",{peerId:c,track:null,type:"remote"}):r.emit("micEnd",{peerId:c,track:null,type:"remote"})):"video"===d&&(C.debug("Going to emit videoEnd, consumer closed for video"),u?r.emit("ssVideoStop",{peerId:c,track:null,type:"remote"}):r.emit("videoEnd",{peerId:c,track:null,type:"remote"}));break;case"consumerPaused":var f=e.data.consumerId,p=r._consumers.get(f);if(!p)break;p.pause();break;case"consumerResumed":var h=e.data.consumerId,m=r._consumers.get(h);if(!m)break;m.resume();break;case"consumerLayersChanged":var b=e.data,v=b.consumerId;if(b.spatialLayer,b.temporalLayer,!r._consumers.get(v))break;break;case"consumerScore":var g=e.data;g.consumerId,g.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 k=e.data.peerId;r.emit("peerMuted",{peerId:k,type:"remote"});break;case"peerUnMuted":var S=e.data.peerId;r.emit("peerUnMuted",{peerId:S,type:"remote"});break;default:C.error('unknown protoo notification.method "%s"',e.method)}});case 1:case"end":return e.stop()}},e,this)})),function(){return W.apply(this,arguments)})},{key:"restartIceSendTransport",value:(V=(0,a.default)(f.default.mark(function e(){var t,r;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(C.debug("restartIce SendTransport()"),!this._restartIceInProgressSendTransport){e.next=1;break}return C.warn("Restart ice already in progress for send transport! wait 4 completion b4 next request!"),e.abrupt("return");case 1:if(e.prev=1,!this._sendTransport||"failed"!==this._sendTransport.connectionState&&"disconnected"!==this._sendTransport.connectionState){e.next=4;break}return this._restartIceInProgressSendTransport=!0,C.debug("Restarting ICE for send transport"),e.next=2,this._cignal.request("restartIce",{transportId:this._sendTransport.id,peerId:this._peerId});case 2:return t=e.sent,e.next=3,this._sendTransport.restartIce({iceParameters:t});case 3:this._restartIceInProgressSendTransport=!1;case 4:e.next=6;break;case 5:e.prev=5,r=e.catch(1),C.error("restartIce SendTransport() | failed:%o",r);case 6:this._reconnectionInitiated=!1;case 7:case"end":return e.stop()}},e,this,[[1,5]])})),function(){return V.apply(this,arguments)})},{key:"restartIceRecvTransport",value:(z=(0,a.default)(f.default.mark(function e(){var t,r;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(C.debug("restartIce RecvTransport()"),!this._restartIceInProgressRecvTransport){e.next=1;break}return C.warn("Restart ice already in progress for recv transport! wait 4 completion b4 next request!"),e.abrupt("return");case 1:if(e.prev=1,!this._recvTransport||"failed"!==this._recvTransport.connectionState&&"disconnected"!==this._recvTransport.connectionState){e.next=4;break}return this._restartIceInProgressRecvTransport=!0,C.debug("Restarting ICE for recv transport"),e.next=2,this._cignal.request("restartIce",{transportId:this._recvTransport.id,peerId:this._peerId});case 2:return t=e.sent,e.next=3,this._recvTransport.restartIce({iceParameters:t});case 3:this._restartIceInProgressRecvTransport=!1;case 4:e.next=6;break;case 5:e.prev=5,r=e.catch(1),C.error("restartIce RecvTransport() | failed:%o",r);case 6:this._reconnectionInitiated=!1;case 7:case"end":return e.stop()}},e,this,[[1,5]])})),function(){return z.apply(this,arguments)})},{key:"_joinRoom",value:(q=(0,a.default)(f.default.mark(function e(){var t,r,n,i,o,s,c,u,d,l,p,h,m,b,v,g,y,_,w,k=this;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return C.debug("_joinRoom()"),e.prev=1,e.next=2,this._cignal.request("getRouterRtpCapabilities",{coreNumber:this.data.core});case 2:return t=e.sent,C.debug("Router rtp capabilities created:%O",t),C.debug("Input params are:",this.data.inputParams),e.next=3,this._device.load({routerRtpCapabilities:t});case 3:if(!this.data.inputParams.produce){e.next=5;break}return C.debug("Going to create webrtctransport send"),e.next=4,this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp||!1,producing:!0,consuming:!1,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0});case 4:r=e.sent,n=r.id,i=r.iceParameters,o=r.iceCandidates,s=r.dtlsParameters,c=r.sctpParameters,C.debug("Transport info is:%O",r),this._sendTransport=this._device.createSendTransport({id:n,iceParameters:i,iceCandidates:o,dtlsParameters:P(P({},s),{},{role:"auto"}),sctpParameters:c,iceServers:[],proprietaryConstraints:A,additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._sendTransport.on("connect",function(e,t,r){var n=e.iceParameters,i=e.dtlsParameters;k._cignal.request("connectWebRtcTransport",{transportId:k._sendTransport.id,iceParameters:n,dtlsParameters:i}).then(t).catch(r)}),this._sendTransport.on("produce",function(){var e=(0,a.default)(f.default.mark(function e(t,r,n){var i,a,o,s,c,u;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.kind,a=t.rtpParameters,o=t.appData,e.prev=1,e.next=2,k._cignal.request("produce",{transportId:k._sendTransport.id,kind:i,rtpParameters:a,appData:o});case 2:s=e.sent,c=s.id,r({id:c}),e.next=4;break;case 3:e.prev=3,u=e.catch(1),n(u);case 4:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t,r,n){return e.apply(this,arguments)}}());case 5:if(!this.data.inputParams.consume){e.next=7;break}return C.debug("Going to create webrtctransport recv"),e.next=6,this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp,producing:!1,consuming:!0,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0});case 6:u=e.sent,d=u.id,l=u.iceParameters,p=u.iceCandidates,h=u.dtlsParameters,m=u.sctpParameters,C.debug("Transport info is:%O",u),this._recvTransport=this._device.createRecvTransport({id:d,iceParameters:l,iceCandidates:p,dtlsParameters:P(P({},h),{},{role:"auto"}),sctpParameters:m,iceServers:[],additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._recvTransport.on("connect",function(e,t,r){var n=e.iceParameters,i=e.dtlsParameters;k._cignal.request("connectWebRtcTransport",{transportId:k._recvTransport.id,iceParameters:n,dtlsParameters:i}).then(t).catch(r)});case 7:return e.next=8,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 8:b=e.sent,v=b.peers,this.emit("newPeer",{peerId:this.data.inputParams.peerId,peerName:this.data.inputParams.peerName,type:"local"}),this._roomStatus="connected",C.debug("All availablepeers in this room are::%O",v),g=S(v);try{for(g.s();!(y=g.n()).done;)_=y.value,this._peers.set(_.id,P(P({},_),{},{consumers:[]})),C.debug("new peer is:%O",_),this.emit("newPeer",{peerId:_.id,peerName:_.displayName,type:"remote"})}catch(e){g.e(e)}finally{g.f()}this.data.inputParams.produce&&(this.data.inputParams.produceAudio?this.enableMic({deviceId:this.data.inputParams.audioDeviceId?this.data.inputParams.audioDeviceId:null}):C.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}):C.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&&C.debug("Send transport now connected!")})),e.next=10;break;case 9:e.prev=9,w=e.catch(1),C.error("_joinRoom() failed:%o",w),this.emit("error",{code:"EJR001",text:"Join room request failed!"}),this.close();case 10:case"end":return e.stop()}},e,this,[[1,9]])})),function(){return q.apply(this,arguments)})},{key:"enableMic",value:(U=(0,a.default)(f.default.mark(function e(){var t,r,n,i,a,o,s,c,u,d,l,p,h,m,b=this,v=arguments;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=v.length>0&&void 0!==v[0]?v[0]:{}).deviceId,n=void 0===r?null:r,i=t.autoGainControl,a=t.noiseSuppression,o=t.echoCancellation,s=t.channelCount,c=t.sampleRate,u=t.forcePCMU,d=t.forcePCMA,C.debug("enableMic()"),this.data.inputParams.produce){e.next=1;break}return C.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 1:if("connected"===this._roomStatus){e.next=2;break}return C.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 2:if(!this._micProducer){e.next=3;break}return C.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 3:if(this._device.canProduce("audio")){e.next=4;break}return C.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 4:if(u&&"boolean"==typeof u&&(this.data.inputParams.forcePCMU=u),d&&"boolean"==typeof d&&(this.data.inputParams.forcePCMA=d),i&&"boolean"==typeof i&&(this.data.inputParams.autoGainControl=i),o&&"boolean"==typeof o&&(this.data.inputParams.echoCancellation=o),a&&"boolean"==typeof a&&(this.data.inputParams.noiseSuppression=a),c&&Number.isInteger(c)&&c<64e3&&c>8e3&&(this.data.inputParams.sampleRate=c),s&&Number.isInteger(s)&&s>0&&s<3&&(this.data.inputParams.channelCount=s),e.prev=5,this._externalVideo){e.next=11;break}if(n?(p=this._deviceList.audioDevices.find(function(e){return e.deviceId===n}))||(C.warn("Selected audio input deviceId:%s not found",n),p=this._deviceList.audioDevices[0]):p=this._deviceList.audioDevices[0],this._mic.device=p,p){e.next=6;break}return C.error("No mic device found! Can't start audio!"),e.abrupt("return",{success:!1,reason:"No mic available for starting audio!"});case 6:return n&&this.data.inputParams.audioDeviceId!==n&&(this.data.inputParams.audioDeviceId=n),C.debug("enableMic() | calling getUserMedia()"),e.prev=7,e.next=8,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:p.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 8:this._micStream=e.sent,l=this._micStream.getAudioTracks()[0],e.next=10;break;case 9:throw e.prev=9,h=e.catch(7),new Error("Error while acquiring mic. Possible issue with audio constraint values",h);case 10:e.next=13;break;case 11:return e.next=12,this._getExternalVideoStream();case 12:this._micStream=e.sent,l=this._micStream.getAudioTracks()[0].clone();case 13:return e.next=14,this._sendTransport.produce({track:l,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 14: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(){b._micProducer=null}),this._micProducer.on("trackended",function(){b.disableMic().catch(function(){})}),e.next=16;break;case 15:e.prev=15,m=e.catch(5),C.error("enableMic() | failed:%o",m),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),l&&l.stop();case 16:case"end":return e.stop()}},e,this,[[5,15],[7,9]])})),function(){return U.apply(this,arguments)})},{key:"disableMic",value:(F=(0,a.default)(f.default.mark(function e(){return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(C.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach(function(e){return e.stop()}),this._micProducer){e.next=1;break}return e.abrupt("return");case 1:return this._micProducer.close(),this._producers.delete("audio"),e.prev=2,e.next=3,this._cignal.request("closeProducer",{producerId:this._micProducer.id});case 3:this.emit("micEnd",{peerId:this.data.inputParams.peerId,audioTrack:null,type:"local"}),e.next=5;break;case 4:e.prev=4,e.catch(2),this.emit("error",{code:"EID003",text:"Error disabling microphone!"});case 5:this._micProducer=null;case 6:case"end":return e.stop()}},e,this,[[2,4]])})),function(){return F.apply(this,arguments)})},{key:"muteMic",value:(N=(0,a.default)(f.default.mark(function e(){var t;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return C.debug("muteMic()"),this._micProducer.pause(),e.prev=1,e.next=2,this._cignal.request("pauseProducer",{producerId:this._micProducer.id});case 2:this.emit("peerMuted",{peerId:this.data.inputParams.peerId,type:"local"}),e.next=4;break;case 3:e.prev=3,t=e.catch(1),C.error("muteMic() | failed: %o",t),this.emit("error",{code:"EID004",text:"Error muting local microphone!"});case 4:case"end":return e.stop()}},e,this,[[1,3]])})),function(){return N.apply(this,arguments)})},{key:"unmuteMic",value:(B=(0,a.default)(f.default.mark(function e(){var t;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return C.debug("unmuteMic()"),this._micProducer.resume(),e.prev=1,e.next=2,this._cignal.request("resumeProducer",{producerId:this._micProducer.id});case 2:this.emit("peerUnMuted",{peerId:this.data.inputParams.peerId,type:"local"}),e.next=4;break;case 3:e.prev=3,t=e.catch(1),C.error("unmuteMic() | failed: %o",t),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"});case 4:case"end":return e.stop()}},e,this,[[1,3]])})),function(){return B.apply(this,arguments)})},{key:"enableCam",value:(L=(0,a.default)(f.default.mark(function e(){var t,r,n,i,a,o,s,c,u,d,l,p,h,m,b,v,g,y,_,w,k=this,S=arguments;return f.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,n=void 0===r?null:r,i=t.videoResolution,a=t.forceVp8,o=t.forceVp9,s=t.forceH264,c=t.h264Profile,u=t.forceFPS,d=t.enableWebcamLayers,l=t.numSimulcastStreams,p=t.videoBitRates,C.debug("enableWebcam()"),this.data.inputParams.produce){e.next=1;break}return C.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 1:if("connected"===this._roomStatus){e.next=2;break}return C.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 2:if(!this._webcamProducer){e.next=3;break}return C.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 3:if(this._device.canProduce("video")){e.next=4;break}return C.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 4:if(["hd","vga","qvga"].includes(i)&&(this.data.inputParams.videoResolution=i,this._webcam.resolution=i),a&&"boolean"==typeof a&&(this.data.inputParams.forceVp8=a),o&&"boolean"==typeof o&&(this.data.inputParams.forceVp9=o),s&&"boolean"==typeof s&&(this.data.inputParams.forceH264=s),c&&["high","low"].includes(c.toLowerCase())&&(this.data.inputParams.h264Profile=c),u&&Number.isInteger(u)&&u<65&&u>5&&(this.data.inputParams.forceFPS=25),d&&"boolean"==typeof d&&(this.data.inputParams.enableWebcamLayers=d,this._enableWebcamLayers=d),l&&Number.isInteger(l)&&l<4&&l>0&&(this.data.inputParams.numSimulcastStreams=l,this._numSimulcastStreams=l),Array.isArray(p)&&p.length>=1&&p.length<=3&&p.every(function(e){return Number.isInteger(e)&&e>=75&&e<=800})?(C.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=p):C.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=5,this._externalVideo){e.next=8;break}if(n?(m=this._deviceList.videoDevices.find(function(e){return e.deviceId===n}))||(C.warn("Selected deviceId:%s not found",n),m=this._deviceList.videoDevices[0]):m=this._deviceList.videoDevices[0],this._webcam.device=m,b=this._webcam.resolution,m){e.next=6;break}return C.error("No wencam device found! Can't start video!"),e.abrupt("return",{success:!1,reason:"No Webcam available for starting video!"});case 6:return n&&this.data.inputParams.videoDeviceId!==n&&(this.data.inputParams.videoDeviceId=n),C.debug("enableWebcam() | calling getUserMedia()"),e.next=7,navigator.mediaDevices.getUserMedia({video:P(P({deviceId:{ideal:m.deviceId}},T[b]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 7:this._webCamStream=e.sent,h=this._webCamStream.getVideoTracks()[0],e.next=10;break;case 8:return m={label:"external video"},e.next=9,this._getExternalVideoStream();case 9:this._webCamStream=e.sent,h=this._webCamStream.getVideoTracks()[0].clone();case 10:if(y={videoGoogleStartBitrate:1e3},C.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),!this._forceVP8){e.next=12;break}if(g=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp8"===e.mimeType.toLowerCase()})){e.next=11;break}throw new Error("desired VP8 codec+configuration is not supported");case 11:e.next=16;break;case 12:if(!this._forceH264){e.next=15;break}if("high"===this.data.inputParams.h264Profile?g=this._device.rtpCapabilities.codecs.find(function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]}):"low"===this.data.inputParams.h264Profile&&(g=this._device.rtpCapabilities.codecs.find(function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]})),g){e.next=13;break}throw new Error("desired H264 codec+configuration is not supported");case 13:C.debug("Selected h264 codec is:%O",g);case 14:e.next=16;break;case 15:if(!this._forceVP9){e.next=16;break}if(g=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp9"===e.mimeType.toLowerCase()})){e.next=16;break}throw new Error("desired VP9 codec+configuration is not supported");case 16:return this._enableWebcamLayers&&(_=this._device.rtpCapabilities.codecs.find(function(e){return"video"===e.kind}),this._forceVP9&&g||"video/vp9"===_.mimeType.toLowerCase()?v=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(v=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&v.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&v.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))),e.next=17,this._sendTransport.produce({track:h,encodings:v,codecOptions:y,codec:g});case 17: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(){k._webcamProducer=null}),this._webcamProducer.on("trackended",function(){k.disableWebcam().catch(function(){})}),e.next=19;break;case 18:e.prev=18,w=e.catch(5),C.error("enableWebcam() | failed:%o",w),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),h&&h.stop();case 19:case"end":return e.stop()}},e,this,[[5,18]])})),function(){return L.apply(this,arguments)})},{key:"disableCam",value:(D=(0,a.default)(f.default.mark(function e(){return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(C.debug("disableWebcam()"),this._webcamProducer){e.next=1;break}return e.abrupt("return");case 1:return this._webcamProducer.close(),this._producers.delete("video"),e.prev=2,e.next=3,this._cignal.request("closeProducer",{producerId:this._webcamProducer.id});case 3:this.emit("videoEnd",{peerId:this.data.inputParams.peerId,videoTrack:null}),e.next=5;break;case 4:e.prev=4,e.catch(2),this.emit("error",{code:"EID012",text:"Error while closing server side producer!"});case 5:this._webcamProducer=null;case 6:case"end":return e.stop()}},e,this,[[2,4]])})),function(){return D.apply(this,arguments)})},{key:"_updateWebcams",value:(j=(0,a.default)(f.default.mark(function e(){var t,r,n,i,a,o,s,c;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return C.debug("_updateWebcams()"),this._webcams=new Map,C.debug("_updateWebcams() | calling enumerateDevices()"),e.next=1,navigator.mediaDevices.enumerateDevices();case 1:t=e.sent,r=S(t),e.prev=2,r.s();case 3:if((n=r.n()).done){e.next=6;break}if("videoinput"===(i=n.value).kind){e.next=4;break}return e.abrupt("continue",5);case 4:this._webcams.set(i.deviceId,i);case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,c=e.catch(2),r.e(c);case 8:return e.prev=8,r.f(),e.finish(8);case 9:a=Array.from(this._webcams.values()),o=a.length,s=this._webcam.device?this._webcam.device.deviceId:void 0,C.debug("_updateWebcams() [webcams:%o]",a),0===o?this._webcam.device=null:this._webcams.has(s)||(this._webcam.device=a[0]);case 10:case"end":return e.stop()}},e,this,[[2,7,8,9]])})),function(){return j.apply(this,arguments)})},{key:"_getExternalVideoStream",value:(O=(0,a.default)(f.default.mark(function e(){var t=this;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._externalVideoStream){e.next=1;break}return e.abrupt("return",this._externalVideoStream);case 1:if(!(this._externalVideo.readyState<3)){e.next=2;break}return e.next=2,new Promise(function(e){return t._externalVideo.addEventListener("canplay",e)});case 2:if(!this._externalVideo.captureStream){e.next=3;break}this._externalVideoStream=this._externalVideo.captureStream(),e.next=5;break;case 3:if(!this._externalVideo.mozCaptureStream){e.next=4;break}this._externalVideoStream=this._externalVideo.mozCaptureStream(),e.next=5;break;case 4:throw new Error("video.captureStream() not supported");case 5:return e.abrupt("return",this._externalVideoStream);case 6:case"end":return e.stop()}},e,this)})),function(){return O.apply(this,arguments)})},{key:"_getWebcamType",value:function(e){return/(back|rear)/i.test(e.label)?(C.debug("_getWebcamType() | it seems to be a back camera"),"back"):(C.debug("_getWebcamType() | it seems to be a front camera"),"front")}},{key:"changeVideoInput",value:(I=(0,a.default)(f.default.mark(function e(t){var r,n,i,a;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,n=t.deviceId,i=t.fps,!this._webcamProducer){e.next=2;break}return e.next=1,this._changeVideoInput({resolution:r,deviceId:n,fps:i});case 1:return a=e.sent,e.abrupt("return",a);case 2:return C.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 3:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"_changeVideoInput",value:(E=(0,a.default)(f.default.mark(function e(t){var r,n,i,a,o,s,c;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.resolution,n=t.deviceId,i=t.fps,C.info("_changeVideoInput() | Inside"),r&&["hd","vga","qvga"].includes(r)?this._webcam.resolution=r:C.warn("Invalid video resolution value "),i&&Number.isInteger(i)&&i<65&&i>5?this.data.inputParams.forceFPS=i:C.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),a=this._deviceList.videoDevices.find(function(e){return n&&e.deviceId===n})){e.next=1;break}return C.error("The selected deviceId not found!"),e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 1:return this._webcam.device=a,e.prev=2,this._webCamStream.getVideoTracks().forEach(function(e){return e.stop()}),this._webCamStream=null,C.debug("changeVideoInput() | calling getUserMedia()"),e.next=3,navigator.mediaDevices.getUserMedia({video:P(P({deviceId:{ideal:a.deviceId}},T[this._webcam.resolution]),{},{frameRate:{ideal:this.data.inputParams.forceFPS}})});case 3:return this._webCamStream=e.sent,o=this._webCamStream.getVideoTracks()[0],C.debug("The new video track is:%O",o),e.next=4,this._webcamProducer.replaceTrack({track:o});case 4:return(s=this._producers.get("video")).deviceLabel=a.label,s.type=this._getWebcamType(a),s.track=this._webcamProducer.track,C.debug("Updated producer values are:%O",s),this._producers.set("video",s),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 5:return e.prev=5,c=e.catch(2),C.error("Error while changing input:%O",c),e.abrupt("return",{success:!1,reason:"Couldn't change video input",error:c});case 6:case"end":return e.stop()}},e,this,[[2,5]])})),function(e){return E.apply(this,arguments)})},{key:"changeAudioInput",value:(x=(0,a.default)(f.default.mark(function e(t){var r,n,i,a,o,s,c;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,n=t.echoCancellation,i=t.noiseSuppression,a=t.sampleRate,o=t.channelCount,s=t.deviceId,!this._micProducer){e.next=2;break}return e.next=1,this._changeAudioInput({autoGainControl:r,echoCancellation:n,noiseSuppression:i,sampleRate:a,channelCount:o,deviceId:s});case 1:return c=e.sent,e.abrupt("return",c);case 2: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 3:case"end":return e.stop()}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"_changeAudioInput",value:(v=(0,a.default)(f.default.mark(function e(t){var r,n,i,a,o,s,c,u,d,l;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.autoGainControl,n=t.echoCancellation,i=t.noiseSuppression,a=t.sampleRate,o=t.channelCount,s=t.deviceId,r&&"boolean"==typeof r&&(this.data.inputParams.autoGainControl=r),n&&"boolean"==typeof n&&(this.data.inputParams.echoCancellation=Boolean(n)),i&&"boolean"==typeof i&&(this.data.inputParams.noiseSuppression=Boolean(i)),a&&Number.isInteger(a)&&a<64e3&&a>8e3&&(this.data.inputParams.sampleRate=a),o&&Number.isInteger(o)&&o>0&&o<3&&(this.data.inputParams.channelCount=o),c=this._deviceList.audioDevices.find(function(e){return s&&e.deviceId===s})){e.next=1;break}return e.abrupt("return",{success:!1,reason:"Invalid deviceId!"});case 1:return this._mic.device=c,this._micStream&&this._micStream.getAudioTracks().forEach(function(e){return e.stop()}),this._micStream=null,e.prev=2,e.next=3,navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:c.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 3:return this._micStream=e.sent,u=this._micStream.getAudioTracks()[0],this._micProducer.replaceTrack({track:u}),(d=this._producers.get("audio")).deviceLabel=c.label,d.track=this._micProducer.track,C.debug("Updated producer values are:%O",d),this._producers.set("audio",d),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),e.abrupt("return",{success:!0});case 4:return e.prev=4,l=e.catch(2),C.error("Error while changing input:%O",l),e.abrupt("return",{success:!1,reason:"Couldn't change audio input",err:l});case 5:case"end":return e.stop()}},e,this,[[2,4]])})),function(e){return v.apply(this,arguments)})},{key:"enableShare",value:(b=(0,a.default)(f.default.mark(function e(){var t,r,n,i,a,o,s,c,u,d,l,p,h,m,b,v=this,g=arguments;return f.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,n=void 0!==r&&r,i=t.enableSharingLayers,a=void 0===i||i,o=t.shareBitRates,s=void 0===o?[2500,1250,500]:o,C.debug("enableShare()"),this.data.inputParams.produce){e.next=1;break}return C.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 1:if("connected"===this._roomStatus){e.next=2;break}return C.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 2:if(!this._shareProducer){e.next=3;break}return C.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 3:if(this._device.canProduce("video")){e.next=4;break}return C.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 4:return this._enableSharingLayers="boolean"!=typeof a?Boolean(a):a,Array.isArray(s)&&s.length>=1&&s.length<=3&&s.every(function(e){return Number.isInteger(e)&&e>=500&&e<=2500})?this.data.inputParams.shareBitRates=s:this.data.inputParams.shareBitRates=[2500,1250,500],e.prev=5,C.debug("enableShare() | calling getDisplayMedia()"),e.next=6,navigator.mediaDevices.getDisplayMedia({audio:!!n,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});case 6:if(d=e.sent){e.next=7;break}return C.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 7:if(!(u=d.getAudioTracks()[0])){e.next=9;break}return e.next=8,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 8: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 9:if(c=d.getVideoTracks()[0],h={videoGoogleStartBitrate:1e3},!this._forceVP8){e.next=11;break}if(p=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp8"===e.mimeType.toLowerCase()})){e.next=10;break}throw new Error("desired VP8 codec+configuration is not supported");case 10:e.next=15;break;case 11:if(!this._forceH264){e.next=14;break}if("high"===this.data.inputParams.h264Profile?p=this._device.rtpCapabilities.codecs.find(function(e){return"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]}):"low"===this.data.inputParams.h264Profile&&(p=this._device.rtpCapabilities.codecs.find(function(e){return"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"]})),p){e.next=12;break}throw new Error("desired H264 codec+configuration is not supported");case 12:C.debug("Selected h264 codec is:%O",p);case 13:e.next=15;break;case 14:if(!this._forceVP9){e.next=15;break}if(p=this._device.rtpCapabilities.codecs.find(function(e){return"video/vp9"===e.mimeType.toLowerCase()})){e.next=15;break}throw new Error("desired VP9 codec+configuration is not supported");case 15:return this._enableSharingLayers&&(m=this._device.rtpCapabilities.codecs.find(function(e){return"video"===e.kind}),this._forceVP9&&p||"video/vp9"===m.mimeType.toLowerCase()?l=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(l=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&l.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&l.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))),e.next=16,this._sendTransport.produce({track:c,encodings:l,codecOptions:h,codec:p,appData:{share:!0}});case 16: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(){v._shareProducer=null}),this._shareProducer.on("trackended",function(){v.disableShare().catch(function(){})}),e.next=18;break;case 17:e.prev=17,b=e.catch(5),C.error("enableShare() | failed:%o",b),"NotAllowedError"!==b.name&&this.emit("error",{code:"EID014",text:"Error while trying to start screen share. Error is: ".concat(b,"!")}),c&&c.stop();case 18:case"end":return e.stop()}},e,this,[[5,17]])})),function(){return b.apply(this,arguments)})},{key:"disableShare",value:(i=(0,a.default)(f.default.mark(function e(){var t,r;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(C.debug("disableShare()"),this._shareProducer){e.next=1;break}return C.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 1:if(this._shareProducer.close(),!this._shareAudioProducer){e.next=5;break}return this._shareAudioProducer.close(),e.prev=2,e.next=3,this._cignal.request("closeProducer",{producerId:this._shareAudioProducer.id});case 3:this.emit("ssAudioStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"}),e.next=5;break;case 4:e.prev=4,t=e.catch(2),this.emit("error",{code:"EID015",text:"Error while trying to stop screen share audio. Error is: ".concat(t,"!")});case 5:return e.prev=5,e.next=6,this._cignal.request("closeProducer",{producerId:this._shareProducer.id});case 6:this.emit("ssVideoStop",{peerId:this.data.inputParams.peerId,videoTrack:null,type:"local"}),e.next=8;break;case 7:e.prev=7,r=e.catch(5),this.emit("error",{code:"EID016",text:"Error while trying to stop screen share video. Error is: ".concat(r,"!")});case 8:this._shareAudioProducer=null,this._shareProducer=null;case 9:case"end":return e.stop()}},e,this,[[2,4],[5,7]])})),function(){return i.apply(this,arguments)})}],[{key:"listDevices",value:(n=(0,a.default)(f.default.mark(function e(){var t;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!M){e.next=1;break}return C.info("Device list already exists:%O",M),e.abrupt("return",{success:!0,deviceList:M});case 1:return e.next=2,(0,k.loadAllAvailableDevices)();case 2:if(!(t=e.sent).success){e.next=3;break}return M=t.deviceList,e.abrupt("return",{success:!0,deviceList:t.deviceList});case 3:return e.abrupt("return",{success:!1,reason:t.reason});case 4:case"end":return e.stop()}},e)})),function(){return n.apply(this,arguments)})},{key:"joinRoom",value:(r=(0,a.default)(f.default.mark(function e(){var r,n,i,a,o,s,c,u,d,l,p,m,b,v,k,S,x,E,P,R,M,T,A,I,O,j,D,L,B,N,F,U,q,z,V,W,G,H,K,$,J,Y,X,Z,Q,ee,te,re,ne,ie,ae,oe,se,ce,ue,de,le,fe,pe,he,me,be,ve,ge,ye,_e,we=arguments;return f.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(r=we.length>0&&void 0!==we[0]?we[0]:{}).sessionToken,i=r.roomId,a=r.peerId,o=r.peerName,s=r.produce,c=void 0===s||s,u=r.produceAudio,d=void 0===u||u,l=r.produceVideo,p=void 0===l||l,m=r.consume,b=void 0===m||m,v=r.videoResolution,k=void 0===v?"hd":v,S=r.forceVp8,x=void 0!==S&&S,E=r.forceVp9,P=void 0!==E&&E,R=r.forceH264,M=void 0!==R&&R,T=r.h264Profile,A=void 0===T?"high":T,I=r.forcePCMU,O=void 0!==I&&I,j=r.forcePCMA,D=void 0!==j&&j,L=r.forceFPS,B=void 0===L?25:L,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,W=r.echoCancellation,G=void 0===W||W,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,ne=void 0!==re&&re,ie=r.enableSharingLayers,ae=void 0===ie||ie,oe=r.shareBitRates,se=void 0===oe?[2500,1250,500]:oe,ce=r.audioDeviceId,ue=void 0===ce?null:ce,de=r.videoDeviceId,le=void 0===de?null:de,n){e.next=1;break}throw new Error("Session token is required to join the room.");case 1:return["hd","vga","qvga"].includes(k)||(C.warn("Invalid video resolution value. setting it to default value of 'hd' "),k="hd"),"boolean"!=typeof c&&(C.warn("Produe should either be true or false"),c=Boolean(c)),"boolean"!=typeof d&&(C.warn("ProduceAudio should either be true or false"),d=Boolean(d)),"boolean"!=typeof p&&(C.warn("ProduceVideo should either be true or false"),p=Boolean(p)),"boolean"!=typeof b&&(C.warn("Consume should either be true or false"),b=Boolean(b)),"boolean"!=typeof x&&(C.warn("forceVp8 should either be true or false"),x=Boolean(x)),"boolean"!=typeof P&&(C.warn("forceVp9 should either be true or false"),P=Boolean(P)),"boolean"!=typeof M&&(C.warn("forceH264 should either be true or false"),M=Boolean(M)),["high","low"].includes(A.toLowerCase())||(C.warn("h264Profile should either be 'high' or 'low'"),A="high"),(!Number.isInteger(B)||Number.isInteger(B)&&(B>65||B<5))&&(C.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),B=25),"boolean"!=typeof F&&(C.warn("enableWebcamLayers should either be true or false"),F=Boolean(F)),(!Number.isInteger(q)||Number.isInteger(q)&&(q>3||q<1))&&(C.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})?C.debug("videoBitRates values are correct"):(C.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&&(C.warn("forcePCMU should either be true or false"),O=Boolean(O)),"boolean"!=typeof D&&(C.warn("forcePCMA should either be true or false"),D=Boolean(D)),"boolean"!=typeof V&&(C.warn("autoGainControl should either be true or false"),V=Boolean(V)),"boolean"!=typeof G&&(C.warn("echoCancellation should either be true or false"),G=Boolean(G)),"boolean"!=typeof K&&(C.warn("noiseSuppression should either be true or false"),K=Boolean(K)),(!Number.isInteger(J)||Number.isInteger(J)&&(J>64e3||J<8e3))&&(C.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))&&(C.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),X=1),"boolean"!=typeof te&&(C.warn("share should either be true or false"),te=Boolean(te)),"boolean"!=typeof ne&&(C.warn("shareAudio should either be true or false"),ne=Boolean(ne)),"boolean"!=typeof ae&&(C.warn("enableSharingLayers should either be true or false"),ae=Boolean(ae)),Array.isArray(se)&&se.length>=1&&se.length<=3&&se.every(function(e){return Number.isInteger(e)&&e>=500&&e<=2500})?C.debug("shareBitRates values are correct"):(C.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]'"),se=[2500,1250,500]),e.prev=2,C.info("session token:%s",n),a||(a=(0,y.uuidv4)()),i||(i=(0,g.getRandomInt)()),o||(o=(0,w.default)()),fe=h.default.parse(window.navigator.userAgent),pe=fe.browser.name,he=fe.browser.version,me=fe.os.name,be={name:a,participantType:"moderator",browserName:pe,browserVersion:he,os:me},C.info("browser details are:%O",fe),ve={sessionToken:n,roomId:i,peerId:a,consumerReplicas:0,producer:c,consumer:b,participantData:be},ge={},C.debug("Received input parameters are:%O",ve),e.next=3,(0,_.getVidScaleUrl)(ve);case 3:if(!((ye=e.sent).success&&ye.wsUrl&&ye.core)){e.next=4;break}ge.url=ye.wsUrl,ge.core=ye.core,e.next=5;break;case 4:return C.warn("Vidscale returned success as false. with error:%O",ye),e.abrupt("return",ye);case 5:return C.debug("VidScale url is:",ge.url),e.abrupt("return",new t({peerId:a,roomId:i,peerName:o,produce:c,produceAudio:d,produceVideo:p,consume:b,videoResolution:k,forceVp8:x,forceVp9:P,forceH264:M,h264Profile:A,forceFPS:B,forcePCMU:O,forcePCMA:D,enableWebcamLayers:F,numSimulcastStreams:q,autoGainControl:V,echoCancellation:G,noiseSuppression:K,sampleRate:J,channelCount:X,videoBitRates:Q,share:te,shareAudio:ne,enableSharingLayers:ae,shareBitRates:se,outputData:ge,audioDeviceId:ue,videoDeviceId:le}));case 6:throw e.prev=6,_e=e.catch(2),C.error("Failed to join room:",_e.message),_e;case 7:case"end":return e.stop()}},e,null,[[2,6]])})),function(){return r.apply(this,arguments)})}]);var r,n,i,b,v,x,E,I,O,j,D,L,B,N,F,U,q,z,V,W,G,H,K,$}(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":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/helpers/typeof":60,"@babel/runtime/regenerator":63,bowser:89,events:205,"mediasoup-client":319}],4:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass")),o=e("debug"),s="VidScale-js",c=function(){return(0,a.default)(function e(t){(0,i.default)(this,e),t?(this._debug=o("".concat(s,":").concat(t)),this._info=o("".concat(s,":INFO:").concat(t)),this._warn=o("".concat(s,":WARN:").concat(t)),this._error=o("".concat(s,":ERROR:").concat(t))):(this._debug=o(s),this._info=o("".concat(s,":INFO")),this._warn=o("".concat(s,":WARN")),this._error=o("".concat(s,":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":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/interopRequireDefault":36,debug:142}],5:[function(e,t,r){"use strict";var n=e("./lib/Peer"),i=e("./lib/transports/SocketTransport"),a=e("./lib/transports/WebSocketTransport");r.Peer=n,r.SocketTransport=i,r.WebSocketTransport=a},{"./lib/Peer":8,"./lib/transports/SocketTransport":9,"./lib/transports/WebSocketTransport":10}],6:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=n(e("@babel/runtime/helpers/possibleConstructorReturn")),c=n(e("@babel/runtime/helpers/getPrototypeOf")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/regenerator"));function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}var f=e("events").EventEmitter,p=e("../../Logger"),h=function(e){function t(e){var r,n,i,o;return(0,a.default)(this,t),n=this,i=t,i=(0,c.default)(i),(r=(0,s.default)(n,l()?Reflect.construct(i,o||[],(0,c.default)(n).constructor):i.apply(n,o))).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),n=1;n<t;n++)r[n-1]=arguments[n];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,i.default)(d.default.mark(function e(t){var r,n,i,a=this,o=arguments;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(r=o.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=o[i];return e.abrupt("return",new Promise(function(e,r){a.safeEmit.apply(a,[t].concat(n,[e,r]))}));case 1:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)})}]);var r}(f);t.exports=h},{"../../Logger":4,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,events:205}],7:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/typeof")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=e("../../Logger"),c=e("./utils").generateRandomNumber,u=new s("Message"),d=function(){return(0,o.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 u.error("parse() | invalid JSON: %s",e)}if("object"===(0,i.default)(t)&&!Array.isArray(t)){if(t.request){if(r.request=!0,"string"!=typeof t.method)return void u.error("parse() | missing/invalid method field");if("number"!=typeof t.id)return void u.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 u.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 u.error("parse() | missing request/response field");if(r.notification=!0,"string"!=typeof t.method)return void u.error("parse() | missing/invalid method field");r.method=t.method,r.data=t.data||{}}return r}u.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=d},{"../../Logger":4,"./utils":11,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":60}],8:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=n(e("@babel/runtime/helpers/possibleConstructorReturn")),c=n(e("@babel/runtime/helpers/getPrototypeOf")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/regenerator"));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 f(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)?f(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var h=e("../../Logger"),m=e("./EnhancedEventEmitter"),b=e("./Message"),v=new h("Peer"),g=function(e){function t(e){var r,n,i,o;return(0,a.default)(this,t),n=this,i=t,o=[v],i=(0,c.default)(i),r=(0,s.default)(n,p()?Reflect.construct(i,o||[],(0,c.default)(n).constructor):i.apply(n,o)),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:(n=(0,i.default)(d.default.mark(function e(t){var r,n,i=this,a=arguments;return d.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,n=b.createRequest(t,r),this._logger.debug("request() [method:%s, id:%s]",t,n.id),e.next=1,this._transport.send(n);case 1:return e.abrupt("return",new Promise(function(e,t){var r=1500*(15+.1*i._sents.size),a={id:n.id,method:n.method,resolve:function(t){i._sents.delete(n.id)&&(clearTimeout(a.timer),e(t))},reject:function(e){i._sents.delete(n.id)&&(clearTimeout(a.timer),t(e))},timer:setTimeout(function(){i._sents.delete(n.id)&&t(new Error("request timeout"))},r),close:function(){clearTimeout(a.timer),t(new Error("peer closed"))}};i._sents.set(n.id,a)}));case 2:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"notify",value:(r=(0,i.default)(d.default.mark(function e(t){var r,n,i=arguments;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:void 0,n=b.createNotification(t,r),this._logger.debug("notify() [method:%s]",t),e.next=1,this._transport.send(n);case 1: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 n=b.createSuccessResponse(e,r);t._transport.send(n).catch(function(){})},function(r,n){r instanceof Error?(n=r.message,r=500):"number"==typeof r&&n instanceof Error&&(n=n.message);var i=b.createErrorResponse(e,r,n);t._transport.send(i).catch(function(){})})}catch(t){var r=b.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,n}(m);t.exports=g},{"../../Logger":4,"./EnhancedEventEmitter":6,"./Message":7,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63}],9:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=n(e("@babel/runtime/helpers/possibleConstructorReturn")),c=n(e("@babel/runtime/helpers/getPrototypeOf")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/regenerator"));function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}var f=e("socket.io-client"),p=e("../utils").sleep,h=e("../../../Logger"),m=e("../EnhancedEventEmitter"),b=e("../Message"),v=new h("WebSocketTransport"),g=function(e){function t(e,r){var n,i,o,u;return(0,a.default)(this,t),i=this,o=t,u=[v],o=(0,c.default)(o),n=(0,s.default)(i,l()?Reflect.construct(o,u||[],(0,c.default)(i).constructor):o.apply(i,u)),v.debug("constructor() [url:%s, options:%o]",e,r),n._closed=!1,n._url=e,n._connected=!1,n._params=r||{},n._socket=null,n._createSocket(),n}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,i.default)(d.default.mark(function e(t){var r;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}throw new Error("transport closed");case 1:e.prev=1,this._socket.send(JSON.stringify(t)),e.next=3;break;case 2:throw e.prev=2,r=e.catch(1),v.warn("send() failed:%o",r),r;case 3:case"end":return e.stop()}},e,this,[[1,2]])})),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,i.default)(d.default.mark(function t(){return d.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=1;break}v.debug("No need to reconnect for roomClient close!"),t.next=3;break;case 1:if(!(e._reconnectionCounter>240)){t.next=2;break}return v.debug("Reconnection not needed if user disconnection for more than 2 minutes, reconnection counter:",e._reconnectionCounter),t.abrupt("return");case 2:return e._socket.close(),e._socket=null,e._createSocket(),e._reconnectionCounter+=1,t.next=3,p(500);case 3: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=b.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}(m);t.exports=g},{"../../../Logger":4,"../EnhancedEventEmitter":6,"../Message":7,"../utils":11,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,"socket.io-client":403}],10:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=n(e("@babel/runtime/helpers/possibleConstructorReturn")),c=n(e("@babel/runtime/helpers/getPrototypeOf")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/helpers/defineProperty")),l=n(e("@babel/runtime/regenerator"));function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=e("../EnhancedEventEmitter"),h=e("../utils").sleep,m=new(e("../../../Logger"))("WebsocketTransport"),b=function(e){function t(e,r){var n,o,u,p;return(0,a.default)(this,t),o=this,u=t,p=[m],u=(0,c.default)(u),n=(0,s.default)(o,f()?Reflect.construct(u,p||[],(0,c.default)(o).constructor):u.apply(o,p)),(0,d.default)(n,"createAndUpdateSocket",function(){var e=(0,i.default)(l.default.mark(function e(t){var r,i,a,o,s;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.connectionType,i=void 0===r?null:r,m.info("Room close status:%s",n._closed),a=n,!n._closed){e.next=1;break}return m.info("Websocket already closed!"),e.abrupt("return");case 1:if(n._url){e.next=2;break}return m.warn("url not available!"),e.abrupt("return");case 2:o=null===i?"".concat(n._url,"&connectionType=","landing"):"".concat(n._url,"&connectionType=").concat(i),m.debug("the url is:%s",o),n._ws=new WebSocket(o),s=0,m.debug("websocketHelper createAndUpdateSocket created a new websocket"),m.debug("websocketHelper createAndUpdateSocket:%s",n._ws.readyState);case 3:if(1===n._ws.readyState||!n._socketShouldReconnect){e.next=8;break}if(3!==n._ws.readyState){e.next=5;break}return m.debug("websocketHelper createAndUpdateSocket"),e.next=4,h(2e3);case 4:n._ws=new WebSocket(o),m.debug("websocketHelper createAndUpdateSocket newly created websocket state:%s",n._ws.readyState);case 5:return e.next=6,h(500);case 6:if(!(++s>250)){e.next=7;break}return m.error("No of retries limit to connect with server exhausted!"),e.abrupt("continue",8);case 7:e.next=3;break;case 8:1===n._ws.readyState&&m.debug("updated the websocket with ready state -".concat(n._ws.readyState)),n.safeEmit("connected"),m.debug("updating the websocket to redux store with ready state -".concat(n._ws.readyState)),n._ws.onopen=function(){n._closed||(m.debug("Websocket open"),n.safeEmit("open"))},n._isConnected=!0,n._ws.onmessage=function(e){if(!n._closed){var t=JSON.parse(e.data);switch(t.id){case"ping":n._lastTimerId&&clearTimeout(n._lastTimerId);var r=n;n._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);n._ws.send(JSON.stringify({id:"pong"}));break;case"invalidToken":m.debug("Session token invalid!"),n._socketShouldReconnect=!1,n.safeEmit("invalidToken",t);break;case"alreadyActive":n.safeEmit("alreadyActive",t);break;case"passwordDisabled":n.safeEmit("passwordDisabled",t);break;case"notify":n.safeEmit("notify",t.data);break;case"remotePeerJoin":n.safeEmit("roomStartedP2p",t);break;case"userError":n.safeEmit("userError",t);break;case"validationAlert":n.safeEmit("validationError",t);break;case"joinStatusOnLanding":n.safeEmit("defaultJoinStatus",t);break;default:n.safeEmit("message",t)}}},n._ws.onclose=function(e){a._closed||(m.warn('WebSocket "close" event [wasClean:%s, code:%s, reason:"%s"]',e.wasClean,e.code,e.reason),4503===e.code||4504===e.code?(m.error("Socket closed with reason",e.reason),a._closed=!0):4500!==e.code&&(m.debug("trying to reconnect:%s",e.code),a._closed=!1,n._roomJoined?(m.debug("Trying to join after a network reset while in a meeting"),a.createAndUpdateSocket({connectionType:"inCall"})):(m.debug("Trying to join after a network reset while on the landing page"),a.createAndUpdateSocket({connectionType:null})),clearTimeout(a._lastTimerId)),n._url=null,m.info("The websocket closed status is:%s",a._closed),a.safeEmit("close",{code:e.code,reason:e.reason}))};case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),n._closed=!1,n._url=e,n._ws=null,n._socketShouldReconnect=r,n._isConnected=!1,n._lastTimerId=null,n._roomJoined=!1,m.info("Request received to instantiate websocket transport! with url :%s",e),n.createAndUpdateSocket({connectionType:null}),n}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){m.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){m.error("close() | error closing the WebSocket: %o",e)}}}},{key:"send",value:(r=(0,i.default)(l.default.mark(function e(t){var r;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}return m.error("Transport closed or not yet ready. Try again later!"),e.abrupt("return");case 1:e.prev=1,this._ws.send(JSON.stringify(t)),e.next=3;break;case 2:throw e.prev=2,r=e.catch(1),m.warn("send() failed:%o",r),r;case 3:case"end":return e.stop()}},e,this,[[1,2]])})),function(e){return r.apply(this,arguments)})}]);var r}(p);t.exports=b},{"../../../Logger":4,"../EnhancedEventEmitter":6,"../utils":11,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63}],11:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/regenerator"));r.generateRandomNumber=function(){return Math.round(1e7*Math.random())},r.sleep=function(){var e=(0,i.default)(a.default.mark(function e(t){return a.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":28,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/regenerator":63}],12:[function(e,t,r){"use strict";var n=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 i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/regenerator")),o=new(n(e("../Logger")).default)("device-manager"),s=(r.chooseMediaLabel=function(){var e=(0,i.default)(a.default.mark(function e(){var t,r;return a.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 n=void 0!==e.find(function(e){return"videoinput"===e.kind}),i=void 0!==e.find(function(e){return"audioinput"===e.kind});return new Promise(function(e,a){navigator.mediaDevices.getUserMedia({audio:i,video:n}).then(function(n){navigator.mediaDevices.enumerateDevices().then(function(i){i.forEach(function(e){"audioinput"===e.kind&&("videoinput"===e.kind?(t.push(e.label),r.push(e.label)):r.push(e.label))}),n.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 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),r.chooseMediaLabelAudio=function(){var e=(0,i.default)(a.default.mark(function e(){var t;return a.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,n){navigator.mediaDevices.getUserMedia({audio:r}).then(function(r){navigator.mediaDevices.enumerateDevices().then(function(n){n.forEach(function(e,r){if("audioinput"===e.kind){var n=e.label||"Mic ".concat(Number(r)+1);t.push({label:n,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 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()),c=r.chooseMediaLabelAudioOutput=function(){var e=(0,i.default)(a.default.mark(function e(){var t;return a.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,n){navigator.mediaDevices.getUserMedia({audio:r}).then(function(r){navigator.mediaDevices.enumerateDevices().then(function(n){n.forEach(function(e,r){if("audiooutput"===e.kind){var n=e.label||"Speaker ".concat(Number(r)+1);t.push({label:n,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 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),u=r.chooseMediaLabelVideo=function(){var e=(0,i.default)(a.default.mark(function e(){var t;return a.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,n){navigator.mediaDevices.getUserMedia({video:r}).then(function(r){navigator.mediaDevices.enumerateDevices().then(function(n){n.forEach(function(e,r){if("videoinput"===e.kind){var n=e.label||"Camera ".concat(Number(r)+1);t.push({label:n,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 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();r.getDeviceId=function(e){return new Promise(function(t){o.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){o.error("err.name:%O ",e.message),t({error:e.name,reason:e.message})})})},r.updatedDeviceList=function(){var e=(0,i.default)(a.default.mark(function e(){var t,r,n;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=[],n=[],e.abrupt("return",new Promise(function(e,i){navigator.mediaDevices.enumerateDevices().then(function(i){i.forEach(function(e,i){if("audioinput"===e.kind){var a=e.label||"Mic ".concat(Number(i)+1);r.push({label:a,deviceId:e.deviceId})}if("videoinput"===e.kind){var o=e.label||"Camera ".concat(Number(i)+1);t.push({label:o,deviceId:e.deviceId})}if("audiooutput"===e.kind){var s=e.label||"Speaker ".concat(Number(i)+1);n.push({label:s,deviceId:e.deviceId})}}),e({audioDevices:r,audioDevicesOutput:n,videoDevices:t})})}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),r.loadAllAvailableDevices=function(){var e=(0,i.default)(a.default.mark(function e(){var t,r,n,i,o,d,l,f;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t={videoDevices:[],audioDevices:[],audioOutputDevices:[]},e.next=1,u();case 1:if(r=e.sent,n=null,!r.error){e.next=8;break}l=r.error,e.next="TypeError"===l?2:"AbortError"===l?3:"NotAllowedError"===l?4:"NotFoundError"===l?5:"NotReadableError"===l?6:7;break;case 2:return e.abrupt("continue",7);case 3:return n="".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("continue",7);case 4:return n="".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("continue",7);case 5:return n="".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("continue",7);case 6:return n="".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("continue",7);case 7:return e.abrupt("return",{success:!1,reason:{code:"EDV01",type:"DeviceError",text:n}});case 8:r.videoDevices&&r.videoDevices.length>0&&(t.videoDevices=r.videoDevices);case 9:return e.next=10,s();case 10:if(i=e.sent,o=null,!i.error){e.next=15;break}f=i.error,e.next="NotAllowedError"===f?11:"NotFoundError"===f?12:"NotReadableError"===f?13:14;break;case 11:return o="".concat(i.error," : ").concat(i.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("continue",14);case 12:return o="".concat(i.error," : ").concat(i.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("continue",14);case 13:return o="".concat(i.error," : ").concat(i.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("continue",14);case 14:return e.abrupt("return",{success:!1,reason:{code:"EDA01",type:"DeviceError",text:o}});case 15:i.audioDevices&&i.audioDevices.length>0&&(t.audioDevices=i.audioDevices);case 16:return e.next=17,c();case 17:if(!(d=e.sent).error){e.next=18;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 18:d.audioDevicesOutput&&d.audioDevicesOutput.length>0&&(t.audioOutputDevices=d.audioDevicesOutput);case 19:return e.abrupt("return",{success:!0,deviceList:t});case 20:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{"../Logger":4,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/regenerator":63}],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 n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.getVidScaleUrl=function(e){return c.apply(this,arguments)};var i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/regenerator")),o=n(e("axios/dist/browser/axios.cjs")),s=n(e("./constants"));new(n(e("../Logger")).default)("vidscale-url");function c(){return(c=(0,i.default)(a.default.mark(function e(t){var r,n,i,o,s,c,d,l,f,p,h;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sessionToken,n=t.roomId,i=t.peerId,o=t.consumerReplicas,s=t.producer,c=void 0===s||s,d=t.consumer,l=void 0===d||d,f=t.participantData,e.next=1,u({sessionToken:r,roomId:n,peerId:i,producer:c,consumer:l,participantData:f});case 1:if(!(p=e.sent).success){e.next=2;break}return e.abrupt("return",{success:!0,wsUrl:"wss://".concat(p.data.url,"/?roomId=").concat(n,"&peerId=").concat(i,"&consumerReplicas=").concat(o),roomUrl:"https://".concat(p.data.url),core:p.data.core});case 2:return h={success:!1,errorText:p.data.reason,errorCode:p.data.code},e.abrupt("return",h);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}var u=function(){var e=(0,i.default)(a.default.mark(function e(t){var r,n,i,c,u,d,l;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.roomId,n=t.peerId,i=t.producer,c=t.consumer,u=t.sessionToken,d=t.participantData,e.next=1,o.default.post("".concat(s.default._security.vidScaleURL),{roomId:r,peerId:n,producer:i,consumer:c,sessionToken:u,participantData:d});case 1:return l=e.sent,e.abrupt("return",new Promise(function(e){try{e(l.data)}catch(e){}}));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{"../Logger":4,"./constants":13,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/regenerator":63,"axios/dist/browser/axios.cjs":86}],17:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.SocketQueue=void 0;var i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass"));r.SocketQueue=function(){return(0,a.default)(function e(){(0,i.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":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/interopRequireDefault":36}],18:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/typeof");Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){return i.random("en")};var i=function(e,t){if("function"==typeof WeakMap)var r=new WeakMap,i=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var a,o,s={__proto__:null,default:e};if(null===e||"object"!=n(e)&&"function"!=typeof e)return s;if(a=t?i:r){if(a.has(e))return a.get(e);a.set(e,s)}for(var c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((o=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(o.get||o.set)?a(s,c,o):s[c]=e[c]);return s}(e,t)}(e("pokemon"))},{"@babel/runtime/helpers/typeof":60,pokemon:347}],19:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.sleep=void 0;var i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/regenerator"));r.sleep=function(){var e=(0,i.default)(a.default.mark(function e(t){return a.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":28,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/regenerator":63}],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 n.has(e)})};var n=r.ALLOWED_QUALITIES=new Set(["240p","360p","480p","720p","1080p","1440p","2160p"])},{}],22:[function(e,t,r){"use strict";var n=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 i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/regenerator"));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 s(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)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){c=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(c)throw a}}}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var c=new(e("../Logger"))("utils-verifyFiles"),u=r.allowedTypes=["mp4"];function d(e,t){try{return new URL(e).pathname.split(".").pop().toLowerCase()===t.toLowerCase()}catch(e){return!1}}function l(){return(l=(0,i.default)(a.default.mark(function e(t){var r,n,i,s,l,f;return a.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=9;break}c.info("Files array length is:%s",t.length),r=o(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(i=n.value,s=i.type,l=i.url,c.info("The file detais are type:%s, url:%s",s,l),u.includes(s)){e.next=3;break}return console.warn('Type "'.concat(s,'" is not allowed.')),e.abrupt("return",{success:!1,reason:'Type "'.concat(s,'" is not allowed.')});case 3:if(d(l,s)){e.next=4;break}return console.warn("Extension mismatch for ".concat(l,"; expected .").concat(s)),e.abrupt("return",{success:!1,reason:"Extension mismatch for ".concat(l,"; expected .").concat(s)});case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,f=e.catch(1),r.e(f);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return e.abrupt("return",{success:!0});case 9:return e.abrupt("return",{success:!1,reason:"There are no files for processing!"});case 10:case"end":return e.stop()}},e,null,[[1,6,7,8]])}))).apply(this,arguments)}},{"../Logger":4,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/regenerator":63}],23:[function(e,t,r){t.exports=function(e,t){this.v=e,this.k=t},t.exports.__esModule=!0,t.exports.default=t.exports},{}],24:[function(e,t,r){t.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},{}],25:[function(e,t,r){t.exports=function(e){if(Array.isArray(e))return e},t.exports.__esModule=!0,t.exports.default=t.exports},{}],26:[function(e,t,r){var n=e("./arrayLikeToArray.js");t.exports=function(e){if(Array.isArray(e))return n(e)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./arrayLikeToArray.js":24}],27:[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},{}],28:[function(e,t,r){function n(e,t,r,n,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}t.exports=function(e){return function(){var t=this,r=arguments;return new Promise(function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,c,"next",e)}function c(e){n(o,i,a,s,c,"throw",e)}s(void 0)})}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],29:[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},{}],30:[function(e,t,r){var n=e("./isNativeReflectConstruct.js"),i=e("./setPrototypeOf.js");t.exports=function(e,t,r){if(n())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,t);var o=new(e.bind.apply(e,a));return r&&i(o,r.prototype),o},t.exports.__esModule=!0,t.exports.default=t.exports},{"./isNativeReflectConstruct.js":38,"./setPrototypeOf.js":54}],31:[function(e,t,r){var n=e("./toPropertyKey.js");function i(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,n(i.key),i)}}t.exports=function(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPropertyKey.js":59}],32:[function(e,t,r){var n=e("./toPropertyKey.js");t.exports=function(e,t,r){return(t=n(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":59}],33:[function(e,t,r){var n=e("./superPropBase.js");function i(){return t.exports=i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var i=n(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}},t.exports.__esModule=!0,t.exports.default=t.exports,i.apply(null,arguments)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{"./superPropBase.js":56}],34:[function(e,t,r){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},{}],35:[function(e,t,r){var n=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&&n(e,t)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./setPrototypeOf.js":54}],36:[function(e,t,r){t.exports=function(e){return e&&e.__esModule?e:{default:e}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],37:[function(e,t,r){t.exports=function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],38:[function(e,t,r){function n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t.exports=n=function(){return!!e},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},{}],39:[function(e,t,r){t.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},t.exports.__esModule=!0,t.exports.default=t.exports},{}],40:[function(e,t,r){t.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],41:[function(e,t,r){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},{}],42:[function(e,t,r){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},{}],43:[function(e,t,r){var n=e("./objectWithoutPropertiesLoose.js");t.exports=function(e,t){if(null==e)return{};var r,i,a=n(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a},t.exports.__esModule=!0,t.exports.default=t.exports},{"./objectWithoutPropertiesLoose.js":44}],44:[function(e,t,r){t.exports=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r},t.exports.__esModule=!0,t.exports.default=t.exports},{}],45:[function(e,t,r){var n=e("./typeof.js").default,i=e("./assertThisInitialized.js");t.exports=function(e,t){if(t&&("object"==n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./assertThisInitialized.js":27,"./typeof.js":60}],46:[function(e,t,r){var n=e("./regeneratorDefine.js");function i(){
9
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
10
- var e,r,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.toStringTag||"@@toStringTag";function c(t,i,a,o){var s=i&&i.prototype instanceof d?i:d,c=Object.create(s.prototype);return n(c,"_invoke",function(t,n,i){var a,o,s,c=0,d=i||[],l=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,o=0,s=e,f.n=r,u}};function p(t,n){for(o=t,s=n,r=0;!l&&c&&!i&&r<d.length;r++){var i,a=d[r],p=f.p,h=a[2];t>3?(i=h===n)&&(s=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=p&&((i=t<2&&p<a[1])?(o=0,f.v=n,f.n=a[1]):p<h&&(i=t<3||a[0]>n||n>h)&&(a[4]=t,a[5]=n,f.n=h,o=0))}if(i||t>1)return u;throw l=!0,n}return function(i,d,h){if(c>1)throw TypeError("Generator is already running");for(l&&1===d&&p(d,h),o=d,s=h;(r=o<2?e:s)||!l;){a||(o?o<3?(o>1&&(f.n=-1),p(o,s)):f.n=s:f.v=s);try{if(c=2,a){if(o||(i="next"),r=a[i]){if(!(r=r.call(a,s)))throw TypeError("iterator result is not an object");if(!r.done)return r;s=r.value,o<2&&(o=0)}else 1===o&&(r=a.return)&&r.call(a),o<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=e}else if((r=(l=f.n<0)?s:t.call(n,f))!==u)break}catch(t){a=e,o=1,s=t}finally{c=1}}return{value:r,done:l}}}(t,a,o),!0),c}var u={};function d(){}function l(){}function f(){}r=Object.getPrototypeOf;var p=[][o]?r(r([][o]())):(n(r={},o,function(){return this}),r),h=f.prototype=d.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,n(e,s,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=f,n(h,"constructor",f),n(f,"constructor",l),l.displayName="GeneratorFunction",n(f,s,"GeneratorFunction"),n(h),n(h,s,"Generator"),n(h,o,function(){return this}),n(h,"toString",function(){return"[object Generator]"}),(t.exports=i=function(){return{w:c,m:m}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},{"./regeneratorDefine.js":50}],47:[function(e,t,r){var n=e("./regeneratorAsyncGen.js");t.exports=function(e,t,r,i,a){var o=n(e,t,r,i,a);return o.next().then(function(e){return e.done?e.value:o.next()})},t.exports.__esModule=!0,t.exports.default=t.exports},{"./regeneratorAsyncGen.js":48}],48:[function(e,t,r){var n=e("./regenerator.js"),i=e("./regeneratorAsyncIterator.js");t.exports=function(e,t,r,a,o){return new i(n().w(e,t,r,a),o||Promise)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./regenerator.js":46,"./regeneratorAsyncIterator.js":49}],49:[function(e,t,r){var n=e("./OverloadYield.js"),i=e("./regeneratorDefine.js");t.exports=function e(t,r){function a(e,i,o,s){try{var c=t[e](i),u=c.value;return u instanceof n?r.resolve(u.v).then(function(e){a("next",e,o,s)},function(e){a("throw",e,o,s)}):r.resolve(u).then(function(e){c.value=e,o(c)},function(e){return a("throw",e,o,s)})}catch(e){s(e)}}var o;this.next||(i(e.prototype),i(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),i(this,"_invoke",function(e,t,n){function i(){return new r(function(t,r){a(e,n,t,r)})}return o=o?o.then(i,i):i()},!0)},t.exports.__esModule=!0,t.exports.default=t.exports},{"./OverloadYield.js":23,"./regeneratorDefine.js":50}],50:[function(e,t,r){function n(e,r,i,a){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}t.exports=n=function(e,t,r,i){function a(t,r){n(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,n(e,r,i,a)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},{}],51:[function(e,t,r){t.exports=function(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}},t.exports.__esModule=!0,t.exports.default=t.exports},{}],52:[function(e,t,r){var n=e("./OverloadYield.js"),i=e("./regenerator.js"),a=e("./regeneratorAsync.js"),o=e("./regeneratorAsyncGen.js"),s=e("./regeneratorAsyncIterator.js"),c=e("./regeneratorKeys.js"),u=e("./regeneratorValues.js");function d(){"use strict";var e=i(),r=e.m(d),l=(Object.getPrototypeOf?Object.getPrototypeOf(r):r.__proto__).constructor;function f(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function h(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,p[e],t)},delegateYield:function(e,i,a){return t.resultName=i,r(n.d,u(e),a)},finish:function(e){return r(n.f,e)}},r=function(e,r,i){n.p=t.prev,n.n=t.next;try{return e(r,i)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(t.exports=d=function(){return{wrap:function(t,r,n,i){return e.w(h(t),r,n,i&&i.reverse())},isGeneratorFunction:f,mark:e.m,awrap:function(e,t){return new n(e,t)},AsyncIterator:s,async:function(e,t,r,n,i){return(f(t)?o:a)(h(e),t,r,n,i)},keys:c,values:u}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=d,t.exports.__esModule=!0,t.exports.default=t.exports},{"./OverloadYield.js":23,"./regenerator.js":46,"./regeneratorAsync.js":47,"./regeneratorAsyncGen.js":48,"./regeneratorAsyncIterator.js":49,"./regeneratorKeys.js":51,"./regeneratorValues.js":53}],53:[function(e,t,r){var n=e("./typeof.js").default;t.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(n(e)+" is not iterable")},t.exports.__esModule=!0,t.exports.default=t.exports},{"./typeof.js":60}],54:[function(e,t,r){function n(e,r){return t.exports=n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e,r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},{}],55:[function(e,t,r){var n=e("./arrayWithHoles.js"),i=e("./iterableToArrayLimit.js"),a=e("./unsupportedIterableToArray.js"),o=e("./nonIterableRest.js");t.exports=function(e,t){return n(e)||i(e,t)||a(e,t)||o()},t.exports.__esModule=!0,t.exports.default=t.exports},{"./arrayWithHoles.js":25,"./iterableToArrayLimit.js":40,"./nonIterableRest.js":41,"./unsupportedIterableToArray.js":61}],56:[function(e,t,r){var n=e("./getPrototypeOf.js");t.exports=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=n(e)););return e},t.exports.__esModule=!0,t.exports.default=t.exports},{"./getPrototypeOf.js":34}],57:[function(e,t,r){var n=e("./arrayWithoutHoles.js"),i=e("./iterableToArray.js"),a=e("./unsupportedIterableToArray.js"),o=e("./nonIterableSpread.js");t.exports=function(e){return n(e)||i(e)||a(e)||o()},t.exports.__esModule=!0,t.exports.default=t.exports},{"./arrayWithoutHoles.js":26,"./iterableToArray.js":39,"./nonIterableSpread.js":42,"./unsupportedIterableToArray.js":61}],58:[function(e,t,r){var n=e("./typeof.js").default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=n(i))return i;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":60}],59:[function(e,t,r){var n=e("./typeof.js").default,i=e("./toPrimitive.js");t.exports=function(e){var t=i(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports},{"./toPrimitive.js":58,"./typeof.js":60}],60:[function(e,t,r){function n(e){return t.exports=n="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,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},{}],61:[function(e,t,r){var n=e("./arrayLikeToArray.js");t.exports=function(e,t){if(e){if("string"==typeof e)return n(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)?n(e,t):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},{"./arrayLikeToArray.js":24}],62:[function(e,t,r){var n=e("./getPrototypeOf.js"),i=e("./setPrototypeOf.js"),a=e("./isNativeFunction.js"),o=e("./construct.js");function s(e){var r="function"==typeof Map?new Map:void 0;return t.exports=s=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return o(e,arguments,n(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports,s(e)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports},{"./construct.js":30,"./getPrototypeOf.js":34,"./isNativeFunction.js":37,"./setPrototypeOf.js":54}],63:[function(e,t,r){var n=e("../helpers/regeneratorRuntime")();t.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},{"../helpers/regeneratorRuntime":52}],64:[function(e,t,r){function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}r.Emitter=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<n.length;i++)if((r=n[i])===t||r.fn===t){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,t)}return this},n.prototype.emitReserved=n.prototype.emit,n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],65:[function(e,t,r){var n=r;n.bignum=e("bn.js"),n.define=e("./asn1/api").define,n.base=e("./asn1/base"),n.constants=e("./asn1/constants"),n.decoders=e("./asn1/decoders"),n.encoders=e("./asn1/encoders")},{"./asn1/api":66,"./asn1/base":68,"./asn1/constants":72,"./asn1/decoders":74,"./asn1/encoders":77,"bn.js":88}],66:[function(e,t,r){var n=e("../asn1"),i=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 i(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(n.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(n.encoders[e])),this.encoders[e]},a.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},{"../asn1":65,inherits:243,vm:460}],67:[function(e,t,r){var n=e("inherits"),i=e("../base").Reporter,a=e("buffer").Buffer;function o(e,t){i.call(this,t),a.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof s||(e=new s(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}}n(o,i),r.DecoderBuffer=o,o.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},o.prototype.restore=function(e){var t=new o(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},o.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},o.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=s,s.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":68,buffer:124,inherits:243}],68:[function(e,t,r){var n=r;n.Reporter=e("./reporter").Reporter,n.DecoderBuffer=e("./buffer").DecoderBuffer,n.EncoderBuffer=e("./buffer").EncoderBuffer,n.Node=e("./node")},{"./buffer":67,"./node":69,"./reporter":70}],69:[function(e,t,r){var n=e("../base").Reporter,i=e("../base").EncoderBuffer,a=e("../base").DecoderBuffer,o=e("minimalistic-assert"),s=["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(s);function u(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=u;var d=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];u.prototype.clone=function(){var e=this._baseState,t={};d.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},u.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)},u.prototype._init=function(e){var t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),o.equal(t.children.length,1,"Root node can have only one child")},u.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&&(o(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(o(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 n=e[r];t[n]=r}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){u.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),s.forEach(function(e){u.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}}),u.prototype.use=function(e){o(e);var t=this._baseState;return o(null===t.use),t.use=e,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(e){var t=this._baseState;return o(null===t.default),t.default=e,t.optional=!0,this},u.prototype.explicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},u.prototype.implicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},u.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},u.prototype.key=function(e){var t=this._baseState;return o(null===t.key),t.key=e,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(e){var t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},u.prototype.contains=function(e){var t=this._baseState;return o(null===t.use),t.contains=e,this},u.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var n,i=r.default,o=!0,s=null;if(null!==r.key&&(s=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(o=this._peekTag(e,c,r.any),e.isError(o))return o}else{var u=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(u)}}if(r.obj&&o&&(n=e.enterObject()),o){if(null!==r.explicit){var d=this._decodeTag(e,r.explicit);if(e.isError(d))return d;e=d}var l=e.offset;if(null===r.use&&null===r.choice){if(r.any)u=e.save();var f=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(f))return f;r.any?i=e.raw(u):e=f}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||(i=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;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 p=new a(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(p,t)}}return r.obj&&o&&(i=e.leaveObject(n)),null===r.key||null===i&&!0!==o?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,i),i},u.prototype._decodeGeneric=function(e,t,r){var n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.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,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},u.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),o(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},u.prototype._decodeChoice=function(e,t){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some(function(a){var o=e.save(),s=r.choice[a];try{var c=s._decode(e,t);if(e.isError(c))return!1;n={type:a,value:c},i=!0}catch(t){return e.restore(o),!1}return!0},this),i?n:e.error("Choice not matched")},u.prototype._createEncoderBuffer=function(e){return new i(e,this.reporter)},u.prototype._encode=function(e,t,r){var n=this._baseState;if(null===n.default||n.default!==e){var i=this._encodeValue(e,t,r);if(void 0!==i&&!this._skipDefault(i,t,r))return i}},u.prototype._encodeValue=function(e,t,r){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);var a=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}var o=null,s=!1;if(i.any)a=this._createEncoderBuffer(e);else if(i.choice)a=this._encodeChoice(e,t);else if(i.contains)o=this._getUse(i.contains,r)._encode(e,t),s=!0;else if(i.children)o=i.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 n=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var i=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var c=this.clone();c._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(r){var n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)},c))}else null!==i.use?a=this._getUse(i.use,r)._encode(e,t):(o=this._encodePrimitive(i.tag,e),s=!0);if(!i.any&&null===i.choice){var u=null!==i.implicit?i.implicit:i.tag,d=null===i.implicit?"universal":"context";null===u?null===i.use&&t.error("Tag could be omitted only for .use()"):null===i.use&&(a=this._encodeComposite(u,s,d,o))}return null!==i.explicit&&(a=this._encodeComposite(i.explicit,!1,"context",a)),a},u.prototype._encodeChoice=function(e,t){var r=this._baseState,n=r.choice[e.type];return n||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},u.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)},u.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},u.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":68,"minimalistic-assert":328}],70:[function(e,t,r){var n=e("inherits");function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function a(e,t){this.path=e,this.rethrow(t)}r.Reporter=i,i.prototype.isError=function(e){return e instanceof a},i.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,r){var n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){var t,r=this._reporterState,n=e instanceof a;if(t=n?e:new a(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!r.options.partial)throw t;return n||r.errors.push(t),t},i.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},n(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:243}],71:[function(e,t,r){var n=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=n._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=n._reverse(r.tag)},{"../constants":72}],72:[function(e,t,r){var n=r;n._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);var n=e[r];t[n]=r}),t},n.der=e("./der")},{"./der":71}],73:[function(e,t,r){var n=e("inherits"),i=e("../../asn1"),a=i.base,o=i.bignum,s=i.constants.der;function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new u,this.tree._init(e.body)}function u(e){a.Node.call(this,"der",e)}function d(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var n=s.tagClass[r>>6],i=!(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:n,primitive:i,tag:r,tagStr:s.tag[r]}}function l(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(!(128&n))return n;var i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(var a=0;a<i;a++){n<<=8;var o=e.readUInt8(r);if(e.isError(o))return o;n|=o}return n}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)},n(u,a.Node),u.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var n=e.save(),i=d(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(n),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||r)},u.prototype._decodeTag=function(e,t,r){var n=d(e,'Failed to decode tag of "'+t+'"');if(e.isError(n))return n;var i=l(e,n.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!r&&n.tag!==t&&n.tagStr!==t&&n.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(n.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');var a=e.save(),o=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(o)?o:(i=e.offset-a.offset,e.restore(a),e.skip(i,'Failed to match body of: "'+t+'"'))},u.prototype._skipUntilEnd=function(e,t){for(;;){var r=d(e,t);if(e.isError(r))return r;var n,i=l(e,r.primitive,t);if(e.isError(i))return i;if(n=r.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(n))return n;if("end"===r.tagStr)break}},u.prototype._decodeList=function(e,t,r,n){for(var i=[];!e.isEmpty();){var a=this._peekTag(e,"end");if(e.isError(a))return a;var o=r.decode(e,"der",n);if(e.isError(o)&&a)break;i.push(o)}return i},u.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 n=e.raw();if(n.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var i="",a=0;a<n.length/2;a++)i+=String.fromCharCode(n.readUInt16BE(2*a));return i}if("numstr"===t){var o=e.raw().toString("ascii");return this._isNumstr(o)?o: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 s=e.raw().toString("ascii");return this._isPrintstr(s)?s:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},u.prototype._decodeObjid=function(e,t,r){for(var n,i=[],a=0;!e.isEmpty();){var o=e.readUInt8();a<<=7,a|=127&o,128&o||(i.push(a),a=0)}128&o&&i.push(a);var s=i[0]/40|0,c=i[0]%40;if(n=r?i:[s,c].concat(i.slice(1)),t){var u=t[n.join(" ")];void 0===u&&(u=t[n.join(".")]),void 0!==u&&(n=u)}return n},u.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var n=0|r.slice(0,4),i=0|r.slice(4,6),a=0|r.slice(6,8),o=0|r.slice(8,10),s=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");n=0|r.slice(0,2),i=0|r.slice(2,4),a=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),c=0|r.slice(10,12);n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,a,o,s,c,0)},u.prototype._decodeNull=function(e){return null},u.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},u.prototype._decodeInt=function(e,t){var r=e.raw(),n=new o(r);return t&&(n=t[n.toString(10)]||n),n},u.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":65,inherits:243}],74:[function(e,t,r){var n=r;n.der=e("./der"),n.pem=e("./pem")},{"./der":73,"./pem":75}],75:[function(e,t,r){var n=e("inherits"),i=e("buffer").Buffer,a=e("./der");function o(e){a.call(this,e),this.enc="pem"}n(o,a),t.exports=o,o.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),n=t.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,u=0;u<r.length;u++){var d=r[u].match(o);if(null!==d&&d[2]===n){if(-1!==s){if("END"!==d[1])break;c=u;break}if("BEGIN"!==d[1])break;s=u}}if(-1===s||-1===c)throw new Error("PEM section not found for: "+n);var l=r.slice(s+1,c).join("");l.replace(/[^a-z0-9\+\/=]+/gi,"");var f=new i(l,"base64");return a.prototype.decode.call(this,f,t)}},{"./der":73,buffer:124,inherits:243}],76:[function(e,t,r){var n=e("inherits"),i=e("buffer").Buffer,a=e("../../asn1"),o=a.base,s=a.constants.der;function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new u,this.tree._init(e.body)}function u(e){o.Node.call(this,"der",e)}function d(e){return e<10?"0"+e:e}t.exports=c,c.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},n(u,o.Node),u.prototype._encodeComposite=function(e,t,r,n){var a,o=function(e,t,r,n){var i;"seqof"===e?e="seq":"setof"===e&&(e="set");if(s.tagByName.hasOwnProperty(e))i=s.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return n.error("Unknown tag: "+e);i=e}if(i>=31)return n.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=s.tagClassByName[r||"universal"]<<6,i}(e,t,r,this.reporter);if(n.length<128)return(a=new i(2))[0]=o,a[1]=n.length,this._createEncoderBuffer([a,n]);for(var c=1,u=n.length;u>=256;u>>=8)c++;(a=new i(2+c))[0]=o,a[1]=128|c;u=1+c;for(var d=n.length;d>0;u--,d>>=8)a[u]=255&d;return this._createEncoderBuffer([a,n])},u.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new i(2*e.length),n=0;n<e.length;n++)r.writeUInt16BE(e.charCodeAt(n),2*n);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")},u.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 n=0;n<e.length;n++)e[n]|=0}else if(Array.isArray(e)){e=e.slice();for(n=0;n<e.length;n++)e[n]|=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(n=0;n<e.length;n++){var o=e[n];for(a++;o>=128;o>>=7)a++}var s=new i(a),c=s.length-1;for(n=e.length-1;n>=0;n--){o=e[n];for(s[c--]=127&o;(o>>=7)>0;)s[c--]=128|127&o}return this._createEncoderBuffer(s)},u.prototype._encodeTime=function(e,t){var r,n=new Date(e);return"gentime"===t?r=[d(n.getFullYear()),d(n.getUTCMonth()+1),d(n.getUTCDate()),d(n.getUTCHours()),d(n.getUTCMinutes()),d(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[d(n.getFullYear()%100),d(n.getUTCMonth()+1),d(n.getUTCDate()),d(n.getUTCHours()),d(n.getUTCMinutes()),d(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.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&&!i.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new i(r)}if(i.isBuffer(e)){var n=e.length;0===e.length&&n++;var a=new i(n);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]);n=1;for(var o=e;o>=256;o>>=8)n++;for(o=(a=new Array(n)).length-1;o>=0;o--)a[o]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new i(a))},u.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},u.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},u.prototype._skipDefault=function(e,t,r){var n,i=this._baseState;if(null===i.default)return!1;var a=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,r).join()),a.length!==i.defaultBuffer.length)return!1;for(n=0;n<a.length;n++)if(a[n]!==i.defaultBuffer[n])return!1;return!0}},{"../../asn1":65,buffer:124,inherits:243}],77:[function(e,t,r){var n=r;n.der=e("./der"),n.pem=e("./pem")},{"./der":76,"./pem":78}],78:[function(e,t,r){var n=e("inherits"),i=e("./der");function a(e){i.call(this,e),this.enc="pem"}n(a,i),t.exports=a,a.prototype.encode=function(e,t){for(var r=i.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+t.label+"-----"],a=0;a<r.length;a+=64)n.push(r.slice(a,a+64));return n.push("-----END "+t.label+"-----"),n.join("\n")}},{"./der":76,inherits:243}],79:[function(e,t,r){"use strict";var n=e("possible-typed-array-names"),i="undefined"==typeof globalThis?global:globalThis;t.exports=function(){for(var e=[],t=0;t<n.length;t++)"function"==typeof i[n[t]]&&(e[e.length]=n[t]);return e}},{"possible-typed-array-names":348}],80:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AwaitQueue=void 0;const n=e("./Logger"),i=e("./errors"),a=new n.Logger("AwaitQueue");r.AwaitQueue=class{pendingTasks=new Map;nextTaskId=0;stopping=!1;constructor(){a.debug("constructor()")}get size(){return this.pendingTasks.size}async push(e,t){if(t=t??e.name,a.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 i={id:this.nextTaskId++,task:e,name:t,enqueuedAt:Date.now(),executedAt:void 0,completed:!1,resolve:e=>{if(i.completed)return;i.completed=!0,this.pendingTasks.delete(i.id),a.debug(`resolving task [name:${i.name}]`),r(e);const[t]=this.pendingTasks.values();t&&!t.executedAt&&this.execute(t)},reject:e=>{if(!i.completed&&(i.completed=!0,this.pendingTasks.delete(i.id),a.debug(`rejecting task [name:${i.name}]: %s`,String(e)),n(e),!this.stopping)){const[e]=this.pendingTasks.values();e&&!e.executedAt&&this.execute(e)}}};this.pendingTasks.set(i.id,i),1===this.pendingTasks.size&&this.execute(i)})}stop(){a.debug("stop()"),this.stopping=!0;for(const e of this.pendingTasks.values())a.debug(`stop() | stopping task [name:${e.name}]`),e.reject(new i.AwaitQueueStoppedError);this.stopping=!1}remove(e){a.debug(`remove() [taskIdx:${e}]`);const t=Array.from(this.pendingTasks.values())[e];t?t.reject(new i.AwaitQueueRemovedTaskError):a.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(a.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":81,"./errors":82}],81:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Logger=void 0;const n=e("debug"),i="awaitqueue";r.Logger=class{_debug;_warn;_error;constructor(e){e?(this._debug=n(`${i}:${e}`),this._warn=n(`${i}:WARN:${e}`),this._error=n(`${i}:ERROR:${e}`)):(this._debug=n(i),this._warn=n(`${i}:WARN`),this._error=n(`${i}: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:84}],82:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AwaitQueueRemovedTaskError=r.AwaitQueueStoppedError=void 0;class n extends Error{constructor(e){super(e??"queue stopped"),this.name="AwaitQueueStoppedError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,n)}}r.AwaitQueueStoppedError=n;class i extends Error{constructor(e){super(e??"queue task removed"),this.name="AwaitQueueRemovedTaskError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,i)}}r.AwaitQueueRemovedTaskError=i},{}],83:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AwaitQueueRemovedTaskError=r.AwaitQueueStoppedError=r.AwaitQueue=void 0;var n=e("./AwaitQueue");Object.defineProperty(r,"AwaitQueue",{enumerable:!0,get:function(){return n.AwaitQueue}});var i=e("./errors");Object.defineProperty(r,"AwaitQueueStoppedError",{enumerable:!0,get:function(){return i.AwaitQueueStoppedError}}),Object.defineProperty(r,"AwaitQueueRemovedTaskError",{enumerable:!0,get:function(){return i.AwaitQueueRemovedTaskError}})},{"./AwaitQueue":80,"./errors":82}],84:[function(e,t,r){r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),e.splice(i,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")||r.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch(e){}}(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},{"./common":85}],85:[function(e,t,r){t.exports=function(t){function r(e){let t,i,a,o=null;function s(...e){if(!s.enabled)return;const n=s,i=Number(new Date),a=i-(t||i);n.diff=a,n.prev=t,n.curr=i,t=i,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if("%%"===t)return"%";o++;const a=r.formatters[i];if("function"==typeof a){const r=e[o];t=a.call(n,r),e.splice(o,1),o--}return t}),r.formatArgs.call(n,e);(n.log||r.log).apply(n,e)}return s.namespace=e,s.useColors=r.useColors(),s.color=r.selectColor(e),s.extend=n,s.destroy=r.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==r.namespaces&&(i=r.namespaces,a=r.enabled(e)),a),set:e=>{o=e}}),"function"==typeof r.init&&r.init(s),s}function n(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e,t){let r=0,n=0,i=-1,a=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(i=n,a=r,n++):(r++,n++);else{if(-1===i)return!1;n=i+1,a++,r=a}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return r.debug=r,r.default=r,r.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},r.disable=function(){const e=[...r.names,...r.skips.map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){r.save(e),r.namespaces=e,r.names=[],r.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?r.skips.push(e.slice(1)):r.names.push(e)},r.enabled=function(e){for(const t of r.skips)if(i(e,t))return!1;for(const t of r.names)if(i(e,t))return!0;return!1},r.humanize=e("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{r[e]=t[e]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:330}],86:[function(e,t,r){
11
- /*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors */
12
- "use strict";function n(e,t){return function(){return e.apply(t,arguments)}}const{toString:i}=Object.prototype,{getPrototypeOf:a}=Object,{iterator:o,toStringTag:s}=Symbol,c=(u=Object.create(null),e=>{const t=i.call(e);return u[t]||(u[t]=t.slice(8,-1).toLowerCase())});var u;const d=e=>(e=e.toLowerCase(),t=>c(t)===e),l=e=>t=>typeof t===e,{isArray:f}=Array,p=l("undefined");function h(e){return null!==e&&!p(e)&&null!==e.constructor&&!p(e.constructor)&&v(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const m=d("ArrayBuffer");const b=l("string"),v=l("function"),g=l("number"),y=e=>null!==e&&"object"==typeof e,_=e=>{if("object"!==c(e))return!1;const t=a(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||s in e||o in e)},w=d("Date"),k=d("File"),S=d("Blob"),x=d("FileList"),E=d("URLSearchParams"),[P,R,M,C]=["ReadableStream","Request","Response","Headers"].map(d);function T(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),f(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(h(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function A(e,t){if(h(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,O=e=>!p(e)&&e!==I;const j=(D="undefined"!=typeof Uint8Array&&a(Uint8Array),e=>D&&e instanceof D);var D;const L=d("HTMLFormElement"),B=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),N=d("RegExp"),F=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};T(r,(r,i)=>{let a;!1!==(a=t(r,i,e))&&(n[i]=a||r)}),Object.defineProperties(e,n)};const U=d("AsyncFunction"),q=(z="function"==typeof setImmediate,V=v(I.postMessage),z?setImmediate:V?(W=`axios@${Math.random()}`,G=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===W&&G.length&&G.shift()()},!1),e=>{G.push(e),I.postMessage(W,"*")}):e=>setTimeout(e));var z,V,W,G;const H="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||q;var K={isArray:f,isArrayBuffer:m,isBuffer:h,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||v(e.append)&&("formdata"===(t=c(e))||"object"===t&&v(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&m(e.buffer),t},isString:b,isNumber:g,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:_,isEmptyObject:e=>{if(!y(e)||h(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:P,isRequest:R,isResponse:M,isHeaders:C,isUndefined:p,isDate:w,isFile:k,isBlob:S,isRegExp:N,isFunction:v,isStream:e=>y(e)&&v(e.pipe),isURLSearchParams:E,isTypedArray:j,isFileList:x,forEach:T,merge:function e(){const{caseless:t}=O(this)&&this||{},r={},n=(n,i)=>{const a=t&&A(r,i)||i;_(r[a])&&_(n)?r[a]=e(r[a],n):_(n)?r[a]=e({},n):f(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&T(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:i}={})=>(T(t,(t,i)=>{r&&v(t)?e[i]=n(t,r):e[i]=t},{allOwnKeys:i}),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,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,s;const c={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],n&&!n(s,e,t)||c[s]||(t[s]=e[s],c[s]=!0);e=!1!==r&&a(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:c,kindOfTest:d,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(f(e))return e;let t=e.length;if(!g(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[o]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:L,hasOwnProperty:B,hasOwnProp:B,reduceDescriptors:F,freezeMethods:e=>{F(e,(t,r)=>{if(v(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];v(n)&&(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={},n=e=>{e.forEach(e=>{r[e]=!0})};return f(e)?n(e):n(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)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:A,global:I,isContextDefined:O,isSpecCompliantForm:function(e){return!!(e&&v(e.append)&&"FormData"===e[s]&&e[o])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(h(e))return e;if(!("toJSON"in e)){t[n]=e;const i=f(e)?[]:{};return T(e,(e,t)=>{const a=r(e,n+1);!p(a)&&(i[t]=a)}),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:U,isThenable:e=>e&&(y(e)||v(e))&&v(e.then)&&v(e.catch),setImmediate:q,asap:H,isIterable:e=>null!=e&&v(e[o])};function $(e,t,r,n,i){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),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}K.inherits($,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:K.toJSONObject(this.config),code:this.code,status:this.status}}});const J=$.prototype,Y={};["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=>{Y[e]={value:e}}),Object.defineProperties($,Y),Object.defineProperty(J,"isAxiosError",{value:!0}),$.from=(e,t,r,n,i,a)=>{const o=Object.create(J);return K.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),$.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function X(e){return K.isPlainObject(e)||K.isArray(e)}function Z(e){return K.endsWith(e,"[]")?e.slice(0,-2):e}function Q(e,t,r){return e?e.concat(t).map(function(e,t){return e=Z(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const ee=K.toFlatObject(K,{},null,function(e){return/^is[A-Z]/.test(e)});function te(e,t,r){if(!K.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=K.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!K.isUndefined(t[e])})).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&K.isSpecCompliantForm(t);if(!K.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(K.isDate(e))return e.toISOString();if(K.isBoolean(e))return e.toString();if(!s&&K.isBlob(e))throw new $("Blob is not supported. Use a Buffer instead.");return K.isArrayBuffer(e)||K.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(K.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(K.isArray(e)&&function(e){return K.isArray(e)&&!e.some(X)}(e)||(K.isFileList(e)||K.endsWith(r,"[]"))&&(s=K.toArray(e)))return r=Z(r),s.forEach(function(e,n){!K.isUndefined(e)&&null!==e&&t.append(!0===o?Q([r],n,a):null===o?r:r+"[]",c(e))}),!1;return!!X(e)||(t.append(Q(i,r,a),c(e)),!1)}const d=[],l=Object.assign(ee,{defaultVisitor:u,convertValue:c,isVisitable:X});if(!K.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!K.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),K.forEach(r,function(r,a){!0===(!(K.isUndefined(r)||null===r)&&i.call(t,r,K.isString(a)?a.trim():a,n,l))&&e(r,n?n.concat(a):[a])}),d.pop()}}(e),t}function re(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ne(e,t){this._pairs=[],e&&te(e,this,t)}const ie=ne.prototype;function ae(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function oe(e,t,r){if(!t)return e;const n=r&&r.encode||ae;K.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let a;if(a=i?i(t,r):K.isURLSearchParams(t)?t.toString():new ne(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}ie.append=function(e,t){this._pairs.push([e,t])},ie.toString=function(e){const t=e?function(t){return e.call(this,t,re)}:re;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var se=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){K.forEach(this.handlers,function(t){null!==t&&e(t)})}},ce={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ue={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ne,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const de="undefined"!=typeof window&&"undefined"!=typeof document,le="object"==typeof navigator&&navigator||void 0,fe=de&&(!le||["ReactNative","NativeScript","NS"].indexOf(le.product)<0),pe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,he=de&&window.location.href||"http://localhost";var me={...Object.freeze({__proto__:null,hasBrowserEnv:de,hasStandardBrowserWebWorkerEnv:pe,hasStandardBrowserEnv:fe,navigator:le,origin:he}),...ue};function be(e){function t(e,r,n,i){let a=e[i++];if("__proto__"===a)return!0;const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&K.isArray(n)?n.length:a,s)return K.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&K.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&K.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(K.isFormData(e)&&K.isFunction(e.entries)){const r={};return K.forEachEntry(e,(e,n)=>{t(function(e){return K.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const ve={transitional:ce,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=K.isObject(e);i&&K.isHTMLForm(e)&&(e=new FormData(e));if(K.isFormData(e))return n?JSON.stringify(be(e)):e;if(K.isArrayBuffer(e)||K.isBuffer(e)||K.isStream(e)||K.isFile(e)||K.isBlob(e)||K.isReadableStream(e))return e;if(K.isArrayBufferView(e))return e.buffer;if(K.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return te(e,new me.classes.URLSearchParams,{visitor:function(e,t,r,n){return me.isNode&&K.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((a=K.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return te(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(K.isString(e))try{return(t||JSON.parse)(e),K.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ve.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(K.isResponse(e)||K.isReadableStream(e))return e;if(e&&K.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw $.from(e,$.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:me.classes.FormData,Blob:me.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};K.forEach(["delete","get","head","post","put","patch"],e=>{ve.headers[e]={}});var ge=ve;const ye=K.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 _e=Symbol("internals");function we(e){return e&&String(e).trim().toLowerCase()}function ke(e){return!1===e||null==e?e:K.isArray(e)?e.map(ke):String(e)}function Se(e,t,r,n,i){return K.isFunction(n)?n.call(this,t,r):(i&&(t=r),K.isString(t)?K.isString(n)?-1!==t.indexOf(n):K.isRegExp(n)?n.test(t):void 0:void 0)}class xe{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=we(t);if(!i)throw new Error("header name must be a non-empty string");const a=K.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=ke(e))}const a=(e,t)=>K.forEach(e,(e,r)=>i(e,r,t));if(K.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(K.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&ye[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(K.isObject(e)&&K.isIterable(e)){let r,n,i={};for(const t of e){if(!K.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[n=t[0]]=(r=i[n])?K.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=we(e)){const r=K.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 n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(K.isFunction(t))return t.call(this,e,r);if(K.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=we(e)){const r=K.findKey(this,e);return!(!r||void 0===this[r]||t&&!Se(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=we(e)){const i=K.findKey(r,e);!i||t&&!Se(0,r[i],i,t)||(delete r[i],n=!0)}}return K.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!Se(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return K.forEach(this,(n,i)=>{const a=K.findKey(r,i);if(a)return t[a]=ke(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(i):String(i).trim();o!==i&&delete t[i],t[o]=ke(n),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return K.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&K.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")}getSetCookie(){return this.get("set-cookie")||[]}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[_e]=this[_e]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=we(e);t[n]||(!function(e,t){const r=K.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})})}(r,e),t[n]=!0)}return K.isArray(e)?e.forEach(n):n(e),this}}xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),K.reduceDescriptors(xe.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),K.freezeMethods(xe);var Ee=xe;function Pe(e,t){const r=this||ge,n=t||r,i=Ee.from(n.headers);let a=n.data;return K.forEach(e,function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function Re(e){return!(!e||!e.__CANCEL__)}function Me(e,t,r){$.call(this,null==e?"canceled":e,$.ERR_CANCELED,t,r),this.name="CanceledError"}function Ce(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new $("Request failed with status code "+r.status,[$.ERR_BAD_REQUEST,$.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}K.inherits(Me,$,{__CANCEL__:!0});const Te=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[o];i||(i=c),r[a]=s,n[a]=c;let d=o,l=0;for(;d!==a;)l+=r[d++],d%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),c-i<t)return;const f=u&&c-u;return f?Math.round(1e3*l/f):void 0}}(50,250);return function(e,t){let r,n,i=0,a=1e3/t;const o=(t,a=Date.now())=>{i=a,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-i;s>=a?o(e,t):(r=e,n||(n=setTimeout(()=>{n=null,o(r)},a-s)))},()=>r&&o(r)]}(r=>{const a=r.loaded,o=r.lengthComputable?r.total:void 0,s=a-n,c=i(s);n=a;e({loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:c||void 0,estimated:c&&o&&a<=o?(o-a)/c:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},Ae=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ie=e=>(...t)=>K.asap(()=>e(...t));var Oe=me.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,me.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(me.origin),me.navigator&&/(msie|trident)/i.test(me.navigator.userAgent)):()=>!0,je=me.hasStandardBrowserEnv?{write(e,t,r,n,i,a){const o=[e+"="+encodeURIComponent(t)];K.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),K.isString(n)&&o.push("path="+n),K.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function De(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Le=e=>e instanceof Ee?{...e}:e;function Be(e,t){t=t||{};const r={};function n(e,t,r,n){return K.isPlainObject(e)&&K.isPlainObject(t)?K.merge.call({caseless:n},e,t):K.isPlainObject(t)?K.merge({},t):K.isArray(t)?t.slice():t}function i(e,t,r,i){return K.isUndefined(t)?K.isUndefined(e)?void 0:n(void 0,e,0,i):n(e,t,0,i)}function a(e,t){if(!K.isUndefined(t))return n(void 0,t)}function o(e,t){return K.isUndefined(t)?K.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t,r)=>i(Le(e),Le(t),0,!0)};return K.forEach(Object.keys({...e,...t}),function(n){const a=c[n]||i,o=a(e[n],t[n],n);K.isUndefined(o)&&a!==s||(r[n]=o)}),r}var Ne=e=>{const t=Be({},e);let r,{data:n,withXSRFToken:i,xsrfHeaderName:a,xsrfCookieName:o,headers:s,auth:c}=t;if(t.headers=s=Ee.from(s),t.url=oe(De(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),K.isFormData(n))if(me.hasStandardBrowserEnv||me.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(r=s.getContentType())){const[e,...t]=r?r.split(";").map(e=>e.trim()).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(me.hasStandardBrowserEnv&&(i&&K.isFunction(i)&&(i=i(t)),i||!1!==i&&Oe(t.url))){const e=a&&o&&je.read(o);e&&s.set(a,e)}return t};var Fe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Ne(e);let i=n.data;const a=Ee.from(n.headers).normalize();let o,s,c,u,d,{responseType:l,onUploadProgress:f,onDownloadProgress:p}=n;function h(){u&&u(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let m=new XMLHttpRequest;function b(){if(!m)return;const n=Ee.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ce(function(e){t(e),h()},function(e){r(e),h()},{data:l&&"text"!==l&&"json"!==l?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(b)},m.onabort=function(){m&&(r(new $("Request aborted",$.ECONNABORTED,e,m)),m=null)},m.onerror=function(){r(new $("Network Error",$.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||ce;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new $(t,i.clarifyTimeoutError?$.ETIMEDOUT:$.ECONNABORTED,e,m)),m=null},void 0===i&&a.setContentType(null),"setRequestHeader"in m&&K.forEach(a.toJSON(),function(e,t){m.setRequestHeader(t,e)}),K.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),l&&"json"!==l&&(m.responseType=n.responseType),p&&([c,d]=Te(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([s,u]=Te(f),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(o=t=>{m&&(r(!t||t.type?new Me(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===me.protocols.indexOf(v)?r(new $("Unsupported protocol "+v+":",$.ERR_BAD_REQUEST,e)):m.send(i||null)})};var Ue=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const i=function(e){if(!r){r=!0,o();const t=e instanceof Error?e:this.reason;n.abort(t instanceof $?t:new Me(t instanceof Error?t.message:t))}};let a=t&&setTimeout(()=>{a=null,i(new $(`timeout ${t} of ms exceeded`,$.ETIMEDOUT))},t);const o=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:s}=n;return s.unsubscribe=()=>K.asap(o),s}};const qe=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},ze=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Ve=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of ze(e))yield*qe(r,t)}(e,t);let a,o=0,s=e=>{a||(a=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return s(),void e.close();let a=n.byteLength;if(r){let e=o+=a;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),i.return())},{highWaterMark:2})},We="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Ge=We&&"function"==typeof ReadableStream,He=We&&("function"==typeof TextEncoder?(Ke=new TextEncoder,e=>Ke.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ke;const $e=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Je=Ge&&$e(()=>{let e=!1;const t=new Request(me.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ye=Ge&&$e(()=>K.isReadableStream(new Response("").body)),Xe={stream:Ye&&(e=>e.body)};var Ze;We&&(Ze=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Xe[e]&&(Xe[e]=K.isFunction(Ze[e])?t=>t[e]():(t,r)=>{throw new $(`Response type '${e}' is not supported`,$.ERR_NOT_SUPPORT,r)})}));const Qe=async(e,t)=>{const r=K.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(K.isBlob(e))return e.size;if(K.isSpecCompliantForm(e)){const t=new Request(me.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return K.isArrayBufferView(e)||K.isArrayBuffer(e)?e.byteLength:(K.isURLSearchParams(e)&&(e+=""),K.isString(e)?(await He(e)).byteLength:void 0)})(t):r};const et={http:null,xhr:Fe,fetch:We&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:a,timeout:o,onDownloadProgress:s,onUploadProgress:c,responseType:u,headers:d,withCredentials:l="same-origin",fetchOptions:f}=Ne(e);u=u?(u+"").toLowerCase():"text";let p,h=Ue([i,a&&a.toAbortSignal()],o);const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let b;try{if(c&&Je&&"get"!==r&&"head"!==r&&0!==(b=await Qe(d,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(K.isFormData(n)&&(e=r.headers.get("content-type"))&&d.setContentType(e),r.body){const[e,t]=Ae(b,Te(Ie(c)));n=Ve(r.body,65536,e,t)}}K.isString(l)||(l=l?"include":"omit");const i="credentials"in Request.prototype;p=new Request(t,{...f,signal:h,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:i?l:void 0});let a=await fetch(p,f);const o=Ye&&("stream"===u||"response"===u);if(Ye&&(s||o&&m)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=a[t]});const t=K.toFiniteNumber(a.headers.get("content-length")),[r,n]=s&&Ae(t,Te(Ie(s),!0))||[];a=new Response(Ve(a.body,65536,r,()=>{n&&n(),m&&m()}),e)}u=u||"text";let v=await Xe[K.findKey(Xe,u)||"text"](a,e);return!o&&m&&m(),await new Promise((t,r)=>{Ce(t,r,{data:v,headers:Ee.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:p})})}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new $("Network Error",$.ERR_NETWORK,e,p),{cause:t.cause||t});throw $.from(t,t&&t.code,e,p)}})};K.forEach(et,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const tt=e=>`- ${e}`,rt=e=>K.isFunction(e)||null===e||!1===e;var nt=e=>{e=K.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let a=0;a<t;a++){let t;if(r=e[a],n=r,!rt(r)&&(n=et[(t=String(r)).toLowerCase()],void 0===n))throw new $(`Unknown adapter '${t}'`);if(n)break;i[t||"#"+a]=n}if(!n){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new $("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(tt).join("\n"):" "+tt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function it(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Me(null,e)}function at(e){it(e),e.headers=Ee.from(e.headers),e.data=Pe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return nt(e.adapter||ge.adapter)(e).then(function(t){return it(e),t.data=Pe.call(e,e.transformResponse,t),t.headers=Ee.from(t.headers),t},function(t){return Re(t)||(it(e),t&&t.response&&(t.response.data=Pe.call(e,e.transformResponse,t.response),t.response.headers=Ee.from(t.response.headers))),Promise.reject(t)})}const ot="1.11.0",st={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{st[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ct={};st.transitional=function(e,t,r){function n(e,t){return"[Axios v"+ot+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new $(n(i," has been removed"+(t?" in "+t:"")),$.ERR_DEPRECATED);return t&&!ct[i]&&(ct[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}},st.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var ut={assertOptions:function(e,t,r){if("object"!=typeof e)throw new $("options must be an object",$.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new $("option "+a+" must be "+r,$.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new $("Unknown option "+a,$.ERR_BAD_OPTION)}},validators:st};const dt=ut.validators;class lt{constructor(e){this.defaults=e||{},this.interceptors={request:new se,response:new se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Be(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&ut.assertOptions(r,{silentJSONParsing:dt.transitional(dt.boolean),forcedJSONParsing:dt.transitional(dt.boolean),clarifyTimeoutError:dt.transitional(dt.boolean)},!1),null!=n&&(K.isFunction(n)?t.paramsSerializer={serialize:n}:ut.assertOptions(n,{encode:dt.function,serialize:dt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ut.assertOptions(t,{baseUrl:dt.spelling("baseURL"),withXsrfToken:dt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&K.merge(i.common,i[t.method]);i&&K.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=Ee.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,l=0;if(!s){const e=[at.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,u=Promise.resolve(t);l<d;)u=u.then(e[l++],e[l++]);return u}d=o.length;let f=t;for(l=0;l<d;){const e=o[l++],t=o[l++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=at.call(this,f)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)u=u.then(c[l++],c[l++]);return u}getUri(e){return oe(De((e=Be(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}K.forEach(["delete","get","head","options"],function(e){lt.prototype[e]=function(t,r){return this.request(Be(r||{},{method:e,url:t,data:(r||{}).data}))}}),K.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,i){return this.request(Be(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}lt.prototype[e]=t(),lt.prototype[e+"Form"]=t(!0)});var ft=lt;class pt{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 n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,i){r.reason||(r.reason=new Me(e,n,i),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)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new pt(function(t){e=t}),cancel:e}}}var ht=pt;const mt={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(mt).forEach(([e,t])=>{mt[t]=e});var bt=mt;const vt=function e(t){const r=new ft(t),i=n(ft.prototype.request,r);return K.extend(i,ft.prototype,r,{allOwnKeys:!0}),K.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(Be(t,r))},i}(ge);vt.Axios=ft,vt.CanceledError=Me,vt.CancelToken=ht,vt.isCancel=Re,vt.VERSION=ot,vt.toFormData=te,vt.AxiosError=$,vt.Cancel=vt.CanceledError,vt.all=function(e){return Promise.all(e)},vt.spread=function(e){return function(t){return e.apply(null,t)}},vt.isAxiosError=function(e){return K.isObject(e)&&!0===e.isAxiosError},vt.mergeConfig=Be,vt.AxiosHeaders=Ee,vt.formToJSON=e=>be(K.isHTMLForm(e)?new FormData(e):e),vt.getAdapter=nt,vt.HttpStatusCode=bt,vt.default=vt,t.exports=vt},{}],87:[function(e,t,r){"use strict";r.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=c(e),o=n[0],s=n[1],u=new a(function(e,t,r){return 3*(t+r)/4-r}(0,o,s)),d=0,l=s>0?o-4:o;for(r=0;r<l;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[d++]=t>>16&255,u[d++]=t>>8&255,u[d++]=255&t;2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[d++]=255&t);1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[d++]=t>>8&255,u[d++]=255&t);return u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(d(e,s,s+o>c?c:s+o));1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;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 u(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function d(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(u(n));return i.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],88:[function(e,t,r){!function(t,r){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(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 o;"object"==typeof t?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function s(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 n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,a=Math.min(e.length,r),o=t;o<a;o++){var s=e.charCodeAt(o)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}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),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"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):(n(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(n("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 i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===r)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=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 n=0;n<this.length;n++)this.words[n]=0;var i,a=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=c(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=c(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,o=a%n,s=Math.min(a,a-o)+r,c=0,d=r;d<s;d+=n)c=u(e,d,d+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var l=1;for(c=u(e,d,e.length,t),d=0;d<o;d++)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 d=["","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],f=[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 p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,c=o/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var d=c>>>26,l=67108863&c,f=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=f;p++){var h=u-p|0;d+=(o=(i=0|e.words[h])*(a=0|t.words[p])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,c=0|d}return 0!==c?r.words[u]=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 i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==a||o!==this.length-1?d[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 u=l[e],p=f[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modn(p).toString(e);r=(h=h.idivn(p)).isZero()?m+r:d[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!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&&n(!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 n(void 0!==o),this.toArrayLike(o,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,u=new e(a),d=this.clone();if(c){for(s=0;!d.isZero();s++)o=d.andln(255),d.iushrn(8),u[s]=o;for(;s<a;s++)u[s]=0}else{for(s=0;s<a-i;s++)u[s]=0;for(s=0;!d.isZero();s++)o=d.andln(255),d.iushrn(8),u[a-s-1]=o}return u},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 n(0===(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 n(0===(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 n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return n(0===(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},a.prototype.iadd=function(e){var t,r,n;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,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<r.length;a++)t=(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,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,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o<n.length;o++)a=(t=(0|r.words[o])-(0|n.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,i,a,o=e.words,s=t.words,c=r.words,u=0,d=0|o[0],l=8191&d,f=d>>>13,p=0|o[1],h=8191&p,m=p>>>13,b=0|o[2],v=8191&b,g=b>>>13,y=0|o[3],_=8191&y,w=y>>>13,k=0|o[4],S=8191&k,x=k>>>13,E=0|o[5],P=8191&E,R=E>>>13,M=0|o[6],C=8191&M,T=M>>>13,A=0|o[7],I=8191&A,O=A>>>13,j=0|o[8],D=8191&j,L=j>>>13,B=0|o[9],N=8191&B,F=B>>>13,U=0|s[0],q=8191&U,z=U>>>13,V=0|s[1],W=8191&V,G=V>>>13,H=0|s[2],K=8191&H,$=H>>>13,J=0|s[3],Y=8191&J,X=J>>>13,Z=0|s[4],Q=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,de=0|s[8],le=8191&de,fe=de>>>13,pe=0|s[9],he=8191&pe,me=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,q)|0))<<13)|0;u=((a=Math.imul(f,z))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(h,q),i=(i=Math.imul(h,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ve=(u+(n=n+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(f,W)|0))<<13)|0;u=((a=a+Math.imul(f,G)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(g,q)|0,a=Math.imul(g,z),n=n+Math.imul(h,W)|0,i=(i=i+Math.imul(h,G)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,G)|0;var ge=(u+(n=n+Math.imul(l,K)|0)|0)+((8191&(i=(i=i+Math.imul(l,$)|0)+Math.imul(f,K)|0))<<13)|0;u=((a=a+Math.imul(f,$)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(_,q),i=(i=Math.imul(_,z))+Math.imul(w,q)|0,a=Math.imul(w,z),n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(g,W)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(h,K)|0,i=(i=i+Math.imul(h,$)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,$)|0;var ye=(u+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,Y)|0))<<13)|0;u=((a=a+Math.imul(f,X)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,a=Math.imul(x,z),n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(w,W)|0,a=a+Math.imul(w,G)|0,n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(g,K)|0,a=a+Math.imul(g,$)|0,n=n+Math.imul(h,Y)|0,i=(i=i+Math.imul(h,X)|0)+Math.imul(m,Y)|0,a=a+Math.imul(m,X)|0;var _e=(u+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(f,Q)|0))<<13)|0;u=((a=a+Math.imul(f,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(R,q)|0,a=Math.imul(R,z),n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(x,W)|0,a=a+Math.imul(x,G)|0,n=n+Math.imul(_,K)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,$)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,X)|0,n=n+Math.imul(h,Q)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,ee)|0;var we=(u+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(f,re)|0))<<13)|0;u=((a=a+Math.imul(f,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,z))+Math.imul(T,q)|0,a=Math.imul(T,z),n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(R,W)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(x,K)|0,a=a+Math.imul(x,$)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(w,Y)|0,a=a+Math.imul(w,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(h,re)|0,i=(i=i+Math.imul(h,ne)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ne)|0;var ke=(u+(n=n+Math.imul(l,ae)|0)|0)+((8191&(i=(i=i+Math.imul(l,oe)|0)+Math.imul(f,ae)|0))<<13)|0;u=((a=a+Math.imul(f,oe)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(O,q)|0,a=Math.imul(O,z),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,G)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,$)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(x,Y)|0,a=a+Math.imul(x,X)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,ee)|0,n=n+Math.imul(v,re)|0,i=(i=i+Math.imul(v,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(h,ae)|0,i=(i=i+Math.imul(h,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Se=(u+(n=n+Math.imul(l,ce)|0)|0)+((8191&(i=(i=i+Math.imul(l,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((a=a+Math.imul(f,ue)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,z))+Math.imul(L,q)|0,a=Math.imul(L,z),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(O,W)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(T,K)|0,a=a+Math.imul(T,$)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ne)|0,n=n+Math.imul(v,ae)|0,i=(i=i+Math.imul(v,oe)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,oe)|0,n=n+Math.imul(h,ce)|0,i=(i=i+Math.imul(h,ue)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,ue)|0;var xe=(u+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,fe)|0)+Math.imul(f,le)|0))<<13)|0;u=((a=a+Math.imul(f,fe)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,z))+Math.imul(F,q)|0,a=Math.imul(F,z),n=n+Math.imul(D,W)|0,i=(i=i+Math.imul(D,G)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,G)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,$)|0,n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(T,Y)|0,a=a+Math.imul(T,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(_,ae)|0,i=(i=i+Math.imul(_,oe)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,oe)|0,n=n+Math.imul(v,ce)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(g,ce)|0,a=a+Math.imul(g,ue)|0,n=n+Math.imul(h,le)|0,i=(i=i+Math.imul(h,fe)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,fe)|0;var Ee=(u+(n=n+Math.imul(l,he)|0)|0)+((8191&(i=(i=i+Math.imul(l,me)|0)+Math.imul(f,he)|0))<<13)|0;u=((a=a+Math.imul(f,me)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(N,W),i=(i=Math.imul(N,G))+Math.imul(F,W)|0,a=Math.imul(F,G),n=n+Math.imul(D,K)|0,i=(i=i+Math.imul(D,$)|0)+Math.imul(L,K)|0,a=a+Math.imul(L,$)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,X)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ne)|0,n=n+Math.imul(S,ae)|0,i=(i=i+Math.imul(S,oe)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,oe)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,ue)|0)+Math.imul(w,ce)|0,a=a+Math.imul(w,ue)|0,n=n+Math.imul(v,le)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(g,le)|0,a=a+Math.imul(g,fe)|0;var Pe=(u+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;u=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(N,K),i=(i=Math.imul(N,$))+Math.imul(F,K)|0,a=Math.imul(F,$),n=n+Math.imul(D,Y)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(L,Y)|0,a=a+Math.imul(L,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(T,re)|0,a=a+Math.imul(T,ne)|0,n=n+Math.imul(P,ae)|0,i=(i=i+Math.imul(P,oe)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,oe)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,ce)|0,a=a+Math.imul(x,ue)|0,n=n+Math.imul(_,le)|0,i=(i=i+Math.imul(_,fe)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,fe)|0;var Re=(u+(n=n+Math.imul(v,he)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(g,he)|0))<<13)|0;u=((a=a+Math.imul(g,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(N,Y),i=(i=Math.imul(N,X))+Math.imul(F,Y)|0,a=Math.imul(F,X),n=n+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ne)|0,n=n+Math.imul(C,ae)|0,i=(i=i+Math.imul(C,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,oe)|0,n=n+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(R,ce)|0,a=a+Math.imul(R,ue)|0,n=n+Math.imul(S,le)|0,i=(i=i+Math.imul(S,fe)|0)+Math.imul(x,le)|0,a=a+Math.imul(x,fe)|0;var Me=(u+(n=n+Math.imul(_,he)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(w,he)|0))<<13)|0;u=((a=a+Math.imul(w,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(N,Q),i=(i=Math.imul(N,ee))+Math.imul(F,Q)|0,a=Math.imul(F,ee),n=n+Math.imul(D,re)|0,i=(i=i+Math.imul(D,ne)|0)+Math.imul(L,re)|0,a=a+Math.imul(L,ne)|0,n=n+Math.imul(I,ae)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,oe)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(T,ce)|0,a=a+Math.imul(T,ue)|0,n=n+Math.imul(P,le)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,fe)|0;var Ce=(u+(n=n+Math.imul(S,he)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,he)|0))<<13)|0;u=((a=a+Math.imul(x,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(N,re),i=(i=Math.imul(N,ne))+Math.imul(F,re)|0,a=Math.imul(F,ne),n=n+Math.imul(D,ae)|0,i=(i=i+Math.imul(D,oe)|0)+Math.imul(L,ae)|0,a=a+Math.imul(L,oe)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(O,ce)|0,a=a+Math.imul(O,ue)|0,n=n+Math.imul(C,le)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(T,le)|0,a=a+Math.imul(T,fe)|0;var Te=(u+(n=n+Math.imul(P,he)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(R,he)|0))<<13)|0;u=((a=a+Math.imul(R,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(N,ae),i=(i=Math.imul(N,oe))+Math.imul(F,ae)|0,a=Math.imul(F,oe),n=n+Math.imul(D,ce)|0,i=(i=i+Math.imul(D,ue)|0)+Math.imul(L,ce)|0,a=a+Math.imul(L,ue)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,fe)|0;var Ae=(u+(n=n+Math.imul(C,he)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(T,he)|0))<<13)|0;u=((a=a+Math.imul(T,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(N,ce),i=(i=Math.imul(N,ue))+Math.imul(F,ce)|0,a=Math.imul(F,ue),n=n+Math.imul(D,le)|0,i=(i=i+Math.imul(D,fe)|0)+Math.imul(L,le)|0,a=a+Math.imul(L,fe)|0;var Ie=(u+(n=n+Math.imul(I,he)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(O,he)|0))<<13)|0;u=((a=a+Math.imul(O,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(N,le),i=(i=Math.imul(N,fe))+Math.imul(F,le)|0,a=Math.imul(F,fe);var Oe=(u+(n=n+Math.imul(D,he)|0)|0)+((8191&(i=(i=i+Math.imul(D,me)|0)+Math.imul(L,he)|0))<<13)|0;u=((a=a+Math.imul(L,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var je=(u+(n=Math.imul(N,he))|0)+((8191&(i=(i=Math.imul(N,me))+Math.imul(F,he)|0))<<13)|0;return u=((a=Math.imul(F,me))+(i>>>13)|0)+(je>>>26)|0,je&=67108863,c[0]=be,c[1]=ve,c[2]=ge,c[3]=ye,c[4]=_e,c[5]=we,c[6]=ke,c[7]=Se,c[8]=xe,c[9]=Ee,c[10]=Pe,c[11]=Re,c[12]=Me,c[13]=Ce,c[14]=Te,c[15]=Ae,c[16]=Ie,c[17]=Oe,c[18]=je,0!==u&&(c[19]=u,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||(h=p),a.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?p(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,c=Math.min(a,t.length-1),u=Math.max(0,a-e.length+1);u<=c;u++){var d=a-u,l=(0|e.words[d])*(0|t.words[u]),f=67108863&l;s=67108863&(f=f+s|0),i+=(o=(o=o+(l/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n: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,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},b.prototype.permute=function(e,t,r,n,i,a){for(var o=0;o<a;o++)n[o]=t[e[o]],i[o]=r[e[o]]},b.prototype.transform=function(e,t,r,n,i,a){this.permute(a,e,t,r,n,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),d=0;d<i;d+=s)for(var l=c,f=u,p=0;p<o;p++){var h=r[d+p],m=n[d+p],b=r[d+p+o],v=n[d+p+o],g=l*b-f*v;v=l*v+f*b,b=g,r[d+p]=h+b,n[d+p]=m+v,r[d+p+o]=h-b,n[d+p+o]=m-v,p!==s&&(g=c*l-u*f,f=c*f+u*l,l=g)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},b.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(0===a),n(!(-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 n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),a=this.stub(n),o=new Array(n),s=new Array(n),c=new Array(n),u=new Array(n),d=new Array(n),l=new Array(n),f=r.words;f.length=n,this.convert13b(e.words,e.length,o,n),this.convert13b(t.words,t.length,u,n),this.transform(o,a,s,c,n,i),this.transform(u,a,d,l,n,i);for(var p=0;p<n;p++){var h=s[p]*d[p]-c[p]*l[p];c[p]=s[p]*l[p]+c[p]*d[p],s[p]=h}return this.conjugate(s,c,n),this.transform(s,c,f,a,n,i),this.conjugate(f,a,n),this.normalize13b(f,n),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){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(0|this.words[r])*e,a=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this.length=0===e?1: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 n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}(e);if(0===t.length)return new a(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},a.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,c=(0|this.words[t])-s<<r;this.words[t]=c|o,o=s>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var u=0;u<o;u++)c.words[u]=this.words[u];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var d=0;for(u=this.length-1;u>=0&&(0!==d||u>=i);u--){var l=0|this.words[u];this.words[u]=d<<26-a|l>>>a,d=l&s}return c&&0!==d&&(c.words[c.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return n(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){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},a.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(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 i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return n("number"==typeof e),n(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(n("number"==typeof e),n(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 i,a,o=e.length+r;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+r])+s;var c=(0|e.words[i])*t;s=((a-=67108863&c)>>26)-(c/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++)s=(a=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&a;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,c=n.length-i.length;if("mod"!==t){(s=new a(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var d=n.clone()._ishlnsubmul(i,1,c);0===d.negative&&(n=d,s&&(s.words[c]=1));for(var l=c-1;l>=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=f)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):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 i,o,s},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,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},a.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new a(1),o=new a(0),s=new a(0),c=new a(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var d=r.clone(),l=t.clone();!t.isZero();){for(var f=0,p=1;0===(t.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(d),o.isub(l)),i.iushrn(1),o.iushrn(1);for(var h=0,m=1;0===(r.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(d),c.isub(l)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),o.isub(c)):(r.isub(t),s.isub(i),c.isub(o))}return{a:s,b:c,gcd:r.iushln(u)}},a.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,o=new a(1),s=new a(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,d=1;0===(t.words[0]&d)&&u<26;++u,d<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(i=0===t.cmpn(1)?o:s).cmpn(0)<0&&i.iadd(e),i},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 n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},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){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=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),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<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 n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(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 S(e)},a.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function g(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(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){S.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)}g.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},i(y,g),y.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[i-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 n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(_,g),i(w,g),i(k,g),k.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(v[e])return v[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 k}return v[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new a(2*d*d).toRed(this);0!==this.pow(d,u).cmp(c);)d.redIAdd(c);for(var l=this.pow(d,i),f=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),h=o;0!==p.cmp(s);){for(var m=p,b=0;0!==m.cmp(s);b++)m=m.redSqr();n(b<h);var v=this.pow(l,new a(1).iushln(h-b-1));f=f.redMul(v),l=v.redSqr(),p=p.redMul(l),h=b}return f},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.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 n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],o=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],d=c-1;d>=0;d--){var l=u>>d&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===n&&0===d)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}c=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new x(e)},i(x,S),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:92}],89:[function(e,t,r){var n,i;n=this,i=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},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 n=r(18),i=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,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),a=e.getVersionPrecision(r),o=Math.max(i,a),s=0,c=e.map([t,r],function(t){var r=o-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(n&&(s=o-Math.min(i,a)),o-=1;o>=s;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===s)return 0;o-=1}else if(c[0][o]<c[1][o])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(a));var s=function(){var e=a[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach(function(t){n[t]=e[t]})};for(t=0,r=a.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,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","Pale Moon":"pale_moon",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",pale_moon:"Pale Moon",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",bot:"bot"},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 n,i=(n=r(91))&&n.__esModule?n:{default:n},a=r(18);function o(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,n.key,n)}}var s=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 i.default(e,t)},e.parse=function(e){return new i.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}}])&&o(t,r),e}();t.default=s,e.exports=t.default},91:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),a=c(r(94)),o=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=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=s.default.find(n.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))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=s.default.find(i.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))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=s.default.find(a.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))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=s.default.find(o.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))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 s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},a=0;if(Object.keys(e).forEach(function(t){var o=e[t];"string"==typeof o?(i[t]=o,a+=1):"object"==typeof o&&(r[t]=o,n+=1)}),n>0){var o=Object.keys(r),c=s.default.find(o,function(e){return t.isOS(e)});if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var d=s.default.find(o,function(e){return t.isPlatform(e)});if(d){var l=this.satisfies(r[d]);if(void 0!==l)return l}}if(a>0){var f=Object.keys(i),p=s.default.find(f,function(e){return t.isBrowser(e,!0)});if(void 0!==p)return this.compareVersion(i[p])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-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=u,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.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=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.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=i.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=i.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=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.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=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.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=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(a,e)||i.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=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.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=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.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=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.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=i.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=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=o,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),o=[{test:[/Roku\/DVP/],describe:function(e){var t=i.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=i.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=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.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=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:a.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.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=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:a.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.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=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:a.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.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=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.PlayStation4,version:t}}}];t.default=o,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),o=[{test:[/googlebot/i],describe:function(){return{type:a.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.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=i.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:[/Nokia/i],describe:function(e){var t=i.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),r={type:a.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(r.model=t),r}},{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=o,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),o=[{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=i.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=i.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=i.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=i.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=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=o,e.exports=t.default}})},"object"==typeof r&&"object"==typeof t?t.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof r?r.bowser=i():n.bowser=i()},{}],90:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},t.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.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?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(i.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");i.prototype._rand=function(e){return a.randomBytes(e)}}catch(e){}},{crypto:92}],91:[function(e,t,r){"use strict";var n,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,c={};((e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})})(c,{BrowserDetector:()=>p,KnownBrowsers:()=>u,KnownPlatforms:()=>d,default:()=>h}),t.exports=(n=c,((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of o(t))!s.call(e,c)&&c!==r&&i(e,c,{get:()=>t[c],enumerable:!(n=a(t,c))||n.enumerable});return e})(i({},"__esModule",{value:!0}),n));var u={chrome:"Google Chrome",brave:"Brave",crios:"Google Chrome",edge:"Microsoft Edge",edg:"Microsoft Edge",edgios:"Microsoft Edge",fennec:"Mozilla Firefox",jsdom:"JsDOM",mozilla:"Mozilla Firefox",fxios:"Mozilla Firefox",msie:"Microsoft Internet Explorer",opera:"Opera",opios:"Opera",opr:"Opera",opt:"Opera",rv:"Microsoft Internet Explorer",safari:"Safari",samsungbrowser:"Samsung Browser",electron:"Electron"},d={android:"Android",androidTablet:"Android Tablet",cros:"Chrome OS",fennec:"Android Tablet",ipad:"IPad",ipod:"IPod",iphone:"IPhone",jsdom:"JsDOM",linux:"Linux",mac:"Macintosh",tablet:"Android Tablet",win:"Windows","windows phone":"Windows Phone",xbox:"Microsoft Xbox"},l=(e,t=-1)=>{let r=new RegExp(`^-?\\d+(?:.\\d{0,${t}})?`),n=Number(e).toString().match(r);return n?n[0]:null},f=()=>typeof window<"u"?window.navigator:null,p=class{userAgent;constructor(e){this.userAgent=e||f()?.userAgent||null}static get VERSION(){return"4.1.0"}parseUserAgent(e){let t={},r=e||this.userAgent||"",n=r.toLowerCase().replace(/\s\s+/g," "),i=/(edge)\/([\w.]+)/.exec(n)||/(edg)[/]([\w.]+)/.exec(n)||/(opr)[/]([\w.]+)/.exec(n)||/(opt)[/]([\w.]+)/.exec(n)||/(fxios)[/]([\w.]+)/.exec(n)||/(edgios)[/]([\w.]+)/.exec(n)||/(jsdom)[/]([\w.]+)/.exec(n)||/(samsungbrowser)[/]([\w.]+)/.exec(n)||/(electron)[/]([\w.]+)/.exec(n)||/(chrome)[/]([\w.]+)/.exec(n)||/(crios)[/]([\w.]+)/.exec(n)||/(opios)[/]([\w.]+)/.exec(n)||/(version)(applewebkit)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(n)||/(webkit)[/]([\w.]+).*(version)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(n)||/(applewebkit)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(n)||/(webkit)[/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||/(fennec)[/]([\w.]+)/.exec(n)||n.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[],a=/(ipad)/.exec(n)||/(ipod)/.exec(n)||/(iphone)/.exec(n)||/(jsdom)/.exec(n)||/(windows phone)/.exec(n)||/(xbox)/.exec(n)||/(win)/.exec(n)||/(tablet)/.exec(n)||/(android)/.test(n)&&!1===/(mobile)/.test(n)&&["androidTablet"]||/(android)/.exec(n)||/(mac)/.exec(n)||/(linux)/.exec(n)||/(cros)/.exec(n)||[],o=i[5]||i[3]||i[1]||null,s=a[0]||null,c=i[4]||i[2]||null,p=f();"chrome"===o&&"function"==typeof p?.brave?.isBrave&&(o="brave"),o&&(t[o]=!0),s&&(t[s]=!0);let h=!!(t.tablet||t.android||t.androidTablet),m=!!(t.ipad||t.tablet||t.androidTablet),b=!!(t.android||t.androidTablet||t.tablet||t.ipad||t.ipod||t.iphone||t["windows phone"]),v=!!(t.cros||t.mac||t.linux||t.win),g=!!(t.brave||t.chrome||t.crios||t.opr||t.safari||t.edg||t.electron),y=!(!t.msie&&!t.rv),_=!(!t.chrome&&!t.crios),w=!!(t.fxios||t.fennec||t.mozilla),k=!!t.safari,S=!!(t.opera||t.opios||t.opr||t.opt),x=!!(t.edg||t.edge||t.edgios);return{name:u[o]??null,platform:d[s]??null,userAgent:r,version:c,shortVersion:c?l(parseFloat(c),2):null,isAndroid:h,isTablet:m,isMobile:b,isDesktop:v,isWebkit:g,isIE:y,isChrome:_,isFireFox:w,isSafari:k,isOpera:S,isEdge:x}}getBrowserInfo(){let e=this.parseUserAgent();return{name:e.name,platform:e.platform,userAgent:e.userAgent,version:e.version,shortVersion:e.shortVersion}}},h=p},{}],92:[function(e,t,r){},{}],93:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e){n.isBuffer(e)||(e=n.from(e));for(var t=e.length/4|0,r=new Array(t),i=0;i<t;i++)r[i]=e.readUInt32BE(4*i);return r}function a(e){for(;0<e.length;e++)e[0]=0}function o(e,t,r,n,i){for(var a,o,s,c,u=r[0],d=r[1],l=r[2],f=r[3],p=e[0]^t[0],h=e[1]^t[1],m=e[2]^t[2],b=e[3]^t[3],v=4,g=1;g<i;g++)a=u[p>>>24]^d[h>>>16&255]^l[m>>>8&255]^f[255&b]^t[v++],o=u[h>>>24]^d[m>>>16&255]^l[b>>>8&255]^f[255&p]^t[v++],s=u[m>>>24]^d[b>>>16&255]^l[p>>>8&255]^f[255&h]^t[v++],c=u[b>>>24]^d[p>>>16&255]^l[h>>>8&255]^f[255&m]^t[v++],p=a,h=o,m=s,b=c;return a=(n[p>>>24]<<24|n[h>>>16&255]<<16|n[m>>>8&255]<<8|n[255&b])^t[v++],o=(n[h>>>24]<<24|n[m>>>16&255]<<16|n[b>>>8&255]<<8|n[255&p])^t[v++],s=(n[m>>>24]<<24|n[b>>>16&255]<<16|n[p>>>8&255]<<8|n[255&h])^t[v++],c=(n[b>>>24]<<24|n[p>>>16&255]<<16|n[h>>>8&255]<<8|n[255&m])^t[v++],[a>>>=0,o>>>=0,s>>>=0,c>>>=0]}var s=[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=[],n=[],i=[[],[],[],[]],a=[[],[],[],[]],o=0,s=0,c=0;c<256;++c){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[o]=u,n[u]=o;var d=e[o],l=e[d],f=e[l],p=257*e[u]^16843008*u;i[0][o]=p<<24|p>>>8,i[1][o]=p<<16|p>>>16,i[2][o]=p<<8|p>>>24,i[3][o]=p,p=16843009*f^65537*l^257*d^16843008*o,a[0][u]=p<<24|p>>>8,a[1][u]=p<<16|p>>>16,a[2][u]=p<<8|p>>>24,a[3][u]=p,0===o?o=s=1:(o=d^e[e[e[f^d]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:a}}();function u(e){this._key=i(e),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],a=0;a<t;a++)i[a]=e[a];for(a=t;a<n;a++){var o=i[a-1];a%t===0?(o=o<<8|o>>>24,o=c.SBOX[o>>>24]<<24|c.SBOX[o>>>16&255]<<16|c.SBOX[o>>>8&255]<<8|c.SBOX[255&o],o^=s[a/t|0]<<24):t>6&&a%t===4&&(o=c.SBOX[o>>>24]<<24|c.SBOX[o>>>16&255]<<16|c.SBOX[o>>>8&255]<<8|c.SBOX[255&o]),i[a]=i[a-t]^o}for(var u=[],d=0;d<n;d++){var l=n-d,f=i[l-(d%4?0:4)];u[d]=d<4||l<=4?f:c.INV_SUB_MIX[0][c.SBOX[f>>>24]]^c.INV_SUB_MIX[1][c.SBOX[f>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[f>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&f]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(e){return o(e=i(e),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},u.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},u.prototype.decryptBlock=function(e){var t=(e=i(e))[1];e[1]=e[3],e[3]=t;var r=o(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),a=n.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},u.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=u},{"safe-buffer":387}],94:[function(e,t,r){var n=e("./aes"),i=e("safe-buffer").Buffer,a=e("cipher-base"),o=e("inherits"),s=e("./ghash"),c=e("buffer-xor"),u=e("./incr32");function d(e,t,r,o){a.call(this);var c=i.alloc(4,0);this._cipher=new n.AES(t);var d=this._cipher.encryptBlock(c);this._ghash=new s(d),r=function(e,t,r){if(12===t.length)return e._finID=i.concat([t,i.from([0,0,0,1])]),i.concat([t,i.from([0,0,0,2])]);var n=new s(r),a=t.length,o=a%16;n.update(t),o&&(o=16-o,n.update(i.alloc(o,0))),n.update(i.alloc(8,0));var c=8*a,d=i.alloc(8);d.writeUIntBE(c,0,8),n.update(d),e._finID=n.state;var l=i.from(e._finID);return u(l),l}(this,r,d),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=o,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}o(d,a),d.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i.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},d.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 n=Math.min(e.length,t.length),i=0;i<n;++i)r+=e[i]^t[i];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},d.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},d.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},d.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=d},{"./aes":93,"./ghash":98,"./incr32":99,"buffer-xor":123,"cipher-base":133,inherits:243,"safe-buffer":387}],95:[function(e,t,r){var n=e("./encrypter"),i=e("./decrypter"),a=e("./modes/list.json");r.createCipher=r.Cipher=n.createCipher,r.createCipheriv=r.Cipheriv=n.createCipheriv,r.createDecipher=r.Decipher=i.createDecipher,r.createDecipheriv=r.Decipheriv=i.createDecipheriv,r.listCiphers=r.getCiphers=function(){return Object.keys(a)}},{"./decrypter":96,"./encrypter":97,"./modes/list.json":107}],96:[function(e,t,r){var n=e("./authCipher"),i=e("safe-buffer").Buffer,a=e("./modes"),o=e("./streamCipher"),s=e("cipher-base"),c=e("./aes"),u=e("evp_bytestokey");function d(e,t,r){s.call(this),this._cache=new l,this._last=void 0,this._cipher=new c.AES(t),this._prev=i.from(r),this._mode=e,this._autopadding=!0}function l(){this.cache=i.allocUnsafe(0)}function f(e,t,r){var s=a[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=i.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=i.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===s.type?new o(s.module,t,r,!0):"auth"===s.type?new n(s.module,t,r,!0):new d(s.module,t,r)}e("inherits")(d,s),d.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),n.push(r);return i.concat(n)},d.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")},d.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=i.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 n=u(t,!1,r.key,r.iv);return f(e,n.key,n.iv)},r.createDecipheriv=f},{"./aes":93,"./authCipher":94,"./modes":106,"./streamCipher":109,"cipher-base":133,evp_bytestokey:206,inherits:243,"safe-buffer":387}],97:[function(e,t,r){var n=e("./modes"),i=e("./authCipher"),a=e("safe-buffer").Buffer,o=e("./streamCipher"),s=e("cipher-base"),c=e("./aes"),u=e("evp_bytestokey");function d(e,t,r){s.call(this),this._cache=new f,this._cipher=new c.AES(t),this._prev=a.from(r),this._mode=e,this._autopadding=!0}e("inherits")(d,s),d.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return a.concat(n)};var l=a.alloc(16,16);function f(){this.cache=a.allocUnsafe(0)}function p(e,t,r){var s=n[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=a.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=a.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new o(s.module,t,r):"auth"===s.type?new i(s.module,t,r):new d(s.module,t,r)}d.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")},d.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},f.prototype.add=function(e){this.cache=a.concat([this.cache,e])},f.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},f.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=p,r.createCipher=function(e,t){var r=n[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=u(t,!1,r.key,r.iv);return p(e,i.key,i.iv)}},{"./aes":93,"./authCipher":94,"./modes":106,"./streamCipher":109,"cipher-base":133,evp_bytestokey:206,inherits:243,"safe-buffer":387}],98:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.alloc(16,0);function a(e){var t=n.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 o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e,t,r,n=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],i=[0,0,0,0],o=-1;++o<128;){for(!!(this.state[~~(o/8)]&1<<7-o%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),r=!!(1&n[3]),t=3;t>0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=a(i)},o.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=o},{"safe-buffer":387}],99:[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)}}},{}],100:[function(e,t,r){var n=e("buffer-xor");r.encrypt=function(e,t){var r=n(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 i=e._cipher.decryptBlock(t);return n(i,r)}},{"buffer-xor":123}],101:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("buffer-xor");function a(e,t,r){var a=t.length,o=i(t,e._cache);return e._cache=e._cache.slice(a),e._prev=n.concat([e._prev,r?t:o]),o}r.encrypt=function(e,t,r){for(var i,o=n.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=n.allocUnsafe(0)),!(e._cache.length<=t.length)){o=n.concat([o,a(e,t,r)]);break}i=e._cache.length,o=n.concat([o,a(e,t.slice(0,i),r)]),t=t.slice(i)}return o}},{"buffer-xor":123,"safe-buffer":387}],102:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e,t,r){for(var n,i,o=-1,s=0;++o<8;)n=t&1<<7-o?128:0,s+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>o%8,e._prev=a(e._prev,r?n:i);return s}function a(e,t){var r=e.length,i=-1,a=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++i<r;)a[i]=e[i]<<1|e[i+1]>>7;return a}r.encrypt=function(e,t,r){for(var a=t.length,o=n.allocUnsafe(a),s=-1;++s<a;)o[s]=i(e,t[s],r);return o}},{"safe-buffer":387}],103:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e,t,r){var i=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=n.concat([e._prev.slice(1),n.from([r?t:i])]),i}r.encrypt=function(e,t,r){for(var a=t.length,o=n.allocUnsafe(a),s=-1;++s<a;)o[s]=i(e,t[s],r);return o}},{"safe-buffer":387}],104:[function(e,t,r){var n=e("buffer-xor"),i=e("safe-buffer").Buffer,a=e("../incr32");function o(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=i.concat([e._cache,i.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var c=o(e),u=a+16*s;e._cache.writeUInt32BE(c[0],u+0),e._cache.writeUInt32BE(c[1],u+4),e._cache.writeUInt32BE(c[2],u+8),e._cache.writeUInt32BE(c[3],u+12)}var d=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),n(t,d)}},{"../incr32":99,"buffer-xor":123,"safe-buffer":387}],105:[function(e,t,r){r.encrypt=function(e,t){return e._cipher.encryptBlock(t)},r.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},{}],106:[function(e,t,r){var n={ECB:e("./ecb"),CBC:e("./cbc"),CFB:e("./cfb"),CFB8:e("./cfb8"),CFB1:e("./cfb1"),OFB:e("./ofb"),CTR:e("./ctr"),GCM:e("./ctr")},i=e("./list.json");for(var a in i)i[a].module=n[i[a].mode];t.exports=i},{"./cbc":100,"./cfb":101,"./cfb1":102,"./cfb8":103,"./ctr":104,"./ecb":105,"./list.json":107,"./ofb":108}],107:[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"}}},{}],108:[function(e,t,r){var n=e("buffer-xor");function i(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}r.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=Buffer.concat([e._cache,i(e)]);var r=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),n(t,r)}},{"buffer-xor":123}],109:[function(e,t,r){var n=e("./aes"),i=e("safe-buffer").Buffer,a=e("cipher-base");function o(e,t,r,o){a.call(this),this._cipher=new n.AES(t),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=o,this._mode=e}e("inherits")(o,a),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},t.exports=o},{"./aes":93,"cipher-base":133,inherits:243,"safe-buffer":387}],110:[function(e,t,r){var n=e("browserify-des"),i=e("browserify-aes/browser"),a=e("browserify-aes/modes"),o=e("browserify-des/modes"),s=e("evp_bytestokey");function c(e,t,r){if(e=e.toLowerCase(),a[e])return i.createCipheriv(e,t,r);if(o[e])return new n({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function u(e,t,r){if(e=e.toLowerCase(),a[e])return i.createDecipheriv(e,t,r);if(o[e])return new n({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}r.createCipher=r.Cipher=function(e,t){var r,n;if(e=e.toLowerCase(),a[e])r=a[e].key,n=a[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,n=o[e].iv}var i=s(t,!1,r,n);return c(e,i.key,i.iv)},r.createCipheriv=r.Cipheriv=c,r.createDecipher=r.Decipher=function(e,t){var r,n;if(e=e.toLowerCase(),a[e])r=a[e].key,n=a[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,n=o[e].iv}var i=s(t,!1,r,n);return u(e,i.key,i.iv)},r.createDecipheriv=r.Decipheriv=u,r.listCiphers=r.getCiphers=function(){return Object.keys(o).concat(i.getCiphers())}},{"browserify-aes/browser":95,"browserify-aes/modes":106,"browserify-des":111,"browserify-des/modes":112,evp_bytestokey:206}],111:[function(e,t,r){var n=e("cipher-base"),i=e("des.js"),a=e("inherits"),o=e("safe-buffer").Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function c(e){n.call(this);var t,r=e.mode.toLowerCase(),i=s[r];t=e.decrypt?"decrypt":"encrypt";var a=e.key;o.isBuffer(a)||(a=o.from(a)),"des-ede"!==r&&"des-ede-cbc"!==r||(a=o.concat([a,a.slice(0,8)]));var c=e.iv;o.isBuffer(c)||(c=o.from(c)),this._des=i.create({key:a,iv:c,type:t})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=c,a(c,n),c.prototype._update=function(e){return o.from(this._des.update(e))},c.prototype._final=function(){return o.from(this._des.final())}},{"cipher-base":133,"des.js":145,inherits:243,"safe-buffer":387}],112:[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}},{}],113:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("randombytes"),a=e("safe-buffer").Buffer;function o(e){var t,r=e.modulus.byteLength();do{t=new n(i(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function s(e,t){var r=function(e){var t=o(e);return{blinder:t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),i=t.modulus.byteLength(),s=new n(e).mul(r.blinder).umod(t.modulus),c=s.toRed(n.mont(t.prime1)),u=s.toRed(n.mont(t.prime2)),d=t.coefficient,l=t.prime1,f=t.prime2,p=c.redPow(t.exponent1).fromRed(),h=u.redPow(t.exponent2).fromRed(),m=p.isub(h).imul(d).umod(l).imul(f);return h.iadd(m).imul(r.unblinder).umod(t.modulus).toArrayLike(a,"be",i)}s.getr=o,t.exports=s},{"bn.js":114,randombytes:356,"safe-buffer":387}],114:[function(e,t,r){!function(t,r){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(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 o;"object"==typeof t?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function s(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 n(!1,"Invalid character in "+e)}function c(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function u(e,t,r,i){for(var a=0,o=0,s=Math.min(e.length,r),c=t;c<s;c++){var u=e.charCodeAt(c)-48;a*=i,o=u>=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&o<i,"Invalid character"),a+=o}return a}function d(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),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"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):(n(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(n("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 i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===r)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=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 n=0;n<this.length;n++)this.words[n]=0;var i,a=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=c(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=c(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this._strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,o=a%n,s=Math.min(a,a-o)+r,c=0,d=r;d<s;d+=n)c=u(e,d,d+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var l=1;for(c=u(e,d,e.length,t),d=0;d<o;d++)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){d(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 f=["","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"],p=[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];a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==a||o!==this.length-1?f[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 u=p[e],d=h[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(d).toString(e);r=(l=l.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(e,t){return this.toArrayLike(o,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 n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,c=o/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var d=c>>>26,l=67108863&c,f=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=f;p++){var h=u-p|0;d+=(o=(i=0|e.words[h])*(a=0|t.words[p])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,c=0|d}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}a.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},a.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===a?(r<e.length&&(e[r++]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},a.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r>=0)for(e[r--]=n;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 n(0===(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 n(0===(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 n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},a.prototype.ixor=function(e){return n(0===(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},a.prototype.iadd=function(e){var t,r,n;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,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<r.length;a++)t=(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,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,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o<n.length;o++)a=(t=(0|r.words[o])-(0|n.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var b=function(e,t,r){var n,i,a,o=e.words,s=t.words,c=r.words,u=0,d=0|o[0],l=8191&d,f=d>>>13,p=0|o[1],h=8191&p,m=p>>>13,b=0|o[2],v=8191&b,g=b>>>13,y=0|o[3],_=8191&y,w=y>>>13,k=0|o[4],S=8191&k,x=k>>>13,E=0|o[5],P=8191&E,R=E>>>13,M=0|o[6],C=8191&M,T=M>>>13,A=0|o[7],I=8191&A,O=A>>>13,j=0|o[8],D=8191&j,L=j>>>13,B=0|o[9],N=8191&B,F=B>>>13,U=0|s[0],q=8191&U,z=U>>>13,V=0|s[1],W=8191&V,G=V>>>13,H=0|s[2],K=8191&H,$=H>>>13,J=0|s[3],Y=8191&J,X=J>>>13,Z=0|s[4],Q=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,de=0|s[8],le=8191&de,fe=de>>>13,pe=0|s[9],he=8191&pe,me=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,q)|0))<<13)|0;u=((a=Math.imul(f,z))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(h,q),i=(i=Math.imul(h,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ve=(u+(n=n+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(f,W)|0))<<13)|0;u=((a=a+Math.imul(f,G)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(v,q),i=(i=Math.imul(v,z))+Math.imul(g,q)|0,a=Math.imul(g,z),n=n+Math.imul(h,W)|0,i=(i=i+Math.imul(h,G)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,G)|0;var ge=(u+(n=n+Math.imul(l,K)|0)|0)+((8191&(i=(i=i+Math.imul(l,$)|0)+Math.imul(f,K)|0))<<13)|0;u=((a=a+Math.imul(f,$)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(_,q),i=(i=Math.imul(_,z))+Math.imul(w,q)|0,a=Math.imul(w,z),n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(g,W)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(h,K)|0,i=(i=i+Math.imul(h,$)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,$)|0;var ye=(u+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,Y)|0))<<13)|0;u=((a=a+Math.imul(f,X)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(x,q)|0,a=Math.imul(x,z),n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(w,W)|0,a=a+Math.imul(w,G)|0,n=n+Math.imul(v,K)|0,i=(i=i+Math.imul(v,$)|0)+Math.imul(g,K)|0,a=a+Math.imul(g,$)|0,n=n+Math.imul(h,Y)|0,i=(i=i+Math.imul(h,X)|0)+Math.imul(m,Y)|0,a=a+Math.imul(m,X)|0;var _e=(u+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(f,Q)|0))<<13)|0;u=((a=a+Math.imul(f,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(R,q)|0,a=Math.imul(R,z),n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(x,W)|0,a=a+Math.imul(x,G)|0,n=n+Math.imul(_,K)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,$)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,X)|0,n=n+Math.imul(h,Q)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,ee)|0;var we=(u+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(f,re)|0))<<13)|0;u=((a=a+Math.imul(f,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,z))+Math.imul(T,q)|0,a=Math.imul(T,z),n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(R,W)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(x,K)|0,a=a+Math.imul(x,$)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(w,Y)|0,a=a+Math.imul(w,X)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(h,re)|0,i=(i=i+Math.imul(h,ne)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ne)|0;var ke=(u+(n=n+Math.imul(l,ae)|0)|0)+((8191&(i=(i=i+Math.imul(l,oe)|0)+Math.imul(f,ae)|0))<<13)|0;u=((a=a+Math.imul(f,oe)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(O,q)|0,a=Math.imul(O,z),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,G)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,$)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(x,Y)|0,a=a+Math.imul(x,X)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,ee)|0,n=n+Math.imul(v,re)|0,i=(i=i+Math.imul(v,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(h,ae)|0,i=(i=i+Math.imul(h,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Se=(u+(n=n+Math.imul(l,ce)|0)|0)+((8191&(i=(i=i+Math.imul(l,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((a=a+Math.imul(f,ue)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(D,q),i=(i=Math.imul(D,z))+Math.imul(L,q)|0,a=Math.imul(L,z),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(O,W)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(T,K)|0,a=a+Math.imul(T,$)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ne)|0,n=n+Math.imul(v,ae)|0,i=(i=i+Math.imul(v,oe)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,oe)|0,n=n+Math.imul(h,ce)|0,i=(i=i+Math.imul(h,ue)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,ue)|0;var xe=(u+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,fe)|0)+Math.imul(f,le)|0))<<13)|0;u=((a=a+Math.imul(f,fe)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,z))+Math.imul(F,q)|0,a=Math.imul(F,z),n=n+Math.imul(D,W)|0,i=(i=i+Math.imul(D,G)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,G)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,$)|0,n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(T,Y)|0,a=a+Math.imul(T,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(_,ae)|0,i=(i=i+Math.imul(_,oe)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,oe)|0,n=n+Math.imul(v,ce)|0,i=(i=i+Math.imul(v,ue)|0)+Math.imul(g,ce)|0,a=a+Math.imul(g,ue)|0,n=n+Math.imul(h,le)|0,i=(i=i+Math.imul(h,fe)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,fe)|0;var Ee=(u+(n=n+Math.imul(l,he)|0)|0)+((8191&(i=(i=i+Math.imul(l,me)|0)+Math.imul(f,he)|0))<<13)|0;u=((a=a+Math.imul(f,me)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(N,W),i=(i=Math.imul(N,G))+Math.imul(F,W)|0,a=Math.imul(F,G),n=n+Math.imul(D,K)|0,i=(i=i+Math.imul(D,$)|0)+Math.imul(L,K)|0,a=a+Math.imul(L,$)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,X)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ne)|0,n=n+Math.imul(S,ae)|0,i=(i=i+Math.imul(S,oe)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,oe)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,ue)|0)+Math.imul(w,ce)|0,a=a+Math.imul(w,ue)|0,n=n+Math.imul(v,le)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(g,le)|0,a=a+Math.imul(g,fe)|0;var Pe=(u+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;u=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(N,K),i=(i=Math.imul(N,$))+Math.imul(F,K)|0,a=Math.imul(F,$),n=n+Math.imul(D,Y)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(L,Y)|0,a=a+Math.imul(L,X)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(T,re)|0,a=a+Math.imul(T,ne)|0,n=n+Math.imul(P,ae)|0,i=(i=i+Math.imul(P,oe)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,oe)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(x,ce)|0,a=a+Math.imul(x,ue)|0,n=n+Math.imul(_,le)|0,i=(i=i+Math.imul(_,fe)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,fe)|0;var Re=(u+(n=n+Math.imul(v,he)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(g,he)|0))<<13)|0;u=((a=a+Math.imul(g,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(N,Y),i=(i=Math.imul(N,X))+Math.imul(F,Y)|0,a=Math.imul(F,X),n=n+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ne)|0,n=n+Math.imul(C,ae)|0,i=(i=i+Math.imul(C,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,oe)|0,n=n+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(R,ce)|0,a=a+Math.imul(R,ue)|0,n=n+Math.imul(S,le)|0,i=(i=i+Math.imul(S,fe)|0)+Math.imul(x,le)|0,a=a+Math.imul(x,fe)|0;var Me=(u+(n=n+Math.imul(_,he)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(w,he)|0))<<13)|0;u=((a=a+Math.imul(w,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(N,Q),i=(i=Math.imul(N,ee))+Math.imul(F,Q)|0,a=Math.imul(F,ee),n=n+Math.imul(D,re)|0,i=(i=i+Math.imul(D,ne)|0)+Math.imul(L,re)|0,a=a+Math.imul(L,ne)|0,n=n+Math.imul(I,ae)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,oe)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(T,ce)|0,a=a+Math.imul(T,ue)|0,n=n+Math.imul(P,le)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,fe)|0;var Ce=(u+(n=n+Math.imul(S,he)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(x,he)|0))<<13)|0;u=((a=a+Math.imul(x,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(N,re),i=(i=Math.imul(N,ne))+Math.imul(F,re)|0,a=Math.imul(F,ne),n=n+Math.imul(D,ae)|0,i=(i=i+Math.imul(D,oe)|0)+Math.imul(L,ae)|0,a=a+Math.imul(L,oe)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(O,ce)|0,a=a+Math.imul(O,ue)|0,n=n+Math.imul(C,le)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(T,le)|0,a=a+Math.imul(T,fe)|0;var Te=(u+(n=n+Math.imul(P,he)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(R,he)|0))<<13)|0;u=((a=a+Math.imul(R,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(N,ae),i=(i=Math.imul(N,oe))+Math.imul(F,ae)|0,a=Math.imul(F,oe),n=n+Math.imul(D,ce)|0,i=(i=i+Math.imul(D,ue)|0)+Math.imul(L,ce)|0,a=a+Math.imul(L,ue)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,fe)|0;var Ae=(u+(n=n+Math.imul(C,he)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(T,he)|0))<<13)|0;u=((a=a+Math.imul(T,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(N,ce),i=(i=Math.imul(N,ue))+Math.imul(F,ce)|0,a=Math.imul(F,ue),n=n+Math.imul(D,le)|0,i=(i=i+Math.imul(D,fe)|0)+Math.imul(L,le)|0,a=a+Math.imul(L,fe)|0;var Ie=(u+(n=n+Math.imul(I,he)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(O,he)|0))<<13)|0;u=((a=a+Math.imul(O,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(N,le),i=(i=Math.imul(N,fe))+Math.imul(F,le)|0,a=Math.imul(F,fe);var Oe=(u+(n=n+Math.imul(D,he)|0)|0)+((8191&(i=(i=i+Math.imul(D,me)|0)+Math.imul(L,he)|0))<<13)|0;u=((a=a+Math.imul(L,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var je=(u+(n=Math.imul(N,he))|0)+((8191&(i=(i=Math.imul(N,me))+Math.imul(F,he)|0))<<13)|0;return u=((a=Math.imul(F,me))+(i>>>13)|0)+(je>>>26)|0,je&=67108863,c[0]=be,c[1]=ve,c[2]=ge,c[3]=ye,c[4]=_e,c[5]=we,c[6]=ke,c[7]=Se,c[8]=xe,c[9]=Ee,c[10]=Pe,c[11]=Re,c[12]=Me,c[13]=Ce,c[14]=Te,c[15]=Ae,c[16]=Ie,c[17]=Oe,c[18]=je,0!==u&&(c[19]=u,r.length++),r};function v(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,c=Math.min(a,t.length-1),u=Math.max(0,a-e.length+1);u<=c;u++){var d=a-u,l=(0|e.words[d])*(0|t.words[u]),f=67108863&l;s=67108863&(f=f+s|0),i+=(o=(o=o+(l/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r._strip()}function g(e,t,r){return v(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?v(this,e,t):g(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},y.prototype.permute=function(e,t,r,n,i,a){for(var o=0;o<a;o++)n[o]=t[e[o]],i[o]=r[e[o]]},y.prototype.transform=function(e,t,r,n,i,a){this.permute(a,e,t,r,n,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),d=0;d<i;d+=s)for(var l=c,f=u,p=0;p<o;p++){var h=r[d+p],m=n[d+p],b=r[d+p+o],v=n[d+p+o],g=l*b-f*v;v=l*v+f*b,b=g,r[d+p]=h+b,n[d+p]=m+v,r[d+p+o]=h-b,n[d+p+o]=m-v,p!==s&&(g=c*l-u*f,f=c*f+u*l,l=g)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},y.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},y.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=0|e[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(0===a),n(!(-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 n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),a=this.stub(n),o=new Array(n),s=new Array(n),c=new Array(n),u=new Array(n),d=new Array(n),l=new Array(n),f=r.words;f.length=n,this.convert13b(e.words,e.length,o,n),this.convert13b(t.words,t.length,u,n),this.transform(o,a,s,c,n,i),this.transform(u,a,d,l,n,i);for(var p=0;p<n;p++){var h=s[p]*d[p]-c[p]*l[p];c[p]=s[p]*l[p]+c[p]*d[p],s[p]=h}return this.conjugate(s,c,n),this.transform(s,c,f,a,n,i),this.conjugate(f,a,n),this.normalize13b(f,n),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),g(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),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var a=(0|this.words[i])*e,o=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this.length=0===e?1: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 n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new a(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},a.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,c=(0|this.words[t])-s<<r;this.words[t]=c|o,o=s>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},a.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var u=0;u<o;u++)c.words[u]=this.words[u];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var d=0;for(u=this.length-1;u>=0&&(0!==d||u>=i);u--){var l=0|this.words[u];this.words[u]=d<<26-a|l>>>a,d=l&s}return c&&0!==d&&(c.words[c.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(e,t,r){return n(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){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},a.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(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 i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return n("number"==typeof e),n(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(n("number"==typeof e),n(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 i,a,o=e.length+r;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+r])+s;var c=(0|e.words[i])*t;s=((a-=67108863&c)>>26)-(c/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++)s=(a=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,c=n.length-i.length;if("mod"!==t){(s=new a(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var d=n.clone()._ishlnsubmul(i,1,c);0===d.negative&&(n=d,s&&(s.words[c]=1));for(var l=c-1;l>=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=f)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):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 i,o,s},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,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);return a<0||1===i&&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),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(0|this.words[a]))%e;return t?-i:i},a.prototype.modn=function(e){return this.modrn(e)},a.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*r;this.words[i]=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){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new a(1),o=new a(0),s=new a(0),c=new a(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var d=r.clone(),l=t.clone();!t.isZero();){for(var f=0,p=1;0===(t.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(d),o.isub(l)),i.iushrn(1),o.iushrn(1);for(var h=0,m=1;0===(r.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(d),c.isub(l)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),o.isub(c)):(r.isub(t),s.isub(i),c.isub(o))}return{a:s,b:c,gcd:r.iushln(u)}},a.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,o=new a(1),s=new a(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,d=1;0===(t.words[0]&d)&&u<26;++u,d<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(i=0===t.cmpn(1)?o:s).cmpn(0)<0&&i.iadd(e),i},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 n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},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){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=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),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<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 n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(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 P(e)},a.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return n(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 k(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function P(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function R(e){P.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 n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>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)},i(k,w),k.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},k.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 n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(S,w),i(x,w),i(E,w),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new k;else if("p224"===e)t=new S;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return _[e]=t,t},P.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},P.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},P.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(d(e,e.umod(this.m)._forceRed(this)),e)},P.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},P.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)},P.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},P.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)},P.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},P.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},P.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},P.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},P.prototype.isqr=function(e){return this.imul(e,e.clone())},P.prototype.sqr=function(e){return this.mul(e,e)},P.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new a(2*d*d).toRed(this);0!==this.pow(d,u).cmp(c);)d.redIAdd(c);for(var l=this.pow(d,i),f=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),h=o;0!==p.cmp(s);){for(var m=p,b=0;0!==m.cmp(s);b++)m=m.redSqr();n(b<h);var v=this.pow(l,new a(1).iushln(h-b-1));f=f.redMul(v),l=v.redSqr(),p=p.redMul(l),h=b}return f},P.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},P.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 n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],o=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],d=c-1;d>=0;d--){var l=u>>d&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===n&&0===d)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}c=26}return i},P.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},P.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new R(e)},i(R,P),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),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.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),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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:92}],115:[function(e,t,r){"use strict";t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":116}],116:[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"}}},{}],117:[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"}},{}],118:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("create-hash"),a=e("readable-stream"),o=e("inherits"),s=e("./sign"),c=e("./verify"),u=e("./algorithms.json");function d(e){a.Writable.call(this);var t=u[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){a.Writable.call(this);var t=u[e];if(!t)throw new Error("Unknown message digest");this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function f(e){return new d(e)}function p(e){return new l(e)}Object.keys(u).forEach(function(e){u[e].id=n.from(u[e].id,"hex"),u[e.toLowerCase()]=u[e]}),o(d,a.Writable),d.prototype._write=function(e,t,r){this._hash.update(e),r()},d.prototype.update=function(e,t){return this._hash.update("string"==typeof e?n.from(e,t):e),this},d.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),n=s(r,e,this._hashType,this._signType,this._tag);return t?n.toString(t):n},o(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?n.from(e,t):e),this},l.prototype.verify=function(e,t,r){var i="string"==typeof t?n.from(t,r):t;this.end();var a=this._hash.digest();return c(i,a,e,this._signType,this._tag)},t.exports={Sign:f,Verify:p,createSign:f,createVerify:p}},{"./algorithms.json":116,"./sign":119,"./verify":120,"create-hash":136,inherits:243,"readable-stream":369,"safe-buffer":387}],119:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("create-hmac"),a=e("browserify-rsa"),o=e("elliptic").ec,s=e("bn.js"),c=e("parse-asn1"),u=e("./curves.json");function d(e,t,r,a){if((e=n.from(e.toArray())).length<t.byteLength()){var o=n.alloc(t.byteLength()-e.length);e=n.concat([o,e])}var s=r.length,c=function(e,t){e=l(e,t),e=e.mod(t);var r=n.from(e.toArray());if(r.length<t.byteLength()){var i=n.alloc(t.byteLength()-r.length);r=n.concat([i,r])}return r}(r,t),u=n.alloc(s);u.fill(1);var d=n.alloc(s);return d=i(a,d).update(u).update(n.from([0])).update(e).update(c).digest(),u=i(a,d).update(u).digest(),{k:d=i(a,d).update(u).update(n.from([1])).update(e).update(c).digest(),v:u=i(a,d).update(u).digest()}}function l(e,t){var r=new s(e),n=(e.length<<3)-t.bitLength();return n>0&&r.ishrn(n),r}function f(e,t,r){var a,o;do{for(a=n.alloc(0);8*a.length<e.bitLength();)t.v=i(r,t.k).update(t.v).digest(),a=n.concat([a,t.v]);o=l(a,e),t.k=i(r,t.k).update(t.v).update(n.from([0])).digest(),t.v=i(r,t.k).update(t.v).digest()}while(-1!==o.cmp(e));return o}function p(e,t,r,n){return e.toRed(s.mont(r)).redPow(t).fromRed().mod(n)}t.exports=function(e,t,r,i,h){var m=c(t);if(m.curve){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");return function(e,t){var r=u[t.curve.join(".")];if(!r)throw new Error("unknown curve "+t.curve.join("."));var i=new o(r).keyFromPrivate(t.privateKey),a=i.sign(e);return n.from(a.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==i)throw new Error("wrong private key type");return function(e,t,r){var i,a=t.params.priv_key,o=t.params.p,c=t.params.q,u=t.params.g,h=new s(0),m=l(e,c).mod(c),b=!1,v=d(a,c,e,r);for(;!1===b;)h=p(u,i=f(c,v,r),o,c),0===(b=i.invm(c).imul(m.add(a.mul(h))).mod(c)).cmpn(0)&&(b=!1,h=new s(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,i=[48,r,2,e.length];return i=i.concat(e,[2,t.length],t),n.from(i)}(h,b)}(e,m,r)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");if(void 0!==t.padding&&1!==t.padding)throw new Error("illegal or unsupported padding mode");e=n.concat([h,e]);for(var b=m.modulus.byteLength(),v=[0,1];e.length+v.length+1<b;)v.push(255);v.push(0);for(var g=-1;++g<e.length;)v.push(e[g]);return a(v,m)},t.exports.getKey=d,t.exports.makeKey=f},{"./curves.json":117,"bn.js":121,"browserify-rsa":113,"create-hmac":138,elliptic:158,"parse-asn1":335,"safe-buffer":387}],120:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("bn.js"),a=e("elliptic").ec,o=e("parse-asn1"),s=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,u,d){var l=o(r);if("ec"===l.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(e,t,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new a(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,l)}if("dsa"===l.type){if("dsa"!==u)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,a=r.data.q,s=r.data.g,u=r.data.pub_key,d=o.signature.decode(e,"der"),l=d.s,f=d.r;c(l,a),c(f,a);var p=i.mont(n),h=l.invm(a),m=s.toRed(p).redPow(new i(t).mul(h).mod(a)).fromRed().mul(u.toRed(p).redPow(f.mul(h).mod(a)).fromRed()).mod(n).mod(a);return 0===m.cmp(f)}(e,t,l)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");t=n.concat([d,t]);for(var f=l.modulus.byteLength(),p=[1],h=0;t.length+p.length+2<f;)p.push(255),h+=1;p.push(0);for(var m=-1;++m<t.length;)p.push(t[m]);p=n.from(p);var b=i.mont(l.modulus);e=(e=new i(e).toRed(b)).redPow(new i(l.publicExponent)),e=n.from(e.fromRed().toArray());var v=h<8?1:0;for(f=Math.min(e.length,p.length),e.length!==p.length&&(v=1),m=-1;++m<f;)v|=e[m]^p[m];return 0===v}},{"./curves.json":117,"bn.js":121,elliptic:158,"parse-asn1":335,"safe-buffer":387}],121:[function(e,t,r){arguments[4][114][0].apply(r,arguments)},{buffer:92,dup:114}],122:[function(e,t,r){"use strict";var n=e("buffer").Buffer,i=e("buffer").SlowBuffer;function a(e,t){if(!n.isBuffer(e)||!n.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}t.exports=a,a.install=function(){n.prototype.equal=i.prototype.equal=function(e){return a(this,e)}};var o=n.prototype.equal,s=i.prototype.equal;a.restore=function(){n.prototype.equal=o,i.prototype.equal=s}},{buffer:124}],123:[function(e,t,r){t.exports=function(e,t){for(var r=Math.min(e.length,t.length),n=new Buffer(r),i=0;i<r;++i)n[i]=e[i]^t[i];return n}},{}],124:[function(e,t,r){
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).samvyo={})}(this,function(e){"use strict";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,s,i,a,n,o={},c={exports:{}};function d(){if(s)return r;s=1;var e=1e3,t=60*e,i=60*t,a=24*i,n=7*a,o=365.25*a;function c(e,t,r,s){var i=t>=1.5*r;return Math.round(e/r)+" "+s+(i?"s":"")}return r=function(r,s){s=s||{};var d=typeof r;if("string"===d&&r.length>0)return function(r){if((r=String(r)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*n;case"days":case"day":case"d":return c*a;case"hours":case"hour":case"hrs":case"hr":case"h":return c*i;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(r);if("number"===d&&isFinite(r))return s.long?function(r){var s=Math.abs(r);if(s>=a)return c(r,s,a,"day");if(s>=i)return c(r,s,i,"hour");if(s>=t)return c(r,s,t,"minute");if(s>=e)return c(r,s,e,"second");return r+" ms"}(r):function(r){var s=Math.abs(r);if(s>=a)return Math.round(r/a)+"d";if(s>=i)return Math.round(r/i)+"h";if(s>=t)return Math.round(r/t)+"m";if(s>=e)return Math.round(r/e)+"s";return r+"ms"}(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))}}function l(){return n||(n=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let s=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(s++,"%c"===e&&(i=s))}),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(r){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0)}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=(a?i:(a=1,i=function(e){function t(e){let s,i,a,n=null;function o(...e){if(!o.enabled)return;const r=o,i=Number(new Date),a=i-(s||i);r.diff=a,r.prev=s,r.curr=i,s=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let n=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(s,i)=>{if("%%"===s)return"%";n++;const a=t.formatters[i];if("function"==typeof a){const t=e[n];s=a.call(r,t),e.splice(n,1),n--}return s}),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==n?n:(i!==t.namespaces&&(i=t.namespaces,a=t.enabled(e)),a),set:e=>{n=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,r){const s=t(this.namespace+(void 0===r?":":r)+e);return s.log=this.log,s}function s(e,t){let r=0,s=0,i=-1,a=0;for(;r<e.length;)if(s<t.length&&(t[s]===e[r]||"*"===t[s]))"*"===t[s]?(i=s,a=r,s++):(r++,s++);else{if(-1===i)return!1;s=i+1,a++,r=a}for(;s<t.length&&"*"===t[s];)s++;return s===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const s of r)"-"===s[0]?t.skips.push(s.slice(1)):t.names.push(s)},t.enabled=function(e){for(const r of t.skips)if(s(e,r))return!1;for(const r of t.names)if(s(e,r))return!0;return!1},t.humanize=d(),t.destroy=function(){},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}))(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(c,c.exports)),c.exports}var p,u={};var h,m,f={};function g(){if(m)return h;m=1;var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={};((e,r)=>{for(var s in r)t(e,s,{get:r[s],enumerable:!0})})(a,{BrowserDetector:()=>l,KnownBrowsers:()=>n,KnownPlatforms:()=>o,default:()=>p}),e=a,h=((e,a,n,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let c of s(a))!i.call(e,c)&&c!==n&&t(e,c,{get:()=>a[c],enumerable:!(o=r(a,c))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e);var n={chrome:"Google Chrome",brave:"Brave",crios:"Google Chrome",edge:"Microsoft Edge",edg:"Microsoft Edge",edgios:"Microsoft Edge",fennec:"Mozilla Firefox",jsdom:"JsDOM",mozilla:"Mozilla Firefox",fxios:"Mozilla Firefox",msie:"Microsoft Internet Explorer",opera:"Opera",opios:"Opera",opr:"Opera",opt:"Opera",rv:"Microsoft Internet Explorer",safari:"Safari",samsungbrowser:"Samsung Browser",electron:"Electron"},o={android:"Android",androidTablet:"Android Tablet",cros:"Chrome OS",fennec:"Android Tablet",ipad:"IPad",ipod:"IPod",iphone:"IPhone",jsdom:"JsDOM",linux:"Linux",mac:"Macintosh",tablet:"Android Tablet",win:"Windows","windows phone":"Windows Phone",xbox:"Microsoft Xbox"},c=(e,t=-1)=>{let r=new RegExp(`^-?\\d+(?:.\\d{0,${t}})?`),s=Number(e).toString().match(r);return s?s[0]:null},d=()=>typeof window<"u"?window.navigator:null,l=class{userAgent;constructor(e){this.userAgent=e||d()?.userAgent||null}static get VERSION(){return"4.1.0"}parseUserAgent(e){let t={},r=e||this.userAgent||"",s=r.toLowerCase().replace(/\s\s+/g," "),i=/(edge)\/([\w.]+)/.exec(s)||/(edg)[/]([\w.]+)/.exec(s)||/(opr)[/]([\w.]+)/.exec(s)||/(opt)[/]([\w.]+)/.exec(s)||/(fxios)[/]([\w.]+)/.exec(s)||/(edgios)[/]([\w.]+)/.exec(s)||/(jsdom)[/]([\w.]+)/.exec(s)||/(samsungbrowser)[/]([\w.]+)/.exec(s)||/(electron)[/]([\w.]+)/.exec(s)||/(chrome)[/]([\w.]+)/.exec(s)||/(crios)[/]([\w.]+)/.exec(s)||/(opios)[/]([\w.]+)/.exec(s)||/(version)(applewebkit)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(s)||/(webkit)[/]([\w.]+).*(version)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(s)||/(applewebkit)[/]([\w.]+).*(safari)[/]([\w.]+)/.exec(s)||/(webkit)[/]([\w.]+)/.exec(s)||/(opera)(?:.*version|)[/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||/(fennec)[/]([\w.]+)/.exec(s)||s.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(s)||s.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(s)||[],a=/(ipad)/.exec(s)||/(ipod)/.exec(s)||/(iphone)/.exec(s)||/(jsdom)/.exec(s)||/(windows phone)/.exec(s)||/(xbox)/.exec(s)||/(win)/.exec(s)||/(tablet)/.exec(s)||/(android)/.test(s)&&!1===/(mobile)/.test(s)&&["androidTablet"]||/(android)/.exec(s)||/(mac)/.exec(s)||/(linux)/.exec(s)||/(cros)/.exec(s)||[],l=i[5]||i[3]||i[1]||null,p=a[0]||null,u=i[4]||i[2]||null,h=d();"chrome"===l&&"function"==typeof h?.brave?.isBrave&&(l="brave"),l&&(t[l]=!0),p&&(t[p]=!0);let m=!!(t.tablet||t.android||t.androidTablet),f=!!(t.ipad||t.tablet||t.androidTablet),g=!!(t.android||t.androidTablet||t.tablet||t.ipad||t.ipod||t.iphone||t["windows phone"]),b=!!(t.cros||t.mac||t.linux||t.win),y=!!(t.brave||t.chrome||t.crios||t.opr||t.safari||t.edg||t.electron),_=!(!t.msie&&!t.rv),v=!(!t.chrome&&!t.crios),w=!!(t.fxios||t.fennec||t.mozilla),S=!!t.safari,C=!!(t.opera||t.opios||t.opr||t.opt),P=!!(t.edg||t.edge||t.edgios);return{name:n[l]??null,platform:o[p]??null,userAgent:r,version:u,shortVersion:u?c(parseFloat(u),2):null,isAndroid:m,isTablet:f,isMobile:g,isDesktop:b,isWebkit:y,isIE:_,isChrome:v,isFireFox:w,isSafari:S,isOpera:C,isEdge:P}}getBrowserInfo(){let e=this.parseUserAgent();return{name:e.name,platform:e.platform,userAgent:e.userAgent,version:e.version,shortVersion:e.shortVersion}}},p=l;return h}var b,y={};function _(){if(b)return y;b=1,Object.defineProperty(y,"__esModule",{value:!0}),y.Logger=void 0;const e=l(),t="mediasoup-client";return y.Logger=class{_debug;_warn;_error;constructor(r){r?(this._debug=(0,e.default)(`${t}:${r}`),this._warn=(0,e.default)(`${t}:WARN:${r}`),this._error=(0,e.default)(`${t}:ERROR:${r}`)):(this._debug=(0,e.default)(t),this._warn=(0,e.default)(`${t}:WARN`),this._error=(0,e.default)(`${t}:ERROR`)),this._debug.log=function(){}.bind(),this._warn.log=function(){}.bind(),this._error.log=function(){}.bind()}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}},y}var v,w,S={},C={exports:{}};function P(){if(v)return C.exports;v=1;var e,t="object"==typeof Reflect?Reflect:null,r=t&&"function"==typeof t.apply?t.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}C.exports=i,C.exports.once=function(e,t){return new Promise(function(r,s){function i(r){e.removeListener(t,a),s(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}m(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,r)}(e,i,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function n(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function o(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,r,s){var i,a,c;if(n(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),c=a[t]),void 0===c)c=a[t]=r,++e._eventsCount;else if("function"==typeof c?c=a[t]=s?[r,c]:[c,r]:s?c.unshift(r):c.push(r),(i=o(e))>0&&c.length>i&&!c.warned){c.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=c.length,console&&console.warn}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var s={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(s);return i.listener=r,s.wrapFn=i,i}function p(e,t,r){var s=e._events;if(void 0===s)return[];var i=s[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]: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}(i):h(i,i.length)}function u(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),s=0;s<t;++s)r[s]=e[s];return r}function m(e,t,r,s){if("function"==typeof e.on)s.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(a){s.once&&e.removeEventListener(t,i),r(a)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return o(this)},i.prototype.emit=function(e){for(var t=[],s=1;s<arguments.length;s++)t.push(arguments[s]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var n;if(t.length>0&&(n=t[0]),n instanceof Error)throw n;var o=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw o.context=n,o}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var d=c.length,l=h(c,d);for(s=0;s<d;++s)r(l[s],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return n(t),this.on(e,l(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return n(t),this.prependListener(e,l(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,s,i,a,o;if(n(t),void 0===(s=this._events))return this;if(void 0===(r=s[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(s[e]=r[0]),void 0!==s.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,s;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(s=0;s<a.length;++s)"removeListener"!==(i=a[s])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this},i.prototype.listeners=function(e){return p(this,e,!0)},i.prototype.rawListeners=function(e){return p(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):u.call(e,t)},i.prototype.listenerCount=u,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},C.exports}function k(){if(w)return S;w=1,Object.defineProperty(S,"__esModule",{value:!0}),S.EnhancedEventEmitter=void 0;const e=P(),t=new(_().Logger)("EnhancedEventEmitter");class r extends e.EventEmitter{constructor(){super(),this.setMaxListeners(1/0)}close(){super.removeAllListeners()}emit(e,...t){return super.emit(e,...t)}safeEmit(e,...r){try{return super.emit(e,...r)}catch(s){t.error("safeEmit() | event listener threw an error [eventName:%s]:%o",e,s);try{super.emit("listenererror",e,s)}catch(i){}return Boolean(super.listenerCount(e))}}on(e,t){return super.on(e,t),this}off(e,t){return super.off(e,t),this}addListener(e,t){return super.on(e,t),this}prependListener(e,t){return super.prependListener(e,t),this}once(e,t){return super.once(e,t),this}prependOnceListener(e,t){return super.prependOnceListener(e,t),this}removeListener(e,t){return super.off(e,t),this}removeAllListeners(e){return super.removeAllListeners(e),this}listenerCount(e){return super.listenerCount(e)}listeners(e){return super.listeners(e)}rawListeners(e){return super.rawListeners(e)}}return S.EnhancedEventEmitter=r,S}var R,T={};function E(){if(R)return T;R=1,Object.defineProperty(T,"__esModule",{value:!0}),T.InvalidStateError=T.UnsupportedError=void 0;class e extends Error{constructor(t){super(t),this.name="UnsupportedError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,e):this.stack=new Error(t).stack}}T.UnsupportedError=e;class t extends Error{constructor(e){super(e),this.name="InvalidStateError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,t):this.stack=new Error(e).stack}}return T.InvalidStateError=t,T}var I,x={};function D(){if(I)return x;return I=1,Object.defineProperty(x,"__esModule",{value:!0}),x.clone=function(e){return void 0===e?void 0:Number.isNaN(e)?NaN:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))},x.generateRandomNumber=function(){return Math.round(1e7*Math.random())},x.deepFreeze=function e(t){const r=Reflect.ownKeys(t);for(const s of r){const r=t[s];(r&&"object"==typeof r||"function"==typeof r)&&e(r)}return Object.freeze(t)},x}var M,L,O,A={},N={},j={};function F(){if(L)return N;L=1,Object.defineProperty(N,"__esModule",{value:!0}),N.ProfileLevelId=N.Level=N.Profile=void 0,N.parseProfileLevelId=u,N.profileLevelIdToString=h,N.profileToString=function(r){switch(r){case t.ConstrainedBaseline:return"ConstrainedBaseline";case t.Baseline:return"Baseline";case t.Main:return"Main";case t.ConstrainedHigh:return"ConstrainedHigh";case t.High:return"High";case t.PredictiveHigh444:return"PredictiveHigh444";default:return void e.warn(`profileToString() | unrecognized profile ${r}`)}},N.levelToString=function(t){switch(t){case s.L1_b:return"1b";case s.L1:return"1";case s.L1_1:return"1.1";case s.L1_2:return"1.2";case s.L1_3:return"1.3";case s.L2:return"2";case s.L2_1:return"2.1";case s.L2_2:return"2.2";case s.L3:return"3";case s.L3_1:return"3.1";case s.L3_2:return"3.2";case s.L4:return"4";case s.L4_1:return"4.1";case s.L4_2:return"4.2";case s.L5:return"5";case s.L5_1:return"5.1";case s.L5_2:return"5.2";default:return void e.warn(`levelToString() | unrecognized level ${t}`)}},N.parseSdpProfileLevelId=m,N.isSameProfile=function(e={},t={}){const r=m(e),s=m(t);return Boolean(r&&s&&r.profile===s.profile)},N.isSameProfileAndLevel=function(e={},t={}){const r=m(e),s=m(t);return Boolean(r&&s&&r.profile===s.profile&&r.level==s.level)},N.generateProfileLevelIdStringForAnswer=function(t={},r={}){if(!t["profile-level-id"]&&!r["profile-level-id"])return void e.warn("generateProfileLevelIdStringForAnswer() | profile-level-id missing in local and remote params");const i=m(t),n=m(r);if(!i)throw new TypeError("invalid local_profile_level_id");if(!n)throw new TypeError("invalid remote_profile_level_id");if(i.profile!==n.profile)throw new TypeError("H264 Profile mismatch");const o=g(t)&&g(r),c=i.level,d=n.level,l=(u=c,f=d,function(e,t){return e===s.L1_b?t!==s.L1&&t!==s.L1_b:t===s.L1_b?e!==s.L1:e<t}(u,f)?u:f),p=o?c:l;var u,f;return e.debug(`generateProfileLevelIdStringForAnswer() | result [profile:${i.profile}, level:${p}]`),h(new a(i.profile,p))},N.supportedLevel=function(t,r){for(let s=p.length-1;s>=0;--s){const i=p[s];if(256*i.max_macroblock_frame_size<=t&&i.max_macroblocks_per_second<=r*i.max_macroblock_frame_size)return e.debug(`supportedLevel() | result [max_frame_pixel_count:${t}, max_fps:${r}, level:${i.level}]`),i.level}return void e.warn(`supportedLevel() | no level supported [max_frame_pixel_count:${t}, max_fps:${r}]`)};const e=new(function(){if(M)return j;M=1;var e=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.Logger=void 0;const t=e(l()),r="h264-profile-level-id";return j.Logger=class{constructor(e){e?(this._debug=(0,t.default)(`${r}:${e}`),this._warn=(0,t.default)(`${r}:WARN:${e}`),this._error=(0,t.default)(`${r}:ERROR:${e}`)):(this._debug=(0,t.default)(r),this._warn=(0,t.default)(`${r}:WARN`),this._error=(0,t.default)(`${r}:ERROR`)),this._debug.log=function(){}.bind(),this._warn.log=function(){}.bind(),this._error.log=function(){}.bind()}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}},j}().Logger);var t,r,s,i;(r=t||(N.Profile=t={}))[r.ConstrainedBaseline=1]="ConstrainedBaseline",r[r.Baseline=2]="Baseline",r[r.Main=3]="Main",r[r.ConstrainedHigh=4]="ConstrainedHigh",r[r.High=5]="High",r[r.PredictiveHigh444=6]="PredictiveHigh444",(i=s||(N.Level=s={}))[i.L1_b=0]="L1_b",i[i.L1=10]="L1",i[i.L1_1=11]="L1_1",i[i.L1_2=12]="L1_2",i[i.L1_3=13]="L1_3",i[i.L2=20]="L2",i[i.L2_1=21]="L2_1",i[i.L2_2=22]="L2_2",i[i.L3=30]="L3",i[i.L3_1=31]="L3_1",i[i.L3_2=32]="L3_2",i[i.L4=40]="L4",i[i.L4_1=41]="L4_1",i[i.L4_2=42]="L4_2",i[i.L5=50]="L5",i[i.L5_1=51]="L5_1",i[i.L5_2=52]="L5_2";class a{constructor(e,t){this.profile=e,this.level=t}}N.ProfileLevelId=a;const n=new a(t.ConstrainedBaseline,s.L3_1);class o{constructor(e){this.mask=~f("x",e),this.masked_value=f("1",e)}isMatch(e){return this.masked_value===(e&this.mask)}}class c{constructor(e,t,r){this.profile_idc=e,this.profile_iop=t,this.profile=r}}const d=[new c(66,new o("x1xx0000"),t.ConstrainedBaseline),new c(77,new o("1xxx0000"),t.ConstrainedBaseline),new c(88,new o("11xx0000"),t.ConstrainedBaseline),new c(66,new o("x0xx0000"),t.Baseline),new c(88,new o("10xx0000"),t.Baseline),new c(77,new o("0x0x0000"),t.Main),new c(100,new o("00000000"),t.High),new c(100,new o("00001100"),t.ConstrainedHigh),new c(244,new o("00000000"),t.PredictiveHigh444)],p=[{max_macroblocks_per_second:1485,max_macroblock_frame_size:99,level:s.L1},{max_macroblocks_per_second:1485,max_macroblock_frame_size:99,level:s.L1_b},{max_macroblocks_per_second:3e3,max_macroblock_frame_size:396,level:s.L1_1},{max_macroblocks_per_second:6e3,max_macroblock_frame_size:396,level:s.L1_2},{max_macroblocks_per_second:11880,max_macroblock_frame_size:396,level:s.L1_3},{max_macroblocks_per_second:11880,max_macroblock_frame_size:396,level:s.L2},{max_macroblocks_per_second:19800,max_macroblock_frame_size:792,level:s.L2_1},{max_macroblocks_per_second:20250,max_macroblock_frame_size:1620,level:s.L2_2},{max_macroblocks_per_second:40500,max_macroblock_frame_size:1620,level:s.L3},{max_macroblocks_per_second:108e3,max_macroblock_frame_size:3600,level:s.L3_1},{max_macroblocks_per_second:216e3,max_macroblock_frame_size:5120,level:s.L3_2},{max_macroblocks_per_second:245760,max_macroblock_frame_size:8192,level:s.L4},{max_macroblocks_per_second:245760,max_macroblock_frame_size:8192,level:s.L4_1},{max_macroblocks_per_second:522240,max_macroblock_frame_size:8704,level:s.L4_2},{max_macroblocks_per_second:589824,max_macroblock_frame_size:22080,level:s.L5},{max_macroblocks_per_second:983040,max_macroblock_frame_size:36864,level:s.L5_1},{max_macroblocks_per_second:2073600,max_macroblock_frame_size:36864,level:s.L5_2}];function u(t){if("string"!=typeof t||6!==t.length)return;const r=parseInt(t,16);if(0===r)return;const i=255&r,n=r>>8&255,o=r>>16&255;let c;switch(i){case s.L1_1:c=16&n?s.L1_b:s.L1_1;break;case s.L1:case s.L1_2:case s.L1_3:case s.L2:case s.L2_1:case s.L2_2:case s.L3:case s.L3_1:case s.L3_2:case s.L4:case s.L4_1:case s.L4_2:case s.L5:case s.L5_1:case s.L5_2:c=i;break;default:return void e.warn(`parseProfileLevelId() | unrecognized level_idc [str:${t}, level_idc:${i}]`)}for(const s of d)if(o===s.profile_idc&&s.profile_iop.isMatch(n))return e.debug(`parseProfileLevelId() | result [str:${t}, profile:${s.profile}, level:${c}]`),new a(s.profile,c);e.warn(`parseProfileLevelId() | unrecognized profile_idc/profile_iop combination [str:${t}, profile_idc:${o}, profile_iop:${n}]`)}function h(r){if(r.level==s.L1_b)switch(r.profile){case t.ConstrainedBaseline:return"42f00b";case t.Baseline:return"42100b";case t.Main:return"4d100b";default:return void e.warn(`profileLevelIdToString() | Level 1_b not is allowed for profile ${r.profile}`)}let i;switch(r.profile){case t.ConstrainedBaseline:i="42e0";break;case t.Baseline:i="4200";break;case t.Main:i="4d00";break;case t.ConstrainedHigh:i="640c";break;case t.High:i="6400";break;case t.PredictiveHigh444:i="f400";break;default:return void e.warn(`profileLevelIdToString() | unrecognized profile ${r.profile}`)}let a=r.level.toString(16);return 1===a.length&&(a=`0${a}`),`${i}${a}`}function m(e={}){const t=e["profile-level-id"];return t?u(t):n}function f(e,t){return Number(t[0]===e)<<7|Number(t[1]===e)<<6|Number(t[2]===e)<<5|Number(t[3]===e)<<4|Number(t[4]===e)<<3|Number(t[5]===e)<<2|Number(t[6]===e)<<1|Number(t[7]===e)}function g(e={}){const t=e["level-asymmetry-allowed"];return!0===t||1===t||"1"===t}return N}function B(){if(O)return A;O=1,Object.defineProperty(A,"__esModule",{value:!0}),A.validateAndNormalizeRtpCapabilities=function(e){if("object"!=typeof e)throw new TypeError("caps is not an object");if(e.codecs&&!Array.isArray(e.codecs))throw new TypeError("caps.codecs is not an array");e.codecs||(e.codecs=[]);for(const t of e.codecs)n(t);if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("caps.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);for(const t of e.headerExtensions)c(t)},A.validateAndNormalizeRtpParameters=a,A.validateAndNormalizeSctpStreamParameters=function(e){if("object"!=typeof e)throw new TypeError("params is not an object");if("number"!=typeof e.streamId)throw new TypeError("missing params.streamId");let t=!1;"boolean"==typeof e.ordered?t=!0:e.ordered=!0;if(e.maxPacketLifeTime&&"number"!=typeof e.maxPacketLifeTime)throw new TypeError("invalid params.maxPacketLifeTime");if(e.maxRetransmits&&"number"!=typeof e.maxRetransmits)throw new TypeError("invalid params.maxRetransmits");if(e.maxPacketLifeTime&&e.maxRetransmits)throw new TypeError("cannot provide both maxPacketLifeTime and maxRetransmits");if(t&&e.ordered&&(e.maxPacketLifeTime||e.maxRetransmits))throw new TypeError("cannot be ordered with maxPacketLifeTime or maxRetransmits");t||!e.maxPacketLifeTime&&!e.maxRetransmits||(e.ordered=!1);if(e.label&&"string"!=typeof e.label)throw new TypeError("invalid params.label");if(e.protocol&&"string"!=typeof e.protocol)throw new TypeError("invalid params.protocol")},A.validateSctpCapabilities=function(e){if("object"!=typeof e)throw new TypeError("caps is not an object");if(!e.numStreams||"object"!=typeof e.numStreams)throw new TypeError("missing caps.numStreams");!function(e){if("object"!=typeof e)throw new TypeError("numStreams is not an object");if("number"!=typeof e.OS)throw new TypeError("missing numStreams.OS");if("number"!=typeof e.MIS)throw new TypeError("missing numStreams.MIS")}(e.numStreams)},A.getExtendedRtpCapabilities=function(e,t,r){const s={codecs:[],headerExtensions:[]};if(r)for(const i of e.codecs??[]){if(u(i))continue;const e=(t.codecs??[]).find(e=>h(e,i,{strict:!0,modify:!0}));if(!e)continue;const r={kind:i.kind,mimeType:i.mimeType,clockRate:i.clockRate,channels:i.channels,localPayloadType:i.preferredPayloadType,localRtxPayloadType:void 0,remotePayloadType:e.preferredPayloadType,remoteRtxPayloadType:void 0,localParameters:i.parameters??{},remoteParameters:e.parameters??{},rtcpFeedback:f(i,e)};s.codecs.push(r)}else for(const i of t.codecs??[]){if(u(i))continue;const t=(e.codecs??[]).find(e=>h(e,i,{strict:!0,modify:!0}));if(!t)continue;const r={kind:t.kind,mimeType:t.mimeType,clockRate:t.clockRate,channels:t.channels,localPayloadType:t.preferredPayloadType,localRtxPayloadType:void 0,remotePayloadType:i.preferredPayloadType,remoteRtxPayloadType:void 0,localParameters:t.parameters??{},remoteParameters:i.parameters??{},rtcpFeedback:f(t,i)};s.codecs.push(r)}for(const i of s.codecs){const r=e.codecs.find(e=>u(e)&&e.parameters?.apt===i.localPayloadType),s=t.codecs.find(e=>u(e)&&e.parameters?.apt===i.remotePayloadType);r&&s&&(i.localRtxPayloadType=r.preferredPayloadType,i.remoteRtxPayloadType=s.preferredPayloadType)}for(const i of t.headerExtensions){const t=e.headerExtensions.find(e=>m(e,i));if(!t)continue;const r={kind:i.kind,uri:i.uri,sendId:t.preferredId,recvId:i.preferredId,encrypt:t.preferredEncrypt??!1,direction:"sendrecv"};switch(i.direction){case"sendrecv":r.direction="sendrecv";break;case"recvonly":r.direction="sendonly";break;case"sendonly":r.direction="recvonly";break;case"inactive":r.direction="inactive"}s.headerExtensions.push(r)}return s},A.getRecvRtpCapabilities=function(e){const t={codecs:[],headerExtensions:[]};for(const r of e.codecs){const e={kind:r.kind,mimeType:r.mimeType,preferredPayloadType:r.remotePayloadType,clockRate:r.clockRate,channels:r.channels,parameters:r.localParameters,rtcpFeedback:r.rtcpFeedback};if(t.codecs.push(e),!r.remoteRtxPayloadType)continue;const s={kind:r.kind,mimeType:`${r.kind}/rtx`,preferredPayloadType:r.remoteRtxPayloadType,clockRate:r.clockRate,parameters:{apt:r.remotePayloadType},rtcpFeedback:[]};t.codecs.push(s)}for(const r of e.headerExtensions){if("sendrecv"!==r.direction&&"recvonly"!==r.direction)continue;const e={kind:r.kind,uri:r.uri,preferredId:r.recvId,preferredEncrypt:r.encrypt??!1,direction:r.direction};t.headerExtensions.push(e)}return t},A.getSendingRtpParameters=function(e,t){const r={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}};for(const s of t.codecs){if(s.kind!==e)continue;const t={mimeType:s.mimeType,payloadType:s.localPayloadType,clockRate:s.clockRate,channels:s.channels,parameters:s.localParameters,rtcpFeedback:s.rtcpFeedback};if(r.codecs.push(t),s.localRtxPayloadType){const e={mimeType:`${s.kind}/rtx`,payloadType:s.localRtxPayloadType,clockRate:s.clockRate,parameters:{apt:s.localPayloadType},rtcpFeedback:[]};r.codecs.push(e)}}for(const s of t.headerExtensions){if(s.kind&&s.kind!==e||"sendrecv"!==s.direction&&"sendonly"!==s.direction)continue;const t={uri:s.uri,id:s.sendId,encrypt:s.encrypt,parameters:{}};r.headerExtensions.push(t)}return r},A.getSendingRemoteRtpParameters=function(e,t){const r={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}};for(const s of t.codecs){if(s.kind!==e)continue;const t={mimeType:s.mimeType,payloadType:s.localPayloadType,clockRate:s.clockRate,channels:s.channels,parameters:s.remoteParameters,rtcpFeedback:s.rtcpFeedback};if(r.codecs.push(t),s.localRtxPayloadType){const e={mimeType:`${s.kind}/rtx`,payloadType:s.localRtxPayloadType,clockRate:s.clockRate,parameters:{apt:s.localPayloadType},rtcpFeedback:[]};r.codecs.push(e)}}for(const s of t.headerExtensions){if(s.kind&&s.kind!==e||"sendrecv"!==s.direction&&"sendonly"!==s.direction)continue;const t={uri:s.uri,id:s.sendId,encrypt:s.encrypt,parameters:{}};r.headerExtensions.push(t)}if(r.headerExtensions.some(e=>"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.uri))for(const s of r.codecs)s.rtcpFeedback=(s.rtcpFeedback??[]).filter(e=>"goog-remb"!==e.type);else if(r.headerExtensions.some(e=>"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.uri))for(const s of r.codecs)s.rtcpFeedback=(s.rtcpFeedback??[]).filter(e=>"transport-cc"!==e.type);else for(const s of r.codecs)s.rtcpFeedback=(s.rtcpFeedback??[]).filter(e=>"transport-cc"!==e.type&&"goog-remb"!==e.type);return r},A.reduceCodecs=function(e,t){const r=[];if(t){for(let s=0;s<e.length;++s)if(h(e[s],t,{strict:!0})){r.push(e[s]),u(e[s+1])&&r.push(e[s+1]);break}if(0===r.length)throw new TypeError("no matching codec found")}else r.push(e[0]),u(e[1])&&r.push(e[1]);return r},A.generateProbatorRtpParameters=function(e){a(e=t.clone(e));const n={mid:r,codecs:[],headerExtensions:[],encodings:[{ssrc:s}],rtcp:{cname:"probator"}};return n.codecs.push(e.codecs[0]),n.codecs[0].payloadType=i,n.headerExtensions=e.headerExtensions,n},A.canSend=function(e,t){return(t.codecs??[]).some(t=>t.kind===e)},A.canReceive=function(e,t){if(a(e),0===e.codecs.length)return!1;const r=e.codecs[0];return(t.codecs??[]).some(e=>e.preferredPayloadType===r.payloadType)};const e=F(),t=D(),r="probator",s=1234,i=127;function a(e){if("object"!=typeof e)throw new TypeError("params is not an object");if(e.mid&&"string"!=typeof e.mid)throw new TypeError("params.mid is not a string");if(!Array.isArray(e.codecs))throw new TypeError("missing params.codecs");for(const t of e.codecs)d(t);if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("params.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);for(const t of e.headerExtensions)l(t);if(e.encodings&&!Array.isArray(e.encodings))throw new TypeError("params.encodings is not an array");e.encodings||(e.encodings=[]);for(const t of e.encodings)p(t);if(e.rtcp&&"object"!=typeof e.rtcp)throw new TypeError("params.rtcp is not an object");e.rtcp||(e.rtcp={}),function(e){if("object"!=typeof e)throw new TypeError("rtcp is not an object");if(e.cname&&"string"!=typeof e.cname)throw new TypeError("invalid rtcp.cname");e.reducedSize&&"boolean"==typeof e.reducedSize||(e.reducedSize=!0)}(e.rtcp)}function n(e){const t=new RegExp("^(audio|video)/(.+)","i");if("object"!=typeof e)throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");const r=t.exec(e.mimeType);if(!r)throw new TypeError("invalid codec.mimeType");if(e.kind=r[1].toLowerCase(),"number"!=typeof e.preferredPayloadType)throw new TypeError("missing codec.preferredPayloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===e.kind?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const s of Object.keys(e.parameters)){let t=e.parameters[s];if(void 0===t&&(e.parameters[s]="",t=""),"string"!=typeof t&&"number"!=typeof t)throw new TypeError(`invalid codec parameter [key:${s}s, value:${t}]`);if("apt"===s&&"number"!=typeof t)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);for(const s of e.rtcpFeedback)o(s)}function o(e){if("object"!=typeof e)throw new TypeError("fb is not an object");if(!e.type||"string"!=typeof e.type)throw new TypeError("missing fb.type");e.parameter&&"string"==typeof e.parameter||(e.parameter="")}function c(e){if("object"!=typeof e)throw new TypeError("ext is not an object");if("audio"!==e.kind&&"video"!==e.kind)throw new TypeError("invalid ext.kind");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.preferredId)throw new TypeError("missing ext.preferredId");if(e.preferredEncrypt&&"boolean"!=typeof e.preferredEncrypt)throw new TypeError("invalid ext.preferredEncrypt");if(e.preferredEncrypt||(e.preferredEncrypt=!1),e.direction&&"string"!=typeof e.direction)throw new TypeError("invalid ext.direction");e.direction||(e.direction="sendrecv")}function d(e){const t=new RegExp("^(audio|video)/(.+)","i");if("object"!=typeof e)throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");const r=t.exec(e.mimeType);if(!r)throw new TypeError("invalid codec.mimeType");if("number"!=typeof e.payloadType)throw new TypeError("missing codec.payloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===r[1].toLowerCase()?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const s of Object.keys(e.parameters)){let t=e.parameters[s];if(void 0===t&&(e.parameters[s]="",t=""),"string"!=typeof t&&"number"!=typeof t)throw new TypeError(`invalid codec parameter [key:${s}s, value:${t}]`);if("apt"===s&&"number"!=typeof t)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);for(const s of e.rtcpFeedback)o(s)}function l(e){if("object"!=typeof e)throw new TypeError("ext is not an object");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.id)throw new TypeError("missing ext.id");if(e.encrypt&&"boolean"!=typeof e.encrypt)throw new TypeError("invalid ext.encrypt");e.encrypt||(e.encrypt=!1),e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const t of Object.keys(e.parameters)){let r=e.parameters[t];if(void 0===r&&(e.parameters[t]="",r=""),"string"!=typeof r&&"number"!=typeof r)throw new TypeError("invalid header extension parameter")}}function p(e){if("object"!=typeof e)throw new TypeError("encoding is not an object");if(e.ssrc&&"number"!=typeof e.ssrc)throw new TypeError("invalid encoding.ssrc");if(e.rid&&"string"!=typeof e.rid)throw new TypeError("invalid encoding.rid");if(e.rtx&&"object"!=typeof e.rtx)throw new TypeError("invalid encoding.rtx");if(e.rtx&&"number"!=typeof e.rtx.ssrc)throw new TypeError("missing encoding.rtx.ssrc");if(e.dtx&&"boolean"==typeof e.dtx||(e.dtx=!1),e.scalabilityMode&&"string"!=typeof e.scalabilityMode)throw new TypeError("invalid encoding.scalabilityMode")}function u(e){return!!e&&/.+\/rtx$/i.test(e.mimeType)}function h(t,r,{strict:s=!1,modify:i=!1}={}){const a=t.mimeType.toLowerCase();if(a!==r.mimeType.toLowerCase())return!1;if(t.clockRate!==r.clockRate)return!1;if(t.channels!==r.channels)return!1;switch(a){case"video/h264":if(s){if((t.parameters["packetization-mode"]??0)!==(r.parameters["packetization-mode"]??0))return!1;if(!e.isSameProfile(t.parameters,r.parameters))return!1;let s;try{s=e.generateProfileLevelIdStringForAnswer(t.parameters,r.parameters)}catch(n){return!1}i&&(s?(t.parameters["profile-level-id"]=s,r.parameters["profile-level-id"]=s):(delete t.parameters["profile-level-id"],delete r.parameters["profile-level-id"]))}break;case"video/vp9":if(s){if((t.parameters["profile-id"]??0)!==(r.parameters["profile-id"]??0))return!1}}return!0}function m(e,t){return(!e.kind||!t.kind||e.kind===t.kind)&&e.uri===t.uri}function f(e,t){const r=[];for(const s of e.rtcpFeedback??[]){const e=(t.rtcpFeedback??[]).find(e=>e.type===s.type&&(e.parameter===s.parameter||!e.parameter&&!s.parameter));e&&r.push(e)}return r}return A}var U,$={},V={},q={},W={};var z,H,G,K={};function J(){if(z)return K;z=1,Object.defineProperty(K,"__esModule",{value:!0}),K.AwaitQueueRemovedTaskError=K.AwaitQueueStoppedError=void 0;class e extends Error{constructor(t){super(t??"queue stopped"),this.name="AwaitQueueStoppedError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}}K.AwaitQueueStoppedError=e;class t extends Error{constructor(e){super(e??"queue task removed"),this.name="AwaitQueueRemovedTaskError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}}return K.AwaitQueueRemovedTaskError=t,K}function Q(){if(H)return q;H=1,Object.defineProperty(q,"__esModule",{value:!0}),q.AwaitQueue=void 0;const e=function(){if(U)return W;U=1,Object.defineProperty(W,"__esModule",{value:!0}),W.Logger=void 0;const e=l(),t="awaitqueue";return W.Logger=class{_debug;_warn;_error;constructor(r){r?(this._debug=e(`${t}:${r}`),this._warn=e(`${t}:WARN:${r}`),this._error=e(`${t}:ERROR:${r}`)):(this._debug=e(t),this._warn=e(`${t}:WARN`),this._error=e(`${t}:ERROR`)),this._debug.log=function(){}.bind(),this._warn.log=function(){}.bind(),this._error.log=function(){}.bind()}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}},W}(),t=J(),r=new e.Logger("AwaitQueue");return q.AwaitQueue=class{pendingTasks=new Map;nextTaskId=0;stopping=!1;constructor(){r.debug("constructor()")}get size(){return this.pendingTasks.size}async push(e,t){if(t=t??e.name,r.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(s){}return new Promise((s,i)=>{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),r.debug(`resolving task [name:${a.name}]`),s(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),r.debug(`rejecting task [name:${a.name}]: %s`,String(e)),i(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(){r.debug("stop()"),this.stopping=!0;for(const e of this.pendingTasks.values())r.debug(`stop() | stopping task [name:${e.name}]`),e.reject(new t.AwaitQueueStoppedError);this.stopping=!1}remove(e){r.debug(`remove() [taskIdx:${e}]`);const s=Array.from(this.pendingTasks.values())[e];s?s.reject(new t.AwaitQueueRemovedTaskError):r.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(r.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)}}},q}var X,Y={};var Z,ee={};var te,re={};var se,ie,ae={};function ne(){if(ie)return $;ie=1,Object.defineProperty($,"__esModule",{value:!0}),$.Transport=void 0;const e=(G||(G=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AwaitQueueRemovedTaskError=e.AwaitQueueStoppedError=e.AwaitQueue=void 0;var t=Q();Object.defineProperty(e,"AwaitQueue",{enumerable:!0,get:function(){return t.AwaitQueue}});var r=J();Object.defineProperty(e,"AwaitQueueStoppedError",{enumerable:!0,get:function(){return r.AwaitQueueStoppedError}}),Object.defineProperty(e,"AwaitQueueRemovedTaskError",{enumerable:!0,get:function(){return r.AwaitQueueRemovedTaskError}})}(V)),V),t=_(),r=k(),s=E(),i=D(),a=B(),n=function(){if(X)return Y;X=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.Producer=void 0;const e=_(),t=k(),r=E(),s=new e.Logger("Producer");let i=class extends t.EnhancedEventEmitter{_id;_localId;_closed=!1;_rtpSender;_track;_kind;_rtpParameters;_paused;_maxSpatialLayer;_stopTracks;_disableTrackOnPause;_zeroRtpOnPause;_appData;_observer=new t.EnhancedEventEmitter;constructor({id:e,localId:t,rtpSender:r,track:i,rtpParameters:a,stopTracks:n,disableTrackOnPause:o,zeroRtpOnPause:c,appData:d}){super(),s.debug("constructor()"),this._id=e,this._localId=t,this._rtpSender=r,this._track=i,this._kind=i.kind,this._rtpParameters=a,this._paused=!!o&&!i.enabled,this._maxSpatialLayer=void 0,this._stopTracks=n,this._disableTrackOnPause=o,this._zeroRtpOnPause=c,this._appData=d??{},this.onTrackEnded=this.onTrackEnded.bind(this),this.handleTrack()}get id(){return this._id}get localId(){return this._localId}get closed(){return this._closed}get kind(){return this._kind}get rtpSender(){return this._rtpSender}get track(){return this._track}get rtpParameters(){return this._rtpParameters}get paused(){return this._paused}get maxSpatialLayer(){return this._maxSpatialLayer}get appData(){return this._appData}set appData(e){this._appData=e}get observer(){return this._observer}close(){this._closed||(s.debug("close()"),this._closed=!0,this.destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"),super.close(),this._observer.close())}transportClosed(){this._closed||(s.debug("transportClosed()"),this._closed=!0,this.destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}async getStats(){if(this._closed)throw new r.InvalidStateError("closed");return new Promise((e,t)=>{this.safeEmit("@getstats",e,t)})}pause(){s.debug("pause()"),this._closed?s.error("pause() | Producer closed"):(this._paused=!0,this._track&&this._disableTrackOnPause&&(this._track.enabled=!1),this._zeroRtpOnPause&&new Promise((e,t)=>{this.safeEmit("@pause",e,t)}).catch(()=>{}),this._observer.safeEmit("pause"))}resume(){s.debug("resume()"),this._closed?s.error("resume() | Producer closed"):(this._paused=!1,this._track&&this._disableTrackOnPause&&(this._track.enabled=!0),this._zeroRtpOnPause&&new Promise((e,t)=>{this.safeEmit("@resume",e,t)}).catch(()=>{}),this._observer.safeEmit("resume"))}async replaceTrack({track:e}){if(s.debug("replaceTrack() [track:%o]",e),this._closed){if(e&&this._stopTracks)try{e.stop()}catch(t){}throw new r.InvalidStateError("closed")}if(e&&"ended"===e.readyState)throw new r.InvalidStateError("track ended");e!==this._track?(await new Promise((t,r)=>{this.safeEmit("@replacetrack",e,t,r)}),this.destroyTrack(),this._track=e,this._track&&this._disableTrackOnPause&&(this._paused?this._paused&&(this._track.enabled=!1):this._track.enabled=!0),this.handleTrack()):s.debug("replaceTrack() | same track, ignored")}async setMaxSpatialLayer(e){if(this._closed)throw new r.InvalidStateError("closed");if("video"!==this._kind)throw new r.UnsupportedError("not a video Producer");if("number"!=typeof e)throw new TypeError("invalid spatialLayer");e!==this._maxSpatialLayer&&(await new Promise((t,r)=>{this.safeEmit("@setmaxspatiallayer",e,t,r)}).catch(()=>{}),this._maxSpatialLayer=e)}async setRtpEncodingParameters(e){if(this._closed)throw new r.InvalidStateError("closed");if("object"!=typeof e)throw new TypeError("invalid params");await new Promise((t,r)=>{this.safeEmit("@setrtpencodingparameters",e,t,r)})}onTrackEnded(){s.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}handleTrack(){this._track&&this._track.addEventListener("ended",this.onTrackEnded)}destroyTrack(){if(this._track)try{this._track.removeEventListener("ended",this.onTrackEnded),this._stopTracks&&this._track.stop()}catch(e){}}};return Y.Producer=i,Y}(),o=function(){if(Z)return ee;Z=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.Consumer=void 0;const e=_(),t=k(),r=E(),s=new e.Logger("Consumer");let i=class extends t.EnhancedEventEmitter{_id;_localId;_producerId;_closed=!1;_rtpReceiver;_track;_rtpParameters;_paused;_appData;_observer=new t.EnhancedEventEmitter;constructor({id:e,localId:t,producerId:r,rtpReceiver:i,track:a,rtpParameters:n,appData:o}){super(),s.debug("constructor()"),this._id=e,this._localId=t,this._producerId=r,this._rtpReceiver=i,this._track=a,this._rtpParameters=n,this._paused=!a.enabled,this._appData=o??{},this.onTrackEnded=this.onTrackEnded.bind(this),this.handleTrack()}get id(){return this._id}get localId(){return this._localId}get producerId(){return this._producerId}get closed(){return this._closed}get kind(){return this._track.kind}get rtpReceiver(){return this._rtpReceiver}get track(){return this._track}get rtpParameters(){return this._rtpParameters}get paused(){return this._paused}get appData(){return this._appData}set appData(e){this._appData=e}get observer(){return this._observer}close(){this._closed||(s.debug("close()"),this._closed=!0,this.destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"),super.close(),this._observer.close())}transportClosed(){this._closed||(s.debug("transportClosed()"),this._closed=!0,this.destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}async getStats(){if(this._closed)throw new r.InvalidStateError("closed");return new Promise((e,t)=>{this.safeEmit("@getstats",e,t)})}pause(){s.debug("pause()"),this._closed?s.error("pause() | Consumer closed"):this._paused?s.debug("pause() | Consumer is already paused"):(this._paused=!0,this._track.enabled=!1,this.emit("@pause"),this._observer.safeEmit("pause"))}resume(){s.debug("resume()"),this._closed?s.error("resume() | Consumer closed"):this._paused?(this._paused=!1,this._track.enabled=!0,this.emit("@resume"),this._observer.safeEmit("resume")):s.debug("resume() | Consumer is already resumed")}onTrackEnded(){s.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}handleTrack(){this._track.addEventListener("ended",this.onTrackEnded)}destroyTrack(){try{this._track.removeEventListener("ended",this.onTrackEnded),this._track.stop()}catch(e){}}};return ee.Consumer=i,ee}(),c=function(){if(te)return re;te=1,Object.defineProperty(re,"__esModule",{value:!0}),re.DataProducer=void 0;const e=_(),t=k(),r=E(),s=new e.Logger("DataProducer");let i=class extends t.EnhancedEventEmitter{_id;_dataChannel;_closed=!1;_sctpStreamParameters;_appData;_observer=new t.EnhancedEventEmitter;constructor({id:e,dataChannel:t,sctpStreamParameters:r,appData:i}){super(),s.debug("constructor()"),this._id=e,this._dataChannel=t,this._sctpStreamParameters=r,this._appData=i??{},this.handleDataChannel()}get id(){return this._id}get closed(){return this._closed}get sctpStreamParameters(){return this._sctpStreamParameters}get readyState(){return this._dataChannel.readyState}get label(){return this._dataChannel.label}get protocol(){return this._dataChannel.protocol}get bufferedAmount(){return this._dataChannel.bufferedAmount}get bufferedAmountLowThreshold(){return this._dataChannel.bufferedAmountLowThreshold}set bufferedAmountLowThreshold(e){this._dataChannel.bufferedAmountLowThreshold=e}get appData(){return this._appData}set appData(e){this._appData=e}get observer(){return this._observer}close(){this._closed||(s.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"),super.close(),this._observer.close())}transportClosed(){this._closed||(s.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}send(e){if(s.debug("send()"),this._closed)throw new r.InvalidStateError("closed");this._dataChannel.send(e)}handleDataChannel(){this._dataChannel.addEventListener("open",()=>{this._closed||(s.debug('DataChannel "open" event'),this.safeEmit("open"))}),this._dataChannel.addEventListener("error",e=>{if(this._closed)return;const t=e.error??new Error("unknown DataChannel error");"sctp-failure"===e.error?.errorDetail?s.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",e.error?.sctpCauseCode,e.error.message):s.error('DataChannel "error" event: %o',t),this.safeEmit("error",t)}),this._dataChannel.addEventListener("close",()=>{this._closed||(s.warn('DataChannel "close" event'),this._closed=!0,this.emit("@close"),this.safeEmit("close"),this._observer.safeEmit("close"))}),this._dataChannel.addEventListener("message",()=>{this._closed||s.warn('DataChannel "message" event in a DataProducer, message discarded')}),this._dataChannel.addEventListener("bufferedamountlow",()=>{this._closed||this.safeEmit("bufferedamountlow")})}};return re.DataProducer=i,re}(),d=function(){if(se)return ae;se=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.DataConsumer=void 0;const e=_(),t=k(),r=new e.Logger("DataConsumer");let s=class extends t.EnhancedEventEmitter{_id;_dataProducerId;_dataChannel;_closed=!1;_sctpStreamParameters;_appData;_observer=new t.EnhancedEventEmitter;constructor({id:e,dataProducerId:t,dataChannel:s,sctpStreamParameters:i,appData:a}){super(),r.debug("constructor()"),this._id=e,this._dataProducerId=t,this._dataChannel=s,this._sctpStreamParameters=i,this._appData=a??{},this.handleDataChannel()}get id(){return this._id}get dataProducerId(){return this._dataProducerId}get closed(){return this._closed}get sctpStreamParameters(){return this._sctpStreamParameters}get readyState(){return this._dataChannel.readyState}get label(){return this._dataChannel.label}get protocol(){return this._dataChannel.protocol}get binaryType(){return this._dataChannel.binaryType}set binaryType(e){this._dataChannel.binaryType=e}get appData(){return this._appData}set appData(e){this._appData=e}get observer(){return this._observer}close(){this._closed||(r.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"),super.close(),this._observer.close())}transportClosed(){this._closed||(r.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}handleDataChannel(){this._dataChannel.addEventListener("open",()=>{this._closed||(r.debug('DataChannel "open" event'),this.safeEmit("open"))}),this._dataChannel.addEventListener("error",e=>{if(this._closed)return;const t=e.error??new Error("unknown DataChannel error");"sctp-failure"===e.error?.errorDetail?r.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",e.error?.sctpCauseCode,e.error.message):r.error('DataChannel "error" event: %o',t),this.safeEmit("error",t)}),this._dataChannel.addEventListener("close",()=>{this._closed||(r.warn('DataChannel "close" event'),this._closed=!0,this.emit("@close"),this.safeEmit("close"),this._observer.safeEmit("close"))}),this._dataChannel.addEventListener("message",e=>{this._closed||this.safeEmit("message",e.data)})}};return ae.DataConsumer=s,ae}(),l=new t.Logger("Transport");class p{consumerOptions;promise;resolve;reject;constructor(e){this.consumerOptions=e,this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class u extends r.EnhancedEventEmitter{_id;_closed=!1;_direction;_getSendExtendedRtpCapabilities;_recvRtpCapabilities;_canProduceByKind;_maxSctpMessageSize;_handler;_iceGatheringState="new";_connectionState="new";_appData;_producers=new Map;_consumers=new Map;_dataProducers=new Map;_dataConsumers=new Map;_probatorConsumerCreated=!1;_awaitQueue=new e.AwaitQueue;_pendingConsumerTasks=[];_consumerCreationInProgress=!1;_pendingPauseConsumers=new Map;_consumerPauseInProgress=!1;_pendingResumeConsumers=new Map;_consumerResumeInProgress=!1;_pendingCloseConsumers=new Map;_consumerCloseInProgress=!1;_observer=new r.EnhancedEventEmitter;constructor({direction:e,id:t,iceParameters:r,iceCandidates:s,dtlsParameters:a,sctpParameters:n,iceServers:o,iceTransportPolicy:c,additionalSettings:d,appData:p,handlerFactory:u,getSendExtendedRtpCapabilities:h,recvRtpCapabilities:m,canProduceByKind:f}){super(),l.debug("constructor() [id:%s, direction:%s]",t,e),this._id=t,this._direction=e,this._getSendExtendedRtpCapabilities=h,this._recvRtpCapabilities=m,this._canProduceByKind=f,this._maxSctpMessageSize=n?n.maxMessageSize:null;const g=i.clone(d)??{};delete g.iceServers,delete g.iceTransportPolicy,delete g.bundlePolicy,delete g.rtcpMuxPolicy,this._handler=u.factory({direction:e,iceParameters:r,iceCandidates:s,dtlsParameters:a,sctpParameters:n,iceServers:o,iceTransportPolicy:c,additionalSettings:g,getSendExtendedRtpCapabilities:this._getSendExtendedRtpCapabilities}),this._appData=p??{},this.handleHandler()}get id(){return this._id}get closed(){return this._closed}get direction(){return this._direction}get handler(){return this._handler}get iceGatheringState(){return this._iceGatheringState}get connectionState(){return this._connectionState}get appData(){return this._appData}set appData(e){this._appData=e}get observer(){return this._observer}close(){if(!this._closed){l.debug("close()"),this._closed=!0,this._awaitQueue.stop(),this._handler.close(),this._connectionState="closed";for(const e of this._producers.values())e.transportClosed();this._producers.clear();for(const e of this._consumers.values())e.transportClosed();this._consumers.clear();for(const e of this._dataProducers.values())e.transportClosed();this._dataProducers.clear();for(const e of this._dataConsumers.values())e.transportClosed();this._dataConsumers.clear(),this._observer.safeEmit("close"),super.close(),this._observer.close()}}async getStats(){if(this._closed)throw new s.InvalidStateError("closed");return this._handler.getTransportStats()}async restartIce({iceParameters:e}){if(l.debug("restartIce()"),this._closed)throw new s.InvalidStateError("closed");if(!e)throw new TypeError("missing iceParameters");return this._awaitQueue.push(async()=>await this._handler.restartIce(e),"transport.restartIce()")}async updateIceServers({iceServers:e}={}){if(l.debug("updateIceServers()"),this._closed)throw new s.InvalidStateError("closed");if(!Array.isArray(e))throw new TypeError("missing iceServers");return this._awaitQueue.push(async()=>this._handler.updateIceServers(e),"transport.updateIceServers()")}async produce({track:e,encodings:t,codecOptions:r,codec:i,stopTracks:o=!0,disableTrackOnPause:c=!0,zeroRtpOnPause:d=!1,onRtpSender:p,appData:u={}}={}){if(l.debug("produce() [track:%o]",e),this._closed)throw new s.InvalidStateError("closed");if(!e)throw new TypeError("missing track");if("send"!==this._direction)throw new s.UnsupportedError("not a sending Transport");if(!this._canProduceByKind[e.kind])throw new s.UnsupportedError(`cannot produce ${e.kind}`);if("ended"===e.readyState)throw new s.InvalidStateError("track ended");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(0===this.listenerCount("produce"))throw new TypeError('no "produce" listener set into this transport');if(u&&"object"!=typeof u)throw new TypeError("if given, appData must be an object");return this._awaitQueue.push(async()=>{let s;if(t&&!Array.isArray(t))throw TypeError("encodings must be an array");t&&0===t.length?s=void 0:t&&(s=t.map(e=>{const t={active:!0};return!1===e.active&&(t.active=!1),"boolean"==typeof e.dtx&&(t.dtx=e.dtx),"string"==typeof e.scalabilityMode&&(t.scalabilityMode=e.scalabilityMode),"number"==typeof e.scaleResolutionDownBy&&(t.scaleResolutionDownBy=e.scaleResolutionDownBy),"number"==typeof e.maxBitrate&&(t.maxBitrate=e.maxBitrate),"number"==typeof e.maxFramerate&&(t.maxFramerate=e.maxFramerate),"boolean"==typeof e.adaptivePtime&&(t.adaptivePtime=e.adaptivePtime),"string"==typeof e.priority&&(t.priority=e.priority),"string"==typeof e.networkPriority&&(t.networkPriority=e.networkPriority),t}));const{localId:l,rtpParameters:h,rtpSender:m}=await this._handler.send({track:e,encodings:s,codecOptions:r,codec:i,onRtpSender:p});try{a.validateAndNormalizeRtpParameters(h);const{id:t}=await new Promise((t,r)=>{this.safeEmit("produce",{kind:e.kind,rtpParameters:h,appData:u},t,r)}),r=new n.Producer({id:t,localId:l,rtpSender:m,track:e,rtpParameters:h,stopTracks:o,disableTrackOnPause:c,zeroRtpOnPause:d,appData:u});return this._producers.set(r.id,r),this.handleProducer(r),this._observer.safeEmit("newproducer",r),r}catch(f){throw this._handler.stopSending(l).catch(()=>{}),f}},"transport.produce()").catch(t=>{if(o)try{e.stop()}catch(r){}throw t})}async consume({id:e,producerId:t,kind:r,rtpParameters:n,streamId:o,onRtpReceiver:c,appData:d={}}){if(l.debug("consume()"),this._closed)throw new s.InvalidStateError("closed");if("recv"!==this._direction)throw new s.UnsupportedError("not a receiving Transport");if("string"!=typeof e)throw new TypeError("missing id");if("string"!=typeof t)throw new TypeError("missing producerId");if("audio"!==r&&"video"!==r)throw new TypeError(`invalid kind '${r}'`);if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(d&&"object"!=typeof d)throw new TypeError("if given, appData must be an object");const u=i.clone(n);if(!a.canReceive(u,this._recvRtpCapabilities))throw new s.UnsupportedError("cannot consume this Producer");const h=new p({id:e,producerId:t,kind:r,rtpParameters:u,streamId:o,onRtpReceiver:c,appData:d});return this._pendingConsumerTasks.push(h),queueMicrotask(()=>{this._closed||!1===this._consumerCreationInProgress&&this.createPendingConsumers()}),h.promise}async produceData({ordered:e=!0,maxPacketLifeTime:t,maxRetransmits:r,label:i="",protocol:n="",appData:o={}}={}){if(l.debug("produceData()"),this._closed)throw new s.InvalidStateError("closed");if("send"!==this._direction)throw new s.UnsupportedError("not a sending Transport");if(!this._maxSctpMessageSize)throw new s.UnsupportedError("SCTP not enabled by remote Transport");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(0===this.listenerCount("producedata"))throw new TypeError('no "producedata" listener set into this transport');if(o&&"object"!=typeof o)throw new TypeError("if given, appData must be an object");return(t||r)&&(e=!1),this._awaitQueue.push(async()=>{const{dataChannel:s,sctpStreamParameters:d}=await this._handler.sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:r,label:i,protocol:n});a.validateAndNormalizeSctpStreamParameters(d);const{id:l}=await new Promise((e,t)=>{this.safeEmit("producedata",{sctpStreamParameters:d,label:i,protocol:n,appData:o},e,t)}),p=new c.DataProducer({id:l,dataChannel:s,sctpStreamParameters:d,appData:o});return this._dataProducers.set(p.id,p),this.handleDataProducer(p),this._observer.safeEmit("newdataproducer",p),p},"transport.produceData()")}async consumeData({id:e,dataProducerId:t,sctpStreamParameters:r,label:n="",protocol:o="",appData:c={}}){if(l.debug("consumeData()"),this._closed)throw new s.InvalidStateError("closed");if("recv"!==this._direction)throw new s.UnsupportedError("not a receiving Transport");if(!this._maxSctpMessageSize)throw new s.UnsupportedError("SCTP not enabled by remote Transport");if("string"!=typeof e)throw new TypeError("missing id");if("string"!=typeof t)throw new TypeError("missing dataProducerId");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(c&&"object"!=typeof c)throw new TypeError("if given, appData must be an object");const p=i.clone(r);return a.validateAndNormalizeSctpStreamParameters(p),this._awaitQueue.push(async()=>{const{dataChannel:r}=await this._handler.receiveDataChannel({sctpStreamParameters:p,label:n,protocol:o}),s=new d.DataConsumer({id:e,dataProducerId:t,dataChannel:r,sctpStreamParameters:p,appData:c});return this._dataConsumers.set(s.id,s),this.handleDataConsumer(s),this._observer.safeEmit("newdataconsumer",s),s},"transport.consumeData()")}createPendingConsumers(){this._consumerCreationInProgress=!0,this._awaitQueue.push(async()=>{if(0===this._pendingConsumerTasks.length)return void l.debug("createPendingConsumers() | there is no Consumer to be created");const e=[...this._pendingConsumerTasks];let t;this._pendingConsumerTasks=[];const r=[];for(const i of e){const{id:e,kind:t,rtpParameters:s,streamId:a,onRtpReceiver:n}=i.consumerOptions;r.push({trackId:e,kind:t,rtpParameters:s,streamId:a,onRtpReceiver:n})}try{const s=await this._handler.receive(r);for(let r=0;r<s.length;++r){const i=e[r],a=s[r],{id:n,producerId:c,kind:d,rtpParameters:l,appData:p}=i.consumerOptions,{localId:u,rtpReceiver:h,track:m}=a,f=new o.Consumer({id:n,localId:u,producerId:c,rtpReceiver:h,track:m,rtpParameters:l,appData:p});this._consumers.set(f.id,f),this.handleConsumer(f),this._probatorConsumerCreated||t||"video"!==d||(t=f),this._observer.safeEmit("newconsumer",f),i.resolve(f)}}catch(s){for(const t of e)t.reject(s)}if(t)try{const e=a.generateProbatorRtpParameters(t.rtpParameters);await this._handler.receive([{trackId:"probator",kind:"video",rtpParameters:e}]),l.debug("createPendingConsumers() | Consumer for RTP probation created"),this._probatorConsumerCreated=!0}catch(s){l.error("createPendingConsumers() | failed to create Consumer for RTP probation:%o",s)}},"transport.createPendingConsumers()").then(()=>{this._consumerCreationInProgress=!1,this._pendingConsumerTasks.length>0&&this.createPendingConsumers()}).catch(()=>{})}pausePendingConsumers(){this._consumerPauseInProgress=!0,this._awaitQueue.push(async()=>{if(0===this._pendingPauseConsumers.size)return void l.debug("pausePendingConsumers() | there is no Consumer to be paused");const e=Array.from(this._pendingPauseConsumers.values());this._pendingPauseConsumers.clear();try{const t=e.map(e=>e.localId);await this._handler.pauseReceiving(t)}catch(t){l.error("pausePendingConsumers() | failed to pause Consumers:",t)}},"transport.pausePendingConsumers").then(()=>{this._consumerPauseInProgress=!1,this._pendingPauseConsumers.size>0&&this.pausePendingConsumers()}).catch(()=>{})}resumePendingConsumers(){this._consumerResumeInProgress=!0,this._awaitQueue.push(async()=>{if(0===this._pendingResumeConsumers.size)return void l.debug("resumePendingConsumers() | there is no Consumer to be resumed");const e=Array.from(this._pendingResumeConsumers.values());this._pendingResumeConsumers.clear();try{const t=e.map(e=>e.localId);await this._handler.resumeReceiving(t)}catch(t){l.error("resumePendingConsumers() | failed to resume Consumers:",t)}},"transport.resumePendingConsumers").then(()=>{this._consumerResumeInProgress=!1,this._pendingResumeConsumers.size>0&&this.resumePendingConsumers()}).catch(()=>{})}closePendingConsumers(){this._consumerCloseInProgress=!0,this._awaitQueue.push(async()=>{if(0===this._pendingCloseConsumers.size)return void l.debug("closePendingConsumers() | there is no Consumer to be closed");const e=Array.from(this._pendingCloseConsumers.values());this._pendingCloseConsumers.clear();try{await this._handler.stopReceiving(e.map(e=>e.localId))}catch(t){l.error("closePendingConsumers() | failed to close Consumers:",t)}},"transport.closePendingConsumers").then(()=>{this._consumerCloseInProgress=!1,this._pendingCloseConsumers.size>0&&this.closePendingConsumers()}).catch(()=>{})}handleHandler(){const e=this._handler;e.on("@connect",({dtlsParameters:e},t,r)=>{this._closed?r(new s.InvalidStateError("closed")):this.safeEmit("connect",{dtlsParameters:e},t,r)}),e.on("@icegatheringstatechange",e=>{e!==this._iceGatheringState&&(l.debug("ICE gathering state changed to %s",e),this._iceGatheringState=e,this._closed||this.safeEmit("icegatheringstatechange",e))}),e.on("@icecandidateerror",e=>{l.warn(`ICE candidate error [url:${e.url}, localAddress:${e.address}, localPort:${e.port}]: ${e.errorCode} "${e.errorText}"`),this.safeEmit("icecandidateerror",e)}),e.on("@connectionstatechange",e=>{e!==this._connectionState&&(l.debug("connection state changed to %s",e),this._connectionState=e,this._closed||this.safeEmit("connectionstatechange",e))})}handleProducer(e){e.on("@close",()=>{this._producers.delete(e.id),this._closed||this._awaitQueue.push(async()=>await this._handler.stopSending(e.localId),"producer @close event").catch(e=>l.warn("producer.close() failed:%o",e))}),e.on("@pause",(t,r)=>{this._awaitQueue.push(async()=>await this._handler.pauseSending(e.localId),"producer @pause event").then(t).catch(r)}),e.on("@resume",(t,r)=>{this._awaitQueue.push(async()=>await this._handler.resumeSending(e.localId),"producer @resume event").then(t).catch(r)}),e.on("@replacetrack",(t,r,s)=>{this._awaitQueue.push(async()=>await this._handler.replaceTrack(e.localId,t),"producer @replacetrack event").then(r).catch(s)}),e.on("@setmaxspatiallayer",(t,r,s)=>{this._awaitQueue.push(async()=>await this._handler.setMaxSpatialLayer(e.localId,t),"producer @setmaxspatiallayer event").then(r).catch(s)}),e.on("@setrtpencodingparameters",(t,r,s)=>{this._awaitQueue.push(async()=>await this._handler.setRtpEncodingParameters(e.localId,t),"producer @setrtpencodingparameters event").then(r).catch(s)}),e.on("@getstats",(t,r)=>{if(this._closed)return r(new s.InvalidStateError("closed"));this._handler.getSenderStats(e.localId).then(t).catch(r)})}handleConsumer(e){e.on("@close",()=>{this._consumers.delete(e.id),this._pendingPauseConsumers.delete(e.id),this._pendingResumeConsumers.delete(e.id),this._closed||(this._pendingCloseConsumers.set(e.id,e),!1===this._consumerCloseInProgress&&this.closePendingConsumers())}),e.on("@pause",()=>{this._pendingResumeConsumers.has(e.id)&&this._pendingResumeConsumers.delete(e.id),this._pendingPauseConsumers.set(e.id,e),queueMicrotask(()=>{this._closed||!1===this._consumerPauseInProgress&&this.pausePendingConsumers()})}),e.on("@resume",()=>{this._pendingPauseConsumers.has(e.id)&&this._pendingPauseConsumers.delete(e.id),this._pendingResumeConsumers.set(e.id,e),queueMicrotask(()=>{this._closed||!1===this._consumerResumeInProgress&&this.resumePendingConsumers()})}),e.on("@getstats",(t,r)=>{if(this._closed)return r(new s.InvalidStateError("closed"));this._handler.getReceiverStats(e.localId).then(t).catch(r)})}handleDataProducer(e){e.on("@close",()=>{this._dataProducers.delete(e.id)})}handleDataConsumer(e){e.on("@close",()=>{this._dataConsumers.delete(e.id)})}}return $.Transport=u,$}var oe,ce,de,le,pe,ue={},he={},me={},fe={exports:{}};function ge(){if(oe)return fe.exports;oe=1;var e=fe.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(e).forEach(function(t){e[t].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),fe.exports}function be(){return ce||(ce=1,function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,s){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var a=e.push?{}:i?r[e.name]:r;!function(e,r,s,i){if(i&&!s)r[i]=t(e[1]);else for(var a=0;a<s.length;a+=1)null!=e[a+1]&&(r[s[a]]=t(e[a+1]))}(s.match(e.reg),a,e.names,e.name),e.push&&r[e.push].push(a)},s=ge(),i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],n=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach(function(e){var t=e[0],i=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),n=a[a.length-1]);for(var o=0;o<(s[t]||[]).length;o+=1){var c=s[t][o];if(c.reg.test(i))return r(c,n,i)}}),t.media=a,t};var a=function(e,r){var s=r.split(/=(.+)/,2);return 2===s.length?e[s[0]]=t(s[1]):1===s.length&&r.length>1&&(e[s[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],s=e.split(" ").map(t),i=0;i<s.length;i+=3)r.push({component:s[i],ip:s[i+1],port:s[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var r,s=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),s=!0),{scid:r,paused:s}})})}}(me)),me}function ye(){if(le)return de;le=1;var e=ge(),t=/%[sdv%]/g,r=function(e){var r=1,s=arguments,i=s.length;return e.replace(t,function(e){if(r>=i)return e;var t=s[r];switch(r+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},s=function(e,t,s){var i=[e+"="+(t.format instanceof Function?t.format(t.push?s:s[t.name]):t.format)];if(t.names)for(var a=0;a<t.names.length;a+=1){var n=t.names[a];t.name?i.push(s[t.name][n]):i.push(s[t.names[a]])}else i.push(s[t.name]);return r.apply(null,i)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],a=["i","c","b","a"];return de=function(t,r){r=r||{},null==t.version&&(t.version=0),null==t.name&&(t.name=" "),t.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var n=r.outerOrder||i,o=r.innerOrder||a,c=[];return n.forEach(function(r){e[r].forEach(function(e){e.name in t&&null!=t[e.name]?c.push(s(r,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){c.push(s(r,e,t))})})}),t.media.forEach(function(t){c.push(s("m",e.m[0],t)),o.forEach(function(r){e[r].forEach(function(e){e.name in t&&null!=t[e.name]?c.push(s(r,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){c.push(s(r,e,t))})})})}),c.join("\r\n")+"\r\n"}}function _e(){if(pe)return he;pe=1;var e=be(),t=ye(),r=ge();return he.grammar=r,he.write=t,he.parse=e.parse,he.parseParams=e.parseParams,he.parseFmtpConfig=e.parseFmtpConfig,he.parsePayloads=e.parsePayloads,he.parseRemoteCandidates=e.parseRemoteCandidates,he.parseImageAttributes=e.parseImageAttributes,he.parseSimulcastStreamList=e.parseSimulcastStreamList,he}var ve,we={};function Se(){if(ve)return we;ve=1,Object.defineProperty(we,"__esModule",{value:!0}),we.parse=function(t){const r=e.exec(t??"");return r?{spatialLayers:Number(r[1]),temporalLayers:Number(r[2])}:{spatialLayers:1,temporalLayers:1}};const e=new RegExp("^[LS]([1-9]\\d{0,1})T([1-9]\\d{0,1})");return we}var Ce,Pe={};function ke(){if(Ce)return Pe;Ce=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.extractRtpCapabilities=function({sdpObject:t}){const r=new Map,s=new Map;for(const i of t.media){const t=i.type;switch(t){case"audio":case"video":break;default:continue}for(const e of i.rtp){const s={kind:t,mimeType:`${t}/${e.codec}`,preferredPayloadType:e.payload,clockRate:e.rate,channels:e.encoding,parameters:{},rtcpFeedback:[]};r.set(s.preferredPayloadType,s)}for(const s of i.fmtp??[]){const t=e.parseParams(s.config),i=r.get(s.payload);i&&(t?.hasOwnProperty("profile-level-id")&&(t["profile-level-id"]=String(t["profile-level-id"])),i.parameters=t)}for(const e of i.rtcpFb??[]){const s={type:e.type,parameter:e.subtype};if(s.parameter||delete s.parameter,"*"!==e.payload){const t=r.get(Number(e.payload));if(!t)continue;t.rtcpFeedback.push(s)}else for(const e of r.values())e.kind!==t||/.+\/rtx$/i.test(e.mimeType)||e.rtcpFeedback.push(s)}for(const e of i.ext??[]){if(e["encrypt-uri"])continue;const r={kind:t,uri:e.uri,preferredId:e.value};s.set(r.preferredId,r)}}return{codecs:Array.from(r.values()),headerExtensions:Array.from(s.values())}},Pe.extractDtlsParameters=function({sdpObject:e}){let t,r=e.setup,s=e.fingerprint;if(!r||!s){const t=(e.media??[]).find(e=>0!==e.port);t&&(r??=t.setup,s??=t.fingerprint)}if(!r)throw new Error("no a=setup found at SDP session or media level");if(!s)throw new Error("no a=fingerprint found at SDP session or media level");switch(r){case"active":t="client";break;case"passive":t="server";break;case"actpass":t="auto"}return{role:t,fingerprints:[{algorithm:s.type,value:s.hash}]}},Pe.getCname=function({offerMediaObject:e}){const t=(e.ssrcs??[]).find(e=>"cname"===e.attribute);if(!t)return"";return t.value},Pe.applyCodecParameters=function({offerRtpParameters:t,answerMediaObject:r}){for(const s of t.codecs){const t=s.mimeType.toLowerCase();if("audio/opus"!==t)continue;if(!(r.rtp??[]).find(e=>e.payload===s.payloadType))continue;r.fmtp=r.fmtp??[];let i=r.fmtp.find(e=>e.payload===s.payloadType);i||(i={payload:s.payloadType,config:""},r.fmtp.push(i));const a=e.parseParams(i.config);switch(t){case"audio/opus":{const e=s.parameters?.["sprop-stereo"];void 0!==e&&(a.stereo=Number(e)?1:0);break}}i.config="";for(const e of Object.keys(a))i.config&&(i.config+=";"),i.config+=`${e}=${a[e]}`}};const e=_e();return Pe}var Re,Te={};function Ee(){if(Re)return Te;return Re=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.getRtpEncodings=function({offerMediaObject:e}){const t=new Set;for(const i of e.ssrcs??[]){const e=i.id;e&&t.add(e)}if(0===t.size)throw new Error("no a=ssrc lines found");const r=new Map;for(const i of e.ssrcGroups??[]){if("FID"!==i.semantics)continue;const e=i.ssrcs.split(/\s+/),s=Number(e[0]),a=Number(e[1]);t.has(s)&&(t.delete(s),t.delete(a),r.set(s,a))}for(const i of t)r.set(i,void 0);const s=[];for(const[i,a]of r){const e={ssrc:i};a&&(e.rtx={ssrc:a}),s.push(e)}return s},Te.addLegacySimulcast=function({offerMediaObject:e,numStreams:t}){if(t<=1)throw new TypeError("numStreams must be greater than 1");const r=(e.ssrcs??[]).find(e=>"msid"===e.attribute);if(!r)throw new Error("a=ssrc line with msid information not found");const[s,i]=r.value.split(" "),a=Number(r.id);let n;(e.ssrcGroups??[]).some(e=>{if("FID"!==e.semantics)return!1;const t=e.ssrcs.split(/\s+/);return Number(t[0])===a&&(n=Number(t[1]),!0)});const o=(e.ssrcs??[]).find(e=>"cname"===e.attribute);if(!o)throw new Error("a=ssrc line with cname information not found");const c=o.value,d=[],l=[];for(let p=0;p<t;++p)d.push(a+p),n&&l.push(n+p);e.ssrcGroups=[],e.ssrcs=[],e.ssrcGroups.push({semantics:"SIM",ssrcs:d.join(" ")});for(const p of d)e.ssrcs.push({id:p,attribute:"cname",value:c}),e.ssrcs.push({id:p,attribute:"msid",value:`${s} ${i}`});for(let p=0;p<l.length;++p){const t=d[p],r=l[p];e.ssrcs.push({id:r,attribute:"cname",value:c}),e.ssrcs.push({id:r,attribute:"msid",value:`${s} ${i}`}),e.ssrcGroups.push({semantics:"FID",ssrcs:`${t} ${r}`})}},Te}var Ie,xe={};function De(){if(Ie)return xe;return Ie=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.addNackSupportForOpus=function(e){for(const t of e.codecs??[])"audio/opus"!==t.mimeType.toLowerCase()&&"audio/multiopus"!==t.mimeType.toLowerCase()||t.rtcpFeedback?.some(e=>"nack"===e.type&&!e.parameter)||(t.rtcpFeedback||(t.rtcpFeedback=[]),t.rtcpFeedback.push({type:"nack"}))},xe}var Me,Le,Oe,Ae={},Ne={};function je(){if(Le)return Ae;Le=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.RemoteSdp=void 0;const e=_e(),t=_(),r=function(){if(Me)return Ne;Me=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.OfferMediaSection=Ne.AnswerMediaSection=Ne.MediaSection=void 0;const e=_e(),t=D();let r=class{_mediaObject;constructor({iceParameters:e,iceCandidates:t,dtlsParameters:r}){if(this._mediaObject={type:"",port:0,protocol:"",payloads:"",rtp:[],fmtp:[]},e&&this.setIceParameters(e),t){this._mediaObject.candidates=[];for(const e of t){const t={foundation:e.foundation,component:1,ip:e.address??e.ip,port:e.port,priority:e.priority,transport:e.protocol,type:e.type};e.tcpType&&(t.tcptype=e.tcpType),this._mediaObject.candidates.push(t)}this._mediaObject.endOfCandidates="end-of-candidates",this._mediaObject.iceOptions="renomination"}r&&this.setDtlsRole(r.role)}get mid(){return String(this._mediaObject.mid)}get closed(){return 0===this._mediaObject.port}getObject(){return this._mediaObject}setIceParameters(e){this._mediaObject.iceUfrag=e.usernameFragment,this._mediaObject.icePwd=e.password}pause(){this._mediaObject.direction="inactive"}disable(){this.pause(),delete this._mediaObject.ext,delete this._mediaObject.ssrcs,delete this._mediaObject.ssrcGroups,delete this._mediaObject.simulcast,delete this._mediaObject.simulcast_03,delete this._mediaObject.rids,delete this._mediaObject.extmapAllowMixed}close(){this.disable(),this._mediaObject.port=0}};function s(e){const t=new RegExp("^(audio|video)/(.+)","i").exec(e.mimeType);if(!t)throw new TypeError("invalid codec.mimeType");return t[2]}return Ne.MediaSection=r,Ne.AnswerMediaSection=class extends r{constructor({iceParameters:e,iceCandidates:r,dtlsParameters:i,sctpParameters:a,plainRtpParameters:n,offerMediaObject:o,offerRtpParameters:c,answerRtpParameters:d,codecOptions:l}){switch(super({iceParameters:e,iceCandidates:r,dtlsParameters:i}),this._mediaObject.mid=String(o.mid),this._mediaObject.type=o.type,this._mediaObject.protocol=o.protocol,n?(this._mediaObject.connection={ip:n.ip,version:n.ipVersion},this._mediaObject.port=n.port):(this._mediaObject.connection={ip:"127.0.0.1",version:4},this._mediaObject.port=7),o.type){case"audio":case"video":this._mediaObject.direction="recvonly",this._mediaObject.rtp=[],this._mediaObject.rtcpFb=[],this._mediaObject.fmtp=[];for(const e of d.codecs){const r={payload:e.payloadType,codec:s(e),rate:e.clockRate};e.channels>1&&(r.encoding=e.channels),this._mediaObject.rtp.push(r);const i=t.clone(e.parameters)??{};let a=t.clone(e.rtcpFeedback)??[];if(l){const{opusStereo:t,opusFec:r,opusDtx:s,opusMaxPlaybackRate:n,opusMaxAverageBitrate:o,opusPtime:d,opusNack:p,videoGoogleStartBitrate:u,videoGoogleMaxBitrate:h,videoGoogleMinBitrate:m}=l,f=c.codecs.find(t=>t.payloadType===e.payloadType);switch(e.mimeType.toLowerCase()){case"audio/opus":case"audio/multiopus":void 0!==t&&(f.parameters["sprop-stereo"]=t?1:0,i.stereo=t?1:0),void 0!==r&&(f.parameters.useinbandfec=r?1:0,i.useinbandfec=r?1:0),void 0!==s&&(f.parameters.usedtx=s?1:0,i.usedtx=s?1:0),void 0!==n&&(i.maxplaybackrate=n),void 0!==o&&(i.maxaveragebitrate=o),void 0!==d&&(f.parameters.ptime=d,i.ptime=d),p||(f.rtcpFeedback=f.rtcpFeedback.filter(e=>"nack"!==e.type||e.parameter),a=a.filter(e=>"nack"!==e.type||e.parameter));break;case"video/vp8":case"video/vp9":case"video/h264":case"video/h265":case"video/av1":void 0!==u&&(i["x-google-start-bitrate"]=u),void 0!==h&&(i["x-google-max-bitrate"]=h),void 0!==m&&(i["x-google-min-bitrate"]=m)}}const n={payload:e.payloadType,config:""};for(const e of Object.keys(i))n.config&&(n.config+=";"),n.config+=`${e}=${i[e]}`;n.config&&this._mediaObject.fmtp.push(n);for(const t of a)this._mediaObject.rtcpFb.push({payload:e.payloadType,type:t.type,subtype:t.parameter})}this._mediaObject.payloads=d.codecs.map(e=>e.payloadType).join(" "),this._mediaObject.ext=[];for(const e of d.headerExtensions)(o.ext??[]).some(t=>t.uri===e.uri)&&this._mediaObject.ext.push({uri:e.uri,value:e.id});if("extmap-allow-mixed"===o.extmapAllowMixed&&(this._mediaObject.extmapAllowMixed="extmap-allow-mixed"),o.simulcast){this._mediaObject.simulcast={dir1:"recv",list1:o.simulcast.list1},this._mediaObject.rids=[];for(const e of o.rids??[])"send"===e.direction&&this._mediaObject.rids.push({id:e.id,direction:"recv"})}else if(o.simulcast_03){this._mediaObject.simulcast_03={value:o.simulcast_03.value.replace(/send/g,"recv")},this._mediaObject.rids=[];for(const e of o.rids??[])"send"===e.direction&&this._mediaObject.rids.push({id:e.id,direction:"recv"})}this._mediaObject.rtcpMux="rtcp-mux",this._mediaObject.rtcpRsize="rtcp-rsize";break;case"application":"number"==typeof o.sctpPort?(this._mediaObject.payloads="webrtc-datachannel",this._mediaObject.sctpPort=a.port,this._mediaObject.maxMessageSize=a.maxMessageSize):o.sctpmap&&(this._mediaObject.payloads=String(a.port),this._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:a.port,maxMessageSize:a.maxMessageSize})}}setDtlsRole(e){switch(e){case"client":this._mediaObject.setup="active";break;case"server":this._mediaObject.setup="passive";break;case"auto":this._mediaObject.setup="actpass"}}resume(){this._mediaObject.direction="recvonly"}muxSimulcastStreams(t){if(!this._mediaObject.simulcast?.list1)return;const r={};for(const e of t)e.rid&&(r[e.rid]=e);const s=this._mediaObject.simulcast.list1,i=e.parseSimulcastStreamList(s);for(const e of i)for(const t of e)t.paused=!r[t.scid]?.active;this._mediaObject.simulcast.list1=i.map(e=>e.map(e=>`${e.paused?"~":""}${e.scid}`).join(",")).join(";")}},Ne.OfferMediaSection=class extends r{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:r,sctpParameters:i,plainRtpParameters:a,mid:n,kind:o,offerRtpParameters:c,streamId:d,trackId:l}){switch(super({iceParameters:e,iceCandidates:t,dtlsParameters:r}),this._mediaObject.mid=String(n),this._mediaObject.type=o,a?(this._mediaObject.connection={ip:a.ip,version:a.ipVersion},this._mediaObject.protocol="RTP/AVP",this._mediaObject.port=a.port):(this._mediaObject.connection={ip:"127.0.0.1",version:4},this._mediaObject.protocol=i?"UDP/DTLS/SCTP":"UDP/TLS/RTP/SAVPF",this._mediaObject.port=7),this._mediaObject.extmapAllowMixed="extmap-allow-mixed",o){case"audio":case"video":{this._mediaObject.direction="sendonly",this._mediaObject.rtp=[],this._mediaObject.rtcpFb=[],this._mediaObject.fmtp=[],this._mediaObject.msid=`${d??"-"} ${l}`;for(const i of c.codecs){const e={payload:i.payloadType,codec:s(i),rate:i.clockRate};i.channels>1&&(e.encoding=i.channels),this._mediaObject.rtp.push(e);const t={payload:i.payloadType,config:""};for(const r of Object.keys(i.parameters??{}))t.config&&(t.config+=";"),t.config+=`${r}=${i.parameters[r]}`;t.config&&this._mediaObject.fmtp.push(t);for(const r of i.rtcpFeedback)this._mediaObject.rtcpFb.push({payload:i.payloadType,type:r.type,subtype:r.parameter})}this._mediaObject.payloads=c.codecs.map(e=>e.payloadType).join(" "),this._mediaObject.ext=[];for(const s of c.headerExtensions)this._mediaObject.ext.push({uri:s.uri,value:s.id});this._mediaObject.rtcpMux="rtcp-mux",this._mediaObject.rtcpRsize="rtcp-rsize";const e=c.encodings[0],t=e.ssrc,r=e.rtx?.ssrc;this._mediaObject.ssrcs=[],this._mediaObject.ssrcGroups=[],t&&c.rtcp.cname&&this._mediaObject.ssrcs.push({id:t,attribute:"cname",value:c.rtcp.cname}),r&&(c.rtcp.cname&&this._mediaObject.ssrcs.push({id:r,attribute:"cname",value:c.rtcp.cname}),t&&this._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:`${t} ${r}`}));break}case"application":this._mediaObject.payloads="webrtc-datachannel",this._mediaObject.sctpPort=i.port,this._mediaObject.maxMessageSize=i.maxMessageSize}}setDtlsRole(e){this._mediaObject.setup="actpass"}resume(){this._mediaObject.direction="sendonly"}},Ne}(),s=["av1","h264"],i=new t.Logger("RemoteSdp");return Ae.RemoteSdp=class{_iceParameters;_iceCandidates;_dtlsParameters;_sctpParameters;_plainRtpParameters;_mediaSections=[];_midToIndex=new Map;_firstMid;_sdpObject;constructor({iceParameters:e,iceCandidates:t,dtlsParameters:r,sctpParameters:s,plainRtpParameters:i}){if(this._iceParameters=e,this._iceCandidates=t,this._dtlsParameters=r,this._sctpParameters=s,this._plainRtpParameters=i,this._sdpObject={version:0,origin:{address:"0.0.0.0",ipVer:4,netType:"IN",sessionId:"10000",sessionVersion:0,username:"mediasoup-client"},name:"-",timing:{start:0,stop:0},media:[]},e?.iceLite&&(this._sdpObject.icelite="ice-lite"),r){this._sdpObject.msidSemantic={semantic:"WMS",token:"*"};const e=this._dtlsParameters.fingerprints.length;this._sdpObject.fingerprint={type:r.fingerprints[e-1].algorithm,hash:r.fingerprints[e-1].value},this._sdpObject.groups=[{type:"BUNDLE",mids:""}]}i&&(this._sdpObject.origin.address=i.ip,this._sdpObject.origin.ipVer=i.ipVersion)}updateIceParameters(e){i.debug("updateIceParameters() [iceParameters:%o]",e),this._iceParameters=e,this._sdpObject.icelite=e.iceLite?"ice-lite":void 0;for(const t of this._mediaSections)t.setIceParameters(e)}updateDtlsRole(e){i.debug("updateDtlsRole() [role:%s]",e),this._dtlsParameters.role=e;for(const t of this._mediaSections)t.setDtlsRole(e)}setSessionExtmapAllowMixed(){i.debug("setSessionExtmapAllowMixed()"),this._sdpObject.extmapAllowMixed="extmap-allow-mixed"}getNextMediaSectionIdx(){for(let e=0;e<this._mediaSections.length;++e){const t=this._mediaSections[e];if(t.closed)return{idx:e,reuseMid:t.mid}}return{idx:this._mediaSections.length}}send({offerMediaObject:e,reuseMid:t,offerRtpParameters:i,answerRtpParameters:a,codecOptions:n}){const o=new r.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,offerMediaObject:e,offerRtpParameters:i,answerRtpParameters:a,codecOptions:n}),c=o.getObject();c.rtp.find(e=>s.includes(e.codec.toLowerCase()))||(c.ext=c.ext?.filter(e=>"https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension"!==e.uri)),t?this._replaceMediaSection(o,t):this._midToIndex.has(o.mid)?this._replaceMediaSection(o):this._addMediaSection(o)}receive({mid:e,kind:t,offerRtpParameters:s,streamId:i,trackId:a}){this.setSessionExtmapAllowMixed();const n=new r.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,mid:e,kind:t,offerRtpParameters:s,streamId:i,trackId:a}),o=this._mediaSections.find(e=>e.closed);o?this._replaceMediaSection(n,o.mid):this._addMediaSection(n)}pauseMediaSection(e){this._findMediaSection(e).pause()}resumeSendingMediaSection(e){this._findMediaSection(e).resume()}resumeReceivingMediaSection(e){this._findMediaSection(e).resume()}disableMediaSection(e){this._findMediaSection(e).disable()}closeMediaSection(e){const t=this._findMediaSection(e);return e===this._firstMid?(i.debug("closeMediaSection() | cannot close first media section, disabling it instead [mid:%s]",e),this.disableMediaSection(e),!1):(t.close(),this._regenerateBundleMids(),!0)}muxMediaSectionSimulcast(e,t){const r=this._findMediaSection(e);r.muxSimulcastStreams(t),this._replaceMediaSection(r)}sendSctpAssociation({offerMediaObject:e}){const t=new r.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,offerMediaObject:e});this._addMediaSection(t)}receiveSctpAssociation(){const e=new r.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,mid:"datachannel",kind:"application"});this._addMediaSection(e)}getSdp(){return this._sdpObject.origin.sessionVersion++,e.write(this._sdpObject)}_addMediaSection(e){this._firstMid||(this._firstMid=e.mid),this._mediaSections.push(e),this._midToIndex.set(e.mid,this._mediaSections.length-1),this._sdpObject.media.push(e.getObject()),this._regenerateBundleMids()}_replaceMediaSection(e,t){if("string"==typeof t){const r=this._midToIndex.get(t);if(void 0===r)throw new Error(`no media section found for reuseMid '${t}'`);const s=this._mediaSections[r];this._mediaSections[r]=e,this._midToIndex.delete(s.mid),this._midToIndex.set(e.mid,r),this._sdpObject.media[r]=e.getObject(),this._regenerateBundleMids()}else{const t=this._midToIndex.get(e.mid);if(void 0===t)throw new Error(`no media section found with mid '${e.mid}'`);this._mediaSections[t]=e,this._sdpObject.media[t]=e.getObject()}}_findMediaSection(e){const t=this._midToIndex.get(e);if(void 0===t)throw new Error(`no media section found with mid '${e}'`);return this._mediaSections[t]}_regenerateBundleMids(){this._dtlsParameters&&(this._sdpObject.groups[0].mids=this._mediaSections.filter(e=>!e.closed).map(e=>e.mid).join(" "))}},Ae}var Fe,Be={};var Ue,$e={};var Ve,qe={};var We,ze,He={};function Ge(){if(ze)return f;ze=1,Object.defineProperty(f,"__esModule",{value:!0}),f.Device=void 0,f.detectDevice=h,f.detectDeviceAsync=m;const e=g(),t=_(),r=k(),s=E(),i=D(),a=B(),n=ne(),o=function(){if(Oe)return ue;Oe=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.Chrome111=void 0;const e=_e(),t=k(),r=_(),s=B(),i=E(),a=Se(),n=ke(),o=Ee(),c=De(),d=je(),l=new r.Logger("Chrome111"),p="Chrome111",u={OS:1024,MIS:1024};let h=class r extends t.EnhancedEventEmitter{_closed=!1;_direction;_remoteSdp;_getSendExtendedRtpCapabilities;_forcedLocalDtlsRole;_pc;_mapMidTransceiver=new Map;_sendStream=new MediaStream;_hasDataChannelMediaSection=!1;_nextSendSctpStreamId=0;_transportReady=!1;static createFactory(){return{name:p,factory:e=>new r(e),getNativeRtpCapabilities:async()=>{l.debug("getNativeRtpCapabilities()");let t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});try{t.addTransceiver("audio"),t.addTransceiver("video",{sendEncodings:[{scalabilityMode:"L3T3"}]});const i=await t.createOffer();try{t.close()}catch(s){}t=void 0;const a=e.parse(i.sdp);return r.getLocalRtpCapabilities(a)}catch(s){try{t?.close()}catch(i){}throw t=void 0,s}},getNativeSctpCapabilities:async()=>(l.debug("getNativeSctpCapabilities()"),{numStreams:u})}}static getLocalRtpCapabilities(e){const t=n.extractRtpCapabilities({sdpObject:e});return s.validateAndNormalizeRtpCapabilities(t),c.addNackSupportForOpus(t),t}constructor({direction:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:n,additionalSettings:o,getSendExtendedRtpCapabilities:c}){super(),l.debug("constructor()"),this._direction=e,this._remoteSdp=new d.RemoteSdp({iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i}),this._getSendExtendedRtpCapabilities=c,s.role&&"auto"!==s.role&&(this._forcedLocalDtlsRole="server"===s.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a??[],iceTransportPolicy:n??"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o}),this._pc.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.addEventListener("icecandidateerror",this.onIceCandidateError),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",this.onConnectionStateChange):(l.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange))}get name(){return p}close(){if(l.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),super.close()}}async updateIceServers(e){this.assertNotClosed(),l.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(this.assertNotClosed(),l.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});l.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();l.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this.assertNotClosed(),this._pc.getStats()}async send({track:t,encodings:i,codecOptions:c,codec:d,onRtpSender:p}){if(this.assertNotClosed(),this.assertSendDirection(),l.debug("send() [kind:%s, track.id:%s]",t.kind,t.id),i&&i.length>1){let e=1;for(const t of i){const r=t.scalabilityMode?(0,a.parse)(t.scalabilityMode).temporalLayers:3;r>e&&(e=r)}i.forEach((t,r)=>{t.rid=`r${r}`,t.scalabilityMode=`L1T${e}`})}const u=this._remoteSdp.getNextMediaSectionIdx(),h=this._pc.addTransceiver(t,{direction:"sendonly",streams:[this._sendStream],sendEncodings:i});p&&p(h.sender);const m=await this._pc.createOffer();let f=e.parse(m.sdp);f.extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed();const g=r.getLocalRtpCapabilities(f),b=this._getSendExtendedRtpCapabilities(g),y=s.getSendingRtpParameters(t.kind,b);y.codecs=s.reduceCodecs(y.codecs,d);const _=s.getSendingRemoteRtpParameters(t.kind,b);_.codecs=s.reduceCodecs(_.codecs,d),this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:f}),l.debug("send() | calling pc.setLocalDescription() [offer:%o]",m),await this._pc.setLocalDescription(m);const v=h.mid;y.mid=v,f=e.parse(this._pc.localDescription.sdp);const w=f.media[u.idx];if(y.rtcp.cname=n.getCname({offerMediaObject:w}),i)if(1===i.length){const e=o.getRtpEncodings({offerMediaObject:w});Object.assign(e[0],i[0]),y.encodings=e}else y.encodings=i;else y.encodings=o.getRtpEncodings({offerMediaObject:w});this._remoteSdp.send({offerMediaObject:w,reuseMid:u.reuseMid,offerRtpParameters:y,answerRtpParameters:_,codecOptions:c});const S={type:"answer",sdp:this._remoteSdp.getSdp()};return l.debug("send() | calling pc.setRemoteDescription() [answer:%o]",S),await this._pc.setRemoteDescription(S),this._mapMidTransceiver.set(v,h),{localId:v,rtpParameters:y,rtpSender:h.sender}}async stopSending(e){if(this.assertSendDirection(),l.debug("stopSending() [localId:%s]",e),this._closed)return;const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");if(t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(i){}const r=await this._pc.createOffer();l.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const r=await this._pc.createOffer();l.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async resumeSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(this._remoteSdp.resumeSendingMediaSection(e),!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly";const r=await this._pc.createOffer();l.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async replaceTrack(e,t){this.assertNotClosed(),this.assertSendDirection(),t?l.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):l.debug("replaceTrack() [localId:%s, no track]",e);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");await r.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{e.active=r<=t}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{s.encodings[r]={...e,...t}}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertNotClosed(),this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:t,maxPacketLifeTime:r,maxRetransmits:s,label:i,protocol:a}){this.assertNotClosed(),this.assertSendDirection();const n={negotiated:!0,id:this._nextSendSctpStreamId,ordered:t,maxPacketLifeTime:r,maxRetransmits:s,protocol:a};l.debug("sendDataChannel() [options:%o]",n);const o=this._pc.createDataChannel(i,n);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%u.MIS,!this._hasDataChannelMediaSection){const t=await this._pc.createOffer(),r=e.parse(t.sdp),s=r.media.find(e=>"application"===e.type);this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:r}),l.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",t),await this._pc.setLocalDescription(t),this._remoteSdp.sendSctpAssociation({offerMediaObject:s});const i={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",i),await this._pc.setRemoteDescription(i),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:n.id,ordered:n.ordered,maxPacketLifeTime:n.maxPacketLifeTime,maxRetransmits:n.maxRetransmits}}}async receive(t){this.assertNotClosed(),this.assertRecvDirection();const r=[],s=new Map;for(const e of t){const{trackId:t,kind:r,rtpParameters:i,streamId:a}=e;l.debug("receive() [trackId:%s, kind:%s]",t,r);const n=i.mid??String(this._mapMidTransceiver.size);s.set(t,n),this._remoteSdp.receive({mid:n,kind:r,offerRtpParameters:i,streamId:a??i.rtcp.cname,trackId:t})}const i={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);for(const e of t){const{trackId:t,onRtpReceiver:r}=e;if(r){const e=s.get(t),i=this._pc.getTransceivers().find(t=>t.mid===e);if(!i)throw new Error("transceiver not found");r(i.receiver)}}let a=await this._pc.createAnswer();const o=e.parse(a.sdp);for(const e of t){const{trackId:t,rtpParameters:r}=e,i=s.get(t),a=o.media.find(e=>String(e.mid)===i);n.applyCodecParameters({offerRtpParameters:r,answerMediaObject:a})}a={type:"answer",sdp:e.write(o)},this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:o}),l.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const e of t){const{trackId:t}=e,i=s.get(t),a=this._pc.getTransceivers().find(e=>e.mid===i);if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(i,a),r.push({localId:i,track:a.receiver.track,rtpReceiver:a.receiver})}return r}async stopReceiving(e){if(this.assertRecvDirection(),this._closed)return;for(const s of e){l.debug("stopReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r);for(const s of e)this._mapMidTransceiver.delete(s)}async pauseReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("pauseReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async resumeReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("resumeReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this.assertNotClosed(),this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:t,label:r,protocol:s}){this.assertNotClosed(),this.assertRecvDirection();const{streamId:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o}=t,c={negotiated:!0,id:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o,protocol:s};l.debug("receiveDataChannel() [options:%o]",c);const d=this._pc.createDataChannel(r,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();if(!this._transportReady){const t=e.parse(r.sdp);await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:t})}l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setLocalDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:d}}async setupTransport({localDtlsRole:t,localSdpObject:r}){r||(r=e.parse(this._pc.localDescription.sdp));const s=n.extractDtlsParameters({sdpObject:r});s.role=t,this._remoteSdp.updateDtlsRole("client"===t?"server":"client"),await new Promise((e,t)=>{this.safeEmit("@connect",{dtlsParameters:s},e,t)}),this._transportReady=!0}onIceGatheringStateChange=()=>{this.emit("@icegatheringstatechange",this._pc.iceGatheringState)};onIceCandidateError=e=>{this.emit("@icecandidateerror",e)};onConnectionStateChange=()=>{this.emit("@connectionstatechange",this._pc.connectionState)};onIceConnectionStateChange=()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}};assertNotClosed(){if(this._closed)throw new i.InvalidStateError("method called in a closed handler")}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}};return ue.Chrome111=h,ue}(),c=function(){if(Fe)return Be;Fe=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.Chrome74=void 0;const e=_e(),t=_(),r=k(),s=B(),i=E(),a=Se(),n=ke(),o=Ee(),c=De(),d=je(),l=new t.Logger("Chrome74"),p="Chrome74",u={OS:1024,MIS:1024};let h=class t extends r.EnhancedEventEmitter{_closed=!1;_direction;_remoteSdp;_getSendExtendedRtpCapabilities;_forcedLocalDtlsRole;_pc;_mapMidTransceiver=new Map;_sendStream=new MediaStream;_hasDataChannelMediaSection=!1;_nextSendSctpStreamId=0;_transportReady=!1;static createFactory(){return{name:p,factory:e=>new t(e),getNativeRtpCapabilities:async()=>{l.debug("getNativeRtpCapabilities()");let r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});try{r.addTransceiver("audio"),r.addTransceiver("video");const i=await r.createOffer();try{r.close()}catch(s){}r=void 0;const a=e.parse(i.sdp);return t.getLocalRtpCapabilities(a)}catch(s){try{r?.close()}catch(i){}throw r=void 0,s}},getNativeSctpCapabilities:async()=>(l.debug("getNativeSctpCapabilities()"),{numStreams:u})}}static getLocalRtpCapabilities(e){const t=n.extractRtpCapabilities({sdpObject:e});return s.validateAndNormalizeRtpCapabilities(t),c.addNackSupportForOpus(t),t}constructor({direction:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:n,additionalSettings:o,getSendExtendedRtpCapabilities:c}){super(),l.debug("constructor()"),this._direction=e,this._remoteSdp=new d.RemoteSdp({iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i}),this._getSendExtendedRtpCapabilities=c,s.role&&"auto"!==s.role&&(this._forcedLocalDtlsRole="server"===s.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a??[],iceTransportPolicy:n??"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o}),this._pc.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.addEventListener("icecandidateerror",this.onIceCandidateError),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",this.onConnectionStateChange):(l.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange))}get name(){return p}close(){if(l.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),super.close()}}async updateIceServers(e){this.assertNotClosed(),l.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(this.assertNotClosed(),l.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});l.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();l.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this.assertNotClosed(),this._pc.getStats()}async send({track:r,encodings:i,codecOptions:c,codec:d}){this.assertNotClosed(),this.assertSendDirection(),l.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),i&&i.length>1&&i.forEach((e,t)=>{e.rid=`r${t}`});const p=this._remoteSdp.getNextMediaSectionIdx(),u=this._pc.addTransceiver(r,{direction:"sendonly",streams:[this._sendStream],sendEncodings:i});let h=await this._pc.createOffer(),m=e.parse(h.sdp);m.extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed();const f=t.getLocalRtpCapabilities(m),g=this._getSendExtendedRtpCapabilities(f),b=s.getSendingRtpParameters(r.kind,g);b.codecs=s.reduceCodecs(b.codecs,d);const y=s.getSendingRemoteRtpParameters(r.kind,g);y.codecs=s.reduceCodecs(y.codecs,d),this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:m});let _=!1;const v=(0,a.parse)((i??[{}])[0].scalabilityMode);let w;i&&1===i.length&&v.spatialLayers>1&&"video/vp9"===b.codecs[0].mimeType.toLowerCase()&&(l.debug("send() | enabling legacy simulcast for VP9 SVC"),_=!0,m=e.parse(h.sdp),w=m.media[p.idx],o.addLegacySimulcast({offerMediaObject:w,numStreams:v.spatialLayers}),h={type:"offer",sdp:e.write(m)}),l.debug("send() | calling pc.setLocalDescription() [offer:%o]",h),await this._pc.setLocalDescription(h);const S=u.mid;if(b.mid=S,m=e.parse(this._pc.localDescription.sdp),w=m.media[p.idx],b.rtcp.cname=n.getCname({offerMediaObject:w}),i)if(1===i.length){let e=o.getRtpEncodings({offerMediaObject:w});Object.assign(e[0],i[0]),_&&(e=[e[0]]),b.encodings=e}else b.encodings=i;else b.encodings=o.getRtpEncodings({offerMediaObject:w});if(b.encodings.length>1&&("video/vp8"===b.codecs[0].mimeType.toLowerCase()||"video/h264"===b.codecs[0].mimeType.toLowerCase()))for(const e of b.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${v.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:w,reuseMid:p.reuseMid,offerRtpParameters:b,answerRtpParameters:y,codecOptions:c});const C={type:"answer",sdp:this._remoteSdp.getSdp()};return l.debug("send() | calling pc.setRemoteDescription() [answer:%o]",C),await this._pc.setRemoteDescription(C),this._mapMidTransceiver.set(S,u),{localId:S,rtpParameters:b,rtpSender:u.sender}}async stopSending(e){if(this.assertSendDirection(),l.debug("stopSending() [localId:%s]",e),this._closed)return;const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");if(t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(i){}const r=await this._pc.createOffer();l.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const r=await this._pc.createOffer();l.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async resumeSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(this._remoteSdp.resumeSendingMediaSection(e),!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly";const r=await this._pc.createOffer();l.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async replaceTrack(e,t){this.assertNotClosed(),this.assertSendDirection(),t?l.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):l.debug("replaceTrack() [localId:%s, no track]",e);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");await r.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{e.active=r<=t}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{s.encodings[r]={...e,...t}}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertNotClosed(),this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:t,maxPacketLifeTime:r,maxRetransmits:s,label:i,protocol:a}){this.assertNotClosed(),this.assertSendDirection();const n={negotiated:!0,id:this._nextSendSctpStreamId,ordered:t,maxPacketLifeTime:r,maxRetransmits:s,protocol:a};l.debug("sendDataChannel() [options:%o]",n);const o=this._pc.createDataChannel(i,n);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%u.MIS,!this._hasDataChannelMediaSection){const t=await this._pc.createOffer(),r=e.parse(t.sdp),s=r.media.find(e=>"application"===e.type);this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:r}),l.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",t),await this._pc.setLocalDescription(t),this._remoteSdp.sendSctpAssociation({offerMediaObject:s});const i={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",i),await this._pc.setRemoteDescription(i),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:n.id,ordered:n.ordered,maxPacketLifeTime:n.maxPacketLifeTime,maxRetransmits:n.maxRetransmits}}}async receive(t){this.assertNotClosed(),this.assertRecvDirection();const r=[],s=new Map;for(const e of t){const{trackId:t,kind:r,rtpParameters:i,streamId:a}=e;l.debug("receive() [trackId:%s, kind:%s]",t,r);const n=i.mid??String(this._mapMidTransceiver.size);s.set(t,n),this._remoteSdp.receive({mid:n,kind:r,offerRtpParameters:i,streamId:a??i.rtcp.cname,trackId:t})}const i={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);let a=await this._pc.createAnswer();const o=e.parse(a.sdp);for(const e of t){const{trackId:t,rtpParameters:r}=e,i=s.get(t),a=o.media.find(e=>String(e.mid)===i);n.applyCodecParameters({offerRtpParameters:r,answerMediaObject:a})}a={type:"answer",sdp:e.write(o)},this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:o}),l.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const e of t){const{trackId:t}=e,i=s.get(t),a=this._pc.getTransceivers().find(e=>e.mid===i);if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(i,a),r.push({localId:i,track:a.receiver.track,rtpReceiver:a.receiver})}return r}async stopReceiving(e){if(this.assertRecvDirection(),this._closed)return;for(const s of e){l.debug("stopReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r);for(const s of e)this._mapMidTransceiver.delete(s)}async pauseReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("pauseReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async resumeReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("resumeReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this.assertNotClosed(),this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:t,label:r,protocol:s}){this.assertNotClosed(),this.assertRecvDirection();const{streamId:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o}=t,c={negotiated:!0,id:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o,protocol:s};l.debug("receiveDataChannel() [options:%o]",c);const d=this._pc.createDataChannel(r,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();if(!this._transportReady){const t=e.parse(r.sdp);await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:t})}l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setLocalDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:d}}async setupTransport({localDtlsRole:t,localSdpObject:r}){r||(r=e.parse(this._pc.localDescription.sdp));const s=n.extractDtlsParameters({sdpObject:r});s.role=t,this._remoteSdp.updateDtlsRole("client"===t?"server":"client"),await new Promise((e,t)=>{this.safeEmit("@connect",{dtlsParameters:s},e,t)}),this._transportReady=!0}onIceGatheringStateChange=()=>{this.emit("@icegatheringstatechange",this._pc.iceGatheringState)};onIceCandidateError=e=>{this.emit("@icecandidateerror",e)};onConnectionStateChange=()=>{this.emit("@connectionstatechange",this._pc.connectionState)};onIceConnectionStateChange=()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}};assertNotClosed(){if(this._closed)throw new i.InvalidStateError("method called in a closed handler")}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}};return Be.Chrome74=h,Be}(),d=function(){if(Ue)return $e;Ue=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.Firefox120=void 0;const e=_e(),t=k(),r=_(),s=E(),i=B(),a=Se(),n=ke(),o=Ee(),c=je(),d=new r.Logger("Firefox120"),l="Firefox120",p={OS:16,MIS:2048};let u=class r extends t.EnhancedEventEmitter{_closed=!1;_direction;_remoteSdp;_getSendExtendedRtpCapabilities;_pc;_mapMidTransceiver=new Map;_sendStream=new MediaStream;_hasDataChannelMediaSection=!1;_nextSendSctpStreamId=0;_transportReady=!1;static createFactory(){return{name:l,factory:e=>new r(e),getNativeRtpCapabilities:async()=>{d.debug("getNativeRtpCapabilities()");let t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});const s=document.createElement("canvas");s.getContext("2d");const i=s.captureStream().getVideoTracks()[0];try{t.addTransceiver("audio",{direction:"sendrecv"}),t.addTransceiver(i,{direction:"sendrecv",sendEncodings:[{rid:"r0",maxBitrate:1e5},{rid:"r1",maxBitrate:5e5}]});const n=await t.createOffer();try{s.remove()}catch(a){}try{i.stop()}catch(a){}try{t.close()}catch(a){}t=void 0;const o=e.parse(n.sdp);return r.getLocalRtpCapabilities(o)}catch(a){try{s.remove()}catch(n){}try{i.stop()}catch(n){}try{t?.close()}catch(n){}throw t=void 0,a}},getNativeSctpCapabilities:async()=>(d.debug("getNativeSctpCapabilities()"),{numStreams:p})}}static getLocalRtpCapabilities(e){const t=n.extractRtpCapabilities({sdpObject:e});return i.validateAndNormalizeRtpCapabilities(t),t}constructor({direction:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:n,additionalSettings:o,getSendExtendedRtpCapabilities:l}){super(),d.debug("constructor()"),this._direction=e,this._remoteSdp=new c.RemoteSdp({iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i}),this._getSendExtendedRtpCapabilities=l,this._pc=new RTCPeerConnection({iceServers:a??[],iceTransportPolicy:n??"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o}),this._pc.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.addEventListener("icecandidateerror",this.onIceCandidateError),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",this.onConnectionStateChange):(d.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange))}get name(){return l}close(){if(d.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),super.close()}}async updateIceServers(e){throw this.assertNotClosed(),new s.UnsupportedError("not supported")}async restartIce(e){if(this.assertNotClosed(),d.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});d.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};d.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};d.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();d.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this.assertNotClosed(),this._pc.getStats()}async send({track:t,encodings:s,codecOptions:c,codec:l,onRtpSender:p}){this.assertNotClosed(),this.assertSendDirection(),d.debug("send() [kind:%s, track.id:%s]",t.kind,t.id),s&&s.length>1&&s.forEach((e,t)=>{e.rid=`r${t}`});const u=this._pc.addTransceiver(t,{direction:"sendonly",streams:[this._sendStream],sendEncodings:s});p&&p(u.sender);const h=await this._pc.createOffer();let m=e.parse(h.sdp);m.extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed();const f=r.getLocalRtpCapabilities(m),g=this._getSendExtendedRtpCapabilities(f),b=i.getSendingRtpParameters(t.kind,g);b.codecs=i.reduceCodecs(b.codecs,l);const y=i.getSendingRemoteRtpParameters(t.kind,g);y.codecs=i.reduceCodecs(y.codecs,l),this._transportReady||await this.setupTransport({localDtlsRole:"client",localSdpObject:m});const _=(0,a.parse)((s??[{}])[0].scalabilityMode);d.debug("send() | calling pc.setLocalDescription() [offer:%o]",h),await this._pc.setLocalDescription(h);const v=u.mid;b.mid=v,m=e.parse(this._pc.localDescription.sdp);const w=m.media[m.media.length-1];if(b.rtcp.cname=n.getCname({offerMediaObject:w}),s)if(1===s.length){const e=o.getRtpEncodings({offerMediaObject:w});Object.assign(e[0],s[0]),b.encodings=e}else b.encodings=s;else b.encodings=o.getRtpEncodings({offerMediaObject:w});if(b.encodings.length>1&&("video/vp8"===b.codecs[0].mimeType.toLowerCase()||"video/h264"===b.codecs[0].mimeType.toLowerCase()))for(const e of b.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${_.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:w,offerRtpParameters:b,answerRtpParameters:y,codecOptions:c});const S={type:"answer",sdp:this._remoteSdp.getSdp()};return d.debug("send() | calling pc.setRemoteDescription() [answer:%o]",S),await this._pc.setRemoteDescription(S),this._mapMidTransceiver.set(v,u),{localId:v,rtpParameters:b,rtpSender:u.sender}}async stopSending(e){if(this.assertSendDirection(),d.debug("stopSending() [localId:%s]",e),this._closed)return;const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated transceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.disableMediaSection(t.mid);const r=await this._pc.createOffer();d.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};d.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertNotClosed(),this.assertSendDirection(),d.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const r=await this._pc.createOffer();d.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};d.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async resumeSending(e){this.assertNotClosed(),this.assertSendDirection(),d.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly",this._remoteSdp.resumeSendingMediaSection(e);const r=await this._pc.createOffer();d.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};d.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async replaceTrack(e,t){this.assertNotClosed(),this.assertSendDirection(),t?d.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):d.debug("replaceTrack() [localId:%s, no track]",e);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");await r.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertNotClosed(),this.assertSendDirection(),d.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated transceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{e.active=r<=t}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();d.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};d.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertNotClosed(),this.assertSendDirection(),d.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{s.encodings[r]={...e,...t}}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();d.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};d.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertNotClosed(),this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:t,maxPacketLifeTime:r,maxRetransmits:s,label:i,protocol:a}){this.assertNotClosed(),this.assertSendDirection();const n={negotiated:!0,id:this._nextSendSctpStreamId,ordered:t,maxPacketLifeTime:r,maxRetransmits:s,protocol:a};d.debug("sendDataChannel() [options:%o]",n);const o=this._pc.createDataChannel(i,n);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%p.MIS,!this._hasDataChannelMediaSection){const t=await this._pc.createOffer(),r=e.parse(t.sdp),s=r.media.find(e=>"application"===e.type);this._transportReady||await this.setupTransport({localDtlsRole:"client",localSdpObject:r}),d.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",t),await this._pc.setLocalDescription(t),this._remoteSdp.sendSctpAssociation({offerMediaObject:s});const i={type:"answer",sdp:this._remoteSdp.getSdp()};d.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",i),await this._pc.setRemoteDescription(i),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:n.id,ordered:n.ordered,maxPacketLifeTime:n.maxPacketLifeTime,maxRetransmits:n.maxRetransmits}}}async receive(t){this.assertNotClosed(),this.assertRecvDirection();const r=[],s=new Map;for(const e of t){const{trackId:t,kind:r,rtpParameters:i,streamId:a}=e;d.debug("receive() [trackId:%s, kind:%s]",t,r);const n=i.mid??String(this._mapMidTransceiver.size);s.set(t,n),this._remoteSdp.receive({mid:n,kind:r,offerRtpParameters:i,streamId:a??i.rtcp.cname,trackId:t})}const i={type:"offer",sdp:this._remoteSdp.getSdp()};d.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);for(const e of t){const{trackId:t,onRtpReceiver:r}=e;if(r){const e=s.get(t),i=this._pc.getTransceivers().find(t=>t.mid===e);if(!i)throw new Error("transceiver not found");r(i.receiver)}}let a=await this._pc.createAnswer();const o=e.parse(a.sdp);for(const c of t){const{trackId:t,rtpParameters:r}=c,i=s.get(t),d=o.media.find(e=>String(e.mid)===i);n.applyCodecParameters({offerRtpParameters:r,answerMediaObject:d}),a={type:"answer",sdp:e.write(o)}}this._transportReady||await this.setupTransport({localDtlsRole:"client",localSdpObject:o}),d.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const e of t){const{trackId:t}=e,i=s.get(t),a=this._pc.getTransceivers().find(e=>e.mid===i);if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(i,a),r.push({localId:i,track:a.receiver.track,rtpReceiver:a.receiver})}return r}async stopReceiving(e){if(this.assertRecvDirection(),this._closed)return;for(const s of e){d.debug("stopReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};d.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();d.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r);for(const s of e)this._mapMidTransceiver.delete(s)}async pauseReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){d.debug("pauseReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};d.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();d.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async resumeReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){d.debug("resumeReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};d.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();d.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:t,label:r,protocol:s}){this.assertNotClosed(),this.assertRecvDirection();const{streamId:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o}=t,c={negotiated:!0,id:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o,protocol:s};d.debug("receiveDataChannel() [options:%o]",c);const l=this._pc.createDataChannel(r,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const t={type:"offer",sdp:this._remoteSdp.getSdp()};d.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();if(!this._transportReady){const t=e.parse(r.sdp);await this.setupTransport({localDtlsRole:"client",localSdpObject:t})}d.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setLocalDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:l}}async setupTransport({localDtlsRole:t,localSdpObject:r}){r||(r=e.parse(this._pc.localDescription.sdp));const s=n.extractDtlsParameters({sdpObject:r});s.role=t,this._remoteSdp.updateDtlsRole("client"===t?"server":"client"),await new Promise((e,t)=>{this.safeEmit("@connect",{dtlsParameters:s},e,t)}),this._transportReady=!0}onIceGatheringStateChange=()=>{this.emit("@icegatheringstatechange",this._pc.iceGatheringState)};onIceCandidateError=e=>{this.emit("@icecandidateerror",e)};onConnectionStateChange=()=>{this.emit("@connectionstatechange",this._pc.connectionState)};onIceConnectionStateChange=()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}};assertNotClosed(){if(this._closed)throw new s.InvalidStateError("method called in a closed handler")}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}};return $e.Firefox120=u,$e}(),l=function(){if(Ve)return qe;Ve=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.Safari12=void 0;const e=_e(),t=k(),r=_(),s=B(),i=E(),a=Se(),n=je(),o=ke(),c=Ee(),d=De(),l=new r.Logger("Safari12"),p="Safari12",u={OS:1024,MIS:1024};let h=class r extends t.EnhancedEventEmitter{_closed=!1;_direction;_remoteSdp;_getSendExtendedRtpCapabilities;_forcedLocalDtlsRole;_pc;_mapMidTransceiver=new Map;_sendStream=new MediaStream;_hasDataChannelMediaSection=!1;_nextSendSctpStreamId=0;_transportReady=!1;static createFactory(){return{name:p,factory:e=>new r(e),getNativeRtpCapabilities:async()=>{l.debug("getNativeRtpCapabilities()");let t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});try{t.addTransceiver("audio"),t.addTransceiver("video");const i=await t.createOffer();try{t.close()}catch(s){}t=void 0;const a=e.parse(i.sdp);return r.getLocalRtpCapabilities(a)}catch(s){try{t?.close()}catch(i){}throw t=void 0,s}},getNativeSctpCapabilities:async()=>(l.debug("getNativeSctpCapabilities()"),{numStreams:u})}}static getLocalRtpCapabilities(e){const t=o.extractRtpCapabilities({sdpObject:e});return s.validateAndNormalizeRtpCapabilities(t),d.addNackSupportForOpus(t),t}constructor({direction:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:o,additionalSettings:c,getSendExtendedRtpCapabilities:d}){super(),l.debug("constructor()"),this._direction=e,this._remoteSdp=new n.RemoteSdp({iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i}),this._getSendExtendedRtpCapabilities=d,s.role&&"auto"!==s.role&&(this._forcedLocalDtlsRole="server"===s.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a??[],iceTransportPolicy:o??"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...c}),this._pc.addEventListener("icegatheringstatechange",()=>{this.emit("@icegatheringstatechange",this._pc.iceGatheringState)}),this._pc.addEventListener("icecandidateerror",e=>{this.emit("@icecandidateerror",e)}),this._pc.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.addEventListener("icecandidateerror",this.onIceCandidateError),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",this.onConnectionStateChange):(l.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange))}get name(){return p}close(){if(l.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),super.close()}}async updateIceServers(e){this.assertNotClosed(),l.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(this.assertNotClosed(),l.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});l.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();l.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this.assertNotClosed(),this._pc.getStats()}async send({track:t,encodings:i,codecOptions:n,codec:d,onRtpSender:p}){this.assertNotClosed(),this.assertSendDirection(),l.debug("send() [kind:%s, track.id:%s]",t.kind,t.id);const u=this._remoteSdp.getNextMediaSectionIdx(),h=this._pc.addTransceiver(t,{direction:"sendonly",streams:[this._sendStream]});p&&p(h.sender);let m=await this._pc.createOffer(),f=e.parse(m.sdp);f.extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed();const g=r.getLocalRtpCapabilities(f),b=this._getSendExtendedRtpCapabilities(g),y=s.getSendingRtpParameters(t.kind,b);y.codecs=s.reduceCodecs(y.codecs,d);const _=s.getSendingRemoteRtpParameters(t.kind,b);let v;_.codecs=s.reduceCodecs(_.codecs,d),this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:f});const w=(0,a.parse)((i??[{}])[0].scalabilityMode);i&&i.length>1&&(l.debug("send() | enabling legacy simulcast"),f=e.parse(m.sdp),v=f.media[u.idx],c.addLegacySimulcast({offerMediaObject:v,numStreams:i.length}),m={type:"offer",sdp:e.write(f)}),l.debug("send() | calling pc.setLocalDescription() [offer:%o]",m),await this._pc.setLocalDescription(m);const S=h.mid;if(y.mid=S,f=e.parse(this._pc.localDescription.sdp),v=f.media[u.idx],y.rtcp.cname=o.getCname({offerMediaObject:v}),y.encodings=c.getRtpEncodings({offerMediaObject:v}),i)for(let e=0;e<y.encodings.length;++e)i[e]&&Object.assign(y.encodings[e],i[e]);if(y.encodings.length>1&&("video/vp8"===y.codecs[0].mimeType.toLowerCase()||"video/h264"===y.codecs[0].mimeType.toLowerCase()))for(const e of y.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${w.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:v,reuseMid:u.reuseMid,offerRtpParameters:y,answerRtpParameters:_,codecOptions:n});const C={type:"answer",sdp:this._remoteSdp.getSdp()};return l.debug("send() | calling pc.setRemoteDescription() [answer:%o]",C),await this._pc.setRemoteDescription(C),this._mapMidTransceiver.set(S,h),{localId:S,rtpParameters:y,rtpSender:h.sender}}async stopSending(e){if(this.assertSendDirection(),this._closed)return;l.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");if(t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(i){}const r=await this._pc.createOffer();l.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const r=await this._pc.createOffer();l.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async resumeSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly",this._remoteSdp.resumeSendingMediaSection(e);const r=await this._pc.createOffer();l.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async replaceTrack(e,t){this.assertNotClosed(),this.assertSendDirection(),t?l.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):l.debug("replaceTrack() [localId:%s, no track]",e);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");await r.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{e.active=r<=t}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{s.encodings[r]={...e,...t}}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertNotClosed(),this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:t,maxPacketLifeTime:r,maxRetransmits:s,label:i,protocol:a}){this.assertNotClosed(),this.assertSendDirection();const n={negotiated:!0,id:this._nextSendSctpStreamId,ordered:t,maxPacketLifeTime:r,maxRetransmits:s,protocol:a};l.debug("sendDataChannel() [options:%o]",n);const o=this._pc.createDataChannel(i,n);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%u.MIS,!this._hasDataChannelMediaSection){const t=await this._pc.createOffer(),r=e.parse(t.sdp),s=r.media.find(e=>"application"===e.type);this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:r}),l.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",t),await this._pc.setLocalDescription(t),this._remoteSdp.sendSctpAssociation({offerMediaObject:s});const i={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",i),await this._pc.setRemoteDescription(i),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:n.id,ordered:n.ordered,maxPacketLifeTime:n.maxPacketLifeTime,maxRetransmits:n.maxRetransmits}}}async receive(t){this.assertNotClosed(),this.assertRecvDirection();const r=[],s=new Map;for(const e of t){const{trackId:t,kind:r,rtpParameters:i,streamId:a}=e;l.debug("receive() [trackId:%s, kind:%s]",t,r);const n=i.mid??String(this._mapMidTransceiver.size);s.set(t,n),this._remoteSdp.receive({mid:n,kind:r,offerRtpParameters:i,streamId:a??i.rtcp.cname,trackId:t})}const i={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);for(const e of t){const{trackId:t,onRtpReceiver:r}=e;if(r){const e=s.get(t),i=this._pc.getTransceivers().find(t=>t.mid===e);if(!i)throw new Error("transceiver not found");r(i.receiver)}}let a=await this._pc.createAnswer();const n=e.parse(a.sdp);for(const e of t){const{trackId:t,rtpParameters:r}=e,i=s.get(t),a=n.media.find(e=>String(e.mid)===i);o.applyCodecParameters({offerRtpParameters:r,answerMediaObject:a})}a={type:"answer",sdp:e.write(n)},this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:n}),l.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const e of t){const{trackId:t}=e,i=s.get(t),a=this._pc.getTransceivers().find(e=>e.mid===i);if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(i,a),r.push({localId:i,track:a.receiver.track,rtpReceiver:a.receiver})}return r}async stopReceiving(e){if(this.assertRecvDirection(),this._closed)return;for(const s of e){l.debug("stopReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r);for(const s of e)this._mapMidTransceiver.delete(s)}async pauseReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("pauseReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async resumeReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("resumeReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this.assertNotClosed(),this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:t,label:r,protocol:s}){this.assertNotClosed(),this.assertRecvDirection();const{streamId:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o}=t,c={negotiated:!0,id:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o,protocol:s};l.debug("receiveDataChannel() [options:%o]",c);const d=this._pc.createDataChannel(r,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();if(!this._transportReady){const t=e.parse(r.sdp);await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:t})}l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setLocalDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:d}}async setupTransport({localDtlsRole:t,localSdpObject:r}){r||(r=e.parse(this._pc.localDescription.sdp));const s=o.extractDtlsParameters({sdpObject:r});s.role=t,this._remoteSdp.updateDtlsRole("client"===t?"server":"client"),await new Promise((e,t)=>{this.safeEmit("@connect",{dtlsParameters:s},e,t)}),this._transportReady=!0}onIceGatheringStateChange=()=>{this.emit("@icegatheringstatechange",this._pc.iceGatheringState)};onIceCandidateError=e=>{this.emit("@icecandidateerror",e)};onConnectionStateChange=()=>{this.emit("@connectionstatechange",this._pc.connectionState)};onIceConnectionStateChange=()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}};assertNotClosed(){if(this._closed)throw new i.InvalidStateError("method called in a closed handler")}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}};return qe.Safari12=h,qe}(),p=function(){if(We)return He;We=1,Object.defineProperty(He,"__esModule",{value:!0}),He.ReactNative106=void 0;const e=_e(),t=k(),r=_(),s=B(),i=E(),a=Se(),n=je(),o=ke(),c=Ee(),d=De(),l=new r.Logger("ReactNative106"),p="ReactNative106",u={OS:1024,MIS:1024};let h=class r extends t.EnhancedEventEmitter{_closed=!1;_direction;_remoteSdp;_getSendExtendedRtpCapabilities;_forcedLocalDtlsRole;_pc;_mapMidTransceiver=new Map;_sendStream=new MediaStream;_hasDataChannelMediaSection=!1;_nextSendSctpStreamId=0;_transportReady=!1;static createFactory(){return{name:p,factory:e=>new r(e),getNativeRtpCapabilities:async()=>{l.debug("getNativeRtpCapabilities()");let t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});try{t.addTransceiver("audio"),t.addTransceiver("video");const i=await t.createOffer();try{t.close()}catch(s){}t=void 0;const a=e.parse(i.sdp);return r.getLocalRtpCapabilities(a)}catch(s){try{t?.close()}catch(i){}throw t=void 0,s}},getNativeSctpCapabilities:async()=>(l.debug("getNativeSctpCapabilities()"),{numStreams:u})}}static getLocalRtpCapabilities(e){const t=o.extractRtpCapabilities({sdpObject:e});return s.validateAndNormalizeRtpCapabilities(t),d.addNackSupportForOpus(t),t}constructor({direction:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:o,additionalSettings:c,getSendExtendedRtpCapabilities:d}){super(),l.debug("constructor()"),this._direction=e,this._remoteSdp=new n.RemoteSdp({iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i}),this._getSendExtendedRtpCapabilities=d,s.role&&"auto"!==s.role&&(this._forcedLocalDtlsRole="server"===s.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a??[],iceTransportPolicy:o??"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...c}),this._pc.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.addEventListener("icecandidateerror",this.onIceCandidateError),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",this.onConnectionStateChange):(l.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange))}get name(){return p}close(){if(l.debug("close()"),!this._closed){this._closed=!0,this._sendStream.release(!1);try{this._pc.close()}catch(e){}this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),super.close()}}async updateIceServers(e){this.assertNotClosed(),l.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(this.assertNotClosed(),l.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});l.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();l.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this.assertNotClosed(),this._pc.getStats()}async send({track:t,encodings:i,codecOptions:n,codec:d,onRtpSender:p}){this.assertNotClosed(),this.assertSendDirection(),l.debug("send() [kind:%s, track.id:%s]",t.kind,t.id),i&&i.length>1&&i.forEach((e,t)=>{e.rid=`r${t}`});const u=this._remoteSdp.getNextMediaSectionIdx(),h=this._pc.addTransceiver(t,{direction:"sendonly",streams:[this._sendStream],sendEncodings:i});p&&p(h.sender);let m=await this._pc.createOffer(),f=e.parse(m.sdp);f.extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed();const g=r.getLocalRtpCapabilities(f),b=this._getSendExtendedRtpCapabilities(g),y=s.getSendingRtpParameters(t.kind,b);y.codecs=s.reduceCodecs(y.codecs,d);const _=s.getSendingRemoteRtpParameters(t.kind,b);_.codecs=s.reduceCodecs(_.codecs,d),this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:f});let v=!1;const w=(0,a.parse)((i??[{}])[0].scalabilityMode);let S;i&&1===i.length&&w.spatialLayers>1&&"video/vp9"===y.codecs[0].mimeType.toLowerCase()&&(l.debug("send() | enabling legacy simulcast for VP9 SVC"),v=!0,f=e.parse(m.sdp),S=f.media[u.idx],c.addLegacySimulcast({offerMediaObject:S,numStreams:w.spatialLayers}),m={type:"offer",sdp:e.write(f)}),l.debug("send() | calling pc.setLocalDescription() [offer:%o]",m),await this._pc.setLocalDescription(m);let C=h.mid??void 0;if(C||l.warn("send() | missing transceiver.mid (bug in react-native-webrtc, using a workaround"),y.mid=C,f=e.parse(this._pc.localDescription.sdp),S=f.media[u.idx],y.rtcp.cname=o.getCname({offerMediaObject:S}),i)if(1===i.length){let e=c.getRtpEncodings({offerMediaObject:S});Object.assign(e[0],i[0]),v&&(e=[e[0]]),y.encodings=e}else y.encodings=i;else y.encodings=c.getRtpEncodings({offerMediaObject:S});if(y.encodings.length>1&&("video/vp8"===y.codecs[0].mimeType.toLowerCase()||"video/h264"===y.codecs[0].mimeType.toLowerCase()))for(const e of y.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${w.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:S,reuseMid:u.reuseMid,offerRtpParameters:y,answerRtpParameters:_,codecOptions:n});const P={type:"answer",sdp:this._remoteSdp.getSdp()};return l.debug("send() | calling pc.setRemoteDescription() [answer:%o]",P),await this._pc.setRemoteDescription(P),C||(C=h.mid,y.mid=C),this._mapMidTransceiver.set(C,h),{localId:C,rtpParameters:y,rtpSender:h.sender}}async stopSending(e){if(this.assertSendDirection(),this._closed)return;l.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");if(t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(i){}const r=await this._pc.createOffer();l.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const r=await this._pc.createOffer();l.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async resumeSending(e){this.assertNotClosed(),this.assertSendDirection(),l.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(this._remoteSdp.resumeSendingMediaSection(e),!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly";const r=await this._pc.createOffer();l.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r);const s={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",s),await this._pc.setRemoteDescription(s)}async replaceTrack(e,t){this.assertNotClosed(),this.assertSendDirection(),t?l.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):l.debug("replaceTrack() [localId:%s, no track]",e);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");await r.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{e.active=r<=t}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertNotClosed(),this.assertSendDirection(),l.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const r=this._mapMidTransceiver.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((e,r)=>{s.encodings[r]={...e,...t}}),await r.sender.setParameters(s),this._remoteSdp.muxMediaSectionSimulcast(e,s.encodings);const i=await this._pc.createOffer();l.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const a={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertNotClosed(),this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:t,maxPacketLifeTime:r,maxRetransmits:s,label:i,protocol:a}){this.assertNotClosed(),this.assertSendDirection();const n={negotiated:!0,id:this._nextSendSctpStreamId,ordered:t,maxPacketLifeTime:r,maxRetransmits:s,protocol:a};l.debug("sendDataChannel() [options:%o]",n);const o=this._pc.createDataChannel(i,n);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%u.MIS,!this._hasDataChannelMediaSection){const t=await this._pc.createOffer(),r=e.parse(t.sdp),s=r.media.find(e=>"application"===e.type);this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:r}),l.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",t),await this._pc.setLocalDescription(t),this._remoteSdp.sendSctpAssociation({offerMediaObject:s});const i={type:"answer",sdp:this._remoteSdp.getSdp()};l.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",i),await this._pc.setRemoteDescription(i),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:n.id,ordered:n.ordered,maxPacketLifeTime:n.maxPacketLifeTime,maxRetransmits:n.maxRetransmits}}}async receive(t){this.assertNotClosed(),this.assertRecvDirection();const r=[],s=new Map;for(const e of t){const{trackId:t,kind:r,rtpParameters:i,streamId:a}=e;l.debug("receive() [trackId:%s, kind:%s]",t,r);const n=i.mid??String(this._mapMidTransceiver.size);s.set(t,n),this._remoteSdp.receive({mid:n,kind:r,offerRtpParameters:i,streamId:a??i.rtcp.cname,trackId:t})}const i={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);for(const e of t){const{trackId:t,onRtpReceiver:r}=e;if(r){const e=s.get(t),i=this._pc.getTransceivers().find(t=>t.mid===e);if(!i)throw new Error("transceiver not found");r(i.receiver)}}let a=await this._pc.createAnswer();const n=e.parse(a.sdp);for(const e of t){const{trackId:t,rtpParameters:r}=e,i=s.get(t),a=n.media.find(e=>String(e.mid)===i);o.applyCodecParameters({offerRtpParameters:r,answerMediaObject:a})}a={type:"answer",sdp:e.write(n)},this._transportReady||await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:n}),l.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const e of t){const{trackId:t}=e,i=s.get(t),a=this._pc.getTransceivers().find(e=>e.mid===i);if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(i,a),r.push({localId:i,track:a.receiver.track,rtpReceiver:a.receiver})}return r}async stopReceiving(e){if(this.assertRecvDirection(),this._closed)return;for(const s of e){l.debug("stopReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r);for(const s of e)this._mapMidTransceiver.delete(s)}async pauseReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("pauseReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async resumeReceiving(e){this.assertNotClosed(),this.assertRecvDirection();for(const s of e){l.debug("resumeReceiving() [localId:%s]",s);const e=this._mapMidTransceiver.get(s);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(s)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();l.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this.assertNotClosed(),this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:t,label:r,protocol:s}){this.assertNotClosed(),this.assertRecvDirection();const{streamId:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o}=t,c={negotiated:!0,id:i,ordered:a,maxPacketLifeTime:n,maxRetransmits:o,protocol:s};l.debug("receiveDataChannel() [options:%o]",c);const d=this._pc.createDataChannel(r,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const t={type:"offer",sdp:this._remoteSdp.getSdp()};l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const r=await this._pc.createAnswer();if(!this._transportReady){const t=e.parse(r.sdp);await this.setupTransport({localDtlsRole:this._forcedLocalDtlsRole??"client",localSdpObject:t})}l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setLocalDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:d}}async setupTransport({localDtlsRole:t,localSdpObject:r}){r||(r=e.parse(this._pc.localDescription.sdp));const s=o.extractDtlsParameters({sdpObject:r});s.role=t,this._remoteSdp.updateDtlsRole("client"===t?"server":"client"),await new Promise((e,t)=>{this.safeEmit("@connect",{dtlsParameters:s},e,t)}),this._transportReady=!0}onIceGatheringStateChange=()=>{this.emit("@icegatheringstatechange",this._pc.iceGatheringState)};onIceCandidateError=e=>{this.emit("@icecandidateerror",e)};onConnectionStateChange=()=>{this.emit("@connectionstatechange",this._pc.connectionState)};onIceConnectionStateChange=()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}};assertNotClosed(){if(this._closed)throw new i.InvalidStateError("method called in a closed handler")}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}};return He.ReactNative106=h,He}(),u=new t.Logger("Device");function h(t){u.debug("detectDevice() [userAgent:%s]",t),t||"object"!=typeof navigator||(t=navigator.userAgent);return b(new e.default(t))}async function m(t){u.debug("detectDeviceAsync() [userAgent:%s]",t),t||"object"!=typeof navigator||(t=navigator.userAgent);return b(new e.default(t))}function b(t){if("object"==typeof navigator&&"ReactNative"===navigator.product)return u.debug("detectDeviceImpl() | React-Native detected"),"undefined"==typeof RTCPeerConnection||"undefined"==typeof RTCRtpTransceiver?void u.warn("detectDeviceImpl() | unsupported react-native-webrtc without RTCPeerConnection or RTCRtpTransceiver, forgot to call registerGlobals() on it?"):"ReactNative106";{const r=t.parseUserAgent(),s=/^\d+/.exec(r?.shortVersion??"0"),i=parseInt(s?.[0]??"0",10),a=r.platform===e.KnownPlatforms.iphone||r.platform===e.KnownPlatforms.ipad||r.platform===e.KnownPlatforms.mac&&(r.isMobile||r.isTablet||"object"==typeof navigator&&navigator?.maxTouchPoints>=2),n=r.isChrome,o=r.isFireFox,c=r.isSafari,d=r.isEdge,l=r.isDesktop&&r.name===e.KnownBrowsers.electron,p=r.isWebkit,h={browserMajorVersion:i,isIOS:a,isChrome:n,isFirefox:o,isSafari:c,isElectron:l,isWebkit:p};if(u.debug("detectDeviceImpl() | detected browser [userAgent:%s, parsed:%o, result:%o]",r.userAgent,r,h),(n||d)&&!a&&i>=111)return"Chrome111";if(n&&!a&&i>=74||d&&!a&&i>=88)return"Chrome74";if(l)return"Chrome111";if(o&&!a&&i>=120)return"Firefox120";if(c&&i>=12&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(a&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(p){const e=t.userAgent?.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);if(e){return Number(e[1])>=111?"Chrome111":"Chrome74"}return"Chrome111"}return void u.warn("detectDeviceImpl() | browser not supported [userAgent:%s, parsed:%o, result:%o]",r.userAgent,r,h)}}return f.Device=class e{_handlerFactory;_handlerName;_loaded=!1;_getSendExtendedRtpCapabilities;_recvRtpCapabilities;_canProduceByKind={audio:!1,video:!1};_sctpCapabilities;_observer=new r.EnhancedEventEmitter;static async factory({handlerName:t,handlerFactory:r}={}){if(u.debug("factory()"),t&&r)throw new TypeError("just one of handlerName or handlerInterface can be given");if(!t&&!r&&!(t=await m()))throw new s.UnsupportedError("device not supported");return new e({handlerName:t,handlerFactory:r})}constructor({handlerName:e,handlerFactory:t}={}){if(u.debug("constructor()"),e&&t)throw new TypeError("just one of handlerName or handlerInterface can be given");if(t)this._handlerFactory=t;else{if(e)u.debug("constructor() | handler given: %s",e);else{if(!(e=h()))throw new s.UnsupportedError("device not supported");u.debug("constructor() | detected handler: %s",e)}switch(e){case"Chrome111":this._handlerFactory=o.Chrome111.createFactory();break;case"Chrome74":this._handlerFactory=c.Chrome74.createFactory();break;case"Firefox120":this._handlerFactory=d.Firefox120.createFactory();break;case"Safari12":this._handlerFactory=l.Safari12.createFactory();break;case"ReactNative106":this._handlerFactory=p.ReactNative106.createFactory();break;default:throw new TypeError(`unknown handlerName "${e}"`)}}this._handlerName=this._handlerFactory.name}get handlerName(){return this._handlerName}get loaded(){return this._loaded}get rtpCapabilities(){if(!this._loaded)throw new s.InvalidStateError("not loaded");return this._recvRtpCapabilities}get sctpCapabilities(){if(!this._loaded)throw new s.InvalidStateError("not loaded");return this._sctpCapabilities}get observer(){return this._observer}async load({routerRtpCapabilities:e,preferLocalCodecsOrder:t=!1}){if(u.debug("load() [routerRtpCapabilities:%o]",e),this._loaded)throw new s.InvalidStateError("already loaded");const r=i.clone(e);a.validateAndNormalizeRtpCapabilities(r);const{getNativeRtpCapabilities:n,getNativeSctpCapabilities:o}=this._handlerFactory,c=i.clone(await n());a.validateAndNormalizeRtpCapabilities(c),u.debug("load() | got native RTP capabilities:%o",c),this._getSendExtendedRtpCapabilities=e=>i.clone(a.getExtendedRtpCapabilities(e,r,t));const d=a.getExtendedRtpCapabilities(c,r,!1);this._recvRtpCapabilities=a.getRecvRtpCapabilities(d),a.validateAndNormalizeRtpCapabilities(this._recvRtpCapabilities),u.debug("load() | got receiving RTP capabilities:%o",this._recvRtpCapabilities),this._canProduceByKind.audio=a.canSend("audio",this._recvRtpCapabilities),this._canProduceByKind.video=a.canSend("video",this._recvRtpCapabilities),this._sctpCapabilities=await o(),a.validateSctpCapabilities(this._sctpCapabilities),u.debug("load() | got native SCTP capabilities:%o",this._sctpCapabilities),u.debug("load() succeeded"),this._loaded=!0}canProduce(e){if(!this._loaded)throw new s.InvalidStateError("not loaded");if("audio"!==e&&"video"!==e)throw new TypeError(`invalid kind "${e}"`);return this._canProduceByKind[e]}createSendTransport({id:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:n,additionalSettings:o,appData:c}){return u.debug("createSendTransport()"),this.createTransport({direction:"send",id:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:n,additionalSettings:o,appData:c})}createRecvTransport({id:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:n,additionalSettings:o,appData:c}){return u.debug("createRecvTransport()"),this.createTransport({direction:"recv",id:e,iceParameters:t,iceCandidates:r,dtlsParameters:s,sctpParameters:i,iceServers:a,iceTransportPolicy:n,additionalSettings:o,appData:c})}createTransport({direction:e,id:t,iceParameters:r,iceCandidates:i,dtlsParameters:a,sctpParameters:o,iceServers:c,iceTransportPolicy:d,additionalSettings:l,appData:p}){if(!this._loaded)throw new s.InvalidStateError("not loaded");if("string"!=typeof t)throw new TypeError("missing id");if("object"!=typeof r)throw new TypeError("missing iceParameters");if(!Array.isArray(i))throw new TypeError("missing iceCandidates");if("object"!=typeof a)throw new TypeError("missing dtlsParameters");if(o&&"object"!=typeof o)throw new TypeError("wrong sctpParameters");if(p&&"object"!=typeof p)throw new TypeError("if given, appData must be an object");const u=new n.Transport({direction:e,id:t,iceParameters:r,iceCandidates:i,dtlsParameters:a,sctpParameters:o,iceServers:c,iceTransportPolicy:d,additionalSettings:l,appData:p,handlerFactory:this._handlerFactory,getSendExtendedRtpCapabilities:this._getSendExtendedRtpCapabilities,recvRtpCapabilities:this._recvRtpCapabilities,canProduceByKind:this._canProduceByKind});return this._observer.safeEmit("newtransport",u),u}},f}var Ke,Je={},Qe={},Xe={},Ye={};var Ze,et={};var tt,rt,st,it={},at={},nt={};function ot(){if(rt)return at;rt=1,Object.defineProperty(at,"__esModule",{value:!0});const e=(tt||(tt=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i),nt);return at.default=function(t){return"string"==typeof t&&e.default.test(t)},at}function ct(){if(st)return it;st=1,Object.defineProperty(it,"__esModule",{value:!0});const e=ot();return it.default=function(t){if(!(0,e.default)(t))throw TypeError("Invalid UUID");let r;return Uint8Array.of((r=parseInt(t.slice(0,8),16))>>>24,r>>>16&255,r>>>8&255,255&r,(r=parseInt(t.slice(9,13),16))>>>8,255&r,(r=parseInt(t.slice(14,18),16))>>>8,255&r,(r=parseInt(t.slice(19,23),16))>>>8,255&r,(r=parseInt(t.slice(24,36),16))/1099511627776&255,r/4294967296&255,r>>>24&255,r>>>16&255,r>>>8&255,255&r)},it}var dt,lt={};function pt(){if(dt)return lt;dt=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.unsafeStringify=void 0;const e=ot(),t=[];for(let s=0;s<256;++s)t.push((s+256).toString(16).slice(1));function r(e,r=0){return(t[e[r+0]]+t[e[r+1]]+t[e[r+2]]+t[e[r+3]]+"-"+t[e[r+4]]+t[e[r+5]]+"-"+t[e[r+6]]+t[e[r+7]]+"-"+t[e[r+8]]+t[e[r+9]]+"-"+t[e[r+10]]+t[e[r+11]]+t[e[r+12]]+t[e[r+13]]+t[e[r+14]]+t[e[r+15]]).toLowerCase()}return lt.unsafeStringify=r,lt.default=function(t,s=0){const i=r(t,s);if(!(0,e.default)(i))throw TypeError("Stringified UUID is invalid");return i},lt}var ut,ht,mt={},ft={};function gt(){if(ut)return ft;let e;ut=1,Object.defineProperty(ft,"__esModule",{value:!0});const t=new Uint8Array(16);return ft.default=function(){if(!e){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");e=crypto.getRandomValues.bind(crypto)}return e(t)},ft}function bt(){if(ht)return mt;ht=1,Object.defineProperty(mt,"__esModule",{value:!0}),mt.updateV1State=void 0;const e=gt(),t=pt(),r={};function s(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=16383&(r[8]<<8|r[9])),e.msecs=t,e}function i(e,t,r,s,i,a,n=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(a){if(n<0||n+16>a.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`)}else a=new Uint8Array(16),n=0;t??=Date.now(),r??=0,s??=16383&(e[8]<<8|e[9]),i??=e.slice(10,16);const o=(1e4*(268435455&(t+=122192928e5))+r)%4294967296;a[n++]=o>>>24&255,a[n++]=o>>>16&255,a[n++]=o>>>8&255,a[n++]=255&o;const c=t/4294967296*1e4&268435455;a[n++]=c>>>8&255,a[n++]=255&c,a[n++]=c>>>24&15|16,a[n++]=c>>>16&255,a[n++]=s>>>8|128,a[n++]=255&s;for(let d=0;d<6;++d)a[n++]=i[d];return a}return mt.updateV1State=s,mt.default=function(a,n,o){let c;const d=a?._v6??!1;if(a){const e=Object.keys(a);1===e.length&&"_v6"===e[0]&&(a=void 0)}if(a)c=i(a.random??a.rng?.()??(0,e.default)(),a.msecs,a.nsecs,a.clockseq,a.node,n,o);else{const t=Date.now(),a=(0,e.default)();s(r,t,a),c=i(a,r.msecs,r.nsecs,d?void 0:r.clockseq,d?void 0:r.node,n,o)}return n??(0,t.unsafeStringify)(c)},mt}var yt,_t={};function vt(){if(yt)return _t;yt=1,Object.defineProperty(_t,"__esModule",{value:!0});const e=ct(),t=pt();return _t.default=function(r){const s=function(e){return Uint8Array.of((15&e[6])<<4|e[7]>>4&15,(15&e[7])<<4|(240&e[4])>>4,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,(15&e[1])<<4|(240&e[2])>>4,96|15&e[2],e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof r?(0,e.default)(r):r);return"string"==typeof r?(0,t.unsafeStringify)(s):s},_t}var wt,St={},Ct={};function Pt(){if(wt)return Ct;function e(e){return 14+(e+64>>>9<<4)+1}function t(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(e,r,s,i,a,n){return t((o=t(t(r,e),t(i,n)))<<(c=a)|o>>>32-c,s);var o,c}function s(e,t,s,i,a,n,o){return r(t&s|~t&i,e,t,a,n,o)}function i(e,t,s,i,a,n,o){return r(t&i|s&~i,e,t,a,n,o)}function a(e,t,s,i,a,n,o){return r(t^s^i,e,t,a,n,o)}function n(e,t,s,i,a,n,o){return r(s^(t|~i),e,t,a,n,o)}return wt=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.default=function(r){return function(e){const t=new Uint8Array(4*e.length);for(let r=0;r<4*e.length;r++)t[r]=e[r>>2]>>>r%4*8&255;return t}(function(r,o){const c=new Uint32Array(e(o)).fill(0);c.set(r),c[o>>5]|=128<<o%32,c[c.length-1]=o,r=c;let d=1732584193,l=-271733879,p=-1732584194,u=271733878;for(let e=0;e<r.length;e+=16){const o=d,c=l,h=p,m=u;d=s(d,l,p,u,r[e],7,-680876936),u=s(u,d,l,p,r[e+1],12,-389564586),p=s(p,u,d,l,r[e+2],17,606105819),l=s(l,p,u,d,r[e+3],22,-1044525330),d=s(d,l,p,u,r[e+4],7,-176418897),u=s(u,d,l,p,r[e+5],12,1200080426),p=s(p,u,d,l,r[e+6],17,-1473231341),l=s(l,p,u,d,r[e+7],22,-45705983),d=s(d,l,p,u,r[e+8],7,1770035416),u=s(u,d,l,p,r[e+9],12,-1958414417),p=s(p,u,d,l,r[e+10],17,-42063),l=s(l,p,u,d,r[e+11],22,-1990404162),d=s(d,l,p,u,r[e+12],7,1804603682),u=s(u,d,l,p,r[e+13],12,-40341101),p=s(p,u,d,l,r[e+14],17,-1502002290),l=s(l,p,u,d,r[e+15],22,1236535329),d=i(d,l,p,u,r[e+1],5,-165796510),u=i(u,d,l,p,r[e+6],9,-1069501632),p=i(p,u,d,l,r[e+11],14,643717713),l=i(l,p,u,d,r[e],20,-373897302),d=i(d,l,p,u,r[e+5],5,-701558691),u=i(u,d,l,p,r[e+10],9,38016083),p=i(p,u,d,l,r[e+15],14,-660478335),l=i(l,p,u,d,r[e+4],20,-405537848),d=i(d,l,p,u,r[e+9],5,568446438),u=i(u,d,l,p,r[e+14],9,-1019803690),p=i(p,u,d,l,r[e+3],14,-187363961),l=i(l,p,u,d,r[e+8],20,1163531501),d=i(d,l,p,u,r[e+13],5,-1444681467),u=i(u,d,l,p,r[e+2],9,-51403784),p=i(p,u,d,l,r[e+7],14,1735328473),l=i(l,p,u,d,r[e+12],20,-1926607734),d=a(d,l,p,u,r[e+5],4,-378558),u=a(u,d,l,p,r[e+8],11,-2022574463),p=a(p,u,d,l,r[e+11],16,1839030562),l=a(l,p,u,d,r[e+14],23,-35309556),d=a(d,l,p,u,r[e+1],4,-1530992060),u=a(u,d,l,p,r[e+4],11,1272893353),p=a(p,u,d,l,r[e+7],16,-155497632),l=a(l,p,u,d,r[e+10],23,-1094730640),d=a(d,l,p,u,r[e+13],4,681279174),u=a(u,d,l,p,r[e],11,-358537222),p=a(p,u,d,l,r[e+3],16,-722521979),l=a(l,p,u,d,r[e+6],23,76029189),d=a(d,l,p,u,r[e+9],4,-640364487),u=a(u,d,l,p,r[e+12],11,-421815835),p=a(p,u,d,l,r[e+15],16,530742520),l=a(l,p,u,d,r[e+2],23,-995338651),d=n(d,l,p,u,r[e],6,-198630844),u=n(u,d,l,p,r[e+7],10,1126891415),p=n(p,u,d,l,r[e+14],15,-1416354905),l=n(l,p,u,d,r[e+5],21,-57434055),d=n(d,l,p,u,r[e+12],6,1700485571),u=n(u,d,l,p,r[e+3],10,-1894986606),p=n(p,u,d,l,r[e+10],15,-1051523),l=n(l,p,u,d,r[e+1],21,-2054922799),d=n(d,l,p,u,r[e+8],6,1873313359),u=n(u,d,l,p,r[e+15],10,-30611744),p=n(p,u,d,l,r[e+6],15,-1560198380),l=n(l,p,u,d,r[e+13],21,1309151649),d=n(d,l,p,u,r[e+4],6,-145523070),u=n(u,d,l,p,r[e+11],10,-1120210379),p=n(p,u,d,l,r[e+2],15,718787259),l=n(l,p,u,d,r[e+9],21,-343485551),d=t(d,o),l=t(l,c),p=t(p,h),u=t(u,m)}return Uint32Array.of(d,l,p,u)}(function(t){if(0===t.length)return new Uint32Array;const r=new Uint32Array(e(8*t.length)).fill(0);for(let e=0;e<t.length;e++)r[e>>2]|=(255&t[e])<<e%4*8;return r}(r),8*r.length))},Ct}var kt,Rt,Tt={};function Et(){if(kt)return Tt;kt=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.URL=Tt.DNS=Tt.stringToBytes=void 0;const e=ct(),t=pt();function r(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}return Tt.stringToBytes=r,Tt.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Tt.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",Tt.default=function(s,i,a,n,o,c){const d="string"==typeof a?r(a):a,l="string"==typeof n?(0,e.default)(n):n;if("string"==typeof n&&(n=(0,e.default)(n)),16!==n?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let p=new Uint8Array(16+d.length);if(p.set(l),p.set(d,l.length),p=i(p),p[6]=15&p[6]|s,p[8]=63&p[8]|128,o){c=c||0;for(let e=0;e<16;++e)o[c+e]=p[e];return o}return(0,t.unsafeStringify)(p)},Tt}var It,xt,Dt={},Mt={};function Lt(){if(xt)return Dt;xt=1,Object.defineProperty(Dt,"__esModule",{value:!0});const e=function(){if(It)return Mt;It=1,Object.defineProperty(Mt,"__esModule",{value:!0});const e="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);return Mt.default={randomUUID:e},Mt}(),t=gt(),r=pt();return Dt.default=function(s,i,a){if(e.default.randomUUID&&!i&&!s)return e.default.randomUUID();const n=(s=s||{}).random??s.rng?.()??(0,t.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,i){if((a=a||0)<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[a+e]=n[e];return i}return(0,r.unsafeStringify)(n)},Dt}var Ot,At,Nt={},jt={};function Ft(){return At||(At=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.URL=e.DNS=void 0;const t=function(){if(Ot)return jt;function e(e,t,r,s){switch(e){case 0:return t&r^~t&s;case 1:case 3:return t^r^s;case 2:return t&r^t&s^r&s}}function t(e,t){return e<<t|e>>>32-t}return Ot=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.default=function(r){const s=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520],a=new Uint8Array(r.length+1);a.set(r),a[r.length]=128;const n=(r=a).length/4+2,o=Math.ceil(n/16),c=new Array(o);for(let e=0;e<o;++e){const t=new Uint32Array(16);for(let s=0;s<16;++s)t[s]=r[64*e+4*s]<<24|r[64*e+4*s+1]<<16|r[64*e+4*s+2]<<8|r[64*e+4*s+3];c[e]=t}c[o-1][14]=8*(r.length-1)/Math.pow(2,32),c[o-1][14]=Math.floor(c[o-1][14]),c[o-1][15]=8*(r.length-1)&4294967295;for(let d=0;d<o;++d){const r=new Uint32Array(80);for(let e=0;e<16;++e)r[e]=c[d][e];for(let e=16;e<80;++e)r[e]=t(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let a=i[0],n=i[1],o=i[2],l=i[3],p=i[4];for(let i=0;i<80;++i){const c=Math.floor(i/20),d=t(a,5)+e(c,n,o,l)+p+s[c]+r[i]>>>0;p=l,l=o,o=t(n,30)>>>0,n=a,a=d}i[0]=i[0]+a>>>0,i[1]=i[1]+n>>>0,i[2]=i[2]+o>>>0,i[3]=i[3]+l>>>0,i[4]=i[4]+p>>>0}return Uint8Array.of(i[0]>>24,i[0]>>16,i[0]>>8,i[0],i[1]>>24,i[1]>>16,i[1]>>8,i[1],i[2]>>24,i[2]>>16,i[2]>>8,i[2],i[3]>>24,i[3]>>16,i[3]>>8,i[3],i[4]>>24,i[4]>>16,i[4]>>8,i[4])},jt}(),r=Et();var s=Et();function i(e,s,i,a){return(0,r.default)(80,t.default,e,s,i,a)}Object.defineProperty(e,"DNS",{enumerable:!0,get:function(){return s.DNS}}),Object.defineProperty(e,"URL",{enumerable:!0,get:function(){return s.URL}}),i.DNS=r.DNS,i.URL=r.URL,e.default=i}(Nt)),Nt}var Bt,Ut={};var $t,Vt={};function qt(){if($t)return Vt;$t=1,Object.defineProperty(Vt,"__esModule",{value:!0});const e=ct(),t=pt();return Vt.default=function(r){const s=function(e){return Uint8Array.of((15&e[3])<<4|e[4]>>4&15,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|15&e[6],e[7],(15&e[1])<<4|(240&e[2])>>4,(15&e[2])<<4|(240&e[3])>>4,16|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof r?(0,e.default)(r):r);return"string"==typeof r?(0,t.unsafeStringify)(s):s},Vt}var Wt,zt={};var Ht,Gt,Kt={};function Jt(){return Gt||(Gt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.validate=e.v7=e.v6ToV1=e.v6=e.v5=e.v4=e.v3=e.v1ToV6=e.v1=e.stringify=e.parse=e.NIL=e.MAX=void 0;var t=(Ke||(Ke=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.default="ffffffff-ffff-ffff-ffff-ffffffffffff"),Ye);Object.defineProperty(e,"MAX",{enumerable:!0,get:function(){return t.default}});var r=(Ze||(Ze=1,Object.defineProperty(et,"__esModule",{value:!0}),et.default="00000000-0000-0000-0000-000000000000"),et);Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return r.default}});var s=ct();Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return s.default}});var i=pt();Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return i.default}});var a=bt();Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return a.default}});var n=vt();Object.defineProperty(e,"v1ToV6",{enumerable:!0,get:function(){return n.default}});var o=(Rt||(Rt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.URL=e.DNS=void 0;const t=Pt(),r=Et();var s=Et();function i(e,s,i,a){return(0,r.default)(48,t.default,e,s,i,a)}Object.defineProperty(e,"DNS",{enumerable:!0,get:function(){return s.DNS}}),Object.defineProperty(e,"URL",{enumerable:!0,get:function(){return s.URL}}),i.DNS=r.DNS,i.URL=r.URL,e.default=i}(St)),St);Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return o.default}});var c=Lt();Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return c.default}});var d=Ft();Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return d.default}});var l=function(){if(Bt)return Ut;Bt=1,Object.defineProperty(Ut,"__esModule",{value:!0});const e=pt(),t=bt(),r=vt();return Ut.default=function(s,i,a){s??={},a??=0;let n=(0,t.default)({...s,_v6:!0},new Uint8Array(16));if(n=(0,r.default)(n),i){for(let e=0;e<16;e++)i[a+e]=n[e];return i}return(0,e.unsafeStringify)(n)},Ut}();Object.defineProperty(e,"v6",{enumerable:!0,get:function(){return l.default}});var p=qt();Object.defineProperty(e,"v6ToV1",{enumerable:!0,get:function(){return p.default}});var u=function(){if(Wt)return zt;Wt=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.updateV7State=void 0;const e=gt(),t=pt(),r={};function s(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++),e}function i(e,t,r,s,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(s){if(i<0||i+16>s.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else s=new Uint8Array(16),i=0;return t??=Date.now(),r??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],s[i++]=t/1099511627776&255,s[i++]=t/4294967296&255,s[i++]=t/16777216&255,s[i++]=t/65536&255,s[i++]=t/256&255,s[i++]=255&t,s[i++]=112|r>>>28&15,s[i++]=r>>>20&255,s[i++]=128|r>>>14&63,s[i++]=r>>>6&255,s[i++]=r<<2&255|3&e[10],s[i++]=e[11],s[i++]=e[12],s[i++]=e[13],s[i++]=e[14],s[i++]=e[15],s}return zt.updateV7State=s,zt.default=function(a,n,o){let c;if(a)c=i(a.random??a.rng?.()??(0,e.default)(),a.msecs,a.seq,n,o);else{const t=Date.now(),a=(0,e.default)();s(r,t,a),c=i(a,r.msecs,r.seq,n,o)}return n??(0,t.unsafeStringify)(c)},zt}();Object.defineProperty(e,"v7",{enumerable:!0,get:function(){return u.default}});var h=ot();Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return h.default}});var m=function(){if(Ht)return Kt;Ht=1,Object.defineProperty(Kt,"__esModule",{value:!0});const e=ot();return Kt.default=function(t){if(!(0,e.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)},Kt}();Object.defineProperty(e,"version",{enumerable:!0,get:function(){return m.default}})}(Xe)),Xe}var Qt,Xt={};var Yt,Zt={};var er,tr,rr={};function sr(){if(tr)return Qe;tr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.FakeMediaStreamTrack=void 0;const e=Jt(),t=(Qt||(Qt=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.FakeEventTarget=void 0,Xt.FakeEventTarget=class{listeners={};addEventListener(e,t,r){t&&(this.listeners[e]??=[],this.listeners[e].push({callback:"function"==typeof t?t:t.handleEvent,once:"object"==typeof r&&!0===r.once}))}removeEventListener(e,t,r){this.listeners[e]&&t&&(this.listeners[e]=this.listeners[e].filter(e=>e.callback!==("function"==typeof t?t:t.handleEvent)))}dispatchEvent(e){if(!e||"string"!=typeof e.type)throw new Error("invalid event object");const t=this.listeners[e.type];if(!t)return!0;for(const s of[...t]){try{s.callback.call(this,e)}catch(r){setTimeout(()=>{throw r},0)}s.once&&this.removeEventListener(e.type,s.callback)}return!e.defaultPrevented}}),Xt),r=(Yt||(Yt=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.FakeEvent=void 0,Zt.FakeEvent=class{NONE=0;CAPTURING_PHASE=1;AT_TARGET=2;BUBBLING_PHASE=3;type;bubbles;cancelable;defaultPrevented=!1;composed=!1;currentTarget=null;eventPhase=this.NONE;isTrusted=!0;target=null;timeStamp=0;cancelBubble=!1;returnValue=!0;srcElement=null;constructor(e,t={}){this.type=e,this.bubbles=t.bubbles??!1,this.cancelable=t.cancelable??!1}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}stopPropagation(){}stopImmediatePropagation(){}composedPath(){return[]}initEvent(e,t,r){}}),Zt),s=(er||(er=1,Object.defineProperty(rr,"__esModule",{value:!0}),rr.clone=function(e){return void 0===e?void 0:Number.isNaN(e)?NaN:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}),rr);class i extends t.FakeEventTarget{#e;#t;#r;#s;#i;#a;#n;#o;#c;#d;#l;#p=null;#u=null;#h=null;#m=null;#f=null;constructor({kind:t,id:r,label:s,contentHint:i,enabled:a,muted:n,readyState:o,capabilities:c,constraints:d,settings:l,data:p}){super(),this.#e=r??(0,e.v4)(),this.#t=t,this.#r=s??"",this.#n=i??"",this.#i=a??!0,this.#a=n??!1,this.#s=o??"live",this.#o=c??{},this.#c=d??{},this.#d=l??{},this.#l=p??{}}get id(){return this.#e}get kind(){return this.#t}get label(){return this.#r}get contentHint(){return this.#n}set contentHint(e){this.#n=e}get enabled(){return this.#i}set enabled(e){const t=this.#i!==e;this.#i=e,t&&this.dispatchEvent(new r.FakeEvent("enabledchange"))}get muted(){return this.#a}get readyState(){return this.#s}get data(){return this.#l}set data(e){this.#l=e}get onmute(){return this.#p}set onmute(e){this.#p&&this.removeEventListener("mute",this.#p),this.#p=e,e&&this.addEventListener("mute",e)}get onunmute(){return this.#u}set onunmute(e){this.#u&&this.removeEventListener("unmute",this.#u),this.#u=e,e&&this.addEventListener("unmute",e)}get onended(){return this.#h}set onended(e){this.#h&&this.removeEventListener("ended",this.#h),this.#h=e,e&&this.addEventListener("ended",e)}get onenabledchange(){return this.#m}set onenabledchange(e){this.#m&&this.removeEventListener("enabledchange",this.#m),this.#m=e,e&&this.addEventListener("enabledchange",e)}get onstopped(){return this.#f}set onstopped(e){this.#f&&this.removeEventListener("stopped",this.#f),this.#f=e,e&&this.addEventListener("stopped",e)}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}stop(){"ended"!==this.#s&&(this.#s="ended",this.dispatchEvent(new r.FakeEvent("stopped")))}clone({id:t,data:r}={}){return new i({id:t??(0,e.v4)(),kind:this.#t,label:this.#r,contentHint:this.#n,enabled:this.#i,muted:this.#a,readyState:this.#s,capabilities:(0,s.clone)(this.#o),constraints:(0,s.clone)(this.#c),settings:(0,s.clone)(this.#d),data:r??(0,s.clone)(this.#l)})}getCapabilities(){return this.#o}getConstraints(){return this.#c}async applyConstraints(e={}){return this.#c=e,Promise.resolve()}getSettings(){return this.#d}remoteStop(){"ended"!==this.#s&&(this.#s="ended",this.dispatchEvent(new r.FakeEvent("stopped")),this.dispatchEvent(new r.FakeEvent("ended")))}remoteMute(){this.#a||(this.#a=!0,this.dispatchEvent(new r.FakeEvent("mute")))}remoteUnmute(){this.#a&&(this.#a=!1,this.dispatchEvent(new r.FakeEvent("unmute")))}}return Qe.FakeMediaStreamTrack=i,Qe}var ir,ar,nr={};function or(){if(ar)return Je;ar=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.FakeHandler=void 0;const e=sr(),t=k(),r=_(),s=D(),i=B(),a=E(),n=(ir||(ir=1,Object.defineProperty(nr,"__esModule",{value:!0}),nr.FakeEventTarget=void 0,nr.FakeEventTarget=class{listeners={};addEventListener(e,t,r){t&&(this.listeners[e]??=[],this.listeners[e].push({callback:"function"==typeof t?t:t.handleEvent,once:"object"==typeof r&&!0===r.once}))}removeEventListener(e,t,r){this.listeners[e]&&t&&(this.listeners[e]=this.listeners[e].filter(e=>e.callback!==("function"==typeof t?t:t.handleEvent)))}dispatchEvent(e){if(!e||"string"!=typeof e.type)throw new Error("invalid event object");const t=this.listeners[e.type];if(!t)return!0;for(const s of[...t]){try{s.callback.call(this,e)}catch(r){setTimeout(()=>{throw r},0)}s.once&&this.removeEventListener(e.type,s.callback)}return!e.defaultPrevented}}),nr),o=new r.Logger("FakeHandler"),c="FakeHandler";let d=class r extends t.EnhancedEventEmitter{_closed=!1;_fakeParameters;_getSendExtendedRtpCapabilities;_cname=`CNAME-${s.generateRandomNumber()}`;_transportReady=!1;_nextLocalId=1;_tracks=new Map;_nextSctpStreamId=0;static createFactory(e){return{name:c,factory:t=>new r(t,e),getNativeRtpCapabilities:async()=>(o.debug("getNativeRtpCapabilities()"),r.getLocalRtpCapabilities(e)),getNativeSctpCapabilities:async()=>(o.debug("getNativeSctpCapabilities()"),e.generateNativeSctpCapabilities())}}static getLocalRtpCapabilities(e){const t=e.generateNativeRtpCapabilities();return i.validateAndNormalizeRtpCapabilities(t),t}constructor({getSendExtendedRtpCapabilities:e},t){super(),o.debug("constructor()"),this._getSendExtendedRtpCapabilities=e,this._fakeParameters=t}get name(){return c}close(){o.debug("close()"),this._closed||(this._closed=!0,super.close())}setIceGatheringState(e){this.emit("@icegatheringstatechange",e)}setConnectionState(e){this.emit("@connectionstatechange",e)}async updateIceServers(e){this.assertNotClosed(),o.debug("updateIceServers()")}async restartIce(e){this.assertNotClosed(),o.debug("restartIce()")}async getTransportStats(){return this.assertNotClosed(),new Map}async send({track:e,encodings:t,codecOptions:a,codec:n}){this.assertNotClosed(),o.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),this._transportReady||await this.setupTransport({localDtlsRole:"server"});const c=r.getLocalRtpCapabilities(this._fakeParameters),d=this._getSendExtendedRtpCapabilities(c),l=i.getSendingRtpParameters(e.kind,d);l.codecs=i.reduceCodecs(l.codecs,n);const p=l.codecs.some(e=>/.+\/rtx$/i.test(e.mimeType));l.mid=`mid-${s.generateRandomNumber()}`,t||(t=[{}]);for(const r of t)r.ssrc=s.generateRandomNumber(),p&&(r.rtx={ssrc:s.generateRandomNumber()});l.encodings=t,l.rtcp={cname:this._cname,reducedSize:!0,mux:!0};const u=this._nextLocalId++;return this._tracks.set(u,e),{localId:String(u),rtpParameters:l}}async stopSending(e){if(o.debug("stopSending() [localId:%s]",e),!this._closed){if(!this._tracks.has(Number(e)))throw new Error("local track not found");this._tracks.delete(Number(e))}}async pauseSending(e){this.assertNotClosed()}async resumeSending(e){this.assertNotClosed()}async replaceTrack(e,t){this.assertNotClosed(),t?o.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):o.debug("replaceTrack() [localId:%s, no track]",e),this._tracks.delete(Number(e)),this._tracks.set(Number(e),t)}async setMaxSpatialLayer(e,t){this.assertNotClosed(),o.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t)}async setRtpEncodingParameters(e,t){this.assertNotClosed(),o.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t)}async getSenderStats(e){return this.assertNotClosed(),new Map}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:r,label:s,protocol:i}){this.assertNotClosed(),this._transportReady||await this.setupTransport({localDtlsRole:"server"}),o.debug("sendDataChannel()");return{dataChannel:new l({id:this._nextSctpStreamId++,ordered:e,maxPacketLifeTime:t,maxRetransmits:r,label:s,protocol:i}),sctpStreamParameters:{streamId:this._nextSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:r}}}async receive(t){this.assertNotClosed();const r=[];for(const s of t){const{trackId:t,kind:i}=s;this._transportReady||await this.setupTransport({localDtlsRole:"client"}),o.debug("receive() [trackId:%s, kind:%s]",t,i);const a=this._nextLocalId++,n=new e.FakeMediaStreamTrack({kind:i});this._tracks.set(a,n),r.push({localId:String(a),track:n})}return r}async stopReceiving(e){if(!this._closed)for(const t of e)o.debug("stopReceiving() [localId:%s]",t),this._tracks.delete(Number(t))}async pauseReceiving(e){this.assertNotClosed()}async resumeReceiving(e){this.assertNotClosed()}async getReceiverStats(e){return this.assertNotClosed(),new Map}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:r}){this.assertNotClosed(),this._transportReady||await this.setupTransport({localDtlsRole:"client"}),o.debug("receiveDataChannel()");return{dataChannel:new l({id:e.streamId,ordered:e.ordered,maxPacketLifeTime:e.maxPacketLifeTime,maxRetransmits:e.maxRetransmits,label:t,protocol:r})}}async setupTransport({localDtlsRole:e,localSdpObject:t}){const r=s.clone(this._fakeParameters.generateLocalDtlsParameters());e&&(r.role=e),this.emit("@connectionstatechange","connecting"),await new Promise((e,t)=>this.emit("@connect",{dtlsParameters:r},e,t)),this._transportReady=!0}assertNotClosed(){if(this._closed)throw new a.InvalidStateError("method called in a closed handler")}};Je.FakeHandler=d;class l extends n.FakeEventTarget{_id;_negotiated=!0;_ordered;_maxPacketLifeTime;_maxRetransmits;_label;_protocol;_readyState="connecting";_bufferedAmount=0;_bufferedAmountLowThreshold=0;_binaryType="arraybuffer";_onopen=null;_onclosing=null;_onclose=null;_onmessage=null;_onbufferedamountlow=null;_onerror=null;constructor({id:e,ordered:t=!0,maxPacketLifeTime:r=null,maxRetransmits:s=null,label:i="",protocol:a=""}){super(),o.debug(`constructor() [id:${e}, ordered:${t}, maxPacketLifeTime:${r}, maxRetransmits:${s}, label:${i}, protocol:${a}`),this._id=e,this._ordered=t,this._maxPacketLifeTime=r,this._maxRetransmits=s,this._label=i,this._protocol=a}get id(){return this._id}get negotiated(){return this._negotiated}get ordered(){return this._ordered}get maxPacketLifeTime(){return this._maxPacketLifeTime}get maxRetransmits(){return this._maxRetransmits}get label(){return this._label}get protocol(){return this._protocol}get readyState(){return this._readyState}get bufferedAmount(){return this._bufferedAmount}get bufferedAmountLowThreshold(){return this._bufferedAmountLowThreshold}set bufferedAmountLowThreshold(e){this._bufferedAmountLowThreshold=e}get binaryType(){return this._binaryType}set binaryType(e){this._binaryType=e}get onopen(){return this._onopen}set onopen(e){this._onopen&&this.removeEventListener("open",this._onopen),this._onopen=e,e&&this.addEventListener("open",e)}get onclosing(){return this._onclosing}set onclosing(e){this._onclosing&&this.removeEventListener("closing",this._onclosing),this._onclosing=e,e&&this.addEventListener("closing",e)}get onclose(){return this._onclose}set onclose(e){this._onclose&&this.removeEventListener("close",this._onclose),this._onclose=e,e&&this.addEventListener("close",e)}get onmessage(){return this._onmessage}set onmessage(e){this._onmessage&&this.removeEventListener("message",this._onmessage),this._onmessage=e,e&&this.addEventListener("message",e)}get onbufferedamountlow(){return this._onbufferedamountlow}set onbufferedamountlow(e){this._onbufferedamountlow&&this.removeEventListener("bufferedamountlow",this._onbufferedamountlow),this._onbufferedamountlow=e,e&&this.addEventListener("bufferedamountlow",e)}get onerror(){return this._onerror}set onerror(e){this._onerror&&this.removeEventListener("error",this._onerror),this._onerror=e,e&&this.addEventListener("error",e)}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}close(){["closing","closed"].includes(this._readyState)||(this._readyState="closed")}send(e){if("open"!==this._readyState)throw new a.InvalidStateError("not open")}}return Je}var cr,dr,lr={};var pr=(dr||(dr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.debug=e.testFakeParameters=e.FakeHandler=e.enhancedEvents=e.ortc=e.parseScalabilityMode=e.detectDeviceAsync=e.detectDevice=e.Device=e.version=e.types=void 0;const t=l();e.debug=t.default,e.types=(p||(p=1,Object.defineProperty(u,"__esModule",{value:!0})),u),e.version="3.15.6";var r=Ge();Object.defineProperty(e,"Device",{enumerable:!0,get:function(){return r.Device}}),Object.defineProperty(e,"detectDevice",{enumerable:!0,get:function(){return r.detectDevice}}),Object.defineProperty(e,"detectDeviceAsync",{enumerable:!0,get:function(){return r.detectDeviceAsync}});var s=Se();Object.defineProperty(e,"parseScalabilityMode",{enumerable:!0,get:function(){return s.parse}}),e.ortc=B(),e.enhancedEvents=k();var i=or();Object.defineProperty(e,"FakeHandler",{enumerable:!0,get:function(){return i.FakeHandler}}),e.testFakeParameters=function(){if(cr)return lr;cr=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.generateRouterRtpCapabilities=function(){return e.deepFreeze({codecs:[{mimeType:"audio/opus",kind:"audio",preferredPayloadType:100,clockRate:48e3,channels:2,rtcpFeedback:[{type:"transport-cc"}],parameters:{useinbandfec:1,foo:"bar"}},{mimeType:"video/VP8",kind:"video",preferredPayloadType:101,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"x-google-start-bitrate":1500}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:102,clockRate:9e4,rtcpFeedback:[],parameters:{apt:101}},{mimeType:"video/H264",kind:"video",preferredPayloadType:103,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"level-asymmetry-allowed":1,"packetization-mode":1,"profile-level-id":"42e01f"}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:104,clockRate:9e4,rtcpFeedback:[],parameters:{apt:103}},{mimeType:"video/VP9",kind:"video",preferredPayloadType:105,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"profile-id":0,"x-google-start-bitrate":1500}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:106,clockRate:9e4,rtcpFeedback:[],parameters:{apt:105}}],headerExtensions:[{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id",preferredId:2,preferredEncrypt:!1,direction:"recvonly"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id",preferredId:3,preferredEncrypt:!1,direction:"recvonly"},{kind:"audio",uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",preferredId:4,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",preferredId:4,preferredEncrypt:!1,direction:"sendrecv"},{kind:"audio",uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",preferredId:5,preferredEncrypt:!1,direction:"recvonly"},{kind:"video",uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",preferredId:5,preferredEncrypt:!1,direction:"sendrecv"},{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:ssrc-audio-level",preferredId:10,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:3gpp:video-orientation",preferredId:11,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:toffset",preferredId:12,preferredEncrypt:!1,direction:"sendrecv"}]})},lr.generateNativeRtpCapabilities=function(){return{codecs:[{mimeType:"audio/opus",kind:"audio",preferredPayloadType:111,clockRate:48e3,channels:2,rtcpFeedback:[{type:"transport-cc"}],parameters:{minptime:10,useinbandfec:1}},{mimeType:"audio/ISAC",kind:"audio",preferredPayloadType:103,clockRate:16e3,channels:1,rtcpFeedback:[{type:"transport-cc"}],parameters:{}},{mimeType:"audio/CN",kind:"audio",preferredPayloadType:106,clockRate:32e3,channels:1,rtcpFeedback:[{type:"transport-cc"}],parameters:{}},{mimeType:"audio/foo",kind:"audio",preferredPayloadType:107,clockRate:9e4,channels:4,rtcpFeedback:[{type:"foo-qwe-qwe"}],parameters:{foo:"lalala"}},{mimeType:"video/BAZCODEC",kind:"video",preferredPayloadType:100,clockRate:9e4,rtcpFeedback:[{type:"foo"},{type:"transport-cc"},{type:"ccm",parameter:"fir"},{type:"nack"},{type:"nack",parameter:"pli"}],parameters:{baz:"1234abcd"}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:101,clockRate:9e4,rtcpFeedback:[],parameters:{apt:100}},{mimeType:"video/VP8",kind:"video",preferredPayloadType:96,clockRate:9e4,rtcpFeedback:[{type:"goog-remb"},{type:"transport-cc"},{type:"ccm",parameter:"fir"},{type:"nack"},{type:"nack",parameter:"pli"}],parameters:{baz:"1234abcd"}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:97,clockRate:9e4,rtcpFeedback:[],parameters:{apt:96}},{mimeType:"video/VP9",kind:"video",preferredPayloadType:98,clockRate:9e4,rtcpFeedback:[{type:"goog-remb"},{type:"transport-cc"},{type:"ccm",parameter:"fir"},{type:"nack"},{type:"nack",parameter:"pli"}],parameters:{"profile-id":0}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:99,clockRate:9e4,rtcpFeedback:[],parameters:{apt:98}}],headerExtensions:[{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:toffset",preferredId:2},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",preferredId:3},{kind:"video",uri:"urn:3gpp:video-orientation",preferredId:4},{kind:"video",uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",preferredId:5},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay",preferredId:6},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/video-content-type",preferredId:7},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/video-timing",preferredId:8},{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:ssrc-audio-level",preferredId:10}]}},lr.generateNativeSctpCapabilities=function(){return e.deepFreeze({numStreams:{OS:2048,MIS:2048}})},lr.generateLocalDtlsParameters=function(){return e.deepFreeze({fingerprints:[{algorithm:"sha-256",value:"82:5A:68:3D:36:C3:0A:DE:AF:E7:32:43:D2:88:83:57:AC:2D:65:E5:80:C4:B6:FB:AF:1A:A0:21:9F:6D:0C:AD"}],role:"auto"})},lr.generateTransportRemoteParameters=function(){return{id:t(),iceParameters:e.deepFreeze({iceLite:!0,password:"yku5ej8nvfaor28lvtrabcx0wkrpkztz",usernameFragment:"h3hk1iz6qqlnqlne"}),iceCandidates:e.deepFreeze([{foundation:"udpcandidate",address:"9.9.9.9",ip:"9.9.9.9",port:40533,priority:1078862079,protocol:"udp",type:"host",tcpType:"passive"},{foundation:"udpcandidate",address:"9.9.9.9",ip:"9:9:9:9:9:9",port:41333,priority:1078862089,protocol:"udp",type:"host",tcpType:"passive"}]),dtlsParameters:e.deepFreeze({fingerprints:[{algorithm:"sha-256",value:"A9:F4:E0:D2:74:D3:0F:D9:CA:A5:2F:9F:7F:47:FA:F0:C4:72:DD:73:49:D0:3B:14:90:20:51:30:1B:90:8E:71"},{algorithm:"sha-384",value:"03:D9:0B:87:13:98:F6:6D:BC:FC:92:2E:39:D4:E1:97:32:61:30:56:84:70:81:6E:D1:82:97:EA:D9:C1:21:0F:6B:C5:E7:7F:E1:97:0C:17:97:6E:CF:B3:EF:2E:74:B0"},{algorithm:"sha-512",value:"84:27:A4:28:A4:73:AF:43:02:2A:44:68:FF:2F:29:5C:3B:11:9A:60:F4:A8:F0:F5:AC:A0:E3:49:3E:B1:34:53:A9:85:CE:51:9B:ED:87:5E:B8:F4:8E:3D:FA:20:51:B8:96:EE:DA:56:DC:2F:5C:62:79:15:23:E0:21:82:2B:2C"}],role:"auto"}),sctpParameters:e.deepFreeze({port:5e3,OS:2048,MIS:2048,maxMessageSize:2e6})}},lr.generateProducerRemoteParameters=function(){return e.deepFreeze({id:t()})},lr.generateConsumerRemoteParameters=function({id:r,codecMimeType:s}={}){switch(s){case"audio/opus":return{id:r??t(),producerId:t(),kind:"audio",rtpParameters:e.deepFreeze({codecs:[{mimeType:"audio/opus",payloadType:100,clockRate:48e3,channels:2,rtcpFeedback:[{type:"transport-cc"}],parameters:{useinbandfec:1,foo:"bar"}}],encodings:[{ssrc:46687003}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5},{uri:"urn:ietf:params:rtp-hdrext:ssrc-audio-level",id:10}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};case"audio/ISAC":return{id:r??t(),producerId:t(),kind:"audio",rtpParameters:e.deepFreeze({codecs:[{mimeType:"audio/ISAC",payloadType:111,clockRate:16e3,channels:1,rtcpFeedback:[{type:"transport-cc"}],parameters:{}}],encodings:[{ssrc:46687004}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};case"video/VP8":return{id:r??t(),producerId:t(),kind:"video",rtpParameters:e.deepFreeze({codecs:[{mimeType:"video/VP8",payloadType:101,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"x-google-start-bitrate":1500}},{mimeType:"video/rtx",payloadType:102,clockRate:9e4,rtcpFeedback:[],parameters:{apt:101}}],encodings:[{ssrc:99991111,rtx:{ssrc:99991112}}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",id:4},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5},{uri:"urn:3gpp:video-orientation",id:11},{uri:"urn:ietf:params:rtp-hdrext:toffset",id:12}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};case"video/H264":return{id:r??t(),producerId:t(),kind:"video",rtpParameters:e.deepFreeze({codecs:[{mimeType:"video/H264",payloadType:103,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"level-asymmetry-allowed":1,"packetization-mode":1,"profile-level-id":"42e01f"}},{mimeType:"video/rtx",payloadType:104,clockRate:9e4,rtcpFeedback:[],parameters:{apt:103}}],encodings:[{ssrc:99991113,rtx:{ssrc:99991114}}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",id:4},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5},{uri:"urn:3gpp:video-orientation",id:11},{uri:"urn:ietf:params:rtp-hdrext:toffset",id:12}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};default:throw new TypeError(`unknown codecMimeType '${s}'`)}},lr.generateDataProducerRemoteParameters=function(){return e.deepFreeze({id:t()})},lr.generateDataConsumerRemoteParameters=function({id:r}={}){return{id:r??t(),dataProducerId:t(),sctpStreamParameters:e.deepFreeze({streamId:666,maxPacketLifeTime:5e3,maxRetransmits:void 0})}};const e=D();function t(){return String(e.generateRandomNumber())}return lr}()}(o)),o);const ur={"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","Pale Moon":"pale_moon",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"},hr={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",pale_moon:"Pale Moon",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"},mr={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv",bot:"bot"},fr={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"},gr={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class br{static getFirstMatch(e,t){const r=t.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,t){const r=t.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,t,r){if(e.test(t))return r}static getWindowsVersionName(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}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map(e=>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}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map(e=>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}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,r=!1){const s=br.getVersionPrecision(e),i=br.getVersionPrecision(t);let a=Math.max(s,i),n=0;const o=br.map([e,t],e=>{const t=a-br.getVersionPrecision(e),r=e+new Array(t+1).join(".0");return br.map(r.split("."),e=>new Array(20-e.length).join("0")+e).reverse()});for(r&&(n=a-Math.min(s,i)),a-=1;a>=n;){if(o[0][a]>o[1][a])return 1;if(o[0][a]===o[1][a]){if(a===n)return 0;a-=1}else if(o[0][a]<o[1][a])return-1}}static map(e,t){const r=[];let s;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(s=0;s<e.length;s+=1)r.push(t(e[s]));return r}static find(e,t){let r,s;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,s=e.length;r<s;r+=1){const s=e[r];if(t(s,r))return s}}static assign(e,...t){const r=e;let s,i;if(Object.assign)return Object.assign(e,...t);for(s=0,i=t.length;s<i;s+=1){const e=t[s];if("object"==typeof e&&null!==e){Object.keys(e).forEach(t=>{r[t]=e[t]})}}return e}static getBrowserAlias(e){return ur[e]}static getBrowserTypeByAlias(e){return hr[e]||""}}const yr=/version\/(\d+(\.?_?\d+)+)/i,_r=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},r=br.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},r=br.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/PaleMoon/i],describe(e){const t={name:"Pale Moon"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},r=br.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},r=br.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},r=br.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},r=br.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},r=br.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},r=br.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=br.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},r=br.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},r=br.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},r=br.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},r=br.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},r=br.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},r=br.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},r=br.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},r=br.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},r=br.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},r=br.getFirstMatch(yr,e)||br.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},r=br.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},r=br.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},r=br.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},r=br.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},r=br.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},r=br.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},r=br.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},r=br.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},r=br.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t={name:"Android Browser"},r=br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},r=br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},r=br.getFirstMatch(yr,e);return r&&(t.version=r),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:br.getFirstMatch(t,e),version:br.getSecondMatch(t,e)}}}],vr=[{test:[/Roku\/DVP/],describe(e){const t=br.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:fr.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=br.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:fr.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=br.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=br.getWindowsVersionName(t);return{name:fr.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:fr.iOS},r=br.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe(e){const t=br.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=br.getMacOSVersionName(t),s={name:fr.MacOS,version:t};return r&&(s.versionName=r),s}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=br.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:fr.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t=br.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=br.getAndroidVersionName(t),s={name:fr.Android,version:t};return r&&(s.versionName=r),s}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=br.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:fr.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=br.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||br.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||br.getFirstMatch(/\bbb(\d+)/i,e);return{name:fr.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=br.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:fr.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=br.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:fr.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:fr.Linux})},{test:[/CrOS/],describe:()=>({name:fr.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=br.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:fr.PlayStation4,version:t}}}],wr=[{test:[/googlebot/i],describe:()=>({type:mr.bot,vendor:"Google"})},{test:[/huawei/i],describe(e){const t=br.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:mr.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:mr.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:mr.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:mr.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:mr.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:mr.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:mr.tablet})},{test(e){const t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe(e){const t=br.getFirstMatch(/(ipod|iphone)/i,e);return{type:mr.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:mr.mobile,vendor:"Nexus"})},{test:[/Nokia/i],describe(e){const t=br.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),r={type:mr.mobile,vendor:"Nokia"};return t&&(r.model=t),r}},{test:[/[^-]mobi/i],describe:()=>({type:mr.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:mr.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:mr.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:mr.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:mr.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:mr.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:mr.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:mr.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:mr.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:mr.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:mr.tv})}],Sr=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:gr.Blink};const t=br.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:gr.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:gr.Trident},r=br.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:gr.Presto},r=br.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe(e){const t={name:gr.Gecko},r=br.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:gr.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:gr.WebKit},r=br.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];class Cr{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=br.find(_r,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=br.find(vr,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=br.find(wr,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=br.find(Sr,e=>{if("function"==typeof e.test)return e.test(this);if(Array.isArray(e.test))return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return br.assign({},this.parsedResult)}satisfies(e){const t={};let r=0;const s={};let i=0;if(Object.keys(e).forEach(a=>{const n=e[a];"string"==typeof n?(s[a]=n,i+=1):"object"==typeof n&&(t[a]=n,r+=1)}),r>0){const e=Object.keys(t),r=br.find(e,e=>this.isOS(e));if(r){const e=this.satisfies(t[r]);if(void 0!==e)return e}const s=br.find(e,e=>this.isPlatform(e));if(s){const e=this.satisfies(t[s]);if(void 0!==e)return e}}if(i>0){const e=Object.keys(s),t=br.find(e,e=>this.isBrowser(e,!0));if(void 0!==t)return this.compareVersion(s[t])}}isBrowser(e,t=!1){const r=this.getBrowserName().toLowerCase();let s=e.toLowerCase();const i=br.getBrowserTypeByAlias(s);return t&&i&&(s=i.toLowerCase()),s===r}compareVersion(e){let t=[0],r=e,s=!1;const i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(s=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(s=!0,r=e.substr(1)),t.indexOf(br.compareVersions(i,r,s))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(e=>this.is(e))}}
13
2
  /*!
14
- * The buffer module from node.js, for the browser.
15
- *
16
- * @author Feross Aboukhadijeh <https://feross.org>
17
- * @license MIT
18
- */
19
- "use strict";var n=e("base64-js"),i=e("ieee754");r.Buffer=s,r.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},r.INSPECT_MAX_BYTES=50;var a=2147483647;function o(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|p(e,t),n=o(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r);return n.__proto__=s.prototype,n}(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=function(e){if(s.isBuffer(e)){var t=0|f(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?o(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),o(e<0?0:0|f(e))}function l(e){for(var t=e.length<0?0:0|f(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(i)return n?-1:N(e).length;t=(""+t).toLowerCase(),i=!0}}function h(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return M(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,o=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var d=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===d?0:a-d)){if(-1===d&&(d=a),a-d+1===c)return d*o}else-1!==d&&(a-=a-d),d=-1}else for(r+c>s&&(r=s-c),a=r;a>=0;a--){for(var l=!0,f=0;f<c;f++)if(u(e,a+f)!==u(t,f)){l=!1;break}if(l)return a}return-1}function g(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(z(s))return o;e[r+o]=s}return o}function y(e,t,r,n){return U(N(t,e.length-r),e,r,n)}function _(e,t,r,n){return U(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function w(e,t,r,n){return _(e,t,r,n)}function k(e,t,r,n){return U(F(t),e,r,n)}function S(e,t,r,n){return U(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function x(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,c,u=e[i],d=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(d=u);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&u)<<6|63&a)>127&&(d=c);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(c=(15&u)<<12|(63&a)<<6|63&o)>2047&&(c<55296||c>57343)&&(d=c);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(c=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&c<1114112&&(d=c)}null===d?(d=65533,l=1):d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|1023&d),n.push(d),i+=l}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}r.kMaxLength=a,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return c(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)}(e,t,r)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(q(a,Uint8Array)&&(a=s.from(a)),!s.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):h.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),c=Math.min(a,o),u=this.slice(n,i),d=e.slice(t,r),l=0;l<c;++l)if(u[l]!==d[l]){a=u[l],o=d[l];break}return a<o?-1:o<a?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function R(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function M(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function C(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=B(e[a]);return i}function T(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function A(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,r,n,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,a){return t=+t,r>>>=0,a||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,a){return t=+t,r>>>=0,a||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||I(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||I(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);I(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);I(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var a=i-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=s.isBuffer(e)?e:s.from(e,n),c=o.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<r-t;++a)this[a+t]=o[a%c]}return this};var L=/[^+/0-9A-Za-z-_]/g;function B(e){return e<16?"0"+e.toString(16):e.toString(16)}function N(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function F(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}},{"base64-js":87,ieee754:242}],125:[function(e,t,r){"use strict";var n=e("function-bind"),i=e("./functionApply"),a=e("./functionCall"),o=e("./reflectApply");t.exports=o||n.call(a,i)},{"./functionApply":127,"./functionCall":128,"./reflectApply":130,"function-bind":213}],126:[function(e,t,r){"use strict";var n=e("function-bind"),i=e("./functionApply"),a=e("./actualApply");t.exports=function(){return a(n,i,arguments)}},{"./actualApply":125,"./functionApply":127,"function-bind":213}],127:[function(e,t,r){"use strict";t.exports=Function.prototype.apply},{}],128:[function(e,t,r){"use strict";t.exports=Function.prototype.call},{}],129:[function(e,t,r){"use strict";var n=e("function-bind"),i=e("es-errors/type"),a=e("./functionCall"),o=e("./actualApply");t.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new i("a function is required");return o(n,a,e)}},{"./actualApply":125,"./functionCall":128,"es-errors/type":201,"function-bind":213}],130:[function(e,t,r){"use strict";t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},{}],131:[function(e,t,r){"use strict";var n=e("set-function-length"),i=e("es-define-property"),a=e("call-bind-apply-helpers"),o=e("call-bind-apply-helpers/applyBind");t.exports=function(e){var t=a(arguments),r=e.length-(arguments.length-1);return n(t,1+(r>0?r:0),!0)},i?i(t.exports,"apply",{value:o}):t.exports.apply=o},{"call-bind-apply-helpers":129,"call-bind-apply-helpers/applyBind":126,"es-define-property":195,"set-function-length":393}],132:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("call-bind-apply-helpers"),a=i([n("%String.prototype.indexOf%")]);t.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&a(e,".prototype.")>-1?i([r]):r}},{"call-bind-apply-helpers":129,"get-intrinsic":214}],133:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("stream").Transform,a=e("string_decoder").StringDecoder;function o(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}e("inherits")(o,i);var s="undefined"!=typeof Uint8Array,c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(n.prototype instanceof Uint8Array||n.TYPED_ARRAY_SUPPORT);o.prototype.update=function(e,t,r){var i=function(e,t){if(e instanceof n)return e;if("string"==typeof e)return n.from(e,t);if(c&&ArrayBuffer.isView(e)){if(0===e.byteLength)return n.alloc(0);var r=n.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(s&&e instanceof Uint8Array)return n.from(e);if(n.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return n.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(e,t),a=this._update(i);return this.hashMode?this:(r&&(a=this._toString(a,r)),a)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},o.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},o.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},o.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new a(t),this._encoding=t),this._encoding!==t)throw new Error("can’t switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},t.exports=o},{inherits:243,"safe-buffer":387,stream:415,string_decoder:430}],134:[function(e,t,r){function n(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===n(e)},r.isObject=function(e){return"object"==typeof e&&null!==e},r.isDate=function(e){return"[object Date]"===n(e)},r.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e("buffer").Buffer.isBuffer},{buffer:124}],135:[function(e,t,r){var n=e("elliptic"),i=e("bn.js");t.exports=function(e){return new o(e)};var a={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function o(e){this.curveType=a[e],this.curveType||(this.curveType={name:e}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function s(e,t,r){Array.isArray(e)||(e=e.toArray());var n=new Buffer(e);if(r&&n.length<r){var i=new Buffer(r-n.length);i.fill(0),n=Buffer.concat([i,n])}return t?n.toString(t):n}a.p224=a.secp224r1,a.p256=a.secp256r1=a.prime256v1,a.p192=a.secp192r1=a.prime192v1,a.p384=a.secp384r1,a.p521=a.secp521r1,o.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},o.prototype.computeSecret=function(e,t,r){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},o.prototype.getPublicKey=function(e,t){var r=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(r[r.length-1]%2?r[0]=7:r[0]=6),s(r,e)},o.prototype.getPrivateKey=function(e){return s(this.keys.getPrivate(),e)},o.prototype.setPublicKey=function(e,t){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),this.keys._importPublic(e),this},o.prototype.setPrivateKey=function(e,t){t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t));var r=new i(e);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this}},{"bn.js":88,elliptic:158}],136:[function(e,t,r){"use strict";var n=e("inherits"),i=e("md5.js"),a=e("ripemd160"),o=e("sha.js"),s=e("cipher-base");function c(e){s.call(this,"digest"),this._hash=e}n(c,s),c.prototype._update=function(e){this._hash.update(e)},c.prototype._final=function(){return this._hash.digest()},t.exports=function(e){return"md5"===(e=e.toLowerCase())?new i:"rmd160"===e||"ripemd160"===e?new a:new c(o(e))}},{"cipher-base":133,inherits:243,"md5.js":281,ripemd160:370,"sha.js":395}],137:[function(e,t,r){var n=e("md5.js");t.exports=function(e){return(new n).update(e).digest()}},{"md5.js":281}],138:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./legacy"),a=e("cipher-base"),o=e("safe-buffer").Buffer,s=e("create-hash/md5"),c=e("ripemd160"),u=e("sha.js"),d=o.alloc(128);function l(e,t){a.call(this,"digest"),"string"==typeof t&&(t=o.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new c:u(e)).update(t).digest():t.length<r&&(t=o.concat([t,d],r));for(var n=this._ipad=o.allocUnsafe(r),i=this._opad=o.allocUnsafe(r),s=0;s<r;s++)n[s]=54^t[s],i[s]=92^t[s];this._hash="rmd160"===e?new c:u(e),this._hash.update(n)}n(l,a),l.prototype._update=function(e){this._hash.update(e)},l.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new c:u(this._alg)).update(this._opad).update(e).digest()},t.exports=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new l("rmd160",t):"md5"===e?new i(s,t):new l(e,t)}},{"./legacy":139,"cipher-base":133,"create-hash/md5":137,inherits:243,ripemd160:370,"safe-buffer":387,"sha.js":395}],139:[function(e,t,r){"use strict";var n=e("inherits"),i=e("safe-buffer").Buffer,a=e("cipher-base"),o=i.alloc(128),s=64;function c(e,t){a.call(this,"digest"),"string"==typeof t&&(t=i.from(t)),this._alg=e,this._key=t,t.length>s?t=e(t):t.length<s&&(t=i.concat([t,o],s));for(var r=this._ipad=i.allocUnsafe(s),n=this._opad=i.allocUnsafe(s),c=0;c<s;c++)r[c]=54^t[c],n[c]=92^t[c];this._hash=[r]}n(c,a),c.prototype._update=function(e){this._hash.push(e)},c.prototype._final=function(){var e=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,e]))},t.exports=c},{"cipher-base":133,inherits:243,"safe-buffer":387}],140:[function(e,t,r){"use strict";r.randomBytes=r.rng=r.pseudoRandomBytes=r.prng=e("randombytes"),r.createHash=r.Hash=e("create-hash"),r.createHmac=r.Hmac=e("create-hmac");var n=e("browserify-sign/algos"),i=Object.keys(n),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);r.getHashes=function(){return a};var o=e("pbkdf2");r.pbkdf2=o.pbkdf2,r.pbkdf2Sync=o.pbkdf2Sync;var s=e("browserify-cipher");r.Cipher=s.Cipher,r.createCipher=s.createCipher,r.Cipheriv=s.Cipheriv,r.createCipheriv=s.createCipheriv,r.Decipher=s.Decipher,r.createDecipher=s.createDecipher,r.Decipheriv=s.Decipheriv,r.createDecipheriv=s.createDecipheriv,r.getCiphers=s.getCiphers,r.listCiphers=s.listCiphers;var c=e("diffie-hellman");r.DiffieHellmanGroup=c.DiffieHellmanGroup,r.createDiffieHellmanGroup=c.createDiffieHellmanGroup,r.getDiffieHellman=c.getDiffieHellman,r.createDiffieHellman=c.createDiffieHellman,r.DiffieHellman=c.DiffieHellman;var u=e("browserify-sign");r.createSign=u.createSign,r.Sign=u.Sign,r.createVerify=u.createVerify,r.Verify=u.Verify,r.createECDH=e("create-ecdh");var d=e("public-encrypt");r.publicEncrypt=d.publicEncrypt,r.privateEncrypt=d.privateEncrypt,r.publicDecrypt=d.publicDecrypt,r.privateDecrypt=d.privateDecrypt;var l=e("randomfill");r.randomFill=l.randomFill,r.randomFillSync=l.randomFillSync,r.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},r.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},{"browserify-cipher":110,"browserify-sign":118,"browserify-sign/algos":115,"create-ecdh":135,"create-hash":136,"create-hmac":138,"diffie-hellman":151,pbkdf2:336,"public-encrypt":350,randombytes:356,randomfill:357}],141:[function(e,t,r){var n=1e3,i=60*n,a=60*i,o=24*a,s=365.25*o;function c(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}t.exports=function(e,t){t=t||{};var r,u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*s;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===u&&!1===isNaN(e))return t.long?c(r=e,o,"day")||c(r,a,"hour")||c(r,i,"minute")||c(r,n,"second")||r+" ms":function(e){if(e>=o)return Math.round(e/o)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],142:[function(e,t,r){function n(){var e;try{e=r.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(r=t.exports=e("./debug")).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},r.formatArgs=function(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff),!t)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,a=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(a=i))}),e.splice(a,0,n)},r.save=function(e){try{null==e?r.storage.removeItem("debug"):r.storage.debug=e}catch(e){}},r.load=n,r.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},r.enable(n())},{"./debug":143}],143:[function(e,t,r){var n;function i(e){function t(){if(t.enabled){var e=t,i=+new Date,a=i-(n||i);e.diff=a,e.prev=n,e.curr=i,n=i;for(var o=new Array(arguments.length),s=0;s<o.length;s++)o[s]=arguments[s];o[0]=r.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var c=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,function(t,n){if("%%"===t)return t;c++;var i=r.formatters[n];if("function"==typeof i){var a=o[c];t=i.call(e,a),o.splice(c,1),c--}return t}),r.formatArgs.call(e,o),(t.log||r.log||console.log.bind(console)).apply(e,o)}}return t.namespace=e,t.enabled=r.enabled(e),t.useColors=r.useColors(),t.color=function(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return r.colors[Math.abs(n)%r.colors.length]}(e),"function"==typeof r.init&&r.init(t),t}(r=t.exports=i.debug=i.default=i).coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){r.enable("")},r.enable=function(e){r.save(e),r.names=[],r.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),n=t.length,i=0;i<n;i++)t[i]&&("-"===(e=t[i].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){var t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.names=[],r.skips=[],r.formatters={}},{ms:141}],144:[function(e,t,r){"use strict";var n=e("es-define-property"),i=e("es-errors/syntax"),a=e("es-errors/type"),o=e("gopd");t.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new a("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new a("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new a("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new a("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new a("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new a("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,d=arguments.length>6&&arguments[6],l=!!o&&o(e,t);if(n)n(e,t,{configurable:null===u&&l?l.configurable:!u,enumerable:null===s&&l?l.enumerable:!s,value:r,writable:null===c&&l?l.writable:!c});else{if(!d&&(s||c||u))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},{"es-define-property":195,"es-errors/syntax":200,"es-errors/type":201,gopd:219}],145:[function(e,t,r){"use strict";r.utils=e("./des/utils"),r.Cipher=e("./des/cipher"),r.DES=e("./des/des"),r.CBC=e("./des/cbc"),r.EDE=e("./des/ede")},{"./des/cbc":146,"./des/cipher":147,"./des/des":148,"./des/ede":149,"./des/utils":150}],146:[function(e,t,r){"use strict";var n=e("minimalistic-assert"),i=e("inherits"),a={};function o(e){n.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}r.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}i(t,e);for(var r=Object.keys(a),n=0;n<r.length;n++){var o=r[n];t.prototype[o]=a[o]}return t.create=function(e){return new t(e)},t},a._cbcInit=function(){var e=new o(this.options.iv);this._cbcState=e},a._update=function(e,t,r,n){var i=this._cbcState,a=this.constructor.super_.prototype,o=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)o[s]^=e[t+s];a._update.call(this,o,0,r,n);for(s=0;s<this.blockSize;s++)o[s]=r[n+s]}else{a._update.call(this,e,t,r,n);for(s=0;s<this.blockSize;s++)r[n+s]^=o[s];for(s=0;s<this.blockSize;s++)o[s]=e[t+s]}}},{inherits:243,"minimalistic-assert":328}],147:[function(e,t,r){"use strict";var n=e("minimalistic-assert");function i(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},i.prototype._buffer=function(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),n=0;n<r;n++)this.buffer[this.bufferOff+n]=e[t+n];return this.bufferOff+=r,r},i.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(e){var t=0,r=0,n=(this.bufferOff+e.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var a=e.length-(e.length-t)%this.blockSize;t<a;t+=this.blockSize)this._update(e,t,i,r),r+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},i.prototype._updateDecrypt=function(e){for(var t=0,r=0,n=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,i=new Array(n*this.blockSize);n>0;n--)t+=this._buffer(e,t),r+=this._flushBuffer(i,r);return t+=this._buffer(e,t),i},i.prototype.final=function(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},i.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},i.prototype._unpad=function(e){return e},i.prototype._finalDecrypt=function(){n.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}},{"minimalistic-assert":328}],148:[function(e,t,r){"use strict";var n=e("minimalistic-assert"),i=e("inherits"),a=e("./utils"),o=e("./cipher");function s(){this.tmp=new Array(2),this.keys=null}function c(e){o.call(this,e);var t=new s;this._desState=t,this.deriveKeys(t,e.key)}i(c,o),t.exports=c,c.create=function(e){return new c(e)};var u=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];c.prototype.deriveKeys=function(e,t){e.keys=new Array(32),n.equal(t.length,this.blockSize,"Invalid key length");var r=a.readUInt32BE(t,0),i=a.readUInt32BE(t,4);a.pc1(r,i,e.tmp,0),r=e.tmp[0],i=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=u[o>>>1];r=a.r28shl(r,s),i=a.r28shl(i,s),a.pc2(r,i,e.keys,o)}},c.prototype._update=function(e,t,r,n){var i=this._desState,o=a.readUInt32BE(e,t),s=a.readUInt32BE(e,t+4);a.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],a.writeUInt32BE(r,o,n),a.writeUInt32BE(r,s,n+4)},c.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var r=e.length-t,n=t;n<e.length;n++)e[n]=r;return!0},c.prototype._unpad=function(e){if(!1===this.padding)return e;for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)n.equal(e[r],t);return e.slice(0,e.length-t)},c.prototype._encrypt=function(e,t,r,n,i){for(var o=t,s=r,c=0;c<e.keys.length;c+=2){var u=e.keys[c],d=e.keys[c+1];a.expand(s,e.tmp,0),u^=e.tmp[0],d^=e.tmp[1];var l=a.substitute(u,d),f=s;s=(o^a.permute(l))>>>0,o=f}a.rip(s,o,n,i)},c.prototype._decrypt=function(e,t,r,n,i){for(var o=r,s=t,c=e.keys.length-2;c>=0;c-=2){var u=e.keys[c],d=e.keys[c+1];a.expand(o,e.tmp,0),u^=e.tmp[0],d^=e.tmp[1];var l=a.substitute(u,d),f=o;o=(s^a.permute(l))>>>0,s=f}a.rip(o,s,n,i)}},{"./cipher":147,"./utils":150,inherits:243,"minimalistic-assert":328}],149:[function(e,t,r){"use strict";var n=e("minimalistic-assert"),i=e("inherits"),a=e("./cipher"),o=e("./des");function s(e,t){n.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),i=t.slice(8,16),a=t.slice(16,24);this.ciphers="encrypt"===e?[o.create({type:"encrypt",key:r}),o.create({type:"decrypt",key:i}),o.create({type:"encrypt",key:a})]:[o.create({type:"decrypt",key:a}),o.create({type:"encrypt",key:i}),o.create({type:"decrypt",key:r})]}function c(e){a.call(this,e);var t=new s(this.type,this.options.key);this._edeState=t}i(c,a),t.exports=c,c.create=function(e){return new c(e)},c.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},c.prototype._pad=o.prototype._pad,c.prototype._unpad=o.prototype._unpad},{"./cipher":147,"./des":148,inherits:243,"minimalistic-assert":328}],150:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,a=0,o=6;o>=0;o-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+o&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+o&1}for(o=6;o>=0;o-=2){for(s=1;s<=25;s+=8)a<<=1,a|=t>>>s+o&1;for(s=1;s<=25;s+=8)a<<=1,a|=e>>>s+o&1}r[n+0]=i>>>0,r[n+1]=a>>>0},r.rip=function(e,t,r,n){for(var i=0,a=0,o=0;o<4;o++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+o&1,i<<=1,i|=e>>>s+o&1;for(o=4;o<8;o++)for(s=24;s>=0;s-=8)a<<=1,a|=t>>>s+o&1,a<<=1,a|=e>>>s+o&1;r[n+0]=i>>>0,r[n+1]=a>>>0},r.pc1=function(e,t,r,n){for(var i=0,a=0,o=7;o>=5;o--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+o&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+o&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+o&1;for(o=1;o<=3;o++){for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1;for(s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1}for(s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1;r[n+0]=i>>>0,r[n+1]=a>>>0},r.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,i){for(var a=0,o=0,s=n.length>>>1,c=0;c<s;c++)a<<=1,a|=e>>>n[c]&1;for(c=s;c<n.length;c++)o<<=1,o|=t>>>n[c]&1;r[i+0]=a>>>0,r[i+1]=o>>>0},r.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var a=23;a>=15;a-=4)n<<=6,n|=e>>>a&63;for(a=11;a>=3;a-=4)i|=e>>>a&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r<a.length;r++)t<<=1,t|=e>>>a[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var n=e.toString(2);n.length<t;)n="0"+n;for(var i=[],a=0;a<t;a+=r)i.push(n.slice(a,a+r));return i.join(" ")}},{}],151:[function(e,t,r){var n=e("./lib/generatePrime"),i=e("./lib/primes.json"),a=e("./lib/dh");var o={binary:!0,hex:!0,base64:!0};r.DiffieHellmanGroup=r.createDiffieHellmanGroup=r.getDiffieHellman=function(e){var t=new Buffer(i[e].prime,"hex"),r=new Buffer(i[e].gen,"hex");return new a(t,r)},r.createDiffieHellman=r.DiffieHellman=function e(t,r,i,s){return Buffer.isBuffer(r)||void 0===o[r]?e(t,"binary",r,i):(r=r||"binary",s=s||"binary",i=i||new Buffer([2]),Buffer.isBuffer(i)||(i=new Buffer(i,s)),"number"==typeof t?new a(n(t,i),i,!0):(Buffer.isBuffer(t)||(t=new Buffer(t,r)),new a(t,i,!0)))}},{"./lib/dh":152,"./lib/generatePrime":153,"./lib/primes.json":154}],152:[function(e,t,r){var n=e("bn.js"),i=new(e("miller-rabin")),a=new n(24),o=new n(11),s=new n(10),c=new n(3),u=new n(7),d=e("./generatePrime"),l=e("randombytes");function f(e,t){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),this._pub=new n(e),this}function p(e,t){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),this._priv=new n(e),this}t.exports=m;var h={};function m(e,t,r){this.setGenerator(t),this.__prime=new n(e),this._prime=n.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=f,this.setPrivateKey=p):this._primeCode=8}function b(e,t){var r=new Buffer(e.toArray());return t?r.toString(t):r}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var r=t.toString("hex"),n=[r,e.toString(16)].join("_");if(n in h)return h[n];var l,f=0;if(e.isEven()||!d.simpleSieve||!d.fermatTest(e)||!i.test(e))return f+=1,f+="02"===r||"05"===r?8:4,h[n]=f,f;switch(i.test(e.shrn(1))||(f+=2),r){case"02":e.mod(a).cmp(o)&&(f+=8);break;case"05":(l=e.mod(s)).cmp(c)&&l.cmp(u)&&(f+=8);break;default:f+=4}return h[n]=f,f}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new n(l(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(e){var t=(e=(e=new n(e)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new Buffer(t.toArray()),i=this.getPrime();if(r.length<i.length){var a=new Buffer(i.length-r.length);a.fill(0),r=Buffer.concat([a,r])}return r},m.prototype.getPublicKey=function(e){return b(this._pub,e)},m.prototype.getPrivateKey=function(e){return b(this._priv,e)},m.prototype.getPrime=function(e){return b(this.__prime,e)},m.prototype.getGenerator=function(e){return b(this._gen,e)},m.prototype.setGenerator=function(e,t){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),this.__gen=e,this._gen=new n(e),this}},{"./generatePrime":153,"bn.js":88,"miller-rabin":327,randombytes:356}],153:[function(e,t,r){var n=e("randombytes");t.exports=g,g.simpleSieve=b,g.fermatTest=v;var i=e("bn.js"),a=new i(24),o=new(e("miller-rabin")),s=new i(1),c=new i(2),u=new i(5),d=(new i(16),new i(8),new i(10)),l=new i(3),f=(new i(7),new i(11)),p=new i(4),h=(new i(12),null);function m(){if(null!==h)return h;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var n=Math.ceil(Math.sqrt(r)),i=0;i<t&&e[i]<=n&&r%e[i]!==0;i++);t!==i&&e[i]<=n||(e[t++]=r)}return h=e,e}function b(e){for(var t=m(),r=0;r<t.length;r++)if(0===e.modn(t[r]))return 0===e.cmpn(t[r]);return!0}function v(e){var t=i.mont(e);return 0===c.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)}function g(e,t){if(e<16)return new i(2===t||5===t?[140,123]:[140,39]);var r,h;for(t=new i(t);;){for(r=new i(n(Math.ceil(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(c),t.cmp(c)){if(!t.cmp(u))for(;r.mod(d).cmp(l);)r.iadd(p)}else for(;r.mod(a).cmp(f);)r.iadd(p);if(b(h=r.shrn(1))&&b(r)&&v(h)&&v(r)&&o.test(h)&&o.test(r))return r}}},{"bn.js":88,"miller-rabin":327,randombytes:356}],154:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],155:[function(e,t,r){"use strict";var n,i=e("call-bind-apply-helpers"),a=e("gopd");try{n=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var o=!!n&&a&&a(Object.prototype,"__proto__"),s=Object,c=s.getPrototypeOf;t.exports=o&&"function"==typeof o.get?i([o.get]):"function"==typeof c&&function(e){return c(null==e?e:s(e))}},{"call-bind-apply-helpers":129,gopd:219}],156:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("./param-bytes-for-alg"),a=128;function o(e){if(n.isBuffer(e))return e;if("string"==typeof e)return n.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(e,t,r){for(var n=0;t+n<r&&0===e[t+n];)++n;return e[t+n]>=a&&--n,n}t.exports={derToJose:function(e,t){e=o(e);var r=i(t),a=r+1,s=e.length,c=0;if(48!==e[c++])throw new Error('Could not find expected "seq"');var u=e[c++];if(129===u&&(u=e[c++]),s-c<u)throw new Error('"seq" specified length of "'+u+'", only "'+(s-c)+'" remaining');if(2!==e[c++])throw new Error('Could not find expected "int" for "r"');var d=e[c++];if(s-c-2<d)throw new Error('"r" specified length of "'+d+'", only "'+(s-c-2)+'" available');if(a<d)throw new Error('"r" specified length of "'+d+'", max of "'+a+'" is acceptable');var l=c;if(c+=d,2!==e[c++])throw new Error('Could not find expected "int" for "s"');var f=e[c++];if(s-c!==f)throw new Error('"s" specified length of "'+f+'", expected "'+(s-c)+'"');if(a<f)throw new Error('"s" specified length of "'+f+'", max of "'+a+'" is acceptable');var p=c;if((c+=f)!==s)throw new Error('Expected to consume entire buffer, but "'+(s-c)+'" bytes remain');var h=r-d,m=r-f,b=n.allocUnsafe(h+d+m+f);for(c=0;c<h;++c)b[c]=0;e.copy(b,c,l+Math.max(-h,0),l+d);for(var v=c=r;c<v+m;++c)b[c]=0;return e.copy(b,c,p+Math.max(-m,0),p+f),b=(b=b.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=o(e);var r=i(t),c=e.length;if(c!==2*r)throw new TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+c+'"');var u=s(e,0,r),d=s(e,r,e.length),l=r-u,f=r-d,p=2+l+1+1+f,h=p<a,m=n.allocUnsafe((h?2:3)+p),b=0;return m[b++]=48,h?m[b++]=p:(m[b++]=129,m[b++]=255&p),m[b++]=2,m[b++]=l,u<0?(m[b++]=0,b+=e.copy(m,b,0,r)):b+=e.copy(m,b,u,r),m[b++]=2,m[b++]=f,d<0?(m[b++]=0,e.copy(m,b,r)):e.copy(m,b,r+d),m}}},{"./param-bytes-for-alg":157,"safe-buffer":387}],157:[function(e,t,r){"use strict";function n(e){return(e/8|0)+(e%8==0?0:1)}var i={ES256:n(256),ES384:n(384),ES512:n(521)};t.exports=function(e){var t=i[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}},{}],158:[function(e,t,r){"use strict";var n=r;n.version=e("../package.json").version,n.utils=e("./elliptic/utils"),n.rand=e("brorand"),n.curve=e("./elliptic/curve"),n.curves=e("./elliptic/curves"),n.ec=e("./elliptic/ec"),n.eddsa=e("./elliptic/eddsa")},{"../package.json":173,"./elliptic/curve":161,"./elliptic/curves":164,"./elliptic/ec":165,"./elliptic/eddsa":168,"./elliptic/utils":172,brorand:90}],159:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils"),a=i.getNAF,o=i.getJSF,s=i.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}t.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),n=a(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,c,u=[];for(o=0;o<n.length;o+=r.step){c=0;for(var d=o+r.step-1;d>=o;d--)c=(c<<1)+n[d];u.push(c)}for(var l=this.jpoint(null,null,null),f=this.jpoint(null,null,null),p=i;p>0;p--){for(o=0;o<u.length;o++)(c=u[o])===p?f=f.mixedAdd(r.points[o]):c===-p&&(f=f.mixedAdd(r.points[o].neg()));l=l.add(f)}return l.toP()},c.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=a(t,r,this._bitLength),c=this.jpoint(null,null,null),u=o.length-1;u>=0;u--){for(var d=0;u>=0&&0===o[u];u--)d++;if(u>=0&&d++,c=c.dblp(d),u<0)break;var l=o[u];s(0!==l),c="affine"===e.type?l>0?c.mixedAdd(i[l-1>>1]):c.mixedAdd(i[-l-1>>1].neg()):l>0?c.add(i[l-1>>1]):c.add(i[-l-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,n,i){var s,c,u,d=this._wnafT1,l=this._wnafT2,f=this._wnafT3,p=0;for(s=0;s<n;s++){var h=(u=t[s])._getNAFPoints(e);d[s]=h.wnd,l[s]=h.points}for(s=n-1;s>=1;s-=2){var m=s-1,b=s;if(1===d[m]&&1===d[b]){var v=[t[m],null,null,t[b]];0===t[m].y.cmp(t[b].y)?(v[1]=t[m].add(t[b]),v[2]=t[m].toJ().mixedAdd(t[b].neg())):0===t[m].y.cmp(t[b].y.redNeg())?(v[1]=t[m].toJ().mixedAdd(t[b]),v[2]=t[m].add(t[b].neg())):(v[1]=t[m].toJ().mixedAdd(t[b]),v[2]=t[m].toJ().mixedAdd(t[b].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=o(r[m],r[b]);for(p=Math.max(y[0].length,p),f[m]=new Array(p),f[b]=new Array(p),c=0;c<p;c++){var _=0|y[0][c],w=0|y[1][c];f[m][c]=g[3*(_+1)+(w+1)],f[b][c]=0,l[m]=v}}else f[m]=a(r[m],d[m],this._bitLength),f[b]=a(r[b],d[b],this._bitLength),p=Math.max(f[m].length,p),p=Math.max(f[b].length,p)}var k=this.jpoint(null,null,null),S=this._wnafT4;for(s=p;s>=0;s--){for(var x=0;s>=0;){var E=!0;for(c=0;c<n;c++)S[c]=0|f[c][s],0!==S[c]&&(E=!1);if(!E)break;x++,s--}if(s>=0&&x++,k=k.dblp(x),s<0)break;for(c=0;c<n;c++){var P=S[c];0!==P&&(P>0?u=l[c][P-1>>1]:P<0&&(u=l[c][-P-1>>1].neg()),k="affine"===u.type?k.mixedAdd(u):k.add(u))}}for(s=0;s<n;s++)l[s]=null;return i?k:k.toP()},c.BasePoint=u,u.prototype.eq=function(){throw new Error("Not implemented")},u.prototype.validate=function(){return this.curve.validate(this)},c.prototype.decodePoint=function(e,t){e=i.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},u.prototype.encodeCompressed=function(e){return this.encode(e,!0)},u.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},u.prototype.encode=function(e,t){return i.encode(this._encode(t),e)},u.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},u.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var a=0;a<e;a++)n=n.dbl();r.push(n)}return{step:e,points:r}},u.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},u.prototype._getBeta=function(){return null},u.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},{"../utils":172,"bn.js":88}],160:[function(e,t,r){"use strict";var n=e("../utils"),i=e("bn.js"),a=e("inherits"),o=e("./base"),s=n.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,n,a){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=a&&new i(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(c,o),t.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(a.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=s.fromRed().isOdd();return(t&&!c||!t&&c)&&(s=s.redNeg()),this.point(e,s)},c.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(a.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},a(u,o.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new u(this,e,t,r,n)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),o=a.redSub(r),s=n.redSub(t),c=i.redMul(o),u=a.redMul(s),d=i.redMul(s),l=o.redMul(a);return this.curve.point(c,u,l,d)},u.prototype._projDbl=function(){var e,t,r,n,i,a,o=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=o.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),a=u.redSub(i).redISub(i),e=o.redSub(s).redISub(c).redMul(a),t=u.redMul(n.redSub(c)),r=u.redMul(a))}else n=s.redAdd(c),i=this.curve._mulC(this.z).redSqr(),a=n.redSub(i).redSub(i),e=this.curve._mulC(o.redISub(n)).redMul(a),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(a);return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),o=i.redSub(n),s=i.redAdd(n),c=r.redAdd(t),u=a.redMul(o),d=s.redMul(c),l=a.redMul(c),f=o.redMul(s);return this.curve.point(u,d,f,l)},u.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(o),c=i.redSub(s),u=i.redAdd(s),d=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),l=n.redMul(c).redMul(d);return this.curve.twisted?(t=n.redMul(u).redMul(o.redSub(this.curve._mulA(a))),r=c.redMul(u)):(t=n.redMul(u).redMul(o.redSub(a)),r=this.curve._mulC(c).redMul(u)),this.curve.point(l,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},{"../utils":172,"./base":159,"bn.js":88,inherits:243}],161:[function(e,t,r){"use strict";var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":159,"./edwards":160,"./mont":162,"./short":163}],162:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("inherits"),a=e("./base"),o=e("../utils");function s(e){a.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,a),t.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(c,a.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},s.prototype.point=function(e,t){return new c(this,e,t)},s.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),o=i.redMul(n),s=t.z.redMul(a.redAdd(o).redSqr()),c=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var a=i.length-1;a>=0;a--)0===i[a]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":172,"./base":159,"bn.js":88,inherits:243}],163:[function(e,t,r){"use strict";var n=e("../utils"),i=e("bn.js"),a=e("inherits"),o=e("./base"),s=n.assert;function c(e){o.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function d(e,t,r,n){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(c,o),t.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new i(e.a,16),b:new i(e.b,16)}}):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),a=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(a).fromRed(),n.redSub(a).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,a,o,s,c,u,d,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,p=this.n.clone(),h=new i(1),m=new i(0),b=new i(0),v=new i(1),g=0;0!==f.cmpn(0);){var y=p.div(f);u=p.sub(y.mul(f)),d=b.sub(y.mul(h));var _=v.sub(y.mul(m));if(!n&&u.cmp(l)<0)t=c.neg(),r=h,n=u.neg(),a=d;else if(n&&2===++g)break;c=u,p=f,f=u,b=h,h=d,v=m,m=_}o=u.neg(),s=d;var w=n.sqr().add(a.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=t,s=r),n.negative&&(n=n.neg(),a=a.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:a},{a:o,b:s}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),s=a.mul(n.a),c=i.mul(r.b),u=a.mul(n.b);return{k1:e.sub(o).sub(s),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],c=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),n[2*a]=s,n[2*a+1]=c,i[2*a]=o.k1,i[2*a+1]=o.k2}for(var u=this._wnafMulAdd(1,n,i,2*a,r),d=0;d<2*a;d++)n[d]=null,i[d]=null;return u},a(u,o.BasePoint),c.prototype.point=function(e,t,r){return new u(this,e,t,r)},c.prototype.pointFromJSON=function(e,t){return u.fromJSON(this,e,t)},u.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},u.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},u.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(i))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(i))}},n},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),a=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(d,o.BasePoint),c.prototype.jpoint=function(e,t,r){return new d(this,e,t,r)},d.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},d.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},d.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=a.redSub(o);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),d=u.redMul(s),l=n.redMul(u),f=c.redSqr().redIAdd(d).redISub(l).redISub(l),p=c.redMul(l.redISub(f)).redISub(a.redMul(d)),h=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,p,h)},d.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),o=r.redSub(n),s=i.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),u=c.redMul(o),d=r.redMul(c),l=s.redSqr().redIAdd(u).redISub(d).redISub(d),f=s.redMul(d.redISub(l)).redISub(i.redMul(u)),p=this.z.redMul(o);return this.curve.jpoint(l,f,p)},d.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,a=this.x,o=this.y,s=this.z,c=s.redSqr().redSqr(),u=o.redAdd(o);for(t=0;t<e;t++){var d=a.redSqr(),l=u.redSqr(),f=l.redSqr(),p=d.redAdd(d).redIAdd(d).redIAdd(n.redMul(c)),h=a.redMul(l),m=p.redSqr().redISub(h.redAdd(h)),b=h.redISub(m),v=p.redMul(b);v=v.redIAdd(v).redISub(f);var g=u.redMul(s);t+1<e&&(c=c.redMul(f)),a=m,s=g,u=v}return this.curve.jpoint(a,u.redMul(i),s)},d.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},d.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(a);o=o.redIAdd(o);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(o).redISub(o),u=a.redIAdd(a);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),l=this.y.redSqr(),f=l.redSqr(),p=this.x.redAdd(l).redSqr().redISub(d).redISub(f);p=p.redIAdd(p);var h=d.redAdd(d).redIAdd(d),m=h.redSqr(),b=f.redIAdd(f);b=(b=b.redIAdd(b)).redIAdd(b),e=m.redISub(p).redISub(p),t=h.redMul(p.redISub(e)).redISub(b),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},d.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(a);o=o.redIAdd(o);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(o).redISub(o);e=c;var u=a.redIAdd(a);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(o.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),l=this.y.redSqr(),f=this.x.redMul(l),p=this.x.redSub(d).redMul(this.x.redAdd(d));p=p.redAdd(p).redIAdd(p);var h=f.redIAdd(f),m=(h=h.redIAdd(h)).redAdd(h);e=p.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(d);var b=l.redSqr();b=(b=(b=b.redIAdd(b)).redIAdd(b)).redIAdd(b),t=p.redMul(h.redISub(e)).redISub(b)}return this.curve.jpoint(e,t,r)},d.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),a=t.redSqr(),o=r.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(i)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(o),d=s.redSqr().redISub(u.redAdd(u)),l=u.redISub(d),f=o.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var p=s.redMul(l).redISub(f),h=r.redAdd(r).redMul(n);return this.curve.jpoint(d,p,h)},d.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),a=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(a)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=i.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(c),d=t.redMul(u);d=(d=d.redIAdd(d)).redIAdd(d);var l=this.x.redMul(s).redISub(d);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(o.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var p=this.z.redAdd(o).redSqr().redISub(r).redISub(s);return this.curve.jpoint(l,f,p)},d.prototype.mul=function(e,t){return e=new i(e,t),this.curve._wnafMul(this,e)},d.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},d.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},d.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},d.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":172,"./base":159,"bn.js":88,inherits:243}],164:[function(e,t,r){"use strict";var n,i=r,a=e("hash.js"),o=e("./curve"),s=e("./utils").assert;function c(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":161,"./precomputed/secp256k1":171,"./utils":172,"hash.js":228}],165:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("hmac-drbg"),a=e("../utils"),o=e("../curves"),s=e("brorand"),c=a.assert,u=e("./key"),d=e("./signature");function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(o,e),"Unknown curve "+e),e=o[e]),e instanceof o.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=l,l.prototype.keyPair=function(e){return new u(this,e)},l.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),a=this.n.sub(new n(2));;){var o=new n(t.generate(r));if(!(o.cmp(a)>0))return o.iaddn(1),this.keyFromPrivate(o)}},l.prototype._truncateToN=function(e,t,r){var i;if(n.isBN(e)||"number"==typeof e)i=(e=new n(e,16)).byteLength();else if("object"==typeof e)i=e.length,e=new n(e,16);else{var a=e.toString();i=a.length+1>>>1,e=new n(a,16)}"number"!=typeof r&&(r=8*i);var o=r-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},l.prototype.sign=function(e,t,r,a){if("object"==typeof r&&(a=r,r=null),a||(a={}),"string"!=typeof e&&"number"!=typeof e&&!n.isBN(e)){c("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),c(e.length>>>0===e.length);for(var o=0;o<e.length;o++)c((255&e[o])===e[o])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,a.msgBitLength),c(!e.isNeg(),"Can not sign a negative message");var s=this.n.byteLength(),u=t.getPrivate().toArray("be",s),l=e.toArray("be",s);c(new n(l).eq(e),"Can not sign message");for(var f=new i({hash:this.hash,entropy:u,nonce:l,pers:a.pers,persEnc:a.persEnc||"utf8"}),p=this.n.sub(new n(1)),h=0;;h++){var m=a.k?a.k(h):new n(f.generate(this.n.byteLength()));if(!((m=this._truncateToN(m,!0)).cmpn(1)<=0||m.cmp(p)>=0)){var b=this.g.mul(m);if(!b.isInfinity()){var v=b.getX(),g=v.umod(this.n);if(0!==g.cmpn(0)){var y=m.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var _=(b.getY().isOdd()?1:0)|(0!==v.cmp(g)?2:0);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),_^=1),new d({r:g,s:y,recoveryParam:_})}}}}}},l.prototype.verify=function(e,t,r,n,i){i||(i={}),e=this._truncateToN(e,!1,i.msgBitLength),r=this.keyFromPublic(r,n);var a=(t=new d(t,"hex")).r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,c=o.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},l.prototype.recoverPubKey=function(e,t,r,i){c((3&r)===r,"The recovery param is more than two bits"),t=new d(t,i);var a=this.n,o=new n(e),s=t.r,u=t.s,l=1&r,f=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");s=f?this.curve.pointFromX(s.add(this.curve.n),l):this.curve.pointFromX(s,l);var p=t.r.invm(a),h=a.sub(o).mul(p).umod(a),m=u.mul(p).umod(a);return this.g.mulAdd(h,s,m)},l.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new d(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch(e){continue}if(a.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":164,"../utils":172,"./key":166,"./signature":167,"bn.js":88,brorand:90,"hmac-drbg":241}],166:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils").assert;function a(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=a,a.fromPublic=function(e,t,r){return t instanceof a?t:new a(e,{pub:t,pubEnc:r})},a.fromPrivate=function(e,t,r){return t instanceof a?t:new a(e,{priv:t,privEnc:r})},a.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},a.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},a.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},a.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},a.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},a.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../utils":172,"bn.js":88}],167:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils"),a=i.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(a(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===e[t.place])return!1;for(var i=0,a=0,o=t.place;a<n;a++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function d(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}t.exports=o,o.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var a=c(e,r);if(!1===a)return!1;if(a+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;if(128&e[r.place])return!1;var u=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var d=c(e,r);if(!1===d)return!1;if(e.length!==d+r.place)return!1;if(128&e[r.place])return!1;var l=e.slice(r.place,d+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new n(u),this.s=new n(l),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];d(n,t.length),(n=n.concat(t)).push(2),d(n,r.length);var a=n.concat(r),o=[48];return d(o,a.length),o=o.concat(a),i.encode(o,e)}},{"../utils":172,"bn.js":88}],168:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("../curves"),a=e("../utils"),o=a.assert,s=a.parseBytes,c=e("./key"),u=e("./signature");function d(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof d))return new d(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}t.exports=d,d.prototype.sign=function(e,t){e=s(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),a=this.encodePoint(i),o=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),c=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:a})},d.prototype.verify=function(e,t,r){if(e=s(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(a)},d.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return a.intFromLE(e.digest()).umod(this.curve.n)},d.prototype.keyFromPublic=function(e){return c.fromPublic(this,e)},d.prototype.keyFromSecret=function(e){return c.fromSecret(this,e)},d.prototype.makeSignature=function(e){return e instanceof u?e:new u(this,e)},d.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},d.prototype.decodePoint=function(e){var t=(e=a.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=!!(128&e[t]),i=a.intFromLE(r);return this.curve.pointFromY(i,n)},d.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},d.prototype.decodeInt=function(e){return a.intFromLE(e)},d.prototype.isPoint=function(e){return e instanceof this.pointClass}},{"../curves":164,"../utils":172,"./key":169,"./signature":170,"hash.js":228}],169:[function(e,t,r){"use strict";var n=e("../utils"),i=n.assert,a=n.parseBytes,o=n.cachedProperty;function s(e,t){this.eddsa=e,this._secret=a(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a(t.pub)}s.fromPublic=function(e,t){return t instanceof s?t:new s(e,{pub:t})},s.fromSecret=function(e,t){return t instanceof s?t:new s(e,{secret:t})},s.prototype.secret=function(){return this._secret},o(s,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),o(s,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),o(s,"privBytes",function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n}),o(s,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),o(s,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),o(s,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),s.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},s.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},s.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},s.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},t.exports=s},{"../utils":172}],170:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils"),a=i.assert,o=i.cachedProperty,s=i.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=s(t)),Array.isArray(t)&&(a(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}o(c,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),o(c,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),o(c,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),o(c,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=c},{"../utils":172,"bn.js":88}],171:[function(e,t,r){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},{}],172:[function(e,t,r){"use strict";var n=r,i=e("bn.js"),a=e("minimalistic-assert"),o=e("minimalistic-crypto-utils");n.assert=a,n.toArray=o.toArray,n.zero2=o.zero2,n.toHex=o.toHex,n.encode=o.encode,n.getNAF=function(e,t,r){var n,i=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n<i.length;n+=1)i[n]=0;var a=1<<t+1,o=e.clone();for(n=0;n<i.length;n++){var s,c=o.andln(a-1);o.isOdd()?(s=c>(a>>1)-1?(a>>1)-c:c,o.isubn(s)):s=0,i[n]=s,o.iushrn(1)}return i},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,a=0;e.cmpn(-i)>0||t.cmpn(-a)>0;){var o,s,c=e.andln(3)+i&3,u=t.andln(3)+a&3;3===c&&(c=-1),3===u&&(u=-1),o=1&c?3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:0,r[0].push(o),s=1&u?3!==(n=t.andln(7)+a&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*i===o+1&&(i=1-i),2*a===s+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},{"bn.js":88,"minimalistic-assert":328,"minimalistic-crypto-utils":329}],173:[function(e,t,r){t.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}},{}],174:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hasCORS=void 0;let n=!1;try{n="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}r.hasCORS=n},{}],175:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.encode=function(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},r.decode=function(e){let t={},r=e.split("&");for(let e=0,n=r.length;e<n;e++){let n=r[e].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}},{}],176:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.parse=function(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),a=e.indexOf("]");-1!=r&&-1!=a&&(e=e.substring(0,r)+e.substring(r,a).replace(/:/g,";")+e.substring(a,e.length));let o=n.exec(e||""),s={},c=14;for(;c--;)s[i[c]]=o[c]||"";-1!=r&&-1!=a&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0);return s.pathNames=function(e,t){const r=t.replace(/\/{2,9}/g,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,s.path),s.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,n){t&&(r[t]=n)}),r}(0,s.query),s};const n=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"]},{}],177:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.defaultBinaryType=r.globalThisShim=r.nextTick=void 0,r.createCookieJar=function(){},r.nextTick="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),r.globalThisShim="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")(),r.defaultBinaryType="arraybuffer"},{}],178:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WebTransport=r.WebSocket=r.NodeWebSocket=r.XHR=r.NodeXHR=r.Fetch=r.nextTick=r.parse=r.installTimerFunctions=r.transports=r.TransportError=r.Transport=r.protocol=r.SocketWithUpgrade=r.SocketWithoutUpgrade=r.Socket=void 0;const n=e("./socket.js");Object.defineProperty(r,"Socket",{enumerable:!0,get:function(){return n.Socket}});var i=e("./socket.js");Object.defineProperty(r,"SocketWithoutUpgrade",{enumerable:!0,get:function(){return i.SocketWithoutUpgrade}}),Object.defineProperty(r,"SocketWithUpgrade",{enumerable:!0,get:function(){return i.SocketWithUpgrade}}),r.protocol=n.Socket.protocol;var a=e("./transport.js");Object.defineProperty(r,"Transport",{enumerable:!0,get:function(){return a.Transport}}),Object.defineProperty(r,"TransportError",{enumerable:!0,get:function(){return a.TransportError}});var o=e("./transports/index.js");Object.defineProperty(r,"transports",{enumerable:!0,get:function(){return o.transports}});var s=e("./util.js");Object.defineProperty(r,"installTimerFunctions",{enumerable:!0,get:function(){return s.installTimerFunctions}});var c=e("./contrib/parseuri.js");Object.defineProperty(r,"parse",{enumerable:!0,get:function(){return c.parse}});var u=e("./globals.node.js");Object.defineProperty(r,"nextTick",{enumerable:!0,get:function(){return u.nextTick}});var d=e("./transports/polling-fetch.js");Object.defineProperty(r,"Fetch",{enumerable:!0,get:function(){return d.Fetch}});var l=e("./transports/polling-xhr.node.js");Object.defineProperty(r,"NodeXHR",{enumerable:!0,get:function(){return l.XHR}});var f=e("./transports/polling-xhr.js");Object.defineProperty(r,"XHR",{enumerable:!0,get:function(){return f.XHR}});var p=e("./transports/websocket.node.js");Object.defineProperty(r,"NodeWebSocket",{enumerable:!0,get:function(){return p.WS}});var h=e("./transports/websocket.js");Object.defineProperty(r,"WebSocket",{enumerable:!0,get:function(){return h.WS}});var m=e("./transports/webtransport.js");Object.defineProperty(r,"WebTransport",{enumerable:!0,get:function(){return m.WT}})},{"./contrib/parseuri.js":176,"./globals.node.js":177,"./socket.js":179,"./transport.js":180,"./transports/index.js":181,"./transports/polling-fetch.js":182,"./transports/polling-xhr.js":183,"./transports/polling-xhr.node.js":183,"./transports/websocket.js":185,"./transports/websocket.node.js":185,"./transports/webtransport.js":186,"./util.js":187}],179:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Socket=r.SocketWithUpgrade=r.SocketWithoutUpgrade=void 0;const i=e("./transports/index.js"),a=e("./util.js"),o=e("./contrib/parseqs.js"),s=e("./contrib/parseuri.js"),c=e("@socket.io/component-emitter"),u=e("engine.io-parser"),d=e("./globals.node.js"),l=(0,n(e("debug")).default)("engine.io-client:socket"),f="function"==typeof addEventListener&&"function"==typeof removeEventListener,p=[];f&&addEventListener("offline",()=>{l("closing %d connection(s) because the network was lost",p.length),p.forEach(e=>e())},!1);class h extends c.Emitter{constructor(e,t){if(super(),this.binaryType=d.defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const r=(0,s.parse)(e);t.hostname=r.host,t.secure="https"===r.protocol||"wss"===r.protocol,t.port=r.port,r.query&&(t.query=r.query)}else t.host&&(t.hostname=(0,s.parse)(t.host).host);(0,a.installTimerFunctions)(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=(0,o.decode)(this.opts.query)),f&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(l("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},p.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=(0,d.createCookieJar)()),this._open()}createTransport(e){l('creating transport "%s"',e);const t=Object.assign({},this.opts.query);t.EIO=u.protocol,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return l("options: %j",r),new this._transportsByName[e](r)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&h.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){l("setting transport %s",e.name),this.transport&&(l("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){l("socket open"),this.readyState="open",h.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(l('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}else l('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();l("flushing %d packets in socket",e.length),this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const r=this.writeBuffer[t].data;if(r&&(e+=(0,a.byteLength)(r)),t>0&&e>this._maxPayload)return l("only send %d out of %d packets",t,this.writeBuffer.length),this.writeBuffer.slice(0,t);e+=2}return l("payload size is %d (max: %d)",e,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(l("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,(0,d.nextTick)(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,r){return this._sendPacket("message",e,t,r),this}send(e,t,r){return this._sendPacket("message",e,t,r),this}_sendPacket(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this._onClose("forced close"),l("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(l("socket error %j",e),h.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return l("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(l('socket close with reason: "%s"',e),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),f&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=p.indexOf(this._offlineEventListener);-1!==e&&(l("removing listener for the 'offline' event"),p.splice(e,1))}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}r.SocketWithoutUpgrade=h,h.protocol=u.protocol;class m extends h{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade){l("starting upgrade probes");for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}}_probe(e){l('probing transport "%s"',e);let t=this.createTransport(e),r=!1;h.priorWebsocketSuccess=!1;const n=()=>{r||(l('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",n=>{if(!r)if("pong"===n.type&&"probe"===n.data){if(l('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;h.priorWebsocketSuccess="websocket"===t.name,l('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||"closed"!==this.readyState&&(l("changing transport and sending upgrade packet"),u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{l('probe transport "%s" failed',e);const r=new Error("probe error");r.transport=t.name,this.emitReserved("upgradeError",r)}}))};function i(){r||(r=!0,u(),t.close(),t=null)}const a=r=>{const n=new Error("probe error: "+r);n.transport=t.name,i(),l('probe transport "%s" failed because of error: %s',e,r),this.emitReserved("upgradeError",n)};function o(){a("transport closed")}function s(){a("socket closed")}function c(e){t&&e.name!==t.name&&(l('"%s" works - aborting "%s"',e.name,t.name),i())}const u=()=>{t.removeListener("open",n),t.removeListener("error",a),t.removeListener("close",o),this.off("close",s),this.off("upgrading",c)};t.once("open",n),t.once("error",a),t.once("close",o),this.once("close",s),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}r.SocketWithUpgrade=m;r.Socket=class extends m{constructor(e,t={}){const r="object"==typeof e?e:t;(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>i.transports[e]).filter(e=>!!e)),super(e,r)}}},{"./contrib/parseqs.js":175,"./contrib/parseuri.js":176,"./globals.node.js":177,"./transports/index.js":181,"./util.js":187,"@socket.io/component-emitter":64,debug:188,"engine.io-parser":194}],180:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Transport=r.TransportError=void 0;const i=e("engine.io-parser"),a=e("@socket.io/component-emitter"),o=e("./util.js"),s=e("./contrib/parseqs.js"),c=(0,n(e("debug")).default)("engine.io-client:transport");class u extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}r.TransportError=u;class d extends a.Emitter{constructor(e){super(),this.writable=!1,(0,o.installTimerFunctions)(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new u(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState?this.write(e):c("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=(0,i.decodePacket)(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=(0,s.encode)(e);return t.length?"?"+t:""}}r.Transport=d},{"./contrib/parseqs.js":175,"./util.js":187,"@socket.io/component-emitter":64,debug:188,"engine.io-parser":194}],181:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.transports=void 0;const n=e("./polling-xhr.node.js"),i=e("./websocket.node.js"),a=e("./webtransport.js");r.transports={websocket:i.WS,webtransport:a.WT,polling:n.XHR}},{"./polling-xhr.node.js":183,"./websocket.node.js":185,"./webtransport.js":186}],182:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Fetch=void 0;const n=e("./polling.js");class i extends n.Polling{doPoll(){this._fetch().then(e=>{if(!e.ok)return this.onError("fetch read error",e.status,e);e.text().then(e=>this.onData(e))}).catch(e=>{this.onError("fetch read error",e)})}doWrite(e,t){this._fetch(e).then(e=>{if(!e.ok)return this.onError("fetch write error",e.status,e);t()}).catch(e=>{this.onError("fetch write error",e)})}_fetch(e){var t;const r=void 0!==e,n=new Headers(this.opts.extraHeaders);return r&&n.set("content-type","text/plain;charset=UTF-8"),null===(t=this.socket._cookieJar)||void 0===t||t.appendCookies(n),fetch(this.uri(),{method:r?"POST":"GET",body:r?e:null,headers:n,credentials:this.opts.withCredentials?"include":"omit"}).then(e=>{var t;return null===(t=this.socket._cookieJar)||void 0===t||t.parseCookies(e.headers.getSetCookie()),e})}}r.Fetch=i},{"./polling.js":184}],183:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.XHR=r.Request=r.BaseXHR=void 0;const i=e("./polling.js"),a=e("@socket.io/component-emitter"),o=e("../util.js"),s=e("../globals.node.js"),c=e("../contrib/has-cors.js"),u=(0,n(e("debug")).default)("engine.io-client:polling");function d(){}class l extends i.Polling{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){u("xhr poll");const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}r.BaseXHR=l;class f extends a.Emitter{constructor(e,t,r){super(),this.createRequest=e,(0,o.installTimerFunctions)(this,r),this._opts=r,this._method=r.method||"GET",this._uri=t,this._data=void 0!==r.data?r.data:null,this._create()}_create(){var e;const t=(0,o.pick)(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(t);try{u("xhr open %s: %s",this._method,this._uri),r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{r.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},u("xhr data %s",this._data),r.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=f.requestsCount++,f.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=d,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete f.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(r.Request=f,f.requestsCount=0,f.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",p);else if("function"==typeof addEventListener){const e="onpagehide"in s.globalThisShim?"pagehide":"unload";addEventListener(e,p,!1)}function p(){for(let e in f.requests)f.requests.hasOwnProperty(e)&&f.requests[e].abort()}const h=function(){const e=m({xdomain:!1});return e&&null!==e.responseType}();function m(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||c.hasCORS))return new XMLHttpRequest}catch(e){}if(!t)try{return new(s.globalThisShim[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}r.XHR=class extends l{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=h&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new f(m,this.uri(),e)}}},{"../contrib/has-cors.js":174,"../globals.node.js":177,"../util.js":187,"./polling.js":184,"@socket.io/component-emitter":64,debug:188}],184:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Polling=void 0;const i=e("../transport.js"),a=e("../util.js"),o=e("engine.io-parser"),s=(0,n(e("debug")).default)("engine.io-client:polling");class c extends i.Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{s("paused"),this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(s("we are currently polling - waiting to pause"),e++,this.once("pollComplete",function(){s("pre-pause polling complete"),--e||t()})),this.writable||(s("we are currently writing - waiting to pause"),e++,this.once("drain",function(){s("pre-pause writing complete"),--e||t()}))}else t()}_poll(){s("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){s("polling got data %s",e);(0,o.decodePayload)(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState?this._poll():s('ignoring poll - transport state "%s"',this.readyState))}doClose(){const e=()=>{s("writing close packet"),this.write([{type:"close"}])};"open"===this.readyState?(s("transport open - closing"),e()):(s("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,(0,o.encodePayload)(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=(0,a.randomString)()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}r.Polling=c},{"../transport.js":180,"../util.js":187,debug:188,"engine.io-parser":194}],185:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.WS=r.BaseWS=void 0;const i=e("../transport.js"),a=e("../util.js"),o=e("engine.io-parser"),s=e("../globals.node.js"),c=(0,n(e("debug")).default)("engine.io-client:websocket"),u="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class d extends i.Transport{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,r=u?{}:(0,a.pick)(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],n=t===e.length-1;(0,o.encodePacket)(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(e){c("websocket closed before onclose event")}n&&(0,s.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=(0,a.randomString)()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}r.BaseWS=d;const l=s.globalThisShim.WebSocket||s.globalThisShim.MozWebSocket;r.WS=class extends d{createSocket(e,t,r){return u?new l(e,t,r):t?new l(e,t):new l(e)}doWrite(e,t){this.ws.send(t)}}},{"../globals.node.js":177,"../transport.js":180,"../util.js":187,debug:188,"engine.io-parser":194}],186:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.WT=void 0;const i=e("../transport.js"),a=e("../globals.node.js"),o=e("engine.io-parser"),s=(0,n(e("debug")).default)("engine.io-client:webtransport");class c extends i.Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{s("transport closed gracefully"),this.onClose()}).catch(e=>{s("transport closed due to %s",e),this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=(0,o.createPacketDecoderStream)(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=(0,o.createPacketEncoderStream)();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();const i=()=>{r.read().then(({done:e,value:t})=>{e?s("session is closed"):(s("received chunk: %o",t),this.onPacket(t),i())}).catch(e=>{s("an error occurred while reading: %s",e)})};i();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],n=t===e.length-1;this._writer.write(r).then(()=>{n&&(0,a.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}}r.WT=c},{"../globals.node.js":177,"../transport.js":180,debug:188,"engine.io-parser":194}],187:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.pick=function(e,...t){return t.reduce((t,r)=>(e.hasOwnProperty(r)&&(t[r]=e[r]),t),{})},r.installTimerFunctions=function(e,t){t.useNativeTimers?(e.setTimeoutFn=i.bind(n.globalThisShim),e.clearTimeoutFn=a.bind(n.globalThisShim)):(e.setTimeoutFn=n.globalThisShim.setTimeout.bind(n.globalThisShim),e.clearTimeoutFn=n.globalThisShim.clearTimeout.bind(n.globalThisShim))},r.byteLength=function(e){if("string"==typeof e)return function(e){let t=0,r=0;for(let n=0,i=e.length;n<i;n++)t=e.charCodeAt(n),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(n++,r+=4);return r}(e);return Math.ceil((e.byteLength||e.size)*o)},r.randomString=function(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)};const n=e("./globals.node.js");const i=n.globalThisShim.setTimeout,a=n.globalThisShim.clearTimeout;const o=1.33},{"./globals.node.js":177}],188:[function(e,t,r){r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),e.splice(i,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch(e){}}(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},{"./common":189}],189:[function(e,t,r){t.exports=function(t){function r(e){let t,i,a,o=null;function s(...e){if(!s.enabled)return;const n=s,i=Number(new Date),a=i-(t||i);n.diff=a,n.prev=t,n.curr=i,t=i,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if("%%"===t)return"%";o++;const a=r.formatters[i];if("function"==typeof a){const r=e[o];t=a.call(n,r),e.splice(o,1),o--}return t}),r.formatArgs.call(n,e);(n.log||r.log).apply(n,e)}return s.namespace=e,s.useColors=r.useColors(),s.color=r.selectColor(e),s.extend=n,s.destroy=r.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==r.namespaces&&(i=r.namespaces,a=r.enabled(e)),a),set:e=>{o=e}}),"function"==typeof r.init&&r.init(s),s}function n(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},r.disable=function(){const e=[...r.names.map(i),...r.skips.map(i).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.namespaces=e,r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t<i;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.slice(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{r[e]=t[e]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:330}],190:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ERROR_PACKET=r.PACKET_TYPES_REVERSE=r.PACKET_TYPES=void 0;const n=Object.create(null);r.PACKET_TYPES=n,n.open="0",n.close="1",n.ping="2",n.pong="3",n.message="4",n.upgrade="5",n.noop="6";const i=Object.create(null);r.PACKET_TYPES_REVERSE=i,Object.keys(n).forEach(e=>{i[n[e]]=e});r.ERROR_PACKET={type:"error",data:"parser error"}},{}],191:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=r.encode=void 0;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)i[n.charCodeAt(e)]=e;r.encode=e=>{let t,r=new Uint8Array(e),i=r.length,a="";for(t=0;t<i;t+=3)a+=n[r[t]>>2],a+=n[(3&r[t])<<4|r[t+1]>>4],a+=n[(15&r[t+1])<<2|r[t+2]>>6],a+=n[63&r[t+2]];return i%3==2?a=a.substring(0,a.length-1)+"=":i%3==1&&(a=a.substring(0,a.length-2)+"=="),a};r.decode=e=>{let t,r,n,a,o,s=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const d=new ArrayBuffer(s),l=new Uint8Array(d);for(t=0;t<c;t+=4)r=i[e.charCodeAt(t)],n=i[e.charCodeAt(t+1)],a=i[e.charCodeAt(t+2)],o=i[e.charCodeAt(t+3)],l[u++]=r<<2|n>>4,l[u++]=(15&n)<<4|a>>2,l[u++]=(3&a)<<6|63&o;return d}},{}],192:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decodePacket=void 0;const n=e("./commons.js"),i=e("./contrib/base64-arraybuffer.js"),a="function"==typeof ArrayBuffer;r.decodePacket=(e,t)=>{if("string"!=typeof e)return{type:"message",data:s(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:o(e.substring(1),t)};return n.PACKET_TYPES_REVERSE[r]?e.length>1?{type:n.PACKET_TYPES_REVERSE[r],data:e.substring(1)}:{type:n.PACKET_TYPES_REVERSE[r]}:n.ERROR_PACKET};const o=(e,t)=>{if(a){const r=(0,i.decode)(e);return s(r,t)}return{base64:!0,data:e}},s=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer},{"./commons.js":190,"./contrib/base64-arraybuffer.js":191}],193:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.encodePacket=void 0,r.encodePacketToBinary=function(e,t){if(i&&e.data instanceof Blob)return e.data.arrayBuffer().then(u).then(t);if(a&&(e.data instanceof ArrayBuffer||o(e.data)))return t(u(e.data));s(e,!1,e=>{d||(d=new TextEncoder),t(d.encode(e))})};const n=e("./commons.js"),i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),a="function"==typeof ArrayBuffer,o=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,s=({type:e,data:t},r,s)=>i&&t instanceof Blob?r?s(t):c(t,s):a&&(t instanceof ArrayBuffer||o(t))?r?s(t):c(new Blob([t]),s):s(n.PACKET_TYPES[e]+(t||""));r.encodePacket=s;const c=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+(e||""))},r.readAsDataURL(e)};function u(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let d},{"./commons.js":190}],194:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decodePayload=r.decodePacket=r.encodePayload=r.encodePacket=r.protocol=void 0,r.createPacketEncoderStream=function(){return new TransformStream({transform(e,t){(0,n.encodePacketToBinary)(e,r=>{const n=r.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,n)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(n))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(r)})}})},r.createPacketDecoderStream=function(e,t){s||(s=new TextDecoder);const r=[];let n=0,o=-1,d=!1;return new TransformStream({transform(l,f){for(r.push(l);;){if(0===n){if(c(r)<1)break;const e=u(r,1);d=!(128&~e[0]),o=127&e[0],n=o<126?3:126===o?1:2}else if(1===n){if(c(r)<2)break;const e=u(r,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),n=3}else if(2===n){if(c(r)<8)break;const e=u(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){f.enqueue(a.ERROR_PACKET);break}o=i*Math.pow(2,32)+t.getUint32(4),n=3}else{if(c(r)<o)break;const e=u(r,o);f.enqueue((0,i.decodePacket)(d?e:s.decode(e),t)),n=0}if(0===o||o>e){f.enqueue(a.ERROR_PACKET);break}}}})};const n=e("./encodePacket.js");Object.defineProperty(r,"encodePacket",{enumerable:!0,get:function(){return n.encodePacket}});const i=e("./decodePacket.js");Object.defineProperty(r,"decodePacket",{enumerable:!0,get:function(){return i.decodePacket}});const a=e("./commons.js"),o=String.fromCharCode(30);r.encodePayload=(e,t)=>{const r=e.length,i=new Array(r);let a=0;e.forEach((e,s)=>{(0,n.encodePacket)(e,!1,e=>{i[s]=e,++a===r&&t(i.join(o))})})};let s;function c(e){return e.reduce((e,t)=>e+t.length,0)}function u(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let n=0;for(let i=0;i<t;i++)r[i]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),r}r.decodePayload=(e,t)=>{const r=e.split(o),n=[];for(let e=0;e<r.length;e++){const a=(0,i.decodePacket)(r[e],t);if(n.push(a),"error"===a.type)break}return n},r.protocol=4},{"./commons.js":190,"./decodePacket.js":192,"./encodePacket.js":193}],195:[function(e,t,r){"use strict";var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch(e){n=!1}t.exports=n},{}],196:[function(e,t,r){"use strict";t.exports=EvalError},{}],197:[function(e,t,r){"use strict";t.exports=Error},{}],198:[function(e,t,r){"use strict";t.exports=RangeError},{}],199:[function(e,t,r){"use strict";t.exports=ReferenceError},{}],200:[function(e,t,r){"use strict";t.exports=SyntaxError},{}],201:[function(e,t,r){"use strict";t.exports=TypeError},{}],202:[function(e,t,r){"use strict";t.exports=URIError},{}],203:[function(e,t,r){"use strict";t.exports=Object},{}],204:[function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(e,t){return new Promise(function(r,n){function i(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}v(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,r)}(e,i,{once:!0})})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,a,o,s;if(u(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=d(e))>0&&o.length>i&&!o.warned){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,s=c,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]: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}(i):b(i,i.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(a){n.once&&e.removeEventListener(t,i),r(a)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return d(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)a(c,this,t);else{var u=c.length,d=b(c,u);for(r=0;r<u;++r)a(d[r],this,t)}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){return u(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,i,a,o;if(u(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(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?n(this._events):[]}},{}],205:[function(e,t,r){arguments[4][204][0].apply(r,arguments)},{dup:204}],206:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("md5.js");t.exports=function(e,t,r,a){if(n.isBuffer(e)||(e=n.from(e,"binary")),t&&(n.isBuffer(t)||(t=n.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,s=n.alloc(o),c=n.alloc(a||0),u=n.alloc(0);o>0||a>0;){var d=new i;d.update(u),d.update(e),t&&d.update(t),u=d.digest();var l=0;if(o>0){var f=s.length-o;l=Math.min(o,u.length),u.copy(s,f,0,l),o-=l}if(l<u.length&&a>0){var p=c.length-a,h=Math.min(a,u.length-l);u.copy(c,p,l,l+h),a-=h}}return u.fill(0),{key:s,iv:c}}},{"md5.js":281,"safe-buffer":387}],207:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FakeEvent=void 0;r.FakeEvent=class{NONE=0;CAPTURING_PHASE=1;AT_TARGET=2;BUBBLING_PHASE=3;type;bubbles;cancelable;defaultPrevented=!1;composed=!1;currentTarget=null;eventPhase=this.NONE;isTrusted=!0;target=null;timeStamp=0;cancelBubble=!1;returnValue=!0;srcElement=null;constructor(e,t={}){this.type=e,this.bubbles=t.bubbles??!1,this.cancelable=t.cancelable??!1}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}stopPropagation(){}stopImmediatePropagation(){}composedPath(){return[]}initEvent(e,t,r){}}},{}],208:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FakeEventTarget=void 0;r.FakeEventTarget=class{listeners={};addEventListener(e,t,r){t&&(this.listeners[e]??=[],this.listeners[e].push({callback:"function"==typeof t?t:t.handleEvent,once:"object"==typeof r&&!0===r.once}))}removeEventListener(e,t,r){this.listeners[e]&&t&&(this.listeners[e]=this.listeners[e].filter(e=>e.callback!==("function"==typeof t?t:t.handleEvent)))}dispatchEvent(e){if(!e||"string"!=typeof e.type)throw new Error("invalid event object");const t=this.listeners[e.type];if(!t)return!0;for(const r of[...t]){try{r.callback.call(this,e)}catch(e){setTimeout(()=>{throw e},0)}r.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}},{}],209:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FakeMediaStreamTrack=void 0;const n=e("uuid"),i=e("./fakeEvents/FakeEventTarget"),a=e("./fakeEvents/FakeEvent"),o=e("./utils");class s extends i.FakeEventTarget{#e;#t;#r;#n;#i;#a;#o;#s;#c;#u;#d;#l=null;#f=null;#p=null;#h=null;#m=null;constructor({kind:e,id:t,label:r,contentHint:i,enabled:a,muted:o,readyState:s,capabilities:c,constraints:u,settings:d,data:l}){super(),this.#e=t??(0,n.v4)(),this.#t=e,this.#r=r??"",this.#o=i??"",this.#i=a??!0,this.#a=o??!1,this.#n=s??"live",this.#s=c??{},this.#c=u??{},this.#u=d??{},this.#d=l??{}}get id(){return this.#e}get kind(){return this.#t}get label(){return this.#r}get contentHint(){return this.#o}set contentHint(e){this.#o=e}get enabled(){return this.#i}set enabled(e){const t=this.#i!==e;this.#i=e,t&&this.dispatchEvent(new a.FakeEvent("enabledchange"))}get muted(){return this.#a}get readyState(){return this.#n}get data(){return this.#d}set data(e){this.#d=e}get onmute(){return this.#l}set onmute(e){this.#l&&this.removeEventListener("mute",this.#l),this.#l=e,e&&this.addEventListener("mute",e)}get onunmute(){return this.#f}set onunmute(e){this.#f&&this.removeEventListener("unmute",this.#f),this.#f=e,e&&this.addEventListener("unmute",e)}get onended(){return this.#p}set onended(e){this.#p&&this.removeEventListener("ended",this.#p),this.#p=e,e&&this.addEventListener("ended",e)}get onenabledchange(){return this.#h}set onenabledchange(e){this.#h&&this.removeEventListener("enabledchange",this.#h),this.#h=e,e&&this.addEventListener("enabledchange",e)}get onstopped(){return this.#m}set onstopped(e){this.#m&&this.removeEventListener("stopped",this.#m),this.#m=e,e&&this.addEventListener("stopped",e)}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}stop(){"ended"!==this.#n&&(this.#n="ended",this.dispatchEvent(new a.FakeEvent("stopped")))}clone({id:e,data:t}={}){return new s({id:e??(0,n.v4)(),kind:this.#t,label:this.#r,contentHint:this.#o,enabled:this.#i,muted:this.#a,readyState:this.#n,capabilities:(0,o.clone)(this.#s),constraints:(0,o.clone)(this.#c),settings:(0,o.clone)(this.#u),data:t??(0,o.clone)(this.#d)})}getCapabilities(){return this.#s}getConstraints(){return this.#c}async applyConstraints(e={}){return this.#c=e,Promise.resolve()}getSettings(){return this.#u}remoteStop(){"ended"!==this.#n&&(this.#n="ended",this.dispatchEvent(new a.FakeEvent("stopped")),this.dispatchEvent(new a.FakeEvent("ended")))}remoteMute(){this.#a||(this.#a=!0,this.dispatchEvent(new a.FakeEvent("mute")))}remoteUnmute(){this.#a&&(this.#a=!1,this.dispatchEvent(new a.FakeEvent("unmute")))}}r.FakeMediaStreamTrack=s},{"./fakeEvents/FakeEvent":207,"./fakeEvents/FakeEventTarget":208,"./utils":210,uuid:439}],210:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.clone=function(e){return void 0===e?void 0:Number.isNaN(e)?NaN:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}},{}],211:[function(e,t,r){"use strict";var n=e("is-callable"),i=Object.prototype.toString,a=Object.prototype.hasOwnProperty;t.exports=function(e,t,r){if(!n(t))throw new TypeError("iterator must be a function");var o,s;arguments.length>=3&&(o=r),s=e,"[object Array]"===i.call(s)?function(e,t,r){for(var n=0,i=e.length;n<i;n++)a.call(e,n)&&(null==r?t(e[n],n,e):t.call(r,e[n],n,e))}(e,t,o):"string"==typeof e?function(e,t,r){for(var n=0,i=e.length;n<i;n++)null==r?t(e.charAt(n),n,e):t.call(r,e.charAt(n),n,e)}(e,t,o):function(e,t,r){for(var n in e)a.call(e,n)&&(null==r?t(e[n],n,e):t.call(r,e[n],n,e))}(e,t,o)}},{"is-callable":245}],212:[function(e,t,r){"use strict";var n=Object.prototype.toString,i=Math.max,a=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r};t.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==n.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var r,o=function(e,t){for(var r=[],n=t||0,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r}(arguments,1),s=i(0,t.length-o.length),c=[],u=0;u<s;u++)c[u]="$"+u;if(r=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(c,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof r){var n=t.apply(this,a(o,arguments));return Object(n)===n?n:this}return t.apply(e,a(o,arguments))}),t.prototype){var d=function(){};d.prototype=t.prototype,r.prototype=new d,d.prototype=null}return r}},{}],213:[function(e,t,r){"use strict";var n=e("./implementation");t.exports=Function.prototype.bind||n},{"./implementation":212}],214:[function(e,t,r){"use strict";var n,i=e("es-object-atoms"),a=e("es-errors"),o=e("es-errors/eval"),s=e("es-errors/range"),c=e("es-errors/ref"),u=e("es-errors/syntax"),d=e("es-errors/type"),l=e("es-errors/uri"),f=e("math-intrinsics/abs"),p=e("math-intrinsics/floor"),h=e("math-intrinsics/max"),m=e("math-intrinsics/min"),b=e("math-intrinsics/pow"),v=e("math-intrinsics/round"),g=e("math-intrinsics/sign"),y=Function,_=function(e){try{return y('"use strict"; return ('+e+").constructor;")()}catch(e){}},w=e("gopd"),k=e("es-define-property"),S=function(){throw new d},x=w?function(){try{return S}catch(e){try{return w(arguments,"callee").get}catch(e){return S}}}():S,E=e("has-symbols")(),P=e("get-proto"),R=e("get-proto/Object.getPrototypeOf"),M=e("get-proto/Reflect.getPrototypeOf"),C=e("call-bind-apply-helpers/functionApply"),T=e("call-bind-apply-helpers/functionCall"),A={},I="undefined"!=typeof Uint8Array&&P?P(Uint8Array):n,O={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":E&&P?P([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":a,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?n:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":A,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":E&&P?P(P([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&E&&P?P((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":w,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":s,"%ReferenceError%":c,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&E&&P?P((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":E&&P?P(""[Symbol.iterator]()):n,"%Symbol%":E?Symbol:n,"%SyntaxError%":u,"%ThrowTypeError%":x,"%TypedArray%":I,"%TypeError%":d,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":l,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet,"%Function.prototype.call%":T,"%Function.prototype.apply%":C,"%Object.defineProperty%":k,"%Object.getPrototypeOf%":R,"%Math.abs%":f,"%Math.floor%":p,"%Math.max%":h,"%Math.min%":m,"%Math.pow%":b,"%Math.round%":v,"%Math.sign%":g,"%Reflect.getPrototypeOf%":M};if(P)try{null.error}catch(e){var j=P(P(e));O["%Error.prototype%"]=j}var D=function e(t){var r;if("%AsyncFunction%"===t)r=_("async function () {}");else if("%GeneratorFunction%"===t)r=_("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=_("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&P&&(r=P(i.prototype))}return O[t]=r,r},L={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},B=e("function-bind"),N=e("hasown"),F=B.call(T,Array.prototype.concat),U=B.call(C,Array.prototype.splice),q=B.call(T,String.prototype.replace),z=B.call(T,String.prototype.slice),V=B.call(T,RegExp.prototype.exec),W=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,G=/\\(\\)?/g,H=function(e,t){var r,n=e;if(N(L,n)&&(n="%"+(r=L[n])[0]+"%"),N(O,n)){var i=O[n];if(i===A&&(i=D(n)),void 0===i&&!t)throw new d("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new u("intrinsic "+e+" does not exist!")};t.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new d("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new d('"allowMissing" argument must be a boolean');if(null===V(/^%?[^%]*%?$/,e))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=z(e,0,1),r=z(e,-1);if("%"===t&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new u("invalid intrinsic syntax, expected opening `%`");var n=[];return q(e,W,function(e,t,r,i){n[n.length]=r?q(i,G,"$1"):t||e}),n}(e),n=r.length>0?r[0]:"",i=H("%"+n+"%",t),a=i.name,o=i.value,s=!1,c=i.alias;c&&(n=c[0],U(r,F([0,1],c)));for(var l=1,f=!0;l<r.length;l+=1){var p=r[l],h=z(p,0,1),m=z(p,-1);if(('"'===h||"'"===h||"`"===h||'"'===m||"'"===m||"`"===m)&&h!==m)throw new u("property names with quotes must have matching quotes");if("constructor"!==p&&f||(s=!0),N(O,a="%"+(n+="."+p)+"%"))o=O[a];else if(null!=o){if(!(p in o)){if(!t)throw new d("base intrinsic for "+e+" exists, but the property is not available.");return}if(w&&l+1>=r.length){var b=w(o,p);o=(f=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:o[p]}else f=N(o,p),o=o[p];f&&!s&&(O[a]=o)}}return o}},{"call-bind-apply-helpers/functionApply":127,"call-bind-apply-helpers/functionCall":128,"es-define-property":195,"es-errors":197,"es-errors/eval":196,"es-errors/range":198,"es-errors/ref":199,"es-errors/syntax":200,"es-errors/type":201,"es-errors/uri":202,"es-object-atoms":203,"function-bind":213,"get-proto":217,"get-proto/Object.getPrototypeOf":215,"get-proto/Reflect.getPrototypeOf":216,gopd:219,"has-symbols":225,hasown:240,"math-intrinsics/abs":273,"math-intrinsics/floor":274,"math-intrinsics/max":276,"math-intrinsics/min":277,"math-intrinsics/pow":278,"math-intrinsics/round":279,"math-intrinsics/sign":280}],215:[function(e,t,r){"use strict";var n=e("es-object-atoms");t.exports=n.getPrototypeOf||null},{"es-object-atoms":203}],216:[function(e,t,r){"use strict";t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},{}],217:[function(e,t,r){"use strict";var n=e("./Reflect.getPrototypeOf"),i=e("./Object.getPrototypeOf"),a=e("dunder-proto/get");t.exports=n?function(e){return n(e)}:i?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return i(e)}:a?function(e){return a(e)}:null},{"./Object.getPrototypeOf":215,"./Reflect.getPrototypeOf":216,"dunder-proto/get":155}],218:[function(e,t,r){"use strict";t.exports=Object.getOwnPropertyDescriptor},{}],219:[function(e,t,r){"use strict";var n=e("./gOPD");if(n)try{n([],"length")}catch(e){n=null}t.exports=n},{"./gOPD":218}],220:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Logger=void 0;const i=n(e("debug")),a="h264-profile-level-id";r.Logger=class{constructor(e){e?(this._debug=(0,i.default)(`${a}:${e}`),this._warn=(0,i.default)(`${a}:WARN:${e}`),this._error=(0,i.default)(`${a}:ERROR:${e}`)):(this._debug=(0,i.default)(a),this._warn=(0,i.default)(`${a}:WARN`),this._error=(0,i.default)(`${a}: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:222}],221:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ProfileLevelId=r.Level=r.Profile=void 0,r.parseProfileLevelId=f,r.profileLevelIdToString=p,r.profileToString=function(e){switch(e){case i.ConstrainedBaseline:return"ConstrainedBaseline";case i.Baseline:return"Baseline";case i.Main:return"Main";case i.ConstrainedHigh:return"ConstrainedHigh";case i.High:return"High";case i.PredictiveHigh444:return"PredictiveHigh444";default:return void n.warn(`profileToString() | unrecognized profile ${e}`)}},r.levelToString=function(e){switch(e){case a.L1_b:return"1b";case a.L1:return"1";case a.L1_1:return"1.1";case a.L1_2:return"1.2";case a.L1_3:return"1.3";case a.L2:return"2";case a.L2_1:return"2.1";case a.L2_2:return"2.2";case a.L3:return"3";case a.L3_1:return"3.1";case a.L3_2:return"3.2";case a.L4:return"4";case a.L4_1:return"4.1";case a.L4_2:return"4.2";case a.L5:return"5";case a.L5_1:return"5.1";case a.L5_2:return"5.2";default:return void n.warn(`levelToString() | unrecognized level ${e}`)}},r.parseSdpProfileLevelId=h,r.isSameProfile=function(e={},t={}){const r=h(e),n=h(t);return Boolean(r&&n&&r.profile===n.profile)},r.isSameProfileAndLevel=function(e={},t={}){const r=h(e),n=h(t);return Boolean(r&&n&&r.profile===n.profile&&r.level==n.level)},r.generateProfileLevelIdStringForAnswer=function(e={},t={}){if(!e["profile-level-id"]&&!t["profile-level-id"])return void n.warn("generateProfileLevelIdStringForAnswer() | profile-level-id missing in local and remote params");const r=h(e),i=h(t);if(!r)throw new TypeError("invalid local_profile_level_id");if(!i)throw new TypeError("invalid remote_profile_level_id");if(r.profile!==i.profile)throw new TypeError("H264 Profile mismatch");const s=b(e)&&b(t),c=r.level,u=i.level,d=(f=c,m=u,function(e,t){return e===a.L1_b?t!==a.L1&&t!==a.L1_b:t===a.L1_b?e!==a.L1:e<t}(f,m)?f:m),l=s?c:d;var f,m;return n.debug(`generateProfileLevelIdStringForAnswer() | result [profile:${r.profile}, level:${l}]`),p(new o(r.profile,l))},r.supportedLevel=function(e,t){for(let r=l.length-1;r>=0;--r){const i=l[r];if(256*i.max_macroblock_frame_size<=e&&i.max_macroblocks_per_second<=t*i.max_macroblock_frame_size)return n.debug(`supportedLevel() | result [max_frame_pixel_count:${e}, max_fps:${t}, level:${i.level}]`),i.level}return void n.warn(`supportedLevel() | no level supported [max_frame_pixel_count:${e}, max_fps:${t}]`)};const n=new(e("./Logger").Logger);var i,a;!function(e){e[e.ConstrainedBaseline=1]="ConstrainedBaseline",e[e.Baseline=2]="Baseline",e[e.Main=3]="Main",e[e.ConstrainedHigh=4]="ConstrainedHigh",e[e.High=5]="High",e[e.PredictiveHigh444=6]="PredictiveHigh444"}(i||(r.Profile=i={})),function(e){e[e.L1_b=0]="L1_b",e[e.L1=10]="L1",e[e.L1_1=11]="L1_1",e[e.L1_2=12]="L1_2",e[e.L1_3=13]="L1_3",e[e.L2=20]="L2",e[e.L2_1=21]="L2_1",e[e.L2_2=22]="L2_2",e[e.L3=30]="L3",e[e.L3_1=31]="L3_1",e[e.L3_2=32]="L3_2",e[e.L4=40]="L4",e[e.L4_1=41]="L4_1",e[e.L4_2=42]="L4_2",e[e.L5=50]="L5",e[e.L5_1=51]="L5_1",e[e.L5_2=52]="L5_2"}(a||(r.Level=a={}));class o{constructor(e,t){this.profile=e,this.level=t}}r.ProfileLevelId=o;const s=new o(i.ConstrainedBaseline,a.L3_1);class c{constructor(e){this.mask=~m("x",e),this.masked_value=m("1",e)}isMatch(e){return this.masked_value===(e&this.mask)}}class u{constructor(e,t,r){this.profile_idc=e,this.profile_iop=t,this.profile=r}}const d=[new u(66,new c("x1xx0000"),i.ConstrainedBaseline),new u(77,new c("1xxx0000"),i.ConstrainedBaseline),new u(88,new c("11xx0000"),i.ConstrainedBaseline),new u(66,new c("x0xx0000"),i.Baseline),new u(88,new c("10xx0000"),i.Baseline),new u(77,new c("0x0x0000"),i.Main),new u(100,new c("00000000"),i.High),new u(100,new c("00001100"),i.ConstrainedHigh),new u(244,new c("00000000"),i.PredictiveHigh444)],l=[{max_macroblocks_per_second:1485,max_macroblock_frame_size:99,level:a.L1},{max_macroblocks_per_second:1485,max_macroblock_frame_size:99,level:a.L1_b},{max_macroblocks_per_second:3e3,max_macroblock_frame_size:396,level:a.L1_1},{max_macroblocks_per_second:6e3,max_macroblock_frame_size:396,level:a.L1_2},{max_macroblocks_per_second:11880,max_macroblock_frame_size:396,level:a.L1_3},{max_macroblocks_per_second:11880,max_macroblock_frame_size:396,level:a.L2},{max_macroblocks_per_second:19800,max_macroblock_frame_size:792,level:a.L2_1},{max_macroblocks_per_second:20250,max_macroblock_frame_size:1620,level:a.L2_2},{max_macroblocks_per_second:40500,max_macroblock_frame_size:1620,level:a.L3},{max_macroblocks_per_second:108e3,max_macroblock_frame_size:3600,level:a.L3_1},{max_macroblocks_per_second:216e3,max_macroblock_frame_size:5120,level:a.L3_2},{max_macroblocks_per_second:245760,max_macroblock_frame_size:8192,level:a.L4},{max_macroblocks_per_second:245760,max_macroblock_frame_size:8192,level:a.L4_1},{max_macroblocks_per_second:522240,max_macroblock_frame_size:8704,level:a.L4_2},{max_macroblocks_per_second:589824,max_macroblock_frame_size:22080,level:a.L5},{max_macroblocks_per_second:983040,max_macroblock_frame_size:36864,level:a.L5_1},{max_macroblocks_per_second:2073600,max_macroblock_frame_size:36864,level:a.L5_2}];function f(e){if("string"!=typeof e||6!==e.length)return;const t=parseInt(e,16);if(0===t)return;const r=255&t,i=t>>8&255,s=t>>16&255;let c;switch(r){case a.L1_1:c=16&i?a.L1_b:a.L1_1;break;case a.L1:case a.L1_2:case a.L1_3:case a.L2:case a.L2_1:case a.L2_2:case a.L3:case a.L3_1:case a.L3_2:case a.L4:case a.L4_1:case a.L4_2:case a.L5:case a.L5_1:case a.L5_2:c=r;break;default:return void n.warn(`parseProfileLevelId() | unrecognized level_idc [str:${e}, level_idc:${r}]`)}for(const t of d)if(s===t.profile_idc&&t.profile_iop.isMatch(i))return n.debug(`parseProfileLevelId() | result [str:${e}, profile:${t.profile}, level:${c}]`),new o(t.profile,c);n.warn(`parseProfileLevelId() | unrecognized profile_idc/profile_iop combination [str:${e}, profile_idc:${s}, profile_iop:${i}]`)}function p(e){if(e.level==a.L1_b)switch(e.profile){case i.ConstrainedBaseline:return"42f00b";case i.Baseline:return"42100b";case i.Main:return"4d100b";default:return void n.warn(`profileLevelIdToString() | Level 1_b not is allowed for profile ${e.profile}`)}let t;switch(e.profile){case i.ConstrainedBaseline:t="42e0";break;case i.Baseline:t="4200";break;case i.Main:t="4d00";break;case i.ConstrainedHigh:t="640c";break;case i.High:t="6400";break;case i.PredictiveHigh444:t="f400";break;default:return void n.warn(`profileLevelIdToString() | unrecognized profile ${e.profile}`)}let r=e.level.toString(16);return 1===r.length&&(r=`0${r}`),`${t}${r}`}function h(e={}){const t=e["profile-level-id"];return t?f(t):s}function m(e,t){return Number(t[0]===e)<<7|Number(t[1]===e)<<6|Number(t[2]===e)<<5|Number(t[3]===e)<<4|Number(t[4]===e)<<3|Number(t[5]===e)<<2|Number(t[6]===e)<<1|Number(t[7]===e)}function b(e={}){const t=e["level-asymmetry-allowed"];return!0===t||1===t||"1"===t}},{"./Logger":220}],222:[function(e,t,r){arguments[4][84][0].apply(r,arguments)},{"./common":223,dup:84}],223:[function(e,t,r){arguments[4][85][0].apply(r,arguments)},{dup:85,ms:330}],224:[function(e,t,r){"use strict";var n=e("es-define-property"),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},t.exports=i},{"es-define-property":195}],225:[function(e,t,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=e("./shams");t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},{"./shams":226}],226:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var n in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var a=Object.getOwnPropertyDescriptor(e,t);if(42!==a.value||!0!==a.enumerable)return!1}return!0}},{}],227:[function(e,t,r){"use strict";var n=e("has-symbols/shams");t.exports=function(){return n()&&!!Symbol.toStringTag}},{"has-symbols/shams":226}],228:[function(e,t,r){var n=r;n.utils=e("./hash/utils"),n.common=e("./hash/common"),n.sha=e("./hash/sha"),n.ripemd=e("./hash/ripemd"),n.hmac=e("./hash/hmac"),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},{"./hash/common":229,"./hash/hmac":230,"./hash/ripemd":231,"./hash/sha":232,"./hash/utils":239}],229:[function(e,t,r){"use strict";var n=e("./utils"),i=e("minimalistic-assert");function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}r.BlockHash=a,a.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},a.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},a.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,a=8;a<this.padLength;a++)n[i++]=0;return n}},{"./utils":239,"minimalistic-assert":328}],230:[function(e,t,r){"use strict";var n=e("./utils"),i=e("minimalistic-assert");function a(e,t,r){if(!(this instanceof a))return new a(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}t.exports=a,a.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},a.prototype.update=function(e,t){return this.inner.update(e,t),this},a.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},{"./utils":239,"minimalistic-assert":328}],231:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./common"),a=n.rotl32,o=n.sum32,s=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function d(){if(!(this instanceof d))return new d;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function f(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function p(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(d,u),r.ripemd160=d,d.blockSize=512,d.outSize=160,d.hmacStrength=192,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],d=this.h[4],g=r,y=n,_=i,w=u,k=d,S=0;S<80;S++){var x=o(a(c(r,l(S,n,i,u),e[h[S]+t],f(S)),b[S]),d);r=d,d=u,u=a(i,10),i=n,n=x,x=o(a(c(g,l(79-S,y,_,w),e[m[S]+t],p(S)),v[S]),k),g=k,k=w,w=a(_,10),_=y,y=x}x=s(this.h[1],i,w),this.h[1]=s(this.h[2],u,k),this.h[2]=s(this.h[3],d,g),this.h[3]=s(this.h[4],r,y),this.h[4]=s(this.h[0],n,_),this.h[0]=x},d.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],b=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],v=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":229,"./utils":239}],232:[function(e,t,r){"use strict";r.sha1=e("./sha/1"),r.sha224=e("./sha/224"),r.sha256=e("./sha/256"),r.sha384=e("./sha/384"),r.sha512=e("./sha/512")},{"./sha/1":233,"./sha/224":234,"./sha/256":235,"./sha/384":236,"./sha/512":237}],233:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../common"),a=e("./common"),o=n.rotl32,s=n.sum32,c=n.sum32_5,u=a.ft_1,d=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function f(){if(!(this instanceof f))return new f;d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(f,d),t.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=o(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],a=this.h[1],d=this.h[2],f=this.h[3],p=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),m=c(o(i,5),u(h,a,d,f),p,r[n],l[h]);p=f,f=d,d=o(a,30),a=i,i=m}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],d),this.h[3]=s(this.h[3],f),this.h[4]=s(this.h[4],p)},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":229,"../utils":239,"./common":238}],234:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./256");function a(){if(!(this instanceof a))return new a;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(a,i),t.exports=a,a.blockSize=512,a.outSize=224,a.hmacStrength=192,a.padLength=64,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},{"../utils":239,"./256":235}],235:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../common"),a=e("./common"),o=e("minimalistic-assert"),s=n.sum32,c=n.sum32_4,u=n.sum32_5,d=a.ch32,l=a.maj32,f=a.s0_256,p=a.s1_256,h=a.g0_256,m=a.g1_256,b=i.BlockHash,v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function g(){if(!(this instanceof g))return new g;b.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}n.inherits(g,b),t.exports=g,g.blockSize=512,g.outSize=256,g.hmacStrength=192,g.padLength=64,g.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=c(m(r[n-2]),r[n-7],h(r[n-15]),r[n-16]);var i=this.h[0],a=this.h[1],b=this.h[2],v=this.h[3],g=this.h[4],y=this.h[5],_=this.h[6],w=this.h[7];for(o(this.k.length===r.length),n=0;n<r.length;n++){var k=u(w,p(g),d(g,y,_),this.k[n],r[n]),S=s(f(i),l(i,a,b));w=_,_=y,y=g,g=s(v,k),v=b,b=a,a=i,i=s(k,S)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],b),this.h[3]=s(this.h[3],v),this.h[4]=s(this.h[4],g),this.h[5]=s(this.h[5],y),this.h[6]=s(this.h[6],_),this.h[7]=s(this.h[7],w)},g.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":229,"../utils":239,"./common":238,"minimalistic-assert":328}],236:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./512");function a(){if(!(this instanceof a))return new a;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(a,i),t.exports=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},{"../utils":239,"./512":237}],237:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../common"),a=e("minimalistic-assert"),o=n.rotr64_hi,s=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,d=n.sum64,l=n.sum64_hi,f=n.sum64_lo,p=n.sum64_4_hi,h=n.sum64_4_lo,m=n.sum64_5_hi,b=n.sum64_5_lo,v=i.BlockHash,g=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=g,this.W=new Array(160)}function _(e,t,r,n,i){var a=e&r^~e&i;return a<0&&(a+=4294967296),a}function w(e,t,r,n,i,a){var o=t&n^~t&a;return o<0&&(o+=4294967296),o}function k(e,t,r,n,i){var a=e&r^e&i^r&i;return a<0&&(a+=4294967296),a}function S(e,t,r,n,i,a){var o=t&n^t&a^n&a;return o<0&&(o+=4294967296),o}function x(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function E(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=o(e,t,14)^o(e,t,18)^o(t,e,9);return r<0&&(r+=4294967296),r}function R(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function M(e,t){var r=o(e,t,1)^o(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function C(e,t){var r=s(e,t,1)^s(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function T(e,t){var r=o(e,t,19)^o(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}function A(e,t){var r=s(e,t,19)^s(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(y,v),t.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=T(r[n-4],r[n-3]),a=A(r[n-4],r[n-3]),o=r[n-14],s=r[n-13],c=M(r[n-30],r[n-29]),u=C(r[n-30],r[n-29]),d=r[n-32],l=r[n-31];r[n]=p(i,a,o,s,c,u,d,l),r[n+1]=h(i,a,o,s,c,u,d,l)}},y.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],c=this.h[4],u=this.h[5],p=this.h[6],h=this.h[7],v=this.h[8],g=this.h[9],y=this.h[10],M=this.h[11],C=this.h[12],T=this.h[13],A=this.h[14],I=this.h[15];a(this.k.length===r.length);for(var O=0;O<r.length;O+=2){var j=A,D=I,L=P(v,g),B=R(v,g),N=_(v,g,y,M,C),F=w(v,g,y,M,C,T),U=this.k[O],q=this.k[O+1],z=r[O],V=r[O+1],W=m(j,D,L,B,N,F,U,q,z,V),G=b(j,D,L,B,N,F,U,q,z,V);j=x(n,i),D=E(n,i),L=k(n,i,o,s,c),B=S(n,i,o,s,c,u);var H=l(j,D,L,B),K=f(j,D,L,B);A=C,I=T,C=y,T=M,y=v,M=g,v=l(p,h,W,G),g=f(h,h,W,G),p=c,h=u,c=o,u=s,o=n,s=i,n=l(W,G,H,K),i=f(W,G,H,K)}d(this.h,0,n,i),d(this.h,2,o,s),d(this.h,4,c,u),d(this.h,6,p,h),d(this.h,8,v,g),d(this.h,10,y,M),d(this.h,12,C,T),d(this.h,14,A,I)},y.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":229,"../utils":239,"minimalistic-assert":328}],238:[function(e,t,r){"use strict";var n=e("../utils").rotr32;function i(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}r.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?o(t,r,n):2===e?a(t,r,n):void 0},r.ch32=i,r.maj32=a,r.p32=o,r.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},r.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},r.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":239}],239:[function(e,t,r){"use strict";var n=e("minimalistic-assert"),i=e("inherits");function a(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=i,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):a(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i<e.length;i++)r[i]=0|e[i];return r},r.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},r.htonl=o,r.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=o(i)),r+=c(i.toString(16))}return r},r.zero2=s,r.zero8=c,r.join32=function(e,t,r,i){var a=r-t;n(a%4==0);for(var o=new Array(a/4),s=0,c=t;s<o.length;s++,c+=4){var u;u="big"===i?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],o[s]=u>>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var a=e[n];"big"===t?(r[i]=a>>>24,r[i+1]=a>>>16&255,r[i+2]=a>>>8&255,r[i+3]=255&a):(r[i+3]=a>>>24,r[i+2]=a>>>16&255,r[i+1]=a>>>8&255,r[i]=255&a)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<<t|e>>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],a=n+e[t+1]>>>0,o=(a<n?1:0)+r+i;e[t]=o>>>0,e[t+1]=a},r.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,a,o,s){var c=0,u=t;return c+=(u=u+n>>>0)<t?1:0,c+=(u=u+a>>>0)<a?1:0,e+r+i+o+(c+=(u=u+s>>>0)<s?1:0)>>>0},r.sum64_4_lo=function(e,t,r,n,i,a,o,s){return t+n+a+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,a,o,s,c,u){var d=0,l=t;return d+=(l=l+n>>>0)<t?1:0,d+=(l=l+a>>>0)<a?1:0,d+=(l=l+s>>>0)<s?1:0,e+r+i+o+c+(d+=(l=l+u>>>0)<u?1:0)>>>0},r.sum64_5_lo=function(e,t,r,n,i,a,o,s,c,u){return t+n+a+s+u>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:243,"minimalistic-assert":328}],240:[function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,a=e("function-bind");t.exports=a.call(n,i)},{"function-bind":213}],241:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("minimalistic-crypto-utils"),a=e("minimalistic-assert");function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}t.exports=o,o.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},o.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},o.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=i.toArray(e,t),r=i.toArray(r,n),a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var o=a.slice(0,e);return this._update(r),this._reseed++,i.encode(o,t)}},{"hash.js":228,"minimalistic-assert":328,"minimalistic-crypto-utils":329}],242:[function(e,t,r){
20
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
21
- r.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,c=(1<<s)-1,u=c>>1,d=-7,l=r?i-1:0,f=r?-1:1,p=e[t+l];for(l+=f,a=p&(1<<-d)-1,p>>=-d,d+=s;d>0;a=256*a+e[t+l],l+=f,d-=8);for(o=a&(1<<-d)-1,a>>=-d,d+=n;d>0;o=256*o+e[t+l],l+=f,d-=8);if(0===a)a=1-u;else{if(a===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=u}return(p?-1:1)*o*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var o,s,c,u=8*a-i-1,d=(1<<u)-1,l=d>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=d):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+l>=1?f/c:f*Math.pow(2,1-l))*c>=2&&(o++,c/=2),o+l>=d?(s=0,o=d):o+l>=1?(s=(t*c-1)*Math.pow(2,i),o+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&s,p+=h,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+p]=255&o,p+=h,o/=256,u-=8);e[r+p-h]|=128*m}},{}],243:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],244:[function(e,t,r){"use strict";var n=e("has-tostringtag/shams")(),i=e("call-bound")("Object.prototype.toString"),a=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},o=function(e){return!!a(e)||null!==e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"callee"in e&&"[object Function]"===i(e.callee)},s=function(){return a(arguments)}();a.isLegacyArguments=o,t.exports=s?a:o},{"call-bound":132,"has-tostringtag/shams":227}],245:[function(e,t,r){"use strict";var n,i,a=Function.prototype.toString,o="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof o&&"function"==typeof Object.defineProperty)try{n=Object.defineProperty({},"length",{get:function(){throw i}}),i={},o(function(){throw 42},null,n)}catch(e){e!==i&&(o=null)}else o=null;var s=/^\s*class\b/,c=function(e){try{var t=a.call(e);return s.test(t)}catch(e){return!1}},u=function(e){try{return!c(e)&&(a.call(e),!0)}catch(e){return!1}},d=Object.prototype.toString,l="function"==typeof Symbol&&!!Symbol.toStringTag,f=!(0 in[,]),p=function(){return!1};if("object"==typeof document){var h=document.all;d.call(h)===d.call(document.all)&&(p=function(e){if((f||!e)&&(void 0===e||"object"==typeof e))try{var t=d.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}t.exports=o?function(e){if(p(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{o(e,null,n)}catch(e){if(e!==i)return!1}return!c(e)&&u(e)}:function(e){if(p(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(l)return u(e);if(c(e))return!1;var t=d.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&u(e)}},{}],246:[function(e,t,r){"use strict";var n,i=e("call-bound"),a=e("safe-regex-test")(/^\s*(?:function)?\*/),o=e("has-tostringtag/shams")(),s=e("get-proto"),c=i("Object.prototype.toString"),u=i("Function.prototype.toString");t.exports=function(e){if("function"!=typeof e)return!1;if(a(u(e)))return!0;if(!o)return"[object GeneratorFunction]"===c(e);if(!s)return!1;if(void 0===n){var t=function(){if(!o)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&s(t)}return s(e)===n}},{"call-bound":132,"get-proto":217,"has-tostringtag/shams":227,"safe-regex-test":388}],247:[function(e,t,r){"use strict";var n,i=e("call-bound"),a=e("has-tostringtag/shams")(),o=e("hasown"),s=e("gopd");if(a){var c=i("RegExp.prototype.exec"),u={},d=function(){throw u},l={toString:d,valueOf:d};"symbol"==typeof Symbol.toPrimitive&&(l[Symbol.toPrimitive]=d),n=function(e){if(!e||"object"!=typeof e)return!1;var t=s(e,"lastIndex");if(!(t&&o(t,"value")))return!1;try{c(e,l)}catch(e){return e===u}}}else{var f=i("Object.prototype.toString");n=function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===f(e)}}t.exports=n},{"call-bound":132,gopd:219,"has-tostringtag/shams":227,hasown:240}],248:[function(e,t,r){"use strict";var n=e("which-typed-array");t.exports=function(e){return!!n(e)}},{"which-typed-array":461}],249:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],250:[function(e,t,r){var n=e("jws");t.exports=function(e,t){t=t||{};var r=n.decode(e,t);if(!r)return null;var i=r.payload;if("string"==typeof i)try{var a=JSON.parse(i);null!==a&&"object"==typeof a&&(i=a)}catch(e){}return!0===t.complete?{header:r.header,payload:i,signature:r.signature}:i}},{jws:261}],251:[function(e,t,r){t.exports={decode:e("./decode"),verify:e("./verify"),sign:e("./sign"),JsonWebTokenError:e("./lib/JsonWebTokenError"),NotBeforeError:e("./lib/NotBeforeError"),TokenExpiredError:e("./lib/TokenExpiredError")}},{"./decode":250,"./lib/JsonWebTokenError":252,"./lib/NotBeforeError":253,"./lib/TokenExpiredError":254,"./sign":258,"./verify":259}],252:[function(e,t,r){var n=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};(n.prototype=Object.create(Error.prototype)).constructor=n,t.exports=n},{}],253:[function(e,t,r){var n=e("./JsonWebTokenError"),i=function(e,t){n.call(this,e),this.name="NotBeforeError",this.date=t};(i.prototype=Object.create(n.prototype)).constructor=i,t.exports=i},{"./JsonWebTokenError":252}],254:[function(e,t,r){var n=e("./JsonWebTokenError"),i=function(e,t){n.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};(i.prototype=Object.create(n.prototype)).constructor=i,t.exports=i},{"./JsonWebTokenError":252}],255:[function(e,t,r){var n=e("semver");t.exports=n.satisfies(process.version,"^6.12.0 || >=8.0.0")},{semver:257}],256:[function(e,t,r){var n=e("ms");t.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var i=n(e);if(void 0===i)return;return Math.floor(r+i/1e3)}return"number"==typeof e?r+e:void 0}},{ms:330}],257:[function(e,t,r){var n;r=t.exports=Q,n="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},r.SEMVER_SPEC_VERSION="2.0.0";var i=256,a=Number.MAX_SAFE_INTEGER||9007199254740991,o=i-6,s=r.re=[],c=r.safeRe=[],u=r.src=[],d=0,l="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",i],[l,o]];function p(e){for(var t=0;t<f.length;t++){var r=f[t][0],n=f[t][1];e=e.split(r+"*").join(r+"{0,"+n+"}").split(r+"+").join(r+"{1,"+n+"}")}return e}var h=d++;u[h]="0|[1-9]\\d*";var m=d++;u[m]="\\d+";var b=d++;u[b]="\\d*[a-zA-Z-]"+l+"*";var v=d++;u[v]="("+u[h]+")\\.("+u[h]+")\\.("+u[h]+")";var g=d++;u[g]="("+u[m]+")\\.("+u[m]+")\\.("+u[m]+")";var y=d++;u[y]="(?:"+u[h]+"|"+u[b]+")";var _=d++;u[_]="(?:"+u[m]+"|"+u[b]+")";var w=d++;u[w]="(?:-("+u[y]+"(?:\\."+u[y]+")*))";var k=d++;u[k]="(?:-?("+u[_]+"(?:\\."+u[_]+")*))";var S=d++;u[S]=l+"+";var x=d++;u[x]="(?:\\+("+u[S]+"(?:\\."+u[S]+")*))";var E=d++,P="v?"+u[v]+u[w]+"?"+u[x]+"?";u[E]="^"+P+"$";var R="[v=\\s]*"+u[g]+u[k]+"?"+u[x]+"?",M=d++;u[M]="^"+R+"$";var C=d++;u[C]="((?:<|>)?=?)";var T=d++;u[T]=u[m]+"|x|X|\\*";var A=d++;u[A]=u[h]+"|x|X|\\*";var I=d++;u[I]="[v=\\s]*("+u[A]+")(?:\\.("+u[A]+")(?:\\.("+u[A]+")(?:"+u[w]+")?"+u[x]+"?)?)?";var O=d++;u[O]="[v=\\s]*("+u[T]+")(?:\\.("+u[T]+")(?:\\.("+u[T]+")(?:"+u[k]+")?"+u[x]+"?)?)?";var j=d++;u[j]="^"+u[C]+"\\s*"+u[I]+"$";var D=d++;u[D]="^"+u[C]+"\\s*"+u[O]+"$";var L=d++;u[L]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var B=d++;u[B]="(?:~>?)";var N=d++;u[N]="(\\s*)"+u[B]+"\\s+",s[N]=new RegExp(u[N],"g"),c[N]=new RegExp(p(u[N]),"g");var F=d++;u[F]="^"+u[B]+u[I]+"$";var U=d++;u[U]="^"+u[B]+u[O]+"$";var q=d++;u[q]="(?:\\^)";var z=d++;u[z]="(\\s*)"+u[q]+"\\s+",s[z]=new RegExp(u[z],"g"),c[z]=new RegExp(p(u[z]),"g");var V=d++;u[V]="^"+u[q]+u[I]+"$";var W=d++;u[W]="^"+u[q]+u[O]+"$";var G=d++;u[G]="^"+u[C]+"\\s*("+R+")$|^$";var H=d++;u[H]="^"+u[C]+"\\s*("+P+")$|^$";var K=d++;u[K]="(\\s*)"+u[C]+"\\s*("+R+"|"+u[I]+")",s[K]=new RegExp(u[K],"g"),c[K]=new RegExp(p(u[K]),"g");var $=d++;u[$]="^\\s*("+u[I]+")\\s+-\\s+("+u[I]+")\\s*$";var J=d++;u[J]="^\\s*("+u[O]+")\\s+-\\s+("+u[O]+")\\s*$";var Y=d++;u[Y]="(<|>)?=?\\s*\\*";for(var X=0;X<35;X++)n(X,u[X]),s[X]||(s[X]=new RegExp(u[X]),c[X]=new RegExp(p(u[X])));function Z(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof Q)return e;if("string"!=typeof e)return null;if(e.length>i)return null;if(!(t.loose?c[M]:c[E]).test(e))return null;try{return new Q(e,t)}catch(e){return null}}function Q(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof Q){if(e.loose===t.loose)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>i)throw new TypeError("version is longer than "+i+" characters");if(!(this instanceof Q))return new Q(e,t);n("SemVer",e,t),this.options=t,this.loose=!!t.loose;var r=e.trim().match(t.loose?c[M]:c[E]);if(!r)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<a)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}r.parse=Z,r.valid=function(e,t){var r=Z(e,t);return r?r.version:null},r.clean=function(e,t){var r=Z(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null},r.SemVer=Q,Q.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},Q.prototype.toString=function(){return this.version},Q.prototype.compare=function(e){return n("SemVer.compare",this.version,this.options,e),e instanceof Q||(e=new Q(e,this.options)),this.compareMain(e)||this.comparePre(e)},Q.prototype.compareMain=function(e){return e instanceof Q||(e=new Q(e,this.options)),te(this.major,e.major)||te(this.minor,e.minor)||te(this.patch,e.patch)},Q.prototype.comparePre=function(e){if(e instanceof Q||(e=new Q(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var r=this.prerelease[t],i=e.prerelease[t];if(n("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return te(r,i)}while(++t)},Q.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},r.inc=function(e,t,r,n){"string"==typeof r&&(n=r,r=void 0);try{return new Q(e,r).inc(t,n).version}catch(e){return null}},r.diff=function(e,t){if(ae(e,t))return null;var r=Z(e),n=Z(t),i="";if(r.prerelease.length||n.prerelease.length){i="pre";var a="prerelease"}for(var o in r)if(("major"===o||"minor"===o||"patch"===o)&&r[o]!==n[o])return i+o;return a},r.compareIdentifiers=te;var ee=/^[0-9]+$/;function te(e,t){var r=ee.test(e),n=ee.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1}function re(e,t,r){return new Q(e,r).compare(new Q(t,r))}function ne(e,t,r){return re(e,t,r)>0}function ie(e,t,r){return re(e,t,r)<0}function ae(e,t,r){return 0===re(e,t,r)}function oe(e,t,r){return 0!==re(e,t,r)}function se(e,t,r){return re(e,t,r)>=0}function ce(e,t,r){return re(e,t,r)<=0}function ue(e,t,r,n){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return ae(e,r,n);case"!=":return oe(e,r,n);case">":return ne(e,r,n);case">=":return se(e,r,n);case"<":return ie(e,r,n);case"<=":return ce(e,r,n);default:throw new TypeError("Invalid operator: "+t)}}function de(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof de){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof de))return new de(e,t);e=e.trim().split(/\s+/).join(" "),n("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===le?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}r.rcompareIdentifiers=function(e,t){return te(t,e)},r.major=function(e,t){return new Q(e,t).major},r.minor=function(e,t){return new Q(e,t).minor},r.patch=function(e,t){return new Q(e,t).patch},r.compare=re,r.compareLoose=function(e,t){return re(e,t,!0)},r.rcompare=function(e,t,r){return re(t,e,r)},r.sort=function(e,t){return e.sort(function(e,n){return r.compare(e,n,t)})},r.rsort=function(e,t){return e.sort(function(e,n){return r.rcompare(e,n,t)})},r.gt=ne,r.lt=ie,r.eq=ae,r.neq=oe,r.gte=se,r.lte=ce,r.cmp=ue,r.Comparator=de;var le={};function fe(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof fe)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new fe(e.raw,t);if(e instanceof de)return new fe(e.value,t);if(!(this instanceof fe))return new fe(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+this.raw);this.format()}function pe(e){return!e||"x"===e.toLowerCase()||"*"===e}function he(e,t,r,n,i,a,o,s,c,u,d,l,f){return((t=pe(r)?"":pe(n)?">="+r+".0.0":pe(i)?">="+r+"."+n+".0":">="+t)+" "+(s=pe(c)?"":pe(u)?"<"+(+c+1)+".0.0":pe(d)?"<"+c+"."+(+u+1)+".0":l?"<="+c+"."+u+"."+d+"-"+l:"<="+s)).trim()}function me(e,t,r){for(var i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(i=0;i<e.length;i++)if(n(e[i].semver),e[i].semver!==le&&e[i].semver.prerelease.length>0){var a=e[i].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0}function be(e,t,r){try{t=new fe(t,r)}catch(e){return!1}return t.test(e)}function ve(e,t,r,n){var i,a,o,s,c;switch(e=new Q(e,n),t=new fe(t,n),r){case">":i=ne,a=ce,o=ie,s=">",c=">=";break;case"<":i=ie,a=se,o=ne,s="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(be(e,t,n))return!1;for(var u=0;u<t.set.length;++u){var d=t.set[u],l=null,f=null;if(d.forEach(function(e){e.semver===le&&(e=new de(">=0.0.0")),l=l||e,f=f||e,i(e.semver,l.semver,n)?l=e:o(e.semver,f.semver,n)&&(f=e)}),l.operator===s||l.operator===c)return!1;if((!f.operator||f.operator===s)&&a(e,f.semver))return!1;if(f.operator===c&&o(e,f.semver))return!1}return!0}de.prototype.parse=function(e){var t=this.options.loose?c[G]:c[H],r=e.match(t);if(!r)throw new TypeError("Invalid comparator: "+e);this.operator=r[1],"="===this.operator&&(this.operator=""),r[2]?this.semver=new Q(r[2],this.options.loose):this.semver=le},de.prototype.toString=function(){return this.value},de.prototype.test=function(e){return n("Comparator.test",e,this.options.loose),this.semver===le||("string"==typeof e&&(e=new Q(e,this.options)),ue(e,this.operator,this.semver,this.options))},de.prototype.intersects=function(e,t){if(!(e instanceof de))throw new TypeError("a Comparator is required");var r;if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return r=new fe(e.value,t),be(this.value,r,t);if(""===e.operator)return r=new fe(this.value,t),be(e.semver,r,t);var n=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),a=this.semver.version===e.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),s=ue(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),c=ue(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||i||a&&o||s||c},r.Range=fe,fe.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range},fe.prototype.toString=function(){return this.range},fe.prototype.parseRange=function(e){var t=this.options.loose,r=t?c[J]:c[$];e=e.replace(r,he),n("hyphen replace",e),e=e.replace(c[K],"$1$2$3"),n("comparator trim",e,c[K]),e=(e=e.replace(c[N],"$1~")).replace(c[z],"$1^");var i=t?c[G]:c[H],a=e.split(" ").map(function(e){return function(e,t){return n("comp",e,t),e=function(e,t){return e.trim().split(/\s+/).map(function(e){return function(e,t){n("caret",e,t);var r=t.loose?c[W]:c[V];return e.replace(r,function(t,r,i,a,o){var s;return n("caret",e,t,r,i,a,o),pe(r)?s="":pe(i)?s=">="+r+".0.0 <"+(+r+1)+".0.0":pe(a)?s="0"===r?">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":">="+r+"."+i+".0 <"+(+r+1)+".0.0":o?(n("replaceCaret pr",o),s="0"===r?"0"===i?">="+r+"."+i+"."+a+"-"+o+" <"+r+"."+i+"."+(+a+1):">="+r+"."+i+"."+a+"-"+o+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+a+"-"+o+" <"+(+r+1)+".0.0"):(n("no pr"),s="0"===r?"0"===i?">="+r+"."+i+"."+a+" <"+r+"."+i+"."+(+a+1):">="+r+"."+i+"."+a+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+a+" <"+(+r+1)+".0.0"),n("caret return",s),s})}(e,t)}).join(" ")}(e,t),n("caret",e),e=function(e,t){return e.trim().split(/\s+/).map(function(e){return function(e,t){var r=t.loose?c[U]:c[F];return e.replace(r,function(t,r,i,a,o){var s;return n("tilde",e,t,r,i,a,o),pe(r)?s="":pe(i)?s=">="+r+".0.0 <"+(+r+1)+".0.0":pe(a)?s=">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":o?(n("replaceTilde pr",o),s=">="+r+"."+i+"."+a+"-"+o+" <"+r+"."+(+i+1)+".0"):s=">="+r+"."+i+"."+a+" <"+r+"."+(+i+1)+".0",n("tilde return",s),s})}(e,t)}).join(" ")}(e,t),n("tildes",e),e=function(e,t){return n("replaceXRanges",e,t),e.split(/\s+/).map(function(e){return function(e,t){e=e.trim();var r=t.loose?c[D]:c[j];return e.replace(r,function(t,r,i,a,o,s){n("xRange",e,t,r,i,a,o,s);var c=pe(i),u=c||pe(a),d=u||pe(o);return"="===r&&d&&(r=""),c?t=">"===r||"<"===r?"<0.0.0":"*":r&&d?(u&&(a=0),o=0,">"===r?(r=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):"<="===r&&(r="<",u?i=+i+1:a=+a+1),t=r+i+"."+a+"."+o):u?t=">="+i+".0.0 <"+(+i+1)+".0.0":d&&(t=">="+i+"."+a+".0 <"+i+"."+(+a+1)+".0"),n("xRange return",t),t})}(e,t)}).join(" ")}(e,t),n("xrange",e),e=function(e,t){return n("replaceStars",e,t),e.trim().replace(c[Y],"")}(e,t),n("stars",e),e}(e,this.options)},this).join(" ").split(/\s+/);return this.options.loose&&(a=a.filter(function(e){return!!e.match(i)})),a=a.map(function(e){return new de(e,this.options)},this)},fe.prototype.intersects=function(e,t){if(!(e instanceof fe))throw new TypeError("a Range is required");return this.set.some(function(r){return r.every(function(r){return e.set.some(function(e){return e.every(function(e){return r.intersects(e,t)})})})})},r.toComparators=function(e,t){return new fe(e,t).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})},fe.prototype.test=function(e){if(!e)return!1;"string"==typeof e&&(e=new Q(e,this.options));for(var t=0;t<this.set.length;t++)if(me(this.set[t],e,this.options))return!0;return!1},r.satisfies=be,r.maxSatisfying=function(e,t,r){var n=null,i=null;try{var a=new fe(t,r)}catch(e){return null}return e.forEach(function(e){a.test(e)&&(n&&-1!==i.compare(e)||(i=new Q(n=e,r)))}),n},r.minSatisfying=function(e,t,r){var n=null,i=null;try{var a=new fe(t,r)}catch(e){return null}return e.forEach(function(e){a.test(e)&&(n&&1!==i.compare(e)||(i=new Q(n=e,r)))}),n},r.minVersion=function(e,t){e=new fe(e,t);var r=new Q("0.0.0");if(e.test(r))return r;if(r=new Q("0.0.0-0"),e.test(r))return r;r=null;for(var n=0;n<e.set.length;++n){e.set[n].forEach(function(e){var t=new Q(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":r&&!ne(r,t)||(r=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}})}if(r&&e.test(r))return r;return null},r.validRange=function(e,t){try{return new fe(e,t).range||"*"}catch(e){return null}},r.ltr=function(e,t,r){return ve(e,t,"<",r)},r.gtr=function(e,t,r){return ve(e,t,">",r)},r.outside=ve,r.prerelease=function(e,t){var r=Z(e,t);return r&&r.prerelease.length?r.prerelease:null},r.intersects=function(e,t,r){return e=new fe(e,r),t=new fe(t,r),e.intersects(t)},r.coerce=function(e){if(e instanceof Q)return e;if("string"!=typeof e)return null;var t=e.match(c[L]);if(null==t)return null;return Z(t[1]+"."+(t[2]||"0")+"."+(t[3]||"0"))}},{}],258:[function(e,t,r){var n=e("./lib/timespan"),i=e("./lib/psSupported"),a=e("jws"),o=e("lodash.includes"),s=e("lodash.isboolean"),c=e("lodash.isinteger"),u=e("lodash.isnumber"),d=e("lodash.isplainobject"),l=e("lodash.isstring"),f=e("lodash.once"),p=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&p.splice(3,0,"PS256","PS384","PS512");var h={expiresIn:{isValid:function(e){return c(e)||l(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return c(e)||l(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return l(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:o.bind(null,p),message:'"algorithm" must be a valid string enum value'},header:{isValid:d,message:'"header" must be an object'},encoding:{isValid:l,message:'"encoding" must be a string'},issuer:{isValid:l,message:'"issuer" must be a string'},subject:{isValid:l,message:'"subject" must be a string'},jwtid:{isValid:l,message:'"jwtid" must be a string'},noTimestamp:{isValid:s,message:'"noTimestamp" must be a boolean'},keyid:{isValid:l,message:'"keyid" must be a string'},mutatePayload:{isValid:s,message:'"mutatePayload" must be a boolean'}},m={iat:{isValid:u,message:'"iat" should be a number of seconds'},exp:{isValid:u,message:'"exp" should be a number of seconds'},nbf:{isValid:u,message:'"nbf" should be a number of seconds'}};function b(e,t,r,n){if(!d(r))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach(function(i){var a=e[i];if(a){if(!a.isValid(r[i]))throw new Error(a.message)}else if(!t)throw new Error('"'+i+'" is not allowed in "'+n+'"')})}var v={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},g=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];t.exports=function(e,t,r,i){"function"==typeof r?(i=r,r={}):r=r||{};var o="object"==typeof e&&!Buffer.isBuffer(e),s=Object.assign({alg:r.algorithm||"HS256",typ:o?"JWT":void 0,kid:r.keyid},r.header);function c(e){if(i)return i(e);throw e}if(!t&&"none"!==r.algorithm)return c(new Error("secretOrPrivateKey must have a value"));if(void 0===e)return c(new Error("payload is required"));if(o){try{!function(e){b(m,!0,e,"payload")}(e)}catch(e){return c(e)}r.mutatePayload||(e=Object.assign({},e))}else{var u=g.filter(function(e){return void 0!==r[e]});if(u.length>0)return c(new Error("invalid "+u.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return c(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return c(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(e){b(h,!1,e,"options")}(r)}catch(e){return c(e)}var d=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:o&&(e.iat=d),void 0!==r.notBefore){try{e.nbf=n(r.notBefore,d)}catch(e){return c(e)}if(void 0===e.nbf)return c(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=n(r.expiresIn,d)}catch(e){return c(e)}if(void 0===e.exp)return c(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(v).forEach(function(t){var n=v[t];if(void 0!==r[t]){if(void 0!==e[n])return c(new Error('Bad "options.'+t+'" option. The payload already has an "'+n+'" property.'));e[n]=r[t]}});var l=r.encoding||"utf8";if("function"!=typeof i)return a.sign({header:s,payload:e,secret:t,encoding:l});i=i&&f(i),a.createSign({header:s,privateKey:t,payload:e,encoding:l}).once("error",i).once("done",function(e){i(null,e)})}},{"./lib/psSupported":255,"./lib/timespan":256,jws:261,"lodash.includes":266,"lodash.isboolean":267,"lodash.isinteger":268,"lodash.isnumber":269,"lodash.isplainobject":270,"lodash.isstring":271,"lodash.once":272}],259:[function(e,t,r){var n=e("./lib/JsonWebTokenError"),i=e("./lib/NotBeforeError"),a=e("./lib/TokenExpiredError"),o=e("./decode"),s=e("./lib/timespan"),c=e("./lib/psSupported"),u=e("jws"),d=["RS256","RS384","RS512","ES256","ES384","ES512"],l=["RS256","RS384","RS512"],f=["HS256","HS384","HS512"];c&&(d.splice(3,0,"PS256","PS384","PS512"),l.splice(3,0,"PS256","PS384","PS512")),t.exports=function(e,t,r,c){var p;if("function"!=typeof r||c||(c=r,r={}),r||(r={}),r=Object.assign({},r),p=c||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return p(new n("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return p(new n("nonce must be a non-empty string"));var h=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return p(new n("jwt must be provided"));if("string"!=typeof e)return p(new n("jwt must be a string"));var m,b=e.split(".");if(3!==b.length)return p(new n("jwt malformed"));try{m=o(e,{complete:!0})}catch(e){return p(e)}if(!m)return p(new n("invalid token"));var v,g=m.header;if("function"==typeof t){if(!c)return p(new n("verify must be called asynchronous if secret or public key is provided as a callback"));v=t}else v=function(e,r){return r(null,t)};return v(g,function(t,o){if(t)return p(new n("error in secret or public key callback: "+t.message));var c,v=""!==b[2].trim();if(!v&&o)return p(new n("jwt signature is required"));if(v&&!o)return p(new n("secret or public key must be provided"));if(v||r.algorithms||(r.algorithms=["none"]),r.algorithms||(r.algorithms=~o.toString().indexOf("BEGIN CERTIFICATE")||~o.toString().indexOf("BEGIN PUBLIC KEY")?d:~o.toString().indexOf("BEGIN RSA PUBLIC KEY")?l:f),!~r.algorithms.indexOf(m.header.alg))return p(new n("invalid algorithm"));try{c=u.verify(e,m.header.alg,o)}catch(e){return p(e)}if(!c)return p(new n("invalid signature"));var y=m.payload;if(void 0!==y.nbf&&!r.ignoreNotBefore){if("number"!=typeof y.nbf)return p(new n("invalid nbf value"));if(y.nbf>h+(r.clockTolerance||0))return p(new i("jwt not active",new Date(1e3*y.nbf)))}if(void 0!==y.exp&&!r.ignoreExpiration){if("number"!=typeof y.exp)return p(new n("invalid exp value"));if(h>=y.exp+(r.clockTolerance||0))return p(new a("jwt expired",new Date(1e3*y.exp)))}if(r.audience){var _=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(y.aud)?y.aud:[y.aud]).some(function(e){return _.some(function(t){return t instanceof RegExp?t.test(e):t===e})}))return p(new n("jwt audience invalid. expected: "+_.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&y.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(y.iss)))return p(new n("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&y.sub!==r.subject)return p(new n("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&y.jti!==r.jwtid)return p(new n("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&y.nonce!==r.nonce)return p(new n("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof y.iat)return p(new n("iat required when maxAge is specified"));var w=s(r.maxAge,y.iat);if(void 0===w)return p(new n('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(h>=w+(r.clockTolerance||0))return p(new a("maxAge exceeded",new Date(1e3*w)))}if(!0===r.complete){var k=m.signature;return p(null,{header:g,payload:y,signature:k})}return p(null,y)})}},{"./decode":250,"./lib/JsonWebTokenError":252,"./lib/NotBeforeError":253,"./lib/TokenExpiredError":254,"./lib/psSupported":255,"./lib/timespan":256,jws:261}],260:[function(e,t,r){var n,i=e("safe-buffer").Buffer,a=e("crypto"),o=e("ecdsa-sig-formatter"),s=e("util"),c="secret must be a string or buffer",u="key must be a string or a buffer",d="function"==typeof a.createPublicKey;function l(e){if(!i.isBuffer(e)&&"string"!=typeof e){if(!d)throw m(u);if("object"!=typeof e)throw m(u);if("string"!=typeof e.type)throw m(u);if("string"!=typeof e.asymmetricKeyType)throw m(u);if("function"!=typeof e.export)throw m(u)}}function f(e){if(!i.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw m("key must be a string, a buffer or an object")}function p(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function m(e){var t=[].slice.call(arguments,1),r=s.format.bind(s,e).apply(null,t);return new TypeError(r)}function b(e){var t;return t=e,i.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function v(e){return function(t,r){!function(e){if(!i.isBuffer(e)){if("string"==typeof e)return e;if(!d)throw m(c);if("object"!=typeof e)throw m(c);if("secret"!==e.type)throw m(c);if("function"!=typeof e.export)throw m(c)}}(r),t=b(t);var n=a.createHmac("sha"+e,r);return p((n.update(t),n.digest("base64")))}}d&&(u+=" or a KeyObject",c+="or a KeyObject");var g="timingSafeEqual"in a?function(e,t){return e.byteLength===t.byteLength&&a.timingSafeEqual(e,t)}:function(t,r){return n||(n=e("buffer-equal-constant-time")),n(t,r)};function y(e){return function(t,r,n){var a=v(e)(t,n);return g(i.from(r),i.from(a))}}function _(e){return function(t,r){f(r),t=b(t);var n=a.createSign("RSA-SHA"+e);return p((n.update(t),n.sign(r,"base64")))}}function w(e){return function(t,r,n){l(n),t=b(t),r=h(r);var i=a.createVerify("RSA-SHA"+e);return i.update(t),i.verify(n,r,"base64")}}function k(e){return function(t,r){f(r),t=b(t);var n=a.createSign("RSA-SHA"+e);return p((n.update(t),n.sign({key:r,padding:a.constants.RSA_PKCS1_PSS_PADDING,saltLength:a.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function S(e){return function(t,r,n){l(n),t=b(t),r=h(r);var i=a.createVerify("RSA-SHA"+e);return i.update(t),i.verify({key:n,padding:a.constants.RSA_PKCS1_PSS_PADDING,saltLength:a.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function x(e){var t=_(e);return function(){var r=t.apply(null,arguments);return r=o.derToJose(r,"ES"+e)}}function E(e){var t=w(e);return function(r,n,i){return n=o.joseToDer(n,"ES"+e).toString("base64"),t(r,n,i)}}function P(){return function(){return""}}function R(){return function(e,t){return""===t}}t.exports=function(e){var t={hs:v,rs:_,ps:k,es:x,none:P},r={hs:y,rs:w,ps:S,es:E,none:R},n=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!n)throw m('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var i=(n[1]||n[3]).toLowerCase(),a=n[2];return{sign:t[i](a),verify:r[i](a)}}},{"buffer-equal-constant-time":122,crypto:140,"ecdsa-sig-formatter":156,"safe-buffer":387,util:438}],261:[function(e,t,r){var n=e("./lib/sign-stream"),i=e("./lib/verify-stream");r.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],r.sign=n.sign,r.verify=i.verify,r.decode=i.decode,r.isValid=i.isValid,r.createSign=function(e){return new n(e)},r.createVerify=function(e){return new i(e)}},{"./lib/sign-stream":263,"./lib/verify-stream":265}],262:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("stream");function a(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=n.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=n.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}e("util").inherits(a,i),a.prototype.write=function(e){this.buffer=n.concat([this.buffer,n.from(e)]),this.emit("data",e)},a.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=a},{"safe-buffer":387,stream:415,util:438}],263:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("./data-stream"),a=e("jwa"),o=e("stream"),s=e("./tostring"),c=e("util");function u(e,t){return n.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function d(e){var t=e.header,r=e.payload,n=e.secret||e.privateKey,i=e.encoding,o=a(t.alg),d=function(e,t,r){r=r||"utf8";var n=u(s(e),"binary"),i=u(s(t),r);return c.format("%s.%s",n,i)}(t,r,i),l=o.sign(d,n);return c.format("%s.%s",d,l)}function l(e){var t=e.secret||e.privateKey||e.key,r=new i(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new i(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}c.inherits(l,o),l.prototype.sign=function(){try{var e=d({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},l.sign=d,t.exports=l},{"./data-stream":262,"./tostring":264,jwa:260,"safe-buffer":387,stream:415,util:438}],264:[function(e,t,r){var n=e("buffer").Buffer;t.exports=function(e){return"string"==typeof e?e:"number"==typeof e||n.isBuffer(e)?e.toString():JSON.stringify(e)}},{buffer:124}],265:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("./data-stream"),a=e("jwa"),o=e("stream"),s=e("./tostring"),c=e("util"),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function d(e){if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(e))return e;try{return JSON.parse(e)}catch(e){return}}function l(e){var t=e.split(".",1)[0];return d(n.from(t,"base64").toString("binary"))}function f(e){return e.split(".")[2]}function p(e){return u.test(e)&&!!l(e)}function h(e,t,r){if(!t){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}var i=f(e=s(e)),o=function(e){return e.split(".",2).join(".")}(e);return a(t).verify(o,i,r)}function m(e,t){if(t=t||{},!p(e=s(e)))return null;var r=l(e);if(!r)return null;var i=function(e,t){t=t||"utf8";var r=e.split(".")[1];return n.from(r,"base64").toString(t)}(e);return("JWT"===r.typ||t.json)&&(i=JSON.parse(i,t.encoding)),{header:r,payload:i,signature:f(e)}}function b(e){var t=(e=e||{}).secret||e.publicKey||e.key,r=new i(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new i(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}c.inherits(b,o),b.prototype.verify=function(){try{var e=h(this.signature.buffer,this.algorithm,this.key.buffer),t=m(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},b.decode=m,b.isValid=p,b.verify=h,t.exports=b},{"./data-stream":262,"./tostring":264,jwa:260,"safe-buffer":387,stream:415,util:438}],266:[function(e,t,r){var n=1/0,i=9007199254740991,a=17976931348623157e292,o=NaN,s="[object Arguments]",c="[object Function]",u="[object GeneratorFunction]",d="[object String]",l="[object Symbol]",f=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=/^(?:0|[1-9]\d*)$/,v=parseInt;function g(e){return e!=e}function y(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,function(t){return e[t]})}var _,w,k=Object.prototype,S=k.hasOwnProperty,x=k.toString,E=k.propertyIsEnumerable,P=(_=Object.keys,w=Object,function(e){return _(w(e))}),R=Math.max;function M(e,t){var r=A(e)||function(e){return function(e){return j(e)&&I(e)}(e)&&S.call(e,"callee")&&(!E.call(e,"callee")||x.call(e)==s)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var a in e)!t&&!S.call(e,a)||i&&("length"==a||T(a,n))||r.push(a);return r}function C(e){if(r=(t=e)&&t.constructor,n="function"==typeof r&&r.prototype||k,t!==n)return P(e);var t,r,n,i=[];for(var a in Object(e))S.call(e,a)&&"constructor"!=a&&i.push(a);return i}function T(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||b.test(e))&&e>-1&&e%1==0&&e<t}var A=Array.isArray;function I(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}(e.length)&&!function(e){var t=O(e)?x.call(e):"";return t==c||t==u}(e)}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function j(e){return!!e&&"object"==typeof e}t.exports=function(e,t,r,i){var s;e=I(e)?e:(s=e)?y(s,function(e){return I(e)?M(e):C(e)}(s)):[],r=r&&!i?function(e){var t=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||j(e)&&x.call(e)==l}(e))return o;if(O(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=O(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(f,"");var r=h.test(e);return r||m.test(e)?v(e.slice(2),r?2:8):p.test(e)?o:+e}(e),e===n||e===-1/0){return(e<0?-1:1)*a}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(r):0;var c=e.length;return r<0&&(r=R(c+r,0)),function(e){return"string"==typeof e||!A(e)&&j(e)&&x.call(e)==d}(e)?r<=c&&e.indexOf(t,r)>-1:!!c&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;return-1}(e,g,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r)>-1}},{}],267:[function(e,t,r){var n=Object.prototype.toString;t.exports=function(e){return!0===e||!1===e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Boolean]"==n.call(e)}},{}],268:[function(e,t,r){var n=1/0,i=17976931348623157e292,a=NaN,o="[object Symbol]",s=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,d=/^0o[0-7]+$/i,l=parseInt,f=Object.prototype.toString;function p(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=function(e){return"number"==typeof e&&e==function(e){var t=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&f.call(e)==o}(e))return a;if(p(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=p(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var r=u.test(e);return r||d.test(e)?l(e.slice(2),r?2:8):c.test(e)?a:+e}(e),e===n||e===-1/0){return(e<0?-1:1)*i}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(e)}},{}],269:[function(e,t,r){var n=Object.prototype.toString;t.exports=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Number]"==n.call(e)}},{}],270:[function(e,t,r){var n,i,a=Function.prototype,o=Object.prototype,s=a.toString,c=o.hasOwnProperty,u=s.call(Object),d=o.toString,l=(n=Object.getPrototypeOf,i=Object,function(e){return n(i(e))});t.exports=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=d.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=l(e);if(null===t)return!0;var r=c.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&s.call(r)==u}},{}],271:[function(e,t,r){var n=Object.prototype.toString,i=Array.isArray;t.exports=function(e){return"string"==typeof e||!i(e)&&function(e){return!!e&&"object"==typeof e}(e)&&"[object String]"==n.call(e)}},{}],272:[function(e,t,r){var n=1/0,i=17976931348623157e292,a=NaN,o="[object Symbol]",s=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,d=/^0o[0-7]+$/i,l=parseInt,f=Object.prototype.toString;function p(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=function(e){var t=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&f.call(e)==o}(e))return a;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var r=u.test(e);return r||d.test(e)?l(e.slice(2),r?2:8):c.test(e)?a:+e}(e),e===n||e===-1/0){return(e<0?-1:1)*i}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=function(e){return p(2,e)}},{}],273:[function(e,t,r){"use strict";t.exports=Math.abs},{}],274:[function(e,t,r){"use strict";t.exports=Math.floor},{}],275:[function(e,t,r){"use strict";t.exports=Number.isNaN||function(e){return e!=e}},{}],276:[function(e,t,r){"use strict";t.exports=Math.max},{}],277:[function(e,t,r){"use strict";t.exports=Math.min},{}],278:[function(e,t,r){"use strict";t.exports=Math.pow},{}],279:[function(e,t,r){"use strict";t.exports=Math.round},{}],280:[function(e,t,r){"use strict";var n=e("./isNaN");t.exports=function(e){return n(e)||0===e?e:e<0?-1:1}},{"./isNaN":275}],281:[function(e,t,r){"use strict";var n=e("inherits"),i=e("hash-base"),a=e("safe-buffer").Buffer,o=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function c(e,t){return e<<t|e>>>32-t}function u(e,t,r,n,i,a,o){return c(e+(t&r|~t&n)+i+a|0,o)+t|0}function d(e,t,r,n,i,a,o){return c(e+(t&n|r&~n)+i+a|0,o)+t|0}function l(e,t,r,n,i,a,o){return c(e+(t^r^n)+i+a|0,o)+t|0}function f(e,t,r,n,i,a,o){return c(e+(r^(t|~n))+i+a|0,o)+t|0}n(s,i),s.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,a=this._d;r=u(r,n,i,a,e[0],3614090360,7),a=u(a,r,n,i,e[1],3905402710,12),i=u(i,a,r,n,e[2],606105819,17),n=u(n,i,a,r,e[3],3250441966,22),r=u(r,n,i,a,e[4],4118548399,7),a=u(a,r,n,i,e[5],1200080426,12),i=u(i,a,r,n,e[6],2821735955,17),n=u(n,i,a,r,e[7],4249261313,22),r=u(r,n,i,a,e[8],1770035416,7),a=u(a,r,n,i,e[9],2336552879,12),i=u(i,a,r,n,e[10],4294925233,17),n=u(n,i,a,r,e[11],2304563134,22),r=u(r,n,i,a,e[12],1804603682,7),a=u(a,r,n,i,e[13],4254626195,12),i=u(i,a,r,n,e[14],2792965006,17),r=d(r,n=u(n,i,a,r,e[15],1236535329,22),i,a,e[1],4129170786,5),a=d(a,r,n,i,e[6],3225465664,9),i=d(i,a,r,n,e[11],643717713,14),n=d(n,i,a,r,e[0],3921069994,20),r=d(r,n,i,a,e[5],3593408605,5),a=d(a,r,n,i,e[10],38016083,9),i=d(i,a,r,n,e[15],3634488961,14),n=d(n,i,a,r,e[4],3889429448,20),r=d(r,n,i,a,e[9],568446438,5),a=d(a,r,n,i,e[14],3275163606,9),i=d(i,a,r,n,e[3],4107603335,14),n=d(n,i,a,r,e[8],1163531501,20),r=d(r,n,i,a,e[13],2850285829,5),a=d(a,r,n,i,e[2],4243563512,9),i=d(i,a,r,n,e[7],1735328473,14),r=l(r,n=d(n,i,a,r,e[12],2368359562,20),i,a,e[5],4294588738,4),a=l(a,r,n,i,e[8],2272392833,11),i=l(i,a,r,n,e[11],1839030562,16),n=l(n,i,a,r,e[14],4259657740,23),r=l(r,n,i,a,e[1],2763975236,4),a=l(a,r,n,i,e[4],1272893353,11),i=l(i,a,r,n,e[7],4139469664,16),n=l(n,i,a,r,e[10],3200236656,23),r=l(r,n,i,a,e[13],681279174,4),a=l(a,r,n,i,e[0],3936430074,11),i=l(i,a,r,n,e[3],3572445317,16),n=l(n,i,a,r,e[6],76029189,23),r=l(r,n,i,a,e[9],3654602809,4),a=l(a,r,n,i,e[12],3873151461,11),i=l(i,a,r,n,e[15],530742520,16),r=f(r,n=l(n,i,a,r,e[2],3299628645,23),i,a,e[0],4096336452,6),a=f(a,r,n,i,e[7],1126891415,10),i=f(i,a,r,n,e[14],2878612391,15),n=f(n,i,a,r,e[5],4237533241,21),r=f(r,n,i,a,e[12],1700485571,6),a=f(a,r,n,i,e[3],2399980690,10),i=f(i,a,r,n,e[10],4293915773,15),n=f(n,i,a,r,e[1],2240044497,21),r=f(r,n,i,a,e[8],1873313359,6),a=f(a,r,n,i,e[15],4264355552,10),i=f(i,a,r,n,e[6],2734768916,15),n=f(n,i,a,r,e[13],1309151649,21),r=f(r,n,i,a,e[4],4149444226,6),a=f(a,r,n,i,e[11],3174756917,10),i=f(i,a,r,n,e[2],718787259,15),n=f(n,i,a,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+a|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=a.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},t.exports=s},{"hash-base":282,inherits:243,"safe-buffer":387}],282:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("readable-stream").Transform;function a(e){i.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}e("inherits")(a,i),a.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},a.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},a.prototype.update=function(e,t){if(function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(e)||(e=n.from(e,t));for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var a=this._blockOffset;a<this._blockSize;)r[a++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var o=0,s=8*e.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=a},{inherits:243,"readable-stream":297,"safe-buffer":387}],283:[function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function a(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(e){return String(e)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,r){var n,i,o,s;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(a(t,"type"));else{var c=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(c," ").concat(n," ").concat(a(t,"type"))}return s+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],284:[function(e,t,r){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=u;var i=e("./_stream_readable"),a=e("./_stream_writable");e("inherits")(u,i);for(var o=n(a.prototype),s=0;s<o.length;s++){var c=o[s];u.prototype[c]||(u.prototype[c]=a.prototype[c])}function u(e){if(!(this instanceof u))return new u(e);i.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||process.nextTick(l,this)}function l(e){e.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},{"./_stream_readable":286,"./_stream_writable":288,inherits:243}],285:[function(e,t,r){"use strict";t.exports=i;var n=e("./_stream_transform");function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}e("inherits")(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":287,inherits:243}],286:[function(e,t,r){"use strict";var n;t.exports=x,x.ReadableState=S;e("events").EventEmitter;var i=function(e,t){return e.listeners(t).length},a=e("./internal/streams/stream"),o=e("buffer").Buffer,s=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,u=e("util");c=u&&u.debuglog?u.debuglog("stream"):function(){};var d,l,f,p=e("./internal/streams/buffer_list"),h=e("./internal/streams/destroy"),m=e("./internal/streams/state").getHighWaterMark,b=e("../errors").codes,v=b.ERR_INVALID_ARG_TYPE,g=b.ERR_STREAM_PUSH_AFTER_EOF,y=b.ERR_METHOD_NOT_IMPLEMENTED,_=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(x,a);var w=h.errorOrDestroy,k=["error","close","destroy","pause","resume"];function S(t,r,i){n=n||e("./_stream_duplex"),t=t||{},"boolean"!=typeof i&&(i=r instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=e("string_decoder/").StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function x(t){if(n=n||e("./_stream_duplex"),!(this instanceof x))return new x(t);var r=this instanceof n;this._readableState=new S(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function E(e,t,r,n,i){c("readableAddChunk",t);var a,u=e._readableState;if(null===t)u.reading=!1,function(e,t){if(c("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?C(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,T(e)))}(e,u);else if(i||(a=function(e,t){var r;n=t,o.isBuffer(n)||n instanceof s||"string"==typeof t||void 0===t||e.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(u,t)),a)w(e,a);else if(u.objectMode||t&&t.length>0)if("string"==typeof t||u.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),n)u.endEmitted?w(e,new _):P(e,u,t,!0);else if(u.ended)w(e,new g);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(t=u.decoder.write(t),u.objectMode||0!==t.length?P(e,u,t,!1):A(e,u)):P(e,u,t,!1)}else n||(u.reading=!1,A(e,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function P(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&C(e)),A(e,t)}Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),x.prototype.destroy=h.destroy,x.prototype._undestroy=h.undestroy,x.prototype._destroy=function(e,t){t(e)},x.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=o.from(e,t),t=""),r=!0),E(this,e,t,!1,r)},x.prototype.unshift=function(e){return E(this,e,null,!0,!1)},x.prototype.isPaused=function(){return!1===this._readableState.flowing},x.prototype.setEncoding=function(t){d||(d=e("string_decoder/").StringDecoder);var r=new d(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var R=1073741824;function M(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(T,e))}function T(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,L(e)}function A(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(I,e,t))}function I(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(c("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function O(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function j(e){c("readable nexttick read 0"),e.read(0)}function D(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),L(e),t.flowing&&!t.reading&&e.read(0)}function L(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(F,t,e))}function F(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function U(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}x.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?N(this):C(this),null;if(0===(e=M(e,t))&&t.ended)return 0===t.length&&N(this),null;var n,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",i=!0),t.ended||t.reading?c("reading or ended",i=!1):i&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=M(r,t))),null===(n=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&N(this)),null!==n&&this.emit("data",n),n},x.prototype._read=function(e){w(this,new y("_read()"))},x.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,c("pipe count=%d opts=%j",n.pipesCount,t);var a=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?s:m;function o(t,i){c("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",h),e.removeListener("drain",u),e.removeListener("error",f),e.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",m),r.removeListener("data",l),d=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function s(){c("onend"),e.end()}n.endEmitted?process.nextTick(a):r.once("end",a),e.on("unpipe",o);var u=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,L(e))}}(r);e.on("drain",u);var d=!1;function l(t){c("ondata");var i=e.write(t);c("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==U(n.pipes,e))&&!d&&(c("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function f(t){c("onerror",t),m(),e.removeListener("error",f),0===i(e,"error")&&w(e,t)}function p(){e.removeListener("finish",h),m()}function h(){c("onfinish"),e.removeListener("close",p),m()}function m(){c("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",f),e.once("close",p),e.once("finish",h),e.emit("pipe",r),n.flowing||(c("pipe resume"),r.resume()),e},x.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)n[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=U(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},x.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,c("on readable",n.length,n.reading),n.length?C(this):n.reading||process.nextTick(j,this))),r},x.prototype.addListener=x.prototype.on,x.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(O,this),r},x.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(O,this),t},x.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(D,e,t))}(this,e)),e.paused=!1,this},x.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},x.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<k.length;a++)e.on(k[a],this.emit.bind(this,k[a]));return this._read=function(t){c("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(x.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=e("./internal/streams/async_iterator")),l(this)}),Object.defineProperty(x.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(x.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(x.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),x._fromList=B,Object.defineProperty(x.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(x.from=function(t,r){return void 0===f&&(f=e("./internal/streams/from")),f(x,t,r)})},{"../errors":283,"./_stream_duplex":284,"./internal/streams/async_iterator":289,"./internal/streams/buffer_list":290,"./internal/streams/destroy":291,"./internal/streams/from":293,"./internal/streams/state":295,"./internal/streams/stream":296,buffer:124,events:205,inherits:243,"string_decoder/":430,util:92}],287:[function(e,t,r){"use strict";t.exports=d;var n=e("../errors").codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,a=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,c=e("./_stream_duplex");function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function d(e){if(!(this instanceof d))return new d(e);c.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush(function(t,r){f(e,t,r)})}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new o;return e.push(null)}e("inherits")(d,c),d.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},d.prototype._transform=function(e,t,r){r(new i("_transform()"))},d.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},d.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},d.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,function(e){t(e)})}},{"../errors":283,"./_stream_duplex":284,inherits:243}],288:[function(e,t,r){"use strict";function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var i;t.exports=x,x.WritableState=S;var a={deprecate:e("util-deprecate")},o=e("./internal/streams/stream"),s=e("buffer").Buffer,c=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,d=e("./internal/streams/destroy"),l=e("./internal/streams/state").getHighWaterMark,f=e("../errors").codes,p=f.ERR_INVALID_ARG_TYPE,h=f.ERR_METHOD_NOT_IMPLEMENTED,m=f.ERR_MULTIPLE_CALLBACK,b=f.ERR_STREAM_CANNOT_PIPE,v=f.ERR_STREAM_DESTROYED,g=f.ERR_STREAM_NULL_VALUES,y=f.ERR_STREAM_WRITE_AFTER_END,_=f.ERR_UNKNOWN_ENCODING,w=d.errorOrDestroy;function k(){}function S(t,r,a){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof a&&(a=r instanceof i),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=l(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===t.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new m;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(T,e,t),e._writableState.errorEmitted=!0,w(e,n)):(i(n),e._writableState.errorEmitted=!0,w(e,n),T(e,t))}(e,r,n,t,i);else{var a=M(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||R(e,r),n?process.nextTick(P,e,r,a,i):P(e,r,a,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function x(t){var r=this instanceof(i=i||e("./_stream_duplex"));if(!r&&!u.call(x,this))return new x(t);this._writableState=new S(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),o.call(this)}function E(e,t,r,n,i,a,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):r?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function P(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),T(e,t)}function R(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,a=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)a[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;a.allBuffers=c,E(e,t,!0,t.length,a,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,d=r.encoding,l=r.callback;if(E(e,t,!1,t.objectMode?1:u.length,u,d,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function M(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final(function(r){t.pendingcb--,r&&w(e,r),t.prefinished=!0,e.emit("prefinish"),T(e,t)})}function T(e,t){var r=M(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(C,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}e("inherits")(x,o),S.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(S.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(e){return!!u.call(this,e)||this===x&&(e&&e._writableState instanceof S)}})):u=function(e){return e instanceof this},x.prototype.pipe=function(){w(this,new b)},x.prototype.write=function(e,t,r){var n,i=this._writableState,a=!1,o=!i.objectMode&&(n=e,s.isBuffer(n)||n instanceof c);return o&&!s.isBuffer(e)&&(e=function(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=k),i.ending?function(e,t){var r=new y;w(e,r),process.nextTick(t,r)}(this,r):(o||function(e,t,r,n){var i;return null===r?i=new g:"string"==typeof r||t.objectMode||(i=new p("chunk",["string","Buffer"],r)),!i||(w(e,i),process.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,a=function(e,t,r,n,i,a){if(!r){var o=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var c=t.objectMode?1:n.length;t.length+=c;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:a,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else E(e,t,!1,c,n,i,a);return u}(this,i,o,e,t,r)),a},x.prototype.cork=function(){this._writableState.corked++},x.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},x.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(e,t,r){r(new h("_write()"))},x.prototype._writev=null,x.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,T(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),x.prototype.destroy=d.destroy,x.prototype._undestroy=d.undestroy,x.prototype._destroy=function(e,t){t(e)}},{"../errors":283,"./_stream_duplex":284,"./internal/streams/destroy":291,"./internal/streams/state":295,"./internal/streams/stream":296,buffer:124,inherits:243,"util-deprecate":435}],289:[function(e,t,r){"use strict";var n;function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=e("./end-of-stream"),o=Symbol("lastResolve"),s=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),d=Symbol("lastPromise"),l=Symbol("handlePromise"),f=Symbol("stream");function p(e,t){return{value:e,done:t}}function h(e){var t=e[o];if(null!==t){var r=e[f].read();null!==r&&(e[d]=null,e[o]=null,e[s]=null,t(p(r,!1)))}}function m(e){process.nextTick(h,e)}var b=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((i(n={get stream(){return this[f]},next:function(){var e=this,t=this[c];if(null!==t)return Promise.reject(t);if(this[u])return Promise.resolve(p(void 0,!0));if(this[f].destroyed)return new Promise(function(t,r){process.nextTick(function(){e[c]?r(e[c]):t(p(void 0,!0))})});var r,n=this[d];if(n)r=new Promise(function(e,t){return function(r,n){e.then(function(){t[u]?r(p(void 0,!0)):t[l](r,n)},n)}}(n,this));else{var i=this[f].read();if(null!==i)return Promise.resolve(p(i,!1));r=new Promise(this[l])}return this[d]=r,r}},Symbol.asyncIterator,function(){return this}),i(n,"return",function(){var e=this;return new Promise(function(t,r){e[f].destroy(null,function(e){e?r(e):t(p(void 0,!0))})})}),n),b);t.exports=function(e){var t,r=Object.create(v,(i(t={},f,{value:e,writable:!0}),i(t,o,{value:null,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,c,{value:null,writable:!0}),i(t,u,{value:e._readableState.endEmitted,writable:!0}),i(t,l,{value:function(e,t){var n=r[f].read();n?(r[d]=null,r[o]=null,r[s]=null,e(p(n,!1))):(r[o]=e,r[s]=t)},writable:!0}),t));return r[d]=null,a(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[s];return null!==t&&(r[d]=null,r[o]=null,r[s]=null,t(e)),void(r[c]=e)}var n=r[o];null!==n&&(r[d]=null,r[o]=null,r[s]=null,n(p(void 0,!0))),r[u]=!0}),e.on("readable",m.bind(null,r)),r}},{"./end-of-stream":292}],290:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function a(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(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,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var c=e("buffer").Buffer,u=e("util").inspect,d=u&&u.custom||"inspect";function l(e,t,r){c.prototype.copy.call(e,t,r)}t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,n;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t=c.allocUnsafe(e>>>0),r=this.head,n=0;r;)l(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,a=e>i.length?i.length:e;if(a===i.length?n+=i:n+=i.slice(0,e),0===(e-=a)){a===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(a));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),0===(e-=a)){a===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(a));break}++n}return this.length-=n,t}},{key:d,value:function(e,t){return u(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:124,util:92}],291:[function(e,t,r){"use strict";function n(e,t){a(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(a,this,e)):process.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?process.nextTick(i,r):(r._writableState.errorEmitted=!0,process.nextTick(n,r,e)):process.nextTick(n,r,e):t?(process.nextTick(i,r),t(e)):process.nextTick(i,r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},{}],292:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function e(t,r,a){if("function"==typeof r)return e(t,null,r);r||(r={}),a=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(a||i);var o=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||d()},u=t._writableState&&t._writableState.finished,d=function(){s=!1,u=!0,o||a.call(t)},l=t._readableState&&t._readableState.endEmitted,f=function(){o=!1,l=!0,s||a.call(t)},p=function(e){a.call(t,e)},h=function(){var e;return o&&!l?(t._readableState&&t._readableState.ended||(e=new n),a.call(t,e)):s&&!u?(t._writableState&&t._writableState.ended||(e=new n),a.call(t,e)):void 0},m=function(){t.req.on("finish",d)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",c),t.on("close",c)):(t.on("complete",d),t.on("abort",h),t.req?m():t.on("request",m)),t.on("end",f),t.on("finish",d),!1!==r.error&&t.on("error",p),t.on("close",h),function(){t.removeListener("complete",d),t.removeListener("abort",h),t.removeListener("request",m),t.req&&t.req.removeListener("finish",d),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",d),t.removeListener("end",f),t.removeListener("error",p),t.removeListener("close",h)}}},{"../../../errors":283}],293:[function(e,t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],294:[function(e,t,r){"use strict";var n;var i=e("../../../errors").codes,a=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function c(e){e()}function u(e,t){return e.pipe(t)}t.exports=function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var d,l=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new a("streams");var f=r.map(function(t,i){var a=i<r.length-1;return function(t,r,i,a){a=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(a);var s=!1;t.on("close",function(){s=!0}),void 0===n&&(n=e("./end-of-stream")),n(t,{readable:r,writable:i},function(e){if(e)return a(e);s=!0,a()});var c=!1;return function(e){if(!s&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void a(e||new o("pipe"))}}(t,a,i>0,function(e){d||(d=e),e&&f.forEach(c),a||(f.forEach(c),l(d))})});return r.reduce(u)}},{"../../../errors":283,"./end-of-stream":292}],295:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new n(i?r:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}}},{"../../../errors":283}],296:[function(e,t,r){t.exports=e("events").EventEmitter},{events:205}],297:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":284,"./lib/_stream_passthrough.js":285,"./lib/_stream_readable.js":286,"./lib/_stream_transform.js":287,"./lib/_stream_writable.js":288,"./lib/internal/streams/end-of-stream.js":292,"./lib/internal/streams/pipeline.js":294}],298:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/defineProperty"));function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.Consumer=void 0;var h=e("./Logger"),m=e("./enhancedEvents"),b=e("./errors"),v=new h.Logger("Consumer"),g=function(e){function t(e){var r,n,i,a,s=e.id,d=e.localId,l=e.producerId,h=e.rtpReceiver,b=e.track,g=e.rtpParameters,y=e.appData;return(0,o.default)(this,t),n=this,i=t,i=(0,u.default)(i),r=(0,c.default)(n,p()?Reflect.construct(i,a||[],(0,u.default)(n).constructor):i.apply(n,a)),(0,f.default)(r,"_id",void 0),(0,f.default)(r,"_localId",void 0),(0,f.default)(r,"_producerId",void 0),(0,f.default)(r,"_closed",!1),(0,f.default)(r,"_rtpReceiver",void 0),(0,f.default)(r,"_track",void 0),(0,f.default)(r,"_rtpParameters",void 0),(0,f.default)(r,"_paused",void 0),(0,f.default)(r,"_appData",void 0),(0,f.default)(r,"_observer",new m.EnhancedEventEmitter),v.debug("constructor()"),r._id=s,r._localId=d,r._producerId=l,r._rtpReceiver=h,r._track=b,r._rtpParameters=g,r._paused=!b.enabled,r._appData=null!=y?y:{},r.onTrackEnded=r.onTrackEnded.bind(r),r.handleTrack(),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"id",get:function(){return this._id}},{key:"localId",get:function(){return this._localId}},{key:"producerId",get:function(){return this._producerId}},{key:"closed",get:function(){return this._closed}},{key:"kind",get:function(){return this._track.kind}},{key:"rtpReceiver",get:function(){return this._rtpReceiver}},{key:"track",get:function(){return this._track}},{key:"rtpParameters",get:function(){return this._rtpParameters}},{key:"paused",get:function(){return this._paused}},{key:"appData",get:function(){return this._appData},set:function(e){this._appData=e}},{key:"observer",get:function(){return this._observer}},{key:"close",value:function(){var e,r,n,i,a;this._closed||(v.debug("close()"),this._closed=!0,this.destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"),(e=t,r="close",n=this,i=3,a=(0,d.default)((0,u.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([]),this._observer.close())}},{key:"transportClosed",value:function(){this._closed||(v.debug("transportClosed()"),this._closed=!0,this.destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"getStats",value:(r=(0,a.default)(i.default.mark(function e(){var t=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}throw new b.InvalidStateError("closed");case 1:return e.abrupt("return",new Promise(function(e,r){t.safeEmit("@getstats",e,r)}));case 2:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"pause",value:function(){v.debug("pause()"),this._closed?v.error("pause() | Consumer closed"):this._paused?v.debug("pause() | Consumer is already paused"):(this._paused=!0,this._track.enabled=!1,this.emit("@pause"),this._observer.safeEmit("pause"))}},{key:"resume",value:function(){v.debug("resume()"),this._closed?v.error("resume() | Consumer closed"):this._paused?(this._paused=!1,this._track.enabled=!0,this.emit("@resume"),this._observer.safeEmit("resume")):v.debug("resume() | Consumer is already resumed")}},{key:"onTrackEnded",value:function(){v.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}},{key:"handleTrack",value:function(){this._track.addEventListener("ended",this.onTrackEnded)}},{key:"destroyTrack",value:function(){try{this._track.removeEventListener("ended",this.onTrackEnded),this._track.stop()}catch(e){}}}]);var r}(m.EnhancedEventEmitter);r.Consumer=g},{"./Logger":302,"./enhancedEvents":305,"./errors":306,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63}],299:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass")),o=n(e("@babel/runtime/helpers/possibleConstructorReturn")),s=n(e("@babel/runtime/helpers/getPrototypeOf")),c=n(e("@babel/runtime/helpers/get")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/helpers/defineProperty"));function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.DataConsumer=void 0;var f=e("./Logger"),p=e("./enhancedEvents"),h=new f.Logger("DataConsumer"),m=function(e){function t(e){var r,n,a,c,u=e.id,f=e.dataProducerId,m=e.dataChannel,b=e.sctpStreamParameters,v=e.appData;return(0,i.default)(this,t),n=this,a=t,a=(0,s.default)(a),r=(0,o.default)(n,l()?Reflect.construct(a,c||[],(0,s.default)(n).constructor):a.apply(n,c)),(0,d.default)(r,"_id",void 0),(0,d.default)(r,"_dataProducerId",void 0),(0,d.default)(r,"_dataChannel",void 0),(0,d.default)(r,"_closed",!1),(0,d.default)(r,"_sctpStreamParameters",void 0),(0,d.default)(r,"_appData",void 0),(0,d.default)(r,"_observer",new p.EnhancedEventEmitter),h.debug("constructor()"),r._id=u,r._dataProducerId=f,r._dataChannel=m,r._sctpStreamParameters=b,r._appData=null!=v?v:{},r.handleDataChannel(),r}return(0,u.default)(t,e),(0,a.default)(t,[{key:"id",get:function(){return this._id}},{key:"dataProducerId",get:function(){return this._dataProducerId}},{key:"closed",get:function(){return this._closed}},{key:"sctpStreamParameters",get:function(){return this._sctpStreamParameters}},{key:"readyState",get:function(){return this._dataChannel.readyState}},{key:"label",get:function(){return this._dataChannel.label}},{key:"protocol",get:function(){return this._dataChannel.protocol}},{key:"binaryType",get:function(){return this._dataChannel.binaryType},set:function(e){this._dataChannel.binaryType=e}},{key:"appData",get:function(){return this._appData},set:function(e){this._appData=e}},{key:"observer",get:function(){return this._observer}},{key:"close",value:function(){var e,r,n,i,a;this._closed||(h.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"),(e=t,r="close",n=this,i=3,a=(0,c.default)((0,s.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([]),this._observer.close())}},{key:"transportClosed",value:function(){this._closed||(h.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"handleDataChannel",value:function(){var e=this;this._dataChannel.addEventListener("open",function(){e._closed||(h.debug('DataChannel "open" event'),e.safeEmit("open"))}),this._dataChannel.addEventListener("error",function(t){var r,n;if(!e._closed){var i,a=null!==(r=t.error)&&void 0!==r?r:new Error("unknown DataChannel error");if("sctp-failure"===(null===(n=t.error)||void 0===n?void 0:n.errorDetail))h.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",null===(i=t.error)||void 0===i?void 0:i.sctpCauseCode,t.error.message);else h.error('DataChannel "error" event: %o',a);e.safeEmit("error",a)}}),this._dataChannel.addEventListener("close",function(){e._closed||(h.warn('DataChannel "close" event'),e._closed=!0,e.emit("@close"),e.safeEmit("close"),e._observer.safeEmit("close"))}),this._dataChannel.addEventListener("message",function(t){e._closed||e.safeEmit("message",t.data)})}}])}(p.EnhancedEventEmitter);r.DataConsumer=m},{"./Logger":302,"./enhancedEvents":305,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45}],300:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass")),o=n(e("@babel/runtime/helpers/possibleConstructorReturn")),s=n(e("@babel/runtime/helpers/getPrototypeOf")),c=n(e("@babel/runtime/helpers/get")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/helpers/defineProperty"));function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.DataProducer=void 0;var f=e("./Logger"),p=e("./enhancedEvents"),h=e("./errors"),m=new f.Logger("DataProducer"),b=function(e){function t(e){var r,n,a,c,u=e.id,f=e.dataChannel,h=e.sctpStreamParameters,b=e.appData;return(0,i.default)(this,t),n=this,a=t,a=(0,s.default)(a),r=(0,o.default)(n,l()?Reflect.construct(a,c||[],(0,s.default)(n).constructor):a.apply(n,c)),(0,d.default)(r,"_id",void 0),(0,d.default)(r,"_dataChannel",void 0),(0,d.default)(r,"_closed",!1),(0,d.default)(r,"_sctpStreamParameters",void 0),(0,d.default)(r,"_appData",void 0),(0,d.default)(r,"_observer",new p.EnhancedEventEmitter),m.debug("constructor()"),r._id=u,r._dataChannel=f,r._sctpStreamParameters=h,r._appData=null!=b?b:{},r.handleDataChannel(),r}return(0,u.default)(t,e),(0,a.default)(t,[{key:"id",get:function(){return this._id}},{key:"closed",get:function(){return this._closed}},{key:"sctpStreamParameters",get:function(){return this._sctpStreamParameters}},{key:"readyState",get:function(){return this._dataChannel.readyState}},{key:"label",get:function(){return this._dataChannel.label}},{key:"protocol",get:function(){return this._dataChannel.protocol}},{key:"bufferedAmount",get:function(){return this._dataChannel.bufferedAmount}},{key:"bufferedAmountLowThreshold",get:function(){return this._dataChannel.bufferedAmountLowThreshold},set:function(e){this._dataChannel.bufferedAmountLowThreshold=e}},{key:"appData",get:function(){return this._appData},set:function(e){this._appData=e}},{key:"observer",get:function(){return this._observer}},{key:"close",value:function(){var e,r,n,i,a;this._closed||(m.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"),(e=t,r="close",n=this,i=3,a=(0,c.default)((0,s.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([]),this._observer.close())}},{key:"transportClosed",value:function(){this._closed||(m.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"send",value:function(e){if(m.debug("send()"),this._closed)throw new h.InvalidStateError("closed");this._dataChannel.send(e)}},{key:"handleDataChannel",value:function(){var e=this;this._dataChannel.addEventListener("open",function(){e._closed||(m.debug('DataChannel "open" event'),e.safeEmit("open"))}),this._dataChannel.addEventListener("error",function(t){var r,n;if(!e._closed){var i,a=null!==(r=t.error)&&void 0!==r?r:new Error("unknown DataChannel error");if("sctp-failure"===(null===(n=t.error)||void 0===n?void 0:n.errorDetail))m.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",null===(i=t.error)||void 0===i?void 0:i.sctpCauseCode,t.error.message);else m.error('DataChannel "error" event: %o',a);e.safeEmit("error",a)}}),this._dataChannel.addEventListener("close",function(){e._closed||(m.warn('DataChannel "close" event'),e._closed=!0,e.emit("@close"),e.safeEmit("close"),e._observer.safeEmit("close"))}),this._dataChannel.addEventListener("message",function(){e._closed||m.warn('DataChannel "message" event in a DataProducer, message discarded')}),this._dataChannel.addEventListener("bufferedamountlow",function(){e._closed||e.safeEmit("bufferedamountlow")})}}])}(p.EnhancedEventEmitter);r.DataProducer=b},{"./Logger":302,"./enhancedEvents":305,"./errors":306,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45}],301:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=n(e("@babel/runtime/helpers/defineProperty")),c=n(e("@babel/runtime/helpers/asyncToGenerator")),u=n(e("@babel/runtime/helpers/typeof"));Object.defineProperty(r,"__esModule",{value:!0}),r.Device=void 0,r.detectDevice=S,r.detectDeviceAsync=x;var d=e("browser-dtector"),l=e("./Logger"),f=e("./enhancedEvents"),p=e("./errors"),h=e("./utils"),m=e("./ortc"),b=e("./Transport"),v=e("./handlers/Chrome111"),g=e("./handlers/Chrome74"),y=e("./handlers/Firefox120"),_=e("./handlers/Safari12"),w=e("./handlers/ReactNative106"),k=new l.Logger("Device");function S(e){return k.debug("detectDevice() [userAgent:%s]",e),e||"object"!==("undefined"==typeof navigator?"undefined":(0,u.default)(navigator))||(e=navigator.userAgent),R(new d.default(e))}function x(e){return E.apply(this,arguments)}function E(){return(E=(0,c.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k.debug("detectDeviceAsync() [userAgent:%s]",t),t||"object"!==("undefined"==typeof navigator?"undefined":(0,u.default)(navigator))||(t=navigator.userAgent),r=new d.default(t),e.abrupt("return",R(r));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}var P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.handlerName,n=t.handlerFactory;if((0,a.default)(this,e),(0,s.default)(this,"_handlerFactory",void 0),(0,s.default)(this,"_handlerName",void 0),(0,s.default)(this,"_loaded",!1),(0,s.default)(this,"_getSendExtendedRtpCapabilities",void 0),(0,s.default)(this,"_recvRtpCapabilities",void 0),(0,s.default)(this,"_canProduceByKind",{audio:!1,video:!1}),(0,s.default)(this,"_sctpCapabilities",void 0),(0,s.default)(this,"_observer",new f.EnhancedEventEmitter),k.debug("constructor()"),r&&n)throw new TypeError("just one of handlerName or handlerInterface can be given");if(n)this._handlerFactory=n;else{if(r)k.debug("constructor() | handler given: %s",r);else{if(!(r=S()))throw new p.UnsupportedError("device not supported");k.debug("constructor() | detected handler: %s",r)}switch(r){case"Chrome111":this._handlerFactory=v.Chrome111.createFactory();break;case"Chrome74":this._handlerFactory=g.Chrome74.createFactory();break;case"Firefox120":this._handlerFactory=y.Firefox120.createFactory();break;case"Safari12":this._handlerFactory=_.Safari12.createFactory();break;case"ReactNative106":this._handlerFactory=w.ReactNative106.createFactory();break;default:throw new TypeError('unknown handlerName "'.concat(r,'"'))}}this._handlerName=this._handlerFactory.name}return(0,o.default)(e,[{key:"handlerName",get:function(){return this._handlerName}},{key:"loaded",get:function(){return this._loaded}},{key:"rtpCapabilities",get:function(){if(!this._loaded)throw new p.InvalidStateError("not loaded");return this._recvRtpCapabilities}},{key:"sctpCapabilities",get:function(){if(!this._loaded)throw new p.InvalidStateError("not loaded");return this._sctpCapabilities}},{key:"observer",get:function(){return this._observer}},{key:"load",value:(r=(0,c.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.routerRtpCapabilities,n=t.preferLocalCodecsOrder,a=void 0!==n&&n,k.debug("load() [routerRtpCapabilities:%o]",r),!this._loaded){e.next=1;break}throw new p.InvalidStateError("already loaded");case 1:return o=h.clone(r),m.validateAndNormalizeRtpCapabilities(o),s=this._handlerFactory,c=s.getNativeRtpCapabilities,u=s.getNativeSctpCapabilities,f=h,e.next=2,c();case 2:return d=f.clone.call(f,e.sent),m.validateAndNormalizeRtpCapabilities(d),k.debug("load() | got native RTP capabilities:%o",d),this._getSendExtendedRtpCapabilities=function(e){return h.clone(m.getExtendedRtpCapabilities(e,o,a))},l=m.getExtendedRtpCapabilities(d,o,!1),this._recvRtpCapabilities=m.getRecvRtpCapabilities(l),m.validateAndNormalizeRtpCapabilities(this._recvRtpCapabilities),k.debug("load() | got receiving RTP capabilities:%o",this._recvRtpCapabilities),this._canProduceByKind.audio=m.canSend("audio",this._recvRtpCapabilities),this._canProduceByKind.video=m.canSend("video",this._recvRtpCapabilities),e.next=3,u();case 3:this._sctpCapabilities=e.sent,m.validateSctpCapabilities(this._sctpCapabilities),k.debug("load() | got native SCTP capabilities:%o",this._sctpCapabilities),k.debug("load() succeeded"),this._loaded=!0;case 4:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"canProduce",value:function(e){if(!this._loaded)throw new p.InvalidStateError("not loaded");if("audio"!==e&&"video"!==e)throw new TypeError('invalid kind "'.concat(e,'"'));return this._canProduceByKind[e]}},{key:"createSendTransport",value:function(e){var t=e.id,r=e.iceParameters,n=e.iceCandidates,i=e.dtlsParameters,a=e.sctpParameters,o=e.iceServers,s=e.iceTransportPolicy,c=e.additionalSettings,u=e.appData;return k.debug("createSendTransport()"),this.createTransport({direction:"send",id:t,iceParameters:r,iceCandidates:n,dtlsParameters:i,sctpParameters:a,iceServers:o,iceTransportPolicy:s,additionalSettings:c,appData:u})}},{key:"createRecvTransport",value:function(e){var t=e.id,r=e.iceParameters,n=e.iceCandidates,i=e.dtlsParameters,a=e.sctpParameters,o=e.iceServers,s=e.iceTransportPolicy,c=e.additionalSettings,u=e.appData;return k.debug("createRecvTransport()"),this.createTransport({direction:"recv",id:t,iceParameters:r,iceCandidates:n,dtlsParameters:i,sctpParameters:a,iceServers:o,iceTransportPolicy:s,additionalSettings:c,appData:u})}},{key:"createTransport",value:function(e){var t=e.direction,r=e.id,n=e.iceParameters,i=e.iceCandidates,a=e.dtlsParameters,o=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,d=e.additionalSettings,l=e.appData;if(!this._loaded)throw new p.InvalidStateError("not loaded");if("string"!=typeof r)throw new TypeError("missing id");if("object"!==(0,u.default)(n))throw new TypeError("missing iceParameters");if(!Array.isArray(i))throw new TypeError("missing iceCandidates");if("object"!==(0,u.default)(a))throw new TypeError("missing dtlsParameters");if(o&&"object"!==(0,u.default)(o))throw new TypeError("wrong sctpParameters");if(l&&"object"!==(0,u.default)(l))throw new TypeError("if given, appData must be an object");var f=new b.Transport({direction:t,id:r,iceParameters:n,iceCandidates:i,dtlsParameters:a,sctpParameters:o,iceServers:s,iceTransportPolicy:c,additionalSettings:d,appData:l,handlerFactory:this._handlerFactory,getSendExtendedRtpCapabilities:this._getSendExtendedRtpCapabilities,recvRtpCapabilities:this._recvRtpCapabilities,canProduceByKind:this._canProduceByKind});return this._observer.safeEmit("newtransport",f),f}}],[{key:"factory",value:(t=(0,c.default)(i.default.mark(function t(){var r,n,a,o=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(r=o.length>0&&void 0!==o[0]?o[0]:{}).handlerName,a=r.handlerFactory,k.debug("factory()"),!n||!a){t.next=1;break}throw new TypeError("just one of handlerName or handlerInterface can be given");case 1:if(n||a){t.next=3;break}return t.next=2,x();case 2:if(n=t.sent){t.next=3;break}throw new p.UnsupportedError("device not supported");case 3:return t.abrupt("return",new e({handlerName:n,handlerFactory:a}));case 4:case"end":return t.stop()}},t)})),function(){return t.apply(this,arguments)})}]);var t,r}();function R(e){if("object"===("undefined"==typeof navigator?"undefined":(0,u.default)(navigator))&&"ReactNative"===navigator.product)return k.debug("detectDeviceImpl() | React-Native detected"),"undefined"==typeof RTCPeerConnection||"undefined"==typeof RTCRtpTransceiver?void k.warn("detectDeviceImpl() | unsupported react-native-webrtc without RTCPeerConnection or RTCRtpTransceiver, forgot to call registerGlobals() on it?"):"ReactNative106";var t,r,n,i=e.parseUserAgent(),a=/^\d+/.exec(null!==(t=null==i?void 0:i.shortVersion)&&void 0!==t?t:"0"),o=parseInt(null!==(r=null==a?void 0:a[0])&&void 0!==r?r:"0",10),s=i.platform===d.KnownPlatforms.iphone||i.platform===d.KnownPlatforms.ipad||i.platform===d.KnownPlatforms.mac&&(i.isMobile||i.isTablet||"object"===("undefined"==typeof navigator?"undefined":(0,u.default)(navigator))&&(null===(n=navigator)||void 0===n?void 0:n.maxTouchPoints)>=2),c=i.isChrome,l=i.isFireFox,f=i.isSafari,p=i.isEdge,h=i.isDesktop&&i.name===d.KnownBrowsers.electron,m=i.isWebkit,b={browserMajorVersion:o,isIOS:s,isChrome:c,isFirefox:l,isSafari:f,isElectron:h,isWebkit:m};if(k.debug("detectDeviceImpl() | detected browser [userAgent:%s, parsed:%o, result:%o]",i.userAgent,i,b),(c||p)&&!s&&o>=111)return"Chrome111";if(c&&!s&&o>=74||p&&!s&&o>=88)return"Chrome74";if(h)return"Chrome111";if(l&&!s&&o>=120)return"Firefox120";if(f&&o>=12&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(s&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(m){var v,g=null===(v=e.userAgent)||void 0===v?void 0:v.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);return g?Number(g[1])>=111?"Chrome111":"Chrome74":"Chrome111"}k.warn("detectDeviceImpl() | browser not supported [userAgent:%s, parsed:%o, result:%o]",i.userAgent,i,b)}r.Device=P},{"./Logger":302,"./Transport":304,"./enhancedEvents":305,"./errors":306,"./handlers/Chrome111":307,"./handlers/Chrome74":308,"./handlers/Firefox120":310,"./handlers/ReactNative106":311,"./handlers/Safari12":312,"./ortc":320,"./utils":324,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":60,"@babel/runtime/regenerator":63,"browser-dtector":91}],302:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass")),o=n(e("@babel/runtime/helpers/defineProperty"));Object.defineProperty(r,"__esModule",{value:!0}),r.Logger=void 0;var s=e("debug"),c="mediasoup-client",u=function(){return(0,a.default)(function e(t){(0,i.default)(this,e),(0,o.default)(this,"_debug",void 0),(0,o.default)(this,"_warn",void 0),(0,o.default)(this,"_error",void 0),t?(this._debug=(0,s.default)("".concat(c,":").concat(t)),this._warn=(0,s.default)("".concat(c,":WARN:").concat(t)),this._error=(0,s.default)("".concat(c,":ERROR:").concat(t))):(this._debug=(0,s.default)(c),this._warn=(0,s.default)("".concat(c,":WARN")),this._error=(0,s.default)("".concat(c,":ERROR"))),this._debug.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:"warn",get:function(){return this._warn}},{key:"error",get:function(){return this._error}}])}();r.Logger=u},{"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/interopRequireDefault":36,debug:325}],303:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/typeof")),o=n(e("@babel/runtime/helpers/asyncToGenerator")),s=n(e("@babel/runtime/helpers/classCallCheck")),c=n(e("@babel/runtime/helpers/createClass")),u=n(e("@babel/runtime/helpers/possibleConstructorReturn")),d=n(e("@babel/runtime/helpers/getPrototypeOf")),l=n(e("@babel/runtime/helpers/get")),f=n(e("@babel/runtime/helpers/inherits")),p=n(e("@babel/runtime/helpers/defineProperty"));function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.Producer=void 0;var m=e("./Logger"),b=e("./enhancedEvents"),v=e("./errors"),g=new m.Logger("Producer"),y=function(e){function t(e){var r,n,i,a,o=e.id,c=e.localId,l=e.rtpSender,f=e.track,m=e.rtpParameters,v=e.stopTracks,y=e.disableTrackOnPause,_=e.zeroRtpOnPause,w=e.appData;return(0,s.default)(this,t),n=this,i=t,i=(0,d.default)(i),r=(0,u.default)(n,h()?Reflect.construct(i,a||[],(0,d.default)(n).constructor):i.apply(n,a)),(0,p.default)(r,"_id",void 0),(0,p.default)(r,"_localId",void 0),(0,p.default)(r,"_closed",!1),(0,p.default)(r,"_rtpSender",void 0),(0,p.default)(r,"_track",void 0),(0,p.default)(r,"_kind",void 0),(0,p.default)(r,"_rtpParameters",void 0),(0,p.default)(r,"_paused",void 0),(0,p.default)(r,"_maxSpatialLayer",void 0),(0,p.default)(r,"_stopTracks",void 0),(0,p.default)(r,"_disableTrackOnPause",void 0),(0,p.default)(r,"_zeroRtpOnPause",void 0),(0,p.default)(r,"_appData",void 0),(0,p.default)(r,"_observer",new b.EnhancedEventEmitter),g.debug("constructor()"),r._id=o,r._localId=c,r._rtpSender=l,r._track=f,r._kind=f.kind,r._rtpParameters=m,r._paused=!!y&&!f.enabled,r._maxSpatialLayer=void 0,r._stopTracks=v,r._disableTrackOnPause=y,r._zeroRtpOnPause=_,r._appData=null!=w?w:{},r.onTrackEnded=r.onTrackEnded.bind(r),r.handleTrack(),r}return(0,f.default)(t,e),(0,c.default)(t,[{key:"id",get:function(){return this._id}},{key:"localId",get:function(){return this._localId}},{key:"closed",get:function(){return this._closed}},{key:"kind",get:function(){return this._kind}},{key:"rtpSender",get:function(){return this._rtpSender}},{key:"track",get:function(){return this._track}},{key:"rtpParameters",get:function(){return this._rtpParameters}},{key:"paused",get:function(){return this._paused}},{key:"maxSpatialLayer",get:function(){return this._maxSpatialLayer}},{key:"appData",get:function(){return this._appData},set:function(e){this._appData=e}},{key:"observer",get:function(){return this._observer}},{key:"close",value:function(){var e,r,n,i,a;this._closed||(g.debug("close()"),this._closed=!0,this.destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"),(e=t,r="close",n=this,i=3,a=(0,l.default)((0,d.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([]),this._observer.close())}},{key:"transportClosed",value:function(){this._closed||(g.debug("transportClosed()"),this._closed=!0,this.destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"getStats",value:(y=(0,o.default)(i.default.mark(function e(){var t=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}throw new v.InvalidStateError("closed");case 1:return e.abrupt("return",new Promise(function(e,r){t.safeEmit("@getstats",e,r)}));case 2:case"end":return e.stop()}},e,this)})),function(){return y.apply(this,arguments)})},{key:"pause",value:function(){var e=this;g.debug("pause()"),this._closed?g.error("pause() | Producer closed"):(this._paused=!0,this._track&&this._disableTrackOnPause&&(this._track.enabled=!1),this._zeroRtpOnPause&&new Promise(function(t,r){e.safeEmit("@pause",t,r)}).catch(function(){}),this._observer.safeEmit("pause"))}},{key:"resume",value:function(){var e=this;g.debug("resume()"),this._closed?g.error("resume() | Producer closed"):(this._paused=!1,this._track&&this._disableTrackOnPause&&(this._track.enabled=!0),this._zeroRtpOnPause&&new Promise(function(t,r){e.safeEmit("@resume",t,r)}).catch(function(){}),this._observer.safeEmit("resume"))}},{key:"replaceTrack",value:(m=(0,o.default)(i.default.mark(function e(t){var r,n=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.track,g.debug("replaceTrack() [track:%o]",r),!this._closed){e.next=1;break}if(r&&this._stopTracks)try{r.stop()}catch(e){}throw new v.InvalidStateError("closed");case 1:if(!r||"ended"!==r.readyState){e.next=2;break}throw new v.InvalidStateError("track ended");case 2:if(r!==this._track){e.next=3;break}return g.debug("replaceTrack() | same track, ignored"),e.abrupt("return");case 3:return e.next=4,new Promise(function(e,t){n.safeEmit("@replacetrack",r,e,t)});case 4:this.destroyTrack(),this._track=r,this._track&&this._disableTrackOnPause&&(this._paused?this._paused&&(this._track.enabled=!1):this._track.enabled=!0),this.handleTrack();case 5:case"end":return e.stop()}},e,this)})),function(e){return m.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(n=(0,o.default)(i.default.mark(function e(t){var r=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}throw new v.InvalidStateError("closed");case 1:if("video"===this._kind){e.next=2;break}throw new v.UnsupportedError("not a video Producer");case 2:if("number"==typeof t){e.next=3;break}throw new TypeError("invalid spatialLayer");case 3:if(t!==this._maxSpatialLayer){e.next=4;break}return e.abrupt("return");case 4:return e.next=5,new Promise(function(e,n){r.safeEmit("@setmaxspatiallayer",t,e,n)}).catch(function(){});case 5:this._maxSpatialLayer=t;case 6:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(r=(0,o.default)(i.default.mark(function e(t){var r=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}throw new v.InvalidStateError("closed");case 1:if("object"===(0,a.default)(t)){e.next=2;break}throw new TypeError("invalid params");case 2:return e.next=3,new Promise(function(e,n){r.safeEmit("@setrtpencodingparameters",t,e,n)});case 3:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"onTrackEnded",value:function(){g.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}},{key:"handleTrack",value:function(){this._track&&this._track.addEventListener("ended",this.onTrackEnded)}},{key:"destroyTrack",value:function(){if(this._track)try{this._track.removeEventListener("ended",this.onTrackEnded),this._stopTracks&&this._track.stop()}catch(e){}}}]);var r,n,m,y}(b.EnhancedEventEmitter);r.Producer=y},{"./Logger":302,"./enhancedEvents":305,"./errors":306,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/helpers/typeof":60,"@babel/runtime/regenerator":63}],304:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/toConsumableArray")),o=n(e("@babel/runtime/helpers/typeof")),s=n(e("@babel/runtime/helpers/asyncToGenerator")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/createClass")),p=n(e("@babel/runtime/helpers/classCallCheck")),h=n(e("@babel/runtime/helpers/defineProperty"));function m(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 b(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)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.Transport=void 0;var g=e("awaitqueue"),y=e("./Logger"),_=e("./enhancedEvents"),w=e("./errors"),k=e("./utils"),S=e("./ortc"),x=e("./Producer"),E=e("./Consumer"),P=e("./DataProducer"),R=e("./DataConsumer"),M=new y.Logger("Transport"),C=(0,f.default)(function e(t){var r=this;(0,p.default)(this,e),(0,h.default)(this,"consumerOptions",void 0),(0,h.default)(this,"promise",void 0),(0,h.default)(this,"resolve",void 0),(0,h.default)(this,"reject",void 0),this.consumerOptions=t,this.promise=new Promise(function(e,t){r.resolve=e,r.reject=t})}),T=function(e){function t(e){var r,n,i,a,o,s=e.direction,d=e.id,l=e.iceParameters,f=e.iceCandidates,m=e.dtlsParameters,b=e.sctpParameters,y=e.iceServers,w=e.iceTransportPolicy,S=e.additionalSettings,x=e.appData,E=e.handlerFactory,P=e.getSendExtendedRtpCapabilities,R=e.recvRtpCapabilities,C=e.canProduceByKind;(0,p.default)(this,t),i=this,a=t,a=(0,u.default)(a),n=(0,c.default)(i,v()?Reflect.construct(a,o||[],(0,u.default)(i).constructor):a.apply(i,o)),(0,h.default)(n,"_id",void 0),(0,h.default)(n,"_closed",!1),(0,h.default)(n,"_direction",void 0),(0,h.default)(n,"_getSendExtendedRtpCapabilities",void 0),(0,h.default)(n,"_recvRtpCapabilities",void 0),(0,h.default)(n,"_canProduceByKind",void 0),(0,h.default)(n,"_maxSctpMessageSize",void 0),(0,h.default)(n,"_handler",void 0),(0,h.default)(n,"_iceGatheringState","new"),(0,h.default)(n,"_connectionState","new"),(0,h.default)(n,"_appData",void 0),(0,h.default)(n,"_producers",new Map),(0,h.default)(n,"_consumers",new Map),(0,h.default)(n,"_dataProducers",new Map),(0,h.default)(n,"_dataConsumers",new Map),(0,h.default)(n,"_probatorConsumerCreated",!1),(0,h.default)(n,"_awaitQueue",new g.AwaitQueue),(0,h.default)(n,"_pendingConsumerTasks",[]),(0,h.default)(n,"_consumerCreationInProgress",!1),(0,h.default)(n,"_pendingPauseConsumers",new Map),(0,h.default)(n,"_consumerPauseInProgress",!1),(0,h.default)(n,"_pendingResumeConsumers",new Map),(0,h.default)(n,"_consumerResumeInProgress",!1),(0,h.default)(n,"_pendingCloseConsumers",new Map),(0,h.default)(n,"_consumerCloseInProgress",!1),(0,h.default)(n,"_observer",new _.EnhancedEventEmitter),M.debug("constructor() [id:%s, direction:%s]",d,s),n._id=d,n._direction=s,n._getSendExtendedRtpCapabilities=P,n._recvRtpCapabilities=R,n._canProduceByKind=C,n._maxSctpMessageSize=b?b.maxMessageSize:null;var T=null!==(r=k.clone(S))&&void 0!==r?r:{};return delete T.iceServers,delete T.iceTransportPolicy,delete T.bundlePolicy,delete T.rtcpMuxPolicy,n._handler=E.factory({direction:s,iceParameters:l,iceCandidates:f,dtlsParameters:m,sctpParameters:b,iceServers:y,iceTransportPolicy:w,additionalSettings:T,getSendExtendedRtpCapabilities:n._getSendExtendedRtpCapabilities}),n._appData=null!=x?x:{},n.handleHandler(),n}return(0,l.default)(t,e),(0,f.default)(t,[{key:"id",get:function(){return this._id}},{key:"closed",get:function(){return this._closed}},{key:"direction",get:function(){return this._direction}},{key:"handler",get:function(){return this._handler}},{key:"iceGatheringState",get:function(){return this._iceGatheringState}},{key:"connectionState",get:function(){return this._connectionState}},{key:"appData",get:function(){return this._appData},set:function(e){this._appData=e}},{key:"observer",get:function(){return this._observer}},{key:"close",value:function(){if(!this._closed){M.debug("close()"),this._closed=!0,this._awaitQueue.stop(),this._handler.close(),this._connectionState="closed";var e,r=m(this._producers.values());try{for(r.s();!(e=r.n()).done;){e.value.transportClosed()}}catch(e){r.e(e)}finally{r.f()}this._producers.clear();var n,i=m(this._consumers.values());try{for(i.s();!(n=i.n()).done;){n.value.transportClosed()}}catch(e){i.e(e)}finally{i.f()}this._consumers.clear();var a,o=m(this._dataProducers.values());try{for(o.s();!(a=o.n()).done;){a.value.transportClosed()}}catch(e){o.e(e)}finally{o.f()}this._dataProducers.clear();var s,c,l,f,p,h,b=m(this._dataConsumers.values());try{for(b.s();!(s=b.n()).done;){s.value.transportClosed()}}catch(e){b.e(e)}finally{b.f()}this._dataConsumers.clear(),this._observer.safeEmit("close"),(c=t,l="close",f=this,p=3,h=(0,d.default)((0,u.default)(1&p?c.prototype:c),l,f),2&p&&"function"==typeof h?function(e){return h.apply(f,e)}:h)([]),this._observer.close()}}},{key:"getStats",value:(I=(0,s.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}throw new w.InvalidStateError("closed");case 1:return e.abrupt("return",this._handler.getTransportStats());case 2:case"end":return e.stop()}},e,this)})),function(){return I.apply(this,arguments)})},{key:"restartIce",value:(A=(0,s.default)(i.default.mark(function e(t){var r,n=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.iceParameters,M.debug("restartIce()"),!this._closed){e.next=1;break}throw new w.InvalidStateError("closed");case 1:if(r){e.next=2;break}throw new TypeError("missing iceParameters");case 2:return e.abrupt("return",this._awaitQueue.push((0,s.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,n._handler.restartIce(r);case 1:return e.abrupt("return",e.sent);case 2:case"end":return e.stop()}},e)})),"transport.restartIce()"));case 3:case"end":return e.stop()}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"updateIceServers",value:(T=(0,s.default)(i.default.mark(function e(){var t,r=this,n=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(n.length>0&&void 0!==n[0]?n[0]:{}).iceServers,M.debug("updateIceServers()"),!this._closed){e.next=1;break}throw new w.InvalidStateError("closed");case 1:if(Array.isArray(t)){e.next=2;break}throw new TypeError("missing iceServers");case 2:return e.abrupt("return",this._awaitQueue.push((0,s.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",r._handler.updateIceServers(t));case 1:case"end":return e.stop()}},e)})),"transport.updateIceServers()"));case 3:case"end":return e.stop()}},e,this)})),function(){return T.apply(this,arguments)})},{key:"produce",value:(y=(0,s.default)(i.default.mark(function e(){var t,r,n,a,c,u,d,l,f,p,h,m,b,v,g=this,y=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=y.length>0&&void 0!==y[0]?y[0]:{}).track,n=t.encodings,a=t.codecOptions,c=t.codec,u=t.stopTracks,d=void 0===u||u,l=t.disableTrackOnPause,f=void 0===l||l,p=t.zeroRtpOnPause,h=void 0!==p&&p,m=t.onRtpSender,b=t.appData,v=void 0===b?{}:b,M.debug("produce() [track:%o]",r),!this._closed){e.next=1;break}throw new w.InvalidStateError("closed");case 1:if(r){e.next=2;break}throw new TypeError("missing track");case 2:if("send"===this._direction){e.next=3;break}throw new w.UnsupportedError("not a sending Transport");case 3:if(this._canProduceByKind[r.kind]){e.next=4;break}throw new w.UnsupportedError("cannot produce ".concat(r.kind));case 4:if("ended"!==r.readyState){e.next=5;break}throw new w.InvalidStateError("track ended");case 5:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=6;break}throw new TypeError('no "connect" listener set into this transport');case 6:if(0!==this.listenerCount("produce")){e.next=7;break}throw new TypeError('no "produce" listener set into this transport');case 7:if(!v||"object"===(0,o.default)(v)){e.next=8;break}throw new TypeError("if given, appData must be an object");case 8:return e.abrupt("return",this._awaitQueue.push((0,s.default)(i.default.mark(function e(){var t,o,s,u,l,p,b,y,_;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||Array.isArray(n)){e.next=1;break}throw TypeError("encodings must be an array");case 1:n&&0===n.length?t=void 0:n&&(t=n.map(function(e){var t={active:!0};return!1===e.active&&(t.active=!1),"boolean"==typeof e.dtx&&(t.dtx=e.dtx),"string"==typeof e.scalabilityMode&&(t.scalabilityMode=e.scalabilityMode),"number"==typeof e.scaleResolutionDownBy&&(t.scaleResolutionDownBy=e.scaleResolutionDownBy),"number"==typeof e.maxBitrate&&(t.maxBitrate=e.maxBitrate),"number"==typeof e.maxFramerate&&(t.maxFramerate=e.maxFramerate),"boolean"==typeof e.adaptivePtime&&(t.adaptivePtime=e.adaptivePtime),"string"==typeof e.priority&&(t.priority=e.priority),"string"==typeof e.networkPriority&&(t.networkPriority=e.networkPriority),t}));case 2:return e.next=3,g._handler.send({track:r,encodings:t,codecOptions:a,codec:c,onRtpSender:m});case 3:return o=e.sent,s=o.localId,u=o.rtpParameters,l=o.rtpSender,e.prev=4,S.validateAndNormalizeRtpParameters(u),e.next=5,new Promise(function(e,t){g.safeEmit("produce",{kind:r.kind,rtpParameters:u,appData:v},e,t)});case 5:return p=e.sent,b=p.id,y=new x.Producer({id:b,localId:s,rtpSender:l,track:r,rtpParameters:u,stopTracks:d,disableTrackOnPause:f,zeroRtpOnPause:h,appData:v}),g._producers.set(y.id,y),g.handleProducer(y),g._observer.safeEmit("newproducer",y),e.abrupt("return",y);case 6:throw e.prev=6,_=e.catch(4),g._handler.stopSending(s).catch(function(){}),_;case 7:case"end":return e.stop()}},e,null,[[4,6]])})),"transport.produce()").catch(function(e){if(d)try{r.stop()}catch(e){}throw e}));case 9:case"end":return e.stop()}},e,this)})),function(){return y.apply(this,arguments)})},{key:"consume",value:(b=(0,s.default)(i.default.mark(function e(t){var r,n,a,s,c,u,d,l,f,p,h=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.id,n=t.producerId,a=t.kind,s=t.rtpParameters,c=t.streamId,u=t.onRtpReceiver,d=t.appData,l=void 0===d?{}:d,M.debug("consume()"),!this._closed){e.next=1;break}throw new w.InvalidStateError("closed");case 1:if("recv"===this._direction){e.next=2;break}throw new w.UnsupportedError("not a receiving Transport");case 2:if("string"==typeof r){e.next=3;break}throw new TypeError("missing id");case 3:if("string"==typeof n){e.next=4;break}throw new TypeError("missing producerId");case 4:if("audio"===a||"video"===a){e.next=5;break}throw new TypeError("invalid kind '".concat(a,"'"));case 5:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=6;break}throw new TypeError('no "connect" listener set into this transport');case 6:if(!l||"object"===(0,o.default)(l)){e.next=7;break}throw new TypeError("if given, appData must be an object");case 7:if(f=k.clone(s),S.canReceive(f,this._recvRtpCapabilities)){e.next=8;break}throw new w.UnsupportedError("cannot consume this Producer");case 8:return p=new C({id:r,producerId:n,kind:a,rtpParameters:f,streamId:c,onRtpReceiver:u,appData:l}),this._pendingConsumerTasks.push(p),queueMicrotask(function(){h._closed||!1===h._consumerCreationInProgress&&h.createPendingConsumers()}),e.abrupt("return",p.promise);case 9:case"end":return e.stop()}},e,this)})),function(e){return b.apply(this,arguments)})},{key:"produceData",value:(n=(0,s.default)(i.default.mark(function e(){var t,r,n,a,c,u,d,l,f,p,h,m=this,b=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=b.length>0&&void 0!==b[0]?b[0]:{}).ordered,n=void 0===r||r,a=t.maxPacketLifeTime,c=t.maxRetransmits,u=t.label,d=void 0===u?"":u,l=t.protocol,f=void 0===l?"":l,p=t.appData,h=void 0===p?{}:p,M.debug("produceData()"),!this._closed){e.next=1;break}throw new w.InvalidStateError("closed");case 1:if("send"===this._direction){e.next=2;break}throw new w.UnsupportedError("not a sending Transport");case 2:if(this._maxSctpMessageSize){e.next=3;break}throw new w.UnsupportedError("SCTP not enabled by remote Transport");case 3:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=4;break}throw new TypeError('no "connect" listener set into this transport');case 4:if(0!==this.listenerCount("producedata")){e.next=5;break}throw new TypeError('no "producedata" listener set into this transport');case 5:if(!h||"object"===(0,o.default)(h)){e.next=6;break}throw new TypeError("if given, appData must be an object");case 6:return(a||c)&&(n=!1),e.abrupt("return",this._awaitQueue.push((0,s.default)(i.default.mark(function e(){var t,r,o,s,u,l;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,m._handler.sendDataChannel({ordered:n,maxPacketLifeTime:a,maxRetransmits:c,label:d,protocol:f});case 1:return t=e.sent,r=t.dataChannel,o=t.sctpStreamParameters,S.validateAndNormalizeSctpStreamParameters(o),e.next=2,new Promise(function(e,t){m.safeEmit("producedata",{sctpStreamParameters:o,label:d,protocol:f,appData:h},e,t)});case 2:return s=e.sent,u=s.id,l=new P.DataProducer({id:u,dataChannel:r,sctpStreamParameters:o,appData:h}),m._dataProducers.set(l.id,l),m.handleDataProducer(l),m._observer.safeEmit("newdataproducer",l),e.abrupt("return",l);case 3:case"end":return e.stop()}},e)})),"transport.produceData()"));case 7:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"consumeData",value:(r=(0,s.default)(i.default.mark(function e(t){var r,n,a,c,u,d,l,f,p,h,m=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.id,n=t.dataProducerId,a=t.sctpStreamParameters,c=t.label,u=void 0===c?"":c,d=t.protocol,l=void 0===d?"":d,f=t.appData,p=void 0===f?{}:f,M.debug("consumeData()"),!this._closed){e.next=1;break}throw new w.InvalidStateError("closed");case 1:if("recv"===this._direction){e.next=2;break}throw new w.UnsupportedError("not a receiving Transport");case 2:if(this._maxSctpMessageSize){e.next=3;break}throw new w.UnsupportedError("SCTP not enabled by remote Transport");case 3:if("string"==typeof r){e.next=4;break}throw new TypeError("missing id");case 4:if("string"==typeof n){e.next=5;break}throw new TypeError("missing dataProducerId");case 5:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=6;break}throw new TypeError('no "connect" listener set into this transport');case 6:if(!p||"object"===(0,o.default)(p)){e.next=7;break}throw new TypeError("if given, appData must be an object");case 7:return h=k.clone(a),S.validateAndNormalizeSctpStreamParameters(h),e.abrupt("return",this._awaitQueue.push((0,s.default)(i.default.mark(function e(){var t,a,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,m._handler.receiveDataChannel({sctpStreamParameters:h,label:u,protocol:l});case 1:return t=e.sent,a=t.dataChannel,o=new R.DataConsumer({id:r,dataProducerId:n,dataChannel:a,sctpStreamParameters:h,appData:p}),m._dataConsumers.set(o.id,o),m.handleDataConsumer(o),m._observer.safeEmit("newdataconsumer",o),e.abrupt("return",o);case 2:case"end":return e.stop()}},e)})),"transport.consumeData()"));case 8:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"createPendingConsumers",value:function(){var e=this;this._consumerCreationInProgress=!0,this._awaitQueue.push((0,s.default)(i.default.mark(function t(){var r,n,o,s,c,u,d,l,f,p,h,b,v,g,y,_,w,k,x,P,R,C,T,A,I,O,j,D,L,B,N;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==e._pendingConsumerTasks.length){t.next=1;break}return M.debug("createPendingConsumers() | there is no Consumer to be created"),t.abrupt("return");case 1:r=(0,a.default)(e._pendingConsumerTasks),e._pendingConsumerTasks=[],n=void 0,o=[],s=m(r);try{for(s.s();!(c=s.n()).done;)u=c.value,d=u.consumerOptions,l=d.id,f=d.kind,p=d.rtpParameters,h=d.streamId,b=d.onRtpReceiver,o.push({trackId:l,kind:f,rtpParameters:p,streamId:h,onRtpReceiver:b})}catch(e){s.e(e)}finally{s.f()}return t.prev=2,t.next=3,e._handler.receive(o);case 3:for(v=t.sent,g=0;g<v.length;++g)y=r[g],_=v[g],w=y.consumerOptions,k=w.id,x=w.producerId,P=w.kind,R=w.rtpParameters,C=w.appData,T=_.localId,A=_.rtpReceiver,I=_.track,O=new E.Consumer({id:k,localId:T,producerId:x,rtpReceiver:A,track:I,rtpParameters:R,appData:C}),e._consumers.set(O.id,O),e.handleConsumer(O),e._probatorConsumerCreated||n||"video"!==P||(n=O),e._observer.safeEmit("newconsumer",O),y.resolve(O);t.next=5;break;case 4:t.prev=4,B=t.catch(2),j=m(r);try{for(j.s();!(D=j.n()).done;)D.value.reject(B)}catch(e){j.e(e)}finally{j.f()}case 5:if(!n){t.next=9;break}return t.prev=6,L=S.generateProbatorRtpParameters(n.rtpParameters),t.next=7,e._handler.receive([{trackId:"probator",kind:"video",rtpParameters:L}]);case 7:M.debug("createPendingConsumers() | Consumer for RTP probation created"),e._probatorConsumerCreated=!0,t.next=9;break;case 8:t.prev=8,N=t.catch(6),M.error("createPendingConsumers() | failed to create Consumer for RTP probation:%o",N);case 9:case"end":return t.stop()}},t,null,[[2,4],[6,8]])})),"transport.createPendingConsumers()").then(function(){e._consumerCreationInProgress=!1,e._pendingConsumerTasks.length>0&&e.createPendingConsumers()}).catch(function(){})}},{key:"pausePendingConsumers",value:function(){var e=this;this._consumerPauseInProgress=!0,this._awaitQueue.push((0,s.default)(i.default.mark(function t(){var r,n,a;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==e._pendingPauseConsumers.size){t.next=1;break}return M.debug("pausePendingConsumers() | there is no Consumer to be paused"),t.abrupt("return");case 1:return r=Array.from(e._pendingPauseConsumers.values()),e._pendingPauseConsumers.clear(),t.prev=2,n=r.map(function(e){return e.localId}),t.next=3,e._handler.pauseReceiving(n);case 3:t.next=5;break;case 4:t.prev=4,a=t.catch(2),M.error("pausePendingConsumers() | failed to pause Consumers:",a);case 5:case"end":return t.stop()}},t,null,[[2,4]])})),"transport.pausePendingConsumers").then(function(){e._consumerPauseInProgress=!1,e._pendingPauseConsumers.size>0&&e.pausePendingConsumers()}).catch(function(){})}},{key:"resumePendingConsumers",value:function(){var e=this;this._consumerResumeInProgress=!0,this._awaitQueue.push((0,s.default)(i.default.mark(function t(){var r,n,a;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==e._pendingResumeConsumers.size){t.next=1;break}return M.debug("resumePendingConsumers() | there is no Consumer to be resumed"),t.abrupt("return");case 1:return r=Array.from(e._pendingResumeConsumers.values()),e._pendingResumeConsumers.clear(),t.prev=2,n=r.map(function(e){return e.localId}),t.next=3,e._handler.resumeReceiving(n);case 3:t.next=5;break;case 4:t.prev=4,a=t.catch(2),M.error("resumePendingConsumers() | failed to resume Consumers:",a);case 5:case"end":return t.stop()}},t,null,[[2,4]])})),"transport.resumePendingConsumers").then(function(){e._consumerResumeInProgress=!1,e._pendingResumeConsumers.size>0&&e.resumePendingConsumers()}).catch(function(){})}},{key:"closePendingConsumers",value:function(){var e=this;this._consumerCloseInProgress=!0,this._awaitQueue.push((0,s.default)(i.default.mark(function t(){var r,n;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==e._pendingCloseConsumers.size){t.next=1;break}return M.debug("closePendingConsumers() | there is no Consumer to be closed"),t.abrupt("return");case 1:return r=Array.from(e._pendingCloseConsumers.values()),e._pendingCloseConsumers.clear(),t.prev=2,t.next=3,e._handler.stopReceiving(r.map(function(e){return e.localId}));case 3:t.next=5;break;case 4:t.prev=4,n=t.catch(2),M.error("closePendingConsumers() | failed to close Consumers:",n);case 5:case"end":return t.stop()}},t,null,[[2,4]])})),"transport.closePendingConsumers").then(function(){e._consumerCloseInProgress=!1,e._pendingCloseConsumers.size>0&&e.closePendingConsumers()}).catch(function(){})}},{key:"handleHandler",value:function(){var e=this,t=this._handler;t.on("@connect",function(t,r,n){var i=t.dtlsParameters;e._closed?n(new w.InvalidStateError("closed")):e.safeEmit("connect",{dtlsParameters:i},r,n)}),t.on("@icegatheringstatechange",function(t){t!==e._iceGatheringState&&(M.debug("ICE gathering state changed to %s",t),e._iceGatheringState=t,e._closed||e.safeEmit("icegatheringstatechange",t))}),t.on("@icecandidateerror",function(t){M.warn("ICE candidate error [url:".concat(t.url,", localAddress:").concat(t.address,", localPort:").concat(t.port,"]: ").concat(t.errorCode,' "').concat(t.errorText,'"')),e.safeEmit("icecandidateerror",t)}),t.on("@connectionstatechange",function(t){t!==e._connectionState&&(M.debug("connection state changed to %s",t),e._connectionState=t,e._closed||e.safeEmit("connectionstatechange",t))})}},{key:"handleProducer",value:function(e){var t=this;e.on("@close",function(){t._producers.delete(e.id),t._closed||t._awaitQueue.push((0,s.default)(i.default.mark(function r(){return i.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=1,t._handler.stopSending(e.localId);case 1:return r.abrupt("return",r.sent);case 2:case"end":return r.stop()}},r)})),"producer @close event").catch(function(e){return M.warn("producer.close() failed:%o",e)})}),e.on("@pause",function(r,n){t._awaitQueue.push((0,s.default)(i.default.mark(function r(){return i.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=1,t._handler.pauseSending(e.localId);case 1:return r.abrupt("return",r.sent);case 2:case"end":return r.stop()}},r)})),"producer @pause event").then(r).catch(n)}),e.on("@resume",function(r,n){t._awaitQueue.push((0,s.default)(i.default.mark(function r(){return i.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=1,t._handler.resumeSending(e.localId);case 1:return r.abrupt("return",r.sent);case 2:case"end":return r.stop()}},r)})),"producer @resume event").then(r).catch(n)}),e.on("@replacetrack",function(r,n,a){t._awaitQueue.push((0,s.default)(i.default.mark(function n(){return i.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=1,t._handler.replaceTrack(e.localId,r);case 1:return n.abrupt("return",n.sent);case 2:case"end":return n.stop()}},n)})),"producer @replacetrack event").then(n).catch(a)}),e.on("@setmaxspatiallayer",function(r,n,a){t._awaitQueue.push((0,s.default)(i.default.mark(function n(){return i.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=1,t._handler.setMaxSpatialLayer(e.localId,r);case 1:return n.abrupt("return",n.sent);case 2:case"end":return n.stop()}},n)})),"producer @setmaxspatiallayer event").then(n).catch(a)}),e.on("@setrtpencodingparameters",function(r,n,a){t._awaitQueue.push((0,s.default)(i.default.mark(function n(){return i.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=1,t._handler.setRtpEncodingParameters(e.localId,r);case 1:return n.abrupt("return",n.sent);case 2:case"end":return n.stop()}},n)})),"producer @setrtpencodingparameters event").then(n).catch(a)}),e.on("@getstats",function(r,n){if(t._closed)return n(new w.InvalidStateError("closed"));t._handler.getSenderStats(e.localId).then(r).catch(n)})}},{key:"handleConsumer",value:function(e){var t=this;e.on("@close",function(){t._consumers.delete(e.id),t._pendingPauseConsumers.delete(e.id),t._pendingResumeConsumers.delete(e.id),t._closed||(t._pendingCloseConsumers.set(e.id,e),!1===t._consumerCloseInProgress&&t.closePendingConsumers())}),e.on("@pause",function(){t._pendingResumeConsumers.has(e.id)&&t._pendingResumeConsumers.delete(e.id),t._pendingPauseConsumers.set(e.id,e),queueMicrotask(function(){t._closed||!1===t._consumerPauseInProgress&&t.pausePendingConsumers()})}),e.on("@resume",function(){t._pendingPauseConsumers.has(e.id)&&t._pendingPauseConsumers.delete(e.id),t._pendingResumeConsumers.set(e.id,e),queueMicrotask(function(){t._closed||!1===t._consumerResumeInProgress&&t.resumePendingConsumers()})}),e.on("@getstats",function(r,n){if(t._closed)return n(new w.InvalidStateError("closed"));t._handler.getReceiverStats(e.localId).then(r).catch(n)})}},{key:"handleDataProducer",value:function(e){var t=this;e.on("@close",function(){t._dataProducers.delete(e.id)})}},{key:"handleDataConsumer",value:function(e){var t=this;e.on("@close",function(){t._dataConsumers.delete(e.id)})}}]);var r,n,b,y,T,A,I}(_.EnhancedEventEmitter);r.Transport=T},{"./Consumer":298,"./DataConsumer":299,"./DataProducer":300,"./Logger":302,"./Producer":303,"./enhancedEvents":305,"./errors":306,"./ortc":320,"./utils":324,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/helpers/toConsumableArray":57,"@babel/runtime/helpers/typeof":60,"@babel/runtime/regenerator":63,awaitqueue:83}],305:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass")),o=n(e("@babel/runtime/helpers/possibleConstructorReturn")),s=n(e("@babel/runtime/helpers/getPrototypeOf")),c=n(e("@babel/runtime/helpers/get")),u=n(e("@babel/runtime/helpers/inherits"));function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function l(e,t,r,n){var i=(0,c.default)((0,s.default)(1&n?e.prototype:e),t,r);return 2&n&&"function"==typeof i?function(e){return i.apply(r,e)}:i}Object.defineProperty(r,"__esModule",{value:!0}),r.EnhancedEventEmitter=void 0;var f=e("events-alias"),p=new(e("./Logger").Logger)("EnhancedEventEmitter"),h=function(e){function t(){var e,r,n,a;return(0,i.default)(this,t),r=this,n=t,n=(0,s.default)(n),(e=(0,o.default)(r,d()?Reflect.construct(n,a||[],(0,s.default)(r).constructor):n.apply(r,a))).setMaxListeners(1/0),e}return(0,u.default)(t,e),(0,a.default)(t,[{key:"close",value:function(){l(t,"removeAllListeners",this,3)([])}},{key:"emit",value:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return l(t,"emit",this,3)([e].concat(n))}},{key:"safeEmit",value:function(e){try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return l(t,"emit",this,3)([e].concat(n))}catch(r){p.error("safeEmit() | event listener threw an error [eventName:%s]:%o",e,r);try{l(t,"emit",this,3)(["listenererror",e,r])}catch(e){}return Boolean(l(t,"listenerCount",this,3)([e]))}}},{key:"on",value:function(e,r){return l(t,"on",this,3)([e,r]),this}},{key:"off",value:function(e,r){return l(t,"off",this,3)([e,r]),this}},{key:"addListener",value:function(e,r){return l(t,"on",this,3)([e,r]),this}},{key:"prependListener",value:function(e,r){return l(t,"prependListener",this,3)([e,r]),this}},{key:"once",value:function(e,r){return l(t,"once",this,3)([e,r]),this}},{key:"prependOnceListener",value:function(e,r){return l(t,"prependOnceListener",this,3)([e,r]),this}},{key:"removeListener",value:function(e,r){return l(t,"off",this,3)([e,r]),this}},{key:"removeAllListeners",value:function(e){return l(t,"removeAllListeners",this,3)([e]),this}},{key:"listenerCount",value:function(e){return l(t,"listenerCount",this,3)([e])}},{key:"listeners",value:function(e){return l(t,"listeners",this,3)([e])}},{key:"rawListeners",value:function(e){return l(t,"rawListeners",this,3)([e])}}])}(f.EventEmitter);r.EnhancedEventEmitter=h},{"./Logger":302,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"events-alias":204}],306:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/createClass")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/possibleConstructorReturn")),s=n(e("@babel/runtime/helpers/getPrototypeOf")),c=n(e("@babel/runtime/helpers/inherits")),u=n(e("@babel/runtime/helpers/wrapNativeSuper"));function d(e,t,r){return t=(0,s.default)(t),(0,o.default)(e,l()?Reflect.construct(t,r||[],(0,s.default)(e).constructor):t.apply(e,r))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.InvalidStateError=r.UnsupportedError=void 0;var f=function(e){function t(e){var r;return(0,a.default)(this,t),(r=d(this,t,[e])).name="UnsupportedError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,t):r.stack=new Error(e).stack,r}return(0,c.default)(t,e),(0,i.default)(t)}((0,u.default)(Error));r.UnsupportedError=f;var p=function(e){function t(e){var r;return(0,a.default)(this,t),(r=d(this,t,[e])).name="InvalidStateError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,t):r.stack=new Error(e).stack,r}return(0,c.default)(t,e),(0,i.default)(t)}((0,u.default)(Error));r.InvalidStateError=p},{"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/helpers/wrapNativeSuper":62}],307:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/defineProperty"));function p(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(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,f.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 v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.Chrome111=void 0;var g=e("sdp-transform"),y=e("../enhancedEvents"),_=e("../Logger"),w=e("../ortc"),k=e("../errors"),S=e("../scalabilityModes"),x=e("./sdp/commonUtils"),E=e("./sdp/unifiedPlanUtils"),P=e("./ortc/utils"),R=e("./sdp/RemoteSdp"),M=new _.Logger("Chrome111"),C="Chrome111",T={OS:1024,MIS:1024},A=function(e){function t(e){var r,n,i,a,s=e.direction,d=e.iceParameters,l=e.iceCandidates,p=e.dtlsParameters,h=e.sctpParameters,m=e.iceServers,g=e.iceTransportPolicy,y=e.additionalSettings,_=e.getSendExtendedRtpCapabilities;return(0,o.default)(this,t),n=this,i=t,i=(0,u.default)(i),r=(0,c.default)(n,v()?Reflect.construct(i,a||[],(0,u.default)(n).constructor):i.apply(n,a)),(0,f.default)(r,"_closed",!1),(0,f.default)(r,"_direction",void 0),(0,f.default)(r,"_remoteSdp",void 0),(0,f.default)(r,"_getSendExtendedRtpCapabilities",void 0),(0,f.default)(r,"_forcedLocalDtlsRole",void 0),(0,f.default)(r,"_pc",void 0),(0,f.default)(r,"_mapMidTransceiver",new Map),(0,f.default)(r,"_sendStream",new MediaStream),(0,f.default)(r,"_hasDataChannelMediaSection",!1),(0,f.default)(r,"_nextSendSctpStreamId",0),(0,f.default)(r,"_transportReady",!1),(0,f.default)(r,"onIceGatheringStateChange",function(){r.emit("@icegatheringstatechange",r._pc.iceGatheringState)}),(0,f.default)(r,"onIceCandidateError",function(e){r.emit("@icecandidateerror",e)}),(0,f.default)(r,"onConnectionStateChange",function(){r.emit("@connectionstatechange",r._pc.connectionState)}),(0,f.default)(r,"onIceConnectionStateChange",function(){switch(r._pc.iceConnectionState){case"checking":r.emit("@connectionstatechange","connecting");break;case"connected":case"completed":r.emit("@connectionstatechange","connected");break;case"failed":r.emit("@connectionstatechange","failed");break;case"disconnected":r.emit("@connectionstatechange","disconnected");break;case"closed":r.emit("@connectionstatechange","closed")}}),M.debug("constructor()"),r._direction=s,r._remoteSdp=new R.RemoteSdp({iceParameters:d,iceCandidates:l,dtlsParameters:p,sctpParameters:h}),r._getSendExtendedRtpCapabilities=_,p.role&&"auto"!==p.role&&(r._forcedLocalDtlsRole="server"===p.role?"client":"server"),r._pc=new RTCPeerConnection(b({iceServers:null!=m?m:[],iceTransportPolicy:null!=g?g:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},y)),r._pc.addEventListener("icegatheringstatechange",r.onIceGatheringStateChange),r._pc.addEventListener("icecandidateerror",r.onIceCandidateError),r._pc.connectionState?r._pc.addEventListener("connectionstatechange",r.onConnectionStateChange):(M.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),r._pc.addEventListener("iceconnectionstatechange",r.onIceConnectionStateChange)),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return C}},{key:"close",value:function(){if(M.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}var e,r,n,i,a;this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),(e=t,r="close",n=this,i=3,a=(0,d.default)((0,u.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([])}}},{key:"updateIceServers",value:(V=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),M.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 1:case"end":return e.stop()}},e,this)})),function(e){return V.apply(this,arguments)})},{key:"restartIce",value:(z=(0,a.default)(i.default.mark(function e(t){var r,n,a,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),M.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=1;break}return e.abrupt("return");case 1:if("send"!==this._direction){e.next=5;break}return e.next=2,this._pc.createOffer({iceRestart:!0});case 2:return r=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=3,this._pc.setLocalDescription(r);case 3:return n={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=4,this._pc.setRemoteDescription(n);case 4:e.next=8;break;case 5:return a={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=6,this._pc.setRemoteDescription(a);case 6:return e.next=7,this._pc.createAnswer();case 7:return o=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=8,this._pc.setLocalDescription(o);case 8:case"end":return e.stop()}},e,this)})),function(e){return z.apply(this,arguments)})},{key:"getTransportStats",value:(q=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}},e,this)})),function(){return q.apply(this,arguments)})},{key:"send",value:(U=(0,a.default)(i.default.mark(function e(r){var n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,k,P,R,C,T,A,I,O;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.track,a=r.encodings,o=r.codecOptions,s=r.codec,c=r.onRtpSender,this.assertNotClosed(),this.assertSendDirection(),M.debug("send() [kind:%s, track.id:%s]",n.kind,n.id),a&&a.length>1){u=1,d=p(a);try{for(d.s();!(l=d.n()).done;)f=l.value,(h=f.scalabilityMode?(0,S.parse)(f.scalabilityMode).temporalLayers:3)>u&&(u=h)}catch(e){d.e(e)}finally{d.f()}a.forEach(function(e,t){e.rid="r".concat(t),e.scalabilityMode="L1T".concat(u)})}return m=this._remoteSdp.getNextMediaSectionIdx(),b=this._pc.addTransceiver(n,{direction:"sendonly",streams:[this._sendStream],sendEncodings:a}),c&&c(b.sender),e.next=1,this._pc.createOffer();case 1:if(v=e.sent,(y=g.parse(v.sdp)).extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed(),_=t.getLocalRtpCapabilities(y),k=this._getSendExtendedRtpCapabilities(_),(P=w.getSendingRtpParameters(n.kind,k)).codecs=w.reduceCodecs(P.codecs,s),(R=w.getSendingRemoteRtpParameters(n.kind,k)).codecs=w.reduceCodecs(R.codecs,s),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(C=this._forcedLocalDtlsRole)&&void 0!==C?C:"client",localSdpObject:y});case 2:return M.debug("send() | calling pc.setLocalDescription() [offer:%o]",v),e.next=3,this._pc.setLocalDescription(v);case 3:return T=b.mid,P.mid=T,y=g.parse(this._pc.localDescription.sdp),A=y.media[m.idx],P.rtcp.cname=x.getCname({offerMediaObject:A}),a?1===a.length?(I=E.getRtpEncodings({offerMediaObject:A}),Object.assign(I[0],a[0]),P.encodings=I):P.encodings=a:P.encodings=E.getRtpEncodings({offerMediaObject:A}),this._remoteSdp.send({offerMediaObject:A,reuseMid:m.reuseMid,offerRtpParameters:P,answerRtpParameters:R,codecOptions:o}),O={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("send() | calling pc.setRemoteDescription() [answer:%o]",O),e.next=4,this._pc.setRemoteDescription(O);case 4:return this._mapMidTransceiver.set(T,b),e.abrupt("return",{localId:T,rtpParameters:P,rtpSender:b.sender});case 5:case"end":return e.stop()}},e,this)})),function(e){return U.apply(this,arguments)})},{key:"stopSending",value:(F=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertSendDirection(),M.debug("stopSending() [localId:%s]",t),!this._closed){e.next=1;break}return e.abrupt("return");case 1:if(r=this._mapMidTransceiver.get(t)){e.next=2;break}throw new Error("associated RTCRtpTransceiver not found");case 2:if(r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.closeMediaSection(r.mid))try{r.stop()}catch(e){}return e.next=3,this._pc.createOffer();case 3:return n=e.sent,M.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=4,this._pc.setLocalDescription(n);case 4:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=5,this._pc.setRemoteDescription(a);case 5:this._mapMidTransceiver.delete(t);case 6:case"end":return e.stop()}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"pauseSending",value:(N=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("pauseSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="inactive",this._remoteSdp.pauseMediaSection(t),e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"resumeSending",value:(B=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("resumeSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t),this._remoteSdp.resumeSendingMediaSection(t),r){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="sendonly",e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return B.apply(this,arguments)})},{key:"replaceTrack",value:(L=(0,a.default)(i.default.mark(function e(t,r){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r?M.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):M.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.next=2,n.sender.replaceTrack(r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return L.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(D=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){e.active=t<=r}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(j=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){a.encodings[t]=b(b({},e),r)}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return j.apply(this,arguments)})},{key:"getSenderStats",value:(O=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.sender.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"sendDataChannel",value:(I=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,a=t.maxRetransmits,o=t.label,s=t.protocol,this.assertNotClosed(),this.assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:a,protocol:s},M.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%T.MIS,this._hasDataChannelMediaSection){e.next=5;break}return e.next=1,this._pc.createOffer();case 1:if(d=e.sent,l=g.parse(d.sdp),f=l.media.find(function(e){return"application"===e.type}),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(p=this._forcedLocalDtlsRole)&&void 0!==p?p:"client",localSdpObject:l});case 2:return M.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=3,this._pc.setLocalDescription(d);case 3:return this._remoteSdp.sendSctpAssociation({offerMediaObject:f}),h={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=4,this._pc.setRemoteDescription(h);case 4:this._hasDataChannelMediaSection=!0;case 5:return m={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:m});case 6:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"receive",value:(A=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,w,k,S,E,P,R,C,T,A,I,O,j=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=[],n=new Map,a=p(t);try{for(a.s();!(o=a.n()).done;)c=o.value,u=c.trackId,d=c.kind,l=c.rtpParameters,f=c.streamId,M.debug("receive() [trackId:%s, kind:%s]",u,d),h=null!==(s=l.mid)&&void 0!==s?s:String(this._mapMidTransceiver.size),n.set(u,h),this._remoteSdp.receive({mid:h,kind:d,offerRtpParameters:l,streamId:null!=f?f:l.rtcp.cname,trackId:u})}catch(e){a.e(e)}finally{a.f()}return m={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",m),e.next=1,this._pc.setRemoteDescription(m);case 1:b=p(t),e.prev=2,y=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=v.value,r=t.trackId,!(a=t.onRtpReceiver)){e.next=2;break}if(o=n.get(r),s=j._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("transceiver not found");case 1:a(s.receiver);case 2:case"end":return e.stop()}},e)}),b.s();case 3:if((v=b.n()).done){e.next=5;break}return e.delegateYield(y(),"t0",4);case 4:e.next=3;break;case 5:e.next=7;break;case 6:e.prev=6,A=e.catch(2),b.e(A);case 7:return e.prev=7,b.f(),e.finish(7);case 8:return e.next=9,this._pc.createAnswer();case 9:_=e.sent,w=g.parse(_.sdp),k=p(t),e.prev=10,E=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=S.value,r=t.trackId,a=t.rtpParameters,o=n.get(r),s=w.media.find(function(e){return String(e.mid)===o}),x.applyCodecParameters({offerRtpParameters:a,answerMediaObject:s});case 1:case"end":return e.stop()}},e)}),k.s();case 11:if((S=k.n()).done){e.next=13;break}return e.delegateYield(E(),"t1",12);case 12:e.next=11;break;case 13:e.next=15;break;case 14:e.prev=14,I=e.catch(10),k.e(I);case 15:return e.prev=15,k.f(),e.finish(15);case 16:if(_={type:"answer",sdp:g.write(w)},this._transportReady){e.next=17;break}return e.next=17,this.setupTransport({localDtlsRole:null!==(P=this._forcedLocalDtlsRole)&&void 0!==P?P:"client",localSdpObject:w});case 17:return M.debug("receive() | calling pc.setLocalDescription() [answer:%o]",_),e.next=18,this._pc.setLocalDescription(_);case 18:R=p(t),e.prev=19,T=i.default.mark(function e(){var t,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=C.value,a=t.trackId,o=n.get(a),s=j._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("new RTCRtpTransceiver not found");case 1:j._mapMidTransceiver.set(o,s),r.push({localId:o,track:s.receiver.track,rtpReceiver:s.receiver});case 2:case"end":return e.stop()}},e)}),R.s();case 20:if((C=R.n()).done){e.next=22;break}return e.delegateYield(T(),"t2",21);case 21:e.next=20;break;case 22:e.next=24;break;case 23:e.prev=23,O=e.catch(19),R.e(O);case 24:return e.prev=24,R.f(),e.finish(24);case 25:return e.abrupt("return",r);case 26:case"end":return e.stop()}},e,this,[[2,6,7,8],[10,14,15,16],[19,23,24,25]])})),function(e){return A.apply(this,arguments)})},{key:"stopReceiving",value:(_=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertRecvDirection(),!this._closed){e.next=1;break}return e.abrupt("return");case 1:r=p(t),e.prev=2,r.s();case 3:if((n=r.n()).done){e.next=6;break}if(a=n.value,M.debug("stopReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:this._remoteSdp.closeMediaSection(o.mid);case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,f=e.catch(2),r.e(f);case 8:return e.prev=8,r.f(),e.finish(8);case 9:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=10,this._pc.setRemoteDescription(s);case 10:return e.next=11,this._pc.createAnswer();case 11:return c=e.sent,M.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=12,this._pc.setLocalDescription(c);case 12:u=p(t);try{for(u.s();!(d=u.n()).done;)l=d.value,this._mapMidTransceiver.delete(l)}catch(e){u.e(e)}finally{u.f()}case 13:case"end":return e.stop()}},e,this,[[2,7,8,9]])})),function(e){return _.apply(this,arguments)})},{key:"pauseReceiving",value:(y=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("pauseReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="inactive",this._remoteSdp.pauseMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return y.apply(this,arguments)})},{key:"resumeReceiving",value:(m=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("resumeReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return m.apply(this,arguments)})},{key:"getReceiverStats",value:(h=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.receiver.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return h.apply(this,arguments)})},{key:"receiveDataChannel",value:(n=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,a=t.protocol,this.assertNotClosed(),this.assertRecvDirection(),o=r.streamId,s=r.ordered,c=r.maxPacketLifeTime,u=r.maxRetransmits,d={negotiated:!0,id:o,ordered:s,maxPacketLifeTime:c,maxRetransmits:u,protocol:a},M.debug("receiveDataChannel() [options:%o]",d),l=this._pc.createDataChannel(n,d),this._hasDataChannelMediaSection){e.next=5;break}return this._remoteSdp.receiveSctpAssociation(),f={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",f),e.next=1,this._pc.setRemoteDescription(f);case 1:return e.next=2,this._pc.createAnswer();case 2:if(p=e.sent,this._transportReady){e.next=3;break}return m=g.parse(p.sdp),e.next=3,this.setupTransport({localDtlsRole:null!==(h=this._forcedLocalDtlsRole)&&void 0!==h?h:"client",localSdpObject:m});case 3:return M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=4,this._pc.setLocalDescription(p);case 4:this._hasDataChannelMediaSection=!0;case 5:return e.abrupt("return",{dataChannel:l});case 6:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setupTransport",value:(r=(0,a.default)(i.default.mark(function e(t){var r,n,a,o=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=g.parse(this._pc.localDescription.sdp)),(a=x.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=1,new Promise(function(e,t){o.safeEmit("@connect",{dtlsParameters:a},e,t)});case 1:this._transportReady=!0;case 2:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"assertNotClosed",value:function(){if(this._closed)throw new k.InvalidStateError("method called in a closed handler")}},{key:"assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}],[{key:"createFactory",value:function(){return{name:C,factory:function(e){return new t(e)},getNativeRtpCapabilities:(r=(0,a.default)(i.default.mark(function e(){var r,n,a,o,s,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeRtpCapabilities()"),r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),e.prev=1,r.addTransceiver("audio"),r.addTransceiver("video",{sendEncodings:[{scalabilityMode:"L3T3"}]}),e.next=2,r.createOffer();case 2:n=e.sent;try{r.close()}catch(e){}return r=void 0,a=g.parse(n.sdp),o=t.getLocalRtpCapabilities(a),e.abrupt("return",o);case 3:e.prev=3,c=e.catch(1);try{null===(s=r)||void 0===s||s.close()}catch(e){}throw r=void 0,c;case 4:case"end":return e.stop()}},e,null,[[1,3]])})),function(){return r.apply(this,arguments)}),getNativeSctpCapabilities:(e=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:T});case 1:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})};var e,r}},{key:"getLocalRtpCapabilities",value:function(e){var t=x.extractRtpCapabilities({sdpObject:e});return w.validateAndNormalizeRtpCapabilities(t),P.addNackSupportForOpus(t),t}}]);var r,n,h,m,y,_,A,I,O,j,D,L,B,N,F,U,q,z,V}(y.EnhancedEventEmitter);r.Chrome111=A},{"../Logger":302,"../enhancedEvents":305,"../errors":306,"../ortc":320,"../scalabilityModes":321,"./ortc/utils":314,"./sdp/RemoteSdp":316,"./sdp/commonUtils":317,"./sdp/unifiedPlanUtils":318,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,"sdp-transform":390}],308:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/defineProperty"));function p(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(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,f.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 v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.Chrome74=void 0;var g=e("sdp-transform"),y=e("../Logger"),_=e("../enhancedEvents"),w=e("../ortc"),k=e("../errors"),S=e("../scalabilityModes"),x=e("./sdp/commonUtils"),E=e("./sdp/unifiedPlanUtils"),P=e("./ortc/utils"),R=e("./sdp/RemoteSdp"),M=new y.Logger("Chrome74"),C="Chrome74",T={OS:1024,MIS:1024},A=function(e){function t(e){var r,n,i,a,s=e.direction,d=e.iceParameters,l=e.iceCandidates,p=e.dtlsParameters,h=e.sctpParameters,m=e.iceServers,g=e.iceTransportPolicy,y=e.additionalSettings,_=e.getSendExtendedRtpCapabilities;return(0,o.default)(this,t),n=this,i=t,i=(0,u.default)(i),r=(0,c.default)(n,v()?Reflect.construct(i,a||[],(0,u.default)(n).constructor):i.apply(n,a)),(0,f.default)(r,"_closed",!1),(0,f.default)(r,"_direction",void 0),(0,f.default)(r,"_remoteSdp",void 0),(0,f.default)(r,"_getSendExtendedRtpCapabilities",void 0),(0,f.default)(r,"_forcedLocalDtlsRole",void 0),(0,f.default)(r,"_pc",void 0),(0,f.default)(r,"_mapMidTransceiver",new Map),(0,f.default)(r,"_sendStream",new MediaStream),(0,f.default)(r,"_hasDataChannelMediaSection",!1),(0,f.default)(r,"_nextSendSctpStreamId",0),(0,f.default)(r,"_transportReady",!1),(0,f.default)(r,"onIceGatheringStateChange",function(){r.emit("@icegatheringstatechange",r._pc.iceGatheringState)}),(0,f.default)(r,"onIceCandidateError",function(e){r.emit("@icecandidateerror",e)}),(0,f.default)(r,"onConnectionStateChange",function(){r.emit("@connectionstatechange",r._pc.connectionState)}),(0,f.default)(r,"onIceConnectionStateChange",function(){switch(r._pc.iceConnectionState){case"checking":r.emit("@connectionstatechange","connecting");break;case"connected":case"completed":r.emit("@connectionstatechange","connected");break;case"failed":r.emit("@connectionstatechange","failed");break;case"disconnected":r.emit("@connectionstatechange","disconnected");break;case"closed":r.emit("@connectionstatechange","closed")}}),M.debug("constructor()"),r._direction=s,r._remoteSdp=new R.RemoteSdp({iceParameters:d,iceCandidates:l,dtlsParameters:p,sctpParameters:h}),r._getSendExtendedRtpCapabilities=_,p.role&&"auto"!==p.role&&(r._forcedLocalDtlsRole="server"===p.role?"client":"server"),r._pc=new RTCPeerConnection(b({iceServers:null!=m?m:[],iceTransportPolicy:null!=g?g:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},y)),r._pc.addEventListener("icegatheringstatechange",r.onIceGatheringStateChange),r._pc.addEventListener("icecandidateerror",r.onIceCandidateError),r._pc.connectionState?r._pc.addEventListener("connectionstatechange",r.onConnectionStateChange):(M.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),r._pc.addEventListener("iceconnectionstatechange",r.onIceConnectionStateChange)),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return C}},{key:"close",value:function(){if(M.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}var e,r,n,i,a;this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),(e=t,r="close",n=this,i=3,a=(0,d.default)((0,u.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([])}}},{key:"updateIceServers",value:(V=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),M.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 1:case"end":return e.stop()}},e,this)})),function(e){return V.apply(this,arguments)})},{key:"restartIce",value:(z=(0,a.default)(i.default.mark(function e(t){var r,n,a,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),M.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=1;break}return e.abrupt("return");case 1:if("send"!==this._direction){e.next=5;break}return e.next=2,this._pc.createOffer({iceRestart:!0});case 2:return r=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=3,this._pc.setLocalDescription(r);case 3:return n={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=4,this._pc.setRemoteDescription(n);case 4:e.next=8;break;case 5:return a={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=6,this._pc.setRemoteDescription(a);case 6:return e.next=7,this._pc.createAnswer();case 7:return o=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=8,this._pc.setLocalDescription(o);case 8:case"end":return e.stop()}},e,this)})),function(e){return z.apply(this,arguments)})},{key:"getTransportStats",value:(q=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}},e,this)})),function(){return q.apply(this,arguments)})},{key:"send",value:(U=(0,a.default)(i.default.mark(function e(r){var n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,k,P,R,C,T,A,I;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.track,a=r.encodings,o=r.codecOptions,s=r.codec,this.assertNotClosed(),this.assertSendDirection(),M.debug("send() [kind:%s, track.id:%s]",n.kind,n.id),a&&a.length>1&&a.forEach(function(e,t){e.rid="r".concat(t)}),c=this._remoteSdp.getNextMediaSectionIdx(),u=this._pc.addTransceiver(n,{direction:"sendonly",streams:[this._sendStream],sendEncodings:a}),e.next=1,this._pc.createOffer();case 1:if(d=e.sent,(l=g.parse(d.sdp)).extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed(),f=t.getLocalRtpCapabilities(l),h=this._getSendExtendedRtpCapabilities(f),(m=w.getSendingRtpParameters(n.kind,h)).codecs=w.reduceCodecs(m.codecs,s),(b=w.getSendingRemoteRtpParameters(n.kind,h)).codecs=w.reduceCodecs(b.codecs,s),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(v=this._forcedLocalDtlsRole)&&void 0!==v?v:"client",localSdpObject:l});case 2:return y=!1,_=(0,S.parse)((null!=a?a:[{}])[0].scalabilityMode),a&&1===a.length&&_.spatialLayers>1&&"video/vp9"===m.codecs[0].mimeType.toLowerCase()&&(M.debug("send() | enabling legacy simulcast for VP9 SVC"),y=!0,l=g.parse(d.sdp),k=l.media[c.idx],E.addLegacySimulcast({offerMediaObject:k,numStreams:_.spatialLayers}),d={type:"offer",sdp:g.write(l)}),M.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),e.next=3,this._pc.setLocalDescription(d);case 3:if(P=u.mid,m.mid=P,l=g.parse(this._pc.localDescription.sdp),k=l.media[c.idx],m.rtcp.cname=x.getCname({offerMediaObject:k}),a?1===a.length?(R=E.getRtpEncodings({offerMediaObject:k}),Object.assign(R[0],a[0]),y&&(R=[R[0]]),m.encodings=R):m.encodings=a:m.encodings=E.getRtpEncodings({offerMediaObject:k}),m.encodings.length>1&&("video/vp8"===m.codecs[0].mimeType.toLowerCase()||"video/h264"===m.codecs[0].mimeType.toLowerCase())){C=p(m.encodings);try{for(C.s();!(T=C.n()).done;)(A=T.value).scalabilityMode?A.scalabilityMode="L1T".concat(_.temporalLayers):A.scalabilityMode="L1T3"}catch(e){C.e(e)}finally{C.f()}}return this._remoteSdp.send({offerMediaObject:k,reuseMid:c.reuseMid,offerRtpParameters:m,answerRtpParameters:b,codecOptions:o}),I={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("send() | calling pc.setRemoteDescription() [answer:%o]",I),e.next=4,this._pc.setRemoteDescription(I);case 4:return this._mapMidTransceiver.set(P,u),e.abrupt("return",{localId:P,rtpParameters:m,rtpSender:u.sender});case 5:case"end":return e.stop()}},e,this)})),function(e){return U.apply(this,arguments)})},{key:"stopSending",value:(F=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertSendDirection(),M.debug("stopSending() [localId:%s]",t),!this._closed){e.next=1;break}return e.abrupt("return");case 1:if(r=this._mapMidTransceiver.get(t)){e.next=2;break}throw new Error("associated RTCRtpTransceiver not found");case 2:if(r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.closeMediaSection(r.mid))try{r.stop()}catch(e){}return e.next=3,this._pc.createOffer();case 3:return n=e.sent,M.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=4,this._pc.setLocalDescription(n);case 4:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=5,this._pc.setRemoteDescription(a);case 5:this._mapMidTransceiver.delete(t);case 6:case"end":return e.stop()}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"pauseSending",value:(N=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("pauseSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="inactive",this._remoteSdp.pauseMediaSection(t),e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"resumeSending",value:(B=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("resumeSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t),this._remoteSdp.resumeSendingMediaSection(t),r){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="sendonly",e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return B.apply(this,arguments)})},{key:"replaceTrack",value:(L=(0,a.default)(i.default.mark(function e(t,r){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r?M.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):M.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.next=2,n.sender.replaceTrack(r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return L.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(D=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){e.active=t<=r}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(j=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){a.encodings[t]=b(b({},e),r)}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return j.apply(this,arguments)})},{key:"getSenderStats",value:(O=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.sender.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"sendDataChannel",value:(I=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,a=t.maxRetransmits,o=t.label,s=t.protocol,this.assertNotClosed(),this.assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:a,protocol:s},M.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%T.MIS,this._hasDataChannelMediaSection){e.next=5;break}return e.next=1,this._pc.createOffer();case 1:if(d=e.sent,l=g.parse(d.sdp),f=l.media.find(function(e){return"application"===e.type}),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(p=this._forcedLocalDtlsRole)&&void 0!==p?p:"client",localSdpObject:l});case 2:return M.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=3,this._pc.setLocalDescription(d);case 3:return this._remoteSdp.sendSctpAssociation({offerMediaObject:f}),h={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=4,this._pc.setRemoteDescription(h);case 4:this._hasDataChannelMediaSection=!0;case 5:return m={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:m});case 6:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"receive",value:(A=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,w,k,S,E,P,R,C,T=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=[],n=new Map,a=p(t);try{for(a.s();!(o=a.n()).done;)c=o.value,u=c.trackId,d=c.kind,l=c.rtpParameters,f=c.streamId,M.debug("receive() [trackId:%s, kind:%s]",u,d),h=null!==(s=l.mid)&&void 0!==s?s:String(this._mapMidTransceiver.size),n.set(u,h),this._remoteSdp.receive({mid:h,kind:d,offerRtpParameters:l,streamId:null!=f?f:l.rtcp.cname,trackId:u})}catch(e){a.e(e)}finally{a.f()}return m={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",m),e.next=1,this._pc.setRemoteDescription(m);case 1:return e.next=2,this._pc.createAnswer();case 2:b=e.sent,v=g.parse(b.sdp),y=p(t),e.prev=3,w=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=_.value,r=t.trackId,a=t.rtpParameters,o=n.get(r),s=v.media.find(function(e){return String(e.mid)===o}),x.applyCodecParameters({offerRtpParameters:a,answerMediaObject:s});case 1:case"end":return e.stop()}},e)}),y.s();case 4:if((_=y.n()).done){e.next=6;break}return e.delegateYield(w(),"t0",5);case 5:e.next=4;break;case 6:e.next=8;break;case 7:e.prev=7,R=e.catch(3),y.e(R);case 8:return e.prev=8,y.f(),e.finish(8);case 9:if(b={type:"answer",sdp:g.write(v)},this._transportReady){e.next=10;break}return e.next=10,this.setupTransport({localDtlsRole:null!==(k=this._forcedLocalDtlsRole)&&void 0!==k?k:"client",localSdpObject:v});case 10:return M.debug("receive() | calling pc.setLocalDescription() [answer:%o]",b),e.next=11,this._pc.setLocalDescription(b);case 11:S=p(t),e.prev=12,P=i.default.mark(function e(){var t,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=E.value,a=t.trackId,o=n.get(a),s=T._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("new RTCRtpTransceiver not found");case 1:T._mapMidTransceiver.set(o,s),r.push({localId:o,track:s.receiver.track,rtpReceiver:s.receiver});case 2:case"end":return e.stop()}},e)}),S.s();case 13:if((E=S.n()).done){e.next=15;break}return e.delegateYield(P(),"t1",14);case 14:e.next=13;break;case 15:e.next=17;break;case 16:e.prev=16,C=e.catch(12),S.e(C);case 17:return e.prev=17,S.f(),e.finish(17);case 18:return e.abrupt("return",r);case 19:case"end":return e.stop()}},e,this,[[3,7,8,9],[12,16,17,18]])})),function(e){return A.apply(this,arguments)})},{key:"stopReceiving",value:(_=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertRecvDirection(),!this._closed){e.next=1;break}return e.abrupt("return");case 1:r=p(t),e.prev=2,r.s();case 3:if((n=r.n()).done){e.next=6;break}if(a=n.value,M.debug("stopReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:this._remoteSdp.closeMediaSection(o.mid);case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,f=e.catch(2),r.e(f);case 8:return e.prev=8,r.f(),e.finish(8);case 9:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=10,this._pc.setRemoteDescription(s);case 10:return e.next=11,this._pc.createAnswer();case 11:return c=e.sent,M.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=12,this._pc.setLocalDescription(c);case 12:u=p(t);try{for(u.s();!(d=u.n()).done;)l=d.value,this._mapMidTransceiver.delete(l)}catch(e){u.e(e)}finally{u.f()}case 13:case"end":return e.stop()}},e,this,[[2,7,8,9]])})),function(e){return _.apply(this,arguments)})},{key:"pauseReceiving",value:(y=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("pauseReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="inactive",this._remoteSdp.pauseMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return y.apply(this,arguments)})},{key:"resumeReceiving",value:(m=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("resumeReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return m.apply(this,arguments)})},{key:"getReceiverStats",value:(h=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.receiver.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return h.apply(this,arguments)})},{key:"receiveDataChannel",value:(n=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,a=t.protocol,this.assertNotClosed(),this.assertRecvDirection(),o=r.streamId,s=r.ordered,c=r.maxPacketLifeTime,u=r.maxRetransmits,d={negotiated:!0,id:o,ordered:s,maxPacketLifeTime:c,maxRetransmits:u,protocol:a},M.debug("receiveDataChannel() [options:%o]",d),l=this._pc.createDataChannel(n,d),this._hasDataChannelMediaSection){e.next=5;break}return this._remoteSdp.receiveSctpAssociation(),f={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",f),e.next=1,this._pc.setRemoteDescription(f);case 1:return e.next=2,this._pc.createAnswer();case 2:if(p=e.sent,this._transportReady){e.next=3;break}return m=g.parse(p.sdp),e.next=3,this.setupTransport({localDtlsRole:null!==(h=this._forcedLocalDtlsRole)&&void 0!==h?h:"client",localSdpObject:m});case 3:return M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=4,this._pc.setLocalDescription(p);case 4:this._hasDataChannelMediaSection=!0;case 5:return e.abrupt("return",{dataChannel:l});case 6:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setupTransport",value:(r=(0,a.default)(i.default.mark(function e(t){var r,n,a,o=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=g.parse(this._pc.localDescription.sdp)),(a=x.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=1,new Promise(function(e,t){o.safeEmit("@connect",{dtlsParameters:a},e,t)});case 1:this._transportReady=!0;case 2:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"assertNotClosed",value:function(){if(this._closed)throw new k.InvalidStateError("method called in a closed handler")}},{key:"assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}],[{key:"createFactory",value:function(){return{name:C,factory:function(e){return new t(e)},getNativeRtpCapabilities:(r=(0,a.default)(i.default.mark(function e(){var r,n,a,o,s,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeRtpCapabilities()"),r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),e.prev=1,r.addTransceiver("audio"),r.addTransceiver("video"),e.next=2,r.createOffer();case 2:n=e.sent;try{r.close()}catch(e){}return r=void 0,a=g.parse(n.sdp),o=t.getLocalRtpCapabilities(a),e.abrupt("return",o);case 3:e.prev=3,c=e.catch(1);try{null===(s=r)||void 0===s||s.close()}catch(e){}throw r=void 0,c;case 4:case"end":return e.stop()}},e,null,[[1,3]])})),function(){return r.apply(this,arguments)}),getNativeSctpCapabilities:(e=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:T});case 1:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})};var e,r}},{key:"getLocalRtpCapabilities",value:function(e){var t=x.extractRtpCapabilities({sdpObject:e});return w.validateAndNormalizeRtpCapabilities(t),P.addNackSupportForOpus(t),t}}]);var r,n,h,m,y,_,A,I,O,j,D,L,B,N,F,U,q,z,V}(_.EnhancedEventEmitter);r.Chrome74=A},{"../Logger":302,"../enhancedEvents":305,"../errors":306,"../ortc":320,"../scalabilityModes":321,"./ortc/utils":314,"./sdp/RemoteSdp":316,"./sdp/commonUtils":317,"./sdp/unifiedPlanUtils":318,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,"sdp-transform":390}],309:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/defineProperty"));function p(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t,r){return t=(0,u.default)(t),(0,c.default)(e,b()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function b(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!e})()}function v(e,t,r,n){var i=(0,d.default)((0,u.default)(1&n?e.prototype:e),t,r);return 2&n&&"function"==typeof i?function(e){return i.apply(r,e)}:i}Object.defineProperty(r,"__esModule",{value:!0}),r.FakeHandler=void 0;var g=e("fake-mediastreamtrack"),y=e("../enhancedEvents"),_=e("../Logger"),w=e("../utils"),k=e("../ortc"),S=e("../errors"),x=e("./fakeEvents/FakeEventTarget"),E=new _.Logger("FakeHandler"),P="FakeHandler",R=function(e){function t(e,r){var n,i=e.getSendExtendedRtpCapabilities;return(0,o.default)(this,t),n=m(this,t),(0,f.default)(n,"_closed",!1),(0,f.default)(n,"_fakeParameters",void 0),(0,f.default)(n,"_getSendExtendedRtpCapabilities",void 0),(0,f.default)(n,"_cname","CNAME-".concat(w.generateRandomNumber())),(0,f.default)(n,"_transportReady",!1),(0,f.default)(n,"_nextLocalId",1),(0,f.default)(n,"_tracks",new Map),(0,f.default)(n,"_nextSctpStreamId",0),E.debug("constructor()"),n._getSendExtendedRtpCapabilities=i,n._fakeParameters=r,n}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return P}},{key:"close",value:function(){E.debug("close()"),this._closed||(this._closed=!0,v(t,"close",this,3)([]))}},{key:"setIceGatheringState",value:function(e){this.emit("@icegatheringstatechange",e)}},{key:"setConnectionState",value:function(e){this.emit("@connectionstatechange",e)}},{key:"updateIceServers",value:(L=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),E.debug("updateIceServers()");case 1:case"end":return e.stop()}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"restartIce",value:(D=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),E.debug("restartIce()");case 1:case"end":return e.stop()}},e,this)})),function(e){return D.apply(this,arguments)})},{key:"getTransportStats",value:(j=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",new Map);case 1:case"end":return e.stop()}},e,this)})),function(){return j.apply(this,arguments)})},{key:"send",value:(O=(0,a.default)(i.default.mark(function e(r){var n,a,o,s,c,u,d,l,f,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.track,a=r.encodings,r.codecOptions,o=r.codec,this.assertNotClosed(),E.debug("send() [kind:%s, track.id:%s]",n.kind,n.id),this._transportReady){e.next=1;break}return e.next=1,this.setupTransport({localDtlsRole:"server"});case 1:s=t.getLocalRtpCapabilities(this._fakeParameters),c=this._getSendExtendedRtpCapabilities(s),(u=k.getSendingRtpParameters(n.kind,c)).codecs=k.reduceCodecs(u.codecs,o),d=u.codecs.some(function(e){return/.+\/rtx$/i.test(e.mimeType)}),u.mid="mid-".concat(w.generateRandomNumber()),a||(a=[{}]),l=p(a);try{for(l.s();!(f=l.n()).done;)(h=f.value).ssrc=w.generateRandomNumber(),d&&(h.rtx={ssrc:w.generateRandomNumber()})}catch(e){l.e(e)}finally{l.f()}return u.encodings=a,u.rtcp={cname:this._cname,reducedSize:!0,mux:!0},m=this._nextLocalId++,this._tracks.set(m,n),e.abrupt("return",{localId:String(m),rtpParameters:u});case 2:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"stopSending",value:(I=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(E.debug("stopSending() [localId:%s]",t),!this._closed){e.next=1;break}return e.abrupt("return");case 1:if(this._tracks.has(Number(t))){e.next=2;break}throw new Error("local track not found");case 2:this._tracks.delete(Number(t));case 3:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"pauseSending",value:(A=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed();case 1:case"end":return e.stop()}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"resumeSending",value:(T=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed();case 1:case"end":return e.stop()}},e,this)})),function(e){return T.apply(this,arguments)})},{key:"replaceTrack",value:(C=(0,a.default)(i.default.mark(function e(t,r){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),r?E.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):E.debug("replaceTrack() [localId:%s, no track]",t),this._tracks.delete(Number(t)),this._tracks.set(Number(t),r);case 1:case"end":return e.stop()}},e,this)})),function(e,t){return C.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(R=(0,a.default)(i.default.mark(function e(t,r){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),E.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r);case 1:case"end":return e.stop()}},e,this)})),function(e,t){return R.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(x=(0,a.default)(i.default.mark(function e(t,r){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),E.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r);case 1:case"end":return e.stop()}},e,this)})),function(e,t){return x.apply(this,arguments)})},{key:"getSenderStats",value:(_=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",new Map);case 1:case"end":return e.stop()}},e,this)})),function(e){return _.apply(this,arguments)})},{key:"sendDataChannel",value:(y=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,a=t.maxRetransmits,o=t.label,s=t.protocol,this.assertNotClosed(),this._transportReady){e.next=1;break}return e.next=1,this.setupTransport({localDtlsRole:"server"});case 1:return E.debug("sendDataChannel()"),c=new M({id:this._nextSctpStreamId++,ordered:r,maxPacketLifeTime:n,maxRetransmits:a,label:o,protocol:s}),u={streamId:this._nextSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:a},e.abrupt("return",{dataChannel:c,sctpStreamParameters:u});case 2:case"end":return e.stop()}},e,this)})),function(e){return y.apply(this,arguments)})},{key:"receive",value:(b=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),r=[],n=p(t),e.prev=1,n.s();case 2:if((a=n.n()).done){e.next=5;break}if(o=a.value,s=o.trackId,c=o.kind,this._transportReady){e.next=3;break}return e.next=3,this.setupTransport({localDtlsRole:"client"});case 3:E.debug("receive() [trackId:%s, kind:%s]",s,c),u=this._nextLocalId++,d=new g.FakeMediaStreamTrack({kind:c}),this._tracks.set(u,d),r.push({localId:String(u),track:d});case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,l=e.catch(1),n.e(l);case 7:return e.prev=7,n.f(),e.finish(7);case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return b.apply(this,arguments)})},{key:"stopReceiving",value:(h=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}return e.abrupt("return");case 1:r=p(t);try{for(r.s();!(n=r.n()).done;)a=n.value,E.debug("stopReceiving() [localId:%s]",a),this._tracks.delete(Number(a))}catch(e){r.e(e)}finally{r.f()}case 2:case"end":return e.stop()}},e,this)})),function(e){return h.apply(this,arguments)})},{key:"pauseReceiving",value:(d=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed();case 1:case"end":return e.stop()}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"resumeReceiving",value:(u=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed();case 1:case"end":return e.stop()}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"getReceiverStats",value:(c=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",new Map);case 1:case"end":return e.stop()}},e,this)})),function(e){return c.apply(this,arguments)})},{key:"receiveDataChannel",value:(n=(0,a.default)(i.default.mark(function e(t){var r,n,a,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,a=t.protocol,this.assertNotClosed(),this._transportReady){e.next=1;break}return e.next=1,this.setupTransport({localDtlsRole:"client"});case 1:return E.debug("receiveDataChannel()"),o=new M({id:r.streamId,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits,label:n,protocol:a}),e.abrupt("return",{dataChannel:o});case 2:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setupTransport",value:(r=(0,a.default)(i.default.mark(function e(t){var r,n,a=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,t.localSdpObject,n=w.clone(this._fakeParameters.generateLocalDtlsParameters()),r&&(n.role=r),this.emit("@connectionstatechange","connecting"),e.next=1,new Promise(function(e,t){return a.emit("@connect",{dtlsParameters:n},e,t)});case 1:this._transportReady=!0;case 2:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"assertNotClosed",value:function(){if(this._closed)throw new S.InvalidStateError("method called in a closed handler")}}],[{key:"createFactory",value:function(e){return{name:P,factory:function(r){return new t(r,e)},getNativeRtpCapabilities:(n=(0,a.default)(i.default.mark(function r(){return i.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return E.debug("getNativeRtpCapabilities()"),r.abrupt("return",t.getLocalRtpCapabilities(e));case 1:case"end":return r.stop()}},r)})),function(){return n.apply(this,arguments)}),getNativeSctpCapabilities:(r=(0,a.default)(i.default.mark(function t(){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return E.debug("getNativeSctpCapabilities()"),t.abrupt("return",e.generateNativeSctpCapabilities());case 1:case"end":return t.stop()}},t)})),function(){return r.apply(this,arguments)})};var r,n}},{key:"getLocalRtpCapabilities",value:function(e){var t=e.generateNativeRtpCapabilities();return k.validateAndNormalizeRtpCapabilities(t),t}}]);var r,n,c,u,d,h,b,y,_,x,R,C,T,A,I,O,j,D,L}(y.EnhancedEventEmitter);r.FakeHandler=R;var M=function(e){function t(e){var r,n=e.id,i=e.ordered,a=void 0===i||i,s=e.maxPacketLifeTime,c=void 0===s?null:s,u=e.maxRetransmits,d=void 0===u?null:u,l=e.label,p=void 0===l?"":l,h=e.protocol,b=void 0===h?"":h;return(0,o.default)(this,t),r=m(this,t),(0,f.default)(r,"_id",void 0),(0,f.default)(r,"_negotiated",!0),(0,f.default)(r,"_ordered",void 0),(0,f.default)(r,"_maxPacketLifeTime",void 0),(0,f.default)(r,"_maxRetransmits",void 0),(0,f.default)(r,"_label",void 0),(0,f.default)(r,"_protocol",void 0),(0,f.default)(r,"_readyState","connecting"),(0,f.default)(r,"_bufferedAmount",0),(0,f.default)(r,"_bufferedAmountLowThreshold",0),(0,f.default)(r,"_binaryType","arraybuffer"),(0,f.default)(r,"_onopen",null),(0,f.default)(r,"_onclosing",null),(0,f.default)(r,"_onclose",null),(0,f.default)(r,"_onmessage",null),(0,f.default)(r,"_onbufferedamountlow",null),(0,f.default)(r,"_onerror",null),E.debug("constructor() [id:".concat(n,", ordered:").concat(a,", maxPacketLifeTime:").concat(c,", maxRetransmits:").concat(d,", label:").concat(p,", protocol:").concat(b)),r._id=n,r._ordered=a,r._maxPacketLifeTime=c,r._maxRetransmits=d,r._label=p,r._protocol=b,r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"id",get:function(){return this._id}},{key:"negotiated",get:function(){return this._negotiated}},{key:"ordered",get:function(){return this._ordered}},{key:"maxPacketLifeTime",get:function(){return this._maxPacketLifeTime}},{key:"maxRetransmits",get:function(){return this._maxRetransmits}},{key:"label",get:function(){return this._label}},{key:"protocol",get:function(){return this._protocol}},{key:"readyState",get:function(){return this._readyState}},{key:"bufferedAmount",get:function(){return this._bufferedAmount}},{key:"bufferedAmountLowThreshold",get:function(){return this._bufferedAmountLowThreshold},set:function(e){this._bufferedAmountLowThreshold=e}},{key:"binaryType",get:function(){return this._binaryType},set:function(e){this._binaryType=e}},{key:"onopen",get:function(){return this._onopen},set:function(e){this._onopen&&this.removeEventListener("open",this._onopen),this._onopen=e,e&&this.addEventListener("open",e)}},{key:"onclosing",get:function(){return this._onclosing},set:function(e){this._onclosing&&this.removeEventListener("closing",this._onclosing),this._onclosing=e,e&&this.addEventListener("closing",e)}},{key:"onclose",get:function(){return this._onclose},set:function(e){this._onclose&&this.removeEventListener("close",this._onclose),this._onclose=e,e&&this.addEventListener("close",e)}},{key:"onmessage",get:function(){return this._onmessage},set:function(e){this._onmessage&&this.removeEventListener("message",this._onmessage),this._onmessage=e,e&&this.addEventListener("message",e)}},{key:"onbufferedamountlow",get:function(){return this._onbufferedamountlow},set:function(e){this._onbufferedamountlow&&this.removeEventListener("bufferedamountlow",this._onbufferedamountlow),this._onbufferedamountlow=e,e&&this.addEventListener("bufferedamountlow",e)}},{key:"onerror",get:function(){return this._onerror},set:function(e){this._onerror&&this.removeEventListener("error",this._onerror),this._onerror=e,e&&this.addEventListener("error",e)}},{key:"addEventListener",value:function(e,r,n){v(t,"addEventListener",this,3)([e,r,n])}},{key:"removeEventListener",value:function(e,r,n){v(t,"removeEventListener",this,3)([e,r,n])}},{key:"close",value:function(){["closing","closed"].includes(this._readyState)||(this._readyState="closed")}},{key:"send",value:function(e){if("open"!==this._readyState)throw new S.InvalidStateError("not open")}}])}(x.FakeEventTarget)},{"../Logger":302,"../enhancedEvents":305,"../errors":306,"../ortc":320,"../utils":324,"./fakeEvents/FakeEventTarget":313,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,"fake-mediastreamtrack":209}],310:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/defineProperty"));function p(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(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,f.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 v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.Firefox120=void 0;var g=e("sdp-transform"),y=e("../enhancedEvents"),_=e("../Logger"),w=e("../errors"),k=e("../ortc"),S=e("../scalabilityModes"),x=e("./sdp/commonUtils"),E=e("./sdp/unifiedPlanUtils"),P=e("./sdp/RemoteSdp"),R=new _.Logger("Firefox120"),M="Firefox120",C={OS:16,MIS:2048},T=function(e){function t(e){var r,n,i,a,s=e.direction,d=e.iceParameters,l=e.iceCandidates,p=e.dtlsParameters,h=e.sctpParameters,m=e.iceServers,g=e.iceTransportPolicy,y=e.additionalSettings,_=e.getSendExtendedRtpCapabilities;return(0,o.default)(this,t),n=this,i=t,i=(0,u.default)(i),r=(0,c.default)(n,v()?Reflect.construct(i,a||[],(0,u.default)(n).constructor):i.apply(n,a)),(0,f.default)(r,"_closed",!1),(0,f.default)(r,"_direction",void 0),(0,f.default)(r,"_remoteSdp",void 0),(0,f.default)(r,"_getSendExtendedRtpCapabilities",void 0),(0,f.default)(r,"_pc",void 0),(0,f.default)(r,"_mapMidTransceiver",new Map),(0,f.default)(r,"_sendStream",new MediaStream),(0,f.default)(r,"_hasDataChannelMediaSection",!1),(0,f.default)(r,"_nextSendSctpStreamId",0),(0,f.default)(r,"_transportReady",!1),(0,f.default)(r,"onIceGatheringStateChange",function(){r.emit("@icegatheringstatechange",r._pc.iceGatheringState)}),(0,f.default)(r,"onIceCandidateError",function(e){r.emit("@icecandidateerror",e)}),(0,f.default)(r,"onConnectionStateChange",function(){r.emit("@connectionstatechange",r._pc.connectionState)}),(0,f.default)(r,"onIceConnectionStateChange",function(){switch(r._pc.iceConnectionState){case"checking":r.emit("@connectionstatechange","connecting");break;case"connected":case"completed":r.emit("@connectionstatechange","connected");break;case"failed":r.emit("@connectionstatechange","failed");break;case"disconnected":r.emit("@connectionstatechange","disconnected");break;case"closed":r.emit("@connectionstatechange","closed")}}),R.debug("constructor()"),r._direction=s,r._remoteSdp=new P.RemoteSdp({iceParameters:d,iceCandidates:l,dtlsParameters:p,sctpParameters:h}),r._getSendExtendedRtpCapabilities=_,r._pc=new RTCPeerConnection(b({iceServers:null!=m?m:[],iceTransportPolicy:null!=g?g:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},y)),r._pc.addEventListener("icegatheringstatechange",r.onIceGatheringStateChange),r._pc.addEventListener("icecandidateerror",r.onIceCandidateError),r._pc.connectionState?r._pc.addEventListener("connectionstatechange",r.onConnectionStateChange):(R.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),r._pc.addEventListener("iceconnectionstatechange",r.onIceConnectionStateChange)),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return M}},{key:"close",value:function(){if(R.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}var e,r,n,i,a;this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),(e=t,r="close",n=this,i=3,a=(0,d.default)((0,u.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([])}}},{key:"updateIceServers",value:(z=(0,a.default)(i.default.mark(function e(t){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw this.assertNotClosed(),new w.UnsupportedError("not supported");case 1:case"end":return e.stop()}},e,this)})),function(e){return z.apply(this,arguments)})},{key:"restartIce",value:(q=(0,a.default)(i.default.mark(function e(t){var r,n,a,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),R.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=1;break}return e.abrupt("return");case 1:if("send"!==this._direction){e.next=5;break}return e.next=2,this._pc.createOffer({iceRestart:!0});case 2:return r=e.sent,R.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=3,this._pc.setLocalDescription(r);case 3:return n={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=4,this._pc.setRemoteDescription(n);case 4:e.next=8;break;case 5:return a={type:"offer",sdp:this._remoteSdp.getSdp()},R.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=6,this._pc.setRemoteDescription(a);case 6:return e.next=7,this._pc.createAnswer();case 7:return o=e.sent,R.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=8,this._pc.setLocalDescription(o);case 8:case"end":return e.stop()}},e,this)})),function(e){return q.apply(this,arguments)})},{key:"getTransportStats",value:(U=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}},e,this)})),function(){return U.apply(this,arguments)})},{key:"send",value:(F=(0,a.default)(i.default.mark(function e(r){var n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,w,P,M,C,T;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.track,a=r.encodings,o=r.codecOptions,s=r.codec,c=r.onRtpSender,this.assertNotClosed(),this.assertSendDirection(),R.debug("send() [kind:%s, track.id:%s]",n.kind,n.id),a&&a.length>1&&a.forEach(function(e,t){e.rid="r".concat(t)}),u=this._pc.addTransceiver(n,{direction:"sendonly",streams:[this._sendStream],sendEncodings:a}),c&&c(u.sender),e.next=1,this._pc.createOffer();case 1:if(d=e.sent,(l=g.parse(d.sdp)).extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed(),f=t.getLocalRtpCapabilities(l),h=this._getSendExtendedRtpCapabilities(f),(m=k.getSendingRtpParameters(n.kind,h)).codecs=k.reduceCodecs(m.codecs,s),(b=k.getSendingRemoteRtpParameters(n.kind,h)).codecs=k.reduceCodecs(b.codecs,s),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:"client",localSdpObject:l});case 2:return v=(0,S.parse)((null!=a?a:[{}])[0].scalabilityMode),R.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),e.next=3,this._pc.setLocalDescription(d);case 3:if(y=u.mid,m.mid=y,l=g.parse(this._pc.localDescription.sdp),_=l.media[l.media.length-1],m.rtcp.cname=x.getCname({offerMediaObject:_}),a?1===a.length?(w=E.getRtpEncodings({offerMediaObject:_}),Object.assign(w[0],a[0]),m.encodings=w):m.encodings=a:m.encodings=E.getRtpEncodings({offerMediaObject:_}),m.encodings.length>1&&("video/vp8"===m.codecs[0].mimeType.toLowerCase()||"video/h264"===m.codecs[0].mimeType.toLowerCase())){P=p(m.encodings);try{for(P.s();!(M=P.n()).done;)(C=M.value).scalabilityMode?C.scalabilityMode="L1T".concat(v.temporalLayers):C.scalabilityMode="L1T3"}catch(e){P.e(e)}finally{P.f()}}return this._remoteSdp.send({offerMediaObject:_,offerRtpParameters:m,answerRtpParameters:b,codecOptions:o}),T={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("send() | calling pc.setRemoteDescription() [answer:%o]",T),e.next=4,this._pc.setRemoteDescription(T);case 4:return this._mapMidTransceiver.set(y,u),e.abrupt("return",{localId:y,rtpParameters:m,rtpSender:u.sender});case 5:case"end":return e.stop()}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"stopSending",value:(N=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertSendDirection(),R.debug("stopSending() [localId:%s]",t),!this._closed){e.next=1;break}return e.abrupt("return");case 1:if(r=this._mapMidTransceiver.get(t)){e.next=2;break}throw new Error("associated transceiver not found");case 2:return r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.disableMediaSection(r.mid),e.next=3,this._pc.createOffer();case 3:return n=e.sent,R.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=4,this._pc.setLocalDescription(n);case 4:return a={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=5,this._pc.setRemoteDescription(a);case 5:this._mapMidTransceiver.delete(t);case 6:case"end":return e.stop()}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"pauseSending",value:(B=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),R.debug("pauseSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="inactive",this._remoteSdp.pauseMediaSection(t),e.next=2,this._pc.createOffer();case 2:return n=e.sent,R.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return B.apply(this,arguments)})},{key:"resumeSending",value:(L=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),R.debug("resumeSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="sendonly",this._remoteSdp.resumeSendingMediaSection(t),e.next=2,this._pc.createOffer();case 2:return n=e.sent,R.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"replaceTrack",value:(D=(0,a.default)(i.default.mark(function e(t,r){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r?R.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):R.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.next=2,n.sender.replaceTrack(r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(j=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),R.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated transceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){e.active=t<=r}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,R.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return j.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(O=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),R.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){a.encodings[t]=b(b({},e),r)}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,R.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return O.apply(this,arguments)})},{key:"getSenderStats",value:(I=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.sender.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"sendDataChannel",value:(A=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,a=t.maxRetransmits,o=t.label,s=t.protocol,this.assertNotClosed(),this.assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:a,protocol:s},R.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%C.MIS,this._hasDataChannelMediaSection){e.next=5;break}return e.next=1,this._pc.createOffer();case 1:if(d=e.sent,l=g.parse(d.sdp),f=l.media.find(function(e){return"application"===e.type}),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:"client",localSdpObject:l});case 2:return R.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=3,this._pc.setLocalDescription(d);case 3:return this._remoteSdp.sendSctpAssociation({offerMediaObject:f}),p={type:"answer",sdp:this._remoteSdp.getSdp()},R.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=4,this._pc.setRemoteDescription(p);case 4:this._hasDataChannelMediaSection=!0;case 5:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 6:case"end":return e.stop()}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"receive",value:(T=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,w,k,S,E,P,M,C,T,A,I,O=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=[],n=new Map,a=p(t);try{for(a.s();!(o=a.n()).done;)c=o.value,u=c.trackId,d=c.kind,l=c.rtpParameters,f=c.streamId,R.debug("receive() [trackId:%s, kind:%s]",u,d),h=null!==(s=l.mid)&&void 0!==s?s:String(this._mapMidTransceiver.size),n.set(u,h),this._remoteSdp.receive({mid:h,kind:d,offerRtpParameters:l,streamId:null!=f?f:l.rtcp.cname,trackId:u})}catch(e){a.e(e)}finally{a.f()}return m={type:"offer",sdp:this._remoteSdp.getSdp()},R.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",m),e.next=1,this._pc.setRemoteDescription(m);case 1:b=p(t),e.prev=2,y=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=v.value,r=t.trackId,!(a=t.onRtpReceiver)){e.next=2;break}if(o=n.get(r),s=O._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("transceiver not found");case 1:a(s.receiver);case 2:case"end":return e.stop()}},e)}),b.s();case 3:if((v=b.n()).done){e.next=5;break}return e.delegateYield(y(),"t0",4);case 4:e.next=3;break;case 5:e.next=7;break;case 6:e.prev=6,T=e.catch(2),b.e(T);case 7:return e.prev=7,b.f(),e.finish(7);case 8:return e.next=9,this._pc.createAnswer();case 9:_=e.sent,w=g.parse(_.sdp),k=p(t),e.prev=10,E=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=S.value,r=t.trackId,a=t.rtpParameters,o=n.get(r),s=w.media.find(function(e){return String(e.mid)===o}),x.applyCodecParameters({offerRtpParameters:a,answerMediaObject:s}),_={type:"answer",sdp:g.write(w)};case 1:case"end":return e.stop()}},e)}),k.s();case 11:if((S=k.n()).done){e.next=13;break}return e.delegateYield(E(),"t1",12);case 12:e.next=11;break;case 13:e.next=15;break;case 14:e.prev=14,A=e.catch(10),k.e(A);case 15:return e.prev=15,k.f(),e.finish(15);case 16:if(this._transportReady){e.next=17;break}return e.next=17,this.setupTransport({localDtlsRole:"client",localSdpObject:w});case 17:return R.debug("receive() | calling pc.setLocalDescription() [answer:%o]",_),e.next=18,this._pc.setLocalDescription(_);case 18:P=p(t),e.prev=19,C=i.default.mark(function e(){var t,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=M.value,a=t.trackId,o=n.get(a),s=O._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("new RTCRtpTransceiver not found");case 1:O._mapMidTransceiver.set(o,s),r.push({localId:o,track:s.receiver.track,rtpReceiver:s.receiver});case 2:case"end":return e.stop()}},e)}),P.s();case 20:if((M=P.n()).done){e.next=22;break}return e.delegateYield(C(),"t2",21);case 21:e.next=20;break;case 22:e.next=24;break;case 23:e.prev=23,I=e.catch(19),P.e(I);case 24:return e.prev=24,P.f(),e.finish(24);case 25:return e.abrupt("return",r);case 26:case"end":return e.stop()}},e,this,[[2,6,7,8],[10,14,15,16],[19,23,24,25]])})),function(e){return T.apply(this,arguments)})},{key:"stopReceiving",value:(_=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertRecvDirection(),!this._closed){e.next=1;break}return e.abrupt("return");case 1:r=p(t),e.prev=2,r.s();case 3:if((n=r.n()).done){e.next=6;break}if(a=n.value,R.debug("stopReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:this._remoteSdp.closeMediaSection(o.mid);case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,f=e.catch(2),r.e(f);case 8:return e.prev=8,r.f(),e.finish(8);case 9:return s={type:"offer",sdp:this._remoteSdp.getSdp()},R.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=10,this._pc.setRemoteDescription(s);case 10:return e.next=11,this._pc.createAnswer();case 11:return c=e.sent,R.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=12,this._pc.setLocalDescription(c);case 12:u=p(t);try{for(u.s();!(d=u.n()).done;)l=d.value,this._mapMidTransceiver.delete(l)}catch(e){u.e(e)}finally{u.f()}case 13:case"end":return e.stop()}},e,this,[[2,7,8,9]])})),function(e){return _.apply(this,arguments)})},{key:"pauseReceiving",value:(y=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,R.debug("pauseReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="inactive",this._remoteSdp.pauseMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},R.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,R.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return y.apply(this,arguments)})},{key:"resumeReceiving",value:(m=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,R.debug("resumeReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},R.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,R.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return m.apply(this,arguments)})},{key:"getReceiverStats",value:(h=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.receiver.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return h.apply(this,arguments)})},{key:"receiveDataChannel",value:(n=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,a=t.protocol,this.assertNotClosed(),this.assertRecvDirection(),o=r.streamId,s=r.ordered,c=r.maxPacketLifeTime,u=r.maxRetransmits,d={negotiated:!0,id:o,ordered:s,maxPacketLifeTime:c,maxRetransmits:u,protocol:a},R.debug("receiveDataChannel() [options:%o]",d),l=this._pc.createDataChannel(n,d),this._hasDataChannelMediaSection){e.next=5;break}return this._remoteSdp.receiveSctpAssociation(),f={type:"offer",sdp:this._remoteSdp.getSdp()},R.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",f),e.next=1,this._pc.setRemoteDescription(f);case 1:return e.next=2,this._pc.createAnswer();case 2:if(p=e.sent,this._transportReady){e.next=3;break}return h=g.parse(p.sdp),e.next=3,this.setupTransport({localDtlsRole:"client",localSdpObject:h});case 3:return R.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=4,this._pc.setLocalDescription(p);case 4:this._hasDataChannelMediaSection=!0;case 5:return e.abrupt("return",{dataChannel:l});case 6:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setupTransport",value:(r=(0,a.default)(i.default.mark(function e(t){var r,n,a,o=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=g.parse(this._pc.localDescription.sdp)),(a=x.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=1,new Promise(function(e,t){o.safeEmit("@connect",{dtlsParameters:a},e,t)});case 1:this._transportReady=!0;case 2:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"assertNotClosed",value:function(){if(this._closed)throw new w.InvalidStateError("method called in a closed handler")}},{key:"assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}],[{key:"createFactory",value:function(){return{name:M,factory:function(e){return new t(e)},getNativeRtpCapabilities:(r=(0,a.default)(i.default.mark(function e(){var r,n,a,o,s,c,u,d,l;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return R.debug("getNativeRtpCapabilities()"),r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),(n=document.createElement("canvas")).getContext("2d"),a=n.captureStream(),o=a.getVideoTracks()[0],e.prev=1,r.addTransceiver("audio",{direction:"sendrecv"}),r.addTransceiver(o,{direction:"sendrecv",sendEncodings:[{rid:"r0",maxBitrate:1e5},{rid:"r1",maxBitrate:5e5}]}),e.next=2,r.createOffer();case 2:s=e.sent;try{n.remove()}catch(e){}try{o.stop()}catch(e){}try{r.close()}catch(e){}return r=void 0,c=g.parse(s.sdp),u=t.getLocalRtpCapabilities(c),e.abrupt("return",u);case 3:e.prev=3,l=e.catch(1);try{n.remove()}catch(e){}try{o.stop()}catch(e){}try{null===(d=r)||void 0===d||d.close()}catch(e){}throw r=void 0,l;case 4:case"end":return e.stop()}},e,null,[[1,3]])})),function(){return r.apply(this,arguments)}),getNativeSctpCapabilities:(e=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return R.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:C});case 1:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})};var e,r}},{key:"getLocalRtpCapabilities",value:function(e){var t=x.extractRtpCapabilities({sdpObject:e});return k.validateAndNormalizeRtpCapabilities(t),t}}]);var r,n,h,m,y,_,T,A,I,O,j,D,L,B,N,F,U,q,z}(y.EnhancedEventEmitter);r.Firefox120=T},{"../Logger":302,"../enhancedEvents":305,"../errors":306,"../ortc":320,"../scalabilityModes":321,"./sdp/RemoteSdp":316,"./sdp/commonUtils":317,"./sdp/unifiedPlanUtils":318,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,"sdp-transform":390}],311:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/defineProperty"));function p(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(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,f.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 v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.ReactNative106=void 0;var g=e("sdp-transform"),y=e("../enhancedEvents"),_=e("../Logger"),w=e("../ortc"),k=e("../errors"),S=e("../scalabilityModes"),x=e("./sdp/RemoteSdp"),E=e("./sdp/commonUtils"),P=e("./sdp/unifiedPlanUtils"),R=e("./ortc/utils"),M=new _.Logger("ReactNative106"),C="ReactNative106",T={OS:1024,MIS:1024},A=function(e){function t(e){var r,n,i,a,s=e.direction,d=e.iceParameters,l=e.iceCandidates,p=e.dtlsParameters,h=e.sctpParameters,m=e.iceServers,g=e.iceTransportPolicy,y=e.additionalSettings,_=e.getSendExtendedRtpCapabilities;return(0,o.default)(this,t),n=this,i=t,i=(0,u.default)(i),r=(0,c.default)(n,v()?Reflect.construct(i,a||[],(0,u.default)(n).constructor):i.apply(n,a)),(0,f.default)(r,"_closed",!1),(0,f.default)(r,"_direction",void 0),(0,f.default)(r,"_remoteSdp",void 0),(0,f.default)(r,"_getSendExtendedRtpCapabilities",void 0),(0,f.default)(r,"_forcedLocalDtlsRole",void 0),(0,f.default)(r,"_pc",void 0),(0,f.default)(r,"_mapMidTransceiver",new Map),(0,f.default)(r,"_sendStream",new MediaStream),(0,f.default)(r,"_hasDataChannelMediaSection",!1),(0,f.default)(r,"_nextSendSctpStreamId",0),(0,f.default)(r,"_transportReady",!1),(0,f.default)(r,"onIceGatheringStateChange",function(){r.emit("@icegatheringstatechange",r._pc.iceGatheringState)}),(0,f.default)(r,"onIceCandidateError",function(e){r.emit("@icecandidateerror",e)}),(0,f.default)(r,"onConnectionStateChange",function(){r.emit("@connectionstatechange",r._pc.connectionState)}),(0,f.default)(r,"onIceConnectionStateChange",function(){switch(r._pc.iceConnectionState){case"checking":r.emit("@connectionstatechange","connecting");break;case"connected":case"completed":r.emit("@connectionstatechange","connected");break;case"failed":r.emit("@connectionstatechange","failed");break;case"disconnected":r.emit("@connectionstatechange","disconnected");break;case"closed":r.emit("@connectionstatechange","closed")}}),M.debug("constructor()"),r._direction=s,r._remoteSdp=new x.RemoteSdp({iceParameters:d,iceCandidates:l,dtlsParameters:p,sctpParameters:h}),r._getSendExtendedRtpCapabilities=_,p.role&&"auto"!==p.role&&(r._forcedLocalDtlsRole="server"===p.role?"client":"server"),r._pc=new RTCPeerConnection(b({iceServers:null!=m?m:[],iceTransportPolicy:null!=g?g:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},y)),r._pc.addEventListener("icegatheringstatechange",r.onIceGatheringStateChange),r._pc.addEventListener("icecandidateerror",r.onIceCandidateError),r._pc.connectionState?r._pc.addEventListener("connectionstatechange",r.onConnectionStateChange):(M.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),r._pc.addEventListener("iceconnectionstatechange",r.onIceConnectionStateChange)),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return C}},{key:"close",value:function(){if(M.debug("close()"),!this._closed){this._closed=!0,this._sendStream.release(!1);try{this._pc.close()}catch(e){}var e,r,n,i,a;this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),(e=t,r="close",n=this,i=3,a=(0,d.default)((0,u.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([])}}},{key:"updateIceServers",value:(V=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),M.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 1:case"end":return e.stop()}},e,this)})),function(e){return V.apply(this,arguments)})},{key:"restartIce",value:(z=(0,a.default)(i.default.mark(function e(t){var r,n,a,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),M.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=1;break}return e.abrupt("return");case 1:if("send"!==this._direction){e.next=5;break}return e.next=2,this._pc.createOffer({iceRestart:!0});case 2:return r=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=3,this._pc.setLocalDescription(r);case 3:return n={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=4,this._pc.setRemoteDescription(n);case 4:e.next=8;break;case 5:return a={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=6,this._pc.setRemoteDescription(a);case 6:return e.next=7,this._pc.createAnswer();case 7:return o=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=8,this._pc.setLocalDescription(o);case 8:case"end":return e.stop()}},e,this)})),function(e){return z.apply(this,arguments)})},{key:"getTransportStats",value:(q=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}},e,this)})),function(){return q.apply(this,arguments)})},{key:"send",value:(U=(0,a.default)(i.default.mark(function e(r){var n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,k,x,R,C,T,A,I,O,j;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.track,o=r.encodings,s=r.codecOptions,c=r.codec,u=r.onRtpSender,this.assertNotClosed(),this.assertSendDirection(),M.debug("send() [kind:%s, track.id:%s]",a.kind,a.id),o&&o.length>1&&o.forEach(function(e,t){e.rid="r".concat(t)}),d=this._remoteSdp.getNextMediaSectionIdx(),l=this._pc.addTransceiver(a,{direction:"sendonly",streams:[this._sendStream],sendEncodings:o}),u&&u(l.sender),e.next=1,this._pc.createOffer();case 1:if(f=e.sent,(h=g.parse(f.sdp)).extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed(),m=t.getLocalRtpCapabilities(h),b=this._getSendExtendedRtpCapabilities(m),(v=w.getSendingRtpParameters(a.kind,b)).codecs=w.reduceCodecs(v.codecs,c),(y=w.getSendingRemoteRtpParameters(a.kind,b)).codecs=w.reduceCodecs(y.codecs,c),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(_=this._forcedLocalDtlsRole)&&void 0!==_?_:"client",localSdpObject:h});case 2:return k=!1,x=(0,S.parse)((null!=o?o:[{}])[0].scalabilityMode),o&&1===o.length&&x.spatialLayers>1&&"video/vp9"===v.codecs[0].mimeType.toLowerCase()&&(M.debug("send() | enabling legacy simulcast for VP9 SVC"),k=!0,h=g.parse(f.sdp),R=h.media[d.idx],P.addLegacySimulcast({offerMediaObject:R,numStreams:x.spatialLayers}),f={type:"offer",sdp:g.write(h)}),M.debug("send() | calling pc.setLocalDescription() [offer:%o]",f),e.next=3,this._pc.setLocalDescription(f);case 3:if((C=null!==(n=l.mid)&&void 0!==n?n:void 0)||M.warn("send() | missing transceiver.mid (bug in react-native-webrtc, using a workaround"),v.mid=C,h=g.parse(this._pc.localDescription.sdp),R=h.media[d.idx],v.rtcp.cname=E.getCname({offerMediaObject:R}),o?1===o.length?(T=P.getRtpEncodings({offerMediaObject:R}),Object.assign(T[0],o[0]),k&&(T=[T[0]]),v.encodings=T):v.encodings=o:v.encodings=P.getRtpEncodings({offerMediaObject:R}),v.encodings.length>1&&("video/vp8"===v.codecs[0].mimeType.toLowerCase()||"video/h264"===v.codecs[0].mimeType.toLowerCase())){A=p(v.encodings);try{for(A.s();!(I=A.n()).done;)(O=I.value).scalabilityMode?O.scalabilityMode="L1T".concat(x.temporalLayers):O.scalabilityMode="L1T3"}catch(e){A.e(e)}finally{A.f()}}return this._remoteSdp.send({offerMediaObject:R,reuseMid:d.reuseMid,offerRtpParameters:v,answerRtpParameters:y,codecOptions:s}),j={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("send() | calling pc.setRemoteDescription() [answer:%o]",j),e.next=4,this._pc.setRemoteDescription(j);case 4:return C||(C=l.mid,v.mid=C),this._mapMidTransceiver.set(C,l),e.abrupt("return",{localId:C,rtpParameters:v,rtpSender:l.sender});case 5:case"end":return e.stop()}},e,this)})),function(e){return U.apply(this,arguments)})},{key:"stopSending",value:(F=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertSendDirection(),!this._closed){e.next=1;break}return e.abrupt("return");case 1:if(M.debug("stopSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=2;break}throw new Error("associated RTCRtpTransceiver not found");case 2:if(r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.closeMediaSection(r.mid))try{r.stop()}catch(e){}return e.next=3,this._pc.createOffer();case 3:return n=e.sent,M.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=4,this._pc.setLocalDescription(n);case 4:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=5,this._pc.setRemoteDescription(a);case 5:this._mapMidTransceiver.delete(t);case 6:case"end":return e.stop()}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"pauseSending",value:(N=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("pauseSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="inactive",this._remoteSdp.pauseMediaSection(t),e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"resumeSending",value:(B=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("resumeSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t),this._remoteSdp.resumeSendingMediaSection(t),r){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="sendonly",e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return B.apply(this,arguments)})},{key:"replaceTrack",value:(L=(0,a.default)(i.default.mark(function e(t,r){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r?M.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):M.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.next=2,n.sender.replaceTrack(r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return L.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(D=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){e.active=t<=r}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(j=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){a.encodings[t]=b(b({},e),r)}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return j.apply(this,arguments)})},{key:"getSenderStats",value:(O=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.sender.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"sendDataChannel",value:(I=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,a=t.maxRetransmits,o=t.label,s=t.protocol,this.assertNotClosed(),this.assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:a,protocol:s},M.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%T.MIS,this._hasDataChannelMediaSection){e.next=5;break}return e.next=1,this._pc.createOffer();case 1:if(d=e.sent,l=g.parse(d.sdp),f=l.media.find(function(e){return"application"===e.type}),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(p=this._forcedLocalDtlsRole)&&void 0!==p?p:"client",localSdpObject:l});case 2:return M.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=3,this._pc.setLocalDescription(d);case 3:return this._remoteSdp.sendSctpAssociation({offerMediaObject:f}),h={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=4,this._pc.setRemoteDescription(h);case 4:this._hasDataChannelMediaSection=!0;case 5:return m={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:m});case 6:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"receive",value:(A=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,w,k,S,x,P,R,C,T,A,I,O,j=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=[],n=new Map,a=p(t);try{for(a.s();!(o=a.n()).done;)c=o.value,u=c.trackId,d=c.kind,l=c.rtpParameters,f=c.streamId,M.debug("receive() [trackId:%s, kind:%s]",u,d),h=null!==(s=l.mid)&&void 0!==s?s:String(this._mapMidTransceiver.size),n.set(u,h),this._remoteSdp.receive({mid:h,kind:d,offerRtpParameters:l,streamId:null!=f?f:l.rtcp.cname,trackId:u})}catch(e){a.e(e)}finally{a.f()}return m={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",m),e.next=1,this._pc.setRemoteDescription(m);case 1:b=p(t),e.prev=2,y=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=v.value,r=t.trackId,!(a=t.onRtpReceiver)){e.next=2;break}if(o=n.get(r),s=j._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("transceiver not found");case 1:a(s.receiver);case 2:case"end":return e.stop()}},e)}),b.s();case 3:if((v=b.n()).done){e.next=5;break}return e.delegateYield(y(),"t0",4);case 4:e.next=3;break;case 5:e.next=7;break;case 6:e.prev=6,A=e.catch(2),b.e(A);case 7:return e.prev=7,b.f(),e.finish(7);case 8:return e.next=9,this._pc.createAnswer();case 9:_=e.sent,w=g.parse(_.sdp),k=p(t),e.prev=10,x=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=S.value,r=t.trackId,a=t.rtpParameters,o=n.get(r),s=w.media.find(function(e){return String(e.mid)===o}),E.applyCodecParameters({offerRtpParameters:a,answerMediaObject:s});case 1:case"end":return e.stop()}},e)}),k.s();case 11:if((S=k.n()).done){e.next=13;break}return e.delegateYield(x(),"t1",12);case 12:e.next=11;break;case 13:e.next=15;break;case 14:e.prev=14,I=e.catch(10),k.e(I);case 15:return e.prev=15,k.f(),e.finish(15);case 16:if(_={type:"answer",sdp:g.write(w)},this._transportReady){e.next=17;break}return e.next=17,this.setupTransport({localDtlsRole:null!==(P=this._forcedLocalDtlsRole)&&void 0!==P?P:"client",localSdpObject:w});case 17:return M.debug("receive() | calling pc.setLocalDescription() [answer:%o]",_),e.next=18,this._pc.setLocalDescription(_);case 18:R=p(t),e.prev=19,T=i.default.mark(function e(){var t,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=C.value,a=t.trackId,o=n.get(a),s=j._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("new RTCRtpTransceiver not found");case 1:j._mapMidTransceiver.set(o,s),r.push({localId:o,track:s.receiver.track,rtpReceiver:s.receiver});case 2:case"end":return e.stop()}},e)}),R.s();case 20:if((C=R.n()).done){e.next=22;break}return e.delegateYield(T(),"t2",21);case 21:e.next=20;break;case 22:e.next=24;break;case 23:e.prev=23,O=e.catch(19),R.e(O);case 24:return e.prev=24,R.f(),e.finish(24);case 25:return e.abrupt("return",r);case 26:case"end":return e.stop()}},e,this,[[2,6,7,8],[10,14,15,16],[19,23,24,25]])})),function(e){return A.apply(this,arguments)})},{key:"stopReceiving",value:(_=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertRecvDirection(),!this._closed){e.next=1;break}return e.abrupt("return");case 1:r=p(t),e.prev=2,r.s();case 3:if((n=r.n()).done){e.next=6;break}if(a=n.value,M.debug("stopReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:this._remoteSdp.closeMediaSection(o.mid);case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,f=e.catch(2),r.e(f);case 8:return e.prev=8,r.f(),e.finish(8);case 9:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=10,this._pc.setRemoteDescription(s);case 10:return e.next=11,this._pc.createAnswer();case 11:return c=e.sent,M.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=12,this._pc.setLocalDescription(c);case 12:u=p(t);try{for(u.s();!(d=u.n()).done;)l=d.value,this._mapMidTransceiver.delete(l)}catch(e){u.e(e)}finally{u.f()}case 13:case"end":return e.stop()}},e,this,[[2,7,8,9]])})),function(e){return _.apply(this,arguments)})},{key:"pauseReceiving",value:(y=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("pauseReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="inactive",this._remoteSdp.pauseMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return y.apply(this,arguments)})},{key:"resumeReceiving",value:(m=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("resumeReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return m.apply(this,arguments)})},{key:"getReceiverStats",value:(h=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.receiver.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return h.apply(this,arguments)})},{key:"receiveDataChannel",value:(n=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,a=t.protocol,this.assertNotClosed(),this.assertRecvDirection(),o=r.streamId,s=r.ordered,c=r.maxPacketLifeTime,u=r.maxRetransmits,d={negotiated:!0,id:o,ordered:s,maxPacketLifeTime:c,maxRetransmits:u,protocol:a},M.debug("receiveDataChannel() [options:%o]",d),l=this._pc.createDataChannel(n,d),this._hasDataChannelMediaSection){e.next=5;break}return this._remoteSdp.receiveSctpAssociation(),f={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",f),e.next=1,this._pc.setRemoteDescription(f);case 1:return e.next=2,this._pc.createAnswer();case 2:if(p=e.sent,this._transportReady){e.next=3;break}return m=g.parse(p.sdp),e.next=3,this.setupTransport({localDtlsRole:null!==(h=this._forcedLocalDtlsRole)&&void 0!==h?h:"client",localSdpObject:m});case 3:return M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=4,this._pc.setLocalDescription(p);case 4:this._hasDataChannelMediaSection=!0;case 5:return e.abrupt("return",{dataChannel:l});case 6:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setupTransport",value:(r=(0,a.default)(i.default.mark(function e(t){var r,n,a,o=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=g.parse(this._pc.localDescription.sdp)),(a=E.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=1,new Promise(function(e,t){o.safeEmit("@connect",{dtlsParameters:a},e,t)});case 1:this._transportReady=!0;case 2:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"assertNotClosed",value:function(){if(this._closed)throw new k.InvalidStateError("method called in a closed handler")}},{key:"assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}],[{key:"createFactory",value:function(){return{name:C,factory:function(e){return new t(e)},getNativeRtpCapabilities:(r=(0,a.default)(i.default.mark(function e(){var r,n,a,o,s,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeRtpCapabilities()"),r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),e.prev=1,r.addTransceiver("audio"),r.addTransceiver("video"),e.next=2,r.createOffer();case 2:n=e.sent;try{r.close()}catch(e){}return r=void 0,a=g.parse(n.sdp),o=t.getLocalRtpCapabilities(a),e.abrupt("return",o);case 3:e.prev=3,c=e.catch(1);try{null===(s=r)||void 0===s||s.close()}catch(e){}throw r=void 0,c;case 4:case"end":return e.stop()}},e,null,[[1,3]])})),function(){return r.apply(this,arguments)}),getNativeSctpCapabilities:(e=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:T});case 1:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})};var e,r}},{key:"getLocalRtpCapabilities",value:function(e){var t=E.extractRtpCapabilities({sdpObject:e});return w.validateAndNormalizeRtpCapabilities(t),R.addNackSupportForOpus(t),t}}]);var r,n,h,m,y,_,A,I,O,j,D,L,B,N,F,U,q,z,V}(y.EnhancedEventEmitter);r.ReactNative106=A},{"../Logger":302,"../enhancedEvents":305,"../errors":306,"../ortc":320,"../scalabilityModes":321,"./ortc/utils":314,"./sdp/RemoteSdp":316,"./sdp/commonUtils":317,"./sdp/unifiedPlanUtils":318,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,"sdp-transform":390}],312:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/regenerator")),a=n(e("@babel/runtime/helpers/asyncToGenerator")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/possibleConstructorReturn")),u=n(e("@babel/runtime/helpers/getPrototypeOf")),d=n(e("@babel/runtime/helpers/get")),l=n(e("@babel/runtime/helpers/inherits")),f=n(e("@babel/runtime/helpers/defineProperty"));function p(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(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,f.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 v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}Object.defineProperty(r,"__esModule",{value:!0}),r.Safari12=void 0;var g=e("sdp-transform"),y=e("../enhancedEvents"),_=e("../Logger"),w=e("../ortc"),k=e("../errors"),S=e("../scalabilityModes"),x=e("./sdp/RemoteSdp"),E=e("./sdp/commonUtils"),P=e("./sdp/unifiedPlanUtils"),R=e("./ortc/utils"),M=new _.Logger("Safari12"),C="Safari12",T={OS:1024,MIS:1024},A=function(e){function t(e){var r,n,i,a,s=e.direction,d=e.iceParameters,l=e.iceCandidates,p=e.dtlsParameters,h=e.sctpParameters,m=e.iceServers,g=e.iceTransportPolicy,y=e.additionalSettings,_=e.getSendExtendedRtpCapabilities;return(0,o.default)(this,t),n=this,i=t,i=(0,u.default)(i),r=(0,c.default)(n,v()?Reflect.construct(i,a||[],(0,u.default)(n).constructor):i.apply(n,a)),(0,f.default)(r,"_closed",!1),(0,f.default)(r,"_direction",void 0),(0,f.default)(r,"_remoteSdp",void 0),(0,f.default)(r,"_getSendExtendedRtpCapabilities",void 0),(0,f.default)(r,"_forcedLocalDtlsRole",void 0),(0,f.default)(r,"_pc",void 0),(0,f.default)(r,"_mapMidTransceiver",new Map),(0,f.default)(r,"_sendStream",new MediaStream),(0,f.default)(r,"_hasDataChannelMediaSection",!1),(0,f.default)(r,"_nextSendSctpStreamId",0),(0,f.default)(r,"_transportReady",!1),(0,f.default)(r,"onIceGatheringStateChange",function(){r.emit("@icegatheringstatechange",r._pc.iceGatheringState)}),(0,f.default)(r,"onIceCandidateError",function(e){r.emit("@icecandidateerror",e)}),(0,f.default)(r,"onConnectionStateChange",function(){r.emit("@connectionstatechange",r._pc.connectionState)}),(0,f.default)(r,"onIceConnectionStateChange",function(){switch(r._pc.iceConnectionState){case"checking":r.emit("@connectionstatechange","connecting");break;case"connected":case"completed":r.emit("@connectionstatechange","connected");break;case"failed":r.emit("@connectionstatechange","failed");break;case"disconnected":r.emit("@connectionstatechange","disconnected");break;case"closed":r.emit("@connectionstatechange","closed")}}),M.debug("constructor()"),r._direction=s,r._remoteSdp=new x.RemoteSdp({iceParameters:d,iceCandidates:l,dtlsParameters:p,sctpParameters:h}),r._getSendExtendedRtpCapabilities=_,p.role&&"auto"!==p.role&&(r._forcedLocalDtlsRole="server"===p.role?"client":"server"),r._pc=new RTCPeerConnection(b({iceServers:null!=m?m:[],iceTransportPolicy:null!=g?g:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},y)),r._pc.addEventListener("icegatheringstatechange",function(){r.emit("@icegatheringstatechange",r._pc.iceGatheringState)}),r._pc.addEventListener("icecandidateerror",function(e){r.emit("@icecandidateerror",e)}),r._pc.addEventListener("icegatheringstatechange",r.onIceGatheringStateChange),r._pc.addEventListener("icecandidateerror",r.onIceCandidateError),r._pc.connectionState?r._pc.addEventListener("connectionstatechange",r.onConnectionStateChange):(M.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),r._pc.addEventListener("iceconnectionstatechange",r.onIceConnectionStateChange)),r}return(0,l.default)(t,e),(0,s.default)(t,[{key:"name",get:function(){return C}},{key:"close",value:function(){if(M.debug("close()"),!this._closed){this._closed=!0;try{this._pc.close()}catch(e){}var e,r,n,i,a;this._pc.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this._pc.removeEventListener("icecandidateerror",this.onIceCandidateError),this._pc.removeEventListener("connectionstatechange",this.onConnectionStateChange),this._pc.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.emit("@close"),(e=t,r="close",n=this,i=3,a=(0,d.default)((0,u.default)(1&i?e.prototype:e),r,n),2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a)([])}}},{key:"updateIceServers",value:(V=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),M.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 1:case"end":return e.stop()}},e,this)})),function(e){return V.apply(this,arguments)})},{key:"restartIce",value:(z=(0,a.default)(i.default.mark(function e(t){var r,n,a,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),M.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=1;break}return e.abrupt("return");case 1:if("send"!==this._direction){e.next=5;break}return e.next=2,this._pc.createOffer({iceRestart:!0});case 2:return r=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=3,this._pc.setLocalDescription(r);case 3:return n={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=4,this._pc.setRemoteDescription(n);case 4:e.next=8;break;case 5:return a={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=6,this._pc.setRemoteDescription(a);case 6:return e.next=7,this._pc.createAnswer();case 7:return o=e.sent,M.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=8,this._pc.setLocalDescription(o);case 8:case"end":return e.stop()}},e,this)})),function(e){return z.apply(this,arguments)})},{key:"getTransportStats",value:(q=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotClosed(),e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}},e,this)})),function(){return q.apply(this,arguments)})},{key:"send",value:(U=(0,a.default)(i.default.mark(function e(r){var n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,k,x,R,C,T,A,I;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.track,a=r.encodings,o=r.codecOptions,s=r.codec,c=r.onRtpSender,this.assertNotClosed(),this.assertSendDirection(),M.debug("send() [kind:%s, track.id:%s]",n.kind,n.id),u=this._remoteSdp.getNextMediaSectionIdx(),d=this._pc.addTransceiver(n,{direction:"sendonly",streams:[this._sendStream]}),c&&c(d.sender),e.next=1,this._pc.createOffer();case 1:if(l=e.sent,(f=g.parse(l.sdp)).extmapAllowMixed&&this._remoteSdp.setSessionExtmapAllowMixed(),h=t.getLocalRtpCapabilities(f),m=this._getSendExtendedRtpCapabilities(h),(b=w.getSendingRtpParameters(n.kind,m)).codecs=w.reduceCodecs(b.codecs,s),(v=w.getSendingRemoteRtpParameters(n.kind,m)).codecs=w.reduceCodecs(v.codecs,s),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(_=this._forcedLocalDtlsRole)&&void 0!==_?_:"client",localSdpObject:f});case 2:return k=(0,S.parse)((null!=a?a:[{}])[0].scalabilityMode),a&&a.length>1&&(M.debug("send() | enabling legacy simulcast"),f=g.parse(l.sdp),y=f.media[u.idx],P.addLegacySimulcast({offerMediaObject:y,numStreams:a.length}),l={type:"offer",sdp:g.write(f)}),M.debug("send() | calling pc.setLocalDescription() [offer:%o]",l),e.next=3,this._pc.setLocalDescription(l);case 3:if(x=d.mid,b.mid=x,f=g.parse(this._pc.localDescription.sdp),y=f.media[u.idx],b.rtcp.cname=E.getCname({offerMediaObject:y}),b.encodings=P.getRtpEncodings({offerMediaObject:y}),a)for(R=0;R<b.encodings.length;++R)a[R]&&Object.assign(b.encodings[R],a[R]);if(b.encodings.length>1&&("video/vp8"===b.codecs[0].mimeType.toLowerCase()||"video/h264"===b.codecs[0].mimeType.toLowerCase())){C=p(b.encodings);try{for(C.s();!(T=C.n()).done;)(A=T.value).scalabilityMode?A.scalabilityMode="L1T".concat(k.temporalLayers):A.scalabilityMode="L1T3"}catch(e){C.e(e)}finally{C.f()}}return this._remoteSdp.send({offerMediaObject:y,reuseMid:u.reuseMid,offerRtpParameters:b,answerRtpParameters:v,codecOptions:o}),I={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("send() | calling pc.setRemoteDescription() [answer:%o]",I),e.next=4,this._pc.setRemoteDescription(I);case 4:return this._mapMidTransceiver.set(x,d),e.abrupt("return",{localId:x,rtpParameters:b,rtpSender:d.sender});case 5:case"end":return e.stop()}},e,this)})),function(e){return U.apply(this,arguments)})},{key:"stopSending",value:(F=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertSendDirection(),!this._closed){e.next=1;break}return e.abrupt("return");case 1:if(M.debug("stopSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=2;break}throw new Error("associated RTCRtpTransceiver not found");case 2:if(r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.closeMediaSection(r.mid))try{r.stop()}catch(e){}return e.next=3,this._pc.createOffer();case 3:return n=e.sent,M.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=4,this._pc.setLocalDescription(n);case 4:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=5,this._pc.setRemoteDescription(a);case 5:this._mapMidTransceiver.delete(t);case 6:case"end":return e.stop()}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"pauseSending",value:(N=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("pauseSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="inactive",this._remoteSdp.pauseMediaSection(t),e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"resumeSending",value:(B=(0,a.default)(i.default.mark(function e(t){var r,n,a;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("resumeSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return r.direction="sendonly",this._remoteSdp.resumeSendingMediaSection(t),e.next=2,this._pc.createOffer();case 2:return n=e.sent,M.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=3,this._pc.setLocalDescription(n);case 3:return a={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",a),e.next=4,this._pc.setRemoteDescription(a);case 4:case"end":return e.stop()}},e,this)})),function(e){return B.apply(this,arguments)})},{key:"replaceTrack",value:(L=(0,a.default)(i.default.mark(function e(t,r){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r?M.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):M.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.next=2,n.sender.replaceTrack(r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return L.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(D=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){e.active=t<=r}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(j=(0,a.default)(i.default.mark(function e(t,r){var n,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),M.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return(a=n.sender.getParameters()).encodings.forEach(function(e,t){a.encodings[t]=b(b({},e),r)}),e.next=2,n.sender.setParameters(a);case 2:return this._remoteSdp.muxMediaSectionSimulcast(t,a.encodings),e.next=3,this._pc.createOffer();case 3:return o=e.sent,M.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",o),e.next=4,this._pc.setLocalDescription(o);case 4:return s={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",s),e.next=5,this._pc.setRemoteDescription(s);case 5:case"end":return e.stop()}},e,this)})),function(e,t){return j.apply(this,arguments)})},{key:"getSenderStats",value:(O=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.sender.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"sendDataChannel",value:(I=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,a=t.maxRetransmits,o=t.label,s=t.protocol,this.assertNotClosed(),this.assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:a,protocol:s},M.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%T.MIS,this._hasDataChannelMediaSection){e.next=5;break}return e.next=1,this._pc.createOffer();case 1:if(d=e.sent,l=g.parse(d.sdp),f=l.media.find(function(e){return"application"===e.type}),this._transportReady){e.next=2;break}return e.next=2,this.setupTransport({localDtlsRole:null!==(p=this._forcedLocalDtlsRole)&&void 0!==p?p:"client",localSdpObject:l});case 2:return M.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=3,this._pc.setLocalDescription(d);case 3:return this._remoteSdp.sendSctpAssociation({offerMediaObject:f}),h={type:"answer",sdp:this._remoteSdp.getSdp()},M.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=4,this._pc.setRemoteDescription(h);case 4:this._hasDataChannelMediaSection=!0;case 5:return m={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:m});case 6:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"receive",value:(A=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,h,m,b,v,y,_,w,k,S,x,P,R,C,T,A,I,O,j=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=[],n=new Map,a=p(t);try{for(a.s();!(o=a.n()).done;)c=o.value,u=c.trackId,d=c.kind,l=c.rtpParameters,f=c.streamId,M.debug("receive() [trackId:%s, kind:%s]",u,d),h=null!==(s=l.mid)&&void 0!==s?s:String(this._mapMidTransceiver.size),n.set(u,h),this._remoteSdp.receive({mid:h,kind:d,offerRtpParameters:l,streamId:null!=f?f:l.rtcp.cname,trackId:u})}catch(e){a.e(e)}finally{a.f()}return m={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",m),e.next=1,this._pc.setRemoteDescription(m);case 1:b=p(t),e.prev=2,y=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=v.value,r=t.trackId,!(a=t.onRtpReceiver)){e.next=2;break}if(o=n.get(r),s=j._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("transceiver not found");case 1:a(s.receiver);case 2:case"end":return e.stop()}},e)}),b.s();case 3:if((v=b.n()).done){e.next=5;break}return e.delegateYield(y(),"t0",4);case 4:e.next=3;break;case 5:e.next=7;break;case 6:e.prev=6,A=e.catch(2),b.e(A);case 7:return e.prev=7,b.f(),e.finish(7);case 8:return e.next=9,this._pc.createAnswer();case 9:_=e.sent,w=g.parse(_.sdp),k=p(t),e.prev=10,x=i.default.mark(function e(){var t,r,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=S.value,r=t.trackId,a=t.rtpParameters,o=n.get(r),s=w.media.find(function(e){return String(e.mid)===o}),E.applyCodecParameters({offerRtpParameters:a,answerMediaObject:s});case 1:case"end":return e.stop()}},e)}),k.s();case 11:if((S=k.n()).done){e.next=13;break}return e.delegateYield(x(),"t1",12);case 12:e.next=11;break;case 13:e.next=15;break;case 14:e.prev=14,I=e.catch(10),k.e(I);case 15:return e.prev=15,k.f(),e.finish(15);case 16:if(_={type:"answer",sdp:g.write(w)},this._transportReady){e.next=17;break}return e.next=17,this.setupTransport({localDtlsRole:null!==(P=this._forcedLocalDtlsRole)&&void 0!==P?P:"client",localSdpObject:w});case 17:return M.debug("receive() | calling pc.setLocalDescription() [answer:%o]",_),e.next=18,this._pc.setLocalDescription(_);case 18:R=p(t),e.prev=19,T=i.default.mark(function e(){var t,a,o,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=C.value,a=t.trackId,o=n.get(a),s=j._pc.getTransceivers().find(function(e){return e.mid===o})){e.next=1;break}throw new Error("new RTCRtpTransceiver not found");case 1:j._mapMidTransceiver.set(o,s),r.push({localId:o,track:s.receiver.track,rtpReceiver:s.receiver});case 2:case"end":return e.stop()}},e)}),R.s();case 20:if((C=R.n()).done){e.next=22;break}return e.delegateYield(T(),"t2",21);case 21:e.next=20;break;case 22:e.next=24;break;case 23:e.prev=23,O=e.catch(19),R.e(O);case 24:return e.prev=24,R.f(),e.finish(24);case 25:return e.abrupt("return",r);case 26:case"end":return e.stop()}},e,this,[[2,6,7,8],[10,14,15,16],[19,23,24,25]])})),function(e){return A.apply(this,arguments)})},{key:"stopReceiving",value:(_=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertRecvDirection(),!this._closed){e.next=1;break}return e.abrupt("return");case 1:r=p(t),e.prev=2,r.s();case 3:if((n=r.n()).done){e.next=6;break}if(a=n.value,M.debug("stopReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:this._remoteSdp.closeMediaSection(o.mid);case 5:e.next=3;break;case 6:e.next=8;break;case 7:e.prev=7,f=e.catch(2),r.e(f);case 8:return e.prev=8,r.f(),e.finish(8);case 9:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=10,this._pc.setRemoteDescription(s);case 10:return e.next=11,this._pc.createAnswer();case 11:return c=e.sent,M.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=12,this._pc.setLocalDescription(c);case 12:u=p(t);try{for(u.s();!(d=u.n()).done;)l=d.value,this._mapMidTransceiver.delete(l)}catch(e){u.e(e)}finally{u.f()}case 13:case"end":return e.stop()}},e,this,[[2,7,8,9]])})),function(e){return _.apply(this,arguments)})},{key:"pauseReceiving",value:(y=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("pauseReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="inactive",this._remoteSdp.pauseMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return y.apply(this,arguments)})},{key:"resumeReceiving",value:(m=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.assertNotClosed(),this.assertRecvDirection(),r=p(t),e.prev=1,r.s();case 2:if((n=r.n()).done){e.next=5;break}if(a=n.value,M.debug("resumeReceiving() [localId:%s]",a),o=this._mapMidTransceiver.get(a)){e.next=3;break}throw new Error("associated RTCRtpTransceiver not found");case 3:o.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(a);case 4:e.next=2;break;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(1),r.e(u);case 7:return e.prev=7,r.f(),e.finish(7);case 8:return s={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=9,this._pc.setRemoteDescription(s);case 9:return e.next=10,this._pc.createAnswer();case 10:return c=e.sent,M.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",c),e.next=11,this._pc.setLocalDescription(c);case 11:case"end":return e.stop()}},e,this,[[1,6,7,8]])})),function(e){return m.apply(this,arguments)})},{key:"getReceiverStats",value:(h=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertNotClosed(),this.assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=1;break}throw new Error("associated RTCRtpTransceiver not found");case 1:return e.abrupt("return",r.receiver.getStats());case 2:case"end":return e.stop()}},e,this)})),function(e){return h.apply(this,arguments)})},{key:"receiveDataChannel",value:(n=(0,a.default)(i.default.mark(function e(t){var r,n,a,o,s,c,u,d,l,f,p,h,m;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,a=t.protocol,this.assertNotClosed(),this.assertRecvDirection(),o=r.streamId,s=r.ordered,c=r.maxPacketLifeTime,u=r.maxRetransmits,d={negotiated:!0,id:o,ordered:s,maxPacketLifeTime:c,maxRetransmits:u,protocol:a},M.debug("receiveDataChannel() [options:%o]",d),l=this._pc.createDataChannel(n,d),this._hasDataChannelMediaSection){e.next=5;break}return this._remoteSdp.receiveSctpAssociation(),f={type:"offer",sdp:this._remoteSdp.getSdp()},M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",f),e.next=1,this._pc.setRemoteDescription(f);case 1:return e.next=2,this._pc.createAnswer();case 2:if(p=e.sent,this._transportReady){e.next=3;break}return m=g.parse(p.sdp),e.next=3,this.setupTransport({localDtlsRole:null!==(h=this._forcedLocalDtlsRole)&&void 0!==h?h:"client",localSdpObject:m});case 3:return M.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=4,this._pc.setLocalDescription(p);case 4:this._hasDataChannelMediaSection=!0;case 5:return e.abrupt("return",{dataChannel:l});case 6:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"setupTransport",value:(r=(0,a.default)(i.default.mark(function e(t){var r,n,a,o=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=g.parse(this._pc.localDescription.sdp)),(a=E.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=1,new Promise(function(e,t){o.safeEmit("@connect",{dtlsParameters:a},e,t)});case 1:this._transportReady=!0;case 2:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"assertNotClosed",value:function(){if(this._closed)throw new k.InvalidStateError("method called in a closed handler")}},{key:"assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}],[{key:"createFactory",value:function(){return{name:C,factory:function(e){return new t(e)},getNativeRtpCapabilities:(r=(0,a.default)(i.default.mark(function e(){var r,n,a,o,s,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeRtpCapabilities()"),r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),e.prev=1,r.addTransceiver("audio"),r.addTransceiver("video"),e.next=2,r.createOffer();case 2:n=e.sent;try{r.close()}catch(e){}return r=void 0,a=g.parse(n.sdp),o=t.getLocalRtpCapabilities(a),e.abrupt("return",o);case 3:e.prev=3,c=e.catch(1);try{null===(s=r)||void 0===s||s.close()}catch(e){}throw r=void 0,c;case 4:case"end":return e.stop()}},e,null,[[1,3]])})),function(){return r.apply(this,arguments)}),getNativeSctpCapabilities:(e=(0,a.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return M.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:T});case 1:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})};var e,r}},{key:"getLocalRtpCapabilities",value:function(e){var t=E.extractRtpCapabilities({sdpObject:e});return w.validateAndNormalizeRtpCapabilities(t),R.addNackSupportForOpus(t),t}}]);var r,n,h,m,y,_,A,I,O,j,D,L,B,N,F,U,q,z,V}(y.EnhancedEventEmitter);r.Safari12=A},{"../Logger":302,"../enhancedEvents":305,"../errors":306,"../ortc":320,"../scalabilityModes":321,"./ortc/utils":314,"./sdp/RemoteSdp":316,"./sdp/commonUtils":317,"./sdp/unifiedPlanUtils":318,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/get":33,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,"sdp-transform":390}],313:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/toConsumableArray")),a=n(e("@babel/runtime/helpers/typeof")),o=n(e("@babel/runtime/helpers/classCallCheck")),s=n(e("@babel/runtime/helpers/createClass")),c=n(e("@babel/runtime/helpers/defineProperty"));Object.defineProperty(r,"__esModule",{value:!0}),r.FakeEventTarget=void 0;var u=function(){return(0,s.default)(function e(){(0,o.default)(this,e),(0,c.default)(this,"listeners",{})},[{key:"addEventListener",value:function(e,t,r){var n,i;t&&(null!==(i=(n=this.listeners)[e])&&void 0!==i||(n[e]=[]),this.listeners[e].push({callback:"function"==typeof t?t:t.handleEvent,once:"object"===(0,a.default)(r)&&!0===r.once}))}},{key:"removeEventListener",value:function(e,t,r){this.listeners[e]&&t&&(this.listeners[e]=this.listeners[e].filter(function(e){return e.callback!==("function"==typeof t?t:t.handleEvent)}))}},{key:"dispatchEvent",value:function(e){var t=this;if(!e||"string"!=typeof e.type)throw new Error("invalid event object");var r=this.listeners[e.type];if(!r)return!0;for(var n=function(){var r=o[a];try{r.callback.call(t,e)}catch(e){setTimeout(function(){throw e},0)}r.once&&t.removeEventListener(e.type,r.callback)},a=0,o=(0,i.default)(r);a<o.length;a++)n();return!e.defaultPrevented}}])}();r.FakeEventTarget=u},{"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":57,"@babel/runtime/helpers/typeof":60}],314:[function(e,t,r){"use strict";function n(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 i(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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}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 o,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,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw o}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.addNackSupportForOpus=function(e){var t,r,i=n(null!==(t=e.codecs)&&void 0!==t?t:[]);try{for(i.s();!(r=i.n()).done;){var a,o=r.value;"audio/opus"!==o.mimeType.toLowerCase()&&"audio/multiopus"!==o.mimeType.toLowerCase()||null!==(a=o.rtcpFeedback)&&void 0!==a&&a.some(function(e){return"nack"===e.type&&!e.parameter})||(o.rtcpFeedback||(o.rtcpFeedback=[]),o.rtcpFeedback.push({type:"nack"}))}}catch(e){i.e(e)}finally{i.f()}}},{}],315:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/possibleConstructorReturn")),a=n(e("@babel/runtime/helpers/getPrototypeOf")),o=n(e("@babel/runtime/helpers/inherits")),s=n(e("@babel/runtime/helpers/classCallCheck")),c=n(e("@babel/runtime/helpers/createClass")),u=n(e("@babel/runtime/helpers/defineProperty"));function d(e,t,r){return t=(0,a.default)(t),(0,i.default)(e,l()?Reflect.construct(t,r||[],(0,a.default)(e).constructor):t.apply(e,r))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.OfferMediaSection=r.AnswerMediaSection=r.MediaSection=void 0;var h=e("sdp-transform"),m=e("../../utils"),b=function(){return(0,c.default)(function e(t){var r=t.iceParameters,n=t.iceCandidates,i=t.dtlsParameters;if((0,s.default)(this,e),(0,u.default)(this,"_mediaObject",void 0),this._mediaObject={type:"",port:0,protocol:"",payloads:"",rtp:[],fmtp:[]},r&&this.setIceParameters(r),n){this._mediaObject.candidates=[];var a,o=f(n);try{for(o.s();!(a=o.n()).done;){var c,d=a.value,l={foundation:d.foundation,component:1,ip:null!==(c=d.address)&&void 0!==c?c:d.ip,port:d.port,priority:d.priority,transport:d.protocol,type:d.type};d.tcpType&&(l.tcptype=d.tcpType),this._mediaObject.candidates.push(l)}}catch(e){o.e(e)}finally{o.f()}this._mediaObject.endOfCandidates="end-of-candidates",this._mediaObject.iceOptions="renomination"}i&&this.setDtlsRole(i.role)},[{key:"mid",get:function(){return String(this._mediaObject.mid)}},{key:"closed",get:function(){return 0===this._mediaObject.port}},{key:"getObject",value:function(){return this._mediaObject}},{key:"setIceParameters",value:function(e){this._mediaObject.iceUfrag=e.usernameFragment,this._mediaObject.icePwd=e.password}},{key:"pause",value:function(){this._mediaObject.direction="inactive"}},{key:"disable",value:function(){this.pause(),delete this._mediaObject.ext,delete this._mediaObject.ssrcs,delete this._mediaObject.ssrcGroups,delete this._mediaObject.simulcast,delete this._mediaObject.simulcast_03,delete this._mediaObject.rids,delete this._mediaObject.extmapAllowMixed}},{key:"close",value:function(){this.disable(),this._mediaObject.port=0}}])}();r.MediaSection=b;var v=function(e){function t(e){var r,n=e.iceParameters,i=e.iceCandidates,a=e.dtlsParameters,o=e.sctpParameters,c=e.plainRtpParameters,u=e.offerMediaObject,l=e.offerRtpParameters,p=e.answerRtpParameters,h=e.codecOptions;switch((0,s.default)(this,t),(r=d(this,t,[{iceParameters:n,iceCandidates:i,dtlsParameters:a}]))._mediaObject.mid=String(u.mid),r._mediaObject.type=u.type,r._mediaObject.protocol=u.protocol,c?(r._mediaObject.connection={ip:c.ip,version:c.ipVersion},r._mediaObject.port=c.port):(r._mediaObject.connection={ip:"127.0.0.1",version:4},r._mediaObject.port=7),u.type){case"audio":case"video":r._mediaObject.direction="recvonly",r._mediaObject.rtp=[],r._mediaObject.rtcpFb=[],r._mediaObject.fmtp=[];var b,v=f(p.codecs);try{var g=function(){var e,t,n=b.value,i={payload:n.payloadType,codec:y(n),rate:n.clockRate};n.channels>1&&(i.encoding=n.channels),r._mediaObject.rtp.push(i);var a=null!==(e=m.clone(n.parameters))&&void 0!==e?e:{},o=null!==(t=m.clone(n.rtcpFeedback))&&void 0!==t?t:[];if(h){var s=h.opusStereo,c=h.opusFec,u=h.opusDtx,d=h.opusMaxPlaybackRate,p=h.opusMaxAverageBitrate,v=h.opusPtime,g=h.opusNack,_=h.videoGoogleStartBitrate,w=h.videoGoogleMaxBitrate,k=h.videoGoogleMinBitrate,S=l.codecs.find(function(e){return e.payloadType===n.payloadType});switch(n.mimeType.toLowerCase()){case"audio/opus":case"audio/multiopus":void 0!==s&&(S.parameters["sprop-stereo"]=s?1:0,a.stereo=s?1:0),void 0!==c&&(S.parameters.useinbandfec=c?1:0,a.useinbandfec=c?1:0),void 0!==u&&(S.parameters.usedtx=u?1:0,a.usedtx=u?1:0),void 0!==d&&(a.maxplaybackrate=d),void 0!==p&&(a.maxaveragebitrate=p),void 0!==v&&(S.parameters.ptime=v,a.ptime=v),g||(S.rtcpFeedback=S.rtcpFeedback.filter(function(e){return"nack"!==e.type||e.parameter}),o=o.filter(function(e){return"nack"!==e.type||e.parameter}));break;case"video/vp8":case"video/vp9":case"video/h264":case"video/h265":case"video/av1":void 0!==_&&(a["x-google-start-bitrate"]=_),void 0!==w&&(a["x-google-max-bitrate"]=w),void 0!==k&&(a["x-google-min-bitrate"]=k)}}for(var x={payload:n.payloadType,config:""},E=0,P=Object.keys(a);E<P.length;E++){var R=P[E];x.config&&(x.config+=";"),x.config+="".concat(R,"=").concat(a[R])}x.config&&r._mediaObject.fmtp.push(x);var M,C=f(o);try{for(C.s();!(M=C.n()).done;){var T=M.value;r._mediaObject.rtcpFb.push({payload:n.payloadType,type:T.type,subtype:T.parameter})}}catch(e){C.e(e)}finally{C.f()}};for(v.s();!(b=v.n()).done;)g()}catch(e){v.e(e)}finally{v.f()}r._mediaObject.payloads=p.codecs.map(function(e){return e.payloadType}).join(" "),r._mediaObject.ext=[];var _,w=f(p.headerExtensions);try{var k=function(){var e,t=_.value;if(!(null!==(e=u.ext)&&void 0!==e?e:[]).some(function(e){return e.uri===t.uri}))return 1;r._mediaObject.ext.push({uri:t.uri,value:t.id})};for(w.s();!(_=w.n()).done;)k()}catch(e){w.e(e)}finally{w.f()}if("extmap-allow-mixed"===u.extmapAllowMixed&&(r._mediaObject.extmapAllowMixed="extmap-allow-mixed"),u.simulcast){var S;r._mediaObject.simulcast={dir1:"recv",list1:u.simulcast.list1},r._mediaObject.rids=[];var x,E=f(null!==(S=u.rids)&&void 0!==S?S:[]);try{for(E.s();!(x=E.n()).done;){var P=x.value;"send"===P.direction&&r._mediaObject.rids.push({id:P.id,direction:"recv"})}}catch(e){E.e(e)}finally{E.f()}}else if(u.simulcast_03){var R;r._mediaObject.simulcast_03={value:u.simulcast_03.value.replace(/send/g,"recv")},r._mediaObject.rids=[];var M,C=f(null!==(R=u.rids)&&void 0!==R?R:[]);try{for(C.s();!(M=C.n()).done;){var T=M.value;"send"===T.direction&&r._mediaObject.rids.push({id:T.id,direction:"recv"})}}catch(e){C.e(e)}finally{C.f()}}r._mediaObject.rtcpMux="rtcp-mux",r._mediaObject.rtcpRsize="rtcp-rsize";break;case"application":"number"==typeof u.sctpPort?(r._mediaObject.payloads="webrtc-datachannel",r._mediaObject.sctpPort=o.port,r._mediaObject.maxMessageSize=o.maxMessageSize):u.sctpmap&&(r._mediaObject.payloads=String(o.port),r._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:o.port,maxMessageSize:o.maxMessageSize})}return r}return(0,o.default)(t,e),(0,c.default)(t,[{key:"setDtlsRole",value:function(e){switch(e){case"client":this._mediaObject.setup="active";break;case"server":this._mediaObject.setup="passive";break;case"auto":this._mediaObject.setup="actpass"}}},{key:"resume",value:function(){this._mediaObject.direction="recvonly"}},{key:"muxSimulcastStreams",value:function(e){var t;if(null!==(t=this._mediaObject.simulcast)&&void 0!==t&&t.list1){var r,n={},i=f(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;a.rid&&(n[a.rid]=a)}}catch(e){i.e(e)}finally{i.f()}var o,s=this._mediaObject.simulcast.list1,c=h.parseSimulcastStreamList(s),u=f(c);try{for(u.s();!(o=u.n()).done;){var d,l=f(o.value);try{for(l.s();!(d=l.n()).done;){var p,m=d.value;m.paused=!(null!==(p=n[m.scid])&&void 0!==p&&p.active)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){u.e(e)}finally{u.f()}this._mediaObject.simulcast.list1=c.map(function(e){return e.map(function(e){return"".concat(e.paused?"~":"").concat(e.scid)}).join(",")}).join(";")}}}])}(b);r.AnswerMediaSection=v;var g=function(e){function t(e){var r,n=e.iceParameters,i=e.iceCandidates,a=e.dtlsParameters,o=e.sctpParameters,c=e.plainRtpParameters,u=e.mid,l=e.kind,p=e.offerRtpParameters,h=e.streamId,m=e.trackId;switch((0,s.default)(this,t),(r=d(this,t,[{iceParameters:n,iceCandidates:i,dtlsParameters:a}]))._mediaObject.mid=String(u),r._mediaObject.type=l,c?(r._mediaObject.connection={ip:c.ip,version:c.ipVersion},r._mediaObject.protocol="RTP/AVP",r._mediaObject.port=c.port):(r._mediaObject.connection={ip:"127.0.0.1",version:4},r._mediaObject.protocol=o?"UDP/DTLS/SCTP":"UDP/TLS/RTP/SAVPF",r._mediaObject.port=7),r._mediaObject.extmapAllowMixed="extmap-allow-mixed",l){case"audio":case"video":var b;r._mediaObject.direction="sendonly",r._mediaObject.rtp=[],r._mediaObject.rtcpFb=[],r._mediaObject.fmtp=[],r._mediaObject.msid="".concat(null!=h?h:"-"," ").concat(m);var v,g=f(p.codecs);try{for(g.s();!(v=g.n()).done;){var _=v.value,w={payload:_.payloadType,codec:y(_),rate:_.clockRate};_.channels>1&&(w.encoding=_.channels),r._mediaObject.rtp.push(w);for(var k={payload:_.payloadType,config:""},S=0,x=Object.keys(null!==(E=_.parameters)&&void 0!==E?E:{});S<x.length;S++){var E,P=x[S];k.config&&(k.config+=";"),k.config+="".concat(P,"=").concat(_.parameters[P])}k.config&&r._mediaObject.fmtp.push(k);var R,M=f(_.rtcpFeedback);try{for(M.s();!(R=M.n()).done;){var C=R.value;r._mediaObject.rtcpFb.push({payload:_.payloadType,type:C.type,subtype:C.parameter})}}catch(e){M.e(e)}finally{M.f()}}}catch(e){g.e(e)}finally{g.f()}r._mediaObject.payloads=p.codecs.map(function(e){return e.payloadType}).join(" "),r._mediaObject.ext=[];var T,A=f(p.headerExtensions);try{for(A.s();!(T=A.n()).done;){var I=T.value;r._mediaObject.ext.push({uri:I.uri,value:I.id})}}catch(e){A.e(e)}finally{A.f()}r._mediaObject.rtcpMux="rtcp-mux",r._mediaObject.rtcpRsize="rtcp-rsize";var O=p.encodings[0],j=O.ssrc,D=null===(b=O.rtx)||void 0===b?void 0:b.ssrc;r._mediaObject.ssrcs=[],r._mediaObject.ssrcGroups=[],j&&p.rtcp.cname&&r._mediaObject.ssrcs.push({id:j,attribute:"cname",value:p.rtcp.cname}),D&&(p.rtcp.cname&&r._mediaObject.ssrcs.push({id:D,attribute:"cname",value:p.rtcp.cname}),j&&r._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:"".concat(j," ").concat(D)}));break;case"application":r._mediaObject.payloads="webrtc-datachannel",r._mediaObject.sctpPort=o.port,r._mediaObject.maxMessageSize=o.maxMessageSize}return r}return(0,o.default)(t,e),(0,c.default)(t,[{key:"setDtlsRole",value:function(e){this._mediaObject.setup="actpass"}},{key:"resume",value:function(){this._mediaObject.direction="sendonly"}}])}(b);function y(e){var t=new RegExp("^(audio|video)/(.+)","i").exec(e.mimeType);if(!t)throw new TypeError("invalid codec.mimeType");return t[2]}r.OfferMediaSection=g},{"../../utils":324,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"sdp-transform":390}],316:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault"),i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass")),o=n(e("@babel/runtime/helpers/defineProperty"));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 c(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)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.RemoteSdp=void 0;var u=e("sdp-transform"),d=e("../../Logger"),l=e("./MediaSection"),f=["av1","h264"],p=new d.Logger("RemoteSdp"),h=function(){return(0,a.default)(function e(t){var r=t.iceParameters,n=t.iceCandidates,a=t.dtlsParameters,s=t.sctpParameters,c=t.plainRtpParameters;if((0,i.default)(this,e),(0,o.default)(this,"_iceParameters",void 0),(0,o.default)(this,"_iceCandidates",void 0),(0,o.default)(this,"_dtlsParameters",void 0),(0,o.default)(this,"_sctpParameters",void 0),(0,o.default)(this,"_plainRtpParameters",void 0),(0,o.default)(this,"_mediaSections",[]),(0,o.default)(this,"_midToIndex",new Map),(0,o.default)(this,"_firstMid",void 0),(0,o.default)(this,"_sdpObject",void 0),this._iceParameters=r,this._iceCandidates=n,this._dtlsParameters=a,this._sctpParameters=s,this._plainRtpParameters=c,this._sdpObject={version:0,origin:{address:"0.0.0.0",ipVer:4,netType:"IN",sessionId:"10000",sessionVersion:0,username:"mediasoup-client"},name:"-",timing:{start:0,stop:0},media:[]},null!=r&&r.iceLite&&(this._sdpObject.icelite="ice-lite"),a){this._sdpObject.msidSemantic={semantic:"WMS",token:"*"};var u=this._dtlsParameters.fingerprints.length;this._sdpObject.fingerprint={type:a.fingerprints[u-1].algorithm,hash:a.fingerprints[u-1].value},this._sdpObject.groups=[{type:"BUNDLE",mids:""}]}c&&(this._sdpObject.origin.address=c.ip,this._sdpObject.origin.ipVer=c.ipVersion)},[{key:"updateIceParameters",value:function(e){p.debug("updateIceParameters() [iceParameters:%o]",e),this._iceParameters=e,this._sdpObject.icelite=e.iceLite?"ice-lite":void 0;var t,r=s(this._mediaSections);try{for(r.s();!(t=r.n()).done;){t.value.setIceParameters(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"updateDtlsRole",value:function(e){p.debug("updateDtlsRole() [role:%s]",e),this._dtlsParameters.role=e;var t,r=s(this._mediaSections);try{for(r.s();!(t=r.n()).done;){t.value.setDtlsRole(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"setSessionExtmapAllowMixed",value:function(){p.debug("setSessionExtmapAllowMixed()"),this._sdpObject.extmapAllowMixed="extmap-allow-mixed"}},{key:"getNextMediaSectionIdx",value:function(){for(var e=0;e<this._mediaSections.length;++e){var t=this._mediaSections[e];if(t.closed)return{idx:e,reuseMid:t.mid}}return{idx:this._mediaSections.length}}},{key:"send",value:function(e){var t,r=e.offerMediaObject,n=e.reuseMid,i=e.offerRtpParameters,a=e.answerRtpParameters,o=e.codecOptions,s=new l.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,offerMediaObject:r,offerRtpParameters:i,answerRtpParameters:a,codecOptions:o}),c=s.getObject();c.rtp.find(function(e){return f.includes(e.codec.toLowerCase())})||(c.ext=null===(t=c.ext)||void 0===t?void 0:t.filter(function(e){return"https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension"!==e.uri}));n?this._replaceMediaSection(s,n):this._midToIndex.has(s.mid)?this._replaceMediaSection(s):this._addMediaSection(s)}},{key:"receive",value:function(e){var t=e.mid,r=e.kind,n=e.offerRtpParameters,i=e.streamId,a=e.trackId;this.setSessionExtmapAllowMixed();var o=new l.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,mid:t,kind:r,offerRtpParameters:n,streamId:i,trackId:a}),s=this._mediaSections.find(function(e){return e.closed});s?this._replaceMediaSection(o,s.mid):this._addMediaSection(o)}},{key:"pauseMediaSection",value:function(e){this._findMediaSection(e).pause()}},{key:"resumeSendingMediaSection",value:function(e){this._findMediaSection(e).resume()}},{key:"resumeReceivingMediaSection",value:function(e){this._findMediaSection(e).resume()}},{key:"disableMediaSection",value:function(e){this._findMediaSection(e).disable()}},{key:"closeMediaSection",value:function(e){var t=this._findMediaSection(e);return e===this._firstMid?(p.debug("closeMediaSection() | cannot close first media section, disabling it instead [mid:%s]",e),this.disableMediaSection(e),!1):(t.close(),this._regenerateBundleMids(),!0)}},{key:"muxMediaSectionSimulcast",value:function(e,t){var r=this._findMediaSection(e);r.muxSimulcastStreams(t),this._replaceMediaSection(r)}},{key:"sendSctpAssociation",value:function(e){var t=e.offerMediaObject,r=new l.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,offerMediaObject:t});this._addMediaSection(r)}},{key:"receiveSctpAssociation",value:function(){var e=new l.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,mid:"datachannel",kind:"application"});this._addMediaSection(e)}},{key:"getSdp",value:function(){return this._sdpObject.origin.sessionVersion++,u.write(this._sdpObject)}},{key:"_addMediaSection",value:function(e){this._firstMid||(this._firstMid=e.mid),this._mediaSections.push(e),this._midToIndex.set(e.mid,this._mediaSections.length-1),this._sdpObject.media.push(e.getObject()),this._regenerateBundleMids()}},{key:"_replaceMediaSection",value:function(e,t){if("string"==typeof t){var r=this._midToIndex.get(t);if(void 0===r)throw new Error("no media section found for reuseMid '".concat(t,"'"));var n=this._mediaSections[r];this._mediaSections[r]=e,this._midToIndex.delete(n.mid),this._midToIndex.set(e.mid,r),this._sdpObject.media[r]=e.getObject(),this._regenerateBundleMids()}else{var i=this._midToIndex.get(e.mid);if(void 0===i)throw new Error("no media section found with mid '".concat(e.mid,"'"));this._mediaSections[i]=e,this._sdpObject.media[i]=e.getObject()}}},{key:"_findMediaSection",value:function(e){var t=this._midToIndex.get(e);if(void 0===t)throw new Error("no media section found with mid '".concat(e,"'"));return this._mediaSections[t]}},{key:"_regenerateBundleMids",value:function(){this._dtlsParameters&&(this._sdpObject.groups[0].mids=this._mediaSections.filter(function(e){return!e.closed}).map(function(e){return e.mid}).join(" "))}}])}();r.RemoteSdp=h},{"../../Logger":302,"./MediaSection":315,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/interopRequireDefault":36,"sdp-transform":390}],317:[function(e,t,r){"use strict";function n(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 i(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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}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 o,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,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw o}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.extractRtpCapabilities=function(e){var t,r=e.sdpObject,i=new Map,o=new Map,s=n(r.media);try{for(s.s();!(t=s.n()).done;){var c,u,d,l=t.value,f=l.type;switch(f){case"audio":case"video":break;default:continue}var p,h=n(l.rtp);try{for(h.s();!(p=h.n()).done;){var m=p.value,b={kind:f,mimeType:"".concat(f,"/").concat(m.codec),preferredPayloadType:m.payload,clockRate:m.rate,channels:m.encoding,parameters:{},rtcpFeedback:[]};i.set(b.preferredPayloadType,b)}}catch(e){h.e(e)}finally{h.f()}var v,g=n(null!==(c=l.fmtp)&&void 0!==c?c:[]);try{for(g.s();!(v=g.n()).done;){var y=v.value,_=a.parseParams(y.config),w=i.get(y.payload);w&&(null!=_&&_.hasOwnProperty("profile-level-id")&&(_["profile-level-id"]=String(_["profile-level-id"])),w.parameters=_)}}catch(e){g.e(e)}finally{g.f()}var k,S=n(null!==(u=l.rtcpFb)&&void 0!==u?u:[]);try{for(S.s();!(k=S.n()).done;){var x=k.value,E={type:x.type,parameter:x.subtype};if(E.parameter||delete E.parameter,"*"!==x.payload){var P=i.get(Number(x.payload));if(!P)continue;P.rtcpFeedback.push(E)}else{var R,M=n(i.values());try{for(M.s();!(R=M.n()).done;){var C=R.value;C.kind!==f||/.+\/rtx$/i.test(C.mimeType)||C.rtcpFeedback.push(E)}}catch(e){M.e(e)}finally{M.f()}}}}catch(e){S.e(e)}finally{S.f()}var T,A=n(null!==(d=l.ext)&&void 0!==d?d:[]);try{for(A.s();!(T=A.n()).done;){var I=T.value;if(!I["encrypt-uri"]){var O={kind:f,uri:I.uri,preferredId:I.value};o.set(O.preferredId,O)}}}catch(e){A.e(e)}finally{A.f()}}}catch(e){s.e(e)}finally{s.f()}return{codecs:Array.from(i.values()),headerExtensions:Array.from(o.values())}},r.extractDtlsParameters=function(e){var t,r=e.sdpObject,n=r.setup,i=r.fingerprint;if(!n||!i){var a,o=(null!==(a=r.media)&&void 0!==a?a:[]).find(function(e){return 0!==e.port});o&&(null!=n||(n=o.setup),null!=i||(i=o.fingerprint))}if(!n)throw new Error("no a=setup found at SDP session or media level");if(!i)throw new Error("no a=fingerprint found at SDP session or media level");switch(n){case"active":t="client";break;case"passive":t="server";break;case"actpass":t="auto"}return{role:t,fingerprints:[{algorithm:i.type,value:i.hash}]}},r.getCname=function(e){var t,r=e.offerMediaObject,n=(null!==(t=r.ssrcs)&&void 0!==t?t:[]).find(function(e){return"cname"===e.attribute});if(!n)return"";return n.value},r.applyCodecParameters=function(e){var t,r=e.offerRtpParameters,i=e.answerMediaObject,o=n(r.codecs);try{var s=function(){var e,r,n=t.value,o=n.mimeType.toLowerCase();if("audio/opus"!==o)return 0;if(!(null!==(e=i.rtp)&&void 0!==e?e:[]).find(function(e){return e.payload===n.payloadType}))return 0;i.fmtp=null!==(r=i.fmtp)&&void 0!==r?r:[];var s=i.fmtp.find(function(e){return e.payload===n.payloadType});s||(s={payload:n.payloadType,config:""},i.fmtp.push(s));var c=a.parseParams(s.config);if("audio/opus"===o){var u,d=null===(u=n.parameters)||void 0===u?void 0:u["sprop-stereo"];void 0!==d&&(c.stereo=Number(d)?1:0)}s.config="";for(var l=0,f=Object.keys(c);l<f.length;l++){var p=f[l];s.config&&(s.config+=";"),s.config+="".concat(p,"=").concat(c[p])}};for(o.s();!(t=o.n()).done;)s()}catch(e){o.e(e)}finally{o.f()}};var a=e("sdp-transform")},{"sdp-transform":390}],318:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault")(e("@babel/runtime/helpers/slicedToArray"));function i(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,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,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.getRtpEncodings=function(e){var t,r,a,o=e.offerMediaObject,s=new Set,c=i(null!==(t=o.ssrcs)&&void 0!==t?t:[]);try{for(c.s();!(a=c.n()).done;){var u=a.value.id;u&&s.add(u)}}catch(e){c.e(e)}finally{c.f()}if(0===s.size)throw new Error("no a=ssrc lines found");var d,l=new Map,f=i(null!==(r=o.ssrcGroups)&&void 0!==r?r:[]);try{for(f.s();!(d=f.n()).done;){var p=d.value;if("FID"===p.semantics){var h=p.ssrcs.split(/\s+/),m=Number(h[0]),b=Number(h[1]);s.has(m)&&(s.delete(m),s.delete(b),l.set(m,b))}}}catch(e){f.e(e)}finally{f.f()}var v,g=i(s);try{for(g.s();!(v=g.n()).done;){var y=v.value;l.set(y,void 0)}}catch(e){g.e(e)}finally{g.f()}var _,w=[],k=i(l);try{for(k.s();!(_=k.n()).done;){var S=(0,n.default)(_.value,2),x=S[0],E=S[1],P={ssrc:x};E&&(P.rtx={ssrc:E}),w.push(P)}}catch(e){k.e(e)}finally{k.f()}return w},r.addLegacySimulcast=function(e){var t,r,i,a=e.offerMediaObject,o=e.numStreams;if(o<=1)throw new TypeError("numStreams must be greater than 1");var s=(null!==(t=a.ssrcs)&&void 0!==t?t:[]).find(function(e){return"msid"===e.attribute});if(!s)throw new Error("a=ssrc line with msid information not found");var c,u=s.value.split(" "),d=(0,n.default)(u,2),l=d[0],f=d[1],p=Number(s.id);(null!==(r=a.ssrcGroups)&&void 0!==r?r:[]).some(function(e){if("FID"!==e.semantics)return!1;var t=e.ssrcs.split(/\s+/);return Number(t[0])===p&&(c=Number(t[1]),!0)});var h=(null!==(i=a.ssrcs)&&void 0!==i?i:[]).find(function(e){return"cname"===e.attribute});if(!h)throw new Error("a=ssrc line with cname information not found");for(var m=h.value,b=[],v=[],g=0;g<o;++g)b.push(p+g),c&&v.push(c+g);a.ssrcGroups=[],a.ssrcs=[],a.ssrcGroups.push({semantics:"SIM",ssrcs:b.join(" ")});for(var y=0,_=b;y<_.length;y++){var w=_[y];a.ssrcs.push({id:w,attribute:"cname",value:m}),a.ssrcs.push({id:w,attribute:"msid",value:"".concat(l," ").concat(f)})}for(var k=0;k<v.length;++k){var S=b[k],x=v[k];a.ssrcs.push({id:x,attribute:"cname",value:m}),a.ssrcs.push({id:x,attribute:"msid",value:"".concat(l," ").concat(f)}),a.ssrcGroups.push({semantics:"FID",ssrcs:"".concat(S," ").concat(x)})}}},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":55}],319:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.debug=r.testFakeParameters=r.FakeHandler=r.enhancedEvents=r.ortc=r.parseScalabilityMode=r.detectDeviceAsync=r.detectDevice=r.Device=r.version=r.types=void 0;var n=e("debug");r.debug=n.default,r.types=e("./types"),r.version="3.15.6";var i=e("./Device");Object.defineProperty(r,"Device",{enumerable:!0,get:function(){return i.Device}}),Object.defineProperty(r,"detectDevice",{enumerable:!0,get:function(){return i.detectDevice}}),Object.defineProperty(r,"detectDeviceAsync",{enumerable:!0,get:function(){return i.detectDeviceAsync}});var a=e("./scalabilityModes");Object.defineProperty(r,"parseScalabilityMode",{enumerable:!0,get:function(){return a.parse}}),r.ortc=e("./ortc"),r.enhancedEvents=e("./enhancedEvents");var o=e("./handlers/FakeHandler");Object.defineProperty(r,"FakeHandler",{enumerable:!0,get:function(){return o.FakeHandler}}),r.testFakeParameters=e("./test/fakeParameters")},{"./Device":301,"./enhancedEvents":305,"./handlers/FakeHandler":309,"./ortc":320,"./scalabilityModes":321,"./test/fakeParameters":322,"./types":323,debug:325}],320:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault")(e("@babel/runtime/helpers/typeof"));function i(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,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,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.validateAndNormalizeRtpCapabilities=function(e){if("object"!==(0,n.default)(e))throw new TypeError("caps is not an object");if(e.codecs&&!Array.isArray(e.codecs))throw new TypeError("caps.codecs is not an array");e.codecs||(e.codecs=[]);var t,r=i(e.codecs);try{for(r.s();!(t=r.n()).done;){f(t.value)}}catch(e){r.e(e)}finally{r.f()}if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("caps.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);var a,o=i(e.headerExtensions);try{for(o.s();!(a=o.n()).done;){h(a.value)}}catch(e){o.e(e)}finally{o.f()}},r.validateAndNormalizeRtpParameters=l,r.validateAndNormalizeSctpStreamParameters=function(e){if("object"!==(0,n.default)(e))throw new TypeError("params is not an object");if("number"!=typeof e.streamId)throw new TypeError("missing params.streamId");var t=!1;"boolean"==typeof e.ordered?t=!0:e.ordered=!0;if(e.maxPacketLifeTime&&"number"!=typeof e.maxPacketLifeTime)throw new TypeError("invalid params.maxPacketLifeTime");if(e.maxRetransmits&&"number"!=typeof e.maxRetransmits)throw new TypeError("invalid params.maxRetransmits");if(e.maxPacketLifeTime&&e.maxRetransmits)throw new TypeError("cannot provide both maxPacketLifeTime and maxRetransmits");if(t&&e.ordered&&(e.maxPacketLifeTime||e.maxRetransmits))throw new TypeError("cannot be ordered with maxPacketLifeTime or maxRetransmits");t||!e.maxPacketLifeTime&&!e.maxRetransmits||(e.ordered=!1);if(e.label&&"string"!=typeof e.label)throw new TypeError("invalid params.label");if(e.protocol&&"string"!=typeof e.protocol)throw new TypeError("invalid params.protocol")},r.validateSctpCapabilities=function(e){if("object"!==(0,n.default)(e))throw new TypeError("caps is not an object");if(!e.numStreams||"object"!==(0,n.default)(e.numStreams))throw new TypeError("missing caps.numStreams");!function(e){if("object"!==(0,n.default)(e))throw new TypeError("numStreams is not an object");if("number"!=typeof e.OS)throw new TypeError("missing numStreams.OS");if("number"!=typeof e.MIS)throw new TypeError("missing numStreams.MIS")}(e.numStreams)},r.getExtendedRtpCapabilities=function(e,t,r){var n={codecs:[],headerExtensions:[]};if(r){var a,o,s=i(null!==(a=e.codecs)&&void 0!==a?a:[]);try{var c=function(){var e,r,i,a=o.value;if(g(a))return 0;var s=(null!==(e=t.codecs)&&void 0!==e?e:[]).find(function(e){return y(e,a,{strict:!0,modify:!0})});if(!s)return 0;var c={kind:a.kind,mimeType:a.mimeType,clockRate:a.clockRate,channels:a.channels,localPayloadType:a.preferredPayloadType,localRtxPayloadType:void 0,remotePayloadType:s.preferredPayloadType,remoteRtxPayloadType:void 0,localParameters:null!==(r=a.parameters)&&void 0!==r?r:{},remoteParameters:null!==(i=s.parameters)&&void 0!==i?i:{},rtcpFeedback:_(a,s)};n.codecs.push(c)};for(s.s();!(o=s.n()).done;)c()}catch(e){s.e(e)}finally{s.f()}}else{var u,d,l=i(null!==(u=t.codecs)&&void 0!==u?u:[]);try{var f=function(){var t,r,i,a=d.value;if(g(a))return 0;var o=(null!==(t=e.codecs)&&void 0!==t?t:[]).find(function(e){return y(e,a,{strict:!0,modify:!0})});if(!o)return 0;var s={kind:o.kind,mimeType:o.mimeType,clockRate:o.clockRate,channels:o.channels,localPayloadType:o.preferredPayloadType,localRtxPayloadType:void 0,remotePayloadType:a.preferredPayloadType,remoteRtxPayloadType:void 0,localParameters:null!==(r=o.parameters)&&void 0!==r?r:{},remoteParameters:null!==(i=a.parameters)&&void 0!==i?i:{},rtcpFeedback:_(o,a)};n.codecs.push(s)};for(l.s();!(d=l.n()).done;)f()}catch(e){l.e(e)}finally{l.f()}}var p,h=i(n.codecs);try{var m=function(){var r=p.value,n=e.codecs.find(function(e){var t;return g(e)&&(null===(t=e.parameters)||void 0===t?void 0:t.apt)===r.localPayloadType}),i=t.codecs.find(function(e){var t;return g(e)&&(null===(t=e.parameters)||void 0===t?void 0:t.apt)===r.remotePayloadType});n&&i&&(r.localRtxPayloadType=n.preferredPayloadType,r.remoteRtxPayloadType=i.preferredPayloadType)};for(h.s();!(p=h.n()).done;)m()}catch(e){h.e(e)}finally{h.f()}var b,v=i(t.headerExtensions);try{var w=function(){var t,r=b.value,i=e.headerExtensions.find(function(e){return function(e,t){if(e.kind&&t.kind&&e.kind!==t.kind)return!1;if(e.uri!==t.uri)return!1;return!0}(e,r)});if(!i)return 1;var a={kind:r.kind,uri:r.uri,sendId:i.preferredId,recvId:r.preferredId,encrypt:null!==(t=i.preferredEncrypt)&&void 0!==t&&t,direction:"sendrecv"};switch(r.direction){case"sendrecv":a.direction="sendrecv";break;case"recvonly":a.direction="sendonly";break;case"sendonly":a.direction="recvonly";break;case"inactive":a.direction="inactive"}n.headerExtensions.push(a)};for(v.s();!(b=v.n()).done;)w()}catch(e){v.e(e)}finally{v.f()}return n},r.getRecvRtpCapabilities=function(e){var t,r={codecs:[],headerExtensions:[]},n=i(e.codecs);try{for(n.s();!(t=n.n()).done;){var a=t.value,o={kind:a.kind,mimeType:a.mimeType,preferredPayloadType:a.remotePayloadType,clockRate:a.clockRate,channels:a.channels,parameters:a.localParameters,rtcpFeedback:a.rtcpFeedback};if(r.codecs.push(o),a.remoteRtxPayloadType){var s={kind:a.kind,mimeType:"".concat(a.kind,"/rtx"),preferredPayloadType:a.remoteRtxPayloadType,clockRate:a.clockRate,parameters:{apt:a.remotePayloadType},rtcpFeedback:[]};r.codecs.push(s)}}}catch(e){n.e(e)}finally{n.f()}var c,u=i(e.headerExtensions);try{for(u.s();!(c=u.n()).done;){var d,l=c.value;if("sendrecv"===l.direction||"recvonly"===l.direction){var f={kind:l.kind,uri:l.uri,preferredId:l.recvId,preferredEncrypt:null!==(d=l.encrypt)&&void 0!==d&&d,direction:l.direction};r.headerExtensions.push(f)}}}catch(e){u.e(e)}finally{u.f()}return r},r.getSendingRtpParameters=function(e,t){var r,n={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}},a=i(t.codecs);try{for(a.s();!(r=a.n()).done;){var o=r.value;if(o.kind===e){var s={mimeType:o.mimeType,payloadType:o.localPayloadType,clockRate:o.clockRate,channels:o.channels,parameters:o.localParameters,rtcpFeedback:o.rtcpFeedback};if(n.codecs.push(s),o.localRtxPayloadType){var c={mimeType:"".concat(o.kind,"/rtx"),payloadType:o.localRtxPayloadType,clockRate:o.clockRate,parameters:{apt:o.localPayloadType},rtcpFeedback:[]};n.codecs.push(c)}}}}catch(e){a.e(e)}finally{a.f()}var u,d=i(t.headerExtensions);try{for(d.s();!(u=d.n()).done;){var l=u.value;if(!(l.kind&&l.kind!==e||"sendrecv"!==l.direction&&"sendonly"!==l.direction)){var f={uri:l.uri,id:l.sendId,encrypt:l.encrypt,parameters:{}};n.headerExtensions.push(f)}}}catch(e){d.e(e)}finally{d.f()}return n},r.getSendingRemoteRtpParameters=function(e,t){var r,n={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}},a=i(t.codecs);try{for(a.s();!(r=a.n()).done;){var o=r.value;if(o.kind===e){var s={mimeType:o.mimeType,payloadType:o.localPayloadType,clockRate:o.clockRate,channels:o.channels,parameters:o.remoteParameters,rtcpFeedback:o.rtcpFeedback};if(n.codecs.push(s),o.localRtxPayloadType){var c={mimeType:"".concat(o.kind,"/rtx"),payloadType:o.localRtxPayloadType,clockRate:o.clockRate,parameters:{apt:o.localPayloadType},rtcpFeedback:[]};n.codecs.push(c)}}}}catch(e){a.e(e)}finally{a.f()}var u,d=i(t.headerExtensions);try{for(d.s();!(u=d.n()).done;){var l=u.value;if(!(l.kind&&l.kind!==e||"sendrecv"!==l.direction&&"sendonly"!==l.direction)){var f={uri:l.uri,id:l.sendId,encrypt:l.encrypt,parameters:{}};n.headerExtensions.push(f)}}}catch(e){d.e(e)}finally{d.f()}if(n.headerExtensions.some(function(e){return"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.uri})){var p,h=i(n.codecs);try{for(h.s();!(p=h.n()).done;){var m,b=p.value;b.rtcpFeedback=(null!==(m=b.rtcpFeedback)&&void 0!==m?m:[]).filter(function(e){return"goog-remb"!==e.type})}}catch(e){h.e(e)}finally{h.f()}}else if(n.headerExtensions.some(function(e){return"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.uri})){var v,g=i(n.codecs);try{for(g.s();!(v=g.n()).done;){var y,_=v.value;_.rtcpFeedback=(null!==(y=_.rtcpFeedback)&&void 0!==y?y:[]).filter(function(e){return"transport-cc"!==e.type})}}catch(e){g.e(e)}finally{g.f()}}else{var w,k=i(n.codecs);try{for(k.s();!(w=k.n()).done;){var S,x=w.value;x.rtcpFeedback=(null!==(S=x.rtcpFeedback)&&void 0!==S?S:[]).filter(function(e){return"transport-cc"!==e.type&&"goog-remb"!==e.type})}}catch(e){k.e(e)}finally{k.f()}}return n},r.reduceCodecs=function(e,t){var r=[];if(t){for(var n=0;n<e.length;++n)if(y(e[n],t,{strict:!0})){r.push(e[n]),g(e[n+1])&&r.push(e[n+1]);break}if(0===r.length)throw new TypeError("no matching codec found")}else r.push(e[0]),g(e[1])&&r.push(e[1]);return r},r.generateProbatorRtpParameters=function(e){l(e=s.clone(e));var t={mid:c,codecs:[],headerExtensions:[],encodings:[{ssrc:u}],rtcp:{cname:"probator"}};return t.codecs.push(e.codecs[0]),t.codecs[0].payloadType=d,t.headerExtensions=e.headerExtensions,t},r.canSend=function(e,t){var r;return(null!==(r=t.codecs)&&void 0!==r?r:[]).some(function(t){return t.kind===e})},r.canReceive=function(e,t){var r;if(l(e),0===e.codecs.length)return!1;var n=e.codecs[0];return(null!==(r=t.codecs)&&void 0!==r?r:[]).some(function(e){return e.preferredPayloadType===n.payloadType})};var o=e("h264-profile-level-id"),s=e("./utils"),c="probator",u=1234,d=127;function l(e){if("object"!==(0,n.default)(e))throw new TypeError("params is not an object");if(e.mid&&"string"!=typeof e.mid)throw new TypeError("params.mid is not a string");if(!Array.isArray(e.codecs))throw new TypeError("missing params.codecs");var t,r=i(e.codecs);try{for(r.s();!(t=r.n()).done;){m(t.value)}}catch(e){r.e(e)}finally{r.f()}if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("params.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);var a,o=i(e.headerExtensions);try{for(o.s();!(a=o.n()).done;){b(a.value)}}catch(e){o.e(e)}finally{o.f()}if(e.encodings&&!Array.isArray(e.encodings))throw new TypeError("params.encodings is not an array");e.encodings||(e.encodings=[]);var s,c=i(e.encodings);try{for(c.s();!(s=c.n()).done;){v(s.value)}}catch(e){c.e(e)}finally{c.f()}if(e.rtcp&&"object"!==(0,n.default)(e.rtcp))throw new TypeError("params.rtcp is not an object");e.rtcp||(e.rtcp={}),function(e){if("object"!==(0,n.default)(e))throw new TypeError("rtcp is not an object");if(e.cname&&"string"!=typeof e.cname)throw new TypeError("invalid rtcp.cname");e.reducedSize&&"boolean"==typeof e.reducedSize||(e.reducedSize=!0)}(e.rtcp)}function f(e){var t=new RegExp("^(audio|video)/(.+)","i");if("object"!==(0,n.default)(e))throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");var r=t.exec(e.mimeType);if(!r)throw new TypeError("invalid codec.mimeType");if(e.kind=r[1].toLowerCase(),"number"!=typeof e.preferredPayloadType)throw new TypeError("missing codec.preferredPayloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===e.kind?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"===(0,n.default)(e.parameters)||(e.parameters={});for(var a=0,o=Object.keys(e.parameters);a<o.length;a++){var s=o[a],c=e.parameters[s];if(void 0===c&&(e.parameters[s]="",c=""),"string"!=typeof c&&"number"!=typeof c)throw new TypeError("invalid codec parameter [key:".concat(s,"s, value:").concat(c,"]"));if("apt"===s&&"number"!=typeof c)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);var u,d=i(e.rtcpFeedback);try{for(d.s();!(u=d.n()).done;){p(u.value)}}catch(e){d.e(e)}finally{d.f()}}function p(e){if("object"!==(0,n.default)(e))throw new TypeError("fb is not an object");if(!e.type||"string"!=typeof e.type)throw new TypeError("missing fb.type");e.parameter&&"string"==typeof e.parameter||(e.parameter="")}function h(e){if("object"!==(0,n.default)(e))throw new TypeError("ext is not an object");if("audio"!==e.kind&&"video"!==e.kind)throw new TypeError("invalid ext.kind");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.preferredId)throw new TypeError("missing ext.preferredId");if(e.preferredEncrypt&&"boolean"!=typeof e.preferredEncrypt)throw new TypeError("invalid ext.preferredEncrypt");if(e.preferredEncrypt||(e.preferredEncrypt=!1),e.direction&&"string"!=typeof e.direction)throw new TypeError("invalid ext.direction");e.direction||(e.direction="sendrecv")}function m(e){var t=new RegExp("^(audio|video)/(.+)","i");if("object"!==(0,n.default)(e))throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");var r=t.exec(e.mimeType);if(!r)throw new TypeError("invalid codec.mimeType");if("number"!=typeof e.payloadType)throw new TypeError("missing codec.payloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===r[1].toLowerCase()?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"===(0,n.default)(e.parameters)||(e.parameters={});for(var a=0,o=Object.keys(e.parameters);a<o.length;a++){var s=o[a],c=e.parameters[s];if(void 0===c&&(e.parameters[s]="",c=""),"string"!=typeof c&&"number"!=typeof c)throw new TypeError("invalid codec parameter [key:".concat(s,"s, value:").concat(c,"]"));if("apt"===s&&"number"!=typeof c)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);var u,d=i(e.rtcpFeedback);try{for(d.s();!(u=d.n()).done;){p(u.value)}}catch(e){d.e(e)}finally{d.f()}}function b(e){if("object"!==(0,n.default)(e))throw new TypeError("ext is not an object");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.id)throw new TypeError("missing ext.id");if(e.encrypt&&"boolean"!=typeof e.encrypt)throw new TypeError("invalid ext.encrypt");e.encrypt||(e.encrypt=!1),e.parameters&&"object"===(0,n.default)(e.parameters)||(e.parameters={});for(var t=0,r=Object.keys(e.parameters);t<r.length;t++){var i=r[t],a=e.parameters[i];if(void 0===a&&(e.parameters[i]="",a=""),"string"!=typeof a&&"number"!=typeof a)throw new TypeError("invalid header extension parameter")}}function v(e){if("object"!==(0,n.default)(e))throw new TypeError("encoding is not an object");if(e.ssrc&&"number"!=typeof e.ssrc)throw new TypeError("invalid encoding.ssrc");if(e.rid&&"string"!=typeof e.rid)throw new TypeError("invalid encoding.rid");if(e.rtx&&"object"!==(0,n.default)(e.rtx))throw new TypeError("invalid encoding.rtx");if(e.rtx&&"number"!=typeof e.rtx.ssrc)throw new TypeError("missing encoding.rtx.ssrc");if(e.dtx&&"boolean"==typeof e.dtx||(e.dtx=!1),e.scalabilityMode&&"string"!=typeof e.scalabilityMode)throw new TypeError("invalid encoding.scalabilityMode")}function g(e){return!!e&&/.+\/rtx$/i.test(e.mimeType)}function y(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.strict,i=void 0!==n&&n,a=r.modify,s=void 0!==a&&a,c=e.mimeType.toLowerCase();if(c!==t.mimeType.toLowerCase())return!1;if(e.clockRate!==t.clockRate)return!1;if(e.channels!==t.channels)return!1;switch(c){case"video/h264":if(i){var u,d,l;if((null!==(u=e.parameters["packetization-mode"])&&void 0!==u?u:0)!==(null!==(d=t.parameters["packetization-mode"])&&void 0!==d?d:0))return!1;if(!o.isSameProfile(e.parameters,t.parameters))return!1;try{l=o.generateProfileLevelIdStringForAnswer(e.parameters,t.parameters)}catch(e){return!1}s&&(l?(e.parameters["profile-level-id"]=l,t.parameters["profile-level-id"]=l):(delete e.parameters["profile-level-id"],delete t.parameters["profile-level-id"]))}break;case"video/vp9":var f,p;if(i)if((null!==(f=e.parameters["profile-id"])&&void 0!==f?f:0)!==(null!==(p=t.parameters["profile-id"])&&void 0!==p?p:0))return!1}return!0}function _(e,t){var r,n,a=[],o=i(null!==(r=e.rtcpFeedback)&&void 0!==r?r:[]);try{var s=function(){var e,r=n.value,i=(null!==(e=t.rtcpFeedback)&&void 0!==e?e:[]).find(function(e){return e.type===r.type&&(e.parameter===r.parameter||!e.parameter&&!r.parameter)});i&&a.push(i)};for(o.s();!(n=o.n()).done;)s()}catch(e){o.e(e)}finally{o.f()}return a}},{"./utils":324,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":60,"h264-profile-level-id":221}],321:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.parse=function(e){var t=n.exec(null!=e?e:"");return t?{spatialLayers:Number(t[1]),temporalLayers:Number(t[2])}:{spatialLayers:1,temporalLayers:1}};var n=new RegExp("^[LS]([1-9]\\d{0,1})T([1-9]\\d{0,1})")},{}],322:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.generateRouterRtpCapabilities=function(){return n.deepFreeze({codecs:[{mimeType:"audio/opus",kind:"audio",preferredPayloadType:100,clockRate:48e3,channels:2,rtcpFeedback:[{type:"transport-cc"}],parameters:{useinbandfec:1,foo:"bar"}},{mimeType:"video/VP8",kind:"video",preferredPayloadType:101,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"x-google-start-bitrate":1500}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:102,clockRate:9e4,rtcpFeedback:[],parameters:{apt:101}},{mimeType:"video/H264",kind:"video",preferredPayloadType:103,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"level-asymmetry-allowed":1,"packetization-mode":1,"profile-level-id":"42e01f"}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:104,clockRate:9e4,rtcpFeedback:[],parameters:{apt:103}},{mimeType:"video/VP9",kind:"video",preferredPayloadType:105,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"profile-id":0,"x-google-start-bitrate":1500}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:106,clockRate:9e4,rtcpFeedback:[],parameters:{apt:105}}],headerExtensions:[{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id",preferredId:2,preferredEncrypt:!1,direction:"recvonly"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id",preferredId:3,preferredEncrypt:!1,direction:"recvonly"},{kind:"audio",uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",preferredId:4,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",preferredId:4,preferredEncrypt:!1,direction:"sendrecv"},{kind:"audio",uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",preferredId:5,preferredEncrypt:!1,direction:"recvonly"},{kind:"video",uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",preferredId:5,preferredEncrypt:!1,direction:"sendrecv"},{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:ssrc-audio-level",preferredId:10,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:3gpp:video-orientation",preferredId:11,preferredEncrypt:!1,direction:"sendrecv"},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:toffset",preferredId:12,preferredEncrypt:!1,direction:"sendrecv"}]})},r.generateNativeRtpCapabilities=function(){return{codecs:[{mimeType:"audio/opus",kind:"audio",preferredPayloadType:111,clockRate:48e3,channels:2,rtcpFeedback:[{type:"transport-cc"}],parameters:{minptime:10,useinbandfec:1}},{mimeType:"audio/ISAC",kind:"audio",preferredPayloadType:103,clockRate:16e3,channels:1,rtcpFeedback:[{type:"transport-cc"}],parameters:{}},{mimeType:"audio/CN",kind:"audio",preferredPayloadType:106,clockRate:32e3,channels:1,rtcpFeedback:[{type:"transport-cc"}],parameters:{}},{mimeType:"audio/foo",kind:"audio",preferredPayloadType:107,clockRate:9e4,channels:4,rtcpFeedback:[{type:"foo-qwe-qwe"}],parameters:{foo:"lalala"}},{mimeType:"video/BAZCODEC",kind:"video",preferredPayloadType:100,clockRate:9e4,rtcpFeedback:[{type:"foo"},{type:"transport-cc"},{type:"ccm",parameter:"fir"},{type:"nack"},{type:"nack",parameter:"pli"}],parameters:{baz:"1234abcd"}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:101,clockRate:9e4,rtcpFeedback:[],parameters:{apt:100}},{mimeType:"video/VP8",kind:"video",preferredPayloadType:96,clockRate:9e4,rtcpFeedback:[{type:"goog-remb"},{type:"transport-cc"},{type:"ccm",parameter:"fir"},{type:"nack"},{type:"nack",parameter:"pli"}],parameters:{baz:"1234abcd"}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:97,clockRate:9e4,rtcpFeedback:[],parameters:{apt:96}},{mimeType:"video/VP9",kind:"video",preferredPayloadType:98,clockRate:9e4,rtcpFeedback:[{type:"goog-remb"},{type:"transport-cc"},{type:"ccm",parameter:"fir"},{type:"nack"},{type:"nack",parameter:"pli"}],parameters:{"profile-id":0}},{mimeType:"video/rtx",kind:"video",preferredPayloadType:99,clockRate:9e4,rtcpFeedback:[],parameters:{apt:98}}],headerExtensions:[{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:sdes:mid",preferredId:1},{kind:"video",uri:"urn:ietf:params:rtp-hdrext:toffset",preferredId:2},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",preferredId:3},{kind:"video",uri:"urn:3gpp:video-orientation",preferredId:4},{kind:"video",uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",preferredId:5},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay",preferredId:6},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/video-content-type",preferredId:7},{kind:"video",uri:"http://www.webrtc.org/experiments/rtp-hdrext/video-timing",preferredId:8},{kind:"audio",uri:"urn:ietf:params:rtp-hdrext:ssrc-audio-level",preferredId:10}]}},r.generateNativeSctpCapabilities=function(){return n.deepFreeze({numStreams:{OS:2048,MIS:2048}})},r.generateLocalDtlsParameters=function(){return n.deepFreeze({fingerprints:[{algorithm:"sha-256",value:"82:5A:68:3D:36:C3:0A:DE:AF:E7:32:43:D2:88:83:57:AC:2D:65:E5:80:C4:B6:FB:AF:1A:A0:21:9F:6D:0C:AD"}],role:"auto"})},r.generateTransportRemoteParameters=function(){return{id:i(),iceParameters:n.deepFreeze({iceLite:!0,password:"yku5ej8nvfaor28lvtrabcx0wkrpkztz",usernameFragment:"h3hk1iz6qqlnqlne"}),iceCandidates:n.deepFreeze([{foundation:"udpcandidate",address:"9.9.9.9",ip:"9.9.9.9",port:40533,priority:1078862079,protocol:"udp",type:"host",tcpType:"passive"},{foundation:"udpcandidate",address:"9.9.9.9",ip:"9:9:9:9:9:9",port:41333,priority:1078862089,protocol:"udp",type:"host",tcpType:"passive"}]),dtlsParameters:n.deepFreeze({fingerprints:[{algorithm:"sha-256",value:"A9:F4:E0:D2:74:D3:0F:D9:CA:A5:2F:9F:7F:47:FA:F0:C4:72:DD:73:49:D0:3B:14:90:20:51:30:1B:90:8E:71"},{algorithm:"sha-384",value:"03:D9:0B:87:13:98:F6:6D:BC:FC:92:2E:39:D4:E1:97:32:61:30:56:84:70:81:6E:D1:82:97:EA:D9:C1:21:0F:6B:C5:E7:7F:E1:97:0C:17:97:6E:CF:B3:EF:2E:74:B0"},{algorithm:"sha-512",value:"84:27:A4:28:A4:73:AF:43:02:2A:44:68:FF:2F:29:5C:3B:11:9A:60:F4:A8:F0:F5:AC:A0:E3:49:3E:B1:34:53:A9:85:CE:51:9B:ED:87:5E:B8:F4:8E:3D:FA:20:51:B8:96:EE:DA:56:DC:2F:5C:62:79:15:23:E0:21:82:2B:2C"}],role:"auto"}),sctpParameters:n.deepFreeze({port:5e3,OS:2048,MIS:2048,maxMessageSize:2e6})}},r.generateProducerRemoteParameters=function(){return n.deepFreeze({id:i()})},r.generateConsumerRemoteParameters=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.id,r=e.codecMimeType;switch(r){case"audio/opus":return{id:null!=t?t:i(),producerId:i(),kind:"audio",rtpParameters:n.deepFreeze({codecs:[{mimeType:"audio/opus",payloadType:100,clockRate:48e3,channels:2,rtcpFeedback:[{type:"transport-cc"}],parameters:{useinbandfec:1,foo:"bar"}}],encodings:[{ssrc:46687003}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5},{uri:"urn:ietf:params:rtp-hdrext:ssrc-audio-level",id:10}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};case"audio/ISAC":return{id:null!=t?t:i(),producerId:i(),kind:"audio",rtpParameters:n.deepFreeze({codecs:[{mimeType:"audio/ISAC",payloadType:111,clockRate:16e3,channels:1,rtcpFeedback:[{type:"transport-cc"}],parameters:{}}],encodings:[{ssrc:46687004}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};case"video/VP8":return{id:null!=t?t:i(),producerId:i(),kind:"video",rtpParameters:n.deepFreeze({codecs:[{mimeType:"video/VP8",payloadType:101,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"x-google-start-bitrate":1500}},{mimeType:"video/rtx",payloadType:102,clockRate:9e4,rtcpFeedback:[],parameters:{apt:101}}],encodings:[{ssrc:99991111,rtx:{ssrc:99991112}}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",id:4},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5},{uri:"urn:3gpp:video-orientation",id:11},{uri:"urn:ietf:params:rtp-hdrext:toffset",id:12}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};case"video/H264":return{id:null!=t?t:i(),producerId:i(),kind:"video",rtpParameters:n.deepFreeze({codecs:[{mimeType:"video/H264",payloadType:103,clockRate:9e4,rtcpFeedback:[{type:"nack"},{type:"nack",parameter:"pli"},{type:"ccm",parameter:"fir"},{type:"goog-remb"},{type:"transport-cc"}],parameters:{"level-asymmetry-allowed":1,"packetization-mode":1,"profile-level-id":"42e01f"}},{mimeType:"video/rtx",payloadType:104,clockRate:9e4,rtcpFeedback:[],parameters:{apt:103}}],encodings:[{ssrc:99991113,rtx:{ssrc:99991114}}],headerExtensions:[{uri:"urn:ietf:params:rtp-hdrext:sdes:mid",id:1},{uri:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",id:4},{uri:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",id:5},{uri:"urn:3gpp:video-orientation",id:11},{uri:"urn:ietf:params:rtp-hdrext:toffset",id:12}],rtcp:{cname:"wB4Ql4lrsxYLjzuN",reducedSize:!0,mux:!0}})};default:throw new TypeError("unknown codecMimeType '".concat(r,"'"))}},r.generateDataProducerRemoteParameters=function(){return n.deepFreeze({id:i()})},r.generateDataConsumerRemoteParameters=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.id;return{id:null!=t?t:i(),dataProducerId:i(),sctpStreamParameters:n.deepFreeze({streamId:666,maxPacketLifeTime:5e3,maxRetransmits:void 0})}};var n=e("../utils");function i(){return String(n.generateRandomNumber())}},{"../utils":324}],323:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},{}],324:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault")(e("@babel/runtime/helpers/typeof"));function i(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 n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,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,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(c)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.clone=function(e){return void 0===e?void 0:Number.isNaN(e)?NaN:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))},r.generateRandomNumber=function(){return Math.round(1e7*Math.random())},r.deepFreeze=function e(t){var r,a=i(Reflect.ownKeys(t));try{for(a.s();!(r=a.n()).done;){var o=t[r.value];(o&&"object"===(0,n.default)(o)||"function"==typeof o)&&e(o)}}catch(e){a.e(e)}finally{a.f()}return Object.freeze(t)}},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":60}],325:[function(e,t,r){arguments[4][84][0].apply(r,arguments)},{"./common":326,dup:84}],326:[function(e,t,r){arguments[4][85][0].apply(r,arguments)},{dup:85,ms:330}],327:[function(e,t,r){var n=e("bn.js"),i=e("brorand");function a(e){this.rand=e||new i.Rand}t.exports=a,a.create=function(e){return new a(e)},a.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do{var i=new n(this.rand.generate(r))}while(i.cmp(e)>=0);return i},a.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},a.prototype.test=function(e,t,r){var i=e.bitLength(),a=n.mont(e),o=new n(1).toRed(a);t||(t=Math.max(1,i/48|0));for(var s=e.subn(1),c=0;!s.testn(c);c++);for(var u=e.shrn(c),d=s.toRed(a);t>0;t--){var l=this._randrange(new n(2),s);r&&r(l);var f=l.toRed(a).redPow(u);if(0!==f.cmp(o)&&0!==f.cmp(d)){for(var p=1;p<c;p++){if(0===(f=f.redSqr()).cmp(o))return!1;if(0===f.cmp(d))break}if(p===c)return!1}}return!0},a.prototype.getDivisor=function(e,t){var r=e.bitLength(),i=n.mont(e),a=new n(1).toRed(i);t||(t=Math.max(1,r/48|0));for(var o=e.subn(1),s=0;!o.testn(s);s++);for(var c=e.shrn(s),u=o.toRed(i);t>0;t--){var d=this._randrange(new n(2),o),l=e.gcd(d);if(0!==l.cmpn(1))return l;var f=d.toRed(i).redPow(c);if(0!==f.cmp(a)&&0!==f.cmp(u)){for(var p=1;p<s;p++){if(0===(f=f.redSqr()).cmp(a))return f.fromRed().subn(1).gcd(e);if(0===f.cmp(u))break}if(p===s)return(f=f.redSqr()).fromRed().subn(1).gcd(e)}}return!1}},{"bn.js":88,brorand:90}],328:[function(e,t,r){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=n,n.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},{}],329:[function(e,t,r){"use strict";var n=r;function i(e){return 1===e.length?"0"+e:e}function a(e){for(var t="",r=0;r<e.length;r++)t+=i(e[r].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),a=i>>8,o=255&i;a?r.push(a,o):r.push(o)}return r},n.zero2=i,n.toHex=a,n.encode=function(e,t){return"hex"===t?a(e):e}},{}],330:[function(e,t,r){var n=1e3,i=60*n,a=60*i,o=24*a,s=7*o,c=365.25*o;function u(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"weeks":case"week":case"w":return r*s;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=o)return u(e,t,o,"day");if(t>=a)return u(e,t,a,"hour");if(t>=i)return u(e,t,i,"minute");if(t>=n)return u(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=o)return Math.round(e/o)+"d";if(t>=a)return Math.round(e/a)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],331:[function(e,t,r){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],332:[function(e,t,r){"use strict";var n=e("asn1.js");r.certificate=e("./certificate");var i=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=i;var a=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=a;var o=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),s=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())});r.PublicKey=s;var c=n.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(o),this.key("subjectPrivateKey").octstr())});r.PrivateKey=c;var u=n.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=u;var d=n.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=d,r.DSAparam=n.define("DSAparam",function(){this.int()});var l=n.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),f=n.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(l),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=f,r.signature=n.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":333,"asn1.js":65}],333:[function(e,t,r){"use strict";var n=e("asn1.js"),i=n.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),a=n.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),o=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),s=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())}),c=n.define("RelativeDistinguishedName",function(){this.setof(a)}),u=n.define("RDNSequence",function(){this.seqof(c)}),d=n.define("Name",function(){this.choice({rdnSequence:this.use(u)})}),l=n.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),f=n.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),p=n.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(o),this.key("issuer").use(d),this.key("validity").use(l),this.key("subject").use(d),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(f).optional())}),h=n.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(p),this.key("signatureAlgorithm").use(o),this.key("signatureValue").bitstr())});t.exports=h},{"asn1.js":65}],334:[function(e,t,r){"use strict";var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,a=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,o=e("evp_bytestokey"),s=e("browserify-aes"),c=e("safe-buffer").Buffer;t.exports=function(e,t){var r,u=e.toString(),d=u.match(n);if(d){var l="aes"+d[1],f=c.from(d[2],"hex"),p=c.from(d[3].replace(/[\r\n]/g,""),"base64"),h=o(t,f.slice(0,8),parseInt(d[1],10)).key,m=[],b=s.createDecipheriv(l,h,f);m.push(b.update(p)),m.push(b.final()),r=c.concat(m)}else{var v=u.match(a);r=c.from(v[2].replace(/[\r\n]/g,""),"base64")}return{tag:u.match(i)[1],data:r}}},{"browserify-aes":95,evp_bytestokey:206,"safe-buffer":387}],335:[function(e,t,r){"use strict";var n=e("./asn1"),i=e("./aesid.json"),a=e("./fixProc"),o=e("browserify-aes"),s=e("pbkdf2"),c=e("safe-buffer").Buffer;function u(e){var t;"object"!=typeof e||c.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=c.from(e));var r,u,d=a(e,t),l=d.tag,f=d.data;switch(l){case"CERTIFICATE":u=n.certificate.decode(f,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(u||(u=n.PublicKey.decode(f,"der")),r=u.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(u.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return u.subjectPrivateKey=u.subjectPublicKey,{type:"ec",data:u};case"1.2.840.10040.4.1":return u.algorithm.params.pub_key=n.DSAparam.decode(u.subjectPublicKey.data,"der"),{type:"dsa",data:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":f=function(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),a=i[e.algorithm.decrypt.cipher.algo.join(".")],u=e.algorithm.decrypt.cipher.iv,d=e.subjectPrivateKey,l=parseInt(a.split("-")[1],10)/8,f=s.pbkdf2Sync(t,r,n,l,"sha1"),p=o.createDecipheriv(a,f,u),h=[];return h.push(p.update(d)),h.push(p.final()),c.concat(h)}(f=n.EncryptedPrivateKey.decode(f,"der"),t);case"PRIVATE KEY":switch(r=(u=n.PrivateKey.decode(f,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(u.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:u.algorithm.curve,privateKey:n.ECPrivateKey.decode(u.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return u.algorithm.params.priv_key=n.DSAparam.decode(u.subjectPrivateKey,"der"),{type:"dsa",params:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(f,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(f,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(f,"der")};case"EC PRIVATE KEY":return{curve:(f=n.ECPrivateKey.decode(f,"der")).parameters.value,privateKey:f.privateKey};default:throw new Error("unknown key type "+l)}}u.signature=n.signature,t.exports=u},{"./aesid.json":331,"./asn1":332,"./fixProc":334,"browserify-aes":95,pbkdf2:336,"safe-buffer":387}],336:[function(e,t,r){"use strict";r.pbkdf2=e("./lib/async"),r.pbkdf2Sync=e("./lib/sync")},{"./lib/async":337,"./lib/sync":340}],337:[function(e,t,r){"use strict";var n,i,a=e("safe-buffer").Buffer,o=e("./precondition"),s=e("./default-encoding"),c=e("./sync"),u=e("./to-buffer"),d=global.crypto&&global.crypto.subtle,l={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},f=[];function p(){return i||(i=global.process&&global.process.nextTick?global.process.nextTick:global.queueMicrotask?global.queueMicrotask:global.setImmediate?global.setImmediate:global.setTimeout)}function h(e,t,r,n,i){return d.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return d.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:i}},e,n<<3)}).then(function(e){return a.from(e)})}t.exports=function(e,t,r,i,m,b){"function"==typeof m&&(b=m,m=void 0);var v=l[(m=m||"sha1").toLowerCase()];if(v&&"function"==typeof global.Promise){if(o(r,i),e=u(e,s,"Password"),t=u(t,s,"Salt"),"function"!=typeof b)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then(function(e){p()(function(){t(null,e)})},function(e){p()(function(){t(e)})})}(function(e){if(global.process&&!global.process.browser)return Promise.resolve(!1);if(!d||!d.importKey||!d.deriveBits)return Promise.resolve(!1);if(void 0!==f[e])return f[e];var t=h(n=n||a.alloc(8),n,10,128,e).then(function(){return!0},function(){return!1});return f[e]=t,t}(v).then(function(n){return n?h(e,t,r,i,v):c(e,t,r,i,m)}),b)}else p()(function(){var n;try{n=c(e,t,r,i,m)}catch(e){return void b(e)}b(null,n)})}},{"./default-encoding":338,"./precondition":339,"./sync":340,"./to-buffer":341,"safe-buffer":387}],338:[function(e,t,r){"use strict";var n;if(global.process&&global.process.browser)n="utf-8";else if(global.process&&global.process.version){n=parseInt(process.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else n="utf-8";t.exports=n},{}],339:[function(e,t,r){"use strict";var n=Math.pow(2,30)-1;t.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>n||t!=t)throw new TypeError("Bad key length")}},{}],340:[function(e,t,r){"use strict";var n=e("create-hash/md5"),i=e("ripemd160"),a=e("sha.js"),o=e("safe-buffer").Buffer,s=e("./precondition"),c=e("./default-encoding"),u=e("./to-buffer"),d=o.alloc(128),l={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},f={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function p(e){return(new i).update(e).digest()}function h(e,t,r){var i=function(e){return"rmd160"===e||"ripemd160"===e?p:"md5"===e?n:function(t){return a(e).update(t).digest()}}(e),s="sha512"===e||"sha384"===e?128:64;t.length>s?t=i(t):t.length<s&&(t=o.concat([t,d],s));for(var c=o.allocUnsafe(s+l[e]),u=o.allocUnsafe(s+l[e]),f=0;f<s;f++)c[f]=54^t[f],u[f]=92^t[f];var h=o.allocUnsafe(s+r+4);c.copy(h,0,0,s),this.ipad1=h,this.ipad2=c,this.opad=u,this.alg=e,this.blocksize=s,this.hash=i,this.size=l[e]}h.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(e,t,r,n,i){s(r,n),e=u(e,c,"Password"),t=u(t,c,"Salt");var a=(i||"sha1").toLowerCase(),d=f[a]||a,p=l[d];if("number"!=typeof p||!p)throw new TypeError("Digest algorithm not supported: "+i);var m=new h(d,e,t.length),b=o.allocUnsafe(n),v=o.allocUnsafe(t.length+4);t.copy(v,0,0,t.length);for(var g=0,y=p,_=Math.ceil(n/y),w=1;w<=_;w++){v.writeUInt32BE(w,t.length);for(var k=m.run(v,m.ipad1),S=k,x=1;x<r;x++){S=m.run(S,m.ipad2);for(var E=0;E<y;E++)k[E]^=S[E]}k.copy(b,g),g+=y}return b}},{"./default-encoding":338,"./precondition":339,"./to-buffer":341,"create-hash/md5":343,ripemd160:345,"safe-buffer":387,"sha.js":395}],341:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("to-buffer"),a="undefined"!=typeof Uint8Array,o=a&&"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView;t.exports=function(e,t,r){if("string"==typeof e||n.isBuffer(e)||a&&e instanceof Uint8Array||o&&o(e))return i(e,t);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")}},{"safe-buffer":387,"to-buffer":431}],342:[function(e,t,r){"use strict";var n=new Buffer(4);n.fill(0);t.exports=function(e,t){var r=t(function(e){if(e.length%4!=0){var t=e.length+(4-e.length%4);e=Buffer.concat([e,n],t)}for(var r=new Array(e.length>>>2),i=0,a=0;i<e.length;i+=4,a++)r[a]=e.readInt32LE(i);return r}(e),8*e.length);e=new Buffer(16);for(var i=0;i<r.length;i++)e.writeInt32LE(r[i],i<<2,!0);return e}},{}],343:[function(e,t,r){"use strict";var n=e("./make-hash");function i(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var r=1732584193,n=-271733879,i=-1732584194,a=271733878,l=0;l<e.length;l+=16){var f=r,p=n,h=i,m=a;r=o(r,n,i,a,e[l+0],7,-680876936),a=o(a,r,n,i,e[l+1],12,-389564586),i=o(i,a,r,n,e[l+2],17,606105819),n=o(n,i,a,r,e[l+3],22,-1044525330),r=o(r,n,i,a,e[l+4],7,-176418897),a=o(a,r,n,i,e[l+5],12,1200080426),i=o(i,a,r,n,e[l+6],17,-1473231341),n=o(n,i,a,r,e[l+7],22,-45705983),r=o(r,n,i,a,e[l+8],7,1770035416),a=o(a,r,n,i,e[l+9],12,-1958414417),i=o(i,a,r,n,e[l+10],17,-42063),n=o(n,i,a,r,e[l+11],22,-1990404162),r=o(r,n,i,a,e[l+12],7,1804603682),a=o(a,r,n,i,e[l+13],12,-40341101),i=o(i,a,r,n,e[l+14],17,-1502002290),r=s(r,n=o(n,i,a,r,e[l+15],22,1236535329),i,a,e[l+1],5,-165796510),a=s(a,r,n,i,e[l+6],9,-1069501632),i=s(i,a,r,n,e[l+11],14,643717713),n=s(n,i,a,r,e[l+0],20,-373897302),r=s(r,n,i,a,e[l+5],5,-701558691),a=s(a,r,n,i,e[l+10],9,38016083),i=s(i,a,r,n,e[l+15],14,-660478335),n=s(n,i,a,r,e[l+4],20,-405537848),r=s(r,n,i,a,e[l+9],5,568446438),a=s(a,r,n,i,e[l+14],9,-1019803690),i=s(i,a,r,n,e[l+3],14,-187363961),n=s(n,i,a,r,e[l+8],20,1163531501),r=s(r,n,i,a,e[l+13],5,-1444681467),a=s(a,r,n,i,e[l+2],9,-51403784),i=s(i,a,r,n,e[l+7],14,1735328473),r=c(r,n=s(n,i,a,r,e[l+12],20,-1926607734),i,a,e[l+5],4,-378558),a=c(a,r,n,i,e[l+8],11,-2022574463),i=c(i,a,r,n,e[l+11],16,1839030562),n=c(n,i,a,r,e[l+14],23,-35309556),r=c(r,n,i,a,e[l+1],4,-1530992060),a=c(a,r,n,i,e[l+4],11,1272893353),i=c(i,a,r,n,e[l+7],16,-155497632),n=c(n,i,a,r,e[l+10],23,-1094730640),r=c(r,n,i,a,e[l+13],4,681279174),a=c(a,r,n,i,e[l+0],11,-358537222),i=c(i,a,r,n,e[l+3],16,-722521979),n=c(n,i,a,r,e[l+6],23,76029189),r=c(r,n,i,a,e[l+9],4,-640364487),a=c(a,r,n,i,e[l+12],11,-421815835),i=c(i,a,r,n,e[l+15],16,530742520),r=u(r,n=c(n,i,a,r,e[l+2],23,-995338651),i,a,e[l+0],6,-198630844),a=u(a,r,n,i,e[l+7],10,1126891415),i=u(i,a,r,n,e[l+14],15,-1416354905),n=u(n,i,a,r,e[l+5],21,-57434055),r=u(r,n,i,a,e[l+12],6,1700485571),a=u(a,r,n,i,e[l+3],10,-1894986606),i=u(i,a,r,n,e[l+10],15,-1051523),n=u(n,i,a,r,e[l+1],21,-2054922799),r=u(r,n,i,a,e[l+8],6,1873313359),a=u(a,r,n,i,e[l+15],10,-30611744),i=u(i,a,r,n,e[l+6],15,-1560198380),n=u(n,i,a,r,e[l+13],21,1309151649),r=u(r,n,i,a,e[l+4],6,-145523070),a=u(a,r,n,i,e[l+11],10,-1120210379),i=u(i,a,r,n,e[l+2],15,718787259),n=u(n,i,a,r,e[l+9],21,-343485551),r=d(r,f),n=d(n,p),i=d(i,h),a=d(a,m)}return[r,n,i,a]}function a(e,t,r,n,i,a){return d((o=d(d(t,e),d(n,a)))<<(s=i)|o>>>32-s,r);var o,s}function o(e,t,r,n,i,o,s){return a(t&r|~t&n,e,t,i,o,s)}function s(e,t,r,n,i,o,s){return a(t&n|r&~n,e,t,i,o,s)}function c(e,t,r,n,i,o,s){return a(t^r^n,e,t,i,o,s)}function u(e,t,r,n,i,o,s){return a(r^(t|~n),e,t,i,o,s)}function d(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}t.exports=function(e){return n(e,i)}},{"./make-hash":342}],344:[function(e,t,r){"use strict";var n=e("stream").Transform;function i(e){n.call(this),this._block=new Buffer(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}e("inherits")(i,n),i.prototype._transform=function(e,t,r){var n=null;try{"buffer"!==t&&(e=new Buffer(e,t)),this.update(e)}catch(e){n=e}r(n)},i.prototype._flush=function(e){var t=null;try{this.push(this._digest())}catch(e){t=e}e(t)},i.prototype.update=function(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");Buffer.isBuffer(e)||(e=new Buffer(e,t||"binary"));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var a=0,o=8*e.length;o>0;++a)this._length[a]+=o,(o=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*o);return this},i.prototype._update=function(e){throw new Error("_update is not implemented")},i.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();return void 0!==e&&(t=t.toString(e)),t},i.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=i},{inherits:243,stream:415}],345:[function(e,t,r){"use strict";var n=e("inherits"),i=e("hash-base");function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function o(e,t){return e<<t|e>>>32-t}function s(e,t,r,n,i,a,s,c){return o(e+(t^r^n)+a+s|0,c)+i|0}function c(e,t,r,n,i,a,s,c){return o(e+(t&r|~t&n)+a+s|0,c)+i|0}function u(e,t,r,n,i,a,s,c){return o(e+((t|~r)^n)+a+s|0,c)+i|0}function d(e,t,r,n,i,a,s,c){return o(e+(t&n|r&~n)+a+s|0,c)+i|0}function l(e,t,r,n,i,a,s,c){return o(e+(t^(r|~n))+a+s|0,c)+i|0}n(a,i),a.prototype._update=function(){for(var e=new Array(16),t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,a=this._d,f=this._e;r=s(r,n,i,a,f,e[0],0,11),f=s(f,r,n,i=o(i,10),a,e[1],0,14),a=s(a,f,r,n=o(n,10),i,e[2],0,15),i=s(i,a,f,r=o(r,10),n,e[3],0,12),n=s(n,i,a,f=o(f,10),r,e[4],0,5),r=s(r,n,i,a=o(a,10),f,e[5],0,8),f=s(f,r,n,i=o(i,10),a,e[6],0,7),a=s(a,f,r,n=o(n,10),i,e[7],0,9),i=s(i,a,f,r=o(r,10),n,e[8],0,11),n=s(n,i,a,f=o(f,10),r,e[9],0,13),r=s(r,n,i,a=o(a,10),f,e[10],0,14),f=s(f,r,n,i=o(i,10),a,e[11],0,15),a=s(a,f,r,n=o(n,10),i,e[12],0,6),i=s(i,a,f,r=o(r,10),n,e[13],0,7),n=s(n,i,a,f=o(f,10),r,e[14],0,9),f=c(f,r=s(r,n,i,a=o(a,10),f,e[15],0,8),n,i=o(i,10),a,e[7],1518500249,7),a=c(a,f,r,n=o(n,10),i,e[4],1518500249,6),i=c(i,a,f,r=o(r,10),n,e[13],1518500249,8),n=c(n,i,a,f=o(f,10),r,e[1],1518500249,13),r=c(r,n,i,a=o(a,10),f,e[10],1518500249,11),f=c(f,r,n,i=o(i,10),a,e[6],1518500249,9),a=c(a,f,r,n=o(n,10),i,e[15],1518500249,7),i=c(i,a,f,r=o(r,10),n,e[3],1518500249,15),n=c(n,i,a,f=o(f,10),r,e[12],1518500249,7),r=c(r,n,i,a=o(a,10),f,e[0],1518500249,12),f=c(f,r,n,i=o(i,10),a,e[9],1518500249,15),a=c(a,f,r,n=o(n,10),i,e[5],1518500249,9),i=c(i,a,f,r=o(r,10),n,e[2],1518500249,11),n=c(n,i,a,f=o(f,10),r,e[14],1518500249,7),r=c(r,n,i,a=o(a,10),f,e[11],1518500249,13),a=u(a,f=c(f,r,n,i=o(i,10),a,e[8],1518500249,12),r,n=o(n,10),i,e[3],1859775393,11),i=u(i,a,f,r=o(r,10),n,e[10],1859775393,13),n=u(n,i,a,f=o(f,10),r,e[14],1859775393,6),r=u(r,n,i,a=o(a,10),f,e[4],1859775393,7),f=u(f,r,n,i=o(i,10),a,e[9],1859775393,14),a=u(a,f,r,n=o(n,10),i,e[15],1859775393,9),i=u(i,a,f,r=o(r,10),n,e[8],1859775393,13),n=u(n,i,a,f=o(f,10),r,e[1],1859775393,15),r=u(r,n,i,a=o(a,10),f,e[2],1859775393,14),f=u(f,r,n,i=o(i,10),a,e[7],1859775393,8),a=u(a,f,r,n=o(n,10),i,e[0],1859775393,13),i=u(i,a,f,r=o(r,10),n,e[6],1859775393,6),n=u(n,i,a,f=o(f,10),r,e[13],1859775393,5),r=u(r,n,i,a=o(a,10),f,e[11],1859775393,12),f=u(f,r,n,i=o(i,10),a,e[5],1859775393,7),i=d(i,a=u(a,f,r,n=o(n,10),i,e[12],1859775393,5),f,r=o(r,10),n,e[1],2400959708,11),n=d(n,i,a,f=o(f,10),r,e[9],2400959708,12),r=d(r,n,i,a=o(a,10),f,e[11],2400959708,14),f=d(f,r,n,i=o(i,10),a,e[10],2400959708,15),a=d(a,f,r,n=o(n,10),i,e[0],2400959708,14),i=d(i,a,f,r=o(r,10),n,e[8],2400959708,15),n=d(n,i,a,f=o(f,10),r,e[12],2400959708,9),r=d(r,n,i,a=o(a,10),f,e[4],2400959708,8),f=d(f,r,n,i=o(i,10),a,e[13],2400959708,9),a=d(a,f,r,n=o(n,10),i,e[3],2400959708,14),i=d(i,a,f,r=o(r,10),n,e[7],2400959708,5),n=d(n,i,a,f=o(f,10),r,e[15],2400959708,6),r=d(r,n,i,a=o(a,10),f,e[14],2400959708,8),f=d(f,r,n,i=o(i,10),a,e[5],2400959708,6),a=d(a,f,r,n=o(n,10),i,e[6],2400959708,5),n=l(n,i=d(i,a,f,r=o(r,10),n,e[2],2400959708,12),a,f=o(f,10),r,e[4],2840853838,9),r=l(r,n,i,a=o(a,10),f,e[0],2840853838,15),f=l(f,r,n,i=o(i,10),a,e[5],2840853838,5),a=l(a,f,r,n=o(n,10),i,e[9],2840853838,11),i=l(i,a,f,r=o(r,10),n,e[7],2840853838,6),n=l(n,i,a,f=o(f,10),r,e[12],2840853838,8),r=l(r,n,i,a=o(a,10),f,e[2],2840853838,13),f=l(f,r,n,i=o(i,10),a,e[10],2840853838,12),a=l(a,f,r,n=o(n,10),i,e[14],2840853838,5),i=l(i,a,f,r=o(r,10),n,e[1],2840853838,12),n=l(n,i,a,f=o(f,10),r,e[3],2840853838,13),r=l(r,n,i,a=o(a,10),f,e[8],2840853838,14),f=l(f,r,n,i=o(i,10),a,e[11],2840853838,11),a=l(a,f,r,n=o(n,10),i,e[6],2840853838,8),i=l(i,a,f,r=o(r,10),n,e[15],2840853838,5),n=l(n,i,a,f=o(f,10),r,e[13],2840853838,6),a=o(a,10);var p=this._a,h=this._b,m=this._c,b=this._d,v=this._e;p=l(p,h,m,b,v,e[5],1352829926,8),v=l(v,p,h,m=o(m,10),b,e[14],1352829926,9),b=l(b,v,p,h=o(h,10),m,e[7],1352829926,9),m=l(m,b,v,p=o(p,10),h,e[0],1352829926,11),h=l(h,m,b,v=o(v,10),p,e[9],1352829926,13),p=l(p,h,m,b=o(b,10),v,e[2],1352829926,15),v=l(v,p,h,m=o(m,10),b,e[11],1352829926,15),b=l(b,v,p,h=o(h,10),m,e[4],1352829926,5),m=l(m,b,v,p=o(p,10),h,e[13],1352829926,7),h=l(h,m,b,v=o(v,10),p,e[6],1352829926,7),p=l(p,h,m,b=o(b,10),v,e[15],1352829926,8),v=l(v,p,h,m=o(m,10),b,e[8],1352829926,11),b=l(b,v,p,h=o(h,10),m,e[1],1352829926,14),m=l(m,b,v,p=o(p,10),h,e[10],1352829926,14),h=l(h,m,b,v=o(v,10),p,e[3],1352829926,12),v=d(v,p=l(p,h,m,b=o(b,10),v,e[12],1352829926,6),h,m=o(m,10),b,e[6],1548603684,9),b=d(b,v,p,h=o(h,10),m,e[11],1548603684,13),m=d(m,b,v,p=o(p,10),h,e[3],1548603684,15),h=d(h,m,b,v=o(v,10),p,e[7],1548603684,7),p=d(p,h,m,b=o(b,10),v,e[0],1548603684,12),v=d(v,p,h,m=o(m,10),b,e[13],1548603684,8),b=d(b,v,p,h=o(h,10),m,e[5],1548603684,9),m=d(m,b,v,p=o(p,10),h,e[10],1548603684,11),h=d(h,m,b,v=o(v,10),p,e[14],1548603684,7),p=d(p,h,m,b=o(b,10),v,e[15],1548603684,7),v=d(v,p,h,m=o(m,10),b,e[8],1548603684,12),b=d(b,v,p,h=o(h,10),m,e[12],1548603684,7),m=d(m,b,v,p=o(p,10),h,e[4],1548603684,6),h=d(h,m,b,v=o(v,10),p,e[9],1548603684,15),p=d(p,h,m,b=o(b,10),v,e[1],1548603684,13),b=u(b,v=d(v,p,h,m=o(m,10),b,e[2],1548603684,11),p,h=o(h,10),m,e[15],1836072691,9),m=u(m,b,v,p=o(p,10),h,e[5],1836072691,7),h=u(h,m,b,v=o(v,10),p,e[1],1836072691,15),p=u(p,h,m,b=o(b,10),v,e[3],1836072691,11),v=u(v,p,h,m=o(m,10),b,e[7],1836072691,8),b=u(b,v,p,h=o(h,10),m,e[14],1836072691,6),m=u(m,b,v,p=o(p,10),h,e[6],1836072691,6),h=u(h,m,b,v=o(v,10),p,e[9],1836072691,14),p=u(p,h,m,b=o(b,10),v,e[11],1836072691,12),v=u(v,p,h,m=o(m,10),b,e[8],1836072691,13),b=u(b,v,p,h=o(h,10),m,e[12],1836072691,5),m=u(m,b,v,p=o(p,10),h,e[2],1836072691,14),h=u(h,m,b,v=o(v,10),p,e[10],1836072691,13),p=u(p,h,m,b=o(b,10),v,e[0],1836072691,13),v=u(v,p,h,m=o(m,10),b,e[4],1836072691,7),m=c(m,b=u(b,v,p,h=o(h,10),m,e[13],1836072691,5),v,p=o(p,10),h,e[8],2053994217,15),h=c(h,m,b,v=o(v,10),p,e[6],2053994217,5),p=c(p,h,m,b=o(b,10),v,e[4],2053994217,8),v=c(v,p,h,m=o(m,10),b,e[1],2053994217,11),b=c(b,v,p,h=o(h,10),m,e[3],2053994217,14),m=c(m,b,v,p=o(p,10),h,e[11],2053994217,14),h=c(h,m,b,v=o(v,10),p,e[15],2053994217,6),p=c(p,h,m,b=o(b,10),v,e[0],2053994217,14),v=c(v,p,h,m=o(m,10),b,e[5],2053994217,6),b=c(b,v,p,h=o(h,10),m,e[12],2053994217,9),m=c(m,b,v,p=o(p,10),h,e[2],2053994217,12),h=c(h,m,b,v=o(v,10),p,e[13],2053994217,9),p=c(p,h,m,b=o(b,10),v,e[9],2053994217,12),v=c(v,p,h,m=o(m,10),b,e[7],2053994217,5),b=c(b,v,p,h=o(h,10),m,e[10],2053994217,15),h=s(h,m=c(m,b,v,p=o(p,10),h,e[14],2053994217,8),b,v=o(v,10),p,e[12],0,8),p=s(p,h,m,b=o(b,10),v,e[15],0,5),v=s(v,p,h,m=o(m,10),b,e[10],0,12),b=s(b,v,p,h=o(h,10),m,e[4],0,9),m=s(m,b,v,p=o(p,10),h,e[1],0,12),h=s(h,m,b,v=o(v,10),p,e[5],0,5),p=s(p,h,m,b=o(b,10),v,e[8],0,14),v=s(v,p,h,m=o(m,10),b,e[7],0,6),b=s(b,v,p,h=o(h,10),m,e[6],0,8),m=s(m,b,v,p=o(p,10),h,e[2],0,13),h=s(h,m,b,v=o(v,10),p,e[13],0,6),p=s(p,h,m,b=o(b,10),v,e[14],0,5),v=s(v,p,h,m=o(m,10),b,e[0],0,15),b=s(b,v,p,h=o(h,10),m,e[3],0,13),m=s(m,b,v,p=o(p,10),h,e[9],0,11),h=s(h,m,b,v=o(v,10),p,e[11],0,11),b=o(b,10);var g=this._b+i+b|0;this._b=this._c+a+v|0,this._c=this._d+f+p|0,this._d=this._e+r+h|0,this._e=this._a+n+m|0,this._a=g},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=new Buffer(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},t.exports=a},{"hash-base":344,inherits:243}],346:[function(e,t,r){t.exports=["Bulbasaur","Ivysaur","Venusaur","Charmander","Charmeleon","Charizard","Squirtle","Wartortle","Blastoise","Caterpie","Metapod","Butterfree","Weedle","Kakuna","Beedrill","Pidgey","Pidgeotto","Pidgeot","Rattata","Raticate","Spearow","Fearow","Ekans","Arbok","Pikachu","Raichu","Sandshrew","Sandslash","Nidoran♀","Nidorina","Nidoqueen","Nidoran♂","Nidorino","Nidoking","Clefairy","Clefable","Vulpix","Ninetales","Jigglypuff","Wigglytuff","Zubat","Golbat","Oddish","Gloom","Vileplume","Paras","Parasect","Venonat","Venomoth","Diglett","Dugtrio","Meowth","Persian","Psyduck","Golduck","Mankey","Primeape","Growlithe","Arcanine","Poliwag","Poliwhirl","Poliwrath","Abra","Kadabra","Alakazam","Machop","Machoke","Machamp","Bellsprout","Weepinbell","Victreebel","Tentacool","Tentacruel","Geodude","Graveler","Golem","Ponyta","Rapidash","Slowpoke","Slowbro","Magnemite","Magneton","Farfetch'd","Doduo","Dodrio","Seel","Dewgong","Grimer","Muk","Shellder","Cloyster","Gastly","Haunter","Gengar","Onix","Drowzee","Hypno","Krabby","Kingler","Voltorb","Electrode","Exeggcute","Exeggutor","Cubone","Marowak","Hitmonlee","Hitmonchan","Lickitung","Koffing","Weezing","Rhyhorn","Rhydon","Chansey","Tangela","Kangaskhan","Horsea","Seadra","Goldeen","Seaking","Staryu","Starmie","Mr. Mime","Scyther","Jynx","Electabuzz","Magmar","Pinsir","Tauros","Magikarp","Gyarados","Lapras","Ditto","Eevee","Vaporeon","Jolteon","Flareon","Porygon","Omanyte","Omastar","Kabuto","Kabutops","Aerodactyl","Snorlax","Articuno","Zapdos","Moltres","Dratini","Dragonair","Dragonite","Mewtwo","Mew","Chikorita","Bayleef","Meganium","Cyndaquil","Quilava","Typhlosion","Totodile","Croconaw","Feraligatr","Sentret","Furret","Hoothoot","Noctowl","Ledyba","Ledian","Spinarak","Ariados","Crobat","Chinchou","Lanturn","Pichu","Cleffa","Igglybuff","Togepi","Togetic","Natu","Xatu","Mareep","Flaaffy","Ampharos","Bellossom","Marill","Azumarill","Sudowoodo","Politoed","Hoppip","Skiploom","Jumpluff","Aipom","Sunkern","Sunflora","Yanma","Wooper","Quagsire","Espeon","Umbreon","Murkrow","Slowking","Misdreavus","Unown","Wobbuffet","Girafarig","Pineco","Forretress","Dunsparce","Gligar","Steelix","Snubbull","Granbull","Qwilfish","Scizor","Shuckle","Heracross","Sneasel","Teddiursa","Ursaring","Slugma","Magcargo","Swinub","Piloswine","Corsola","Remoraid","Octillery","Delibird","Mantine","Skarmory","Houndour","Houndoom","Kingdra","Phanpy","Donphan","Porygon2","Stantler","Smeargle","Tyrogue","Hitmontop","Smoochum","Elekid","Magby","Miltank","Blissey","Raikou","Entei","Suicune","Larvitar","Pupitar","Tyranitar","Lugia","Ho-Oh","Celebi","Treecko","Grovyle","Sceptile","Torchic","Combusken","Blaziken","Mudkip","Marshtomp","Swampert","Poochyena","Mightyena","Zigzagoon","Linoone","Wurmple","Silcoon","Beautifly","Cascoon","Dustox","Lotad","Lombre","Ludicolo","Seedot","Nuzleaf","Shiftry","Taillow","Swellow","Wingull","Pelipper","Ralts","Kirlia","Gardevoir","Surskit","Masquerain","Shroomish","Breloom","Slakoth","Vigoroth","Slaking","Nincada","Ninjask","Shedinja","Whismur","Loudred","Exploud","Makuhita","Hariyama","Azurill","Nosepass","Skitty","Delcatty","Sableye","Mawile","Aron","Lairon","Aggron","Meditite","Medicham","Electrike","Manectric","Plusle","Minun","Volbeat","Illumise","Roselia","Gulpin","Swalot","Carvanha","Sharpedo","Wailmer","Wailord","Numel","Camerupt","Torkoal","Spoink","Grumpig","Spinda","Trapinch","Vibrava","Flygon","Cacnea","Cacturne","Swablu","Altaria","Zangoose","Seviper","Lunatone","Solrock","Barboach","Whiscash","Corphish","Crawdaunt","Baltoy","Claydol","Lileep","Cradily","Anorith","Armaldo","Feebas","Milotic","Castform","Kecleon","Shuppet","Banette","Duskull","Dusclops","Tropius","Chimecho","Absol","Wynaut","Snorunt","Glalie","Spheal","Sealeo","Walrein","Clamperl","Huntail","Gorebyss","Relicanth","Luvdisc","Bagon","Shelgon","Salamence","Beldum","Metang","Metagross","Regirock","Regice","Registeel","Latias","Latios","Kyogre","Groudon","Rayquaza","Jirachi","Deoxys","Turtwig","Grotle","Torterra","Chimchar","Monferno","Infernape","Piplup","Prinplup","Empoleon","Starly","Staravia","Staraptor","Bidoof","Bibarel","Kricketot","Kricketune","Shinx","Luxio","Luxray","Budew","Roserade","Cranidos","Rampardos","Shieldon","Bastiodon","Burmy","Wormadam","Mothim","Combee","Vespiquen","Pachirisu","Buizel","Floatzel","Cherubi","Cherrim","Shellos","Gastrodon","Ambipom","Drifloon","Drifblim","Buneary","Lopunny","Mismagius","Honchkrow","Glameow","Purugly","Chingling","Stunky","Skuntank","Bronzor","Bronzong","Bonsly","Mime Jr.","Happiny","Chatot","Spiritomb","Gible","Gabite","Garchomp","Munchlax","Riolu","Lucario","Hippopotas","Hippowdon","Skorupi","Drapion","Croagunk","Toxicroak","Carnivine","Finneon","Lumineon","Mantyke","Snover","Abomasnow","Weavile","Magnezone","Lickilicky","Rhyperior","Tangrowth","Electivire","Magmortar","Togekiss","Yanmega","Leafeon","Glaceon","Gliscor","Mamoswine","Porygon-Z","Gallade","Probopass","Dusknoir","Froslass","Rotom","Uxie","Mesprit","Azelf","Dialga","Palkia","Heatran","Regigigas","Giratina","Cresselia","Phione","Manaphy","Darkrai","Shaymin","Arceus","Victini","Snivy","Servine","Serperior","Tepig","Pignite","Emboar","Oshawott","Dewott","Samurott","Patrat","Watchog","Lillipup","Herdier","Stoutland","Purrloin","Liepard","Pansage","Simisage","Pansear","Simisear","Panpour","Simipour","Munna","Musharna","Pidove","Tranquill","Unfezant","Blitzle","Zebstrika","Roggenrola","Boldore","Gigalith","Woobat","Swoobat","Drilbur","Excadrill","Audino","Timburr","Gurdurr","Conkeldurr","Tympole","Palpitoad","Seismitoad","Throh","Sawk","Sewaddle","Swadloon","Leavanny","Venipede","Whirlipede","Scolipede","Cottonee","Whimsicott","Petilil","Lilligant","Basculin","Sandile","Krokorok","Krookodile","Darumaka","Darmanitan","Maractus","Dwebble","Crustle","Scraggy","Scrafty","Sigilyph","Yamask","Cofagrigus","Tirtouga","Carracosta","Archen","Archeops","Trubbish","Garbodor","Zorua","Zoroark","Minccino","Cinccino","Gothita","Gothorita","Gothitelle","Solosis","Duosion","Reuniclus","Ducklett","Swanna","Vanillite","Vanillish","Vanilluxe","Deerling","Sawsbuck","Emolga","Karrablast","Escavalier","Foongus","Amoonguss","Frillish","Jellicent","Alomomola","Joltik","Galvantula","Ferroseed","Ferrothorn","Klink","Klang","Klinklang","Tynamo","Eelektrik","Eelektross","Elgyem","Beheeyem","Litwick","Lampent","Chandelure","Axew","Fraxure","Haxorus","Cubchoo","Beartic","Cryogonal","Shelmet","Accelgor","Stunfisk","Mienfoo","Mienshao","Druddigon","Golett","Golurk","Pawniard","Bisharp","Bouffalant","Rufflet","Braviary","Vullaby","Mandibuzz","Heatmor","Durant","Deino","Zweilous","Hydreigon","Larvesta","Volcarona","Cobalion","Terrakion","Virizion","Tornadus","Thundurus","Reshiram","Zekrom","Landorus","Kyurem","Keldeo","Meloetta","Genesect","Chespin","Quilladin","Chesnaught","Fennekin","Braixen","Delphox","Froakie","Frogadier","Greninja","Bunnelby","Diggersby","Fletchling","Fletchinder","Talonflame","Scatterbug","Spewpa","Vivillon","Litleo","Pyroar","Flabébé","Floette","Florges","Skiddo","Gogoat","Pancham","Pangoro","Furfrou","Espurr","Meowstic","Honedge","Doublade","Aegislash","Spritzee","Aromatisse","Swirlix","Slurpuff","Inkay","Malamar","Binacle","Barbaracle","Skrelp","Dragalge","Clauncher","Clawitzer","Helioptile","Heliolisk","Tyrunt","Tyrantrum","Amaura","Aurorus","Sylveon","Hawlucha","Dedenne","Carbink","Goomy","Sliggoo","Goodra","Klefki","Phantump","Trevenant","Pumpkaboo","Gourgeist","Bergmite","Avalugg","Noibat","Noivern","Xerneas","Yveltal","Zygarde","Diancie","Hoopa","Volcanion","Rowlet","Dartrix","Decidueye","Litten","Torracat","Incineroar","Popplio","Brionne","Primarina","Pikipek","Trumbeak","Toucannon","Yungoos","Gumshoos","Grubbin","Charjabug","Vikavolt","Crabrawler","Crabominable","Oricorio","Cutiefly","Ribombee","Rockruff","Lycanroc","Wishiwashi","Mareanie","Toxapex","Mudbray","Mudsdale","Dewpider","Araquanid","Fomantis","Lurantis","Morelull","Shiinotic","Salandit","Salazzle","Stufful","Bewear","Bounsweet","Steenee","Tsareena","Comfey","Oranguru","Passimian","Wimpod","Golisopod","Sandygast","Palossand","Pyukumuku","Type: Null","Silvally","Minior","Komala","Turtonator","Togedemaru","Mimikyu","Bruxish","Drampa","Dhelmise","Jangmo-o","Hakamo-o","Kommo-o","Tapu Koko","Tapu Lele","Tapu Bulu","Tapu Fini","Cosmog","Cosmoem","Solgaleo","Lunala","Nihilego","Buzzwole","Pheromosa","Xurkitree","Celesteela","Kartana","Guzzlord","Necrozma","Magearna","Marshadow","Poipole","Naganadel","Stakataka","Blacephalon","Zeraora","Meltan","Melmetal","Grookey","Thwackey","Rillaboom","Scorbunny","Raboot","Cinderace","Sobble","Drizzile","Inteleon","Skwovet","Greedent","Rookidee","Corvisquire","Corviknight","Blipbug","Dottler","Orbeetle","Nickit","Thievul","Gossifleur","Eldegoss","Wooloo","Dubwool","Chewtle","Drednaw","Yamper","Boltund","Rolycoly","Carkol","Coalossal","Applin","Flapple","Appletun","Silicobra","Sandaconda","Cramorant","Arrokuda","Barraskewda","Toxel","Toxtricity","Sizzlipede","Centiskorch","Clobbopus","Grapploct","Sinistea","Polteageist","Hatenna","Hattrem","Hatterene","Impidimp","Morgrem","Grimmsnarl","Obstagoon","Perrserker","Cursola","Sirfetch'd","Mr. Rime","Runerigus","Milcery","Alcremie","Falinks","Pincurchin","Snom","Frosmoth","Stonjourner","Eiscue","Indeedee","Morpeko","Cufant","Copperajah","Dracozolt","Arctozolt","Dracovish","Arctovish","Duraludon","Dreepy","Drakloak","Dragapult","Zacian","Zamazenta","Eternatus","Kubfu","Urshifu","Zarude","Regieleki","Regidrago","Glastrier","Spectrier","Calyrex","Wyrdeer","Kleavor","Ursaluna","Basculegion","Sneasler","Overqwil","Enamorus","Sprigatito","Floragato","Meowscarada","Fuecoco","Crocalor","Skeledirge","Quaxly","Quaxwell","Quaquaval","Lechonk","Oinkologne","Tarountula","Spidops","Nymble","Lokix","Pawmi","Pawmo","Pawmot","Tandemaus","Maushold","Fidough","Dachsbun","Smoliv","Dolliv","Arboliva","Squawkabilly","Nacli","Naclstack","Garganacl","Charcadet","Armarouge","Ceruledge","Tadbulb","Bellibolt","Wattrel","Kilowattrel","Maschiff","Mabosstiff","Shroodle","Grafaiai","Bramblin","Brambleghast","Toedscool","Toedscruel","Klawf","Capsakid","Scovillain","Rellor","Rabsca","Flittle","Espathra","Tinkatink","Tinkatuff","Tinkaton","Wiglett","Wugtrio","Bombirdier","Finizen","Palafin","Varoom","Revavroom","Cyclizar","Orthworm","Glimmet","Glimmora","Greavard","Houndstone","Flamigo","Cetoddle","Cetitan","Veluza","Dondozo","Tatsugiri","Annihilape","Clodsire","Farigiraf","Dudunsparce","Kingambit","Great Tusk","Scream Tail","Brute Bonnet","Flutter Mane","Slither Wing","Sandy Shocks","Iron Treads","Iron Bundle","Iron Hands","Iron Jugulis","Iron Moth","Iron Thorns","Frigibax","Arctibax","Baxcalibur","Gimmighoul","Gholdengo","Wo-Chien","Chien-Pao","Ting-Lu","Chi-Yu","Roaring Moon","Iron Valiant","Koraidon","Miraidon","Walking Wake","Iron Leaves","Dipplin","Poltchageist","Sinistcha","Okidogi","Munkidori","Fezandipiti","Ogerpon","Archaludon","Hydrapple","Gouging Fire","Raging Bolt","Iron Boulder","Iron Crown","Terapagos","Pecharunt"]},{}],347:[function(e,t,r){"use strict";const n=e("unique-random-array"),i=e("./data/en.json"),a="https://github.com/sindresorhus/pokemon",o=`Please report to ${a}/issues if we missed something.`,s=new Set(["de","en","fr","es","ja","ko","ru","th","zh-Hans","zh-Hant"]),c=new Map;function u(t="en"){if("en"===t)return i;if(!s.has(t))throw new Error(`Localized list for language code '${t}' does not exist. Pull request welcome: ${a}`);return e(`./data/${t.toLowerCase()}.json`)}r.all=u,r.random=(e="en")=>{if(c.has(e))return c.get(e)();const t=u(e),r=n(t);return c.set(e,r),r()},r.getName=(e,t="en")=>{const r=u(t)[e-1];if(!r)throw new Error(`Pokémon with ID '${e}' does not exist. ${o}`);return r},r.getId=(e,t="en")=>{const r=u(t).indexOf(e);if(-1===r)throw new Error(`Pokémon with name '${e}' does not exist for language code '${t}'. ${o}`);return r+1},r.languages=s},{"./data/en.json":346,"unique-random-array":433}],348:[function(e,t,r){"use strict";t.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},{}],349:[function(e,t,r){"use strict";"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?t.exports={nextTick:function(e,t,r,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,a,o=arguments.length;switch(o){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,n)});default:for(i=new Array(o-1),a=0;a<i.length;)i[a++]=arguments[a];return process.nextTick(function(){e.apply(null,i)})}}}:t.exports=process},{}],350:[function(e,t,r){r.publicEncrypt=e("./publicEncrypt"),r.privateDecrypt=e("./privateDecrypt"),r.privateEncrypt=function(e,t){return r.publicEncrypt(e,t,!0)},r.publicDecrypt=function(e,t){return r.privateDecrypt(e,t,!0)}},{"./privateDecrypt":352,"./publicEncrypt":353}],351:[function(e,t,r){var n=e("create-hash"),i=e("safe-buffer").Buffer;function a(e){var t=i.allocUnsafe(4);return t.writeUInt32BE(e,0),t}t.exports=function(e,t){for(var r,o=i.alloc(0),s=0;o.length<t;)r=a(s++),o=i.concat([o,n("sha1").update(e).update(r).digest()]);return o.slice(0,t)}},{"create-hash":136,"safe-buffer":387}],352:[function(e,t,r){var n=e("parse-asn1"),i=e("./mgf"),a=e("./xor"),o=e("bn.js"),s=e("browserify-rsa"),c=e("create-hash"),u=e("./withPublic"),d=e("safe-buffer").Buffer;t.exports=function(e,t,r){var l;l=e.padding?e.padding:r?1:4;var f,p=n(e),h=p.modulus.byteLength();if(t.length>h||new o(t).cmp(p.modulus)>=0)throw new Error("decryption error");f=r?u(new o(t),p):s(t,p);var m=d.alloc(h-f.length);if(f=d.concat([m,f],h),4===l)return function(e,t){var r=e.modulus.byteLength(),n=c("sha1").update(d.alloc(0)).digest(),o=n.length;if(0!==t[0])throw new Error("decryption error");var s=t.slice(1,o+1),u=t.slice(o+1),l=a(s,i(u,o)),f=a(u,i(l,r-o-1));if(function(e,t){e=d.from(e),t=d.from(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i<n;)r+=e[i]^t[i];return r}(n,f.slice(0,o)))throw new Error("decryption error");var p=o;for(;0===f[p];)p++;if(1!==f[p++])throw new Error("decryption error");return f.slice(p)}(p,f);if(1===l)return function(e,t,r){var n=t.slice(0,2),i=2,a=0;for(;0!==t[i++];)if(i>=t.length){a++;break}var o=t.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&a++;o.length<8&&a++;if(a)throw new Error("decryption error");return t.slice(i)}(0,f,r);if(3===l)return f;throw new Error("unknown padding")}},{"./mgf":351,"./withPublic":354,"./xor":355,"bn.js":88,"browserify-rsa":113,"create-hash":136,"parse-asn1":335,"safe-buffer":387}],353:[function(e,t,r){var n=e("parse-asn1"),i=e("randombytes"),a=e("create-hash"),o=e("./mgf"),s=e("./xor"),c=e("bn.js"),u=e("./withPublic"),d=e("browserify-rsa"),l=e("safe-buffer").Buffer;t.exports=function(e,t,r){var f;f=e.padding?e.padding:r?1:4;var p,h=n(e);if(4===f)p=function(e,t){var r=e.modulus.byteLength(),n=t.length,u=a("sha1").update(l.alloc(0)).digest(),d=u.length,f=2*d;if(n>r-f-2)throw new Error("message too long");var p=l.alloc(r-n-f-2),h=r-d-1,m=i(d),b=s(l.concat([u,p,l.alloc(1,1),t],h),o(m,h)),v=s(m,o(b,d));return new c(l.concat([l.alloc(1),v,b],r))}(h,t);else if(1===f)p=function(e,t,r){var n,a=t.length,o=e.modulus.byteLength();if(a>o-11)throw new Error("message too long");n=r?l.alloc(o-a-3,255):function(e){var t,r=l.allocUnsafe(e),n=0,a=i(2*e),o=0;for(;n<e;)o===a.length&&(a=i(2*e),o=0),(t=a[o++])&&(r[n++]=t);return r}(o-a-3);return new c(l.concat([l.from([0,r?1:2]),n,l.alloc(1),t],o))}(h,t,r);else{if(3!==f)throw new Error("unknown padding");if((p=new c(t)).cmp(h.modulus)>=0)throw new Error("data too long for modulus")}return r?d(p,h):u(p,h)}},{"./mgf":351,"./withPublic":354,"./xor":355,"bn.js":88,"browserify-rsa":113,"create-hash":136,"parse-asn1":335,randombytes:356,"safe-buffer":387}],354:[function(e,t,r){var n=e("bn.js"),i=e("safe-buffer").Buffer;t.exports=function(e,t){return i.from(e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed().toArray())}},{"bn.js":88,"safe-buffer":387}],355:[function(e,t,r){t.exports=function(e,t){for(var r=e.length,n=-1;++n<r;)e[n]^=t[n];return e}},{}],356:[function(e,t,r){"use strict";var n=65536,i=4294967295;var a=e("safe-buffer").Buffer,o=global.crypto||global.msCrypto;o&&o.getRandomValues?t.exports=function(e,t){if(e>i)throw new RangeError("requested too many random bytes");var r=a.allocUnsafe(e);if(e>0)if(e>n)for(var s=0;s<e;s+=n)o.getRandomValues(r.slice(s,s+n));else o.getRandomValues(r);if("function"==typeof t)return process.nextTick(function(){t(null,r)});return r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}},{"safe-buffer":387}],357:[function(e,t,r){"use strict";function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var i=e("safe-buffer"),a=e("randombytes"),o=i.Buffer,s=i.kMaxLength,c=global.crypto||global.msCrypto,u=Math.pow(2,32)-1;function d(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>u||e<0)throw new TypeError("offset must be a uint32");if(e>s||e>t)throw new RangeError("offset out of range")}function l(e,t,r){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>u||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>s)throw new RangeError("buffer too small")}function f(e,t,r,n){if(process.browser){var i=e.buffer,o=new Uint8Array(i,t,r);return c.getRandomValues(o),n?void process.nextTick(function(){n(null,e)}):e}if(!n)return a(r).copy(e,t),e;a(r,function(r,i){if(r)return n(r);i.copy(e,t),n(null,e)})}c&&c.getRandomValues||!process.browser?(r.randomFill=function(e,t,r,n){if(!(o.isBuffer(e)||e instanceof global.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)n=t,t=0,r=e.length;else if("function"==typeof r)n=r,r=e.length-t;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return d(t,e.length),l(r,t,e.length),f(e,t,r,n)},r.randomFillSync=function(e,t,r){void 0===t&&(t=0);if(!(o.isBuffer(e)||e instanceof global.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');d(t,e.length),void 0===r&&(r=e.length-t);return l(r,t,e.length),f(e,t,r)}):(r.randomFill=n,r.randomFillSync=n)},{randombytes:356,"safe-buffer":387}],358:[function(e,t,r){"use strict";var n=e("process-nextick-args"),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=l;var a=Object.create(e("core-util-is"));a.inherits=e("inherits");var o=e("./_stream_readable"),s=e("./_stream_writable");a.inherits(l,o);for(var c=i(s.prototype),u=0;u<c.length;u++){var d=c[u];l.prototype[d]||(l.prototype[d]=s.prototype[d])}function l(e){if(!(this instanceof l))return new l(e);o.call(this,e),s.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",f)}function f(){this.allowHalfOpen||this._writableState.ended||n.nextTick(p,this)}function p(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),l.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}},{"./_stream_readable":360,"./_stream_writable":362,"core-util-is":134,inherits:243,"process-nextick-args":349}],359:[function(e,t,r){"use strict";t.exports=a;var n=e("./_stream_transform"),i=Object.create(e("core-util-is"));function a(e){if(!(this instanceof a))return new a(e);n.call(this,e)}i.inherits=e("inherits"),i.inherits(a,n),a.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":361,"core-util-is":134,inherits:243}],360:[function(e,t,r){"use strict";var n=e("process-nextick-args");t.exports=g;var i,a=e("isarray");g.ReadableState=v;e("events").EventEmitter;var o=function(e,t){return e.listeners(t).length},s=e("./internal/streams/stream"),c=e("safe-buffer").Buffer,u=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var d=Object.create(e("core-util-is"));d.inherits=e("inherits");var l=e("util"),f=void 0;f=l&&l.debuglog?l.debuglog("stream"):function(){};var p,h=e("./internal/streams/BufferList"),m=e("./internal/streams/destroy");d.inherits(g,s);var b=["error","close","destroy","pause","resume"];function v(t,r){t=t||{};var n=r instanceof(i=i||e("./_stream_duplex"));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var a=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:n&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=e("string_decoder/").StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function g(t){if(i=i||e("./_stream_duplex"),!(this instanceof g))return new g(t);this._readableState=new v(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function y(e,t,r,n,i){var a,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,S(e)}(e,o)):(i||(a=function(e,t){var r;n=t,c.isBuffer(n)||n instanceof u||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(o,t)),a?e.emit("error",a):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):_(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?_(e,o,t,!1):E(e,o)):_(e,o,t,!1))):n||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function _(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&S(e)),E(e,t)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),g.prototype.destroy=m.destroy,g.prototype._undestroy=m.undestroy,g.prototype._destroy=function(e,t){this.push(null),t(e)},g.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),y(this,e,t,!1,r)},g.prototype.unshift=function(e){return y(this,e,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(t){return p||(p=e("string_decoder/").StringDecoder),this._readableState.decoder=new p(t),this._readableState.encoding=t,this};var w=8388608;function k(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=w?e=w:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function S(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(f("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(x,e):x(e))}function x(e){f("emit readable"),e.emit("readable"),C(e)}function E(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(P,e,t))}function P(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(f("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function R(e){f("readable nexttick read 0"),e.read(0)}function M(e,t){t.reading||(f("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(e){var t=e._readableState;for(f("flow",t.flowing);t.flowing&&null!==e.read(););}function T(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,o),0===(e-=o)){o===a.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function A(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(I,t,e))}function I(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function O(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}g.prototype.read=function(e){f("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return f("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?A(this):S(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&A(this),null;var n,i=t.needReadable;return f("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&f("length less than watermark",i=!0),t.ended||t.reading?f("reading or ended",i=!1):i&&(f("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=k(r,t))),null===(n=e>0?T(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&A(this)),null!==n&&this.emit("data",n),n},g.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?u:g;function c(t,n){f("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),e.removeListener("close",b),e.removeListener("finish",v),e.removeListener("drain",d),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",h),l=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||d())}function u(){f("onend"),e.end()}i.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",c);var d=function(e){return function(){var t=e._readableState;f("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,C(e))}}(r);e.on("drain",d);var l=!1;var p=!1;function h(t){f("ondata"),p=!1,!1!==e.write(t)||p||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==O(i.pipes,e))&&!l&&(f("false write response, pause",i.awaitDrain),i.awaitDrain++,p=!0),r.pause())}function m(t){f("onerror",t),g(),e.removeListener("error",m),0===o(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",v),g()}function v(){f("onfinish"),e.removeListener("close",b),g()}function g(){f("unpipe"),r.unpipe(e)}return r.on("data",h),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",m),e.once("close",b),e.once("finish",v),e.emit("pipe",r),i.flowing||(f("pipe resume"),r.resume()),e},g.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)n[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=O(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},g.prototype.on=function(e,t){var r=s.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&S(this):n.nextTick(R,this))}return r},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var e=this._readableState;return e.flowing||(f("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(M,e,t))}(this,e)),this},g.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(f("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(f("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<b.length;a++)e.on(b[a],this.emit.bind(this,b[a]));return this._read=function(t){f("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=T},{"./_stream_duplex":358,"./internal/streams/BufferList":363,"./internal/streams/destroy":364,"./internal/streams/stream":365,"core-util-is":134,events:205,inherits:243,isarray:366,"process-nextick-args":349,"safe-buffer":367,"string_decoder/":368,util:92}],361:[function(e,t,r){"use strict";t.exports=o;var n=e("./_stream_duplex"),i=Object.create(e("core-util-is"));function a(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",s)}function s(){var e=this;"function"==typeof this._flush?this._flush(function(t,r){c(e,t,r)}):c(this,null,null)}function c(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=e("inherits"),i.inherits(o,n),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},o.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,function(e){t(e),r.emit("close")})}},{"./_stream_duplex":358,"core-util-is":134,inherits:243}],362:[function(e,t,r){"use strict";var n=e("process-nextick-args");function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}t.exports=b;var a,o=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:n.nextTick;b.WritableState=m;var s=Object.create(e("core-util-is"));s.inherits=e("inherits");var c={deprecate:e("util-deprecate")},u=e("./internal/streams/stream"),d=e("safe-buffer").Buffer,l=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var f,p=e("./internal/streams/destroy");function h(){}function m(t,r){a=a||e("./_stream_duplex"),t=t||{};var s=r instanceof a;this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var c=t.highWaterMark,u=t.writableHighWaterMark,d=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:s&&(u||0===u)?u:d,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,a=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,a){--t.pendingcb,r?(n.nextTick(a,i),n.nextTick(k,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(a(i),e._writableState.errorEmitted=!0,e.emit("error",i),k(e,t))}(e,r,i,t,a);else{var s=_(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||y(e,r),i?o(g,e,r,s,a):g(e,r,s,a)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function b(t){if(a=a||e("./_stream_duplex"),!(f.call(b,this)||this instanceof a))return new b(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function v(e,t,r,n,i,a,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function g(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),k(e,t)}function y(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,a=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)a[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;a.allBuffers=c,v(e,t,!0,t.length,a,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,d=r.encoding,l=r.callback;if(v(e,t,!1,t.objectMode?1:u.length,u,d,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function _(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),k(e,t)})}function k(e,t){var r=_(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,n.nextTick(w,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}s.inherits(b,u),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===b&&(e&&e._writableState instanceof m)}})):f=function(e){return e instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(e,t,r){var i,a=this._writableState,o=!1,s=!a.objectMode&&(i=e,d.isBuffer(i)||i instanceof l);return s&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=h),a.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),n.nextTick(t,r)}(this,r):(s||function(e,t,r,i){var a=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),n.nextTick(i,o),a=!1),a}(this,a,e,r))&&(a.pendingcb++,o=function(e,t,r,n,i,a){if(!r){var o=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,r));return t}(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var s=t.objectMode?1:n.length;t.length+=s;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:a,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else v(e,t,!1,s,n,i,a);return c}(this,a,s,e,t,r)),o},b.prototype.cork=function(){this._writableState.corked++},b.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||y(this,e))},b.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,r){t.ending=!0,k(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=p.destroy,b.prototype._undestroy=p.undestroy,b.prototype._destroy=function(e,t){this.end(),t(e)}},{"./_stream_duplex":358,"./internal/streams/destroy":364,"./internal/streams/stream":365,"core-util-is":134,inherits:243,"process-nextick-args":349,"safe-buffer":367,"util-deprecate":435}],363:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("util");function a(e,t,r){e.copy(t,r)}t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);for(var t=n.allocUnsafe(e>>>0),r=this.head,i=0;r;)a(r.data,t,i),i+=r.data.length,r=r.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":367,util:92}],364:[function(e,t,r){"use strict";var n=e("process-nextick-args");function i(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(i,this,e)):n.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":349}],365:[function(e,t,r){arguments[4][296][0].apply(r,arguments)},{dup:296,events:205}],366:[function(e,t,r){arguments[4][249][0].apply(r,arguments)},{dup:249}],367:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(a(n,r),r.Buffer=o),a(i,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:124}],368:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=d,this.end=l,t=3;break;default:return this.write=f,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function d(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}r.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},a.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},a.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=o(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if(i=o(t[n]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if(i=o(t[n]),i>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":367}],369:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":358,"./lib/_stream_passthrough.js":359,"./lib/_stream_readable.js":360,"./lib/_stream_transform.js":361,"./lib/_stream_writable.js":362}],370:[function(e,t,r){"use strict";var n=e("buffer").Buffer,i=e("inherits"),a=e("hash-base"),o=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],c=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],d=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],l=[0,1518500249,1859775393,2400959708,2840853838],f=[1352829926,1548603684,1836072691,2053994217,0];function p(){a.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function h(e,t){return e<<t|e>>>32-t}function m(e,t,r,n,i,a,o,s){return h(e+(t^r^n)+a+o|0,s)+i|0}function b(e,t,r,n,i,a,o,s){return h(e+(t&r|~t&n)+a+o|0,s)+i|0}function v(e,t,r,n,i,a,o,s){return h(e+((t|~r)^n)+a+o|0,s)+i|0}function g(e,t,r,n,i,a,o,s){return h(e+(t&n|r&~n)+a+o|0,s)+i|0}function y(e,t,r,n,i,a,o,s){return h(e+(t^(r|~n))+a+o|0,s)+i|0}i(p,a),p.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,a=0|this._d,p=0|this._e,_=0|this._a,w=0|this._b,k=0|this._c,S=0|this._d,x=0|this._e,E=0;E<80;E+=1){var P,R;E<16?(P=m(r,n,i,a,p,e[s[E]],l[0],u[E]),R=y(_,w,k,S,x,e[c[E]],f[0],d[E])):E<32?(P=b(r,n,i,a,p,e[s[E]],l[1],u[E]),R=g(_,w,k,S,x,e[c[E]],f[1],d[E])):E<48?(P=v(r,n,i,a,p,e[s[E]],l[2],u[E]),R=v(_,w,k,S,x,e[c[E]],f[2],d[E])):E<64?(P=g(r,n,i,a,p,e[s[E]],l[3],u[E]),R=b(_,w,k,S,x,e[c[E]],f[3],d[E])):(P=y(r,n,i,a,p,e[s[E]],l[4],u[E]),R=m(_,w,k,S,x,e[c[E]],f[4],d[E])),r=p,p=a,a=h(i,10),i=n,n=P,_=x,x=S,S=h(k,10),k=w,w=R}var M=this._b+i+S|0;this._b=this._c+a+x|0,this._c=this._d+p+_|0,this._d=this._e+r+w|0,this._e=this._a+n+k|0,this._a=M},p.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},t.exports=p},{buffer:124,"hash-base":371,inherits:243}],371:[function(e,t,r){arguments[4][282][0].apply(r,arguments)},{dup:282,inherits:243,"readable-stream":386,"safe-buffer":387}],372:[function(e,t,r){arguments[4][283][0].apply(r,arguments)},{dup:283}],373:[function(e,t,r){arguments[4][284][0].apply(r,arguments)},{"./_stream_readable":375,"./_stream_writable":377,dup:284,inherits:243}],374:[function(e,t,r){arguments[4][285][0].apply(r,arguments)},{"./_stream_transform":376,dup:285,inherits:243}],375:[function(e,t,r){arguments[4][286][0].apply(r,arguments)},{"../errors":372,"./_stream_duplex":373,"./internal/streams/async_iterator":378,"./internal/streams/buffer_list":379,"./internal/streams/destroy":380,"./internal/streams/from":382,"./internal/streams/state":384,"./internal/streams/stream":385,buffer:124,dup:286,events:205,inherits:243,"string_decoder/":430,util:92}],376:[function(e,t,r){arguments[4][287][0].apply(r,arguments)},{"../errors":372,"./_stream_duplex":373,dup:287,inherits:243}],377:[function(e,t,r){arguments[4][288][0].apply(r,arguments)},{"../errors":372,"./_stream_duplex":373,"./internal/streams/destroy":380,"./internal/streams/state":384,"./internal/streams/stream":385,buffer:124,dup:288,inherits:243,"util-deprecate":435}],378:[function(e,t,r){arguments[4][289][0].apply(r,arguments)},{"./end-of-stream":381,dup:289}],379:[function(e,t,r){arguments[4][290][0].apply(r,arguments)},{buffer:124,dup:290,util:92}],380:[function(e,t,r){arguments[4][291][0].apply(r,arguments)},{dup:291}],381:[function(e,t,r){arguments[4][292][0].apply(r,arguments)},{"../../../errors":372,dup:292}],382:[function(e,t,r){arguments[4][293][0].apply(r,arguments)},{dup:293}],383:[function(e,t,r){arguments[4][294][0].apply(r,arguments)},{"../../../errors":372,"./end-of-stream":381,dup:294}],384:[function(e,t,r){arguments[4][295][0].apply(r,arguments)},{"../../../errors":372,dup:295}],385:[function(e,t,r){arguments[4][296][0].apply(r,arguments)},{dup:296,events:205}],386:[function(e,t,r){arguments[4][297][0].apply(r,arguments)},{"./lib/_stream_duplex.js":373,"./lib/_stream_passthrough.js":374,"./lib/_stream_readable.js":375,"./lib/_stream_transform.js":376,"./lib/_stream_writable.js":377,"./lib/internal/streams/end-of-stream.js":381,"./lib/internal/streams/pipeline.js":383,dup:297}],387:[function(e,t,r){
22
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
23
- var n=e("buffer"),i=n.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(a(n,r),r.Buffer=o),o.prototype=Object.create(i.prototype),a(i,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:124}],388:[function(e,t,r){"use strict";var n=e("call-bound"),i=e("is-regex"),a=n("RegExp.prototype.exec"),o=e("es-errors/type");t.exports=function(e){if(!i(e))throw new o("`regex` must be a RegExp");return function(t){return null!==a(e,t)}}},{"call-bound":132,"es-errors/type":201,"is-regex":247}],389:[function(e,t,r){var n=t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(n).forEach(function(e){n[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},{}],390:[function(e,t,r){var n=e("./parser"),i=e("./writer"),a=e("./grammar");r.grammar=a,r.write=i,r.parse=n.parse,r.parseParams=n.parseParams,r.parseFmtpConfig=n.parseFmtpConfig,r.parsePayloads=n.parsePayloads,r.parseRemoteCandidates=n.parseRemoteCandidates,r.parseImageAttributes=n.parseImageAttributes,r.parseSimulcastStreamList=n.parseSimulcastStreamList},{"./grammar":389,"./parser":391,"./writer":392}],391:[function(e,t,r){var n=function(e){return String(Number(e))===e?Number(e):e},i=function(e,t,r){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:i?t[e.name]:t;!function(e,t,r,i){if(i&&!r)t[i]=n(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(t[r[a]]=n(e[a+1]))}(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},a=e("./grammar"),o=RegExp.prototype.test.bind(/^([a-z])=(.*)/);r.parse=function(e){var t={},r=[],n=t;return e.split(/(\r\n|\r|\n)/).filter(o).forEach(function(e){var t=e[0],o=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),n=r[r.length-1]);for(var s=0;s<(a[t]||[]).length;s+=1){var c=a[t][s];if(c.reg.test(o))return i(c,n,o)}}),t.media=r,t};var s=function(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=n(r[1]):1===r.length&&t.length>1&&(e[r[0]]=void 0),e};r.parseParams=function(e){return e.split(/;\s?/).reduce(s,{})},r.parseFmtpConfig=r.parseParams,r.parsePayloads=function(e){return e.toString().split(" ").map(Number)},r.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(n),i=0;i<r.length;i+=3)t.push({component:r[i],ip:r[i+1],port:r[i+2]});return t},r.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(s,{})})},r.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,r=!1;return"~"!==e[0]?t=n(e):(t=n(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}},{"./grammar":389}],392:[function(e,t,r){var n=e("./grammar"),i=/%[sdv%]/g,a=function(e){var t=1,r=arguments,n=r.length;return e.replace(i,function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}})},o=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return a.apply(null,n)},s=["v","o","s","i","u","e","p","c","b","t","r","z","a"],c=["i","c","b","a"];t.exports=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var r=t.outerOrder||s,i=t.innerOrder||c,a=[];return r.forEach(function(t){n[t].forEach(function(r){r.name in e&&null!=e[r.name]?a.push(o(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach(function(e){a.push(o(t,r,e))})})}),e.media.forEach(function(e){a.push(o("m",n.m[0],e)),i.forEach(function(t){n[t].forEach(function(r){r.name in e&&null!=e[r.name]?a.push(o(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach(function(e){a.push(o(t,r,e))})})})}),a.join("\r\n")+"\r\n"}},{"./grammar":389}],393:[function(e,t,r){"use strict";var n=e("get-intrinsic"),i=e("define-data-property"),a=e("has-property-descriptors")(),o=e("gopd"),s=e("es-errors/type"),c=n("%Math.floor%");t.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&o){var d=o(e,"length");d&&!d.configurable&&(n=!1),d&&!d.writable&&(u=!1)}return(n||u||!r)&&(a?i(e,"length",t,!0,!0):i(e,"length",t)),e}},{"define-data-property":144,"es-errors/type":201,"get-intrinsic":214,gopd:219,"has-property-descriptors":224}],394:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("to-buffer");function a(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}a.prototype.update=function(e,t){e=i(e,t||"utf8");for(var r=this._block,n=this._blockSize,a=e.length,o=this._len,s=0;s<a;){for(var c=o%n,u=Math.min(a-s,n-c),d=0;d<u;d++)r[c+d]=e[s+d];s+=u,(o+=u)%n===0&&this._update(r)}return this._len+=a,this},a.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},a.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=a},{"safe-buffer":387,"to-buffer":431}],395:[function(e,t,r){"use strict";t.exports=function(e){var r=e.toLowerCase(),n=t.exports[r];if(!n)throw new Error(r+" is not supported (we accept pull requests)");return new n},t.exports.sha=e("./sha"),t.exports.sha1=e("./sha1"),t.exports.sha224=e("./sha224"),t.exports.sha256=e("./sha256"),t.exports.sha384=e("./sha384"),t.exports.sha512=e("./sha512")},{"./sha":396,"./sha1":397,"./sha224":398,"./sha256":399,"./sha384":400,"./sha512":401}],396:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),a=e("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function c(){this.init(),this._w=s,i.call(this,64,56)}function u(e){return e<<5|e>>>27}function d(e){return e<<30|e>>>2}function l(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,a=0|this._d,s=0|this._e,c=0;c<16;++c)t[c]=e.readInt32BE(4*c);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var f=0;f<80;++f){var p=~~(f/20),h=u(r)+l(p,n,i,a)+s+t[f]+o[p]|0;s=a,a=i,i=d(n),n=r,r=h}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},c.prototype._hash=function(){var e=a.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=c},{"./hash":394,inherits:243,"safe-buffer":387}],397:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),a=e("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function c(){this.init(),this._w=s,i.call(this,64,56)}function u(e){return e<<1|e>>>31}function d(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function f(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,a=0|this._d,s=0|this._e,c=0;c<16;++c)t[c]=e.readInt32BE(4*c);for(;c<80;++c)t[c]=u(t[c-3]^t[c-8]^t[c-14]^t[c-16]);for(var p=0;p<80;++p){var h=~~(p/20),m=d(r)+f(h,n,i,a)+s+t[p]+o[h]|0;s=a,a=i,i=l(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},c.prototype._hash=function(){var e=a.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=c},{"./hash":394,inherits:243,"safe-buffer":387}],398:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./sha256"),a=e("./hash"),o=e("safe-buffer").Buffer,s=new Array(64);function c(){this.init(),this._w=s,a.call(this,64,56)}n(c,i),c.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},c.prototype._hash=function(){var e=o.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=c},{"./hash":394,"./sha256":399,inherits:243,"safe-buffer":387}],399:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),a=e("safe-buffer").Buffer,o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function c(){this.init(),this._w=s,i.call(this,64,56)}function u(e,t,r){return r^e&(t^r)}function d(e,t,r){return e&t|r&(e|t)}function l(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function p(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function h(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}n(c,i),c.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},c.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,a=0|this._d,s=0|this._e,c=0|this._f,m=0|this._g,b=0|this._h,v=0;v<16;++v)t[v]=e.readInt32BE(4*v);for(;v<64;++v)t[v]=h(t[v-2])+t[v-7]+p(t[v-15])+t[v-16]|0;for(var g=0;g<64;++g){var y=b+f(s)+u(s,c,m)+o[g]+t[g]|0,_=l(r)+d(r,n,i)|0;b=m,m=c,c=s,s=a+y|0,a=i,i=n,n=r,r=y+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=c+this._f|0,this._g=m+this._g|0,this._h=b+this._h|0},c.prototype._hash=function(){var e=a.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=c},{"./hash":394,inherits:243,"safe-buffer":387}],400:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./sha512"),a=e("./hash"),o=e("safe-buffer").Buffer,s=new Array(160);function c(){this.init(),this._w=s,a.call(this,128,112)}n(c,i),c.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},c.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},t.exports=c},{"./hash":394,"./sha512":401,inherits:243,"safe-buffer":387}],401:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),a=e("safe-buffer").Buffer,o=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function c(){this.init(),this._w=s,i.call(this,128,112)}function u(e,t,r){return r^e&(t^r)}function d(e,t,r){return e&t|r&(e|t)}function l(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function h(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function b(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function v(e,t){return e>>>0<t>>>0?1:0}n(c,i),c.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},c.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,a=0|this._dh,s=0|this._eh,c=0|this._fh,g=0|this._gh,y=0|this._hh,_=0|this._al,w=0|this._bl,k=0|this._cl,S=0|this._dl,x=0|this._el,E=0|this._fl,P=0|this._gl,R=0|this._hl,M=0;M<32;M+=2)t[M]=e.readInt32BE(4*M),t[M+1]=e.readInt32BE(4*M+4);for(;M<160;M+=2){var C=t[M-30],T=t[M-30+1],A=p(C,T),I=h(T,C),O=m(C=t[M-4],T=t[M-4+1]),j=b(T,C),D=t[M-14],L=t[M-14+1],B=t[M-32],N=t[M-32+1],F=I+L|0,U=A+D+v(F,I)|0;U=(U=U+O+v(F=F+j|0,j)|0)+B+v(F=F+N|0,N)|0,t[M]=U,t[M+1]=F}for(var q=0;q<160;q+=2){U=t[q],F=t[q+1];var z=d(r,n,i),V=d(_,w,k),W=l(r,_),G=l(_,r),H=f(s,x),K=f(x,s),$=o[q],J=o[q+1],Y=u(s,c,g),X=u(x,E,P),Z=R+K|0,Q=y+H+v(Z,R)|0;Q=(Q=(Q=Q+Y+v(Z=Z+X|0,X)|0)+$+v(Z=Z+J|0,J)|0)+U+v(Z=Z+F|0,F)|0;var ee=G+V|0,te=W+z+v(ee,G)|0;y=g,R=P,g=c,P=E,c=s,E=x,s=a+Q+v(x=S+Z|0,S)|0,a=i,S=k,i=n,k=w,n=r,w=_,r=Q+te+v(_=Z+ee|0,Z)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+k|0,this._dl=this._dl+S|0,this._el=this._el+x|0,this._fl=this._fl+E|0,this._gl=this._gl+P|0,this._hl=this._hl+R|0,this._ah=this._ah+r+v(this._al,_)|0,this._bh=this._bh+n+v(this._bl,w)|0,this._ch=this._ch+i+v(this._cl,k)|0,this._dh=this._dh+a+v(this._dl,S)|0,this._eh=this._eh+s+v(this._el,x)|0,this._fh=this._fh+c+v(this._fl,E)|0,this._gh=this._gh+g+v(this._gl,P)|0,this._hh=this._hh+y+v(this._hl,R)|0},c.prototype._hash=function(){var e=a.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},t.exports=c},{"./hash":394,inherits:243,"safe-buffer":387}],402:[function(e,t,r){"use strict";function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Object.defineProperty(r,"__esModule",{value:!0}),r.Backoff=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+r:e-r}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},{}],403:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.WebTransport=r.WebSocket=r.NodeWebSocket=r.XHR=r.NodeXHR=r.Fetch=r.Socket=r.Manager=r.protocol=void 0,r.io=u,r.connect=u,r.default=u;const i=e("./url.js"),a=e("./manager.js");Object.defineProperty(r,"Manager",{enumerable:!0,get:function(){return a.Manager}});const o=e("./socket.js");Object.defineProperty(r,"Socket",{enumerable:!0,get:function(){return o.Socket}});const s=(0,n(e("debug")).default)("socket.io-client"),c={};function u(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};const r=(0,i.url)(e,t.path||"/socket.io"),n=r.source,o=r.id,u=r.path,d=c[o]&&u in c[o].nsps;let l;return t.forceNew||t["force new connection"]||!1===t.multiplex||d?(s("ignoring socket cache for %s",n),l=new a.Manager(n,t)):(c[o]||(s("new io instance for %s",n),c[o]=new a.Manager(n,t)),l=c[o]),r.query&&!t.query&&(t.query=r.queryKey),l.socket(r.path,t)}Object.assign(u,{Manager:a.Manager,Socket:o.Socket,io:u,connect:u});var d=e("socket.io-parser");Object.defineProperty(r,"protocol",{enumerable:!0,get:function(){return d.protocol}});var l=e("engine.io-client");Object.defineProperty(r,"Fetch",{enumerable:!0,get:function(){return l.Fetch}}),Object.defineProperty(r,"NodeXHR",{enumerable:!0,get:function(){return l.NodeXHR}}),Object.defineProperty(r,"XHR",{enumerable:!0,get:function(){return l.XHR}}),Object.defineProperty(r,"NodeWebSocket",{enumerable:!0,get:function(){return l.NodeWebSocket}}),Object.defineProperty(r,"WebSocket",{enumerable:!0,get:function(){return l.WebSocket}}),Object.defineProperty(r,"WebTransport",{enumerable:!0,get:function(){return l.WebTransport}}),t.exports=u},{"./manager.js":404,"./socket.js":406,"./url.js":407,debug:408,"engine.io-client":178,"socket.io-parser":411}],404:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Manager=void 0;const s=e("engine.io-client"),c=e("./socket.js"),u=a(e("socket.io-parser")),d=e("./on.js"),l=e("./contrib/backo2.js"),f=e("@socket.io/component-emitter"),p=(0,o(e("debug")).default)("socket.io-client:manager");class h extends f.Emitter{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,(0,s.installTimerFunctions)(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=t.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new l.Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const n=t.parser||u;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(p("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;p("opening %s",this.uri),this.engine=new s.Socket(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=(0,d.on)(t,"open",function(){r.onopen(),e&&e()}),i=t=>{p("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},a=(0,d.on)(t,"error",i);if(!1!==this._timeout){const e=this._timeout;p("connect attempt will timeout after %d",e);const r=this.setTimeoutFn(()=>{p("connect attempt timed out after %d",e),n(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}return this.subs.push(n),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){p("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push((0,d.on)(e,"ping",this.onping.bind(this)),(0,d.on)(e,"data",this.ondata.bind(this)),(0,d.on)(e,"error",this.onerror.bind(this)),(0,d.on)(e,"close",this.onclose.bind(this)),(0,d.on)(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){(0,s.nextTick)(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){p("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new c.Socket(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return void p("socket %s is still active, skipping close",e)}this._close()}_packet(e){p("writing packet %j",e);const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){p("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){p("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var r;p("closed due to %s",e),this.cleanup(),null===(r=this.engine)||void 0===r||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)p("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();p("will wait %dms before reconnect attempt",t),this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(p("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(p("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):(p("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}r.Manager=h},{"./contrib/backo2.js":402,"./on.js":405,"./socket.js":406,"@socket.io/component-emitter":64,debug:408,"engine.io-client":178,"socket.io-parser":411}],405:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.on=function(e,t,r){return e.on(t,r),function(){e.off(t,r)}}},{}],406:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Socket=void 0;const i=e("socket.io-parser"),a=e("./on.js"),o=e("@socket.io/component-emitter"),s=(0,n(e("debug")).default)("socket.io-client:socket"),c=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class u extends o.Emitter{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[(0,a.on)(e,"open",this.onopen.bind(this)),(0,a.on)(e,"packet",this.onpacket.bind(this)),(0,a.on)(e,"error",this.onerror.bind(this)),(0,a.on)(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var r,n,a;if(c.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:i.PacketType.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++;s("emitting packet with ack id %d",e);const r=t.pop();this._registerAckCallback(e,r),o.id=e}const u=null===(n=null===(r=this.io.engine)||void 0===r?void 0:r.transport)||void 0===n?void 0:n.writable,d=this.connected&&!(null===(a=this.io.engine)||void 0===a?void 0:a._hasPingExpired());return this.flags.volatile&&!u?s("discard packet as the transport is not currently writable"):d?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o),this.flags={},this}_registerAckCallback(e,t){var r;const n=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===n)return void(this.acks[e]=t);const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&(s("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(t,1));s("event with ack id %d has timed out after %d ms",e,n),t.call(this,new Error("operation has timed out"))},n),a=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...t){return new Promise((r,n)=>{const i=(e,t)=>e?n(e):r(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...n)=>{if(r!==this._queue[0])return;return null!==e?r.tryCount>this._opts.retries&&(s("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(e)):(s("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue()}),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(s("draining queue"),!this.connected||0===this._queue.length)return;const t=this._queue[0];!t.pending||e?(t.pending=!0,t.tryCount++,s("sending packet [%d] (try n°%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)):s("packet [%d] has already been sent and is waiting for an ack",t.id)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){s("transport is open - connecting"),"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:i.PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){s("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case i.PacketType.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case i.PacketType.EVENT:case i.PacketType.BINARY_EVENT:this.onevent(e);break;case i.PacketType.ACK:case i.PacketType.BINARY_ACK:this.onack(e);break;case i.PacketType.DISCONNECT:this.ondisconnect();break;case i.PacketType.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];s("emitting event %j",t),null!=e.id&&(s("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...n){r||(r=!0,s("sending ack %j",n),t.packet({type:i.PacketType.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t?(delete this.acks[e.id],s("calling ack %s with %j",e.id,e.data),t.withError&&e.data.unshift(null),t.apply(this,e.data)):s("bad ack %s",e.id)}onconnect(e,t){s("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){s("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(s("performing disconnect (%s)",this.nsp),this.packet({type:i.PacketType.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}r.Socket=u},{"./on.js":405,"@socket.io/component-emitter":64,debug:408,"socket.io-parser":411}],407:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.url=function(e,t="",r){let n=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(a("protocol-less url %s",e),e=void 0!==r?r.protocol+"//"+e:"https://"+e),a("parse %s",e),n=(0,i.parse)(e));n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443"));n.path=n.path||"/";const o=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+t,n.href=n.protocol+"://"+o+(r&&r.port===n.port?"":":"+n.port),n};const i=e("engine.io-client"),a=(0,n(e("debug")).default)("socket.io-client:url")},{debug:408,"engine.io-client":178}],408:[function(e,t,r){arguments[4][188][0].apply(r,arguments)},{"./common":409,dup:188}],409:[function(e,t,r){arguments[4][189][0].apply(r,arguments)},{dup:189,ms:330}],410:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.reconstructPacket=r.deconstructPacket=void 0;const n=e("./is-binary.js");function i(e,t){if(!e)return e;if((0,n.isBinary)(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}if(Array.isArray(e)){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=i(e[n],t);return r}if("object"==typeof e&&!(e instanceof Date)){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=i(e[n],t));return r}return e}function a(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=a(e[r],t);else if("object"==typeof e)for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=a(e[r],t));return e}r.deconstructPacket=function(e){const t=[],r=e.data,n=e;return n.data=i(r,t),n.attachments=t.length,{packet:n,buffers:t}},r.reconstructPacket=function(e,t){return e.data=a(e.data,t),delete e.attachments,e}},{"./is-binary.js":412}],411:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Decoder=r.Encoder=r.PacketType=r.protocol=void 0;const n=e("@socket.io/component-emitter"),i=e("./binary.js"),a=e("./is-binary.js"),o=(0,e("debug").default)("socket.io-parser"),s=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var c;r.protocol=5,function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(c=r.PacketType||(r.PacketType={}));function u(e){return"[object Object]"===Object.prototype.toString.call(e)}r.Encoder=class{constructor(e){this.replacer=e}encode(e){return o("encoding packet %j",e),e.type!==c.EVENT&&e.type!==c.ACK||!(0,a.hasBinary)(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==c.BINARY_EVENT&&e.type!==c.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),o("encoded %j as %s",e,t),t}encodeAsBinary(e){const t=(0,i.deconstructPacket)(e),r=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(r),n}};class d extends n.Emitter{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===c.BINARY_EVENT;r||t.type===c.BINARY_ACK?(t.type=r?c.EVENT:c.ACK,this.reconstructor=new l(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!(0,a.isBinary)(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(void 0===c[r.type])throw new Error("unknown packet type "+r.type);if(r.type===c.BINARY_EVENT||r.type===c.BINARY_ACK){const n=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(n,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");r.attachments=Number(i)}if("/"===e.charAt(t+1)){const n=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}r.nsp=e.substring(n,t)}else r.nsp="/";const n=e.charAt(t+1);if(""!==n&&Number(n)==n){const n=t+1;for(;++t;){const r=e.charAt(t);if(null==r||Number(r)!=r){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(!d.isPayloadValid(r.type,n))throw new Error("invalid payload");r.data=n}return o("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case c.CONNECT:return u(t);case c.DISCONNECT:return void 0===t;case c.CONNECT_ERROR:return"string"==typeof t||u(t);case c.EVENT:case c.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===s.indexOf(t[0]));case c.ACK:case c.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}r.Decoder=d;class l{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=(0,i.reconstructPacket)(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}},{"./binary.js":410,"./is-binary.js":412,"@socket.io/component-emitter":64,debug:413}],412:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hasBinary=r.isBinary=void 0;const n="function"==typeof ArrayBuffer,i=Object.prototype.toString,a="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),o="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);function s(e){return n&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||a&&e instanceof Blob||o&&e instanceof File}r.isBinary=s,r.hasBinary=function e(t,r){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(e(t[r]))return!0;return!1}if(s(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return e(t.toJSON(),!0);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return!0;return!1}},{}],413:[function(e,t,r){arguments[4][188][0].apply(r,arguments)},{"./common":414,dup:188}],414:[function(e,t,r){arguments[4][189][0].apply(r,arguments)},{dup:189,ms:330}],415:[function(e,t,r){t.exports=i;var n=e("events").EventEmitter;function i(){n.call(this)}e("inherits")(i,n),i.Readable=e("readable-stream/lib/_stream_readable.js"),i.Writable=e("readable-stream/lib/_stream_writable.js"),i.Duplex=e("readable-stream/lib/_stream_duplex.js"),i.Transform=e("readable-stream/lib/_stream_transform.js"),i.PassThrough=e("readable-stream/lib/_stream_passthrough.js"),i.finished=e("readable-stream/lib/internal/streams/end-of-stream.js"),i.pipeline=e("readable-stream/lib/internal/streams/pipeline.js"),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",a),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",c));var o=!1;function s(){o||(o=!0,e.end())}function c(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(d(),0===n.listenerCount(this,"error"))throw e}function d(){r.removeListener("data",i),e.removeListener("drain",a),r.removeListener("end",s),r.removeListener("close",c),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d)}return r.on("error",u),e.on("error",u),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e}},{events:205,inherits:243,"readable-stream/lib/_stream_duplex.js":417,"readable-stream/lib/_stream_passthrough.js":418,"readable-stream/lib/_stream_readable.js":419,"readable-stream/lib/_stream_transform.js":420,"readable-stream/lib/_stream_writable.js":421,"readable-stream/lib/internal/streams/end-of-stream.js":425,"readable-stream/lib/internal/streams/pipeline.js":427}],416:[function(e,t,r){arguments[4][283][0].apply(r,arguments)},{dup:283}],417:[function(e,t,r){arguments[4][284][0].apply(r,arguments)},{"./_stream_readable":419,"./_stream_writable":421,dup:284,inherits:243}],418:[function(e,t,r){arguments[4][285][0].apply(r,arguments)},{"./_stream_transform":420,dup:285,inherits:243}],419:[function(e,t,r){arguments[4][286][0].apply(r,arguments)},{"../errors":416,"./_stream_duplex":417,"./internal/streams/async_iterator":422,"./internal/streams/buffer_list":423,"./internal/streams/destroy":424,"./internal/streams/from":426,"./internal/streams/state":428,"./internal/streams/stream":429,buffer:124,dup:286,events:205,inherits:243,"string_decoder/":430,util:92}],420:[function(e,t,r){arguments[4][287][0].apply(r,arguments)},{"../errors":416,"./_stream_duplex":417,dup:287,inherits:243}],421:[function(e,t,r){arguments[4][288][0].apply(r,arguments)},{"../errors":416,"./_stream_duplex":417,"./internal/streams/destroy":424,"./internal/streams/state":428,"./internal/streams/stream":429,buffer:124,dup:288,inherits:243,"util-deprecate":435}],422:[function(e,t,r){arguments[4][289][0].apply(r,arguments)},{"./end-of-stream":425,dup:289}],423:[function(e,t,r){arguments[4][290][0].apply(r,arguments)},{buffer:124,dup:290,util:92}],424:[function(e,t,r){arguments[4][291][0].apply(r,arguments)},{dup:291}],425:[function(e,t,r){arguments[4][292][0].apply(r,arguments)},{"../../../errors":416,dup:292}],426:[function(e,t,r){arguments[4][293][0].apply(r,arguments)},{dup:293}],427:[function(e,t,r){arguments[4][294][0].apply(r,arguments)},{"../../../errors":416,"./end-of-stream":425,dup:294}],428:[function(e,t,r){arguments[4][295][0].apply(r,arguments)},{"../../../errors":416,dup:295}],429:[function(e,t,r){arguments[4][296][0].apply(r,arguments)},{dup:296,events:205}],430:[function(e,t,r){arguments[4][368][0].apply(r,arguments)},{dup:368,"safe-buffer":387}],431:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("isarray"),a=e("typed-array-buffer"),o=ArrayBuffer.isView||function(e){try{return a(e),!0}catch(e){return!1}},s="undefined"!=typeof Uint8Array,c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,u=c&&(n.prototype instanceof Uint8Array||n.TYPED_ARRAY_SUPPORT);t.exports=function(e,t){if(e instanceof n)return e;if("string"==typeof e)return n.from(e,t);if(c&&o(e)){if(0===e.byteLength)return n.alloc(0);if(u){var r=n.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}var a=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),d=n.from(a);if(d.length===e.byteLength)return d}if(s&&e instanceof Uint8Array)return n.from(e);var l=i(e);if(l)for(var f=0;f<e.length;f+=1){var p=e[f];if("number"!=typeof p||p<0||p>255||~~p!==p)throw new RangeError("Array items must be numbers in the range 0-255.")}if(l||n.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return n.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}},{isarray:249,"safe-buffer":387,"typed-array-buffer":432}],432:[function(e,t,r){"use strict";var n=e("es-errors/type"),i=e("call-bound")("TypedArray.prototype.buffer",!0),a=e("is-typed-array");t.exports=i||function(e){if(!a(e))throw new n("Not a Typed Array");return e.buffer}},{"call-bound":132,"es-errors/type":201,"is-typed-array":248}],433:[function(e,t,r){"use strict";const n=e("unique-random");t.exports=e=>{const t=n(0,e.length-1);return()=>e[t()]}},{"unique-random":434}],434:[function(e,t,r){"use strict";t.exports=(e,t)=>{let r;return function n(){const i=Math.floor(Math.random()*(t-e+1)+e);return r=i===r&&e!==t?n():i,r}}},{}],435:[function(e,t,r){function n(e){try{if(!global.localStorage)return!1}catch(e){return!1}var t=global.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},{}],436:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],437:[function(e,t,r){"use strict";var n=e("is-arguments"),i=e("is-generator-function"),a=e("which-typed-array"),o=e("is-typed-array");function s(e){return e.call.bind(e)}var c="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,d=s(Object.prototype.toString),l=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),p=s(Boolean.prototype.valueOf);if(c)var h=s(BigInt.prototype.valueOf);if(u)var m=s(Symbol.prototype.valueOf);function b(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function v(e){return"[object Map]"===d(e)}function g(e){return"[object Set]"===d(e)}function y(e){return"[object WeakMap]"===d(e)}function _(e){return"[object WeakSet]"===d(e)}function w(e){return"[object ArrayBuffer]"===d(e)}function k(e){return"undefined"!=typeof ArrayBuffer&&(w.working?w(e):e instanceof ArrayBuffer)}function S(e){return"[object DataView]"===d(e)}function x(e){return"undefined"!=typeof DataView&&(S.working?S(e):e instanceof DataView)}r.isArgumentsObject=n,r.isGeneratorFunction=i,r.isTypedArray=o,r.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},r.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):o(e)||x(e)},r.isUint8Array=function(e){return"Uint8Array"===a(e)},r.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===a(e)},r.isUint16Array=function(e){return"Uint16Array"===a(e)},r.isUint32Array=function(e){return"Uint32Array"===a(e)},r.isInt8Array=function(e){return"Int8Array"===a(e)},r.isInt16Array=function(e){return"Int16Array"===a(e)},r.isInt32Array=function(e){return"Int32Array"===a(e)},r.isFloat32Array=function(e){return"Float32Array"===a(e)},r.isFloat64Array=function(e){return"Float64Array"===a(e)},r.isBigInt64Array=function(e){return"BigInt64Array"===a(e)},r.isBigUint64Array=function(e){return"BigUint64Array"===a(e)},v.working="undefined"!=typeof Map&&v(new Map),r.isMap=function(e){return"undefined"!=typeof Map&&(v.working?v(e):e instanceof Map)},g.working="undefined"!=typeof Set&&g(new Set),r.isSet=function(e){return"undefined"!=typeof Set&&(g.working?g(e):e instanceof Set)},y.working="undefined"!=typeof WeakMap&&y(new WeakMap),r.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(y.working?y(e):e instanceof WeakMap)},_.working="undefined"!=typeof WeakSet&&_(new WeakSet),r.isWeakSet=function(e){return _(e)},w.working="undefined"!=typeof ArrayBuffer&&w(new ArrayBuffer),r.isArrayBuffer=k,S.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&S(new DataView(new ArrayBuffer(1),0,1)),r.isDataView=x;var E="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function P(e){return"[object SharedArrayBuffer]"===d(e)}function R(e){return void 0!==E&&(void 0===P.working&&(P.working=P(new E)),P.working?P(e):e instanceof E)}function M(e){return b(e,l)}function C(e){return b(e,f)}function T(e){return b(e,p)}function A(e){return c&&b(e,h)}function I(e){return u&&b(e,m)}r.isSharedArrayBuffer=R,r.isAsyncFunction=function(e){return"[object AsyncFunction]"===d(e)},r.isMapIterator=function(e){return"[object Map Iterator]"===d(e)},r.isSetIterator=function(e){return"[object Set Iterator]"===d(e)},r.isGeneratorObject=function(e){return"[object Generator]"===d(e)},r.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===d(e)},r.isNumberObject=M,r.isStringObject=C,r.isBooleanObject=T,r.isBigIntObject=A,r.isSymbolObject=I,r.isBoxedPrimitive=function(e){return M(e)||C(e)||T(e)||A(e)||I(e)},r.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(k(e)||R(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(e){Object.defineProperty(r,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})})},{"is-arguments":244,"is-generator-function":246,"is-typed-array":248,"which-typed-array":461}],438:[function(e,t,r){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},i=/%[sdj%]/g;r.format=function(e){if(!g(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(c(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,a=n.length,o=String(e).replace(i,function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),s=n[r];r<a;s=n[++r])b(s)||!w(s)?o+=" "+s:o+=" "+c(s);return o},r.deprecate=function(e,t){if("undefined"!=typeof process&&!0===process.noDeprecation)return e;if("undefined"==typeof process)return function(){return r.deprecate(e,t).apply(this,arguments)};var n=!1;return function(){if(!n){if(process.throwDeprecation)throw new Error(t);process.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}};var a={},o=/^$/;if(process.env.NODE_DEBUG){var s=process.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}function c(e,t){var n={seen:[],stylize:d};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(t)?n.showHidden=t:t&&r._extend(n,t),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=c.styles[t];return r?"["+c.colors[r][0]+"m"+e+"["+c.colors[r][1]+"m":e}function d(e,t){return e}function l(e,t,n){if(e.customInspect&&t&&x(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return g(i)||(i=l(e,i,n)),i}var a=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(g(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(v(t))return e.stylize(""+t,"number");if(m(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}(e,t);if(a)return a;var o=Object.keys(t),s=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),S(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(t);if(0===o.length){if(x(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(_(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(k(t))return e.stylize(Date.prototype.toString.call(t),"date");if(S(t))return f(t)}var u,d="",w=!1,E=["{","}"];(h(t)&&(w=!0,E=["[","]"]),x(t))&&(d=" [Function"+(t.name?": "+t.name:"")+"]");return _(t)&&(d=" "+RegExp.prototype.toString.call(t)),k(t)&&(d=" "+Date.prototype.toUTCString.call(t)),S(t)&&(d=" "+f(t)),0!==o.length||w&&0!=t.length?n<0?_(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=w?function(e,t,r,n,i){for(var a=[],o=0,s=t.length;o<s;++o)M(t,String(o))?a.push(p(e,t,r,n,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(p(e,t,r,n,i,!0))}),a}(e,t,n,s,o):o.map(function(r){return p(e,t,n,s,r,w)}),e.seen.pop(),function(e,t,r){var n=e.reduce(function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(n>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,d,E)):E[0]+d+E[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,a){var o,s,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),M(n,i)||(o="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=b(r)?l(e,c.value,null):l(e,c.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").slice(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),y(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function b(e){return null===e}function v(e){return"number"==typeof e}function g(e){return"string"==typeof e}function y(e){return void 0===e}function _(e){return w(e)&&"[object RegExp]"===E(e)}function w(e){return"object"==typeof e&&null!==e}function k(e){return w(e)&&"[object Date]"===E(e)}function S(e){return w(e)&&("[object Error]"===E(e)||e instanceof Error)}function x(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function P(e){return e<10?"0"+e.toString(10):e.toString(10)}r.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(o.test(e)){var t=process.pid;a[e]=function(){var n=r.format.apply(r,arguments);console.error("%s %d: %s",e,t,n)}}else a[e]=function(){};return a[e]},r.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.types=e("./support/types"),r.isArray=h,r.isBoolean=m,r.isNull=b,r.isNullOrUndefined=function(e){return null==e},r.isNumber=v,r.isString=g,r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=y,r.isRegExp=_,r.types.isRegExp=_,r.isObject=w,r.isDate=k,r.types.isDate=k,r.isError=S,r.types.isNativeError=S,r.isFunction=x,r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e("./support/isBuffer");var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[P(e.getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":"),[e.getDate(),R[e.getMonth()],t].join(" ")),r.format.apply(r,arguments))},r.inherits=e("inherits"),r._extend=function(e,t){if(!t||!w(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var C="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function T(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}r.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(C&&e[C]){var t;if("function"!=typeof(t=e[C]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,C,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise(function(e,n){t=e,r=n}),i=[],a=0;a<arguments.length;a++)i.push(arguments[a]);i.push(function(e,n){e?r(e):t(n)});try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),C&&Object.defineProperty(t,C,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,n(e))},r.promisify.custom=C,r.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var n=t.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var i=this,a=function(){return n.apply(i,arguments)};e.apply(this,t).then(function(e){process.nextTick(a.bind(null,null,e))},function(e){process.nextTick(T.bind(null,e,a))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,n(e)),t}},{"./support/isBuffer":436,"./support/types":437,inherits:243}],439:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version=r.validate=r.v7=r.v6ToV1=r.v6=r.v5=r.v4=r.v3=r.v1ToV6=r.v1=r.stringify=r.parse=r.NIL=r.MAX=void 0;var n=e("./max.js");Object.defineProperty(r,"MAX",{enumerable:!0,get:function(){return n.default}});var i=e("./nil.js");Object.defineProperty(r,"NIL",{enumerable:!0,get:function(){return i.default}});var a=e("./parse.js");Object.defineProperty(r,"parse",{enumerable:!0,get:function(){return a.default}});var o=e("./stringify.js");Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return o.default}});var s=e("./v1.js");Object.defineProperty(r,"v1",{enumerable:!0,get:function(){return s.default}});var c=e("./v1ToV6.js");Object.defineProperty(r,"v1ToV6",{enumerable:!0,get:function(){return c.default}});var u=e("./v3.js");Object.defineProperty(r,"v3",{enumerable:!0,get:function(){return u.default}});var d=e("./v4.js");Object.defineProperty(r,"v4",{enumerable:!0,get:function(){return d.default}});var l=e("./v5.js");Object.defineProperty(r,"v5",{enumerable:!0,get:function(){return l.default}});var f=e("./v6.js");Object.defineProperty(r,"v6",{enumerable:!0,get:function(){return f.default}});var p=e("./v6ToV1.js");Object.defineProperty(r,"v6ToV1",{enumerable:!0,get:function(){return p.default}});var h=e("./v7.js");Object.defineProperty(r,"v7",{enumerable:!0,get:function(){return h.default}});var m=e("./validate.js");Object.defineProperty(r,"validate",{enumerable:!0,get:function(){return m.default}});var b=e("./version.js");Object.defineProperty(r,"version",{enumerable:!0,get:function(){return b.default}})},{"./max.js":440,"./nil.js":443,"./parse.js":444,"./stringify.js":448,"./v1.js":449,"./v1ToV6.js":450,"./v3.js":451,"./v4.js":453,"./v5.js":454,"./v6.js":455,"./v6ToV1.js":456,"./v7.js":457,"./validate.js":458,"./version.js":459}],440:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default="ffffffff-ffff-ffff-ffff-ffffffffffff"},{}],441:[function(e,t,r){"use strict";function n(e){return 14+(e+64>>>9<<4)+1}function i(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function a(e,t,r,n,a,o){return i((s=i(i(t,e),i(n,o)))<<(c=a)|s>>>32-c,r);var s,c}function o(e,t,r,n,i,o,s){return a(t&r|~t&n,e,t,i,o,s)}function s(e,t,r,n,i,o,s){return a(t&n|r&~n,e,t,i,o,s)}function c(e,t,r,n,i,o,s){return a(t^r^n,e,t,i,o,s)}function u(e,t,r,n,i,o,s){return a(r^(t|~n),e,t,i,o,s)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return function(e){for(var t=new Uint8Array(4*e.length),r=0;r<4*e.length;r++)t[r]=e[r>>2]>>>r%4*8&255;return t}(function(e,t){var r=new Uint32Array(n(t)).fill(0);r.set(e),r[t>>5]|=128<<t%32,r[r.length-1]=t,e=r;for(var a=1732584193,d=-271733879,l=-1732584194,f=271733878,p=0;p<e.length;p+=16){var h=a,m=d,b=l,v=f;a=o(a,d,l,f,e[p],7,-680876936),f=o(f,a,d,l,e[p+1],12,-389564586),l=o(l,f,a,d,e[p+2],17,606105819),d=o(d,l,f,a,e[p+3],22,-1044525330),a=o(a,d,l,f,e[p+4],7,-176418897),f=o(f,a,d,l,e[p+5],12,1200080426),l=o(l,f,a,d,e[p+6],17,-1473231341),d=o(d,l,f,a,e[p+7],22,-45705983),a=o(a,d,l,f,e[p+8],7,1770035416),f=o(f,a,d,l,e[p+9],12,-1958414417),l=o(l,f,a,d,e[p+10],17,-42063),d=o(d,l,f,a,e[p+11],22,-1990404162),a=o(a,d,l,f,e[p+12],7,1804603682),f=o(f,a,d,l,e[p+13],12,-40341101),l=o(l,f,a,d,e[p+14],17,-1502002290),a=s(a,d=o(d,l,f,a,e[p+15],22,1236535329),l,f,e[p+1],5,-165796510),f=s(f,a,d,l,e[p+6],9,-1069501632),l=s(l,f,a,d,e[p+11],14,643717713),d=s(d,l,f,a,e[p],20,-373897302),a=s(a,d,l,f,e[p+5],5,-701558691),f=s(f,a,d,l,e[p+10],9,38016083),l=s(l,f,a,d,e[p+15],14,-660478335),d=s(d,l,f,a,e[p+4],20,-405537848),a=s(a,d,l,f,e[p+9],5,568446438),f=s(f,a,d,l,e[p+14],9,-1019803690),l=s(l,f,a,d,e[p+3],14,-187363961),d=s(d,l,f,a,e[p+8],20,1163531501),a=s(a,d,l,f,e[p+13],5,-1444681467),f=s(f,a,d,l,e[p+2],9,-51403784),l=s(l,f,a,d,e[p+7],14,1735328473),a=c(a,d=s(d,l,f,a,e[p+12],20,-1926607734),l,f,e[p+5],4,-378558),f=c(f,a,d,l,e[p+8],11,-2022574463),l=c(l,f,a,d,e[p+11],16,1839030562),d=c(d,l,f,a,e[p+14],23,-35309556),a=c(a,d,l,f,e[p+1],4,-1530992060),f=c(f,a,d,l,e[p+4],11,1272893353),l=c(l,f,a,d,e[p+7],16,-155497632),d=c(d,l,f,a,e[p+10],23,-1094730640),a=c(a,d,l,f,e[p+13],4,681279174),f=c(f,a,d,l,e[p],11,-358537222),l=c(l,f,a,d,e[p+3],16,-722521979),d=c(d,l,f,a,e[p+6],23,76029189),a=c(a,d,l,f,e[p+9],4,-640364487),f=c(f,a,d,l,e[p+12],11,-421815835),l=c(l,f,a,d,e[p+15],16,530742520),a=u(a,d=c(d,l,f,a,e[p+2],23,-995338651),l,f,e[p],6,-198630844),f=u(f,a,d,l,e[p+7],10,1126891415),l=u(l,f,a,d,e[p+14],15,-1416354905),d=u(d,l,f,a,e[p+5],21,-57434055),a=u(a,d,l,f,e[p+12],6,1700485571),f=u(f,a,d,l,e[p+3],10,-1894986606),l=u(l,f,a,d,e[p+10],15,-1051523),d=u(d,l,f,a,e[p+1],21,-2054922799),a=u(a,d,l,f,e[p+8],6,1873313359),f=u(f,a,d,l,e[p+15],10,-30611744),l=u(l,f,a,d,e[p+6],15,-1560198380),d=u(d,l,f,a,e[p+13],21,1309151649),a=u(a,d,l,f,e[p+4],6,-145523070),f=u(f,a,d,l,e[p+11],10,-1120210379),l=u(l,f,a,d,e[p+2],15,718787259),d=u(d,l,f,a,e[p+9],21,-343485551),a=i(a,h),d=i(d,m),l=i(l,b),f=i(f,v)}return Uint32Array.of(a,d,l,f)}(function(e){if(0===e.length)return new Uint32Array;for(var t=new Uint32Array(n(8*e.length)).fill(0),r=0;r<e.length;r++)t[r>>2]|=(255&e[r])<<r%4*8;return t}(e),8*e.length))}},{}],442:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);r.default={randomUUID:n}},{}],443:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default="00000000-0000-0000-0000-000000000000"},{}],444:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./validate.js");r.default=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");var t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}},{"./validate.js":458}],445:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i},{}],446:[function(e,t,r){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0});var i=new Uint8Array(16);r.default=function(){if(!n){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");n=crypto.getRandomValues.bind(crypto)}return n(i)}},{}],447:[function(e,t,r){"use strict";function n(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function i(e,t){return e<<t|e>>>32-t}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],a=new Uint8Array(e.length+1);a.set(e),a[e.length]=128;for(var o=(e=a).length/4+2,s=Math.ceil(o/16),c=new Array(s),u=0;u<s;++u){for(var d=new Uint32Array(16),l=0;l<16;++l)d[l]=e[64*u+4*l]<<24|e[64*u+4*l+1]<<16|e[64*u+4*l+2]<<8|e[64*u+4*l+3];c[u]=d}c[s-1][14]=8*(e.length-1)/Math.pow(2,32),c[s-1][14]=Math.floor(c[s-1][14]),c[s-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<s;++f){for(var p=new Uint32Array(80),h=0;h<16;++h)p[h]=c[f][h];for(var m=16;m<80;++m)p[m]=i(p[m-3]^p[m-8]^p[m-14]^p[m-16],1);for(var b=r[0],v=r[1],g=r[2],y=r[3],_=r[4],w=0;w<80;++w){var k=Math.floor(w/20),S=i(b,5)+n(k,v,g,y)+_+t[k]+p[w]>>>0;_=y,y=g,g=i(v,30)>>>0,v=b,b=S}r[0]=r[0]+b>>>0,r[1]=r[1]+v>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+y>>>0,r[4]=r[4]+_>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}},{}],448:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.unsafeStringify=void 0;for(var n=e("./validate.js"),i=[],a=0;a<256;++a)i.push((a+256).toString(16).slice(1));function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase()}r.unsafeStringify=o,r.default=function(e){var t=o(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0);if(!(0,n.default)(t))throw TypeError("Stringified UUID is invalid");return t}},{"./validate.js":458}],449:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.updateV1State=void 0;var n=e("./rng.js"),i=e("./stringify.js"),a={};function o(e,t,r){var n,i;return null!==(n=e.msecs)&&void 0!==n||(e.msecs=-1/0),null!==(i=e.nsecs)&&void 0!==i||(e.nsecs=0),t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=16383&(r[8]<<8|r[9])),e.msecs=t,e}function s(e,t,r,n,i,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;if(e.length<16)throw new Error("Random bytes length must be >= 16");if(a){if(o<0||o+16>a.length)throw new RangeError("UUID byte range ".concat(o,":").concat(o+15," is out of buffer bounds"))}else a=new Uint8Array(16),o=0;null!=t||(t=Date.now()),null!=r||(r=0),null!=n||(n=16383&(e[8]<<8|e[9])),null!=i||(i=e.slice(10,16));var s=(1e4*(268435455&(t+=122192928e5))+r)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=255&s;var c=t/4294967296*1e4&268435455;a[o++]=c>>>8&255,a[o++]=255&c,a[o++]=c>>>24&15|16,a[o++]=c>>>16&255,a[o++]=n>>>8|128,a[o++]=255&n;for(var u=0;u<6;++u)a[o++]=i[u];return a}r.updateV1State=o,r.default=function(e,t,r){var c,u,d,l=null!==(c=null===(u=e)||void 0===u?void 0:u._v6)&&void 0!==c&&c;if(e){var f=Object.keys(e);1===f.length&&"_v6"===f[0]&&(e=void 0)}if(e){var p,h,m,b;d=s(null!==(p=null!==(h=e.random)&&void 0!==h?h:null===(m=(b=e).rng)||void 0===m?void 0:m.call(b))&&void 0!==p?p:(0,n.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r)}else{var v=Date.now(),g=(0,n.default)();o(a,v,g),d=s(g,a.msecs,a.nsecs,l?void 0:a.clockseq,l?void 0:a.node,t,r)}return null!=t?t:(0,i.unsafeStringify)(d)}},{"./rng.js":446,"./stringify.js":448}],450:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./parse.js"),i=e("./stringify.js");r.default=function(e){var t=function(e){return Uint8Array.of((15&e[6])<<4|e[7]>>4&15,(15&e[7])<<4|(240&e[4])>>4,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,(15&e[1])<<4|(240&e[2])>>4,96|15&e[2],e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof e?(0,n.default)(e):e);return"string"==typeof e?(0,i.unsafeStringify)(t):t}},{"./parse.js":444,"./stringify.js":448}],451:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.URL=r.DNS=void 0;var n=e("./md5.js"),i=e("./v35.js"),a=e("./v35.js");function o(e,t,r,a){return(0,i.default)(48,n.default,e,t,r,a)}Object.defineProperty(r,"DNS",{enumerable:!0,get:function(){return a.DNS}}),Object.defineProperty(r,"URL",{enumerable:!0,get:function(){return a.URL}}),o.DNS=i.DNS,o.URL=i.URL,r.default=o},{"./md5.js":441,"./v35.js":452}],452:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.URL=r.DNS=r.stringToBytes=void 0;var n=e("./parse.js"),i=e("./stringify.js");function a(e){e=unescape(encodeURIComponent(e));for(var t=new Uint8Array(e.length),r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}r.stringToBytes=a,r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r.default=function(e,t,r,o,s,c){var u,d="string"==typeof r?a(r):r,l="string"==typeof o?(0,n.default)(o):o;if("string"==typeof o&&(o=(0,n.default)(o)),16!==(null===(u=o)||void 0===u?void 0:u.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var f=new Uint8Array(16+d.length);if(f.set(l),f.set(d,l.length),(f=t(f))[6]=15&f[6]|e,f[8]=63&f[8]|128,s){c=c||0;for(var p=0;p<16;++p)s[c+p]=f[p];return s}return(0,i.unsafeStringify)(f)}},{"./parse.js":444,"./stringify.js":448}],453:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./native.js"),i=e("./rng.js"),a=e("./stringify.js");r.default=function(e,t,r){var o,s,c,u;if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();var d=null!==(o=null!==(s=(e=e||{}).random)&&void 0!==s?s:null===(c=(u=e).rng)||void 0===c?void 0:c.call(u))&&void 0!==o?o:(0,i.default)();if(d.length<16)throw new Error("Random bytes length must be >= 16");if(d[6]=15&d[6]|64,d[8]=63&d[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError("UUID byte range ".concat(r,":").concat(r+15," is out of buffer bounds"));for(var l=0;l<16;++l)t[r+l]=d[l];return t}return(0,a.unsafeStringify)(d)}},{"./native.js":442,"./rng.js":446,"./stringify.js":448}],454:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.URL=r.DNS=void 0;var n=e("./sha1.js"),i=e("./v35.js"),a=e("./v35.js");function o(e,t,r,a){return(0,i.default)(80,n.default,e,t,r,a)}Object.defineProperty(r,"DNS",{enumerable:!0,get:function(){return a.DNS}}),Object.defineProperty(r,"URL",{enumerable:!0,get:function(){return a.URL}}),o.DNS=i.DNS,o.URL=i.URL,r.default=o},{"./sha1.js":447,"./v35.js":452}],455:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault")(e("@babel/runtime/helpers/defineProperty"));function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach(function(t){(0,n.default)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}Object.defineProperty(r,"__esModule",{value:!0});var o=e("./stringify.js"),s=e("./v1.js"),c=e("./v1ToV6.js");r.default=function(e,t,r){null!=e||(e={}),null!=r||(r=0);var n=(0,s.default)(a(a({},e),{},{_v6:!0}),new Uint8Array(16));if(n=(0,c.default)(n),t){for(var i=0;i<16;i++)t[r+i]=n[i];return t}return(0,o.unsafeStringify)(n)}},{"./stringify.js":448,"./v1.js":449,"./v1ToV6.js":450,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/interopRequireDefault":36}],456:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./parse.js"),i=e("./stringify.js");r.default=function(e){var t=function(e){return Uint8Array.of((15&e[3])<<4|e[4]>>4&15,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|15&e[6],e[7],(15&e[1])<<4|(240&e[2])>>4,(15&e[2])<<4|(240&e[3])>>4,16|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof e?(0,n.default)(e):e);return"string"==typeof e?(0,i.unsafeStringify)(t):t}},{"./parse.js":444,"./stringify.js":448}],457:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.updateV7State=void 0;var n=e("./rng.js"),i=e("./stringify.js"),a={};function o(e,t,r){var n,i;return null!==(n=e.msecs)&&void 0!==n||(e.msecs=-1/0),null!==(i=e.seq)&&void 0!==i||(e.seq=0),t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++),e}function s(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(e.length<16)throw new Error("Random bytes length must be >= 16");if(n){if(i<0||i+16>n.length)throw new RangeError("UUID byte range ".concat(i,":").concat(i+15," is out of buffer bounds"))}else n=new Uint8Array(16),i=0;return null!=t||(t=Date.now()),null!=r||(r=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9]),n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=255&t,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|3&e[10],n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}r.updateV7State=o,r.default=function(e,t,r){var c;if(e){var u,d,l;c=s(null!==(u=null!==(d=e.random)&&void 0!==d?d:null===(l=e.rng)||void 0===l?void 0:l.call(e))&&void 0!==u?u:(0,n.default)(),e.msecs,e.seq,t,r)}else{var f=Date.now(),p=(0,n.default)();o(a,f,p),c=s(p,a.msecs,a.seq,t,r)}return null!=t?t:(0,i.unsafeStringify)(c)}},{"./rng.js":446,"./stringify.js":448}],458:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./regex.js");r.default=function(e){return"string"==typeof e&&n.default.test(e)}},{"./regex.js":445}],459:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./validate.js");r.default=function(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},{"./validate.js":458}],460:[function(require,module,exports){var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1},Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(e){return function(e,t,r){e[t]=r}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(e){if(!(this instanceof Script))return new Script(e);this.code=e};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,n=r.eval,i=r.execScript;!n&&i&&(i.call(r,"null"),n=r.eval),forEach(Object_keys(e),function(t){r[t]=e[t]}),forEach(globals,function(t){e[t]&&(r[t]=e[t])});var a=Object_keys(r),o=n.call(r,this.code);return forEach(Object_keys(r),function(t){(t in e||-1===indexOf(a,t))&&(e[t]=r[t])}),forEach(globals,function(t){t in e||defineProp(e,t,r[t])}),document.body.removeChild(t),o},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),r=this.runInContext(t);return e&&forEach(Object_keys(t),function(r){e[r]=t[r]}),r},forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var r=Script(t);return r[e].apply(r,[].slice.call(arguments,1))}}),exports.isContext=function(e){return e instanceof Context},exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"==typeof e&&forEach(Object_keys(e),function(r){t[r]=e[r]}),t}},{}],461:[function(e,t,r){"use strict";var n=e("for-each"),i=e("available-typed-arrays"),a=e("call-bind"),o=e("call-bound"),s=e("gopd"),c=e("get-proto"),u=o("Object.prototype.toString"),d=e("has-tostringtag/shams")(),l="undefined"==typeof globalThis?global:globalThis,f=i(),p=o("String.prototype.slice"),h=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},m={__proto__:null};n(f,d&&s&&c?function(e){var t=new l[e];if(Symbol.toStringTag in t&&c){var r=c(t),n=s(r,Symbol.toStringTag);if(!n&&r){var i=c(r);n=s(i,Symbol.toStringTag)}m["$"+e]=a(n.get)}}:function(e){var t=new l[e],r=t.slice||t.set;r&&(m["$"+e]=a(r))});t.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!d){var t=p(u(e),8,-1);return h(f,t)>-1?t:"Object"===t&&function(e){var t=!1;return n(m,function(r,n){if(!t)try{r(e),t=p(n,1)}catch(e){}}),t}(e)}return s?function(e){var t=!1;return n(m,function(r,n){if(!t)try{"$"+r(e)===n&&(t=p(n,1))}catch(e){}}),t}(e):null}},{"available-typed-arrays":79,"call-bind":131,"call-bound":132,"for-each":211,"get-proto":217,gopd:219,"has-tostringtag/shams":227}],462:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.Logger=void 0;var i=n(e("@babel/runtime/helpers/classCallCheck")),a=n(e("@babel/runtime/helpers/createClass")),o=e("debug"),s="cp2p-client";r.Logger=function(){return(0,a.default)(function e(t){(0,i.default)(this,e),t?(this._debug=o("".concat(s,":").concat(t)),this._info=o("".concat(s,":INFO:").concat(t)),this._warn=o("".concat(s,":WARN:").concat(t)),this._error=o("".concat(s,":ERROR:").concat(t))):(this._debug=o(s),this._info=o("".concat(s,":INFO")),this._warn=o("".concat(s,":WARN")),this._error=o("".concat(s,":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}}])}()},{"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/interopRequireDefault":36,debug:142}],463:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.P2pSdk=void 0;var i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=n(e("@babel/runtime/helpers/possibleConstructorReturn")),c=n(e("@babel/runtime/helpers/getPrototypeOf")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/helpers/defineProperty")),l=n(e("@babel/runtime/regenerator")),f=(e("../utils/getRandomInt.js"),e("../utils/uuidv4.js")),p=e("../utils/getAudioVideoInputs.js"),h=e("../utils/getDeviceId.js"),m=(e("../utils/sleep.js"),e("./Logger.js")),b=e("../utils/gumConstraints.js"),v=e("./SocketTransport.js"),g=e("events");function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach(function(t){(0,d.default)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}e("./platform.js");var k=new m.Logger("Room");r.P2pSdk=function(e){function t(e){var r,n,i,o,u=e.peerId,l=e.roomId,f=e.peerName,p=e.role,h=e.url;return(0,a.default)(this,t),n=this,i=t,i=(0,c.default)(i),r=(0,s.default)(n,w()?Reflect.construct(i,o||[],(0,c.default)(n).constructor):i.apply(n,o)),(0,d.default)(r,"handleNegotiationNeededEvent",function(){k.debug("handleNegotiationNeededEvent() | needed to negotiate a new negotiation");r.restartICE()}),(0,d.default)(r,"handleRemoveTrackEvent",function(){k.debug("handleRemoveTrackEvent() | Track removed by remote peer. Need to handle UI locally."),r.emit("videoToggle",{status:!1,peer:"other"})}),r._closed=!1,r._roomId=l,r._socket=null,r._peerConnection=null,r._myDisplayName=f,r._myPeerId=u,r._myRole=p,r._localStream=null,r._remoteDisplayName=null,r._remotePeerId=null,r._remoteRole=null,r._remoteStream=null,r._canvas=null,r._imageData=null,r._imageWidth=1280,r._imageHeight=720,r._availableMediaInputs=null,r._userAgent={name:platform.name,version:platform.version,os:platform.os.family,description:platform.description},r._remoteMediaInputs=null,r._remoteUserAgent=null,r._statsCaptureInterval=null,r._localStats=null,r._remoteStats=null,r._otherPeerConnected=null,r._data={},r._url=h,r.prepareForCall(),k.debug("user agent is:%o",r._userAgent),r}return(0,u.default)(t,e),(0,o.default)(t,[{key:"imageData",get:function(){return this._imageData}},{key:"roomId",get:function(){return this._roomId}},{key:"localStream",get:function(){return this._localStream}},{key:"remoteStream",get:function(){return this._remoteStream}},{key:"myName",get:function(){return this._myDisplayName},set:function(e){this._myDisplayName=e}},{key:"myId",get:function(){return this._myPeerId}},{key:"myRole",get:function(){return this._myRole}},{key:"remoteName",get:function(){return this._remoteDisplayName}},{key:"remoteId",get:function(){return this._remotePeerId}},{key:"remoteRole",get:function(){return this._remoteRole}},{key:"imageHeight",get:function(){return this._imageHeight}},{key:"imageWidth",get:function(){return this._imageWidth}},{key:"userAgent",get:function(){return this._userAgent}},{key:"mediaInputs",get:function(){return this._availableMediaInputs}},{key:"remoteUserAgent",get:function(){return this._remoteUserAgent}},{key:"remoteMediaInputs",get:function(){return this._remoteMediaInputs}},{key:"localStats",get:function(){return this._localStats}},{key:"remoteStats",get:function(){return this._remoteStats}},{key:"pc",get:function(){return this._peerConnection}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("Can't set the whole of data object.")}},{key:"setImageProps",value:function(e){var t=e.width,r=e.height;t&&r?(this._imageHeight=r,this._imageWidth=t):this.clientErrorHandler({reason:"Both width and height are required to set the new image properties. ",error:null})}},{key:"prepareForCall",value:(B=(0,i.default)(l.default.mark(function e(){var t,r=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this,(0,p.chooseMediaLabel)().then(function(){var e=(0,i.default)(l.default.mark(function e(n){var i,a,o,s;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.error){e.next=5;break}s=n.error,e.next="NotAllowedError"===s?1:"NotFoundError"===s?2:"NotReadableError"===s?3:4;break;case 1:return i="".concat(n.error," : ").concat(n.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.'),r.clientErrorHandler({reason:i,error:null}),e.abrupt("continue",4);case 2:return a="".concat(n.error," : ").concat(n.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."),r.clientErrorHandler({reason:a,error:null}),e.abrupt("continue",4);case 3:return o="".concat(n.error," : ").concat(n.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."),r.clientErrorHandler({reason:o,error:null}),e.abrupt("continue",4);case 4:e.next=7;break;case 5:if(!(n.audioLabels&&n.audioLabels.length>0&&n.videoLabels&&n.videoLabels.length>0)){e.next=7;break}return t._availableMediaInputs={audioInputs:n.audioLabels,videoInputs:n.videoLabels},k.debug("available A/V inputs:%o",t.mediaInputs),e.next=6,t.getUserMedia();case 6:t.emit("mediaInputs");case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),navigator.mediaDevices.ondevicechange=function(){var e=(0,i.default)(l.default.mark(function e(r){var n;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k.info("Media devices changed!"),e.next=1,(0,p.updatedDeviceList)();case 1:(n=e.sent).audioLabels&&n.audioLabels.length>0&&n.videoLabels&&n.videoLabels.length>0&&(t._availableMediaInputs={audioInputs:n.audioLabels,videoInputs:n.videoLabels},k.debug("updated A/V inputs:%o",t.mediaInputs),t.emit("mediaInputs"),"client"===t.myRole&&t.pc&&(k.info("Going to update the agent about the updated media devices list."),t.send({type:"mediaListUpdated",mediaInputs:t.mediaInputs})));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();case 1:case"end":return e.stop()}},e,this)})),function(){return B.apply(this,arguments)})},{key:"send",value:function(e){this._closed||this._socket.send(e)}},{key:"inform",value:function(e){if(!this._closed){var t={type:"information",msg:e};this._socket.send(t)}}},{key:"request",value:(L=(0,i.default)(l.default.mark(function e(t){var r,n,i;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.type,n=t.message,e.next=1,this._socket.request({type:r,message:n});case 1:if(!(i=e.sent)){e.next=2;break}return e.abrupt("return",i);case 2:case"end":return e.stop()}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"gotMessageFromServer",value:function(e){switch(k.debug("Got message:%o",e),e.type){case"login":this.handleLogin(e.details);break;case"offer":k.debug("inside offer"),this.handleOffer({offer:e.offer,peer:e.peer,name:e.name});break;case"answer":k.debug("inside answer"),this.handleAnswer(e);break;case"candidate":k.debug("inside handle candidate"),this.handleCandidate(e.candidate);break;case"leave":this.handleLeave(),this.emit("peerHangUp");break;case"audioToggle":this.emit("audioToggle",{status:e.status,peer:"other"});break;case"videoToggle":this.emit("videoToggle",{status:e.status,peer:"other"});break;case"remoteStreamToggle":this.handleRemoteStreamToggle(e);break;case"chatMessage":this.emit("chatMessage",e.message);break;case"imageCapture":this.captureImage("local");break;case"mediaChange":this.changeRemoteMediaSource(e);break;case"requestStats":this.sendRequestedstats();break;case"statsFetched":this._remoteStats=e.stats,this.emit("remoteStats");break;case"information":this.emit("information",e.msg);break;case"iceRestart":this.handleIceRestart(e);break;case"iceRestarted":this.handleIceRestartResponse(e);break;case"nameUpdate":this._remoteDisplayName=e.name,this.emit("peerName");break;case"mediaListUpdated":this._remoteMediaInputs=e.mediaInputs,this.emit("remoteMediaInputs");break;case"peerLeft":this.pc||(this._remoteDisplayName=null,this._remotePeerId=null,this._remoteRole=null,this._otherPeerConnected=!1,this.emit("peerJoin","None"),alert("Other person disconnected from the room"));break;case"error":this.emit("serverError",e.details)}}},{key:"getUserMedia",value:(D=(0,i.default)(l.default.mark(function e(){var t=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:k.debug("Inside getusermedia"),this._localStream?k.debug("Local stream already acquired! Waiting for call!"):navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(b.avConstraints).then(function(e){return t.getUserMediaSuccess(e)}).catch(function(e){return t.clientErrorHandler({reason:"Error while acquiring camera/mic",error:e})}):alert("Your browser does not support getUserMedia API");case 1:case"end":return e.stop()}},e,this)})),function(){return D.apply(this,arguments)})},{key:"getUserMediaSuccess",value:function(e){var t=this,r=this;k.debug("Inside getUserMediaSuccess"),this._localStream=e,this.emit("localStream"),this._socket=new v.SocketTransport({url:this._url,roomId:this._roomId,peerId:this._myPeerId,peerName:this._myDisplayName,role:this._myRole}),this._socket.on("message",function(e){return t.gotMessageFromServer(e)}),this._socket.on("connected",(0,i.default)(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.pc){e.next=1;break}if(k.debug("Socket reconnection happened after a disconnection, ICEState:%s",r._peerConnection.iceConnectionState),"failed"!==r._peerConnection.iceConnectionState&&"disconnected"!==r._peerConnection.iceConnectionState){e.next=1;break}return k.debug("Going to restart ICE as ICE is not in connected state!!"),e.next=1,r.restartICE();case 1:case"end":return e.stop()}},e)})))}},{key:"handleAudioToggle",value:function(){var e=this._localStream.getAudioTracks()[0];e.enabled=!e.enabled,this.send({type:"audioToggle",status:e.enabled}),this.emit("audioToggle",{status:e.enabled,peer:"self"})}},{key:"handleVideoToggle",value:function(){var e=this._localStream.getVideoTracks()[0];e.enabled=!e.enabled,this.send({type:"videoToggle",status:e.enabled}),this.emit("videoToggle",{status:e.enabled,peer:"self"})}},{key:"handleVideoToggleNew",value:function(){var e=this,t=this;if(this._peerConnection){var r=this._peerConnection.getSenders().find(function(e){return e.track&&"video"==e.track.kind});if(r){k.debug("found sender:%o",r),this._peerConnection.removeTrack(r);var n=this._localStream.getVideoTracks()[0];n&&(n.stop(),this._localStream.removeTrack(n)),this.send({type:"videoToggle",status:!1}),this.emit("videoToggle",{status:!1,peer:"self"})}else k.debug("sender not found. Going to create a new video track."),navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(_(_({},b.avConstraints),{},{audio:!1})).then(function(e){var r=e.getVideoTracks()[0];t._localStream.addTrack(r),t._peerConnection.addTrack(r),t.send({type:"videoToggle",status:!0}),t.emit("localStream"),t.emit("videoToggle",{status:!0,peer:"self"})}).catch(function(t){return e.clientErrorHandler({reason:"Error while acquiring camera/mic",error:t})}):alert("Your browser does not support getUserMedia API")}else k.warn("Peer connection not found!")}},{key:"handleRemoteAudioToggle",value:function(){this.send({type:"remoteStreamToggle",streamType:"audio"})}},{key:"handleRemoteVideoToggle",value:function(){this.send({type:"remoteStreamToggle",streamType:"video"})}},{key:"handleRemoteStreamToggle",value:function(e){k.debug("inside remote stream toggle"),"audio"===e.streamType?this.handleAudioToggle():"video"===e.streamType?this.handleVideoToggle():k.warn("Invalid stream type!")}},{key:"sendChatMessage",value:function(e){e&&" "!==e?this.send({type:"chatMessage",message:e}):this.clientErrorHandler({reason:"Chat message need to have a valid value!",error:null})}},{key:"informPeer",value:(j=(0,i.default)(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.remoteId&&this.send({type:"nameUpdate",name:this.myName});case 1:case"end":return e.stop()}},e,this)})),function(){return j.apply(this,arguments)})},{key:"handleLogin",value:function(e){e&&(k.debug("All available users:%o",e),this._remoteDisplayName=e.displayName,this._remotePeerId=e.peerId,this._remoteRole=e.role),this._otherPeerConnected=!0,this.emit("peerJoin",this._remoteDisplayName)}},{key:"gotRemoteTrack",value:(O=(0,i.default)(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:k.debug("inside got remote track:%o",t),t.streams&&t.streams[0]?(k.debug("Got a remote stream"),this._remoteStream=t.streams[0]):(this._remoteStream=new MediaStream,this._remoteStream.addTrack(t.track),k.debug("Got a remote track")),this.emit("remoteStream");case 1:case"end":return e.stop()}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"_onICeCandidate",value:function(e){k.debug("onicecandidate",e.candidate),e.candidate&&this.send({type:"candidate",candidate:e.candidate,peer:this._remotePeerId})}},{key:"createPeerOffer",value:(I=(0,i.default)(l.default.mark(function e(t){var r,n,a,o=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,e.next=1,this._socket.request({type:"fetchIceServers",message:{}});case 1:return n=e.sent,this._peerConnection=new RTCPeerConnection({iceServers:n}),k.debug("connection state in createPeeroffer():%s",this._peerConnection.connectionState),this._peerConnection.onicecandidate=function(e){o._onICeCandidate(e)},this._localStream.getTracks().forEach(function(e){return o._peerConnection.addTrack(e,o._localStream)}),e.next=2,this._peerConnection.createOffer().catch(function(e){alert("Error when creating an offer",e),k.error("Error when creating an offer:%o",e)});case 2:return a=e.sent,e.next=3,this._peerConnection.setLocalDescription(a);case 3:this.send({type:"offer",offer:r._peerConnection.localDescription,peer:r._remotePeerId,name:r.myName}),this._peerConnection.ontrack=function(e){return r.gotRemoteTrack(e)},this._peerConnection.addEventListener("iceconnectionstatechange",function(){var e=(0,i.default)(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:k.debug("Current ICEState:%s",r._peerConnection.iceConnectionState),"failed"!==r._peerConnection.iceConnectionState&&"disconnected"!==r._peerConnection.iceConnectionState||(k.debug("Ice connection failed!! with socket connection status:%s",r._socket.connectionStatus),r.emit("iceFailure"));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),this._peerConnection.onnegotiationneeded=function(){return o.handleNegotiationNeededEvent()},this._peerConnection.onremovetrack=function(){return o.handleRemoveTrackEvent()};case 4:case"end":return e.stop()}},e,this)})),function(e){return I.apply(this,arguments)})},{key:"handleOffer",value:(A=(0,i.default)(l.default.mark(function e(t){var r,n,a,o,s,c=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.peer,n=t.name,a=t.offer,o=this,e.next=1,this._socket.request({type:"fetchIceServers",message:{}});case 1:s=e.sent,this._peerConnection=new RTCPeerConnection({iceServers:s}),k.debug("Peer connection in handle offer is:%s",this._peerConnection),this._remoteDisplayName=n,this._remotePeerId=r,this._peerConnection.setRemoteDescription(new RTCSessionDescription(a)),this._localStream.getTracks().forEach(function(e){return c._peerConnection.addTrack(e,c._localStream)}),this._peerConnection.createAnswer().then(function(e){return o._peerConnection.setLocalDescription(e)}).then(function(){k.debug("Ice already completed. sending answer!!"),o.send({type:"answer",answer:o._peerConnection.localDescription,peer:o._remotePeerId,mediaInputs:o.mediaInputs,userAgent:o.userAgent})}).catch(function(e){alert("Error when creating an answer"),k.error("Error while creating answer:%o",e)}),this._peerConnection.ontrack=function(e){return o.gotRemoteTrack(e)},this._peerConnection.onicecandidate=function(e){c._onICeCandidate(e)},this._peerConnection.addEventListener("iceconnectionstatechange",function(){var e=(0,i.default)(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:k.debug("Current ICEState:%s",o._peerConnection.iceConnectionState),"failed"!==o._peerConnection.iceConnectionState&&"disconnected"!==o._peerConnection.iceConnectionState||(k.debug("Ice connection failed!! with socket connection status:%s",o._socket.connectionStatus),o.emit("iceFailure"));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),this._peerConnection.onnegotiationneeded=function(){return c.handleNegotiationNeededEvent()},this._peerConnection.onremovetrack=function(){return c.handleRemoveTrackEvent()},this.emit("offerReceived");case 2:case"end":return e.stop()}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"handleAnswer",value:function(e){k.debug("answer:%o ",e),this._peerConnection.setRemoteDescription(new RTCSessionDescription(e.answer)),this._remoteMediaInputs=e.mediaInputs,this._remoteUserAgent=e.userAgent,this.emit("remoteMediaInputs")}},{key:"handleCandidate",value:(T=(0,i.default)(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.pc?(k.debug("Peerconnection available, Inside handle candidate for remote icecandidates"),this._peerConnection.addIceCandidate(new RTCIceCandidate(t)).catch(function(e){k.error("Error while adding iceCandidate",e)})):k.warn("Candidate arrived before peer connection instantiation:%o",t);case 1:case"end":return e.stop()}},e,this)})),function(e){return T.apply(this,arguments)})},{key:"restartICE",value:(C=(0,i.default)(l.default.mark(function e(){var t;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,this._peerConnection.createOffer({iceRestart:!0});case 1:return t=e.sent,e.next=2,this._peerConnection.setLocalDescription(t);case 2:this.send({type:"iceRestart",offer:t});case 3:case"end":return e.stop()}},e,this)})),function(){return C.apply(this,arguments)})},{key:"handleIceRestart",value:(M=(0,i.default)(l.default.mark(function e(t){var r;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k.debug("Ice restart message received!!"),this._peerConnection.setRemoteDescription(t.offer),e.next=1,this._peerConnection.createAnswer();case 1:return r=e.sent,e.next=2,this._peerConnection.setLocalDescription(r);case 2:this.send({type:"iceRestarted",answer:r});case 3:case"end":return e.stop()}},e,this)})),function(e){return M.apply(this,arguments)})},{key:"handleIceRestartResponse",value:(R=(0,i.default)(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:k.debug("Ice restart message response received!!"),this._peerConnection.setRemoteDescription(t.answer);case 1:case"end":return e.stop()}},e,this)})),function(e){return R.apply(this,arguments)})},{key:"informRoomLeave",value:(P=(0,i.default)(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.send({type:"leave",peer:this.remoteId}),e.next=1,this.handleLeave();case 1:case"end":return e.stop()}},e,this)})),function(){return P.apply(this,arguments)})},{key:"handleLeave",value:(E=(0,i.default)(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this._peerConnection?(this._peerConnection.ontrack=null,this._peerConnection.onremovetrack=null,this._peerConnection.onremovestream=null,this._peerConnection.onicecandidate=null,this._peerConnection.oniceconnectionstatechange=null,this._peerConnection.onsignalingstatechange=null,this._peerConnection.onicegatheringstatechange=null,this._peerConnection.onnegotiationneeded=null,this._localStream&&this._localStream.getTracks().forEach(function(e){return e.stop()}),this._remoteStream&&this._remoteStream.getTracks().forEach(function(e){return e.stop()}),this._peerConnection.close(),this._peerConnection=null,this._remoteDisplayName=null,this._remotePeerId=null,this._remoteStream=null,this._localStream=null,this._canvas=null,this._imageData=null,this._imageWidth=640,this._imageHeight=480,this._socket.close()):k.error("No peerconnection object found!");case 1:case"end":return e.stop()}},e,this)})),function(){return E.apply(this,arguments)})},{key:"changeRemoteMediaSource",value:(x=(0,i.default)(l.default.mark(function e(t){var r,n;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.label,n=t.mediaType,!r||"video"!==n&&"audio"!==n){e.next=1;break}this.handleReplaceTrack({label:r,mediaType:n}),e.next=2;break;case 1:return this.send({type:"error",details:{reason:"Can't change remote media source as either media label or media type is not available!"}}),e.abrupt("return");case 2:case"end":return e.stop()}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"handleReplaceTrack",value:(S=(0,i.default)(l.default.mark(function e(t){var r,n,i,a,o,s,c,u,d,f;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.label,n=t.mediaType,e.prev=1,e.next=2,(0,h.getDeviceId)(r);case 2:return s=e.sent,"video"===n?(b.videoConstraints.video.deviceId.exact=s,o=b.videoConstraints,i=this._localStream.getVideoTracks()[0]):"audio"===n?(b.audioConstraints.audio.deviceId.exact=s,o=b.audioConstraints,i=this._localStream.getAudioTracks()[0]):k.error("Unknown media type:%s",n),c=i.enabled,i.stop(),k.debug("selected constraints are:%o",o),e.next=3,navigator.mediaDevices.getUserMedia(o);case 3:u=e.sent,k.debug("new stream is:%o",u),"video"===n?a=u.getVideoTracks()[0]:"audio"===n&&(a=u.getAudioTracks()[0]),a.enabled=c,this._peerConnection&&(d=this._peerConnection.getSenders().find(function(e){return e.track.kind==a.kind}),k.debug("found sender:%o",d),d.replaceTrack(a)),this._localStream.removeTrack(i),this._localStream.addTrack(a),e.next=5;break;case 4:e.prev=4,f=e.catch(1),k.error("Error while replace media track:%o",f),this.clientErrorHandler({reason:"Error while replacing media track with new source",error:f});case 5:case"end":return e.stop()}},e,this,[[1,4]])})),function(e){return S.apply(this,arguments)})},{key:"captureImage",value:(y=(0,i.default)(l.default.mark(function e(t){var r,n,i,a,o;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=document.createElement("canvas"),n=r.getContext("2d"),i=this._imageWidth,a=this._imageHeight,k.debug("height:%s and width:%s",i,a),r.width=i,r.height=a,"local"===t?n.drawImage(localVideo,0,0,i,a):n.drawImage(remoteVideo,0,0,i,a),o=r.toDataURL("image/png"),this._canvas=r,this._imageData=o,this.emit("imageCaptured");case 1:case"end":return e.stop()}},e,this)})),function(e){return y.apply(this,arguments)})},{key:"clearImage",value:(g=(0,i.default)(l.default.mark(function e(){var t,r,n;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this._canvas,(r=t.getContext("2d")).fillStyle="#AAA",r.fillRect(0,0,t.width,t.height),n=t.toDataURL("image/png"),this._imageData=n;case 1:case"end":return e.stop()}},e,this)})),function(){return g.apply(this,arguments)})},{key:"captureRemoteImage",value:function(){this.send({type:"imageCapture"})}},{key:"remoteCamChange",value:function(e){e?this.send({type:"mediaChange",mediaType:"video",label:e}):this.clientErrorHandler({reason:"A valid camera name must be selected for to change the remote camera!",error:null})}},{key:"remoteMicChange",value:function(e){e?this.send({type:"mediaChange",mediaType:"audio",label:e}):this.clientErrorHandler({reason:"A valid mic name must be selected for to change the remote mic!",error:null})}},{key:"requestStats",value:function(){this.send({type:"requestStats"})}},{key:"captureStats",value:(m=(0,i.default)(l.default.mark(function e(){var t,r=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this,e.abrupt("return",new Promise(function(e){r._peerConnection.getStats(null).then(function(r){var n={};r.forEach(function(e){["inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","local-candidate","remote-candidate","candidate-pair"].includes(e.type)&&(n=_(_({},n),{},(0,d.default)({},"".concat(e.type),e)))}),t._localStats=n,e(n)})}));case 1:case"end":return e.stop()}},e,this)})),function(){return m.apply(this,arguments)})},{key:"displayStats",value:function(e){var t=e.stats,r=e.element,n="";Object.values(t).forEach(function(e){n+="<h2>Report: ".concat(e.type,"</h2>\n<strong>ID:</strong> ").concat(e.id,"<br>\n")+"<strong>Timestamp:</strong> ".concat(e.timestamp,"<br>\n"),Object.keys(e).forEach(function(t){"id"!==t&&"timestamp"!==t&&"type"!==t&&(n+="<strong>".concat(t,":</strong> ").concat(e[t],"<br>\n"))})}),document.querySelector(r).innerHTML=n}},{key:"sendRequestedstats",value:(n=(0,i.default)(l.default.mark(function e(){var t;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,this.captureStats();case 1:t=e.sent,k.debug("Local stats are:%o",t),this.send({type:"statsFetched",stats:t});case 2:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"clientErrorHandler",value:function(e){var t=e.reason,r=e.error;this.emit("clientError",{reason:t,error:r})}},{key:"copyLink",value:function(e){navigator.clipboard.writeText(e).then(function(){k.debug("Async: Copying to clipboard was successful!"),alert("Link copied!!")},function(e){k.error("Async: Could not copy text:%o ",e)})}}],[{key:"createRoom",value:(r=(0,i.default)(l.default.mark(function e(t){var r,n,i,a,o,s,c,u,d;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.roomId,n=void 0===r?void 0:r,i=t.peerId,a=void 0===i?void 0:i,o=t.peerName,s=void 0===o?void 0:o,c=t.role,u=void 0===c?"caller":c,a||(a=(0,f.uuidv4)()),n){e.next=1;break}return e.abrupt("return",{success:!1,reason:"roomId is required!"});case 1:return d=process.env.NODE_ENV="https//cp2p.centedge.io",e.abrupt("return",new Room({peerId:a,roomId:n,peerName:s,role:u,url:d}));case 2:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)})}]);var r,n,m,g,y,S,x,E,P,R,M,C,T,A,I,O,j,D,L,B}(g.EventEmitter)},{"../utils/getAudioVideoInputs.js":466,"../utils/getDeviceId.js":467,"../utils/getRandomInt.js":468,"../utils/gumConstraints.js":469,"../utils/sleep.js":470,"../utils/uuidv4.js":471,"./Logger.js":462,"./SocketTransport.js":464,"./platform.js":465,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/defineProperty":32,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,events:205}],464:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.SocketTransport=void 0;var i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/helpers/classCallCheck")),o=n(e("@babel/runtime/helpers/createClass")),s=n(e("@babel/runtime/helpers/possibleConstructorReturn")),c=n(e("@babel/runtime/helpers/getPrototypeOf")),u=n(e("@babel/runtime/helpers/inherits")),d=n(e("@babel/runtime/regenerator")),l=e("./Logger.js"),f=e("events");function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var h=new l.Logger("socket");r.SocketTransport=function(e){function t(e){var r,n,i,o,u=e.url,d=e.roomId,l=e.peerId,f=e.peerName,m=e.role;return(0,a.default)(this,t),n=this,i=t,i=(0,c.default)(i),r=(0,s.default)(n,p()?Reflect.construct(i,o||[],(0,c.default)(n).constructor):i.apply(n,o)),h.debug("constructor():%o ",{url:u,roomId:d,peerId:l,peerName:f,role:m}),r._closed=!1,r._params={url:u,roomId:d,peerId:l,peerName:f,role:m},r._socket=null,r._connectionStatus=null,r._createSocket(),r}return(0,u.default)(t,e),(0,o.default)(t,[{key:"closed",get:function(){return this._closed}},{key:"connectionStatus",get:function(){return this._connectionStatus}},{key:"close",value:function(){if(!this._closed){h.debug("close()"),this._closed=!0,this.emit("close");try{this._socket.disconnect()}catch(e){h.error("close() | error closing the Socket:%o",e)}}}},{key:"send",value:(l=(0,i.default)(d.default.mark(function e(t){var r;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=1;break}throw new Error("transport closed");case 1:e.prev=1,this._socket.send(JSON.stringify(t)),e.next=3;break;case 2:throw e.prev=2,r=e.catch(1),h.warn("send() failed:%o",r),r;case 3:case"end":return e.stop()}},e,this,[[1,2]])})),function(e){return l.apply(this,arguments)})},{key:"request",value:(n=(0,i.default)(d.default.mark(function e(t){var r,n,i=this;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.type,n=t.message,e.abrupt("return",new Promise(function(e){if(i._closed)throw new Error("transport closed");try{i._socket.emit(r,JSON.stringify(n),function(t){e(t)})}catch(e){throw h.warn("emit() failed:%o",e),e}}));case 1:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"_createSocket",value:(r=(0,i.default)(d.default.mark(function e(){var t,r;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this,(r=io(this._params.url,{query:{roomId:this._params.roomId,peerId:this._params.peerId,peerName:this._params.peerName,role:this._params.role}})).on("connect",function(){h.debug("Socket connected!!"),t._connectionStatus=!0,t.emit("connected")}),r.on("disconnect",function(){h.debug("Socket disconnected!!"),t._connectionStatus=!1,t.emit("disconnected")}),r.on("reconnect",function(){h.debug("Socket reconnected after disconnect!!"),r.emit("reconnected")}),r.on("message",function(e){var r=JSON.parse(e);h.debug("New mesage received with id:%s",r.type),t.emit("message",r)}),this._socket=r;case 1:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})}]);var r,n,l}(f.EventEmitter)},{"./Logger.js":462,"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/classCallCheck":29,"@babel/runtime/helpers/createClass":31,"@babel/runtime/helpers/getPrototypeOf":34,"@babel/runtime/helpers/inherits":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/possibleConstructorReturn":45,"@babel/runtime/regenerator":63,events:205}],465:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault")(e("@babel/runtime/helpers/typeof"));
3
+ * Bowser - a browser detector
4
+ * https://github.com/lancedikson/bowser
5
+ * MIT License | (c) Dustin Diaz 2012-2015
6
+ * MIT License | (c) Denis Demchenko 2015-2019
7
+ */class Pr{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Cr(e,t)}static parse(e){return new Cr(e).getResult()}static get BROWSER_MAP(){return hr}static get ENGINE_MAP(){return gr}static get OS_MAP(){return fr}static get PLATFORMS_MAP(){return mr}}const kr=t(l()),Rr="VidScale-js";let Tr=class{constructor(e){e?(this._debug=kr(`${Rr}:${e}`),this._info=kr(`${Rr}:INFO:${e}`),this._warn=kr(`${Rr}:WARN:${e}`),this._error=kr(`${Rr}:ERROR:${e}`)):(this._debug=kr(Rr),this._info=kr(`${Rr}:INFO`),this._warn=kr(`${Rr}:WARN`),this._error=kr(`${Rr}:ERROR`)),this._debug.log=function(){}.bind(),this._info.log=function(){}.bind(),this._warn.log=function(){}.bind(),this._error.log=function(){}.bind()}get debug(){return this._debug}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}};var Er,Ir={exports:{}};var xr=function(){if(Er)return Ir.exports;Er=1;var e,t="object"==typeof Reflect?Reflect:null,r=t&&"function"==typeof t.apply?t.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}Ir.exports=i,Ir.exports.once=function(e,t){return new Promise(function(r,s){function i(r){e.removeListener(t,a),s(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}m(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,r)}(e,i,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function n(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function o(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,r,s){var i,a,c;if(n(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),c=a[t]),void 0===c)c=a[t]=r,++e._eventsCount;else if("function"==typeof c?c=a[t]=s?[r,c]:[c,r]:s?c.unshift(r):c.push(r),(i=o(e))>0&&c.length>i&&!c.warned){c.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=c.length,console&&console.warn}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var s={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(s);return i.listener=r,s.wrapFn=i,i}function p(e,t,r){var s=e._events;if(void 0===s)return[];var i=s[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]: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}(i):h(i,i.length)}function u(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),s=0;s<t;++s)r[s]=e[s];return r}function m(e,t,r,s){if("function"==typeof e.on)s.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(a){s.once&&e.removeEventListener(t,i),r(a)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return o(this)},i.prototype.emit=function(e){for(var t=[],s=1;s<arguments.length;s++)t.push(arguments[s]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var n;if(t.length>0&&(n=t[0]),n instanceof Error)throw n;var o=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw o.context=n,o}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var d=c.length,l=h(c,d);for(s=0;s<d;++s)r(l[s],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return n(t),this.on(e,l(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return n(t),this.prependListener(e,l(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,s,i,a,o;if(n(t),void 0===(s=this._events))return this;if(void 0===(r=s[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(s[e]=r[0]),void 0!==s.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,s;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(s=0;s<a.length;++s)"removeListener"!==(i=a[s])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this},i.prototype.listeners=function(e){return p(this,e,!0)},i.prototype.rawListeners=function(e){return p(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):u.call(e,t)},i.prototype.listenerCount=u,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},Ir.exports}();class Dr extends xr.EventEmitter{constructor(e){super(),this.setMaxListeners(1/0),this._logger=e||new Tr("EnhancedEventEmitter")}safeEmit(e,...t){try{this.emit(e,...t)}catch(r){this._logger.error("safeEmit() | event listener threw an error [event:%s]:%o",e,r)}}async safeEmitAsPromise(e,...t){return new Promise((r,s)=>{this.safeEmit(e,...t,r,s)})}}async function Mr(e){return new Promise(t=>setTimeout(()=>t(),e))}const Lr=new Tr("Message");class Or{static parse(e){let t;const r={};try{t=JSON.parse(e)}catch(s){return void Lr.error("parse() | invalid JSON: %s",s)}if("object"==typeof t&&!Array.isArray(t)){if(t.request){if(r.request=!0,"string"!=typeof t.method)return void Lr.error("parse() | missing/invalid method field");if("number"!=typeof t.id)return void Lr.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 Lr.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 Lr.error("parse() | missing request/response field");if(r.notification=!0,"string"!=typeof t.method)return void Lr.error("parse() | missing/invalid method field");r.method=t.method,r.data=t.data||{}}return r}Lr.error("parse() | not an object")}static createRequest(e,t){return{request:!0,id:Math.round(1e7*Math.random()),method:e,data:t||{}}}static createSuccessResponse(e,t){return{response:!0,id:e.id,ok:!0,data:t||{}}}static createErrorResponse(e,t,r){return{response:!0,id:e.id,ok:!1,errorCode:t,errorReason:r}}static createNotification(e,t){return{notification:!0,method:e,data:t||{}}}}const Ar=new Tr("Peer");class Nr extends Dr{constructor(e){super(Ar),Ar.debug("constructor()"),this._closed=!1,this._transport=e,this._connected=!1,this._data={},this._sents=new Map,this._handleTransport()}get closed(){return this._closed}get connected(){return this._connected}get data(){return this._data}set data(e){throw new Error("cannot override data object")}close(){if(!this._closed){Ar.debug("close()"),this._closed=!0,this._connected=!1,this._transport.close();for(const e of this._sents.values())e.close();this.safeEmit("close")}}async request(e,t=void 0){const r=Or.createRequest(e,t);return this._logger.debug("request() [method:%s, id:%s]",e,r.id),await this._transport.send(r),new Promise((e,t)=>{const s=1500*(15+.1*this._sents.size),i={id:r.id,method:r.method,resolve:t=>{this._sents.delete(r.id)&&(clearTimeout(i.timer),e(t))},reject:e=>{this._sents.delete(r.id)&&(clearTimeout(i.timer),t(e))},timer:setTimeout(()=>{this._sents.delete(r.id)&&t(new Error("request timeout"))},s),close:()=>{clearTimeout(i.timer),t(new Error("peer closed"))}};this._sents.set(r.id,i)})}async notify(e,t=void 0){const r=Or.createNotification(e,t);this._logger.debug("notify() [method:%s]",e),await this._transport.send(r)}_handleTransport(){if(this._transport.closed)return this._closed=!0,void setTimeout(()=>{this._closed||(this._connected=!1,this.safeEmit("close"))});this._transport.on("open",()=>{this._closed||(Ar.debug('emit "open"'),this._connected=!0,this.safeEmit("open"))}),this._transport.on("disconnected",()=>{this._closed||(Ar.debug('emit "disconnected"'),this._connected=!1,this.safeEmit("disconnected"))}),this._transport.on("failed",e=>{this._closed||(Ar.debug('emit "failed" [currentAttempt:%s]',e),this._connected=!1,this.safeEmit("failed",e))}),this._transport.on("close",()=>{this._closed||(this._closed=!0,Ar.debug('emit "close"'),this._connected=!1,this.safeEmit("close"))}),this._transport.on("message",e=>{e.request?this._handleRequest(e):e.response?this._handleResponse(e):e.notification&&this._handleNotification(e)})}_handleRequest(e){try{this.emit("request",e,t=>{const r=Or.createSuccessResponse(e,t);this._transport.send(r).catch(()=>{})},(t,r)=>{t instanceof Error?(r=t.message,t=500):"number"==typeof t&&r instanceof Error&&(r=r.message);const s=Or.createErrorResponse(e,t,r);this._transport.send(s).catch(()=>{})})}catch(t){const r=Or.createErrorResponse(e,500,String(t));this._transport.send(r).catch(()=>{})}}_handleResponse(e){const t=this._sents.get(e.id);if(t)if(e.ok)t.resolve(e.data);else{const r=new Error(e.errorReason);r.code=e.errorCode,t.reject(r)}else Ar.error("received response does not match any sent request [id:%s]",e.id)}_handleNotification(e){this.safeEmit("notification",e)}}const jr=Object.create(null);jr.open="0",jr.close="1",jr.ping="2",jr.pong="3",jr.message="4",jr.upgrade="5",jr.noop="6";const Fr=Object.create(null);Object.keys(jr).forEach(e=>{Fr[jr[e]]=e});const Br={type:"error",data:"parser error"},Ur="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),$r="function"==typeof ArrayBuffer,Vr=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,qr=({type:e,data:t},r,s)=>Ur&&t instanceof Blob?r?s(t):Wr(t,s):$r&&(t instanceof ArrayBuffer||Vr(t))?r?s(t):Wr(new Blob([t]),s):s(jr[e]+(t||"")),Wr=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+(e||""))},r.readAsDataURL(e)};function zr(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Hr;const Gr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kr="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let io=0;io<64;io++)Kr[Gr.charCodeAt(io)]=io;const Jr="function"==typeof ArrayBuffer,Qr=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Yr(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:Xr(e.substring(1),t)};return Fr[r]?e.length>1?{type:Fr[r],data:e.substring(1)}:{type:Fr[r]}:Br},Xr=(e,t)=>{if(Jr){const r=(e=>{let t,r,s,i,a,n=.75*e.length,o=e.length,c=0;"="===e[e.length-1]&&(n--,"="===e[e.length-2]&&n--);const d=new ArrayBuffer(n),l=new Uint8Array(d);for(t=0;t<o;t+=4)r=Kr[e.charCodeAt(t)],s=Kr[e.charCodeAt(t+1)],i=Kr[e.charCodeAt(t+2)],a=Kr[e.charCodeAt(t+3)],l[c++]=r<<2|s>>4,l[c++]=(15&s)<<4|i>>2,l[c++]=(3&i)<<6|63&a;return d})(e);return Yr(r,t)}return{base64:!0,data:e}},Yr=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Zr=String.fromCharCode(30);function es(){return new TransformStream({transform(e,t){!function(e,t){Ur&&e.data instanceof Blob?e.data.arrayBuffer().then(zr).then(t):$r&&(e.data instanceof ArrayBuffer||Vr(e.data))?t(zr(e.data)):qr(e,!1,e=>{Hr||(Hr=new TextEncoder),t(Hr.encode(e))})}(e,r=>{const s=r.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,s)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(s))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(r)})}})}let ts;function rs(e){return e.reduce((e,t)=>e+t.length,0)}function ss(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let s=0;for(let i=0;i<t;i++)r[i]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),r}function is(e){if(e)return function(e){for(var t in is.prototype)e[t]=is.prototype[t];return e}(e)}is.prototype.on=is.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},is.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},is.prototype.off=is.prototype.removeListener=is.prototype.removeAllListeners=is.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,s=this._callbacks["$"+e];if(!s)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<s.length;i++)if((r=s[i])===t||r.fn===t){s.splice(i,1);break}return 0===s.length&&delete this._callbacks["$"+e],this},is.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(r){s=0;for(var i=(r=r.slice(0)).length;s<i;++s)r[s].apply(this,t)}return this},is.prototype.emitReserved=is.prototype.emit,is.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},is.prototype.hasListeners=function(e){return!!this.listeners(e).length};const as="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ns="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function os(e,...t){return t.reduce((t,r)=>(e.hasOwnProperty(r)&&(t[r]=e[r]),t),{})}const cs=ns.setTimeout,ds=ns.clearTimeout;function ls(e,t){t.useNativeTimers?(e.setTimeoutFn=cs.bind(ns),e.clearTimeoutFn=ds.bind(ns)):(e.setTimeoutFn=ns.setTimeout.bind(ns),e.clearTimeoutFn=ns.clearTimeout.bind(ns))}function ps(e){return"string"==typeof e?function(e){let t=0,r=0;for(let s=0,i=e.length;s<i;s++)t=e.charCodeAt(s),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(s++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))}function us(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class hs extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class ms extends is{constructor(e){super(),this.writable=!1,ls(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new hs(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Qr(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}(e);return t.length?"?"+t:""}}class fs extends ms{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const r=e.split(Zr),s=[];for(let i=0;i<r.length;i++){const e=Qr(r[i],t);if(s.push(e),"error"===e.type)break}return s})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const r=e.length,s=new Array(r);let i=0;e.forEach((e,a)=>{qr(e,!1,e=>{s[a]=e,++i===r&&t(s.join(Zr))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=us()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let gs=!1;try{gs="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(dc){}const bs=gs;function ys(){}class _s extends fs{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}let vs=class e extends is{constructor(e,t,r){super(),this.createRequest=e,ls(this,r),this._opts=r,this._method=r.method||"GET",this._uri=t,this._data=void 0!==r.data?r.data:null,this._create()}_create(){var t;const r=os(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(r);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&s.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(i){}if("POST"===this._method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(i){}try{s.setRequestHeader("Accept","*/*")}catch(i){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var e;3===s.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(s.getResponseHeader("set-cookie"))),4===s.readyState&&(200===s.status||1223===s.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof s.status?s.status:0)},0))},s.send(this._data)}catch(i){return void this.setTimeoutFn(()=>{this._onError(i)},0)}"undefined"!=typeof document&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=ys,t)try{this._xhr.abort()}catch(r){}"undefined"!=typeof document&&delete e.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};if(vs.requestsCount=0,vs.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",ws);else if("function"==typeof addEventListener){addEventListener("onpagehide"in ns?"pagehide":"unload",ws,!1)}function ws(){for(let e in vs.requests)vs.requests.hasOwnProperty(e)&&vs.requests[e].abort()}const Ss=function(){const e=Cs({xdomain:!1});return e&&null!==e.responseType}();function Cs(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||bs))return new XMLHttpRequest}catch(r){}if(!t)try{return new(ns[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(r){}}const Ps="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class ks extends ms{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,r=Ps?{}:os(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}catch(dc){return this.emitReserved("error",dc)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;qr(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(t){}s&&as(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=us()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Rs=ns.WebSocket||ns.MozWebSocket;const Ts={websocket:class extends ks{createSocket(e,t,r){return Ps?new Rs(e,t,r):t?new Rs(e,t):new Rs(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends ms{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(dc){return this.emitReserved("error",dc)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){ts||(ts=new TextDecoder);const r=[];let s=0,i=-1,a=!1;return new TransformStream({transform(n,o){for(r.push(n);;){if(0===s){if(rs(r)<1)break;const e=ss(r,1);a=!(128&~e[0]),i=127&e[0],s=i<126?3:126===i?1:2}else if(1===s){if(rs(r)<2)break;const e=ss(r,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),s=3}else if(2===s){if(rs(r)<8)break;const e=ss(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>Math.pow(2,21)-1){o.enqueue(Br);break}i=a*Math.pow(2,32)+t.getUint32(4),s=3}else{if(rs(r)<i)break;const e=ss(r,i);o.enqueue(Qr(a?e:ts.decode(e),t)),s=0}if(0===i||i>e){o.enqueue(Br);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=es();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const i=()=>{r.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;this._writer.write(r).then(()=>{s&&as(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends _s{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Ss&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new vs(Cs,this.uri(),e)}}},Es=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Is=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function xs(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),s=e.indexOf("]");-1!=r&&-1!=s&&(e=e.substring(0,r)+e.substring(r,s).replace(/:/g,";")+e.substring(s,e.length));let i=Es.exec(e||""),a={},n=14;for(;n--;)a[Is[n]]=i[n]||"";return-1!=r&&-1!=s&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(e,t){const r=/\/{2,9}/g,s=t.replace(r,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||s.splice(0,1);"/"==t.slice(-1)&&s.splice(s.length-1,1);return s}(0,a.path),a.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,s){t&&(r[t]=s)}),r}(0,a.query),a}const Ds="function"==typeof addEventListener&&"function"==typeof removeEventListener,Ms=[];Ds&&addEventListener("offline",()=>{Ms.forEach(e=>e())},!1);class Ls extends is{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const r=xs(e);t.hostname=r.host,t.secure="https"===r.protocol||"wss"===r.protocol,t.port=r.port,r.query&&(t.query=r.query)}else t.host&&(t.hostname=xs(t.host).host);ls(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},r=e.split("&");for(let s=0,i=r.length;s<i;s++){let e=r[s].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),Ds&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ms.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Ls.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",Ls.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const r=this.writeBuffer[t].data;if(r&&(e+=ps(r)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,as(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,r){return this._sendPacket("message",e,t,r),this}send(e,t,r){return this._sendPacket("message",e,t,r),this}_sendPacket(e,t,r,s){if("function"==typeof t&&(s=t,t=void 0),"function"==typeof r&&(s=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Ls.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ds&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Ms.indexOf(this._offlineEventListener);-1!==e&&Ms.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Ls.protocol=4;class Os extends Ls{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),r=!1;Ls.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!r)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ls.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(d(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){r||(r=!0,d(),t.close(),t=null)}const a=e=>{const r=new Error("probe error: "+e);r.transport=t.name,i(),this.emitReserved("upgradeError",r)};function n(){a("transport closed")}function o(){a("socket closed")}function c(e){t&&e.name!==t.name&&i()}const d=()=>{t.removeListener("open",s),t.removeListener("error",a),t.removeListener("close",n),this.off("close",o),this.off("upgrading",c)};t.once("open",s),t.once("error",a),t.once("close",n),this.once("close",o),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}let As=class extends Os{constructor(e,t={}){const r="object"==typeof e?e:t;(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>Ts[e]).filter(e=>!!e)),super(e,r)}};const Ns="function"==typeof ArrayBuffer,js=Object.prototype.toString,Fs="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===js.call(Blob),Bs="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===js.call(File);function Us(e){return Ns&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Fs&&e instanceof Blob||Bs&&e instanceof File}function $s(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,r=e.length;t<r;t++)if($s(e[t]))return!0;return!1}if(Us(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return $s(e.toJSON(),!0);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&$s(e[r]))return!0;return!1}function Vs(e){const t=[],r=e.data,s=e;return s.data=qs(r,t),s.attachments=t.length,{packet:s,buffers:t}}function qs(e,t){if(!e)return e;if(Us(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}if(Array.isArray(e)){const r=new Array(e.length);for(let s=0;s<e.length;s++)r[s]=qs(e[s],t);return r}if("object"==typeof e&&!(e instanceof Date)){const r={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=qs(e[s],t));return r}return e}function Ws(e,t){return e.data=zs(e.data,t),delete e.attachments,e}function zs(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=zs(e[r],t);else if("object"==typeof e)for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=zs(e[r],t));return e}const Hs=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Gs,Ks;(Ks=Gs||(Gs={}))[Ks.CONNECT=0]="CONNECT",Ks[Ks.DISCONNECT=1]="DISCONNECT",Ks[Ks.EVENT=2]="EVENT",Ks[Ks.ACK=3]="ACK",Ks[Ks.CONNECT_ERROR=4]="CONNECT_ERROR",Ks[Ks.BINARY_EVENT=5]="BINARY_EVENT",Ks[Ks.BINARY_ACK=6]="BINARY_ACK";function Js(e){return"[object Object]"===Object.prototype.toString.call(e)}class Qs extends is{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===Gs.BINARY_EVENT;r||t.type===Gs.BINARY_ACK?(t.type=r?Gs.EVENT:Gs.ACK,this.reconstructor=new Xs(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Us(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(void 0===Gs[r.type])throw new Error("unknown packet type "+r.type);if(r.type===Gs.BINARY_EVENT||r.type===Gs.BINARY_ACK){const s=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(s,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");r.attachments=Number(i)}if("/"===e.charAt(t+1)){const s=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}r.nsp=e.substring(s,t)}else r.nsp="/";const s=e.charAt(t+1);if(""!==s&&Number(s)==s){const s=t+1;for(;++t;){const r=e.charAt(t);if(null==r||Number(r)!=r){--t;break}if(t===e.length)break}r.id=Number(e.substring(s,t+1))}if(e.charAt(++t)){const s=this.tryParse(e.substr(t));if(!Qs.isPayloadValid(r.type,s))throw new Error("invalid payload");r.data=s}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case Gs.CONNECT:return Js(t);case Gs.DISCONNECT:return void 0===t;case Gs.CONNECT_ERROR:return"string"==typeof t||Js(t);case Gs.EVENT:case Gs.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Hs.indexOf(t[0]));case Gs.ACK:case Gs.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Xs{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Ws(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Ys=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Qs,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Gs.EVENT&&e.type!==Gs.ACK||!$s(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Gs.EVENT?Gs.BINARY_EVENT:Gs.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Gs.BINARY_EVENT&&e.type!==Gs.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Vs(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}},get PacketType(){return Gs},protocol:5},Symbol.toStringTag,{value:"Module"}));function Zs(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const ei=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ti extends is{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Zs(e,"open",this.onopen.bind(this)),Zs(e,"packet",this.onpacket.bind(this)),Zs(e,"error",this.onerror.bind(this)),Zs(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var r,s,i;if(ei.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const a={type:Gs.EVENT,data:t,options:{}};if(a.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),a.id=e}const n=null===(s=null===(r=this.io.engine)||void 0===r?void 0:r.transport)||void 0===s?void 0:s.writable,o=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!n||(o?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(e,t){var r;const s=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===s)return void(this.acks[e]=t);const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},s),a=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...t){return new Promise((r,s)=>{const i=(e,t)=>e?s(e):r(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...s)=>{if(r!==this._queue[0])return;return null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...s)),r.pending=!1,this._drainQueue()}),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Gs.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Gs.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Gs.EVENT:case Gs.BINARY_EVENT:this.onevent(e);break;case Gs.ACK:case Gs.BINARY_ACK:this.onack(e);break;case Gs.DISCONNECT:this.ondisconnect();break;case Gs.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:Gs.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Gs.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function ri(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ri.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+r:e-r}return 0|Math.min(e,this.max)},ri.prototype.reset=function(){this.attempts=0},ri.prototype.setMin=function(e){this.ms=e},ri.prototype.setMax=function(e){this.max=e},ri.prototype.setJitter=function(e){this.jitter=e};class si extends is{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,ls(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=t.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new ri({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||Ys;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new As(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Zs(t,"open",function(){r.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},a=Zs(t,"error",i);if(!1!==this._timeout){const e=this._timeout,r=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}return this.subs.push(s),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Zs(e,"ping",this.onping.bind(this)),Zs(e,"data",this.ondata.bind(this)),Zs(e,"error",this.onerror.bind(this)),Zs(e,"close",this.onclose.bind(this)),Zs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){as(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ti(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t){if(this.nsps[r].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var r;this.cleanup(),null===(r=this.engine)||void 0===r||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ii={};function ai(e,t){"object"==typeof e&&(t=e,e=void 0);const r=function(e,t="",r){let s=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),s=xs(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=-1!==s.host.indexOf(":")?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+t,s.href=s.protocol+"://"+i+(r&&r.port===s.port?"":":"+s.port),s}(e,(t=t||{}).path||"/socket.io"),s=r.source,i=r.id,a=r.path,n=ii[i]&&a in ii[i].nsps;let o;return t.forceNew||t["force new connection"]||!1===t.multiplex||n?o=new si(s,t):(ii[i]||(ii[i]=new si(s,t)),o=ii[i]),r.query&&!t.query&&(t.query=r.queryKey),o.socket(r.path,t)}Object.assign(ai,{Manager:si,Socket:ti,io:ai,connect:ai}),new Tr("WebSocketTransport");const ni=new Tr("WebsocketTransport");class oi extends Dr{constructor(e,t){super(ni),this._closed=!1,this._url=e,this._ws=null,this._socketShouldReconnect=t,this._isConnected=!1,this._lastTimerId=null,this._roomJoined=!1,ni.info("Request received to instantiate websocket transport! with url :%s",e),this.createAndUpdateSocket({connectionType:null})}get connectionStatus(){return this._isConnected}createAndUpdateSocket=async({connectionType:e=null})=>{ni.info("Room close status:%s",this._closed);let t,r=this;if(this._closed)return void ni.info("Websocket already closed!");if(!this._url)return void ni.warn("url not available!");t=null===e?`${this._url}&connectionType=landing`:`${this._url}&connectionType=${e}`,ni.debug("the url is:%s",t),this._ws=new WebSocket(t);let s=0;for(ni.debug("websocketHelper createAndUpdateSocket created a new websocket"),ni.debug("websocketHelper createAndUpdateSocket:%s",this._ws.readyState);1!==this._ws.readyState&&this._socketShouldReconnect;)if(3===this._ws.readyState&&(ni.debug("websocketHelper createAndUpdateSocket"),await Mr(2e3),this._ws=new WebSocket(t),ni.debug("websocketHelper createAndUpdateSocket newly created websocket state:%s",this._ws.readyState)),await Mr(500),s++,s>250){ni.error("No of retries limit to connect with server exhausted!");break}1===this._ws.readyState&&ni.debug(`updated the websocket with ready state -${this._ws.readyState}`),this.safeEmit("connected"),ni.debug(`updating the websocket to redux store with ready state -${this._ws.readyState}`),this._ws.onopen=()=>{this._closed||(ni.debug("Websocket open"),this.safeEmit("open"))},this._isConnected=!0,this._ws.onmessage=e=>{if(this._closed)return;let t=JSON.parse(e.data);switch(t.id){case"ping":{this._lastTimerId&&clearTimeout(this._lastTimerId);let e=this;this._lastTimerId=setTimeout(function(){e._isConnected=!1,this._roomJoined?e.close(4104,"In call connections close as server is unreachable for last 5 seconds!"):e.close(4103,"Landing page socket close by client as server not reachable for a couple of seconds!"),e._socketShouldReconnect&&(e._closed=!1,e.createAndUpdateSocket({connectionType:"inCall"}))},22e3);const t={id:"pong"};this._ws.send(JSON.stringify(t));break}case"invalidToken":ni.debug("Session token invalid!"),this._socketShouldReconnect=!1,this.safeEmit("invalidToken",t);break;case"alreadyActive":this.safeEmit("alreadyActive",t);break;case"passwordDisabled":this.safeEmit("passwordDisabled",t);break;case"notify":this.safeEmit("notify",t.data);break;case"remotePeerJoin":this.safeEmit("roomStartedP2p",t);break;case"userError":this.safeEmit("userError",t);break;case"validationAlert":this.safeEmit("validationError",t);break;case"joinStatusOnLanding":this.safeEmit("defaultJoinStatus",t);break;default:this.safeEmit("message",t)}},this._ws.onclose=e=>{r._closed||(ni.warn('WebSocket "close" event [wasClean:%s, code:%s, reason:"%s"]',e.wasClean,e.code,e.reason),4503===e.code||4504===e.code?(ni.error("Socket closed with reason",e.reason),r._closed=!0):4500!==e.code&&(ni.debug("trying to reconnect:%s",e.code),r._closed=!1,this._roomJoined?(ni.debug("Trying to join after a network reset while in a meeting"),r.createAndUpdateSocket({connectionType:"inCall"})):(ni.debug("Trying to join after a network reset while on the landing page"),r.createAndUpdateSocket({connectionType:null})),clearTimeout(r._lastTimerId)),this._url=null,ni.info("The websocket closed status is:%s",r._closed),r.safeEmit("close",{code:e.code,reason:e.reason}))}};close(e,t){if(!this._closed){ni.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(r){ni.error("close() | error closing the WebSocket: %o",r)}}}async send(e){if(this._closed)ni.error("Transport closed or not yet ready. Try again later!");else try{this._ws.send(JSON.stringify(e))}catch(t){throw ni.warn("send() failed:%o",t),t}}}const ci=()=>Math.floor(1e10*Math.random()),di=()=>"111-111-1111".replace(/[018]/g,()=>(15&crypto.getRandomValues(new Uint8Array(1))[0]).toString(16));function li(e,t){return function(){return e.apply(t,arguments)}}const{toString:pi}=Object.prototype,{getPrototypeOf:ui}=Object,{iterator:hi,toStringTag:mi}=Symbol,fi=(e=>t=>{const r=pi.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),gi=e=>(e=e.toLowerCase(),t=>fi(t)===e),bi=e=>t=>typeof t===e,{isArray:yi}=Array,_i=bi("undefined");function vi(e){return null!==e&&!_i(e)&&null!==e.constructor&&!_i(e.constructor)&&Ci(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const wi=gi("ArrayBuffer");const Si=bi("string"),Ci=bi("function"),Pi=bi("number"),ki=e=>null!==e&&"object"==typeof e,Ri=e=>{if("object"!==fi(e))return!1;const t=ui(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||mi in e||hi in e)},Ti=gi("Date"),Ei=gi("File"),Ii=gi("Blob"),xi=gi("FileList"),Di=gi("URLSearchParams"),[Mi,Li,Oi,Ai]=["ReadableStream","Request","Response","Headers"].map(gi);function Ni(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let s,i;if("object"!=typeof e&&(e=[e]),yi(e))for(s=0,i=e.length;s<i;s++)t.call(null,e[s],s,e);else{if(vi(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let n;for(s=0;s<a;s++)n=i[s],t.call(null,e[n],n,e)}}function ji(e,t){if(vi(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s,i=r.length;for(;i-- >0;)if(s=r[i],t===s.toLowerCase())return s;return null}const Fi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:globalThis,Bi=e=>!_i(e)&&e!==Fi;const Ui=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&ui(Uint8Array)),$i=gi("HTMLFormElement"),Vi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),qi=gi("RegExp"),Wi=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Ni(r,(r,i)=>{let a;!1!==(a=t(r,i,e))&&(s[i]=a||r)}),Object.defineProperties(e,s)};const zi=gi("AsyncFunction"),Hi=(Gi="function"==typeof setImmediate,Ki=Ci(Fi.postMessage),Gi?setImmediate:Ki?(Ji=`axios@${Math.random()}`,Qi=[],Fi.addEventListener("message",({source:e,data:t})=>{e===Fi&&t===Ji&&Qi.length&&Qi.shift()()},!1),e=>{Qi.push(e),Fi.postMessage(Ji,"*")}):e=>setTimeout(e));var Gi,Ki,Ji,Qi;const Xi="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Fi):"undefined"!=typeof process&&process.nextTick||Hi,Yi={isArray:yi,isArrayBuffer:wi,isBuffer:vi,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ci(e.append)&&("formdata"===(t=fi(e))||"object"===t&&Ci(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&wi(e.buffer),t},isString:Si,isNumber:Pi,isBoolean:e=>!0===e||!1===e,isObject:ki,isPlainObject:Ri,isEmptyObject:e=>{if(!ki(e)||vi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:Mi,isRequest:Li,isResponse:Oi,isHeaders:Ai,isUndefined:_i,isDate:Ti,isFile:Ei,isBlob:Ii,isRegExp:qi,isFunction:Ci,isStream:e=>ki(e)&&Ci(e.pipe),isURLSearchParams:Di,isTypedArray:Ui,isFileList:xi,forEach:Ni,merge:function e(){const{caseless:t}=Bi(this)&&this||{},r={},s=(s,i)=>{const a=t&&ji(r,i)||i;Ri(r[a])&&Ri(s)?r[a]=e(r[a],s):Ri(s)?r[a]=e({},s):yi(s)?r[a]=s.slice():r[a]=s};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&Ni(arguments[i],s);return r},extend:(e,t,r,{allOwnKeys:s}={})=>(Ni(t,(t,s)=>{r&&Ci(t)?e[s]=li(t,r):e[s]=t},{allOwnKeys:s}),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,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,s)=>{let i,a,n;const o={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)n=i[a],s&&!s(n,e,t)||o[n]||(t[n]=e[n],o[n]=!0);e=!1!==r&&ui(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:fi,kindOfTest:gi,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return-1!==s&&s===r},toArray:e=>{if(!e)return null;if(yi(e))return e;let t=e.length;if(!Pi(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[hi]).call(e);let s;for(;(s=r.next())&&!s.done;){const r=s.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const s=[];for(;null!==(r=e.exec(t));)s.push(r);return s},isHTMLForm:$i,hasOwnProperty:Vi,hasOwnProp:Vi,reduceDescriptors:Wi,freezeMethods:e=>{Wi(e,(t,r)=>{if(Ci(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const s=e[r];Ci(s)&&(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={},s=e=>{e.forEach(e=>{r[e]=!0})};return yi(e)?s(e):s(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)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ji,global:Fi,isContextDefined:Bi,isSpecCompliantForm:function(e){return!!(e&&Ci(e.append)&&"FormData"===e[mi]&&e[hi])},toJSONObject:e=>{const t=new Array(10),r=(e,s)=>{if(ki(e)){if(t.indexOf(e)>=0)return;if(vi(e))return e;if(!("toJSON"in e)){t[s]=e;const i=yi(e)?[]:{};return Ni(e,(e,t)=>{const a=r(e,s+1);!_i(a)&&(i[t]=a)}),t[s]=void 0,i}}return e};return r(e,0)},isAsyncFn:zi,isThenable:e=>e&&(ki(e)||Ci(e))&&Ci(e.then)&&Ci(e.catch),setImmediate:Hi,asap:Xi,isIterable:e=>null!=e&&Ci(e[hi])};function Zi(e,t,r,s,i){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),s&&(this.request=s),i&&(this.response=i,this.status=i.status?i.status:null)}Yi.inherits(Zi,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:Yi.toJSONObject(this.config),code:this.code,status:this.status}}});const ea=Zi.prototype,ta={};["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=>{ta[e]={value:e}}),Object.defineProperties(Zi,ta),Object.defineProperty(ea,"isAxiosError",{value:!0}),Zi.from=(e,t,r,s,i,a)=>{const n=Object.create(ea);return Yi.toFlatObject(e,n,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),Zi.call(n,e.message,t,r,s,i),n.cause=e,n.name=e.name,a&&Object.assign(n,a),n};function ra(e){return Yi.isPlainObject(e)||Yi.isArray(e)}function sa(e){return Yi.endsWith(e,"[]")?e.slice(0,-2):e}function ia(e,t,r){return e?e.concat(t).map(function(e,t){return e=sa(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const aa=Yi.toFlatObject(Yi,{},null,function(e){return/^is[A-Z]/.test(e)});function na(e,t,r){if(!Yi.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const s=(r=Yi.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Yi.isUndefined(t[e])})).metaTokens,i=r.visitor||d,a=r.dots,n=r.indexes,o=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Yi.isSpecCompliantForm(t);if(!Yi.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Yi.isDate(e))return e.toISOString();if(Yi.isBoolean(e))return e.toString();if(!o&&Yi.isBlob(e))throw new Zi("Blob is not supported. Use a Buffer instead.");return Yi.isArrayBuffer(e)||Yi.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,r,i){let o=e;if(e&&!i&&"object"==typeof e)if(Yi.endsWith(r,"{}"))r=s?r:r.slice(0,-2),e=JSON.stringify(e);else if(Yi.isArray(e)&&function(e){return Yi.isArray(e)&&!e.some(ra)}(e)||(Yi.isFileList(e)||Yi.endsWith(r,"[]"))&&(o=Yi.toArray(e)))return r=sa(r),o.forEach(function(e,s){!Yi.isUndefined(e)&&null!==e&&t.append(!0===n?ia([r],s,a):null===n?r:r+"[]",c(e))}),!1;return!!ra(e)||(t.append(ia(i,r,a),c(e)),!1)}const l=[],p=Object.assign(aa,{defaultVisitor:d,convertValue:c,isVisitable:ra});if(!Yi.isObject(e))throw new TypeError("data must be an object");return function e(r,s){if(!Yi.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+s.join("."));l.push(r),Yi.forEach(r,function(r,a){!0===(!(Yi.isUndefined(r)||null===r)&&i.call(t,r,Yi.isString(a)?a.trim():a,s,p))&&e(r,s?s.concat(a):[a])}),l.pop()}}(e),t}function oa(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ca(e,t){this._pairs=[],e&&na(e,this,t)}const da=ca.prototype;function la(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function pa(e,t,r){if(!t)return e;const s=r&&r.encode||la;Yi.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let a;if(a=i?i(t,r):Yi.isURLSearchParams(t)?t.toString():new ca(t,r).toString(s),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}da.append=function(e,t){this._pairs.push([e,t])},da.toString=function(e){const t=e?function(t){return e.call(this,t,oa)}:oa;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class ua{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){Yi.forEach(this.handlers,function(t){null!==t&&e(t)})}}const ha={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ma={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ca,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},fa="undefined"!=typeof window&&"undefined"!=typeof document,ga="object"==typeof navigator&&navigator||void 0,ba=fa&&(!ga||["ReactNative","NativeScript","NS"].indexOf(ga.product)<0),ya="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,_a=fa&&window.location.href||"http://localhost",va={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fa,hasStandardBrowserEnv:ba,hasStandardBrowserWebWorkerEnv:ya,navigator:ga,origin:_a},Symbol.toStringTag,{value:"Module"})),...ma};function wa(e){function t(e,r,s,i){let a=e[i++];if("__proto__"===a)return!0;const n=Number.isFinite(+a),o=i>=e.length;if(a=!a&&Yi.isArray(s)?s.length:a,o)return Yi.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!n;s[a]&&Yi.isObject(s[a])||(s[a]=[]);return t(e,r,s[a],i)&&Yi.isArray(s[a])&&(s[a]=function(e){const t={},r=Object.keys(e);let s;const i=r.length;let a;for(s=0;s<i;s++)a=r[s],t[a]=e[a];return t}(s[a])),!n}if(Yi.isFormData(e)&&Yi.isFunction(e.entries)){const r={};return Yi.forEachEntry(e,(e,s)=>{t(function(e){return Yi.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),s,r,0)}),r}return null}const Sa={transitional:ha,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=Yi.isObject(e);i&&Yi.isHTMLForm(e)&&(e=new FormData(e));if(Yi.isFormData(e))return s?JSON.stringify(wa(e)):e;if(Yi.isArrayBuffer(e)||Yi.isBuffer(e)||Yi.isStream(e)||Yi.isFile(e)||Yi.isBlob(e)||Yi.isReadableStream(e))return e;if(Yi.isArrayBufferView(e))return e.buffer;if(Yi.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return na(e,new va.classes.URLSearchParams,{visitor:function(e,t,r,s){return va.isNode&&Yi.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((a=Yi.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return na(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),function(e,t,r){if(Yi.isString(e))try{return(t||JSON.parse)(e),Yi.trim(e)}catch(s){if("SyntaxError"!==s.name)throw s}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Sa.transitional,r=t&&t.forcedJSONParsing,s="json"===this.responseType;if(Yi.isResponse(e)||Yi.isReadableStream(e))return e;if(e&&Yi.isString(e)&&(r&&!this.responseType||s)){const r=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(i){if(r){if("SyntaxError"===i.name)throw Zi.from(i,Zi.ERR_BAD_RESPONSE,this,null,this.response);throw i}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:va.classes.FormData,Blob:va.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Yi.forEach(["delete","get","head","post","put","patch"],e=>{Sa.headers[e]={}});const Ca=Yi.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"]),Pa=Symbol("internals");function ka(e){return e&&String(e).trim().toLowerCase()}function Ra(e){return!1===e||null==e?e:Yi.isArray(e)?e.map(Ra):String(e)}function Ta(e,t,r,s,i){return Yi.isFunction(s)?s.call(this,t,r):(i&&(t=r),Yi.isString(t)?Yi.isString(s)?-1!==t.indexOf(s):Yi.isRegExp(s)?s.test(t):void 0:void 0)}let Ea=class{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function i(e,t,r){const i=ka(t);if(!i)throw new Error("header name must be a non-empty string");const a=Yi.findKey(s,i);(!a||void 0===s[a]||!0===r||void 0===r&&!1!==s[a])&&(s[a||t]=Ra(e))}const a=(e,t)=>Yi.forEach(e,(e,r)=>i(e,r,t));if(Yi.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(Yi.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let r,s,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),s=e.substring(i+1).trim(),!r||t[r]&&Ca[r]||("set-cookie"===r?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t})(e),t);else if(Yi.isObject(e)&&Yi.isIterable(e)){let r,s,i={};for(const t of e){if(!Yi.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[s=t[0]]=(r=i[s])?Yi.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=ka(e)){const r=Yi.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 s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}(e);if(Yi.isFunction(t))return t.call(this,e,r);if(Yi.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ka(e)){const r=Yi.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ta(0,this[r],r,t))}return!1}delete(e,t){const r=this;let s=!1;function i(e){if(e=ka(e)){const i=Yi.findKey(r,e);!i||t&&!Ta(0,r[i],i,t)||(delete r[i],s=!0)}}return Yi.isArray(e)?e.forEach(i):i(e),s}clear(e){const t=Object.keys(this);let r=t.length,s=!1;for(;r--;){const i=t[r];e&&!Ta(0,this[i],i,e,!0)||(delete this[i],s=!0)}return s}normalize(e){const t=this,r={};return Yi.forEach(this,(s,i)=>{const a=Yi.findKey(r,i);if(a)return t[a]=Ra(s),void delete t[i];const n=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(i):String(i).trim();n!==i&&delete t[i],t[n]=Ra(s),r[n]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Yi.forEach(this,(r,s)=>{null!=r&&!1!==r&&(t[s]=e&&Yi.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")}getSetCookie(){return this.get("set-cookie")||[]}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[Pa]=this[Pa]={accessors:{}}).accessors,r=this.prototype;function s(e){const s=ka(e);t[s]||(!function(e,t){const r=Yi.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(e,r,i){return this[s].call(this,t,e,r,i)},configurable:!0})})}(r,e),t[s]=!0)}return Yi.isArray(e)?e.forEach(s):s(e),this}};function Ia(e,t){const r=this||Sa,s=t||r,i=Ea.from(s.headers);let a=s.data;return Yi.forEach(e,function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function xa(e){return!(!e||!e.__CANCEL__)}function Da(e,t,r){Zi.call(this,null==e?"canceled":e,Zi.ERR_CANCELED,t,r),this.name="CanceledError"}function Ma(e,t,r){const s=r.config.validateStatus;r.status&&s&&!s(r.status)?t(new Zi("Request failed with status code "+r.status,[Zi.ERR_BAD_REQUEST,Zi.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}Ea.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Yi.reduceDescriptors(Ea.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Yi.freezeMethods(Ea),Yi.inherits(Da,Zi,{__CANCEL__:!0});const La=(e,t,r=3)=>{let s=0;const i=function(e,t){e=e||10;const r=new Array(e),s=new Array(e);let i,a=0,n=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),d=s[n];i||(i=c),r[a]=o,s[a]=c;let l=n,p=0;for(;l!==a;)p+=r[l++],l%=e;if(a=(a+1)%e,a===n&&(n=(n+1)%e),c-i<t)return;const u=d&&c-d;return u?Math.round(1e3*p/u):void 0}}(50,250);return function(e,t){let r,s,i=0,a=1e3/t;const n=(t,a=Date.now())=>{i=a,r=null,s&&(clearTimeout(s),s=null),e(...t)};return[(...e)=>{const t=Date.now(),o=t-i;o>=a?n(e,t):(r=e,s||(s=setTimeout(()=>{s=null,n(r)},a-o)))},()=>r&&n(r)]}(r=>{const a=r.loaded,n=r.lengthComputable?r.total:void 0,o=a-s,c=i(o);s=a;e({loaded:a,total:n,progress:n?a/n:void 0,bytes:o,rate:c||void 0,estimated:c&&n&&a<=n?(n-a)/c:void 0,event:r,lengthComputable:null!=n,[t?"download":"upload"]:!0})},r)},Oa=(e,t)=>{const r=null!=e;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},Aa=e=>(...t)=>Yi.asap(()=>e(...t)),Na=va.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,va.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(va.origin),va.navigator&&/(msie|trident)/i.test(va.navigator.userAgent)):()=>!0,ja=va.hasStandardBrowserEnv?{write(e,t,r,s,i,a){const n=[e+"="+encodeURIComponent(t)];Yi.isNumber(r)&&n.push("expires="+new Date(r).toGMTString()),Yi.isString(s)&&n.push("path="+s),Yi.isString(i)&&n.push("domain="+i),!0===a&&n.push("secure"),document.cookie=n.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Fa(e,t,r){let s=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(s||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ba=e=>e instanceof Ea?{...e}:e;function Ua(e,t){t=t||{};const r={};function s(e,t,r,s){return Yi.isPlainObject(e)&&Yi.isPlainObject(t)?Yi.merge.call({caseless:s},e,t):Yi.isPlainObject(t)?Yi.merge({},t):Yi.isArray(t)?t.slice():t}function i(e,t,r,i){return Yi.isUndefined(t)?Yi.isUndefined(e)?void 0:s(void 0,e,0,i):s(e,t,0,i)}function a(e,t){if(!Yi.isUndefined(t))return s(void 0,t)}function n(e,t){return Yi.isUndefined(t)?Yi.isUndefined(e)?void 0:s(void 0,e):s(void 0,t)}function o(r,i,a){return a in t?s(r,i):a in e?s(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:n,transformRequest:n,transformResponse:n,paramsSerializer:n,timeout:n,timeoutMessage:n,withCredentials:n,withXSRFToken:n,adapter:n,responseType:n,xsrfCookieName:n,xsrfHeaderName:n,onUploadProgress:n,onDownloadProgress:n,decompress:n,maxContentLength:n,maxBodyLength:n,beforeRedirect:n,transport:n,httpAgent:n,httpsAgent:n,cancelToken:n,socketPath:n,responseEncoding:n,validateStatus:o,headers:(e,t,r)=>i(Ba(e),Ba(t),0,!0)};return Yi.forEach(Object.keys({...e,...t}),function(s){const a=c[s]||i,n=a(e[s],t[s],s);Yi.isUndefined(n)&&a!==o||(r[s]=n)}),r}const $a=e=>{const t=Ua({},e);let r,{data:s,withXSRFToken:i,xsrfHeaderName:a,xsrfCookieName:n,headers:o,auth:c}=t;if(t.headers=o=Ea.from(o),t.url=pa(Fa(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Yi.isFormData(s))if(va.hasStandardBrowserEnv||va.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(!1!==(r=o.getContentType())){const[e,...t]=r?r.split(";").map(e=>e.trim()).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "))}if(va.hasStandardBrowserEnv&&(i&&Yi.isFunction(i)&&(i=i(t)),i||!1!==i&&Na(t.url))){const e=a&&n&&ja.read(n);e&&o.set(a,e)}return t},Va="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const s=$a(e);let i=s.data;const a=Ea.from(s.headers).normalize();let n,o,c,d,l,{responseType:p,onUploadProgress:u,onDownloadProgress:h}=s;function m(){d&&d(),l&&l(),s.cancelToken&&s.cancelToken.unsubscribe(n),s.signal&&s.signal.removeEventListener("abort",n)}let f=new XMLHttpRequest;function g(){if(!f)return;const s=Ea.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());Ma(function(e){t(e),m()},function(e){r(e),m()},{data:p&&"text"!==p&&"json"!==p?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:s,config:e,request:f}),f=null}f.open(s.method.toUpperCase(),s.url,!0),f.timeout=s.timeout,"onloadend"in f?f.onloadend=g:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(g)},f.onabort=function(){f&&(r(new Zi("Request aborted",Zi.ECONNABORTED,e,f)),f=null)},f.onerror=function(){r(new Zi("Network Error",Zi.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const i=s.transitional||ha;s.timeoutErrorMessage&&(t=s.timeoutErrorMessage),r(new Zi(t,i.clarifyTimeoutError?Zi.ETIMEDOUT:Zi.ECONNABORTED,e,f)),f=null},void 0===i&&a.setContentType(null),"setRequestHeader"in f&&Yi.forEach(a.toJSON(),function(e,t){f.setRequestHeader(t,e)}),Yi.isUndefined(s.withCredentials)||(f.withCredentials=!!s.withCredentials),p&&"json"!==p&&(f.responseType=s.responseType),h&&([c,l]=La(h,!0),f.addEventListener("progress",c)),u&&f.upload&&([o,d]=La(u),f.upload.addEventListener("progress",o),f.upload.addEventListener("loadend",d)),(s.cancelToken||s.signal)&&(n=t=>{f&&(r(!t||t.type?new Da(null,e,f):t),f.abort(),f=null)},s.cancelToken&&s.cancelToken.subscribe(n),s.signal&&(s.signal.aborted?n():s.signal.addEventListener("abort",n)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(s.url);b&&-1===va.protocols.indexOf(b)?r(new Zi("Unsupported protocol "+b+":",Zi.ERR_BAD_REQUEST,e)):f.send(i||null)})},qa=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,s=new AbortController;const i=function(e){if(!r){r=!0,n();const t=e instanceof Error?e:this.reason;s.abort(t instanceof Zi?t:new Da(t instanceof Error?t.message:t))}};let a=t&&setTimeout(()=>{a=null,i(new Zi(`timeout ${t} of ms exceeded`,Zi.ETIMEDOUT))},t);const n=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:o}=s;return o.unsubscribe=()=>Yi.asap(n),o}},Wa=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let s,i=0;for(;i<r;)s=i+t,yield e.slice(i,s),i=s},za=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Ha=(e,t,r,s)=>{const i=async function*(e,t){for await(const r of za(e))yield*Wa(r,t)}(e,t);let a,n=0,o=e=>{a||(a=!0,s&&s(e))};return new ReadableStream({async pull(e){try{const{done:t,value:s}=await i.next();if(t)return o(),void e.close();let a=s.byteLength;if(r){let e=n+=a;r(e)}e.enqueue(new Uint8Array(s))}catch(dc){throw o(dc),dc}},cancel:e=>(o(e),i.return())},{highWaterMark:2})},Ga="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Ka=Ga&&"function"==typeof ReadableStream,Ja=Ga&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Qa=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},Xa=Ka&&Qa(()=>{let e=!1;const t=new Request(va.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ya=Ka&&Qa(()=>Yi.isReadableStream(new Response("").body)),Za={stream:Ya&&(e=>e.body)};var en;Ga&&(en=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Za[e]&&(Za[e]=Yi.isFunction(en[e])?t=>t[e]():(t,r)=>{throw new Zi(`Response type '${e}' is not supported`,Zi.ERR_NOT_SUPPORT,r)})}));const tn=async(e,t)=>{const r=Yi.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Yi.isBlob(e))return e.size;if(Yi.isSpecCompliantForm(e)){const t=new Request(va.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Yi.isArrayBufferView(e)||Yi.isArrayBuffer(e)?e.byteLength:(Yi.isURLSearchParams(e)&&(e+=""),Yi.isString(e)?(await Ja(e)).byteLength:void 0)})(t):r},rn={http:null,xhr:Va,fetch:Ga&&(async e=>{let{url:t,method:r,data:s,signal:i,cancelToken:a,timeout:n,onDownloadProgress:o,onUploadProgress:c,responseType:d,headers:l,withCredentials:p="same-origin",fetchOptions:u}=$a(e);d=d?(d+"").toLowerCase():"text";let h,m=qa([i,a&&a.toAbortSignal()],n);const f=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let g;try{if(c&&Xa&&"get"!==r&&"head"!==r&&0!==(g=await tn(l,s))){let e,r=new Request(t,{method:"POST",body:s,duplex:"half"});if(Yi.isFormData(s)&&(e=r.headers.get("content-type"))&&l.setContentType(e),r.body){const[e,t]=Oa(g,La(Aa(c)));s=Ha(r.body,65536,e,t)}}Yi.isString(p)||(p=p?"include":"omit");const i="credentials"in Request.prototype;h=new Request(t,{...u,signal:m,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:s,duplex:"half",credentials:i?p:void 0});let a=await fetch(h,u);const n=Ya&&("stream"===d||"response"===d);if(Ya&&(o||n&&f)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=a[t]});const t=Yi.toFiniteNumber(a.headers.get("content-length")),[r,s]=o&&Oa(t,La(Aa(o),!0))||[];a=new Response(Ha(a.body,65536,r,()=>{s&&s(),f&&f()}),e)}d=d||"text";let b=await Za[Yi.findKey(Za,d)||"text"](a,e);return!n&&f&&f(),await new Promise((t,r)=>{Ma(t,r,{data:b,headers:Ea.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:h})})}catch(dc){if(f&&f(),dc&&"TypeError"===dc.name&&/Load failed|fetch/i.test(dc.message))throw Object.assign(new Zi("Network Error",Zi.ERR_NETWORK,e,h),{cause:dc.cause||dc});throw Zi.from(dc,dc&&dc.code,e,h)}})};Yi.forEach(rn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});const sn=e=>`- ${e}`,an=e=>Yi.isFunction(e)||null===e||!1===e,nn=e=>{e=Yi.isArray(e)?e:[e];const{length:t}=e;let r,s;const i={};for(let a=0;a<t;a++){let t;if(r=e[a],s=r,!an(r)&&(s=rn[(t=String(r)).toLowerCase()],void 0===s))throw new Zi(`Unknown adapter '${t}'`);if(s)break;i[t||"#"+a]=s}if(!s){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Zi("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(sn).join("\n"):" "+sn(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s};function on(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Da(null,e)}function cn(e){on(e),e.headers=Ea.from(e.headers),e.data=Ia.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return nn(e.adapter||Sa.adapter)(e).then(function(t){return on(e),t.data=Ia.call(e,e.transformResponse,t),t.headers=Ea.from(t.headers),t},function(t){return xa(t)||(on(e),t&&t.response&&(t.response.data=Ia.call(e,e.transformResponse,t.response),t.response.headers=Ea.from(t.response.headers))),Promise.reject(t)})}const dn="1.11.0",ln={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ln[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const pn={};ln.transitional=function(e,t,r){return(s,i,a)=>{if(!1===e)throw new Zi(function(e,t){return"[Axios v"+dn+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}(i," has been removed"+(t?" in "+t:"")),Zi.ERR_DEPRECATED);return t&&!pn[i]&&(pn[i]=!0),!e||e(s,i,a)}},ln.spelling=function(e){return(e,t)=>!0};const un={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Zi("options must be an object",Zi.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let i=s.length;for(;i-- >0;){const a=s[i],n=t[a];if(n){const t=e[a],r=void 0===t||n(t,a,e);if(!0!==r)throw new Zi("option "+a+" must be "+r,Zi.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Zi("Unknown option "+a,Zi.ERR_BAD_OPTION)}},validators:ln},hn=un.validators;let mn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ua,response:new ua}}async request(e,t){try{return await this._request(e,t)}catch(dc){if(dc instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const s=t.stack?t.stack.replace(/^.+\n/,""):"";try{dc.stack?s&&!String(dc.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(dc.stack+="\n"+s):dc.stack=s}catch(r){}}throw dc}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ua(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:i}=t;void 0!==r&&un.assertOptions(r,{silentJSONParsing:hn.transitional(hn.boolean),forcedJSONParsing:hn.transitional(hn.boolean),clarifyTimeoutError:hn.transitional(hn.boolean)},!1),null!=s&&(Yi.isFunction(s)?t.paramsSerializer={serialize:s}:un.assertOptions(s,{encode:hn.function,serialize:hn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),un.assertOptions(t,{baseUrl:hn.spelling("baseURL"),withXsrfToken:hn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&Yi.merge(i.common,i[t.method]);i&&Yi.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=Ea.concat(a,i);const n=[];let o=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,n.unshift(e.fulfilled,e.rejected))});const c=[];let d;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,p=0;if(!o){const e=[cn.bind(this),void 0];for(e.unshift(...n),e.push(...c),l=e.length,d=Promise.resolve(t);p<l;)d=d.then(e[p++],e[p++]);return d}l=n.length;let u=t;for(p=0;p<l;){const e=n[p++],t=n[p++];try{u=e(u)}catch(h){t.call(this,h);break}}try{d=cn.call(this,u)}catch(h){return Promise.reject(h)}for(p=0,l=c.length;p<l;)d=d.then(c[p++],c[p++]);return d}getUri(e){return pa(Fa((e=Ua(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Yi.forEach(["delete","get","head","options"],function(e){mn.prototype[e]=function(t,r){return this.request(Ua(r||{},{method:e,url:t,data:(r||{}).data}))}}),Yi.forEach(["post","put","patch"],function(e){function t(t){return function(r,s,i){return this.request(Ua(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}mn.prototype[e]=t(),mn.prototype[e+"Form"]=t(!0)});const fn={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(fn).forEach(([e,t])=>{fn[t]=e});const gn=function e(t){const r=new mn(t),s=li(mn.prototype.request,r);return Yi.extend(s,mn.prototype,r,{allOwnKeys:!0}),Yi.extend(s,r,null,{allOwnKeys:!0}),s.create=function(r){return e(Ua(t,r))},s}(Sa);gn.Axios=mn,gn.CanceledError=Da,gn.CancelToken=class e{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 s=new Promise(e=>{r.subscribe(e),t=e}).then(e);return s.cancel=function(){r.unsubscribe(t)},s},e(function(e,s,i){r.reason||(r.reason=new Da(e,s,i),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)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},gn.isCancel=xa,gn.VERSION=dn,gn.toFormData=na,gn.AxiosError=Zi,gn.Cancel=gn.CanceledError,gn.all=function(e){return Promise.all(e)},gn.spread=function(e){return function(t){return e.apply(null,t)}},gn.isAxiosError=function(e){return Yi.isObject(e)&&!0===e.isAxiosError},gn.mergeConfig=Ua,gn.AxiosHeaders=Ea,gn.formToJSON=e=>wa(Yi.isHTMLForm(e)?new FormData(e):e),gn.getAdapter=nn,gn.HttpStatusCode=fn,gn.default=gn;const{Axios:bn,AxiosError:yn,CanceledError:_n,isCancel:vn,CancelToken:wn,VERSION:Sn,all:Cn,Cancel:Pn,isAxiosError:kn,spread:Rn,toFormData:Tn,AxiosHeaders:En,HttpStatusCode:In,formToJSON:xn,getAdapter:Dn,mergeConfig:Mn}=gn,Ln={P2P:"p2p",CONFERENCING:"conferencing"},On="autoscalerv1.videoedge.io/api/vidScale/allocateResources",An="record",Nn="rtmpStreamAndRecord";new Tr("vidscale-url");const jn=async e=>{const{roomId:t,peerId:r,producer:s,consumer:i,sessionToken:a,participantData:n}=e,o=await gn.post(`${On}`,{roomId:t,peerId:r,producer:s,consumer:i,sessionToken:a,participantData:n});return new Promise(e=>{try{e(o.data)}catch(t){}})};var Fn,Bn,Un,$n,Vn={};function qn(){if($n)return Un;$n=1;const e=Bn?Fn:(Bn=1,Fn=(e,t)=>{let r;return function s(){const i=Math.floor(Math.random()*(t-e+1)+e);return r=i===r&&e!==t?s():i,r}});return Un=t=>{const r=e(0,t.length-1);return()=>t[r()]}}const Wn=JSON.parse('["Bulbasaur","Ivysaur","Venusaur","Charmander","Charmeleon","Charizard","Squirtle","Wartortle","Blastoise","Caterpie","Metapod","Butterfree","Weedle","Kakuna","Beedrill","Pidgey","Pidgeotto","Pidgeot","Rattata","Raticate","Spearow","Fearow","Ekans","Arbok","Pikachu","Raichu","Sandshrew","Sandslash","Nidoran♀","Nidorina","Nidoqueen","Nidoran♂","Nidorino","Nidoking","Clefairy","Clefable","Vulpix","Ninetales","Jigglypuff","Wigglytuff","Zubat","Golbat","Oddish","Gloom","Vileplume","Paras","Parasect","Venonat","Venomoth","Diglett","Dugtrio","Meowth","Persian","Psyduck","Golduck","Mankey","Primeape","Growlithe","Arcanine","Poliwag","Poliwhirl","Poliwrath","Abra","Kadabra","Alakazam","Machop","Machoke","Machamp","Bellsprout","Weepinbell","Victreebel","Tentacool","Tentacruel","Geodude","Graveler","Golem","Ponyta","Rapidash","Slowpoke","Slowbro","Magnemite","Magneton","Farfetch\'d","Doduo","Dodrio","Seel","Dewgong","Grimer","Muk","Shellder","Cloyster","Gastly","Haunter","Gengar","Onix","Drowzee","Hypno","Krabby","Kingler","Voltorb","Electrode","Exeggcute","Exeggutor","Cubone","Marowak","Hitmonlee","Hitmonchan","Lickitung","Koffing","Weezing","Rhyhorn","Rhydon","Chansey","Tangela","Kangaskhan","Horsea","Seadra","Goldeen","Seaking","Staryu","Starmie","Mr. Mime","Scyther","Jynx","Electabuzz","Magmar","Pinsir","Tauros","Magikarp","Gyarados","Lapras","Ditto","Eevee","Vaporeon","Jolteon","Flareon","Porygon","Omanyte","Omastar","Kabuto","Kabutops","Aerodactyl","Snorlax","Articuno","Zapdos","Moltres","Dratini","Dragonair","Dragonite","Mewtwo","Mew","Chikorita","Bayleef","Meganium","Cyndaquil","Quilava","Typhlosion","Totodile","Croconaw","Feraligatr","Sentret","Furret","Hoothoot","Noctowl","Ledyba","Ledian","Spinarak","Ariados","Crobat","Chinchou","Lanturn","Pichu","Cleffa","Igglybuff","Togepi","Togetic","Natu","Xatu","Mareep","Flaaffy","Ampharos","Bellossom","Marill","Azumarill","Sudowoodo","Politoed","Hoppip","Skiploom","Jumpluff","Aipom","Sunkern","Sunflora","Yanma","Wooper","Quagsire","Espeon","Umbreon","Murkrow","Slowking","Misdreavus","Unown","Wobbuffet","Girafarig","Pineco","Forretress","Dunsparce","Gligar","Steelix","Snubbull","Granbull","Qwilfish","Scizor","Shuckle","Heracross","Sneasel","Teddiursa","Ursaring","Slugma","Magcargo","Swinub","Piloswine","Corsola","Remoraid","Octillery","Delibird","Mantine","Skarmory","Houndour","Houndoom","Kingdra","Phanpy","Donphan","Porygon2","Stantler","Smeargle","Tyrogue","Hitmontop","Smoochum","Elekid","Magby","Miltank","Blissey","Raikou","Entei","Suicune","Larvitar","Pupitar","Tyranitar","Lugia","Ho-Oh","Celebi","Treecko","Grovyle","Sceptile","Torchic","Combusken","Blaziken","Mudkip","Marshtomp","Swampert","Poochyena","Mightyena","Zigzagoon","Linoone","Wurmple","Silcoon","Beautifly","Cascoon","Dustox","Lotad","Lombre","Ludicolo","Seedot","Nuzleaf","Shiftry","Taillow","Swellow","Wingull","Pelipper","Ralts","Kirlia","Gardevoir","Surskit","Masquerain","Shroomish","Breloom","Slakoth","Vigoroth","Slaking","Nincada","Ninjask","Shedinja","Whismur","Loudred","Exploud","Makuhita","Hariyama","Azurill","Nosepass","Skitty","Delcatty","Sableye","Mawile","Aron","Lairon","Aggron","Meditite","Medicham","Electrike","Manectric","Plusle","Minun","Volbeat","Illumise","Roselia","Gulpin","Swalot","Carvanha","Sharpedo","Wailmer","Wailord","Numel","Camerupt","Torkoal","Spoink","Grumpig","Spinda","Trapinch","Vibrava","Flygon","Cacnea","Cacturne","Swablu","Altaria","Zangoose","Seviper","Lunatone","Solrock","Barboach","Whiscash","Corphish","Crawdaunt","Baltoy","Claydol","Lileep","Cradily","Anorith","Armaldo","Feebas","Milotic","Castform","Kecleon","Shuppet","Banette","Duskull","Dusclops","Tropius","Chimecho","Absol","Wynaut","Snorunt","Glalie","Spheal","Sealeo","Walrein","Clamperl","Huntail","Gorebyss","Relicanth","Luvdisc","Bagon","Shelgon","Salamence","Beldum","Metang","Metagross","Regirock","Regice","Registeel","Latias","Latios","Kyogre","Groudon","Rayquaza","Jirachi","Deoxys","Turtwig","Grotle","Torterra","Chimchar","Monferno","Infernape","Piplup","Prinplup","Empoleon","Starly","Staravia","Staraptor","Bidoof","Bibarel","Kricketot","Kricketune","Shinx","Luxio","Luxray","Budew","Roserade","Cranidos","Rampardos","Shieldon","Bastiodon","Burmy","Wormadam","Mothim","Combee","Vespiquen","Pachirisu","Buizel","Floatzel","Cherubi","Cherrim","Shellos","Gastrodon","Ambipom","Drifloon","Drifblim","Buneary","Lopunny","Mismagius","Honchkrow","Glameow","Purugly","Chingling","Stunky","Skuntank","Bronzor","Bronzong","Bonsly","Mime Jr.","Happiny","Chatot","Spiritomb","Gible","Gabite","Garchomp","Munchlax","Riolu","Lucario","Hippopotas","Hippowdon","Skorupi","Drapion","Croagunk","Toxicroak","Carnivine","Finneon","Lumineon","Mantyke","Snover","Abomasnow","Weavile","Magnezone","Lickilicky","Rhyperior","Tangrowth","Electivire","Magmortar","Togekiss","Yanmega","Leafeon","Glaceon","Gliscor","Mamoswine","Porygon-Z","Gallade","Probopass","Dusknoir","Froslass","Rotom","Uxie","Mesprit","Azelf","Dialga","Palkia","Heatran","Regigigas","Giratina","Cresselia","Phione","Manaphy","Darkrai","Shaymin","Arceus","Victini","Snivy","Servine","Serperior","Tepig","Pignite","Emboar","Oshawott","Dewott","Samurott","Patrat","Watchog","Lillipup","Herdier","Stoutland","Purrloin","Liepard","Pansage","Simisage","Pansear","Simisear","Panpour","Simipour","Munna","Musharna","Pidove","Tranquill","Unfezant","Blitzle","Zebstrika","Roggenrola","Boldore","Gigalith","Woobat","Swoobat","Drilbur","Excadrill","Audino","Timburr","Gurdurr","Conkeldurr","Tympole","Palpitoad","Seismitoad","Throh","Sawk","Sewaddle","Swadloon","Leavanny","Venipede","Whirlipede","Scolipede","Cottonee","Whimsicott","Petilil","Lilligant","Basculin","Sandile","Krokorok","Krookodile","Darumaka","Darmanitan","Maractus","Dwebble","Crustle","Scraggy","Scrafty","Sigilyph","Yamask","Cofagrigus","Tirtouga","Carracosta","Archen","Archeops","Trubbish","Garbodor","Zorua","Zoroark","Minccino","Cinccino","Gothita","Gothorita","Gothitelle","Solosis","Duosion","Reuniclus","Ducklett","Swanna","Vanillite","Vanillish","Vanilluxe","Deerling","Sawsbuck","Emolga","Karrablast","Escavalier","Foongus","Amoonguss","Frillish","Jellicent","Alomomola","Joltik","Galvantula","Ferroseed","Ferrothorn","Klink","Klang","Klinklang","Tynamo","Eelektrik","Eelektross","Elgyem","Beheeyem","Litwick","Lampent","Chandelure","Axew","Fraxure","Haxorus","Cubchoo","Beartic","Cryogonal","Shelmet","Accelgor","Stunfisk","Mienfoo","Mienshao","Druddigon","Golett","Golurk","Pawniard","Bisharp","Bouffalant","Rufflet","Braviary","Vullaby","Mandibuzz","Heatmor","Durant","Deino","Zweilous","Hydreigon","Larvesta","Volcarona","Cobalion","Terrakion","Virizion","Tornadus","Thundurus","Reshiram","Zekrom","Landorus","Kyurem","Keldeo","Meloetta","Genesect","Chespin","Quilladin","Chesnaught","Fennekin","Braixen","Delphox","Froakie","Frogadier","Greninja","Bunnelby","Diggersby","Fletchling","Fletchinder","Talonflame","Scatterbug","Spewpa","Vivillon","Litleo","Pyroar","Flabébé","Floette","Florges","Skiddo","Gogoat","Pancham","Pangoro","Furfrou","Espurr","Meowstic","Honedge","Doublade","Aegislash","Spritzee","Aromatisse","Swirlix","Slurpuff","Inkay","Malamar","Binacle","Barbaracle","Skrelp","Dragalge","Clauncher","Clawitzer","Helioptile","Heliolisk","Tyrunt","Tyrantrum","Amaura","Aurorus","Sylveon","Hawlucha","Dedenne","Carbink","Goomy","Sliggoo","Goodra","Klefki","Phantump","Trevenant","Pumpkaboo","Gourgeist","Bergmite","Avalugg","Noibat","Noivern","Xerneas","Yveltal","Zygarde","Diancie","Hoopa","Volcanion","Rowlet","Dartrix","Decidueye","Litten","Torracat","Incineroar","Popplio","Brionne","Primarina","Pikipek","Trumbeak","Toucannon","Yungoos","Gumshoos","Grubbin","Charjabug","Vikavolt","Crabrawler","Crabominable","Oricorio","Cutiefly","Ribombee","Rockruff","Lycanroc","Wishiwashi","Mareanie","Toxapex","Mudbray","Mudsdale","Dewpider","Araquanid","Fomantis","Lurantis","Morelull","Shiinotic","Salandit","Salazzle","Stufful","Bewear","Bounsweet","Steenee","Tsareena","Comfey","Oranguru","Passimian","Wimpod","Golisopod","Sandygast","Palossand","Pyukumuku","Type: Null","Silvally","Minior","Komala","Turtonator","Togedemaru","Mimikyu","Bruxish","Drampa","Dhelmise","Jangmo-o","Hakamo-o","Kommo-o","Tapu Koko","Tapu Lele","Tapu Bulu","Tapu Fini","Cosmog","Cosmoem","Solgaleo","Lunala","Nihilego","Buzzwole","Pheromosa","Xurkitree","Celesteela","Kartana","Guzzlord","Necrozma","Magearna","Marshadow","Poipole","Naganadel","Stakataka","Blacephalon","Zeraora","Meltan","Melmetal","Grookey","Thwackey","Rillaboom","Scorbunny","Raboot","Cinderace","Sobble","Drizzile","Inteleon","Skwovet","Greedent","Rookidee","Corvisquire","Corviknight","Blipbug","Dottler","Orbeetle","Nickit","Thievul","Gossifleur","Eldegoss","Wooloo","Dubwool","Chewtle","Drednaw","Yamper","Boltund","Rolycoly","Carkol","Coalossal","Applin","Flapple","Appletun","Silicobra","Sandaconda","Cramorant","Arrokuda","Barraskewda","Toxel","Toxtricity","Sizzlipede","Centiskorch","Clobbopus","Grapploct","Sinistea","Polteageist","Hatenna","Hattrem","Hatterene","Impidimp","Morgrem","Grimmsnarl","Obstagoon","Perrserker","Cursola","Sirfetch\'d","Mr. Rime","Runerigus","Milcery","Alcremie","Falinks","Pincurchin","Snom","Frosmoth","Stonjourner","Eiscue","Indeedee","Morpeko","Cufant","Copperajah","Dracozolt","Arctozolt","Dracovish","Arctovish","Duraludon","Dreepy","Drakloak","Dragapult","Zacian","Zamazenta","Eternatus","Kubfu","Urshifu","Zarude","Regieleki","Regidrago","Glastrier","Spectrier","Calyrex","Wyrdeer","Kleavor","Ursaluna","Basculegion","Sneasler","Overqwil","Enamorus","Sprigatito","Floragato","Meowscarada","Fuecoco","Crocalor","Skeledirge","Quaxly","Quaxwell","Quaquaval","Lechonk","Oinkologne","Tarountula","Spidops","Nymble","Lokix","Pawmi","Pawmo","Pawmot","Tandemaus","Maushold","Fidough","Dachsbun","Smoliv","Dolliv","Arboliva","Squawkabilly","Nacli","Naclstack","Garganacl","Charcadet","Armarouge","Ceruledge","Tadbulb","Bellibolt","Wattrel","Kilowattrel","Maschiff","Mabosstiff","Shroodle","Grafaiai","Bramblin","Brambleghast","Toedscool","Toedscruel","Klawf","Capsakid","Scovillain","Rellor","Rabsca","Flittle","Espathra","Tinkatink","Tinkatuff","Tinkaton","Wiglett","Wugtrio","Bombirdier","Finizen","Palafin","Varoom","Revavroom","Cyclizar","Orthworm","Glimmet","Glimmora","Greavard","Houndstone","Flamigo","Cetoddle","Cetitan","Veluza","Dondozo","Tatsugiri","Annihilape","Clodsire","Farigiraf","Dudunsparce","Kingambit","Great Tusk","Scream Tail","Brute Bonnet","Flutter Mane","Slither Wing","Sandy Shocks","Iron Treads","Iron Bundle","Iron Hands","Iron Jugulis","Iron Moth","Iron Thorns","Frigibax","Arctibax","Baxcalibur","Gimmighoul","Gholdengo","Wo-Chien","Chien-Pao","Ting-Lu","Chi-Yu","Roaring Moon","Iron Valiant","Koraidon","Miraidon","Walking Wake","Iron Leaves","Dipplin","Poltchageist","Sinistcha","Okidogi","Munkidori","Fezandipiti","Ogerpon","Archaludon","Hydrapple","Gouging Fire","Raging Bolt","Iron Boulder","Iron Crown","Terapagos","Pecharunt"]');var zn;function Hn(){if(zn)return Vn;zn=1;const e=qn(),t=Wn,r="https://github.com/sindresorhus/pokemon",s=`Please report to ${r}/issues if we missed something.`,i=new Set(["de","en","fr","es","ja","ko","ru","th","zh-Hans","zh-Hant"]),a=new Map;function n(e="en"){if("en"===e)return t;if(!i.has(e))throw new Error(`Localized list for language code '${e}' does not exist. Pull request welcome: ${r}`);return function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(`./data/${e.toLowerCase()}.json`)}return Vn.all=n,Vn.random=(t="en")=>{if(a.has(t))return a.get(t)();const r=n(t),s=e(r);return a.set(t,s),s()},Vn.getName=(e,t="en")=>{const r=n(t)[e-1];if(!r)throw new Error(`Pokémon with ID '${e}' does not exist. ${s}`);return r},Vn.getId=(e,t="en")=>{const r=n(t).indexOf(e);if(-1===r)throw new Error(`Pokémon with name '${e}' does not exist for language code '${t}'. ${s}`);return r+1},Vn.languages=i,Vn}var Gn=Hn();function Kn(){return Gn.random("en")}new Tr("device-manager");const Jn=async()=>{let e=[],t=[],r=[];return new Promise((s,i)=>{navigator.mediaDevices.enumerateDevices().then(function(i){i.forEach((s,i)=>{if("audioinput"===s.kind){let e=s.label||`Mic ${Number(i)+1}`;t.push({label:e,deviceId:s.deviceId})}if("videoinput"===s.kind){let t=s.label||`Camera ${Number(i)+1}`;e.push({label:t,deviceId:s.deviceId})}if("audiooutput"===s.kind){let e=s.label||`Speaker ${Number(i)+1}`;r.push({label:e,deviceId:s.deviceId})}}),s({audioDevices:t,audioDevicesOutput:r,videoDevices:e})})})},Qn=async()=>{let e={videoDevices:[],audioDevices:[],audioOutputDevices:[]};const t=await(async()=>{let e=[];return navigator.mediaDevices.enumerateDevices().then(function(t){let r=void 0!==t.find(e=>"videoinput"===e.kind);return new Promise((t,s)=>{navigator.mediaDevices.getUserMedia({video:r}).then(r=>{navigator.mediaDevices.enumerateDevices().then(function(s){s.forEach(function(t,r){if("videoinput"===t.kind){let s=t.label||`Camera ${Number(r)+1}`;e.push({label:s,deviceId:t.deviceId})}}),r.getTracks().forEach(e=>{e.stop()}),t({videoDevices:e})})}).catch(function(e){t({error:e.name,reason:e.message})})})}).catch(function(e){})})();let r=null;if(t.error){switch(t.error){case"TypeError":break;case"AbortError":r=`${t.error} : ${t.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!!`;break;case"NotAllowedError":r=`${t.error} : ${t.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.`;break;case"NotFoundError":r=`${t.error} : ${t.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.`;break;case"NotReadableError":r=`${t.error} : ${t.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.`}return{success:!1,reason:{code:"EDV01",type:"DeviceError",text:r}}}t.videoDevices&&t.videoDevices.length>0&&(e.videoDevices=t.videoDevices);const s=await(async()=>{let e=[];return navigator.mediaDevices.enumerateDevices().then(function(t){let r=void 0!==t.find(e=>"audioinput"===e.kind);return new Promise((t,s)=>{navigator.mediaDevices.getUserMedia({audio:r}).then(r=>{navigator.mediaDevices.enumerateDevices().then(function(s){s.forEach(function(t,r){if("audioinput"===t.kind){let s=t.label||`Mic ${Number(r)+1}`;e.push({label:s,deviceId:t.deviceId})}}),r.getTracks().forEach(e=>{e.stop()}),t({audioDevices:e})})}).catch(function(e){t({error:e.name,reason:e.message})})})}).catch(function(e){})})();let i=null;if(s.error){switch(s.error){case"NotAllowedError":i=`${s.error} : ${s.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.`;break;case"NotFoundError":i=`${s.error} : ${s.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.`;break;case"NotReadableError":i=`${s.error} : ${s.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.`}return{success:!1,reason:{code:"EDA01",type:"DeviceError",text:i}}}s.audioDevices&&s.audioDevices.length>0&&(e.audioDevices=s.audioDevices);const a=await(async()=>{let e=[];return navigator.mediaDevices.enumerateDevices().then(function(t){let r=void 0!==t.find(e=>"audiooutput"===e.kind);return new Promise((t,s)=>{navigator.mediaDevices.getUserMedia({audio:r}).then(r=>{navigator.mediaDevices.enumerateDevices().then(function(s){s.forEach(function(t,r){if("audiooutput"===t.kind){let s=t.label||`Speaker ${Number(r)+1}`;e.push({label:s,deviceId:t.deviceId})}}),r.getTracks().forEach(e=>{e.stop()}),t({audioDevicesOutput:e})})}).catch(function(e){t({error:e.name,reason:e.message})})})}).catch(function(e){})})();return a.error?{success:!1,reason:{code:"EDAO01",type:"DeviceError",text:"Some error occured while accessing your speaker. Please try again again after some time."}}:(a.audioDevicesOutput&&a.audioDevicesOutput.length>0&&(e.audioOutputDevices=a.audioDevicesOutput),{success:!0,deviceList:e})},Xn=new Tr("Room"),Yn={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}}},Zn={optional:[{googDscp:!0}]};let eo;class to extends xr.EventEmitter{static async listDevices(){if(eo)return Xn.info("Device list already exists:%O",eo),{success:!0,deviceList:eo};const e=await Qn();return e.success?(eo=e.deviceList,{success:!0,deviceList:e.deviceList}):{success:!1,reason:e.reason}}static async joinRoom({sessionToken:e,roomId:t,peerId:r,peerName:s,produce:i=!0,produceAudio:a=!0,produceVideo:n=!0,consume:o=!0,videoResolution:c="hd",forceVp8:d=!1,forceVp9:l=!1,forceH264:p=!1,h264Profile:u="high",forcePCMU:h=!1,forcePCMA:m=!1,forceFPS:f=25,enableWebcamLayers:g=!0,numSimulcastStreams:b=3,autoGainControl:y=!0,echoCancellation:_=!0,noiseSuppression:v=!0,sampleRate:w=44e3,channelCount:S=1,videoBitRates:C=[700,250,75],share:P=!1,shareAudio:k=!1,enableSharingLayers:R=!0,shareBitRates:T=[2500,1250,500],audioDeviceId:E=null,videoDeviceId:I=null}={}){if(!e)throw new Error("Session token is required to join the room.");["hd","vga","qvga"].includes(c)||(Xn.warn("Invalid video resolution value. setting it to default value of 'hd' "),c="hd"),"boolean"!=typeof i&&(Xn.warn("Produe should either be true or false"),i=Boolean(i)),"boolean"!=typeof a&&(Xn.warn("ProduceAudio should either be true or false"),a=Boolean(a)),"boolean"!=typeof n&&(Xn.warn("ProduceVideo should either be true or false"),n=Boolean(n)),"boolean"!=typeof o&&(Xn.warn("Consume should either be true or false"),o=Boolean(o)),"boolean"!=typeof d&&(Xn.warn("forceVp8 should either be true or false"),d=Boolean(d)),"boolean"!=typeof l&&(Xn.warn("forceVp9 should either be true or false"),l=Boolean(l)),"boolean"!=typeof p&&(Xn.warn("forceH264 should either be true or false"),p=Boolean(p)),["high","low"].includes(u.toLowerCase())||(Xn.warn("h264Profile should either be 'high' or 'low'"),u="high"),(!Number.isInteger(f)||Number.isInteger(f)&&(f>65||f<5))&&(Xn.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),f=25),"boolean"!=typeof g&&(Xn.warn("enableWebcamLayers should either be true or false"),g=Boolean(g)),(!Number.isInteger(b)||Number.isInteger(b)&&(b>3||b<1))&&(Xn.warn("numSimulcastStreams should be a number between 1 to 3, default value is 3."),b=3),Array.isArray(C)&&C.length>=1&&C.length<=3&&C.every(e=>Number.isInteger(e)&&e>=75&&e<=800)?Xn.debug("videoBitRates values are correct"):(Xn.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]'"),C=[75,75,75]),"boolean"!=typeof h&&(Xn.warn("forcePCMU should either be true or false"),h=Boolean(h)),"boolean"!=typeof m&&(Xn.warn("forcePCMA should either be true or false"),m=Boolean(m)),"boolean"!=typeof y&&(Xn.warn("autoGainControl should either be true or false"),y=Boolean(y)),"boolean"!=typeof _&&(Xn.warn("echoCancellation should either be true or false"),_=Boolean(_)),"boolean"!=typeof v&&(Xn.warn("noiseSuppression should either be true or false"),v=Boolean(v)),(!Number.isInteger(w)||Number.isInteger(w)&&(w>64e3||w<8e3))&&(Xn.warn("sampleRate should be a number between 8000 to 64000, default value is 44000 Khz."),w=44e3),(!Number.isInteger(S)||Number.isInteger(S)&&(S>2||S<1))&&(Xn.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),S=1),"boolean"!=typeof P&&(Xn.warn("share should either be true or false"),P=Boolean(P)),"boolean"!=typeof k&&(Xn.warn("shareAudio should either be true or false"),k=Boolean(k)),"boolean"!=typeof R&&(Xn.warn("enableSharingLayers should either be true or false"),R=Boolean(R)),Array.isArray(T)&&T.length>=1&&T.length<=3&&T.every(e=>Number.isInteger(e)&&e>=500&&e<=2500)?Xn.debug("shareBitRates values are correct"):(Xn.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]'"),T=[2500,1250,500]);try{Xn.info("session token:%s",e),r||(r=di()),t||(t=ci()),s||(s=Kn());const x=Pr.parse(window.navigator.userAgent),D=x.browser.name,M=x.browser.version,L={name:r,participantType:"moderator",browserName:D,browserVersion:M,os:x.os.name};Xn.info("browser details are:%O",x);const O={sessionToken:e,roomId:t,peerId:r,consumerReplicas:0,producer:i,consumer:o,participantData:L};let A={};Xn.debug("Received input parameters are:%O",O);const N=await async function({sessionToken:e,roomId:t,peerId:r,consumerReplicas:s,producer:i=!0,consumer:a=!0,participantData:n}){const o=await jn({sessionToken:e,roomId:t,peerId:r,producer:i,consumer:a,participantData:n});return o.success?{success:!0,wsUrl:`wss://${o.data.url}/?roomId=${t}&peerId=${r}&consumerReplicas=${s}`,roomUrl:`https://${o.data.url}`,core:o.data.core}:{success:!1,errorText:o.data.reason,errorCode:o.data.code}}(O);return N.success&&N.wsUrl&&N.core?(A.url=N.wsUrl,A.core=N.core,Xn.debug("VidScale url is:",A.url),new to({peerId:r,roomId:t,peerName:s,produce:i,produceAudio:a,produceVideo:n,consume:o,videoResolution:c,forceVp8:d,forceVp9:l,forceH264:p,h264Profile:u,forceFPS:f,forcePCMU:h,forcePCMA:m,enableWebcamLayers:g,numSimulcastStreams:b,autoGainControl:y,echoCancellation:_,noiseSuppression:v,sampleRate:w,channelCount:S,videoBitRates:C,share:P,shareAudio:k,enableSharingLayers:R,shareBitRates:T,outputData:A,audioDeviceId:E,videoDeviceId:I})):(Xn.warn("Vidscale returned success as false. with error:%O",N),N)}catch(x){throw Xn.error("Failed to join room:",x.message),x}}constructor({peerId:e,roomId:t,peerName:r,produce:s,produceAudio:i,produceVideo:a,consume:n,videoResolution:o,forceVp8:c,forceVp9:d,forceH264:l,h264Profile:p,forceFPS:u,forcePCMU:h,forcePCMA:m,enableWebcamLayers:f,numSimulcastStreams:g,autoGainControl:b,echoCancellation:y,noiseSuppression:_,sampleRate:v,channelCount:w,videoBitRates:S,share:C,shareAudio:P,enableSharingLayers:k,shareBitRates:R,outputData:T,audioDeviceId:E,videoDeviceId:I}){super(),this._closed=!1,this._roomStatus="initialised",this._cignal=null,this._sendTransport=null,this._recvTransport=null,this._device=new pr.Device,this._webCamProducer=null,this._micProducer=null,this._shareProducer=null,this._shareAudioProducer=null,this._producers=new Map,this._consumers=new Map,this._peers=new Map,this._data={...T},this._micStream=null,this._webCamStream=null,this._webcam={device:null,resolution:o},this._mic={device:null},this._deviceList=eo||null,this._externalVideo=null,this._externalVideoStream=null,this._forceVP8=Boolean(c),this._forceH264=Boolean(l),this._forceVP9=Boolean(d),this._enableWebcamLayers=Boolean(f),this._numSimulcastStreams=g,this._enableSharingLayers=Boolean(k),this._client=Pr.parse(window.navigator.userAgent),this._cignalConnected=!1,this._reconnectionInitiated=!1,this._restartIceInProgressSendTransport=!1,this._restartIceInProgressRecvTransport=!1,this._activeSpeaker=null,this.init({roomId:t,peerId:e,peerName:r,produce:s,produceAudio:i,produceVideo:a,consume:n,videoResolution:o,forceVp8:c,forceVp9:d,forceH264:l,h264Profile:p,forceFPS:u,forcePCMU:h,forcePCMA:m,enableWebcamLayers:f,numSimulcastStreams:g,autoGainControl:b,echoCancellation:y,noiseSuppression:_,sampleRate:v,channelCount:w,videoBitRates:S,share:C,shareAudio:P,enableSharingLayers:k,shareBitRates:R,audioDeviceId:E,videoDeviceId:I})}get closed(){return this._closed}get data(){return this._data}set data(e){throw new Error("Setting the whole data object is not possible!")}get peers(){return this._peers}set peers(e){throw new Error("Setting the whole peers object is not possible!")}get transports(){return{produce:this._sendTransport,consume:this._recvTransport}}set transports(e){throw new Error("Setting of transport is not possible!")}get videoStream(){return this._webCamStream}get audioStream(){return this._micStream}get clientAgent(){return this._client}get activeParameters(){return this._data.inputParams}get deviceList(){return this._deviceList?this._deviceList:{videoDevices:[],audioDevices:[],audioOutputDevices:[]}}set deviceList(e){throw new Error("Setting of deviceList is not possible!")}get currentlyActiveSpeaker(){return this._activeSpeaker}set currentlyActiveSpeaker(e){throw new Error("Setting of currentActivespeaker is not possible!")}async init(e){Xn.debug("init() | The input parameters are:%O",e),this.data.inputParams=e;const t=pr.detectDevice();Xn.debug("The device is:%O",t),await this.listDevicesInternal(),await this.join()}close(){this._closed||(this._closed=!0,Xn.debug("close()"),this._cignal.close(),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed")}async leaveRoom(){Xn.debug("Leave room is called!!"),"connected"===this._roomStatus?(await this._cignal.notify("leaveRoom",{}),this._sendTransport&&(this._sendTransport.close(),this._sendTransport=null),this._recvTransport&&(this._recvTransport.close(),this._recvTransport=null),this._webCamStream&&this._webCamStream.getVideoTracks().forEach(e=>{e.stop(),Xn.debug("Video Track stopped")}),this._micStream&&this._micStream.getAudioTracks().forEach(e=>{e.stop(),Xn.debug("Mic Track stopped")}),this._roomStatus="closed",this._cignal.close()):Xn.error("The room state is:%s",this._roomStatus)}async closeRoom(){await this._cignal.notify("closeRoom",{}),this.leaveRoom()}async listDevicesInternal(){if(navigator.mediaDevices.ondevicechange=async e=>{let t=await Jn();Xn.info("Media devices changed!:%O",t),t.audioDevices&&t.audioDevices.length>0&&(this._deviceList.audioDevices=t.audioDevices),t.videoDevices&&t.videoDevices.length>0&&(this._deviceList.videoDevices=t.videoDevices),t.audioDevices&&t.audioDevices.length>0&&(this._deviceList.audioOutputDevices=t.audioDevicesOutput),eo=this._deviceList,this.emit("deviceListUpdated")},!this._deviceList){const e=await Qn();if(e.success)return this._deviceList=e.deviceList,void(eo=this._deviceList)}}async join(){const e=new oi(this.data.url,{retries:10,factor:2,minTimeout:1e3,maxTimeout:8e3});this._cignal=new Nr(e),this._cignal.on("open",async()=>{this._cignalConnected=!0,this._sendTransport||this._recvTransport?(!this._sendTransport||"failed"!==this._sendTransport.connectionState&&"disconnected"!==this._sendTransport.connectionState?Xn.debug("Nothing to in case of socket reconnection with send transport status:%s",this._sendTransport?.connectionState):(Xn.debug("Ws reconnected after network outage. Need to do ICE restarts for send transport."),this.restartIceSendTransport()),!this._recvTransport||"failed"!==this._recvTransport.connectionState&&"disconnected"!==this._recvTransport.connectionState?Xn.debug("Nothing to in case of socket reconnection with recv transport status:%s",this._recvTransport?.connectionState):(Xn.debug("Ws reconnected after network outage. Need to do ICE restarts for recv transport."),this.restartIceRecvTransport())):(Xn.debug("Ws connected for first time. Need to go with the regular flow."),await this._joinRoom())}),this._cignal.on("failed",()=>{}),this._cignal.on("disconnected",()=>{Xn.debug("ws disconnected!"),this._cignalConnected=!1}),this._cignal.on("close",()=>{this._closed||this._reconnectionInitiated||this.close()}),this._cignal.on("request",async(e,t,r)=>{switch(Xn.debug('cignal "request" event [method:%s, data:%o]',e.method,e.data),this._cignalConnected=!0,e.method){case"newConsumer":{if(!this.data.inputParams.consume){r(403,"I do not want to consume");break}const{peerId:i,producerId:a,id:n,kind:o,rtpParameters:c,type:d,appData:l,producerPaused:p}=e.data;try{const e=await this._recvTransport.consume({id:n,producerId:a,kind:o,rtpParameters:c,streamId:`${i}-${l.share?"share":"mic-webcam"}`,appData:{...l,peerId:i}});this._consumers.set(e.id,e),e.on("transportclose",()=>{this._consumers.delete(e.id)});const{spatialLayers:r,temporalLayers:s}=pr.parseScalabilityMode(e.rtpParameters.encodings[0].scalabilityMode),u=this._peers.get(i);Xn.debug(`Consumer created for peerId ${i} for kind ${e.kind}`);let h={...u,[l.share?`ss${e.kind}`:e.kind]:{consumerId:e.id,type:d,locallyPaused:!1,remotelyPaused:p,rtpParameters:e.rtpParameters,spatialLayers:r,temporalLayers:s,preferredSpatialLayer:r-1,preferredTemporalLayer:s-1,priority:1,codec:e.rtpParameters.codecs[0].mimeType.split("/")[1],track:e.track,share:l.share}};this._peers.set(i,h),t(),Xn.debug("Going to emit mic start / videostart"),"audio"===e.kind?l.share?this.emit("ssAudioStart",{peerId:i,audioTrack:e.track,type:"remote"}):this.emit("micStart",{peerId:i,audioTrack:e.track,type:"remote"}):"video"===e.kind&&(l.share?this.emit("ssVideoStart",{peerId:i,videoTrack:e.track,type:"remote"}):this.emit("videoStart",{peerId:i,videoTrack:e.track,type:"remote"}))}catch(s){throw Xn.error('"newConsumer" request failed:%o',s),s}break}}}),this._cignal.on("notification",e=>{switch("activeSpeaker"!==e.method&&Xn.debug('proto "notification" event [method:%s, data:%o]',e.method,e.data),this._cignalConnected=!0,e.method){case"producerScore":{const{producerId:t,score:r}=e.data;break}case"newPeer":{const t=e.data;this._peers.set(t.id,{...t,consumers:[]}),this.emit("newPeer",{peerId:t.id,peerName:t.displayName,type:"remote"});break}case"peerClosed":{const{peerId:t}=e.data;this._peers.delete(t),this.emit("peerLeft",{peerId:t});break}case"roomClosed":Xn.debug("Room closed. No need to reconnect socket"),this.close();break;case"consumerClosed":{const{consumerId:t}=e.data,r=this._consumers.get(t);if(Xn.debug("Consumer closed for consumerId:%s, type:%s",t,r?.kind),!r)break;const{peerId:s,share:i}=r.appData;let a=i?`ss${r.kind}`:r.kind;r.close(),this._consumers.delete(t);let n=this._peers.get(s);Xn.debug("Peer data before deletion:%O",n),n[a]&&n[a].consumerId===t&&delete n[a],Xn.debug("Peer data after deletion:%O",n),this._peers.set(s,n),"audio"===a?(Xn.debug("Going to emit micEnd, consumer closed for audio"),i?this.emit("ssAudioStop",{peerId:s,track:null,type:"remote"}):this.emit("micEnd",{peerId:s,track:null,type:"remote"})):"video"===a&&(Xn.debug("Going to emit videoEnd, consumer closed for video"),i?this.emit("ssVideoStop",{peerId:s,track:null,type:"remote"}):this.emit("videoEnd",{peerId:s,track:null,type:"remote"}));break}case"consumerPaused":{const{consumerId:t}=e.data,r=this._consumers.get(t);if(!r)break;r.pause();break}case"consumerResumed":{const{consumerId:t}=e.data,r=this._consumers.get(t);if(!r)break;r.resume();break}case"consumerLayersChanged":{const{consumerId:t,spatialLayer:r,temporalLayer:s}=e.data;if(!this._consumers.get(t))break;break}case"consumerScore":{const{consumerId:t,score:r}=e.data;break}case"activeSpeaker":{const{peerId:t,volume:r}=e.data;this._activeSpeaker=e.data,this.emit("activeSpeaker",{peerId:t,volume:r});break}case"peerMuted":{const{peerId:t}=e.data;this.emit("peerMuted",{peerId:t,type:"remote"});break}case"peerUnMuted":{const{peerId:t}=e.data;this.emit("peerUnMuted",{peerId:t,type:"remote"});break}default:Xn.error('unknown protoo notification.method "%s"',e.method)}})}async restartIceSendTransport(){if(Xn.debug("restartIce SendTransport()"),this._restartIceInProgressSendTransport)Xn.warn("Restart ice already in progress for send transport! wait 4 completion b4 next request!");else{try{if(this._sendTransport&&("failed"===this._sendTransport.connectionState||"disconnected"===this._sendTransport.connectionState)){this._restartIceInProgressSendTransport=!0,Xn.debug("Restarting ICE for send transport");const e=await this._cignal.request("restartIce",{transportId:this._sendTransport.id,peerId:this._peerId});await this._sendTransport.restartIce({iceParameters:e}),this._restartIceInProgressSendTransport=!1}}catch(e){Xn.error("restartIce SendTransport() | failed:%o",e)}this._reconnectionInitiated=!1}}async restartIceRecvTransport(){if(Xn.debug("restartIce RecvTransport()"),this._restartIceInProgressRecvTransport)Xn.warn("Restart ice already in progress for recv transport! wait 4 completion b4 next request!");else{try{if(this._recvTransport&&("failed"===this._recvTransport.connectionState||"disconnected"===this._recvTransport.connectionState)){this._restartIceInProgressRecvTransport=!0,Xn.debug("Restarting ICE for recv transport");const e=await this._cignal.request("restartIce",{transportId:this._recvTransport.id,peerId:this._peerId});await this._recvTransport.restartIce({iceParameters:e}),this._restartIceInProgressRecvTransport=!1}}catch(e){Xn.error("restartIce RecvTransport() | failed:%o",e)}this._reconnectionInitiated=!1}}async _joinRoom(){Xn.debug("_joinRoom()");try{const e=await this._cignal.request("getRouterRtpCapabilities",{coreNumber:this.data.core});if(Xn.debug("Router rtp capabilities created:%O",e),Xn.debug("Input params are:",this.data.inputParams),await this._device.load({routerRtpCapabilities:e}),this.data.inputParams.produce){Xn.debug("Going to create webrtctransport send");const e=await this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp||!1,producing:!0,consuming:!1,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0}),{id:t,iceParameters:r,iceCandidates:s,dtlsParameters:i,sctpParameters:a}=e;Xn.debug("Transport info is:%O",e),this._sendTransport=this._device.createSendTransport({id:t,iceParameters:r,iceCandidates:s,dtlsParameters:{...i,role:"auto"},sctpParameters:a,iceServers:[],proprietaryConstraints:Zn,additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._sendTransport.on("connect",({iceParameters:e,dtlsParameters:t},r,s)=>{this._cignal.request("connectWebRtcTransport",{transportId:this._sendTransport.id,iceParameters:e,dtlsParameters:t}).then(r).catch(s)}),this._sendTransport.on("produce",async({kind:e,rtpParameters:t,appData:r},s,i)=>{try{const{id:i}=await this._cignal.request("produce",{transportId:this._sendTransport.id,kind:e,rtpParameters:t,appData:r});s({id:i})}catch(a){i(a)}})}if(this.data.inputParams.consume){Xn.debug("Going to create webrtctransport recv");const e=await this._cignal.request("createWebRtcTransport",{forceTcp:this._forceTcp,producing:!1,consuming:!0,sctpCapabilities:this._useDataChannel?this._device.sctpCapabilities:void 0}),{id:t,iceParameters:r,iceCandidates:s,dtlsParameters:i,sctpParameters:a}=e;Xn.debug("Transport info is:%O",e),this._recvTransport=this._device.createRecvTransport({id:t,iceParameters:r,iceCandidates:s,dtlsParameters:{...i,role:"auto"},sctpParameters:a,iceServers:[],additionalSettings:{encodedInsertableStreams:this._e2eKey&&e2e.isSupported()}}),this._recvTransport.on("connect",({iceParameters:e,dtlsParameters:t},r,s)=>{this._cignal.request("connectWebRtcTransport",{transportId:this._recvTransport.id,iceParameters:e,dtlsParameters:t}).then(r).catch(s)})}const{peers:t}=await 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});this.emit("newPeer",{peerId:this.data.inputParams.peerId,peerName:this.data.inputParams.peerName,type:"local"}),this._roomStatus="connected",Xn.debug("All availablepeers in this room are::%O",t);for(const r of t)this._peers.set(r.id,{...r,consumers:[]}),Xn.debug("new peer is:%O",r),this.emit("newPeer",{peerId:r.id,peerName:r.displayName,type:"remote"});this.data.inputParams.produce&&(this.data.inputParams.produceAudio?this.enableMic({deviceId:this.data.inputParams.audioDeviceId?this.data.inputParams.audioDeviceId:null}):Xn.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}):Xn.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",e=>{"connected"===e&&Xn.debug("Send transport now connected!")}))}catch(e){Xn.error("_joinRoom() failed:%o",e),this.emit("error",{code:"EJR001",text:"Join room request failed!"}),this.close()}}async enableMic({deviceId:e=null,autoGainControl:t,noiseSuppression:r,echoCancellation:s,channelCount:i,sampleRate:a,forcePCMU:n,forcePCMA:o}={}){if(Xn.debug("enableMic()"),!this.data.inputParams.produce)return Xn.debug("Produce status is set to false!"),{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."};if("connected"!==this._roomStatus)return Xn.debug("Room status is not connected yet!"),{success:!1,error:!0,code:"REID008",text:`Error while trying to start Mic/Audio as room not in connected status. Current room status:!${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."};if(this._micProducer)return Xn.debug("Mic is already active!"),{success:!1,warning:!0,code:"RWID002",text:"Error while trying to start Mic/Audio. Mic/Audio is already active!"};if(!this._device.canProduce("audio"))return Xn.error("enableMic() | cannot produce audio"),{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."};let c,d;n&&"boolean"==typeof n&&(this.data.inputParams.forcePCMU=n),o&&"boolean"==typeof o&&(this.data.inputParams.forcePCMA=o),t&&"boolean"==typeof t&&(this.data.inputParams.autoGainControl=t),s&&"boolean"==typeof s&&(this.data.inputParams.echoCancellation=s),r&&"boolean"==typeof r&&(this.data.inputParams.noiseSuppression=r),a&&Number.isInteger(a)&&a<64e3&&a>8e3&&(this.data.inputParams.sampleRate=a),i&&Number.isInteger(i)&&i>0&&i<3&&(this.data.inputParams.channelCount=i);try{if(this._externalVideo)this._micStream=await this._getExternalVideoStream(),c=this._micStream.getAudioTracks()[0].clone();else{if(e?(d=this._deviceList.audioDevices.find(t=>t.deviceId===e),d||(Xn.warn("Selected audio input deviceId:%s not found",e),d=this._deviceList.audioDevices[0])):d=this._deviceList.audioDevices[0],this._mic.device=d,!d)return Xn.error("No mic device found! Can't start audio!"),{success:!1,reason:"No mic available for starting audio!"};e&&this.data.inputParams.audioDeviceId!==e&&(this.data.inputParams.audioDeviceId=e),Xn.debug("enableMic() | calling getUserMedia()");try{this._micStream=await 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}}),c=this._micStream.getAudioTracks()[0]}catch(dc){throw new Error("Error while acquiring mic. Possible issue with audio constraint values",dc)}}this._micProducer=await this._sendTransport.produce({track:c,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(e=>"audio/pcmu"===e.mimeType.toLowerCase()):this.data.inputParams.forcePCMA?this._device.rtpCapabilities.codecs.find(e=>"audio/pcma"===e.mimeType.toLowerCase()):void 0}),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",()=>{this._micProducer=null}),this._micProducer.on("trackended",()=>{this.disableMic().catch(()=>{})})}catch(l){Xn.error("enableMic() | failed:%o",l),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),c&&c.stop()}}async disableMic(){if(Xn.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach(e=>e.stop()),this._micProducer){this._micProducer.close(),this._producers.delete("audio");try{await this._cignal.request("closeProducer",{producerId:this._micProducer.id}),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}}async muteMic(){Xn.debug("muteMic()"),this._micProducer.pause();try{await this._cignal.request("pauseProducer",{producerId:this._micProducer.id}),this.emit("peerMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){Xn.error("muteMic() | failed: %o",e),this.emit("error",{code:"EID004",text:"Error muting local microphone!"})}}async unmuteMic(){Xn.debug("unmuteMic()"),this._micProducer.resume();try{await this._cignal.request("resumeProducer",{producerId:this._micProducer.id}),this.emit("peerUnMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){Xn.error("unmuteMic() | failed: %o",e),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"})}}async enableCam({deviceId:e=null,videoResolution:t,forceVp8:r,forceVp9:s,forceH264:i,h264Profile:a,forceFPS:n,enableWebcamLayers:o,numSimulcastStreams:c,videoBitRates:d}={}){if(Xn.debug("enableWebcam()"),!this.data.inputParams.produce)return Xn.debug("Produce status is set to false!"),{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."};if("connected"!==this._roomStatus)return Xn.debug("Room status is not connected yet!"),{success:!1,error:!0,code:"REID005",text:`Error while trying to start Camera as room not in connected status. Current room status:!${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."};if(this._webcamProducer)return Xn.debug("Camera is already active!"),{success:!1,warning:!0,code:"RWID003",text:"Error while trying to start Camera. Camera is already active!"};if(!this._device.canProduce("video"))return Xn.error("enableWebcam() | cannot produce video"),{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."};let l,p;["hd","vga","qvga"].includes(t)&&(this.data.inputParams.videoResolution=t,this._webcam.resolution=t),r&&"boolean"==typeof r&&(this.data.inputParams.forceVp8=r),s&&"boolean"==typeof s&&(this.data.inputParams.forceVp9=s),i&&"boolean"==typeof i&&(this.data.inputParams.forceH264=i),a&&["high","low"].includes(a.toLowerCase())&&(this.data.inputParams.h264Profile=a),n&&Number.isInteger(n)&&n<65&&n>5&&(this.data.inputParams.forceFPS=25),o&&"boolean"==typeof o&&(this.data.inputParams.enableWebcamLayers=o,this._enableWebcamLayers=o),c&&Number.isInteger(c)&&c<4&&c>0&&(this.data.inputParams.numSimulcastStreams=c,this._numSimulcastStreams=c),Array.isArray(d)&&d.length>=1&&d.length<=3&&d.every(e=>Number.isInteger(e)&&e>=75&&e<=800)?(Xn.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=d):Xn.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]'");try{if(this._externalVideo)p={label:"external video"},this._webCamStream=await this._getExternalVideoStream(),l=this._webCamStream.getVideoTracks()[0].clone();else{e?(p=this._deviceList.videoDevices.find(t=>t.deviceId===e),p||(Xn.warn("Selected deviceId:%s not found",e),p=this._deviceList.videoDevices[0])):p=this._deviceList.videoDevices[0],this._webcam.device=p;const{resolution:t}=this._webcam;if(!p)return Xn.error("No wencam device found! Can't start video!"),{success:!1,reason:"No Webcam available for starting video!"};e&&this.data.inputParams.videoDeviceId!==e&&(this.data.inputParams.videoDeviceId=e),Xn.debug("enableWebcam() | calling getUserMedia()"),this._webCamStream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{ideal:p.deviceId},...Yn[t],frameRate:{ideal:this.data.inputParams.forceFPS}}}),l=this._webCamStream.getVideoTracks()[0]}let t,r;const s={videoGoogleStartBitrate:1e3};if(Xn.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),this._forceVP8){if(r=this._device.rtpCapabilities.codecs.find(e=>"video/vp8"===e.mimeType.toLowerCase()),!r)throw new Error("desired VP8 codec+configuration is not supported")}else if(this._forceH264){if("high"===this.data.inputParams.h264Profile?r=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]):"low"===this.data.inputParams.h264Profile&&(r=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"])),!r)throw new Error("desired H264 codec+configuration is not supported");Xn.debug("Selected h264 codec is:%O",r)}else if(this._forceVP9&&(r=this._device.rtpCapabilities.codecs.find(e=>"video/vp9"===e.mimeType.toLowerCase()),!r))throw new Error("desired VP9 codec+configuration is not supported");if(this._enableWebcamLayers){const e=this._device.rtpCapabilities.codecs.find(e=>"video"===e.kind);this._forceVP9&&r||"video/vp9"===e.mimeType.toLowerCase()?t=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(t=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&t.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&t.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))}this._webcamProducer=await this._sendTransport.produce({track:l,encodings:t,codecOptions:s,codec:r}),this._producers.set("video",{id:this._webcamProducer.id,deviceLabel:p.label,type:this._getWebcamType(p),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",()=>{this._webcamProducer=null}),this._webcamProducer.on("trackended",()=>{this.disableWebcam().catch(()=>{})})}catch(u){Xn.error("enableWebcam() | failed:%o",u),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),l&&l.stop()}}async disableCam(){if(Xn.debug("disableWebcam()"),this._webcamProducer){this._webcamProducer.close(),this._producers.delete("video");try{await this._cignal.request("closeProducer",{producerId:this._webcamProducer.id}),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}}async _updateWebcams(){Xn.debug("_updateWebcams()"),this._webcams=new Map,Xn.debug("_updateWebcams() | calling enumerateDevices()");const e=await navigator.mediaDevices.enumerateDevices();for(const i of e)"videoinput"===i.kind&&this._webcams.set(i.deviceId,i);const t=Array.from(this._webcams.values()),r=t.length,s=this._webcam.device?this._webcam.device.deviceId:void 0;Xn.debug("_updateWebcams() [webcams:%o]",t),0===r?this._webcam.device=null:this._webcams.has(s)||(this._webcam.device=t[0])}async _getExternalVideoStream(){if(this._externalVideoStream)return this._externalVideoStream;if(this._externalVideo.readyState<3&&await new Promise(e=>this._externalVideo.addEventListener("canplay",e)),this._externalVideo.captureStream)this._externalVideoStream=this._externalVideo.captureStream();else{if(!this._externalVideo.mozCaptureStream)throw new Error("video.captureStream() not supported");this._externalVideoStream=this._externalVideo.mozCaptureStream()}return this._externalVideoStream}_getWebcamType(e){return/(back|rear)/i.test(e.label)?(Xn.debug("_getWebcamType() | it seems to be a back camera"),"back"):(Xn.debug("_getWebcamType() | it seems to be a front camera"),"front")}async changeVideoInput({resolution:e,deviceId:t,fps:r}){if(this._webcamProducer){return await this._changeVideoInput({resolution:e,deviceId:t,fps:r})}return Xn.error("No webcam producer available!"),{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. "}}async _changeVideoInput({resolution:e,deviceId:t,fps:r}){Xn.info("_changeVideoInput() | Inside"),e&&["hd","vga","qvga"].includes(e)?this._webcam.resolution=e:Xn.warn("Invalid video resolution value "),r&&Number.isInteger(r)&&r<65&&r>5?this.data.inputParams.forceFPS=r:Xn.warn("forceFPS should be a number between 5 to 65, default value is 25 fps.");let s=this._deviceList.videoDevices.find(e=>t&&e.deviceId===t);if(!s)return Xn.error("The selected deviceId not found!"),{success:!1,reason:"Invalid deviceId!"};this._webcam.device=s;try{this._webCamStream.getVideoTracks().forEach(e=>e.stop()),this._webCamStream=null,Xn.debug("changeVideoInput() | calling getUserMedia()"),this._webCamStream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{ideal:s.deviceId},...Yn[this._webcam.resolution],frameRate:{ideal:this.data.inputParams.forceFPS}}});const e=this._webCamStream.getVideoTracks()[0];Xn.debug("The new video track is:%O",e),await this._webcamProducer.replaceTrack({track:e});let t=this._producers.get("video");return t.deviceLabel=s.label,t.type=this._getWebcamType(s),t.track=this._webcamProducer.track,Xn.debug("Updated producer values are:%O",t),this._producers.set("video",t),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),{success:!0}}catch(i){return Xn.error("Error while changing input:%O",i),{success:!1,reason:"Couldn't change video input",error:i}}}async changeAudioInput({autoGainControl:e,echoCancellation:t,noiseSuppression:r,sampleRate:s,channelCount:i,deviceId:a}){if(this._micProducer){return await this._changeAudioInput({autoGainControl:e,echoCancellation:t,noiseSuppression:r,sampleRate:s,channelCount:i,deviceId:a})}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. "}}async _changeAudioInput({autoGainControl:e,echoCancellation:t,noiseSuppression:r,sampleRate:s,channelCount:i,deviceId:a}){e&&"boolean"==typeof e&&(this.data.inputParams.autoGainControl=e),t&&"boolean"==typeof t&&(this.data.inputParams.echoCancellation=Boolean(t)),r&&"boolean"==typeof r&&(this.data.inputParams.noiseSuppression=Boolean(r)),s&&Number.isInteger(s)&&s<64e3&&s>8e3&&(this.data.inputParams.sampleRate=s),i&&Number.isInteger(i)&&i>0&&i<3&&(this.data.inputParams.channelCount=i);let n=this._deviceList.audioDevices.find(e=>a&&e.deviceId===a);if(!n)return{success:!1,reason:"Invalid deviceId!"};this._mic.device=n,this._micStream&&this._micStream.getAudioTracks().forEach(e=>e.stop()),this._micStream=null;try{this._micStream=await navigator.mediaDevices.getUserMedia({audio:{deviceId:{ideal:n.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}});const e=this._micStream.getAudioTracks()[0];this._micProducer.replaceTrack({track:e});let t=this._producers.get("audio");return t.deviceLabel=n.label,t.track=this._micProducer.track,Xn.debug("Updated producer values are:%O",t),this._producers.set("audio",t),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),{success:!0}}catch(dc){return Xn.error("Error while changing input:%O",dc),{success:!1,reason:"Couldn't change audio input",err:dc}}}async enableShare({shareAudio:e=!1,enableSharingLayers:t=!0,shareBitRates:r=[2500,1250,500]}={}){if(Xn.debug("enableShare()"),!this.data.inputParams.produce)return Xn.debug("Produce status is set to false!"),{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."};if("connected"!==this._roomStatus)return Xn.debug("Room status is not connected yet!"),{success:!1,error:!0,code:"REID001",text:`Error while trying to start screen share as room not in connected status. Current room status:!${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."};if(this._shareProducer)return Xn.debug("Screen share is already active!"),{success:!1,warning:!0,code:"RWID001",text:"Error while trying to start screen share. Screen share is already active!"};if(!this._device.canProduce("video"))return Xn.error("enableShare() | cannot produce video"),{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."};let s,i;this._enableSharingLayers="boolean"!=typeof t?Boolean(t):t,Array.isArray(r)&&r.length>=1&&r.length<=3&&r.every(e=>Number.isInteger(e)&&e>=500&&e<=2500)?this.data.inputParams.shareBitRates=r:this.data.inputParams.shareBitRates=[2500,1250,500];try{Xn.debug("enableShare() | calling getDisplayMedia()");const t=await navigator.mediaDevices.getDisplayMedia({audio:!!e,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});if(!t)return Xn.error("Unable to capture screen."),void this.emit("error",{code:"EID013",text:"Error while trying to start screen share. Not able to capture screen!"});let r,a;i=t.getAudioTracks()[0],i&&(this._shareAudioProducer=await this._sendTransport.produce({track:i,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(e=>"audio/pcmu"===e.mimeType.toLowerCase()):void 0}),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"})),s=t.getVideoTracks()[0];const n={videoGoogleStartBitrate:1e3};if(this._forceVP8){if(a=this._device.rtpCapabilities.codecs.find(e=>"video/vp8"===e.mimeType.toLowerCase()),!a)throw new Error("desired VP8 codec+configuration is not supported")}else if(this._forceH264){if("high"===this.data.inputParams.h264Profile?a=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]):"low"===this.data.inputParams.h264Profile&&(a=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"])),!a)throw new Error("desired H264 codec+configuration is not supported");Xn.debug("Selected h264 codec is:%O",a)}else if(this._forceVP9&&(a=this._device.rtpCapabilities.codecs.find(e=>"video/vp9"===e.mimeType.toLowerCase()),!a))throw new Error("desired VP9 codec+configuration is not supported");if(this._enableSharingLayers){const e=this._device.rtpCapabilities.codecs.find(e=>"video"===e.kind);this._forceVP9&&a||"video/vp9"===e.mimeType.toLowerCase()?r=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(r=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&r.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&r.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))}this._shareProducer=await this._sendTransport.produce({track:s,encodings:r,codecOptions:n,codec:a,appData:{share:!0}}),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",()=>{this._shareProducer=null}),this._shareProducer.on("trackended",()=>{this.disableShare().catch(()=>{})})}catch(a){Xn.error("enableShare() | failed:%o",a),"NotAllowedError"!==a.name&&this.emit("error",{code:"EID014",text:`Error while trying to start screen share. Error is: ${a}!`}),s&&s.stop()}}async disableShare(){if(Xn.debug("disableShare()"),!this._shareProducer)return Xn.warn("Screen share doesn't seem to be on!"),void this.emit("error",{code:"EID017",text:"Error while trying to stop screen share. Is the screen share on!"});if(this._shareProducer.close(),this._shareAudioProducer){this._shareAudioProducer.close();try{await this._cignal.request("closeProducer",{producerId:this._shareAudioProducer.id}),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: ${e}!`})}}try{await this._cignal.request("closeProducer",{producerId:this._shareProducer.id}),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: ${e}!`})}this._shareAudioProducer=null,this._shareProducer=null}}const ro=async e=>new Promise(t=>setTimeout(()=>t(),e)),so=new Set(["240p","360p","480p","720p","1080p","1440p","2160p"]);function ao(e){return!!Array.isArray(e)&&e.every(e=>so.has(e))}const no=new Tr("utils-verifyFiles"),oo=["mp4"];function co(e,t){try{const r=new URL(e).pathname;return r.split(".").pop().toLowerCase()===t.toLowerCase()}catch{return!1}}const lo=new TextEncoder,po=new TextDecoder;function uo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:po.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=po.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return function(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class ho extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class mo extends ho{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",s="unspecified"){super(e,{cause:{claim:r,reason:s,payload:t}}),this.claim=r,this.reason=s,this.payload=t}}class fo extends ho{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",s="unspecified"){super(e,{cause:{claim:r,reason:s,payload:t}}),this.claim=r,this.reason=s,this.payload=t}}class go extends ho{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class bo extends ho{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class yo extends ho{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class _o extends ho{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class vo extends ho{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}function wo(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function So(e,t){return e.name===t}function Co(e){return parseInt(e.name.slice(4),10)}function Po(e,t,r){switch(t){case"HS256":case"HS384":case"HS512":{if(!So(e.algorithm,"HMAC"))throw wo("HMAC");const r=parseInt(t.slice(2),10);if(Co(e.algorithm.hash)!==r)throw wo(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!So(e.algorithm,"RSASSA-PKCS1-v1_5"))throw wo("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(Co(e.algorithm.hash)!==r)throw wo(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!So(e.algorithm,"RSA-PSS"))throw wo("RSA-PSS");const r=parseInt(t.slice(2),10);if(Co(e.algorithm.hash)!==r)throw wo(`SHA-${r}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":if(!So(e.algorithm,"Ed25519"))throw wo("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":if(!So(e.algorithm,t))throw wo(t);break;case"ES256":case"ES384":case"ES512":{if(!So(e.algorithm,"ECDSA"))throw wo("ECDSA");const r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw wo(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}!function(e,t){if(!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}(e,r)}function ko(e,t,...r){if((r=r.filter(Boolean)).length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}function Ro(e,t,...r){return ko(`Key for the ${e} algorithm must be `,t,...r)}function To(e){return"CryptoKey"===e?.[Symbol.toStringTag]}function Eo(e){return"KeyObject"===e?.[Symbol.toStringTag]}const Io=e=>To(e)||Eo(e);const xo=e=>{if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r};const Do=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},r=e.priv?["sign"]:["verify"];break;default:throw new bo('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new bo('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},r=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},r=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new bo('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new bo('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new bo('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),s={...e};return"AKP"!==s.kty&&delete s.alg,delete s.use,crypto.subtle.importKey("jwk",s,t,e.ext??(!e.d&&!e.priv),e.key_ops??r)};function Mo(e){return xo(e)&&"string"==typeof e.kty}let Lo;const Oo=async(e,t,r,s=!1)=>{Lo||=new WeakMap;let i=Lo.get(e);if(i?.[r])return i[r];const a=await Do({...t,alg:r});return s&&Object.freeze(e),i?i[r]=a:Lo.set(e,{[r]:a}),a},Ao=async(e,t)=>{if(e instanceof Uint8Array)return e;if(To(e))return e;if(Eo(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Lo||=new WeakMap;let r=Lo.get(e);if(r?.[t])return r[t];const s="public"===e.type,i=!!s;let a;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}a=e.toCryptoKey(e.asymmetricKeyType,i,s?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");a=e.toCryptoKey(e.asymmetricKeyType,i,[s?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError("given KeyObject instance cannot be used for this algorithm");a=e.toCryptoKey(e.asymmetricKeyType,i,[s?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let r;switch(t){case"RSA-OAEP":r="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":r="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":r="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":r="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:r},i,s?["encrypt"]:["decrypt"]);a=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:r},i,[s?"verify":"sign"])}if("ec"===e.asymmetricKeyType){const r=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!r)throw new TypeError("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===r&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:r},i,[s?"verify":"sign"])),"ES384"===t&&"P-384"===r&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:r},i,[s?"verify":"sign"])),"ES512"===t&&"P-521"===r&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:r},i,[s?"verify":"sign"])),t.startsWith("ECDH-ES")&&(a=e.toCryptoKey({name:"ECDH",namedCurve:r},i,s?[]:["deriveBits"]))}if(!a)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return r?r[t]=a:Lo.set(e,{[t]:a}),a})(e,t)}catch(dc){if(dc instanceof TypeError)throw dc}let r=e.export({format:"jwk"});return Oo(e,r,t)}if(Mo(e))return e.k?uo(e.k):Oo(e,e,t,!0);throw new Error("unreachable")},No=e=>e?.[Symbol.toStringTag],jo=(e,t,r)=>{if(void 0!==t.use){let e;switch(r){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(void 0!==t.alg&&t.alg!==e)throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let s;switch(!0){case"verify"===r:case"dir"===e:case e.includes("CBC-HS"):s=r;break;case e.startsWith("PBES2"):s="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):s=!e.includes("GCM")&&e.endsWith("KW")?"unwrapKey":r;break;case"encrypt"===r:s="wrapKey";break;case"decrypt"===r:s=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(s&&!1===t.key_ops?.includes?.(s))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${s}" when present`)}return!0},Fo=(e,t,r)=>{e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(e)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(e)?((e,t,r)=>{if(!(t instanceof Uint8Array)){if(Mo(t)){if(function(e){return"oct"===e.kty&&"string"==typeof e.k}(t)&&jo(e,t,r))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Io(t))throw new TypeError(Ro(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError(`${No(t)} instances for symmetric algorithms must be of type "secret"`)}})(e,t,r):((e,t,r)=>{if(Mo(t))switch(r){case"decrypt":case"sign":if(function(e){return"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d)}(t)&&jo(e,t,r))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(function(e){return"oct"!==e.kty&&void 0===e.d&&void 0===e.priv}(t)&&jo(e,t,r))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Io(t))throw new TypeError(Ro(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError(`${No(t)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===t.type)switch(r){case"sign":throw new TypeError(`${No(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${No(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===t.type)switch(r){case"verify":throw new TypeError(`${No(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${No(t)} instances for asymmetric algorithm encryption must be of type "public"`)}})(e,t,r)},Bo=async(e,t,r)=>{if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(((e,...t)=>ko("Key must be ",e,...t))(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}return Po(t,e,r),t},Uo=async(e,t,r,s)=>{const i=await Bo(e,t,"verify");((e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}})(e,i);const a=((e,t)=>{const r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new bo(`alg ${e} is not supported either by JOSE or your javascript runtime`)}})(e,i.algorithm);try{return await crypto.subtle.verify(a,i,r,s)}catch{return!1}};async function $o(e,t,r){if(!xo(e))throw new yo("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new yo('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new yo("JWS Protected Header incorrect type");if(void 0===e.payload)throw new yo("JWS Payload missing");if("string"!=typeof e.signature)throw new yo("JWS Signature missing or incorrect type");if(void 0!==e.header&&!xo(e.header))throw new yo("JWS Unprotected Header incorrect type");let s={};if(e.protected)try{const t=uo(e.protected);s=JSON.parse(po.decode(t))}catch{throw new yo("JWS Protected Header is invalid")}if(!((...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const s of t){const e=Object.keys(s);if(r&&0!==r.size)for(const t of e){if(r.has(t))return!1;r.add(t)}else r=new Set(e)}return!0})(s,e.header))throw new yo("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const i={...s,...e.header},a=((e,t,r,s,i)=>{if(void 0!==i.crit&&void 0===s?.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!s||void 0===s.crit)return new Set;if(!Array.isArray(s.crit)||0===s.crit.length||s.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let a;a=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const n of s.crit){if(!a.has(n))throw new bo(`Extension Header Parameter "${n}" is not recognized`);if(void 0===i[n])throw new e(`Extension Header Parameter "${n}" is missing`);if(a.get(n)&&void 0===s[n])throw new e(`Extension Header Parameter "${n}" MUST be integrity protected`)}return new Set(s.crit)})(yo,new Map([["b64",!0]]),r?.crit,s,i);let n=!0;if(a.has("b64")&&(n=s.b64,"boolean"!=typeof n))throw new yo('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:o}=i;if("string"!=typeof o||!o)throw new yo('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=r&&((e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)})("algorithms",r.algorithms);if(c&&!c.has(o))throw new go('"alg" (Algorithm) Header Parameter value not allowed');if(n){if("string"!=typeof e.payload)throw new yo("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new yo("JWS Payload must be a string or an Uint8Array instance");let d=!1;"function"==typeof t&&(t=await t(s,e),d=!0),Fo(o,t,"verify");const l=function(...e){const t=e.reduce((e,{length:t})=>e+t,0),r=new Uint8Array(t);let s=0;for(const i of e)r.set(i,s),s+=i.length;return r}(lo.encode(e.protected??""),lo.encode("."),"string"==typeof e.payload?lo.encode(e.payload):e.payload);let p;try{p=uo(e.signature)}catch{throw new yo("Failed to base64url decode the signature")}const u=await Ao(t,o);if(!(await Uo(o,u,p,l)))throw new vo;let h;if(n)try{h=uo(e.payload)}catch{throw new yo("Failed to base64url decode the payload")}else h="string"==typeof e.payload?lo.encode(e.payload):e.payload;const m={payload:h};return void 0!==e.protected&&(m.protectedHeader=s),void 0!==e.header&&(m.unprotectedHeader=e.header),d?{...m,key:u}:m}const Vo=86400,qo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Wo=e=>{const t=qo.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const r=parseFloat(t[2]);let s;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":s=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":s=Math.round(60*r);break;case"hour":case"hours":case"hr":case"hrs":case"h":s=Math.round(3600*r);break;case"day":case"days":case"d":s=Math.round(r*Vo);break;case"week":case"weeks":case"w":s=Math.round(604800*r);break;default:s=Math.round(31557600*r)}return"-"===t[1]||"ago"===t[4]?-s:s},zo=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`;function Ho(e,t,r={}){let s;try{s=JSON.parse(po.decode(t))}catch{}if(!xo(s))throw new _o("JWT Claims Set must be a top-level JSON object");const{typ:i}=r;if(i&&("string"!=typeof e.typ||zo(e.typ)!==zo(i)))throw new mo('unexpected "typ" JWT header value',s,"typ","check_failed");const{requiredClaims:a=[],issuer:n,subject:o,audience:c,maxTokenAge:d}=r,l=[...a];void 0!==d&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==o&&l.push("sub"),void 0!==n&&l.push("iss");for(const b of new Set(l.reverse()))if(!(b in s))throw new mo(`missing required "${b}" claim`,s,b,"missing");if(n&&!(Array.isArray(n)?n:[n]).includes(s.iss))throw new mo('unexpected "iss" claim value',s,"iss","check_failed");if(o&&s.sub!==o)throw new mo('unexpected "sub" claim value',s,"sub","check_failed");if(c&&(p=s.aud,u="string"==typeof c?[c]:c,!("string"==typeof p?u.includes(p):Array.isArray(p)&&u.some(Set.prototype.has.bind(new Set(p))))))throw new mo('unexpected "aud" claim value',s,"aud","check_failed");var p,u;let h;switch(typeof r.clockTolerance){case"string":h=Wo(r.clockTolerance);break;case"number":h=r.clockTolerance;break;case"undefined":h=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:m}=r,f=(g=m||new Date,Math.floor(g.getTime()/1e3));var g;if((void 0!==s.iat||d)&&"number"!=typeof s.iat)throw new mo('"iat" claim must be a number',s,"iat","invalid");if(void 0!==s.nbf){if("number"!=typeof s.nbf)throw new mo('"nbf" claim must be a number',s,"nbf","invalid");if(s.nbf>f+h)throw new mo('"nbf" claim timestamp check failed',s,"nbf","check_failed")}if(void 0!==s.exp){if("number"!=typeof s.exp)throw new mo('"exp" claim must be a number',s,"exp","invalid");if(s.exp<=f-h)throw new fo('"exp" claim timestamp check failed',s,"exp","check_failed")}if(d){const e=f-s.iat;if(e-h>("number"==typeof d?d:Wo(d)))throw new fo('"iat" claim timestamp check failed (too far in the past)',s,"iat","check_failed");if(e<0-h)throw new mo('"iat" claim timestamp check failed (it should be in the past)',s,"iat","check_failed")}return s}async function Go(e,t,r){const s=await async function(e,t,r){if(e instanceof Uint8Array&&(e=po.decode(e)),"string"!=typeof e)throw new yo("Compact JWS must be a string or Uint8Array");const{0:s,1:i,2:a,length:n}=e.split(".");if(3!==n)throw new yo("Invalid Compact JWS");const o=await $o({payload:i,protected:s,signature:a},t,r),c={payload:o.payload,protectedHeader:o.protectedHeader};return"function"==typeof t?{...c,key:o.key}:c}(e,t,r);if(s.protectedHeader.crit?.includes("b64")&&!1===s.protectedHeader.b64)throw new _o("JWTs MUST NOT use unencoded payload");const i={payload:Ho(s.protectedHeader,s.payload,r),protectedHeader:s.protectedHeader};return"function"==typeof t?{...i,key:s.key}:i}const Ko=new Tr("Room"),Jo={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}}};let Qo;const Xo=new class{constructor(){this.queue=new Map}push(e,t){this.queue.set(e,t)}get(e){return this.queue.get(e)}remove(e){this.queue.delete(e)}};class Yo extends xr.EventEmitter{static async listDevices(){if(Qo)return Ko.info("Device list already exists:%O",Qo),{success:!0,deviceList:Qo};const e=await Qn();return e.success?(Qo=e.deviceList,{success:!0,deviceList:e.deviceList}):{success:!1,reason:e.reason}}static async init({sessionToken:e,roomId:t,peerId:r}={}){if(!e)throw new Error("Session token is required to join the room.");try{let s;Ko.info("session token:%s",e);try{const t=(new TextEncoder).encode("samvyo_tech_321"),{payload:r}=await Go(e,t,{algorithms:["HS256"]});s=r,Ko.info("Decoded token:",s)}catch(dc){throw Ko.error("JWT verification failed:",dc),dc instanceof fo?new Error("Session token has expired"):dc instanceof mo?new Error("Session token not yet active"):new Error("Invalid session token: "+dc.message)}if(!s||"object"!=typeof s)throw new Error("Invalid token format");const{data:i,signallingServerUrl:a}=s;if(!i||!a)throw new Error("Missing required token data");return r||(r=di()),t||(t=ci()),new Yo({peerId:r,roomId:t,outputData:{sessionToken:e,innerSessionToken:i,signallingServerUrl:a}})}catch(s){throw Ko.error("Failed to initialize:",s.message),s}}constructor({peerId:e,roomId:t,outputData:r}){super(),this._closed=!1,this._roomStatus="initialised",this._roomDisplayName=null,this._running=!1,this._cignal=null,this._socket=null,this._sendTransport=null,this._recvTransport=null,this._device=new pr.Device,this._webCamProducer=null,this._micProducer=null,this._shareProducer=null,this._shareAudioProducer=null,this._producers=new Map,this._consumers=new Map,this._peers=new Map,this._data={...r,inputParams:{peerId:e,roomId:t,roomType:"conferencing"}},this._micStream=null,this._webCamStream=null,this._webcam={device:null,resolution:"hd"},this._mic={device:null},this._deviceList=Qo||null,this._externalVideo=null,this._externalVideoStream=null,this._forceVP8=!1,this._forceH264=!1,this._forceVP9=!1,this._enableWebcamLayers=!0,this._numSimulcastStreams=3,this._enableSharingLayers=!0,this._client=Pr.parse(window.navigator.userAgent),this._routerRtpCapabilities=null,this._recordingStartedByMe={},this._cignalConnected=!1,this._reconnectionInitiated=!1,this._restartIceInProgressSendTransport=!1,this._restartIceInProgressRecvTransport=!1,this._activeSpeaker=null,this.initLocal()}get closed(){return this._closed}get data(){return this._data}set data(e){throw new Error("Setting the whole data object is not possible!")}get peers(){return this._peers}set peers(e){throw new Error("Setting the whole peers object is not possible!")}get transports(){return{produce:this._sendTransport,consume:this._recvTransport}}set transports(e){throw new Error("Setting of transport is not possible!")}get videoStream(){return this._webCamStream}get audioStream(){return this._micStream}get clientAgent(){return this._client}get activeParameters(){return this._data.inputParams}get deviceList(){return this._deviceList?this._deviceList:{videoDevices:[],audioDevices:[],audioOutputDevices:[]}}set deviceList(e){throw new Error("Setting of deviceList is not possible!")}get currentlyActiveSpeaker(){return this._activeSpeaker}set currentlyActiveSpeaker(e){throw new Error("Setting of currentActivespeaker is not possible!")}get roomDisplayName(){return this._roomDisplayName}set roomDisplayName(e){throw new Error("Setting of roomDisplayName is not possible!")}async initLocal(){const e=pr.detectDevice();Ko.debug("The device is:%O",e),await this._initSocket()}async _initSocket(){let e=this;const t=this.data.signallingServerUrl.replace(/^(http|https):\/\//,""),r=`wss://${t}/?sessionToken=${this.data.sessionToken}&roomId=${this.data.inputParams.roomId}&peerId=${this.data.inputParams.peerId}&roomType=${this.data.inputParams.roomType}`;Ko.info(`Going to create a new socket! with address: ${t}`),this._socket=new oi(r,!0),this._listenToSocket(),this._socket.on("notify",({type:e,title:t,message:r})=>{this.emit("notification",{eventType:e,eventText:`${t}: ${r}`,roomId:this.data.inputParams.roomId,peerId:this.data.inputParams.peerId})}),this._socket.on("roomStartedP2p",e=>{Ko.info("P2P room successfully started"),this._running=!0}),this._socket.on("userError",t=>{Ko.error("User Error happened with message:%O",t),e.emit("notification",{eventType:t.title,eventText:`${t.text}`})}),this._socket.on("validationAlert",e=>{Ko.info("Validation alert happened")}),this._socket.on("alreadyActive",({title:e,text:t})=>{this.emit("notification",{eventType:"alreadyActive",eventText:"This peer already has an active connection",roomId:this.data.inputParams.roomId,peerId:this.data.inputParams.peerId})}),this._socket.on("passwordDisabled",()=>{Ko.info("password disabled by moderator!"),this.emit("notification",{eventType:"passwordDisabled",eventText:"Password for this room has been disabled by moderator",roomId:this.data.inputParams.roomId})}),this._socket.on("close",({code:e,reason:t})=>{if(Ko.info(`socket closed with code ${e}`),4500!==e&&4100!==e){let r=t||"Connection to server closed unexpectedly! Trying to reconnect.";Ko.info(`socket close code is${e} with reason ${r}`)}else Ko.info("Socket is now closed!"),this.close()}),this._socket.on("connected",async()=>{Ko.info("Socket connected"),e.pc&&e._sendTransport&&e._recvTransport?roomType===Ln.P2P&&e.pc?(Ko.info("Socket seems to be reconnected in mid call! RestartIce needed for p2p call."),"failed"!==e.pc.iceConnectionState&&"disconnected"!==e.pc.iceConnectionState||e.restartICE()):(Ko.debug("Ice restarts for mediasoup transports for a joined peer"),e._sendTransport&&["Failed","disconnected"].includes(e._sendTransport.connectionState)?(Ko.debug("Restart ice for sendtransport"),e.restartIce(e._sendTransport.id,"send")):Ko.error("Send transport not available!"),e._recvTransport&&["Failed","disconnected"].includes(e._recvTransport.connectionState)?(Ko.debug("Restart ice for recvtransport"),e.restartIce(e._recvTransport.id,"recv")):Ko.error("Recv transport not available!")):(Ko.info("Connection getting connected for first time"),this.emit("initSuccess"))}),this._socket.on("defaultJoinStatus",async e=>{Ko.info(" Socket defaultjoinstatus:%O",e)})}_sendMessage(e){this._socket.send({usageType:"sdk",...e})}_listenToSocket(){this._socket.on("message",e=>{try{switch("currentlyActiveSpeaker"===e.id||"allStats"===e.id||Ko.info("message in Room is:%O",e),e.id){case"chatMessage":this.processChatMessage(e);break;case"customMessage":this.processCustomMessage(e);break;case"existingParticipants":this.onExistingParticipants(e);break;case"newPeerJoin":this.onNewPeer(e);break;case"recordingError":this.handleRecordingErrors(e);break;case"moderatorAuthentication":this.authenticateUser(e);break;case"authenticationRequested":this.authenticationRequested(e);break;case"toggleMyMic":this.toggleMyMic(e);break;case"toggleMyCamera":this.toggleMyCamera(e);break;case"logMeOut":this.logMeOutNew(e);break;case"userAlreadyAuthenticated":this.hideUserAuthenticationDialog(e);break;case"peerLeft":this.peerLeft(e);break;case"recordingStarted":this.setRecordingStatusStarted(e);break;case"recordingStopped":this.setRecordingStatusEnded(e);break;case"startDefaultRecording":this.startRecording(e);break;case"mediaToggled":this.mediaToggled(e);break;case"processingStarted":this.handleProcessingStart(e);break;case"processingCompleted":this.handleProcessingCompletion(e);break;case"processingError":this.handleProcessingError(e);break;case"createTransportResponse":this.handleCreateTransportRequest(e);break;case"connectTransportResponse":this.handleConnectTransportRequest(e);break;case"connectRecvTransportResponse":this.handleConnectRecvTransportRequest(e);break;case"sendTrackResponse":this.handleSendTrackRequest(e);break;case"recvTrackResponse":this.handleRecvTrackRequest(e);break;case"roomClosedByModerator":this.leaveRoomCommon(),this.roomClosed();break;case"currentlyActiveSpeaker":this.setCurrentlyActiveSpeaker(e);break;case"restartIceResponse":this.restartIceResponse(e);break;case"consumerClosed":this.closeConsumer(e);break;case"handRaise":this.handleHandRaise(e);break;case"updateCId":this.updateCId(e);break;case"upgradeParticipant":this.handleUpgradeParticipant(e);break;case"downgradeParticipant":this.handleDowngradeParticipant(e);break;case"switchMicOff":this.handleSwitchMicOff(e);break;case"screenShareLimitReached":this.handleScreenShareLimitReached(e);break;case"upgradeLimitReached":this.handleUpgradeLimitReached(e);break;case"modUpgradeReq":this.handleModUpgradeReq(e);break;case"lockUnlockRoom":this.handleLockUnlockRoom(e);break;case"peersWaiting":this.handlePeersWaiting(e);break;case"remotePeerJoin":this.handleRemotePeerJoin(e);break;case"offer":Ko.debug("inside offer"),this.handleOffer(e);break;case"answer":Ko.debug("inside answer"),this.handleAnswer(e);break;case"candidate":Ko.debug("inside handle candidate"),this.handleCandidate(e.candidate);break;case"p2pRoomClosed":Ko.debug("inside p2p room close"),this.leaveRoomNewP2p("leaveAndCloseRoom");break;case"p2pUserLeft":Ko.debug("inside p2p user left"),this.userLeftRoom(e);break;case"iceRestart":this.handleIceRestart(e);break;case"iceRestarted":this.handleIceRestartResponse(e);break;case"screenShareP2p":this.handleScreenShareP2p(e);break;default:Ko.warn("Unrecognized message:%o",e)}}catch(dc){Ko.error("listentomessage:%O",dc)}})}joinRoom=async({peerName:e=null,produce:t=!0,produceAudio:r=!0,produceVideo:s=!0,consume:i=!0,videoResolution:a="hd",forceVp8:n=!1,forceVp9:o=!1,forceH264:c=!1,h264Profile:d="high",forcePCMU:l=!1,forcePCMA:p=!1,forceFPS:u=25,enableWebcamLayers:h=!0,numSimulcastStreams:m=3,autoGainControl:f=!0,echoCancellation:g=!0,noiseSuppression:b=!0,sampleRate:y=44e3,channelCount:_=1,videoBitRates:v=[700,250,75],share:w=!1,shareAudio:S=!1,enableSharingLayers:C=!0,shareBitRates:P=[2500,1250,500],audioDeviceId:k=null,videoDeviceId:R=null,peerType:T="participant",roomType:E=Ln.CONFERENCING,authenticationRequired:I=!1,password:x=null,roomDisplayName:D=null}={})=>{Ko.info("Going to join room"),["hd","vga","qvga"].includes(a)||(Ko.warn("Invalid video resolution value. setting it to default value of 'hd' "),a="hd"),"boolean"!=typeof t&&(Ko.warn("Produe should either be true or false"),t=Boolean(t)),"boolean"!=typeof r&&(Ko.warn("ProduceAudio should either be true or false"),r=Boolean(r)),"boolean"!=typeof s&&(Ko.warn("ProduceVideo should either be true or false"),s=Boolean(s)),"boolean"!=typeof i&&(Ko.warn("Consume should either be true or false"),i=Boolean(i)),"boolean"!=typeof n&&(Ko.warn("forceVp8 should either be true or false"),n=Boolean(n)),"boolean"!=typeof o&&(Ko.warn("forceVp9 should either be true or false"),o=Boolean(o)),"boolean"!=typeof c&&(Ko.warn("forceH264 should either be true or false"),c=Boolean(c)),["high","low"].includes(d.toLowerCase())||(Ko.warn("h264Profile should either be 'high' or 'low'"),d="high"),(!Number.isInteger(u)||Number.isInteger(u)&&(u>65||u<5))&&(Ko.warn("forceFPS should be a number between 5 to 65, default value is 25 fps."),u=25),"boolean"!=typeof h&&(Ko.warn("enableWebcamLayers should either be true or false"),h=Boolean(h)),(!Number.isInteger(m)||Number.isInteger(m)&&(m>3||m<1))&&(Ko.warn("numSimulcastStreams should be a number between 1 to 3, default value is 3."),m=3),Array.isArray(v)&&v.length>=1&&v.length<=3&&v.every(e=>Number.isInteger(e)&&e>=75&&e<=800)?Ko.debug("videoBitRates values are correct"):(Ko.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]'"),v=[700,250,75]),"boolean"!=typeof l&&(Ko.warn("forcePCMU should either be true or false"),l=Boolean(l)),"boolean"!=typeof p&&(Ko.warn("forcePCMA should either be true or false"),p=Boolean(p)),"boolean"!=typeof f&&(Ko.warn("autoGainControl should either be true or false"),f=Boolean(f)),"boolean"!=typeof g&&(Ko.warn("echoCancellation should either be true or false"),g=Boolean(g)),"boolean"!=typeof b&&(Ko.warn("noiseSuppression should either be true or false"),b=Boolean(b)),(!Number.isInteger(y)||Number.isInteger(y)&&(y>64e3||y<8e3))&&(Ko.warn("sampleRate should be a number between 8000 to 64000, default value is 44000 Khz."),y=44e3),(!Number.isInteger(_)||Number.isInteger(_)&&(_>2||_<1))&&(Ko.warn("sampleRate should be a number between 1 to 2, default value is 1, which is a mono audio."),_=1),"boolean"!=typeof w&&(Ko.warn("share should either be true or false"),w=Boolean(w)),"boolean"!=typeof S&&(Ko.warn("shareAudio should either be true or false"),S=Boolean(S)),"boolean"!=typeof C&&(Ko.warn("enableSharingLayers should either be true or false"),C=Boolean(C)),Array.isArray(P)&&P.length>=1&&P.length<=3&&P.every(e=>Number.isInteger(e)&&e>=500&&e<=2500)?Ko.debug("shareBitRates values are correct"):(Ko.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]'"),P=[2500,1250,500]),["moderator","participant","attendee"].includes(T)?Ko.debug("peerType is valid:%s",T):(T="participant",Ko.debug("peerType is invalid:%s. By default set to: participant",T)),await this.listDevicesInternal(),this._videoResolution=a,this._forceVP8=Boolean(n),this._forceH264=Boolean(c),this._forceVP9=Boolean(o),this._enableWebcamLayers=Boolean(h),this._numSimulcastStreams=m,this._enableSharingLayers=Boolean(C);try{e||(e=Kn()),this.data.inputParams={...this.data.inputParams,peerName:e,produce:t,produceAudio:r,produceVideo:s,consume:i,videoResolution:a,forceVp8:n,forceVp9:o,forceH264:c,h264Profile:d,forceFPS:u,forcePCMU:l,forcePCMA:p,enableWebcamLayers:h,numSimulcastStreams:m,autoGainControl:f,echoCancellation:g,noiseSuppression:b,sampleRate:y,channelCount:_,videoBitRates:v,share:w,shareAudio:S,enableSharingLayers:C,shareBitRates:P,audioDeviceId:k,videoDeviceId:R,peerType:T,roomType:E,authenticationRequired:I,password:x,roomDisplayName:D},Ko.info("input params are:%O",this.data.inputParams);const M={id:"joinRoom",type:"r",peerId:this.data.inputParams.peerId,participantType:"attendee"===T?"viewer":T,roomType:E,roomDisplayName:D||`room-${1e5+Math.round(9e5*Math.random())}`,browser:this._client,name:this.data.inputParams.peerName,room:this.data.inputParams.roomId,authenticationRequired:I,isRoomPassword:!!x,roomPassword:x||null,usageType:"sdk"};this._sendMessage(M)}catch(M){return Ko.error("Failed to join room:",M.message),{success:!1,reason:M.message}}};authenticateUser=e=>{Ko.info("Moderator authentication requested:%O",e),this.emit("moderatorAuthentication",{moderatorName:e.moderatorName,requesterName:e.requesterName,requesterPeerId:e.requesterPeerId,text:e.title})};authenticationRequested=e=>{Ko.info("Moderator authentication requested:%O",e),this.emit("authenticationRequested",{requesterName:e.requesterName,requesterPeerId:this.data.inputParams.peerId,text:e.title})};allowRoomJoin=e=>{if(!e)return Ko.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};Ko.info("Allow user to join room:%O",e);let t={id:"userAuthenticated",peerId:e,roomName:this.data.inputParams.roomId,moderator:this.data.inputParams.peerId};this._sendMessage(t)};denyRoomJoin=e=>{if(!e)return Ko.error("peerId can't be undefined!"),{success:!1,reason:"PeerId can't be undefined"};Ko.info("Deny user to join room:%O",e);let t={id:"userDenied",peerId:e,roomName:this.data.inputParams.roomId,moderator:this.data.inputParams.peerId};this._sendMessage(t)};hideUserAuthenticationDialog=e=>{Ko.debug("authentication already done message:%o",e),this.emit("moderatorAuthStatus",{requesterId:e.requesterId,moderatorActed:e.peerId})};onNewPeer(e){const{peerId:t,displayName:r,participantType:s}=e;this._peers.set(t,{displayName:r,participantType:s,consumers:[]}),this.emit("newPeer",{peerId:t,peerName:r,type:this.data.inputParams.peerId===t?"local":"remote",peerRole:s})}async onExistingParticipants(e){if(Ko.debug("Onexisting participant message:%O",e),this._routerRtpCapabilities=e.routerRtpCapabilities,this._roomStatus="connected",this._roomDisplayName=e.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?await this._createSendTransport():Ko.debug("Produce is false!"),this.data.inputParams.consume){await this._createRecvTransport();let t=this;e.peers&&e.peers.length>0&&e.peers.forEach(e=>{t.emit("newPeer",{peerId:e.peerId,peerName:e.name,type:"remote",peerRole:e.participantType})})}else Ko.debug("Consume is false!")}sendCustomMessage=(e,t="general",r=null,s,i,a={})=>{const n={id:"customMessage",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,data:e,type:t,recieverPeerId:r,senderType:s,messageType:i,customData:a};Ko.debug("Room sendCustomMessage",n),this._sendMessage(n)};processCustomMessage=e=>{Ko.debug("Room processCustomMessage",e),this.emit("customMessage",e)};updateCId=e=>{Ko.debug("Received updateCId message",e),e.targetPeerId!==this.data.inputParams.peerId&&e.targetPeerId||this.emit("updateCId",{message:e,cId:e.cId,peerId:this.data.inputParams.peerId,isMyCId:e.targetPeerId===this.data.inputParams.peerId})};setCurrentlyActiveSpeaker(e){const{peerId:t,volume:r}=e.activeSpeaker;this._activeSpeaker=e.activeSpeaker,this.emit("activeSpeaker",{peerId:t,volume:r})}_createSendTransport=async()=>{Ko.debug("Room _createSendTransport");try{this._device.loaded||(Ko.debug("Room _createSendTransport","Going to load device with routerrtpcapabilities"),await this._device.load({routerRtpCapabilities:this._routerRtpCapabilities}));let e="send";this._sendTransport||this._sendMessage({id:"createTransport",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,direction:e})}catch(dc){Ko.error("Room _createSendTransport",dc)}};_createRecvTransport=async()=>{this._device.loaded||(Ko.debug("loading device for creating recv transport"),await this._device.load({routerRtpCapabilities:this._routerRtpCapabilities}));this._recvTransport||(Ko.debug("receive transport created"),this._sendMessage({id:"createTransport",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,direction:"recv"}))};handleCreateTransportRequest=async e=>{Ko.debug("Room handleCreateTransportRequest():%O",e);let t,{transportOptions:r,direction:s}=e;try{if("recv"===s)t=await this._device.createRecvTransport(r),Ko.debug("Room",`handleCreateTransportRequest() recv transport created ${t.id}`),this._recvTransport=t,this.handleRecvTransportListeners();else{if("send"!==s)throw new Error(`bad transport 'direction': ${s}`);t=await this._device.createSendTransport(r),Ko.debug("Room",`handleCreateTransportRequest() send transport created [id:%s]${t.id}`),this._sendTransport=t,this.handleSendTransportListeners(),this.produceMedia()}}catch(i){}};handleSendTransportListeners=()=>{this._sendTransport.on("connect",this.handleTransportConnectEvent),this._sendTransport.on("produce",this.handleTransportProduceEvent);let e=this;this._sendTransport.on("connectionstatechange",async t=>{if(Ko.debug(`ConferenceRoom sendTransport connectionState ${t} & socketconnection state ${this._socket._ws.readyState}`),"failed"===t||"disconnected"===t)if(1===this._socket._ws.readyState)e.restartIce(this._sendTransport.id,"send");else{for(;1!==this._socket._ws.readyState;)Ko.debug(`socket not yet ready with state- ${this._socket._ws.readyState}`),await ro(1500);"connected"===this._roomStatus&&this.restartIce(this._sendTransport.id,"send")}Ko.debug("ConferenceRoom",`send transport connection state change [state:%s]${t}`)})};handleTransportConnectEvent=({dtlsParameters:e},t,r)=>{try{const r=e=>{Ko.debug("connect-transport action"),t(),Xo.remove("connectTransport")};Xo.push("connectTransport",r);let s={id:"connectTransport",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,transportId:this._sendTransport.id,dtlsParameters:e,direction:"send"};this._sendMessage(s)}catch(s){Ko.error("handleTransportConnectEvent() failed [error:%o]",s),r(s)}};handleTransportProduceEvent=({kind:e,rtpParameters:t,appData:r},s,i)=>{try{const i=e=>{Ko.debug("handleTransportProduceEvent callback [data:%o]",e),s({id:e.producerId}),Xo.remove("produce")};Xo.push("produce",i);let a="cam-audio"===r.mediaTag&&void 0!==this.data.inputParams.audioStatus&&!this.data.inputParams.audioStatus;Ko.debug(`handleTransportProduceEvent() | pause status->${a}`);let n={id:"sendTrack",transportId:this._sendTransport.id,peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,kind:e,rtpParameters:t,paused:a,appData:r,clientOs:this._client.os.name,browser:this._client.browser};this._sendMessage(n)}catch(a){Ko.error("handleTransportProduceEvent() failed [error:%o]",a),i(a)}};produceMedia=async()=>{this.data.inputParams.produce?(this.data.inputParams.produceAudio?this.enableMic({deviceId:this.data.inputParams.audioDeviceId?this.data.inputParams.audioDeviceId:null}):Ko.debug("No need to produce audio!"),this._device.canProduce("video")&&(this.data.inputParams.produceVideo?this.enableCam({deviceId:this.data.inputParams.videoDeviceId?this.data.inputParams.videoDeviceId:null}):Ko.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}))):Ko.warn("produce is false!")};handleRecvTransportListeners=async()=>{this._recvTransport.on("connect",this.handleRecvTransportConnectEvent);let e=this;this._recvTransport.on("connectionstatechange",async t=>{if(Ko.debug(`ConferenceRoom recvTransport connectionState ${t} & socketconnection state ${this._socket._ws.readyState}`),"failed"===t||"disconnected"===t)if(1===this._socket._ws.readyState)e.restartIce(this._recvTransport.id,"recv");else{for(;1!==this._socket._ws.readyState;)Ko.debug(`socket not yet ready with state- ${this._socket._ws.readyState}`),await ro(1e3);"connected"===this._roomStatus&&e.restartIce(this._recvTransport.id,"recv")}Ko.debug("ConferenceRoom",`Recv transport connection state change [state:%s]${t}`)});let t={id:"transportsAvailable",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,rtpCapabilities:this._device.rtpCapabilities};this._sendMessage(t)};handleRecvTransportConnectEvent=({dtlsParameters:e},t,r)=>{try{const r=e=>{Ko.debug("ConferenceRoom","connect-recv-transport action"),t(),Xo.remove("connectRecvTransport")};Xo.push("connectRecvTransport",r);let s={id:"connectTransport",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,transportId:this._recvTransport.id,dtlsParameters:e,direction:"recv"};this._sendMessage(s)}catch(s){Ko.error("handleTransportConnectEvent() failed [error:%o]",s),r(s)}};handleRecvTrackRequest=async e=>{if(Ko.debug("Room handleRecvTrackRequest",e),!this.data.inputParams.consume)return void Ko.warn("I do not want to consume");let{senderPeerId:t,mediaTag:r,sender:s,audioStatus:i,videoStatus:a,senderParticipantType:n,type:o,producerPaused:c,...d}=e;Ko.debug("New consumer created",d),d.id=d.consumerId,delete d.consumerId,Ko.debug("ConferenceRoom",`senderPeerId is ->${t}`);let l=await this._recvTransport.consume({...d,streamId:`${t}-${"screen-video"===r||"screen-audio"===r?"share":"mic-webcam"}`,appData:{peerId:t,mediaTag:r}});for(;this._recvTransport&&"connected"!==this._recvTransport.connectionState;)Ko.debug(`recv transport connstate${this._recvTransport.connectionState}`),await ro(100);this._consumers.set(l.id,l),l.on("transportclose",()=>{this._consumers.delete(l.id)});const{spatialLayers:p,temporalLayers:u}=pr.parseScalabilityMode(l.rtpParameters.encodings[0].scalabilityMode),h=this._peers.get(this.data.inputParams.peerId);Ko.debug(`Consumer created for sender peerId ${t} for kind ${l.kind} for receiver peerId ${this.data.inputParams.peerId}`),Ko.info("The old peer data is :%O",h),h?(h["screen-video"===r||"screen-audio"===r?`ss${l.kind}`:l.kind]={consumerId:l.id,type:o,locallyPaused:!1,remotelyPaused:c,rtpParameters:l.rtpParameters,spatialLayers:p,temporalLayers:u,preferredSpatialLayer:p-1,preferredTemporalLayer:u-1,priority:1,codec:l.rtpParameters.codecs[0].mimeType.split("/")[1],track:l.track,share:"screen-video"===r||"screen-audio"===r},Ko.info("The new peer data is :%O",h),this._peers.set(this.data.inputParams.peerId,h)):(Ko.info("Peer not found!"),this._peers.set(this.data.inputParams.peerId,{["screen-video"===r||"screen-audio"===r?`ss${l.kind}`:l.kind]:{consumerId:l.id,type:o,locallyPaused:!1,remotelyPaused:c,rtpParameters:l.rtpParameters,spatialLayers:p,temporalLayers:u,preferredSpatialLayer:p-1,preferredTemporalLayer:u-1,priority:1,codec:l.rtpParameters.codecs[0].mimeType.split("/")[1],track:l.track,share:"screen-video"===r||"screen-audio"===r}})),await this.resumeConsumer(l),Ko.debug("Going to emit mic start / videostart"),"audio"===l.kind?"screen-audio"===r?this.emit("ssAudioStart",{peerId:t,audioTrack:l.track,type:"remote"}):this.emit("micStart",{peerId:t,audioTrack:l.track,type:"remote"}):"video"===l.kind&&("screen-video"===r?this.emit("ssVideoStart",{peerId:t,videoTrack:l.track,type:"remote"}):this.emit("videoStart",{peerId:t,videoTrack:l.track,type:"remote"}))};resumeConsumer=async e=>{if(e){Ko.debug("resume consumer",e.appData.peerId,e.appData.mediaTag);try{let t={id:"resumeConsumer",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,consumerId:e.id};this._sendMessage(t),await e.resume()}catch(t){}}};handleConnectTransportRequest=async e=>{Ko.debug("handleTransportConnectRequest()");try{const t=Xo.get("connectTransport");if(!t)throw new Error("transport-connect action was not found");await t(e)}catch(t){}};handleConnectRecvTransportRequest=async e=>{Ko.debug("handleTransportConnectRequest()");try{const t=Xo.get("connectRecvTransport");if(!t)throw new Error("recv transport-connect action was not found");await t(e)}catch(t){}};handleSendTrackRequest=async e=>{Ko.debug("ConferenceRoom","handleProduceRequest()");try{const t=Xo.get("produce");if(!t)throw new Error("produce action was not found");await t(e)}catch(t){Ko.error("handleProduceRequest() failed [error:%o]",t)}};mediaToggled=e=>{switch(Ko.debug("Media Toggled message:%O",e),e.type){case"video":Ko.debug(`mediaToggled() | inside case video${e.videoStatus}`);break;case"audio":Ko.debug(`mediaToggled() | inside case audio${e.videoStatus}`),e.audioStatus?this.emit("peerUnMuted",{peerId:e.peerId,type:"remote"}):this.emit("peerMuted",{peerId:e.peerId,type:"remote"})}};closeConsumer=e=>{let{consumerId:t}=e;const r=this._consumers.get(t);if(!r)return void Ko.warn("Consumer with id not found!:%s",t);const{peerId:s,mediaTag:i}=r.appData;Ko.debug("Consumer closed for consumerId:%s, type:%s, appData:%o",t,r?.kind,r.appData);let a="screen-audio"===i||"screen-video"===i?`ss${r.kind}`:r.kind;r.close(),this._consumers.delete(t);let n=this._peers.get(this.data.inputParams.peerId);Ko.debug("Peer data before deletion:%O",n),n[a]&&n[a].consumerId===t&&delete n[a],Ko.debug("Peer data after deletion:%O",n),this._peers.set(this.data.inputParams.peerId,n),"audio"===r?.kind?(Ko.debug("Going to emit micEnd, consumer closed for audio"),"screen-audio"===i?this.emit("ssAudioStop",{peerId:s,track:null,type:"remote"}):this.emit("micEnd",{peerId:s,track:null,type:"remote"})):"video"===r?.kind&&(Ko.debug("Going to emit videoEnd, consumer closed for video"),"screen-video"===i?this.emit("ssVideoStop",{peerId:s,track:null,type:"remote"}):this.emit("videoEnd",{peerId:s,track:null,type:"remote"}))};peerLeft=e=>{Ko.debug("Peer Left message is:%o",e);let{peerId:t}=e;this._peers.delete(t),this.emit("peerLeft",{peerId:t})};roomClosed=()=>{Ko.info("room closed by Moderator"),this._peers=null,this.emit("roomClosed",{roomId:this.data.inputParams.roomId})};close(){this._closed||(this._closed=!0,this._socket=null,this.data.inputParams={},Ko.info("Room close()"),this._sendTransport&&this._sendTransport.close(),this._recvTransport&&this._recvTransport.close(),this._roomStatus="closed",this._running=!1)}async leaveRoom(){Ko.debug("Leave room is called!!"),"connected"===this._roomStatus?(this._sendMessage({id:"leaveRoomNew",peerId:this.data.inputParams.peerId,roomLeaveType:"client"}),this.leaveRoomCommon()):Ko.error("The room state is:%s",this._roomStatus)}async closeRoom(){"connected"===this._roomStatus?(this._sendMessage({id:"leaveAndCloseRoom",peerId:this.data.inputParams.peerId,roomCloseType:"client"}),this.leaveRoomCommon()):Ko.error("The room state is:%s",this._roomStatus)}leaveRoomCommon=()=>{this._sendTransport&&(this._sendTransport.close(),this._sendTransport=null),this._recvTransport&&(this._recvTransport.close(),this._recvTransport=null),this._webCamStream&&this._webCamStream.getVideoTracks().forEach(e=>{e.stop(),Ko.debug("Video Track stopped")}),this._micStream&&this._micStream.getAudioTracks().forEach(e=>{e.stop(),Ko.debug("Mic Track stopped")}),this._roomStatus="closed",this._running=!1,this._routerRtpCapabilities=null};async listDevicesInternal(){if(navigator.mediaDevices.ondevicechange=async e=>{let t=await Jn();Ko.info("Media devices changed!:%O",t),t.audioDevices&&t.audioDevices.length>0&&(this._deviceList.audioDevices=t.audioDevices),t.videoDevices&&t.videoDevices.length>0&&(this._deviceList.videoDevices=t.videoDevices),t.audioDevices&&t.audioDevices.length>0&&(this._deviceList.audioOutputDevices=t.audioDevicesOutput),Qo=this._deviceList,this.emit("deviceListUpdated")},!this._deviceList){const e=await Qn();if(e.success)return this._deviceList=e.deviceList,void(Qo=this._deviceList)}}restartIce=async(e,t)=>{if("send"===t&&"connected"===this._sendTransport.connectionState||"recv"===t&&"connected"===this._recvTransport.connectionState)return void Ko.debug("no need to restart ICE as transport now connected");Ko.debug("websocket is ready and connectionstate is still disconnected, therefore going to restart ICE");let r={id:"restartIce",transportId:e,roomName:this.data.inputParams.roomId,peerId:this.data.inputParams.peerId};this._sendMessage(r)};restartIceResponse=e=>{Ko.debug("restart ICE response:%o",e);let{transportId:t,iceParameters:r}=e;this._sendTransport&&this._sendTransport.id===t?this._sendTransport.restartIce({iceParameters:r}):this._recvTransport&&this._recvTransport.id===t&&this._recvTransport.restartIce({iceParameters:r})};startRecording=({recordingType:e=null,outputType:t=null,outputQualities:r=null}={})=>{Ko.debug("recording type requested is:%s,outputType:%s, outputQualties:%o",e,t,r);const s=!e||"av"!==e?.toLowerCase()&&"audiovideo"!==e?.toLowerCase()?"mergedA":"mergedAV";if((!t||"hls"!==t.toLowerCase()&&"mp4"!==t.toLowerCase())&&t)return Ko.error("Invalid outut type"),{success:!1,reason:`Invalid outputType: ${t}. `};if(t&&"hls"===t.toLowerCase()&&r&&!ao(r))return Ko.error("Invalid outut qualities"),{success:!1,reason:`Invalid outputQualities: ${JSON.stringify(r)}. Allowed values are ${Array.from(so).join(", ")}.`};let i={id:"startRecording",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,url:window.location.hostname,type:An,recordingStrategy:s,outputQualities:r,outputType:t?.toLowerCase()};this._sendMessage(i),this._recordingStartedByMe={...this._recordingStartedByMe,"main-room":{recordingNo:null}}};stopRecording=()=>{Ko.debug("going to stop recording for recordingStartedByMe:%o",this._recordingStartedByMe);let e="main-room";if(!this._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."};{let t={id:"stopRecording",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,recordingNo:this._recordingStartedByMe[e].recordingNo,type:An};this._sendMessage(t),delete this._recordingStartedByMe[e],this.emit("recordingEnded",{peerId:this.data.inputParams.peerId})}};setRecordingStatusStarted=e=>{Ko.debug("Recording/Streaming started by moderator!!:%O",e);let{breakOutRoom:t,recordingStartTime:r,recordingNo:s,type:i}=e;[An,Nn].includes(i)&&(this._recordingStartedByMe["main-room"]?(Ko.debug("This recording has been started by me."),this._recordingStartedByMe["main-room"].recordingNo=s,this.emit("recordingStarted",{peerId:this.data.inputParams.peerId,startTime:r})):this.emit("recordingStarted",{startTime:r}))};setRecordingStatusEnded=e=>{Ko.debug("Recording ended by moderator!!, data:%O",e);let{breakOutRoom:t,type:r}=e;"rtmpStream"===r||this.emit("recordingEnded",{})};startProcessing=async({inputFiles:e=[],outputQualities:t=null,bucket:r=null,cloud:s=null,region:i=null}={})=>{Ko.debug("Processing of Files requested for:%o",e);const a=Math.round(1e7*Math.random()),n=await async function(e){if(no.info("The input files are:%o, length:%s",e,e.length),e.length>0){no.info("Files array length is:%s",e.length);for(const{type:t,url:r}of e){if(no.info("The file detais are type:%s, url:%s",t,r),!oo.includes(t))return{success:!1,reason:`Type "${t}" is not allowed.`};if(!co(r,t))return{success:!1,reason:`Extension mismatch for ${r}; expected .${t}`}}return{success:!0}}return{success:!1,reason:"There are no files for processing!"}}(e);if(n.success){if(t&&!ao(t))return Ko.error("Invalid outut qualities"),{success:!1,reason:`Invalid outputQualities: ${JSON.stringify(t)}. Allowed values are ${Array.from(so).join(", ")}.`};this._processingStartedByMe={...this._processingStartedByMe,[a]:{}};for(const{type:t,url:r}of e)this._processingStartedByMe={...this._processingStartedByMe,[a]:{...this._processingStartedByMe[a],[r]:{type:t,url:r,status:"pending"}}};let n={id:"processVideos",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,inputFiles:e,outputQualities:t,bucket:r,cloud:s,region:i,requestId:a,type:"process"};return this._sendMessage(n),{success:!0}}return n};checkProcessingStatus=({requestId:e})=>(Ko.debug("Going to check processing status for request Id:%s",e),this._processingStartedByMe[e]?{success:!0,details:this._processingStartedByMe[e]}:{success:!0,details:this._processingStartedByMe});handleProcessingStart=e=>{const{processingStartTime:t,processingNo:r,requestId:s}=e;Ko.debug("handleProcessingStart()| received message is:%o",e),this.emit("processingStarted",{processingStartTime:t,requestId:s})};handleProcessingCompletion=e=>{const{totalProcessingTime:t,hlsfileKey:r,size:s,originalFile:i,lastFile:a,requestId:n}=e;if(Ko.debug("handleProcessingCompletion()| received message is:%o",e),Ko.debug("Before update, Total files to be processed are:%o",this._processingStartedByMe),this._processingStartedByMe[i]&&(this._processingStartedByMe={...this._processingStartedByMe,[n]:{...this._processingStartedByMe[n],[i]:{...this._processingStartedByMe[i],status:"completed",hlsfileKey:r,size:s,totalProcessingTime:t}}}),Ko.debug("After update, Total files to be processed are:%o",this._processingStartedByMe),this.emit("processingCompleted",e),a){Ko.debug("The last file processing has been completed! Remove all the files that has been completed with the same requesterId");let e={...this._processingStartedByMe};delete e[n],Ko.debug("After deleting the current requestId:%o",e),this._processingStartedByMe=e}};handleProcessingError=e=>{const{totalProcessingTime:t,hlsfileKey:r,size:s,originalFile:i,lastFile:a,requestId:n,error:o}=e;Ko.debug("handleProcessingCompletion()| received message is:%o",e),Ko.debug("Before update, Total files to be processed are:%o",this._processingStartedByMe),this._processingStartedByMe[i]&&(this._processingStartedByMe={...this._processingStartedByMe,[n]:{...this._processingStartedByMe[n],[i]:{...this._processingStartedByMe[i],status:"error",hlsfileKey:r,size:s,totalProcessingTime:t,error:o}}}),Ko.debug("After update, Total files to be processed are:%o",this._processingStartedByMe),this.emit("processingError",e)};async enableMic({deviceId:e=null,autoGainControl:t,noiseSuppression:r,echoCancellation:s,channelCount:i,sampleRate:a,forcePCMU:n,forcePCMA:o}={}){if(Ko.debug("enableMic()"),!this.data.inputParams.produce)return Ko.debug("Produce status is set to false!"),{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."};if("connected"!==this._roomStatus)return Ko.debug("Room status is not connected yet!"),{success:!1,error:!0,code:"REID008",text:`Error while trying to start Mic/Audio as room not in connected status. Current room status:!${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."};if(this._micProducer)return Ko.debug("Mic is already active!"),{success:!1,warning:!0,code:"RWID002",text:"Error while trying to start Mic/Audio. Mic/Audio is already active!"};if(!this._device.canProduce("audio"))return Ko.error("enableMic() | cannot produce audio"),{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."};let c,d;n&&"boolean"==typeof n&&(this.data.inputParams.forcePCMU=n),o&&"boolean"==typeof o&&(this.data.inputParams.forcePCMA=o),t&&"boolean"==typeof t&&(this.data.inputParams.autoGainControl=t),s&&"boolean"==typeof s&&(this.data.inputParams.echoCancellation=s),r&&"boolean"==typeof r&&(this.data.inputParams.noiseSuppression=r),a&&Number.isInteger(a)&&a<64e3&&a>8e3&&(this.data.inputParams.sampleRate=a),i&&Number.isInteger(i)&&i>0&&i<3&&(this.data.inputParams.channelCount=i);try{if(this._externalVideo)this._micStream=await this._getExternalVideoStream(),c=this._micStream.getAudioTracks()[0].clone();else{if(e?(d=this._deviceList.audioDevices.find(t=>t.deviceId===e),d||(Ko.warn("Selected audio input deviceId:%s not found",e),d=this._deviceList.audioDevices[0])):d=this._deviceList.audioDevices[0],this._mic.device=d,!d)return Ko.error("No mic device found! Can't start audio!"),{success:!1,reason:"No mic available for starting audio!"};e&&this.data.inputParams.audioDeviceId!==e&&(this.data.inputParams.audioDeviceId=e),Ko.debug("enableMic() | calling getUserMedia()");try{this._micStream=await navigator.mediaDevices.getUserMedia({audio:{deviceId:{exact: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}}),c=this._micStream.getAudioTracks()[0]}catch(dc){throw new Error("Error while acquiring mic. Possible issue with audio constraint values",dc)}}this._micProducer=await this._sendTransport.produce({track:c,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(e=>"audio/pcmu"===e.mimeType.toLowerCase()):this.data.inputParams.forcePCMA?this._device.rtpCapabilities.codecs.find(e=>"audio/pcma"===e.mimeType.toLowerCase()):void 0,appData:{mediaTag:"cam-audio"}}),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",()=>{this._micProducer=null}),this._micProducer.on("trackended",()=>{this.disableMic().catch(()=>{})})}catch(l){Ko.error("enableMic() | failed:%o",l),this.emit("error",{code:"EID002",text:"Error enabling microphone!"}),c&&c.stop()}}async disableMic(){if(Ko.debug("disableMic()"),this._micStream&&this._micStream.getAudioTracks().forEach(e=>e.stop()),this._micProducer){this._micProducer.close(),this._producers.delete("audio");try{let e={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",producerId:this._micProducer.id};this._sendMessage(e),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}}async muteMic(){Ko.debug("muteMic()"),this._micProducer.pause();try{let e={id:"toggleMedia",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",audioStatus:!1,producerId:this._micProducer.id};this._sendMessage(e),this.emit("peerMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){Ko.error("muteMic() | failed: %o",e),this.emit("error",{code:"EID004",text:"Error muting local microphone!"})}}async unmuteMic(){Ko.debug("unmuteMic()"),this._micProducer.resume();try{let e={id:"toggleMedia",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",audioStatus:!0,producerId:this._micProducer.id};this._sendMessage(e),this.emit("peerUnMuted",{peerId:this.data.inputParams.peerId,type:"local"})}catch(e){Ko.error("unmuteMic() | failed: %o",e),this.emit("error",{code:"EID005",text:"Error unmuting local microphone!"})}}async enableCam({deviceId:e=null,videoResolution:t,forceVp8:r,forceVp9:s,forceH264:i,h264Profile:a,forceFPS:n,enableWebcamLayers:o,numSimulcastStreams:c,videoBitRates:d}={}){if(Ko.debug("enableWebcam()"),!this.data.inputParams.produce)return Ko.debug("Produce status is set to false!"),{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."};if("connected"!==this._roomStatus)return Ko.debug("Room status is not connected yet!"),{success:!1,error:!0,code:"REID005",text:`Error while trying to start Camera as room not in connected status. Current room status:!${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."};if(this._webcamProducer)return Ko.debug("Camera is already active!"),{success:!1,warning:!0,code:"RWID003",text:"Error while trying to start Camera. Camera is already active!"};if(!this._device.canProduce("video"))return Ko.error("enableWebcam() | cannot produce video"),{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."};let l,p;["hd","vga","qvga"].includes(t)&&(this.data.inputParams.videoResolution=t,this._webcam.resolution=t),r&&"boolean"==typeof r&&(this.data.inputParams.forceVp8=r),s&&"boolean"==typeof s&&(this.data.inputParams.forceVp9=s),i&&"boolean"==typeof i&&(this.data.inputParams.forceH264=i),a&&["high","low"].includes(a.toLowerCase())&&(this.data.inputParams.h264Profile=a),n&&Number.isInteger(n)&&n<65&&n>5&&(this.data.inputParams.forceFPS=25),o&&"boolean"==typeof o&&(this.data.inputParams.enableWebcamLayers=o,this._enableWebcamLayers=o),c&&Number.isInteger(c)&&c<4&&c>0&&(this.data.inputParams.numSimulcastStreams=c,this._numSimulcastStreams=c),Array.isArray(d)&&d.length>=1&&d.length<=3&&d.every(e=>Number.isInteger(e)&&e>=75&&e<=800)?(Ko.debug("videoBitRates values are correct"),this.data.inputParams.videoBitRates=d):Ko.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]'");try{if(this._externalVideo)p={label:"external video"},this._webCamStream=await this._getExternalVideoStream(),l=this._webCamStream.getVideoTracks()[0].clone();else{e?(p=this._deviceList.videoDevices.find(t=>t.deviceId===e),p||(Ko.warn("Selected deviceId:%s not found",e),p=this._deviceList.videoDevices[0])):p=this._deviceList.videoDevices[0],this._webcam.device=p;const{resolution:t}=this._webcam;if(!p)return Ko.error("No wencam device found! Can't start video!"),{success:!1,reason:"No Webcam available for starting video!"};e&&this.data.inputParams.videoDeviceId!==e&&(this.data.inputParams.videoDeviceId=e),Ko.debug("enableWebcam() | calling getUserMedia()"),this._webCamStream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:p.deviceId},...Jo[t],frameRate:{ideal:this.data.inputParams.forceFPS}}}),l=this._webCamStream.getVideoTracks()[0]}let t,r;const s={videoGoogleStartBitrate:1e3};if(Ko.debug("Current device codec options are:%O",this._device.rtpCapabilities.codecs),this._forceVP8){if(r=this._device.rtpCapabilities.codecs.find(e=>"video/vp8"===e.mimeType.toLowerCase()),!r)throw new Error("desired VP8 codec+configuration is not supported")}else if(this._forceH264){if("high"===this.data.inputParams.h264Profile?r=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]):"low"===this.data.inputParams.h264Profile&&(r=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"])),!r)throw new Error("desired H264 codec+configuration is not supported");Ko.debug("Selected h264 codec is:%O",r)}else if(this._forceVP9&&(r=this._device.rtpCapabilities.codecs.find(e=>"video/vp9"===e.mimeType.toLowerCase()),!r))throw new Error("desired VP9 codec+configuration is not supported");if(this._enableWebcamLayers){const e=this._device.rtpCapabilities.codecs.find(e=>"video"===e.kind);this._forceVP9&&r||"video/vp9"===e.mimeType.toLowerCase()?t=[{maxBitrate:5e6,scalabilityMode:this._webcamScalabilityMode||"L3T3_KEY"}]:(t=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.videoBitRates[0],scalabilityMode:this._webcamScalabilityMode||"L1T3"}],this._numSimulcastStreams>1&&t.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.videoBitRates[1],scalabilityMode:this._webcamScalabilityMode||"L1T3"}),this._numSimulcastStreams>2&&t.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.videoBitRates[2],scalabilityMode:this._webcamScalabilityMode||"L1T3"}))}this._webcamProducer=await this._sendTransport.produce({track:l,encodings:t,codecOptions:s,codec:r,appData:{mediaTag:"cam-video"}}),this._producers.set("video",{id:this._webcamProducer.id,deviceLabel:p.label,type:this._getWebcamType(p),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",()=>{this._webcamProducer=null}),this._webcamProducer.on("trackended",()=>{this.disableCam().catch(()=>{})})}catch(u){Ko.error("enableWebcam() | failed:%o",u),this.emit("error",{code:"EID011",text:"Enable Webcam failed!"}),l&&l.stop()}}async disableCam(){if(Ko.debug("disableWebcam()"),this._webcamProducer){this._webcamProducer.close(),this._producers.delete("video");try{let e={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"video",producerId:this._webcamProducer.id};this._sendMessage(e),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}}async _updateWebcams(){Ko.debug("_updateWebcams()"),this._webcams=new Map,Ko.debug("_updateWebcams() | calling enumerateDevices()");const e=await navigator.mediaDevices.enumerateDevices();for(const i of e)"videoinput"===i.kind&&this._webcams.set(i.deviceId,i);const t=Array.from(this._webcams.values()),r=t.length,s=this._webcam.device?this._webcam.device.deviceId:void 0;Ko.debug("_updateWebcams() [webcams:%o]",t),0===r?this._webcam.device=null:this._webcams.has(s)||(this._webcam.device=t[0])}async _getExternalVideoStream(){if(this._externalVideoStream)return this._externalVideoStream;if(this._externalVideo.readyState<3&&await new Promise(e=>this._externalVideo.addEventListener("canplay",e)),this._externalVideo.captureStream)this._externalVideoStream=this._externalVideo.captureStream();else{if(!this._externalVideo.mozCaptureStream)throw new Error("video.captureStream() not supported");this._externalVideoStream=this._externalVideo.mozCaptureStream()}return this._externalVideoStream}_getWebcamType(e){return/(back|rear)/i.test(e.label)?(Ko.debug("_getWebcamType() | it seems to be a back camera"),"back"):(Ko.debug("_getWebcamType() | it seems to be a front camera"),"front")}async changeVideoInput({resolution:e,deviceId:t,fps:r}){if(this._webcamProducer){return await this._changeVideoInput({resolution:e,deviceId:t,fps:r})}return Ko.error("No webcam producer available!"),{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. "}}async _changeVideoInput({resolution:e,deviceId:t,fps:r}){Ko.info("_changeVideoInput() | Inside"),e&&["hd","vga","qvga"].includes(e)?this._webcam.resolution=e:Ko.warn("Invalid video resolution value "),r&&Number.isInteger(r)&&r<65&&r>5?this.data.inputParams.forceFPS=r:Ko.warn("forceFPS should be a number between 5 to 65, default value is 25 fps.");let s=this._deviceList.videoDevices.find(e=>t&&e.deviceId===t);if(!s)return Ko.error("The selected deviceId not found!"),{success:!1,reason:"Invalid deviceId!"};this._webcam.device=s;try{this._webCamStream.getVideoTracks().forEach(e=>e.stop()),this._webCamStream=null,Ko.debug("changeVideoInput() | calling getUserMedia()"),this._webCamStream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:s.deviceId},...Jo[this._webcam.resolution],frameRate:{ideal:this.data.inputParams.forceFPS}}});const e=this._webCamStream.getVideoTracks()[0];Ko.debug("The new video track is:%O",e),await this._webcamProducer.replaceTrack({track:e});let t=this._producers.get("video");return t.deviceLabel=s.label,t.type=this._getWebcamType(s),t.track=this._webcamProducer.track,Ko.debug("Updated producer values are:%O",t),this._producers.set("video",t),this.emit("videoStart",{peerId:this.data.inputParams.peerId,videoTrack:this._webcamProducer.track,type:"local"}),{success:!0}}catch(i){return Ko.error("Error while changing input:%O",i),{success:!1,reason:"Couldn't change video input",error:i}}}async changeAudioInput({autoGainControl:e,echoCancellation:t,noiseSuppression:r,sampleRate:s,channelCount:i,deviceId:a}){if(this._micProducer){return await this._changeAudioInput({autoGainControl:e,echoCancellation:t,noiseSuppression:r,sampleRate:s,channelCount:i,deviceId:a})}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. "}}async _changeAudioInput({autoGainControl:e,echoCancellation:t,noiseSuppression:r,sampleRate:s,channelCount:i,deviceId:a}){e&&"boolean"==typeof e&&(this.data.inputParams.autoGainControl=e),t&&"boolean"==typeof t&&(this.data.inputParams.echoCancellation=Boolean(t)),r&&"boolean"==typeof r&&(this.data.inputParams.noiseSuppression=Boolean(r)),s&&Number.isInteger(s)&&s<64e3&&s>8e3&&(this.data.inputParams.sampleRate=s),i&&Number.isInteger(i)&&i>0&&i<3&&(this.data.inputParams.channelCount=i);let n=this._deviceList.audioDevices.find(e=>a&&e.deviceId===a);if(!n)return{success:!1,reason:"Invalid deviceId!"};this._mic.device=n,this._micStream&&this._micStream.getAudioTracks().forEach(e=>e.stop()),this._micStream=null;try{this._micStream=await navigator.mediaDevices.getUserMedia({audio:{deviceId:{exact:n.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}});const e=this._micStream.getAudioTracks()[0];this._micProducer.replaceTrack({track:e});let t=this._producers.get("audio");return t.deviceLabel=n.label,t.track=this._micProducer.track,Ko.debug("Updated producer values are:%O",t),this._producers.set("audio",t),this.emit("micStart",{peerId:this.data.inputParams.peerId,audioTrack:this._micProducer.track,type:"local"}),{success:!0}}catch(dc){return Ko.error("Error while changing input:%O",dc),{success:!1,reason:"Couldn't change audio input",err:dc}}}async enableShare({shareAudio:e=!1,enableSharingLayers:t=!0,shareBitRates:r=[2500,1250,500]}={}){if(Ko.debug("enableShare()"),!this.data.inputParams.produce)return Ko.debug("Produce status is set to false!"),{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."};if("connected"!==this._roomStatus)return Ko.debug("Room status is not connected yet!"),{success:!1,error:!0,code:"REID001",text:`Error while trying to start screen share as room not in connected status. Current room status:!${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."};if(this._shareProducer)return Ko.debug("Screen share is already active!"),{success:!1,warning:!0,code:"RWID001",text:"Error while trying to start screen share. Screen share is already active!"};if(!this._device.canProduce("video"))return Ko.error("enableShare() | cannot produce video"),{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."};let s,i;this._enableSharingLayers="boolean"!=typeof t?Boolean(t):t,Array.isArray(r)&&r.length>=1&&r.length<=3&&r.every(e=>Number.isInteger(e)&&e>=500&&e<=2500)?this.data.inputParams.shareBitRates=r:this.data.inputParams.shareBitRates=[2500,1250,500];try{Ko.debug("enableShare() | calling getDisplayMedia()");const t=await navigator.mediaDevices.getDisplayMedia({audio:!!e,video:{displaySurface:"monitor",logicalSurface:!0,cursor:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}});if(!t)return Ko.error("Unable to capture screen."),void this.emit("error",{code:"EID013",text:"Error while trying to start screen share. Not able to capture screen!"});let r,a;i=t.getAudioTracks()[0],i&&(this._shareAudioProducer=await this._sendTransport.produce({track:i,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(e=>"audio/pcmu"===e.mimeType.toLowerCase()):void 0,appData:{mediaTag:"screen-audio"}}),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"})),s=t.getVideoTracks()[0];const n={videoGoogleStartBitrate:1e3};if(this._forceVP8){if(a=this._device.rtpCapabilities.codecs.find(e=>"video/vp8"===e.mimeType.toLowerCase()),!a)throw new Error("desired VP8 codec+configuration is not supported")}else if(this._forceH264){if("high"===this.data.inputParams.h264Profile?a=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"4d001f"===e.parameters["profile-level-id"]):"low"===this.data.inputParams.h264Profile&&(a=this._device.rtpCapabilities.codecs.find(e=>"video/h264"===e.mimeType.toLowerCase()&&"42e01f"===e.parameters["profile-level-id"])),!a)throw new Error("desired H264 codec+configuration is not supported");Ko.debug("Selected h264 codec is:%O",a)}else if(this._forceVP9&&(a=this._device.rtpCapabilities.codecs.find(e=>"video/vp9"===e.mimeType.toLowerCase()),!a))throw new Error("desired VP9 codec+configuration is not supported");if(this._enableSharingLayers){const e=this._device.rtpCapabilities.codecs.find(e=>"video"===e.kind);this._forceVP9&&a||"video/vp9"===e.mimeType.toLowerCase()?r=[{maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L3T3",dtx:!0}]:(r=[{scaleResolutionDownBy:1,maxBitrate:1e3*this.data.inputParams.shareBitRates[0],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}],this._numSimulcastStreams>1&&r.unshift({scaleResolutionDownBy:2,maxBitrate:1e3*this.data.inputParams.shareBitRates[1],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}),this._numSimulcastStreams>2&&r.unshift({scaleResolutionDownBy:4,maxBitrate:1e3*this.data.inputParams.shareBitRates[2],scalabilityMode:this._sharingScalabilityMode||"L1T3",dtx:!0}))}this._shareProducer=await this._sendTransport.produce({track:s,encodings:r,codecOptions:n,codec:a,appData:{mediaTag:"screen-video"}}),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",()=>{this._shareProducer=null}),this._shareProducer.on("trackended",()=>{this.disableShare().catch(()=>{})})}catch(a){Ko.error("enableShare() | failed:%o",a),"NotAllowedError"!==a.name&&this.emit("error",{code:"EID014",text:`Error while trying to start screen share. Error is: ${a}!`}),s&&s.stop()}}async disableShare(){if(Ko.debug("disableShare()"),!this._shareProducer)return Ko.warn("Screen share doesn't seem to be on!"),void this.emit("error",{code:"EID017",text:"Error while trying to stop screen share. Is the screen share on!"});if(this._shareProducer.close(),this._shareAudioProducer){this._shareAudioProducer.close();try{let e={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"audio",producerId:this._shareAudioProducer.id};this._sendMessage(e),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: ${e}!`})}}try{let e={id:"closeProducerSDK",peerId:this.data.inputParams.peerId,roomName:this.data.inputParams.roomId,type:"video",producerId:this._shareProducer.id};this._sendMessage(e),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: ${e}!`})}this._shareAudioProducer=null,this._shareProducer=null}}const Zo="cp2p-client";class ec{constructor(e){e?(this._debug=kr(`${Zo}:${e}`),this._info=kr(`${Zo}:INFO:${e}`),this._warn=kr(`${Zo}:WARN:${e}`),this._error=kr(`${Zo}:ERROR:${e}`)):(this._debug=kr(Zo),this._info=kr(`${Zo}:INFO`),this._warn=kr(`${Zo}:WARN`),this._error=kr(`${Zo}:ERROR`)),this._debug.log=function(){}.bind(),this._info.log=function(){}.bind(),this._warn.log=function(){}.bind(),this._error.log=function(){}.bind()}get debug(){return this._debug}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}}const tc={audio:{deviceId:{exact:void 0}},video:!1},rc={video:{deviceId:{exact:void 0},width:{min:320,ideal:640,max:1280},height:{min:240,ideal:480,max:720},frameRate:{min:15,max:30}}},sc={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}}},ic=new ec("socket");class ac extends xr.EventEmitter{constructor({url:e,roomId:t,peerId:r,peerName:s,role:i}){super(),ic.debug("constructor():%o ",{url:e,roomId:t,peerId:r,peerName:s,role:i}),this._closed=!1,this._params={url:e,roomId:t,peerId:r,peerName:s,role:i},this._socket=null,this._connectionStatus=null,this._createSocket()}get closed(){return this._closed}get connectionStatus(){return this._connectionStatus}close(){if(!this._closed){ic.debug("close()"),this._closed=!0,this.emit("close");try{this._socket.disconnect()}catch(e){ic.error("close() | error closing the Socket:%o",e)}}}async send(e){if(this._closed)throw new Error("transport closed");try{this._socket.send(JSON.stringify(e))}catch(t){throw ic.warn("send() failed:%o",t),t}}async request({type:e,message:t}){return new Promise(r=>{if(this._closed)throw new Error("transport closed");try{this._socket.emit(e,JSON.stringify(t),e=>{r(e)})}catch(s){throw ic.warn("emit() failed:%o",s),s}})}async _createSocket(){let e=this;const t=io(this._params.url,{query:{roomId:this._params.roomId,peerId:this._params.peerId,peerName:this._params.peerName,role:this._params.role}});t.on("connect",()=>{ic.debug("Socket connected!!"),e._connectionStatus=!0,e.emit("connected")}),t.on("disconnect",()=>{ic.debug("Socket disconnected!!"),e._connectionStatus=!1,e.emit("disconnected")}),t.on("reconnect",()=>{ic.debug("Socket reconnected after disconnect!!"),t.emit("reconnected")}),t.on("message",t=>{const r=JSON.parse(t);ic.debug("New mesage received with id:%s",r.type),e.emit("message",r)}),this._socket=t}}
24
8
  /*!
25
- * Platform.js
26
- * Copyright 2014-2020 Benjamin Tan
27
- * Copyright 2011-2013 John-David Dalton
28
- * Available under MIT license
29
- */
30
- (function(){var e={function:!0,object:!0},i=e["undefined"==typeof window?"undefined":(0,n.default)(window)]&&window||this,a=e[void 0===r?"undefined":(0,n.default)(r)]&&r,o=e[void 0===t?"undefined":(0,n.default)(t)]&&t&&!t.nodeType&&t,s=a&&o&&"object"==("undefined"==typeof global?"undefined":(0,n.default)(global))&&global;!s||s.global!==s&&s.window!==s&&s.self!==s||(i=s);var c=Math.pow(2,53)-1,u=/\bOpera/,d=Object.prototype,l=d.hasOwnProperty,f=d.toString;function p(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function h(e){return e=y(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:p(e)}function m(e,t){for(var r in e)l.call(e,r)&&t(e[r],r,e)}function b(e){return null==e?p(e):f.call(e).slice(8,-1)}function v(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function g(e,t){var r=null;return function(e,t){var r=-1,n=e?e.length:0;if("number"==typeof n&&n>-1&&n<=c)for(;++r<n;)t(e[r],r,e);else m(e,t)}(e,function(n,i){r=t(r,n,i,e)}),r}function y(e){return String(e).replace(/^ +| +$/g,"")}var _=function e(t){var r=i,a=t&&"object"==(0,n.default)(t)&&"String"!=b(t);a&&(r=t,t=null);var o=r.navigator||{},s=o.userAgent||"";t||(t=s);var c,d,l,p,_,w=a?!!o.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(f.toString()),k="Object",S=a?k:"ScriptBridgingProxyObject",x=a?k:"Environment",E=a&&r.java?"JavaPackage":b(r.java),P=a?k:"RuntimeObject",R=/\bJava/.test(E)&&r.java,M=R&&b(r.environment)==x,C=R?"a":"α",T=R?"b":"β",A=r.document||{},I=r.operamini||r.opera,O=u.test(O=a&&I?I["[[Class]]"]:b(I))?O:I=null,j=t,D=[],L=null,B=t==s,N=B&&I&&"function"==typeof I.version&&I.version(),F=g([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"],function(e,r){return e||RegExp("\\b"+(r.pattern||v(r))+"\\b","i").exec(t)&&(r.label||r)}),U=function(e){return g(e,function(e,r){return e||RegExp("\\b"+(r.pattern||v(r))+"\\b","i").exec(t)&&(r.label||r)})}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),q=W([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),z=function(e){return g(e,function(e,r,n){return e||(r[q]||r[/^[a-z]+(?: +[a-z]+\b)*/i.exec(q)]||RegExp("\\b"+v(n)+"(?:\\b|\\w*\\d)","i").exec(t))&&n})}({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),V=function(e){return g(e,function(e,r){var n=r.pattern||v(r);return!e&&(e=RegExp("\\b"+n+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(e=function(e,t,r){var n={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return t&&r&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(n=n[/[\d.]+$/.exec(e)])&&(e="Windows "+n),e=String(e),t&&r&&(e=e.replace(RegExp(t,"i"),r)),h(e.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(e,n,r.label||r)),e})}(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function W(e){return g(e,function(e,r){var n=r.pattern||v(r);return!e&&(e=RegExp("\\b"+n+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+n+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+n+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((e=String(r.label&&!RegExp(n,"i").test(r.label)?r.label:e).split("/"))[1]&&!/[\d.]+/.test(e[0])&&(e[0]+=" "+e[1]),r=r.label||r,e=h(e[0].replace(RegExp(n,"i"),r).replace(RegExp("; *(?:"+r+"[_-])?","i")," ").replace(RegExp("("+r+")[-_.]?(\\w)","i"),"$1 $2"))),e})}function G(e){return g(e,function(e,r){return e||(RegExp(r+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null})}if(F&&(F=[F]),/\bAndroid\b/.test(V)&&!q&&(c=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&(q=y(c[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),z&&!q?q=W([z]):z&&q&&(q=q.replace(RegExp("^("+v(z)+")[-_.\\s]","i"),z+" ").replace(RegExp("^("+v(z)+")[-_.]?(\\w)","i"),z+" $2")),(c=/\bGoogle TV\b/.exec(q))&&(q=c[0]),/\bSimulator\b/i.test(t)&&(q=(q?q+" ":"")+"Simulator"),"Opera Mini"==U&&/\bOPiOS\b/.test(t)&&D.push("running in Turbo/Uncompressed mode"),"IE"==U&&/\blike iPhone OS\b/.test(t)?(z=(c=e(t.replace(/like iPhone OS/,""))).manufacturer,q=c.product):/^iP/.test(q)?(U||(U="Safari"),V="iOS"+((c=/ OS ([\d_]+)/i.exec(t))?" "+c[1].replace(/_/g,"."):"")):"Konqueror"==U&&/^Linux\b/i.test(V)?V="Kubuntu":z&&"Google"!=z&&(/Chrome/.test(U)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test(q))||/\bAndroid\b/.test(V)&&/^Chrome/.test(U)&&/\bVersion\//i.test(t)?(U="Android Browser",V=/\bAndroid\b/.test(V)?V:"Android"):"Silk"==U?(/\bMobi/i.test(t)||(V="Android",D.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&D.unshift("accelerated")):"UC Browser"==U&&/\bUCWEB\b/.test(t)?D.push("speed mode"):"PaleMoon"==U&&(c=/\bFirefox\/([\d.]+)\b/.exec(t))?D.push("identifying as Firefox "+c[1]):"Firefox"==U&&(c=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(V||(V="Firefox OS"),q||(q=c[1])):!U||(c=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(U))?(U&&!q&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(c+"/")+8))&&(U=null),(c=q||z||V)&&(q||z||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(V))&&(U=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(V)?V:c)+" Browser")):"Electron"==U&&(c=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&D.push("Chromium "+c),N||(N=G(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",v(U),"(?:Firefox|Minefield|NetFront)"])),(c=("iCab"==F&&parseFloat(N)>3?"WebKit":/\bOpera\b/.test(U)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(F)&&"WebKit"||!F&&/\bMSIE\b/i.test(t)&&("Mac OS"==V?"Tasman":"Trident")||"WebKit"==F&&/\bPlayStation\b(?! Vita\b)/i.test(U)&&"NetFront")&&(F=[c]),"IE"==U&&(c=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(U+=" Mobile",V="Windows Phone "+(/\+$/.test(c)?c:c+".x"),D.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(U="IE Mobile",V="Windows Phone 8.x",D.unshift("desktop mode"),N||(N=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=U&&"Trident"==F&&(c=/\brv:([\d.]+)/.exec(t))&&(U&&D.push("identifying as "+U+(N?" "+N:"")),U="IE",N=c[1]),B){if(p="global",_=null!=(l=r)?(0,n.default)(l[p]):"number",/^(?:boolean|number|string|undefined)$/.test(_)||"object"==_&&!l[p])b(c=r.runtime)==S?(U="Adobe AIR",V=c.flash.system.Capabilities.os):b(c=r.phantom)==P?(U="PhantomJS",N=(c=c.version||null)&&c.major+"."+c.minor+"."+c.patch):"number"==typeof A.documentMode&&(c=/\bTrident\/(\d+)/i.exec(t))?(N=[N,A.documentMode],(c=+c[1]+4)!=N[1]&&(D.push("IE "+N[1]+" mode"),F&&(F[1]=""),N[1]=c),N="IE"==U?String(N[1].toFixed(1)):N[0]):"number"==typeof A.documentMode&&/^(?:Chrome|Firefox)\b/.test(U)&&(D.push("masking as "+U+" "+N),U="IE",N="11.0",F=["Trident"],V="Windows");else if(R&&(j=(c=R.lang.System).getProperty("os.arch"),V=V||c.getProperty("os.name")+" "+c.getProperty("os.version")),M){try{N=r.require("ringo/engine").version.join("."),U="RingoJS"}catch(e){(c=r.system)&&c.global.system==r.system&&(U="Narwhal",V||(V=c[0].os||null))}U||(U="Rhino")}else"object"==(0,n.default)(r.process)&&!r.process.browser&&(c=r.process)&&("object"==(0,n.default)(c.versions)&&("string"==typeof c.versions.electron?(D.push("Node "+c.versions.node),U="Electron",N=c.versions.electron):"string"==typeof c.versions.nw&&(D.push("Chromium "+N,"Node "+c.versions.node),U="NW.js",N=c.versions.nw)),U||(U="Node.js",j=c.arch,V=c.platform,N=(N=/[\d.]+/.exec(c.version))?N[0]:null));V=V&&h(V)}if(N&&(c=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(N)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(B&&o.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(L=/b/i.test(c)?"beta":"alpha",N=N.replace(RegExp(c+"\\+?$"),"")+("beta"==L?T:C)+(/\d+\+?/.exec(c)||"")),"Fennec"==U||"Firefox"==U&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(V))U="Firefox Mobile";else if("Maxthon"==U&&N)N=N.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(q))"Xbox 360"==q&&(V=null),"Xbox 360"==q&&/\bIEMobile\b/.test(t)&&D.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(U)&&(!U||q||/Browser|Mobi/.test(U))||"Windows CE"!=V&&!/Mobi/i.test(t))if("IE"==U&&B)try{null===r.external&&D.unshift("platform preview")}catch(e){D.unshift("embedded")}else(/\bBlackBerry\b/.test(q)||/\bBB10\b/.test(t))&&(c=(RegExp(q.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||N)?(V=((c=[c,/BB10/.test(t)])[1]?(q=null,z="BlackBerry"):"Device Software")+" "+c[0],N=null):this!=m&&"Wii"!=q&&(B&&I||/Opera/.test(U)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==U&&/\bOS X (?:\d+\.){2,}/.test(V)||"IE"==U&&(V&&!/^Win/.test(V)&&N>5.5||/\bWindows XP\b/.test(V)&&N>8||8==N&&!/\bTrident\b/.test(t)))&&!u.test(c=e.call(m,t.replace(u,"")+";"))&&c.name&&(c="ing as "+c.name+((c=c.version)?" "+c:""),u.test(U)?(/\bIE\b/.test(c)&&"Mac OS"==V&&(V=null),c="identify"+c):(c="mask"+c,U=O?h(O.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(c)&&(V=null),B||(N=null)),F=["Presto"],D.push(c));else U+=" Mobile";(c=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(c=[parseFloat(c.replace(/\.(\d)$/,".0$1")),c],"Safari"==U&&"+"==c[1].slice(-1)?(U="WebKit Nightly",L="alpha",N=c[1].slice(0,-1)):N!=c[1]&&N!=(c[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(N=null),c[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==c[0]&&537.36==c[2]&&parseFloat(c[1])>=28&&"WebKit"==F&&(F=["Blink"]),B&&(w||c[1])?(F&&(F[1]="like Chrome"),c=c[1]||((c=c[0])<530?1:c<532?2:c<532.05?3:c<533?4:c<534.03?5:c<534.07?6:c<534.1?7:c<534.13?8:c<534.16?9:c<534.24?10:c<534.3?11:c<535.01?12:c<535.02?"13+":c<535.07?15:c<535.11?16:c<535.19?17:c<536.05?18:c<536.1?19:c<537.01?20:c<537.11?"21+":c<537.13?23:c<537.18?24:c<537.24?25:c<537.36?26:"Blink"!=F?"27":"28")):(F&&(F[1]="like Safari"),c=(c=c[0])<400?1:c<500?2:c<526?3:c<533?4:c<534?"4+":c<535?5:c<537?6:c<538?7:c<601?8:c<602?9:c<604?10:c<606?11:c<608?12:"12"),F&&(F[1]+=" "+(c+="number"==typeof c?".x":/[.+]/.test(c)?"":"+")),"Safari"==U&&(!N||parseInt(N)>45)?N=c:"Chrome"==U&&/\bHeadlessChrome/i.test(t)&&D.unshift("headless")),"Opera"==U&&(c=/\bzbov|zvav$/.exec(V))?(U+=" ",D.unshift("desktop mode"),"zvav"==c?(U+="Mini",N=null):U+="Mobile",V=V.replace(RegExp(" *"+c+"$"),"")):"Safari"==U&&/\bChrome\b/.exec(F&&F[1])?(D.unshift("desktop mode"),U="Chrome Mobile",N=null,/\bOS X\b/.test(V)?(z="Apple",V="iOS 4.3+"):V=null):/\bSRWare Iron\b/.test(U)&&!N&&(N=G("Chrome")),N&&0==N.indexOf(c=/[\d.]+$/.exec(V))&&t.indexOf("/"+c+"-")>-1&&(V=y(V.replace(c,""))),V&&-1!=V.indexOf(U)&&!RegExp(U+" OS").test(V)&&(V=V.replace(RegExp(" *"+v(U)+" *"),"")),F&&!/\b(?:Avant|Nook)\b/.test(U)&&(/Browser|Lunascape|Maxthon/.test(U)||"Safari"!=U&&/^iOS/.test(V)&&/\bSafari\b/.test(F[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(U)&&F[1])&&(c=F[F.length-1])&&D.push(c),D.length&&(D=["("+D.join("; ")+")"]),z&&q&&q.indexOf(z)<0&&D.push("on "+z),q&&D.push((/^on /.test(D[D.length-1])?"":"on ")+q),V&&(c=/ ([\d.+]+)$/.exec(V),d=c&&"/"==V.charAt(V.length-c[0].length-1),V={architecture:32,family:c&&!d?V.replace(c[0],""):V,version:c?c[1]:null,toString:function(){var e=this.version;return this.family+(e&&!d?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(c=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(j))&&!/\bi686\b/i.test(j)?(V&&(V.architecture=64,V.family=V.family.replace(RegExp(" *"+c),"")),U&&(/\bWOW64\b/i.test(t)||B&&/\w(?:86|32)$/.test(o.cpuClass||o.platform)&&!/\bWin64; x64\b/i.test(t))&&D.unshift("32-bit")):V&&/^OS X/.test(V.family)&&"Chrome"==U&&parseFloat(N)>=39&&(V.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=F&&F[0],H.manufacturer=z,H.name=U,H.prerelease=L,H.product=q,H.ua=t,H.version=U&&N,H.os=V||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&D.unshift(N),H.name&&D.unshift(U),V&&U&&(V!=String(V).split(" ")[0]||V!=U.split(" ")[0]&&!q)&&D.push(q?"("+V+")":"on "+V),D.length&&(H.description=D.join(" ")),H}();"function"==typeof define&&"object"==(0,n.default)(define.amd)&&define.amd?(i.platform=_,define(function(){return _})):a&&o?m(_,function(e,t){a[t]=e}):i.platform=_}).call(void 0)},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":60}],466:[function(e,t,r){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(r,"__esModule",{value:!0}),r.updatedDeviceList=r.chooseMediaLabel=void 0;var i=n(e("@babel/runtime/helpers/asyncToGenerator")),a=n(e("@babel/runtime/regenerator"));r.chooseMediaLabel=function(){var e=(0,i.default)(a.default.mark(function e(){var t,r;return a.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 n=void 0!==e.find(function(e){return"videoinput"===e.kind}),i=void 0!==e.find(function(e){return"audioinput"===e.kind});return new Promise(function(e,a){navigator.mediaDevices.getUserMedia({audio:i,video:n}).then(function(n){navigator.mediaDevices.enumerateDevices().then(function(i){i.forEach(function(e){"audioinput"===e.kind&&r.push(e.label),"videoinput"===e.kind&&t.push(e.label)}),n.getTracks().forEach(function(e){e.stop()}),r.length>0&&t.length>0?e({videoLabels:t,audioLabels:r}):e({audioLabels:r,videoLabels: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 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),r.updatedDeviceList=function(){var e=(0,i.default)(a.default.mark(function e(){var t,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],r=[],e.abrupt("return",new Promise(function(e,n){navigator.mediaDevices.enumerateDevices().then(function(n){n.forEach(function(e){"audioinput"===e.kind&&r.push(e.label),"videoinput"===e.kind&&t.push(e.label)}),console.log(r,t),e({audioLabels:r,videoLabels:t})})}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/regenerator":63}],467:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getDeviceId=void 0;r.getDeviceId=function(e){return new Promise(function(t){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){ConsoleHelper(e.name+": "+e.message),t({error:e.name,reason:e.message})})})}},{}],468:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],469:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.videoConstraints=r.avConstraints=r.audioConstraints=void 0;r.audioConstraints={audio:{deviceId:{exact:void 0}},video:!1},r.videoConstraints={video:{deviceId:{exact:void 0},width:{min:320,ideal:640,max:1280},height:{min:240,ideal:480,max:720},frameRate:{min:15,max:30}}},r.avConstraints={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}}}},{}],470:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{"@babel/runtime/helpers/asyncToGenerator":28,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/regenerator":63,dup:19}],471:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{dup:20}]},{},[1])(1)});
9
+ * Platform.js
10
+ * Copyright 2014-2020 Benjamin Tan
11
+ * Copyright 2011-2013 John-David Dalton
12
+ * Available under MIT license
13
+ */(function(){var t={function:!0,object:!0},r=t[typeof window]&&window||this,s=t[typeof e]&&e,i=t[typeof module]&&module&&!module.nodeType&&module,a=s&&i&&"object"==typeof globalThis&&globalThis;!a||a.global!==a&&a.window!==a&&a.self!==a||(r=a);var n=Math.pow(2,53)-1,o=/\bOpera/,c=Object.prototype,d=c.hasOwnProperty,l=c.toString;function p(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function u(e){return e=b(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:p(e)}function h(e,t){for(var r in e)d.call(e,r)&&t(e[r],r,e)}function m(e){return null==e?p(e):l.call(e).slice(8,-1)}function f(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function g(e,t){var r=null;return function(e,t){var r=-1,s=e?e.length:0;if("number"==typeof s&&s>-1&&s<=n)for(;++r<s;)t(e[r],r,e);else h(e,t)}(e,function(s,i){r=t(r,s,i,e)}),r}function b(e){return String(e).replace(/^ +| +$/g,"")}var y=function e(t){var s=r,i=t&&"object"==typeof t&&"String"!=m(t);i&&(s=t,t=null);var a=s.navigator||{},n=a.userAgent||"";t||(t=n);var c,d,p,y,_,v=i?!!a.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(l.toString()),w="Object",S=i?w:"ScriptBridgingProxyObject",C=i?w:"Environment",P=i&&s.java?"JavaPackage":m(s.java),k=i?w:"RuntimeObject",R=/\bJava/.test(P)&&s.java,T=R&&m(s.environment)==C,E=R?"a":"α",I=R?"b":"β",x=s.document||{},D=s.operamini||s.opera,M=o.test(M=i&&D?D["[[Class]]"]:m(D))?M:D=null,L=t,O=[],A=null,N=t==n,j=N&&D&&"function"==typeof D.version&&D.version(),F=g([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"],function(e,r){return e||RegExp("\\b"+(r.pattern||f(r))+"\\b","i").exec(t)&&(r.label||r)}),B=function(e){return g(e,function(e,r){return e||RegExp("\\b"+(r.pattern||f(r))+"\\b","i").exec(t)&&(r.label||r)})}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),U=q([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),$=function(e){return g(e,function(e,r,s){return e||(r[U]||r[/^[a-z]+(?: +[a-z]+\b)*/i.exec(U)]||RegExp("\\b"+f(s)+"(?:\\b|\\w*\\d)","i").exec(t))&&s})}({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),V=function(e){return g(e,function(e,r){var s=r.pattern||f(r);return!e&&(e=RegExp("\\b"+s+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(e=function(e,t,r){var s={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return t&&r&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(s=s[/[\d.]+$/.exec(e)])&&(e="Windows "+s),e=String(e),t&&r&&(e=e.replace(RegExp(t,"i"),r)),u(e.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(e,s,r.label||r)),e})}(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function q(e){return g(e,function(e,r){var s=r.pattern||f(r);return!e&&(e=RegExp("\\b"+s+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+s+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+s+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((e=String(r.label&&!RegExp(s,"i").test(r.label)?r.label:e).split("/"))[1]&&!/[\d.]+/.test(e[0])&&(e[0]+=" "+e[1]),r=r.label||r,e=u(e[0].replace(RegExp(s,"i"),r).replace(RegExp("; *(?:"+r+"[_-])?","i")," ").replace(RegExp("("+r+")[-_.]?(\\w)","i"),"$1 $2"))),e})}function W(e){return g(e,function(e,r){return e||(RegExp(r+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null})}if(F&&(F=[F]),/\bAndroid\b/.test(V)&&!U&&(c=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&(U=b(c[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),$&&!U?U=q([$]):$&&U&&(U=U.replace(RegExp("^("+f($)+")[-_.\\s]","i"),$+" ").replace(RegExp("^("+f($)+")[-_.]?(\\w)","i"),$+" $2")),(c=/\bGoogle TV\b/.exec(U))&&(U=c[0]),/\bSimulator\b/i.test(t)&&(U=(U?U+" ":"")+"Simulator"),"Opera Mini"==B&&/\bOPiOS\b/.test(t)&&O.push("running in Turbo/Uncompressed mode"),"IE"==B&&/\blike iPhone OS\b/.test(t)?($=(c=e(t.replace(/like iPhone OS/,""))).manufacturer,U=c.product):/^iP/.test(U)?(B||(B="Safari"),V="iOS"+((c=/ OS ([\d_]+)/i.exec(t))?" "+c[1].replace(/_/g,"."):"")):"Konqueror"==B&&/^Linux\b/i.test(V)?V="Kubuntu":$&&"Google"!=$&&(/Chrome/.test(B)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test(U))||/\bAndroid\b/.test(V)&&/^Chrome/.test(B)&&/\bVersion\//i.test(t)?(B="Android Browser",V=/\bAndroid\b/.test(V)?V:"Android"):"Silk"==B?(/\bMobi/i.test(t)||(V="Android",O.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&O.unshift("accelerated")):"UC Browser"==B&&/\bUCWEB\b/.test(t)?O.push("speed mode"):"PaleMoon"==B&&(c=/\bFirefox\/([\d.]+)\b/.exec(t))?O.push("identifying as Firefox "+c[1]):"Firefox"==B&&(c=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(V||(V="Firefox OS"),U||(U=c[1])):!B||(c=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(B))?(B&&!U&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(c+"/")+8))&&(B=null),(c=U||$||V)&&(U||$||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(V))&&(B=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(V)?V:c)+" Browser")):"Electron"==B&&(c=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&O.push("Chromium "+c),j||(j=W(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",f(B),"(?:Firefox|Minefield|NetFront)"])),(c=("iCab"==F&&parseFloat(j)>3?"WebKit":/\bOpera\b/.test(B)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(F)&&"WebKit"||!F&&/\bMSIE\b/i.test(t)&&("Mac OS"==V?"Tasman":"Trident")||"WebKit"==F&&/\bPlayStation\b(?! Vita\b)/i.test(B)&&"NetFront")&&(F=[c]),"IE"==B&&(c=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(B+=" Mobile",V="Windows Phone "+(/\+$/.test(c)?c:c+".x"),O.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(B="IE Mobile",V="Windows Phone 8.x",O.unshift("desktop mode"),j||(j=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=B&&"Trident"==F&&(c=/\brv:([\d.]+)/.exec(t))&&(B&&O.push("identifying as "+B+(j?" "+j:"")),B="IE",j=c[1]),N){if(y="global",_=null!=(p=s)?typeof p[y]:"number",/^(?:boolean|number|string|undefined)$/.test(_)||"object"==_&&!p[y])m(c=s.runtime)==S?(B="Adobe AIR",V=c.flash.system.Capabilities.os):m(c=s.phantom)==k?(B="PhantomJS",j=(c=c.version||null)&&c.major+"."+c.minor+"."+c.patch):"number"==typeof x.documentMode&&(c=/\bTrident\/(\d+)/i.exec(t))?(j=[j,x.documentMode],(c=+c[1]+4)!=j[1]&&(O.push("IE "+j[1]+" mode"),F&&(F[1]=""),j[1]=c),j="IE"==B?String(j[1].toFixed(1)):j[0]):"number"==typeof x.documentMode&&/^(?:Chrome|Firefox)\b/.test(B)&&(O.push("masking as "+B+" "+j),B="IE",j="11.0",F=["Trident"],V="Windows");else if(R&&(L=(c=R.lang.System).getProperty("os.arch"),V=V||c.getProperty("os.name")+" "+c.getProperty("os.version")),T){try{j=s.require("ringo/engine").version.join("."),B="RingoJS"}catch(H){(c=s.system)&&c.global.system==s.system&&(B="Narwhal",V||(V=c[0].os||null))}B||(B="Rhino")}else"object"==typeof s.process&&!s.process.browser&&(c=s.process)&&("object"==typeof c.versions&&("string"==typeof c.versions.electron?(O.push("Node "+c.versions.node),B="Electron",j=c.versions.electron):"string"==typeof c.versions.nw&&(O.push("Chromium "+j,"Node "+c.versions.node),B="NW.js",j=c.versions.nw)),B||(B="Node.js",L=c.arch,V=c.platform,j=(j=/[\d.]+/.exec(c.version))?j[0]:null));V=V&&u(V)}if(j&&(c=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(j)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(N&&a.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(A=/b/i.test(c)?"beta":"alpha",j=j.replace(RegExp(c+"\\+?$"),"")+("beta"==A?I:E)+(/\d+\+?/.exec(c)||"")),"Fennec"==B||"Firefox"==B&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(V))B="Firefox Mobile";else if("Maxthon"==B&&j)j=j.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(U))"Xbox 360"==U&&(V=null),"Xbox 360"==U&&/\bIEMobile\b/.test(t)&&O.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(B)&&(!B||U||/Browser|Mobi/.test(B))||"Windows CE"!=V&&!/Mobi/i.test(t))if("IE"==B&&N)try{null===s.external&&O.unshift("platform preview")}catch(H){O.unshift("embedded")}else(/\bBlackBerry\b/.test(U)||/\bBB10\b/.test(t))&&(c=(RegExp(U.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||j)?(V=((c=[c,/BB10/.test(t)])[1]?(U=null,$="BlackBerry"):"Device Software")+" "+c[0],j=null):this!=h&&"Wii"!=U&&(N&&D||/Opera/.test(B)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==B&&/\bOS X (?:\d+\.){2,}/.test(V)||"IE"==B&&(V&&!/^Win/.test(V)&&j>5.5||/\bWindows XP\b/.test(V)&&j>8||8==j&&!/\bTrident\b/.test(t)))&&!o.test(c=e.call(h,t.replace(o,"")+";"))&&c.name&&(c="ing as "+c.name+((c=c.version)?" "+c:""),o.test(B)?(/\bIE\b/.test(c)&&"Mac OS"==V&&(V=null),c="identify"+c):(c="mask"+c,B=M?u(M.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(c)&&(V=null),N||(j=null)),F=["Presto"],O.push(c));else B+=" Mobile";(c=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(c=[parseFloat(c.replace(/\.(\d)$/,".0$1")),c],"Safari"==B&&"+"==c[1].slice(-1)?(B="WebKit Nightly",A="alpha",j=c[1].slice(0,-1)):j!=c[1]&&j!=(c[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(j=null),c[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==c[0]&&537.36==c[2]&&parseFloat(c[1])>=28&&"WebKit"==F&&(F=["Blink"]),N&&(v||c[1])?(F&&(F[1]="like Chrome"),c=c[1]||((c=c[0])<530?1:c<532?2:c<532.05?3:c<533?4:c<534.03?5:c<534.07?6:c<534.1?7:c<534.13?8:c<534.16?9:c<534.24?10:c<534.3?11:c<535.01?12:c<535.02?"13+":c<535.07?15:c<535.11?16:c<535.19?17:c<536.05?18:c<536.1?19:c<537.01?20:c<537.11?"21+":c<537.13?23:c<537.18?24:c<537.24?25:c<537.36?26:"Blink"!=F?"27":"28")):(F&&(F[1]="like Safari"),c=(c=c[0])<400?1:c<500?2:c<526?3:c<533?4:c<534?"4+":c<535?5:c<537?6:c<538?7:c<601?8:c<602?9:c<604?10:c<606?11:c<608?12:"12"),F&&(F[1]+=" "+(c+="number"==typeof c?".x":/[.+]/.test(c)?"":"+")),"Safari"==B&&(!j||parseInt(j)>45)?j=c:"Chrome"==B&&/\bHeadlessChrome/i.test(t)&&O.unshift("headless")),"Opera"==B&&(c=/\bzbov|zvav$/.exec(V))?(B+=" ",O.unshift("desktop mode"),"zvav"==c?(B+="Mini",j=null):B+="Mobile",V=V.replace(RegExp(" *"+c+"$"),"")):"Safari"==B&&/\bChrome\b/.exec(F&&F[1])?(O.unshift("desktop mode"),B="Chrome Mobile",j=null,/\bOS X\b/.test(V)?($="Apple",V="iOS 4.3+"):V=null):/\bSRWare Iron\b/.test(B)&&!j&&(j=W("Chrome")),j&&0==j.indexOf(c=/[\d.]+$/.exec(V))&&t.indexOf("/"+c+"-")>-1&&(V=b(V.replace(c,""))),V&&-1!=V.indexOf(B)&&!RegExp(B+" OS").test(V)&&(V=V.replace(RegExp(" *"+f(B)+" *"),"")),F&&!/\b(?:Avant|Nook)\b/.test(B)&&(/Browser|Lunascape|Maxthon/.test(B)||"Safari"!=B&&/^iOS/.test(V)&&/\bSafari\b/.test(F[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(B)&&F[1])&&(c=F[F.length-1])&&O.push(c),O.length&&(O=["("+O.join("; ")+")"]),$&&U&&U.indexOf($)<0&&O.push("on "+$),U&&O.push((/^on /.test(O[O.length-1])?"":"on ")+U),V&&(c=/ ([\d.+]+)$/.exec(V),d=c&&"/"==V.charAt(V.length-c[0].length-1),V={architecture:32,family:c&&!d?V.replace(c[0],""):V,version:c?c[1]:null,toString:function(){var e=this.version;return this.family+(e&&!d?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(c=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(L))&&!/\bi686\b/i.test(L)?(V&&(V.architecture=64,V.family=V.family.replace(RegExp(" *"+c),"")),B&&(/\bWOW64\b/i.test(t)||N&&/\w(?:86|32)$/.test(a.cpuClass||a.platform)&&!/\bWin64; x64\b/i.test(t))&&O.unshift("32-bit")):V&&/^OS X/.test(V.family)&&"Chrome"==B&&parseFloat(j)>=39&&(V.architecture=64),t||(t=null);var z={};return z.description=t,z.layout=F&&F[0],z.manufacturer=$,z.name=B,z.prerelease=A,z.product=U,z.ua=t,z.version=B&&j,z.os=V||{architecture:null,family:null,version:null,toString:function(){return"null"}},z.parse=e,z.toString=function(){return this.description||""},z.version&&O.unshift(j),z.name&&O.unshift(B),V&&B&&(V!=String(V).split(" ")[0]||V!=B.split(" ")[0]&&!U)&&O.push(U?"("+V+")":"on "+V),O.length&&(z.description=O.join(" ")),z}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(r.platform=y,define(function(){return y})):s&&i?h(y,function(e,t){s[t]=e}):r.platform=y}).call(void 0);const nc=new ec("Room");class oc extends xr.EventEmitter{static async createRoom({roomId:e,peerId:t,peerName:r,role:s="caller"}){if(t||(t="111-111-1111".replace(/[018]/g,()=>(15&crypto.getRandomValues(new Uint8Array(1))[0]).toString(16))),!e)return{success:!1,reason:"roomId is required!"};const i=process.env.NODE_ENV="https//cp2p.centedge.io";return new Room({peerId:t,roomId:e,peerName:r,role:s,url:i})}constructor({peerId:e,roomId:t,peerName:r,role:s,url:i}){super(),this._closed=!1,this._roomId=t,this._socket=null,this._peerConnection=null,this._myDisplayName=r,this._myPeerId=e,this._myRole=s,this._localStream=null,this._remoteDisplayName=null,this._remotePeerId=null,this._remoteRole=null,this._remoteStream=null,this._canvas=null,this._imageData=null,this._imageWidth=1280,this._imageHeight=720,this._availableMediaInputs=null,this._userAgent={name:platform.name,version:platform.version,os:platform.os.family,description:platform.description},this._remoteMediaInputs=null,this._remoteUserAgent=null,this._statsCaptureInterval=null,this._localStats=null,this._remoteStats=null,this._otherPeerConnected=null,this._data={},this._url=i,this.prepareForCall(),nc.debug("user agent is:%o",this._userAgent)}get imageData(){return this._imageData}get roomId(){return this._roomId}get localStream(){return this._localStream}get remoteStream(){return this._remoteStream}get myName(){return this._myDisplayName}set myName(e){this._myDisplayName=e}get myId(){return this._myPeerId}get myRole(){return this._myRole}get remoteName(){return this._remoteDisplayName}get remoteId(){return this._remotePeerId}get remoteRole(){return this._remoteRole}get imageHeight(){return this._imageHeight}get imageWidth(){return this._imageWidth}get userAgent(){return this._userAgent}get mediaInputs(){return this._availableMediaInputs}get remoteUserAgent(){return this._remoteUserAgent}get remoteMediaInputs(){return this._remoteMediaInputs}get localStats(){return this._localStats}get remoteStats(){return this._remoteStats}get pc(){return this._peerConnection}get data(){return this._data}set data(e){throw new Error("Can't set the whole of data object.")}setImageProps({width:e,height:t}){e&&t?(this._imageHeight=t,this._imageWidth=e):this.clientErrorHandler({reason:"Both width and height are required to set the new image properties. ",error:null})}async prepareForCall(){let e=this;(async()=>{let e=[],t=[];return navigator.mediaDevices.enumerateDevices().then(function(r){let s=void 0!==r.find(e=>"videoinput"===e.kind),i=void 0!==r.find(e=>"audioinput"===e.kind);return new Promise((r,a)=>{navigator.mediaDevices.getUserMedia({audio:i,video:s}).then(s=>{navigator.mediaDevices.enumerateDevices().then(function(i){i.forEach(function(r){"audioinput"===r.kind&&t.push(r.label),"videoinput"===r.kind&&e.push(r.label)}),s.getTracks().forEach(e=>{e.stop()}),t.length>0&&e.length>0?r({videoLabels:e,audioLabels:t}):r({audioLabels:t,videoLabels:e})})}).catch(function(e){r({error:e.name,reason:e.message})})})}).catch(function(e){})})().then(async t=>{if(t.error)switch(t.error){case"NotAllowedError":let e=`${t.error} : ${t.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.`;this.clientErrorHandler({reason:e,error:null});break;case"NotFoundError":let r=`${t.error} : ${t.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.`;this.clientErrorHandler({reason:r,error:null});break;case"NotReadableError":let s=`${t.error} : ${t.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.`;this.clientErrorHandler({reason:s,error:null})}else t.audioLabels&&t.audioLabels.length>0&&t.videoLabels&&t.videoLabels.length>0&&(e._availableMediaInputs={audioInputs:t.audioLabels,videoInputs:t.videoLabels},nc.debug("available A/V inputs:%o",e.mediaInputs),await e.getUserMedia(),e.emit("mediaInputs"))}),navigator.mediaDevices.ondevicechange=async t=>{nc.info("Media devices changed!");let r=await(async()=>{let e=[],t=[];return new Promise((r,s)=>{navigator.mediaDevices.enumerateDevices().then(function(s){s.forEach(r=>{"audioinput"===r.kind&&t.push(r.label),"videoinput"===r.kind&&e.push(r.label)}),r({audioLabels:t,videoLabels:e})})})})();r.audioLabels&&r.audioLabels.length>0&&r.videoLabels&&r.videoLabels.length>0&&(e._availableMediaInputs={audioInputs:r.audioLabels,videoInputs:r.videoLabels},nc.debug("updated A/V inputs:%o",e.mediaInputs),e.emit("mediaInputs"),"client"===e.myRole&&e.pc&&(nc.info("Going to update the agent about the updated media devices list."),e.send({type:"mediaListUpdated",mediaInputs:e.mediaInputs})))}}send(e){this._closed||this._socket.send(e)}inform(e){if(this._closed)return;let t={type:"information",msg:e};this._socket.send(t)}async request({type:e,message:t}){const r=await this._socket.request({type:e,message:t});if(r)return r}gotMessageFromServer(e){switch(nc.debug("Got message:%o",e),e.type){case"login":this.handleLogin(e.details);break;case"offer":nc.debug("inside offer"),this.handleOffer({offer:e.offer,peer:e.peer,name:e.name});break;case"answer":nc.debug("inside answer"),this.handleAnswer(e);break;case"candidate":nc.debug("inside handle candidate"),this.handleCandidate(e.candidate);break;case"leave":this.handleLeave(),this.emit("peerHangUp");break;case"audioToggle":this.emit("audioToggle",{status:e.status,peer:"other"});break;case"videoToggle":this.emit("videoToggle",{status:e.status,peer:"other"});break;case"remoteStreamToggle":this.handleRemoteStreamToggle(e);break;case"chatMessage":this.emit("chatMessage",e.message);break;case"imageCapture":this.captureImage("local");break;case"mediaChange":this.changeRemoteMediaSource(e);break;case"requestStats":this.sendRequestedstats();break;case"statsFetched":this._remoteStats=e.stats,this.emit("remoteStats");break;case"information":this.emit("information",e.msg);break;case"iceRestart":this.handleIceRestart(e);break;case"iceRestarted":this.handleIceRestartResponse(e);break;case"nameUpdate":this._remoteDisplayName=e.name,this.emit("peerName");break;case"mediaListUpdated":this._remoteMediaInputs=e.mediaInputs,this.emit("remoteMediaInputs");break;case"peerLeft":this.pc||(this._remoteDisplayName=null,this._remotePeerId=null,this._remoteRole=null,this._otherPeerConnected=!1,this.emit("peerJoin","None"),alert("Other person disconnected from the room"));break;case"error":this.emit("serverError",e.details)}}async getUserMedia(){nc.debug("Inside getusermedia"),this._localStream?nc.debug("Local stream already acquired! Waiting for call!"):navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(sc).then(e=>this.getUserMediaSuccess(e)).catch(e=>this.clientErrorHandler({reason:"Error while acquiring camera/mic",error:e})):alert("Your browser does not support getUserMedia API")}getUserMediaSuccess(e){let t=this;nc.debug("Inside getUserMediaSuccess"),this._localStream=e,this.emit("localStream"),this._socket=new ac({url:this._url,roomId:this._roomId,peerId:this._myPeerId,peerName:this._myDisplayName,role:this._myRole}),this._socket.on("message",e=>this.gotMessageFromServer(e)),this._socket.on("connected",async()=>{t.pc&&(nc.debug("Socket reconnection happened after a disconnection, ICEState:%s",t._peerConnection.iceConnectionState),"failed"!==t._peerConnection.iceConnectionState&&"disconnected"!==t._peerConnection.iceConnectionState||(nc.debug("Going to restart ICE as ICE is not in connected state!!"),await t.restartICE()))})}handleAudioToggle(){let e=this._localStream.getAudioTracks()[0];e.enabled=!e.enabled,this.send({type:"audioToggle",status:e.enabled}),this.emit("audioToggle",{status:e.enabled,peer:"self"})}handleVideoToggle(){let e=this._localStream.getVideoTracks()[0];e.enabled=!e.enabled,this.send({type:"videoToggle",status:e.enabled}),this.emit("videoToggle",{status:e.enabled,peer:"self"})}handleVideoToggleNew(){let e=this;if(this._peerConnection){const t=this._peerConnection.getSenders().find(function(e){return e.track&&"video"==e.track.kind});if(t){nc.debug("found sender:%o",t),this._peerConnection.removeTrack(t);let e=this._localStream.getVideoTracks()[0];e&&(e.stop(),this._localStream.removeTrack(e)),this.send({type:"videoToggle",status:!1}),this.emit("videoToggle",{status:!1,peer:"self"})}else nc.debug("sender not found. Going to create a new video track."),navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia({...sc,audio:!1}).then(t=>{let r=t.getVideoTracks()[0];e._localStream.addTrack(r),e._peerConnection.addTrack(r),e.send({type:"videoToggle",status:!0}),e.emit("localStream"),e.emit("videoToggle",{status:!0,peer:"self"})}).catch(e=>this.clientErrorHandler({reason:"Error while acquiring camera/mic",error:e})):alert("Your browser does not support getUserMedia API")}else nc.warn("Peer connection not found!")}handleRemoteAudioToggle(){this.send({type:"remoteStreamToggle",streamType:"audio"})}handleRemoteVideoToggle(){this.send({type:"remoteStreamToggle",streamType:"video"})}handleRemoteStreamToggle(e){nc.debug("inside remote stream toggle"),"audio"===e.streamType?this.handleAudioToggle():"video"===e.streamType?this.handleVideoToggle():nc.warn("Invalid stream type!")}sendChatMessage(e){e&&" "!==e?this.send({type:"chatMessage",message:e}):this.clientErrorHandler({reason:"Chat message need to have a valid value!",error:null})}async informPeer(){this.remoteId&&this.send({type:"nameUpdate",name:this.myName})}handleLogin(e){e&&(nc.debug("All available users:%o",e),this._remoteDisplayName=e.displayName,this._remotePeerId=e.peerId,this._remoteRole=e.role),this._otherPeerConnected=!0,this.emit("peerJoin",this._remoteDisplayName)}async gotRemoteTrack(e){nc.debug("inside got remote track:%o",e),e.streams&&e.streams[0]?(nc.debug("Got a remote stream"),this._remoteStream=e.streams[0]):(this._remoteStream=new MediaStream,this._remoteStream.addTrack(e.track),nc.debug("Got a remote track")),this.emit("remoteStream")}_onICeCandidate(e){nc.debug("onicecandidate",e.candidate),e.candidate&&this.send({type:"candidate",candidate:e.candidate,peer:this._remotePeerId})}handleNegotiationNeededEvent=()=>{nc.debug("handleNegotiationNeededEvent() | needed to negotiate a new negotiation"),this.restartICE()};handleRemoveTrackEvent=()=>{nc.debug("handleRemoveTrackEvent() | Track removed by remote peer. Need to handle UI locally."),this.emit("videoToggle",{status:!1,peer:"other"})};async createPeerOffer(e){let t,r=this;t=await this._socket.request({type:"fetchIceServers",message:{}}),this._peerConnection=new RTCPeerConnection({iceServers:t}),nc.debug("connection state in createPeeroffer():%s",this._peerConnection.connectionState),this._peerConnection.onicecandidate=e=>{this._onICeCandidate(e)},this._localStream.getTracks().forEach(e=>this._peerConnection.addTrack(e,this._localStream));const s=await this._peerConnection.createOffer().catch(function(e){alert("Error when creating an offer",e),nc.error("Error when creating an offer:%o",e)});await this._peerConnection.setLocalDescription(s),this.send({type:"offer",offer:r._peerConnection.localDescription,peer:r._remotePeerId,name:r.myName}),this._peerConnection.ontrack=e=>r.gotRemoteTrack(e),this._peerConnection.addEventListener("iceconnectionstatechange",async e=>{nc.debug("Current ICEState:%s",r._peerConnection.iceConnectionState),"failed"!==r._peerConnection.iceConnectionState&&"disconnected"!==r._peerConnection.iceConnectionState||(nc.debug("Ice connection failed!! with socket connection status:%s",r._socket.connectionStatus),r.emit("iceFailure"))}),this._peerConnection.onnegotiationneeded=()=>this.handleNegotiationNeededEvent(),this._peerConnection.onremovetrack=()=>this.handleRemoveTrackEvent()}async handleOffer({peer:e,name:t,offer:r}){let s=this;const i=await this._socket.request({type:"fetchIceServers",message:{}});this._peerConnection=new RTCPeerConnection({iceServers:i}),nc.debug("Peer connection in handle offer is:%s",this._peerConnection),this._remoteDisplayName=t,this._remotePeerId=e,this._peerConnection.setRemoteDescription(new RTCSessionDescription(r)),this._localStream.getTracks().forEach(e=>this._peerConnection.addTrack(e,this._localStream)),this._peerConnection.createAnswer().then(function(e){return s._peerConnection.setLocalDescription(e)}).then(function(){nc.debug("Ice already completed. sending answer!!"),s.send({type:"answer",answer:s._peerConnection.localDescription,peer:s._remotePeerId,mediaInputs:s.mediaInputs,userAgent:s.userAgent})}).catch(function(e){alert("Error when creating an answer"),nc.error("Error while creating answer:%o",e)}),this._peerConnection.ontrack=e=>s.gotRemoteTrack(e),this._peerConnection.onicecandidate=e=>{this._onICeCandidate(e)},this._peerConnection.addEventListener("iceconnectionstatechange",async e=>{nc.debug("Current ICEState:%s",s._peerConnection.iceConnectionState),"failed"!==s._peerConnection.iceConnectionState&&"disconnected"!==s._peerConnection.iceConnectionState||(nc.debug("Ice connection failed!! with socket connection status:%s",s._socket.connectionStatus),s.emit("iceFailure"))}),this._peerConnection.onnegotiationneeded=()=>this.handleNegotiationNeededEvent(),this._peerConnection.onremovetrack=()=>this.handleRemoveTrackEvent(),this.emit("offerReceived")}handleAnswer(e){nc.debug("answer:%o ",e),this._peerConnection.setRemoteDescription(new RTCSessionDescription(e.answer)),this._remoteMediaInputs=e.mediaInputs,this._remoteUserAgent=e.userAgent,this.emit("remoteMediaInputs")}async handleCandidate(e){this.pc?(nc.debug("Peerconnection available, Inside handle candidate for remote icecandidates"),this._peerConnection.addIceCandidate(new RTCIceCandidate(e)).catch(e=>{nc.error("Error while adding iceCandidate",e)})):nc.warn("Candidate arrived before peer connection instantiation:%o",e)}async restartICE(){const e=await this._peerConnection.createOffer({iceRestart:!0});await this._peerConnection.setLocalDescription(e),this.send({type:"iceRestart",offer:e})}async handleIceRestart(e){nc.debug("Ice restart message received!!"),this._peerConnection.setRemoteDescription(e.offer);const t=await this._peerConnection.createAnswer();await this._peerConnection.setLocalDescription(t),this.send({type:"iceRestarted",answer:t})}async handleIceRestartResponse(e){nc.debug("Ice restart message response received!!"),this._peerConnection.setRemoteDescription(e.answer)}async informRoomLeave(){this.send({type:"leave",peer:this.remoteId}),await this.handleLeave()}async handleLeave(){this._peerConnection?(this._peerConnection.ontrack=null,this._peerConnection.onremovetrack=null,this._peerConnection.onremovestream=null,this._peerConnection.onicecandidate=null,this._peerConnection.oniceconnectionstatechange=null,this._peerConnection.onsignalingstatechange=null,this._peerConnection.onicegatheringstatechange=null,this._peerConnection.onnegotiationneeded=null,this._localStream&&this._localStream.getTracks().forEach(e=>e.stop()),this._remoteStream&&this._remoteStream.getTracks().forEach(e=>e.stop()),this._peerConnection.close(),this._peerConnection=null,this._remoteDisplayName=null,this._remotePeerId=null,this._remoteStream=null,this._localStream=null,this._canvas=null,this._imageData=null,this._imageWidth=640,this._imageHeight=480,this._socket.close()):nc.error("No peerconnection object found!")}async changeRemoteMediaSource(e){let{label:t,mediaType:r}=e;!t||"video"!==r&&"audio"!==r?this.send({type:"error",details:{reason:"Can't change remote media source as either media label or media type is not available!"}}):this.handleReplaceTrack({label:t,mediaType:r})}async handleReplaceTrack({label:e,mediaType:t}){try{let r,s,i;const a=await(e=>new Promise(t=>{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){ConsoleHelper(e.name+": "+e.message),t({error:e.name,reason:e.message})})}))(e);"video"===t?(rc.video.deviceId.exact=a,i=rc,r=this._localStream.getVideoTracks()[0]):"audio"===t?(tc.audio.deviceId.exact=a,i=tc,r=this._localStream.getAudioTracks()[0]):nc.error("Unknown media type:%s",t);let n=r.enabled;r.stop(),nc.debug("selected constraints are:%o",i);let o=await navigator.mediaDevices.getUserMedia(i);if(nc.debug("new stream is:%o",o),"video"===t?s=o.getVideoTracks()[0]:"audio"===t&&(s=o.getAudioTracks()[0]),s.enabled=n,this._peerConnection){const e=this._peerConnection.getSenders().find(function(e){return e.track.kind==s.kind});nc.debug("found sender:%o",e),e.replaceTrack(s)}this._localStream.removeTrack(r),this._localStream.addTrack(s)}catch(r){nc.error("Error while replace media track:%o",r),this.clientErrorHandler({reason:"Error while replacing media track with new source",error:r})}}async captureImage(e){const t=document.createElement("canvas"),r=t.getContext("2d"),s=this._imageWidth,i=this._imageHeight;nc.debug("height:%s and width:%s",s,i),t.width=s,t.height=i,"local"===e?r.drawImage(localVideo,0,0,s,i):r.drawImage(remoteVideo,0,0,s,i);let a=t.toDataURL("image/png");this._canvas=t,this._imageData=a,this.emit("imageCaptured")}async clearImage(){const e=this._canvas,t=e.getContext("2d");t.fillStyle="#AAA",t.fillRect(0,0,e.width,e.height);let r=e.toDataURL("image/png");this._imageData=r}captureRemoteImage(){this.send({type:"imageCapture"})}remoteCamChange(e){e?this.send({type:"mediaChange",mediaType:"video",label:e}):this.clientErrorHandler({reason:"A valid camera name must be selected for to change the remote camera!",error:null})}remoteMicChange(e){e?this.send({type:"mediaChange",mediaType:"audio",label:e}):this.clientErrorHandler({reason:"A valid mic name must be selected for to change the remote mic!",error:null})}requestStats(){this.send({type:"requestStats"})}async captureStats(){let e=this;return new Promise(t=>{this._peerConnection.getStats(null).then(r=>{let s={};r.forEach(e=>{["inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","local-candidate","remote-candidate","candidate-pair"].includes(e.type)&&(s={...s,[`${e.type}`]:e})}),e._localStats=s,t(s)})})}displayStats({stats:e,element:t}){let r="";Object.values(e).forEach(e=>{r+=`<h2>Report: ${e.type}</h2>\n<strong>ID:</strong> ${e.id}<br>\n<strong>Timestamp:</strong> ${e.timestamp}<br>\n`,Object.keys(e).forEach(t=>{"id"!==t&&"timestamp"!==t&&"type"!==t&&(r+=`<strong>${t}:</strong> ${e[t]}<br>\n`)})}),document.querySelector(t).innerHTML=r}async sendRequestedstats(){let e=await this.captureStats();nc.debug("Local stats are:%o",e),this.send({type:"statsFetched",stats:e})}clientErrorHandler({reason:e,error:t}){this.emit("clientError",{reason:e,error:t})}copyLink(e){navigator.clipboard.writeText(e).then(function(){nc.debug("Async: Copying to clipboard was successful!"),alert("Link copied!!")},function(e){nc.error("Async: Could not copy text:%o ",e)})}}const cc={JsSdk_v1:to,JsSdk:Yo,P2pSdk:oc};e.JsSdk=Yo,e.JsSdk_v1=to,e.P2pSdk=oc,e.default=cc,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});