@seastart/srtc-web-sdk 0.3.7 → 0.4.0
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.
- package/package.json +1 -1
- package/srtc.d.mts +9 -0
- package/srtc.d.ts +9 -0
- package/srtc.js +1 -1
- package/srtc.mjs +1 -1
package/srtc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={5964:(e,t,r)=>{var n=r(3908);const i=r(9273).EventEmitter,o=r(6394),s=r(9790),a=r(3124),c=r(3140),u=r(9996),l=r(1181).Writable,h=r(6371),f=r(5371),d=r(1691),p=r(1223),g=r(7616),m=r(659)("mqttjs:client"),y=n?n.nextTick:function(e){setTimeout(e,0)},v=r.g.setImmediate||function(e){y(e)},b={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},w=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND","ETIMEDOUT"],_={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function k(e,t){let r;t.properties&&(r=t.properties.topicAlias);let n=t.topic.toString();if(0===n.length){if(void 0===r)return new Error("Unregistered Topic Alias");if(n=e.topicAliasSend.getTopicByAlias(r),void 0===n)return new Error("Unregistered Topic Alias");t.topic=n}r&&delete t.properties.topicAlias}function S(e,t,r){m("sendPacket :: packet: %O",t),m("sendPacket :: emitting `packetsend`"),e.emit("packetsend",t),m("sendPacket :: writing to stream");const n=c.writeToStream(t,e.stream,e.options);m("sendPacket :: writeToStream result %s",n),!n&&r&&r!==C?(m("sendPacket :: handle events on `drain` once through callback."),e.stream.once("drain",r)):r&&(m("sendPacket :: invoking cb"),r())}function E(e,t,r,n){m("storeAndSend :: store packet with cmd %s to outgoingStore",t.cmd);let i,o=t;if("publish"===o.cmd&&(o=d(t),i=k(e,o),i))return r&&r(i);e.outgoingStore.put(o,(function(i){if(i)return r&&r(i);n(),S(e,t,r)}))}function C(e){m("nop ::",e)}function T(e,t){let r;const n=this;if(!(this instanceof T))return new T(e,t);for(r in this.options=t||{},b)void 0===this.options[r]?this.options[r]=b[r]:this.options[r]=t[r];m("MqttClient :: options.protocol",t.protocol),m("MqttClient :: options.protocolVersion",t.protocolVersion),m("MqttClient :: options.username",t.username),m("MqttClient :: options.keepalive",t.keepalive),m("MqttClient :: options.reconnectPeriod",t.reconnectPeriod),m("MqttClient :: options.rejectUnauthorized",t.rejectUnauthorized),m("MqttClient :: options.topicAliasMaximum",t.topicAliasMaximum),this.options.clientId="string"==typeof t.clientId?t.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),m("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===t.protocolVersion&&t.customHandleAcks?t.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=e,this.messageIdProvider=void 0===this.options.messageIdProvider?new u:this.options.messageIdProvider,this.outgoingStore=t.outgoingStore||new o,this.incomingStore=t.incomingStore||new o,this.queueQoSZero=void 0===t.queueQoSZero||t.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,t.topicAliasMaximum>0&&(t.topicAliasMaximum>65535?m("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new s(t.topicAliasMaximum)),this.on("connect",(function(){const e=this.queue;m("connect :: sending queued packets"),function t(){const r=e.shift();m("deliver :: entry %o",r);let i=null;if(!r)return void n._resubscribe();i=r.packet,m("deliver :: call _sendPacket for %o",i);let o=!0;i.messageId&&0!==i.messageId&&(n.messageIdProvider.register(i.messageId)||(o=!1)),o?n._sendPacket(i,(function(e){r.cb&&r.cb(e),t()})):(m("messageId: %d has already used. The message is skipped and removed.",i.messageId),t())}()})),this.on("close",(function(){m("close :: connected set to `false`"),this.connected=!1,m("close :: clearing connackTimer"),clearTimeout(this.connackTimer),m("close :: clearing ping timer"),null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),m("close :: calling _setupReconnect"),this._setupReconnect()})),i.call(this),m("MqttClient :: setting up stream"),this._setupStream()}h(T,i),T.prototype._setupStream=function(){const e=this,t=new l,r=c.parser(this.options);let n=null;const i=[];function o(){if(i.length)y(s);else{const e=n;n=null,e()}}function s(){m("work :: getting next packet in queue");const t=i.shift();if(t)m("work :: packet pulled from queue"),e._handlePacket(t,o);else{m("work :: no packets in queue");const e=n;n=null,m("work :: done flag is %s",!!e),e&&e()}}m("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),m("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",(function(e){m("parser :: on packet push to packets array."),i.push(e)})),t._write=function(e,t,i){n=i,m("writable stream :: parsing buffer"),r.parse(e),s()},m("_setupStream :: pipe stream to writable stream"),this.stream.pipe(t),this.stream.on("error",(function(t){m("streamErrorHandler :: error",t.message),w.includes(t.code)?(m("streamErrorHandler :: emitting error"),e.emit("error",t)):C(t)})),this.stream.on("close",(function(){var t;m("(%s)stream :: on close",e.options.clientId),(t=e.outgoing)&&(m("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach((function(e){t[e].volatile&&"function"==typeof t[e].cb&&(t[e].cb(new Error("Connection closed")),delete t[e])}))),m("stream: emit close to MqttClient"),e.emit("close")})),m("_setupStream: sending packet `connect`");const a=Object.create(this.options);if(a.cmd="connect",this.topicAliasRecv&&(a.properties||(a.properties={}),this.topicAliasRecv&&(a.properties.topicAliasMaximum=this.topicAliasRecv.max)),S(this,a),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return e.end((()=>this.emit("error",new Error("Packet has no Authentication Method")))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket){S(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){m("!!connectTimeout hit!! Calling _cleanUp with force `true`"),e._cleanUp(!0)}),this.options.connectTimeout)},T.prototype._handlePacket=function(e,t){const r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<e.length)return this.emit("error",new Error("exceeding packets size "+e.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(m("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"auth":this._handleAuth(e),t();break;case"pingresp":this._handlePingresp(e),t();break;case"disconnect":this._handleDisconnect(e),t()}},T.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e&&e!==C?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},T.prototype.publish=function(e,t,r,n){m("publish :: message `%s` to topic `%s`",t,e);const i=this.options;"function"==typeof r&&(n=r,r=null);if(r=g({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;const o=this,s=function(){let s=0;if((1===r.qos||2===r.qos)&&(s=o._nextId(),null===s))return m("No messageId left"),!1;const a={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:s,dup:r.dup};switch(5===i.protocolVersion&&(a.properties=r.properties),m("publish :: qos",r.qos),r.qos){case 1:case 2:o.outgoing[a.messageId]={volatile:!1,cb:n||C},m("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,void 0,r.cbStorePut);break;default:m("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,n,r.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,cbStorePut:r.cbStorePut,callback:n}),this},T.prototype.subscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];const r=[];let n=t.shift();const i=n.resubscribe;let o=t.pop()||C,s=t.pop();const a=this.options.protocolVersion;delete n.resubscribe,"string"==typeof n&&(n=[n]),"function"!=typeof o&&(s=o,o=C);const c=p.validateTopics(n);if(null!==c)return v(o,new Error("Invalid topic "+c)),this;if(this._checkDisconnecting(o))return m("subscribe: discconecting true"),this;const u={qos:0};if(5===a&&(u.nl=!1,u.rap=!1,u.rh=0),s=g(u,s),Array.isArray(n)?n.forEach((function(t){if(m("subscribe: array topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<s.qos||i){const e={topic:t,qos:s.qos};5===a&&(e.nl=s.nl,e.rap=s.rap,e.rh=s.rh,e.properties=s.properties),m("subscribe: pushing topic `%s` and qos `%s` to subs list",e.topic,e.qos),r.push(e)}})):Object.keys(n).forEach((function(t){if(m("subscribe: object topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<n[t].qos||i){const e={topic:t,qos:n[t].qos};5===a&&(e.nl=n[t].nl,e.rap=n[t].rap,e.rh=n[t].rh,e.properties=s.properties),m("subscribe: pushing `%s` to subs list",e),r.push(e)}})),!r.length)return o(null,[]),this;const l=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const n={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:t};if(s.properties&&(n.properties=s.properties),e.options.resubscribe){m("subscribe :: resubscribe true");const t=[];r.forEach((function(r){if(e.options.reconnectPeriod>0){const n={qos:r.qos};5===a&&(n.nl=r.nl||!1,n.rap=r.rap||!1,n.rh=r.rh||0,n.properties=r.properties),e._resubscribeTopics[r.topic]=n,t.push(r.topic)}})),e.messageIdToTopic[n.messageId]=t}return e.outgoing[n.messageId]={volatile:!0,cb:function(e,t){if(!e){const e=t.granted;for(let t=0;t<e.length;t+=1)r[t].qos=e[t]}o(e,r)}},m("subscribe :: call _sendPacket"),e._sendPacket(n),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!l())&&this._storeProcessingQueue.push({invoke:l,callback:o}),this},T.prototype.unsubscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];let r=t.shift(),n=t.pop()||C,i=t.pop();"string"==typeof r&&(r=[r]),"function"!=typeof n&&(i=n,n=C);const o=p.validateTopics(r);if(null!==o)return v(n,new Error("Invalid topic "+o)),this;if(e._checkDisconnecting(n))return this;const s=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const o={cmd:"unsubscribe",qos:1,messageId:t};return"string"==typeof r?o.unsubscriptions=[r]:Array.isArray(r)&&(o.unsubscriptions=r),e.options.resubscribe&&o.unsubscriptions.forEach((function(t){delete e._resubscribeTopics[t]})),"object"==typeof i&&i.properties&&(o.properties=i.properties),e.outgoing[o.messageId]={volatile:!0,cb:n},m("unsubscribe: call _sendPacket"),e._sendPacket(o),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,callback:n}),this},T.prototype.end=function(e,t,r){const n=this;function i(){m("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close((function(e){n.outgoingStore.close((function(t){if(m("end :: closeStores: emitting end"),n.emit("end"),r){const n=e||t;m("end :: closeStores: invoking callback with args"),r(n)}}))})),n._deferredReconnect&&n._deferredReconnect()}function o(){m("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,e),n._cleanUp(e,(()=>{m("end :: finish :: calling process.nextTick on closeStores"),y(i.bind(n))}),t)}return m("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(r=t||C,t=e,e=!1,"object"!=typeof t&&(r=t,t=null,"function"!=typeof r&&(r=C))),"object"!=typeof t&&(r=t,t=null),m("end :: cb? %s",!!r),r=r||C,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(m("end :: (%s) :: calling finish in 10ms once outgoing is empty",n.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,o,10))):(m("end :: (%s) :: immediately calling finish",n.options.clientId),o()),this)},T.prototype.removeOutgoingMessage=function(e){const t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},T.prototype.reconnect=function(e){m("client reconnect");const t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},T.prototype._reconnect=function(){m("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((()=>{this._setupStream()})),m("client already connected. disconnecting first.")):(m("_reconnect: calling _setupStream"),this._setupStream())},T.prototype._setupReconnect=function(){const e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(m("_setupReconnect :: emit `offline` state"),this.emit("offline"),m("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),m("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval((function(){m("reconnectTimer :: reconnect triggered!"),e._reconnect()}),e.options.reconnectPeriod)):m("_setupReconnect :: doing nothing...")},T.prototype._clearReconnect=function(){m("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},T.prototype._cleanUp=function(e,t){const r=arguments[2];if(t&&(m("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),m("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&(n=this.outgoing)&&(m("flush: queue exists? %b",!!n),Object.keys(n).forEach((function(e){"function"==typeof n[e].cb&&(n[e].cb(new Error("Connection closed")),delete n[e])}))),m("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const e=g({cmd:"disconnect"},r);m("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(e,v.bind(null,this.stream.end.bind(this.stream)))}var n;this.disconnecting||(m("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(m("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(m("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},T.prototype._sendPacket=function(e,t,r){m("_sendPacket :: (%s) :: start",this.options.clientId),r=r||C,t=t||C;const n=function(e,t){if(5===e.options.protocolVersion&&"publish"===t.cmd){let r;t.properties&&(r=t.properties.topicAlias);const n=t.topic.toString();if(e.topicAliasSend)if(r){if(0!==n.length&&(m("applyTopicAlias :: register topic: %s - alias: %d",n,r),!e.topicAliasSend.put(n,r)))return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}else 0!==n.length&&(e.options.autoAssignTopicAlias?(r=e.topicAliasSend.getAliasByTopic(n),r?(t.topic="",t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",n,r)):(r=e.topicAliasSend.getLruAlias(),e.topicAliasSend.put(n,r),t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto assign topic: %s - alias: %d",n,r))):e.options.autoUseTopicAlias&&(r=e.topicAliasSend.getAliasByTopic(n),r&&(t.topic="",t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto use topic: %s - alias: %d",n,r))));else if(r)return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}}(this,e);if(n)t(n);else{if(!this.connected)return"auth"===e.cmd?(this._shiftPingInterval(),void S(this,e,t)):(m("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,r));switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void E(this,e,t,r);default:return void S(this,e,t)}switch(e.qos){case 2:case 1:E(this,e,t,r);break;default:S(this,e,t)}m("_sendPacket :: (%s) :: end",this.options.clientId)}},T.prototype._storePacket=function(e,t,r){m("_storePacket :: packet: %o",e),m("_storePacket :: cb? %s",!!t),r=r||C;let n=e;if("publish"===n.cmd){n=d(e);const r=k(this,n);if(r)return t&&t(r)}0===(n.qos||0)&&this.queueQoSZero||"publish"!==n.cmd?this.queue.push({packet:n,cb:t}):n.qos>0?(t=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,(function(e){if(e)return t&&t(e);r()}))):t&&t(new Error("No connection to broker"))},T.prototype._setupPingTimer=function(){m("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=f((function(){e._checkPing()}),1e3*this.options.keepalive))},T.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},T.prototype._checkPing=function(){m("_checkPing :: checking ping..."),this.pingResp?(m("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(m("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},T.prototype._handlePingresp=function(){this.pingResp=!0},T.prototype._handleConnack=function(e){m("_handleConnack");const t=this.options,r=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));e.properties.topicAliasMaximum>0&&(this.topicAliasSend=new a(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(0===r)this.reconnecting=!1,this._onConnect(e);else if(r>0){const e=new Error("Connection refused: "+_[r]);e.code=r,this.emit("error",e)}},T.prototype._handleAuth=function(e){const t=this.options.protocolVersion,r=5===t?e.reasonCode:e.returnCode;if(5!==t){const e=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+t);return e.code=r,void this.emit("error",e)}const n=this;this.handleAuth(e,(function(e,t){if(e)n.emit("error",e);else if(24===r)n.reconnecting=!1,n._sendPacket(t);else{const t=new Error("Connection refused: "+_[r]);e.code=r,n.emit("error",t)}}))},T.prototype.handleAuth=function(e,t){t()},T.prototype._handlePublish=function(e,t){m("_handlePublish: packet %o",e),t=void 0!==t?t:C;let r=e.topic.toString();const n=e.payload,i=e.qos,o=e.messageId,s=this,a=this.options,c=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let t;if(e.properties&&(t=e.properties.topicAlias),void 0!==t)if(0===r.length){if(!(t>0&&t<=65535))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));{const e=this.topicAliasRecv.getTopicByAlias(t);if(!e)return m("_handlePublish :: unregistered topic alias. alias: %d",t),void this.emit("error",new Error("Received unregistered Topic Alias"));r=e,m("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",r,t)}}else{if(!this.topicAliasRecv.put(r,t))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));m("_handlePublish :: registered topic: %s - alias: %d",r,t)}}switch(m("_handlePublish: qos %d",i),i){case 2:a.customHandleAcks(r,n,e,(function(r,n){return r instanceof Error||(n=r,r=null),r?s.emit("error",r):-1===c.indexOf(n)?s.emit("error",new Error("Wrong reason code for pubrec")):void(n?s._sendPacket({cmd:"pubrec",messageId:o,reasonCode:n},t):s.incomingStore.put(e,(function(){s._sendPacket({cmd:"pubrec",messageId:o},t)})))}));break;case 1:a.customHandleAcks(r,n,e,(function(i,a){return i instanceof Error||(a=i,i=null),i?s.emit("error",i):-1===c.indexOf(a)?s.emit("error",new Error("Wrong reason code for puback")):(a||s.emit("message",r,n,e),void s.handleMessage(e,(function(e){if(e)return t&&t(e);s._sendPacket({cmd:"puback",messageId:o,reasonCode:a},t)})))}));break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t);break;default:m("_handlePublish: unknown QoS. Doing nothing.")}},T.prototype.handleMessage=function(e,t){t()},T.prototype._handleAck=function(e){const t=e.messageId,r=e.cmd;let n=null;const i=this.outgoing[t]?this.outgoing[t].cb:null,o=this;let s;if(i){switch(m("_handleAck :: packet type",r),r){case"pubcomp":case"puback":{const r=e.reasonCode;r&&r>0&&16!==r&&(s=new Error("Publish error: "+_[r]),s.code=r,i(s,e)),delete this.outgoing[t],this.outgoingStore.del(e,i),this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue();break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:t};const r=e.reasonCode;r&&r>0&&16!==r?(s=new Error("Publish error: "+_[r]),s.code=r,i(s,e)):this._sendPacket(n);break}case"suback":delete this.outgoing[t],this.messageIdProvider.deallocate(t);for(let r=0;r<e.granted.length;r++)if(128&e.granted[r]){const e=this.messageIdToTopic[t];e&&e.forEach((function(e){delete o._resubscribeTopics[e]}))}this._invokeStoreProcessingQueue(),i(null,e);break;case"unsuback":delete this.outgoing[t],this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue(),i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else m("_handleAck :: Server sent an ack in error. Ignoring.")},T.prototype._handlePubrel=function(e,t){m("handling pubrel packet"),t=void 0!==t?t:C;const r=e.messageId,n=this,i={cmd:"pubcomp",messageId:r};n.incomingStore.get(e,(function(e,r){e?n._sendPacket(i,t):(n.emit("message",r.topic,r.payload,r),n.handleMessage(r,(function(e){if(e)return t(e);n.incomingStore.del(r,C),n._sendPacket(i,t)})))}))},T.prototype._handleDisconnect=function(e){this.emit("disconnect",e)},T.prototype._nextId=function(){return this.messageIdProvider.allocate()},T.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},T.prototype._resubscribe=function(){m("_resubscribe");const e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){m("_resubscribe: protocolVersion 5");for(let t=0;t<e.length;t++){const r={};r[e[t]]=this._resubscribeTopics[e[t]],r.resubscribe=!0,this.subscribe(r,{properties:r[e[t]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},T.prototype._onConnect=function(e){if(this.disconnected)return void this.emit("connect",e);const t=this;this.connackPacket=e,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function r(){let n=t.outgoingStore.createStream();function i(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}}function o(){n.destroy(),n=null,t._flushStoreProcessingQueue(),i()}t.once("close",o),n.on("error",(function(e){i(),t._flushStoreProcessingQueue(),t.removeListener("close",o),t.emit("error",e)})),n.on("end",(function(){let n=!0;for(const e in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[e]){n=!1;break}n?(i(),t.removeListener("close",o),t._invokeAllStoreProcessingQueue(),t.emit("connect",e)):r()})),function e(){if(!n)return;t._storeProcessing=!0;const r=n.read(1);let i;r?t._packetIdsDuringStoreProcessing[r.messageId]?e():t.disconnecting||t.reconnectTimer?n.destroy&&n.destroy():(i=t.outgoing[r.messageId]?t.outgoing[r.messageId].cb:null,t.outgoing[r.messageId]={volatile:!1,cb:function(t,r){i&&i(t,r),e()}},t._packetIdsDuringStoreProcessing[r.messageId]=!0,t.messageIdProvider.register(r.messageId)?t._sendPacket(r):m("messageId: %d has already used.",r.messageId)):n.once("readable",e)}()}()},T.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1},T.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},T.prototype._flushStoreProcessingQueue=function(){for(const e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},e.exports=T},2670:(e,t,r)=>{const{Buffer:n}=r(2577),i=r(1181).Transform,o=r(3521);let s,a,c,u=!1;e.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);const l=function(e,t){const r="alis"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s=t.my,s.connectSocket({url:l,protocols:r}),a=function(){const e=new i;return e._write=function(e,t,r){s.sendSocketMessage({data:e.buffer,success:function(){r()},fail:function(){r(new Error)}})},e._flush=function(e){s.closeSocket({success:function(){e()}})},e}(),c=o.obj(),u||(u=!0,s.onSocketOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),s.onSocketMessage((function(e){if("string"==typeof e.data){const t=n.from(e.data,"base64");a.push(t)}else{const t=new FileReader;t.addEventListener("load",(function(){let e=t.result;e=e instanceof ArrayBuffer?n.from(e):n.from(e,"utf8"),a.push(e)})),t.readAsArrayBuffer(e.data)}})),s.onSocketClose((function(){c.end(),c.destroy()})),s.onSocketError((function(e){c.destroy(e)}))),c}},7594:(e,t,r)=>{var n=r(3908);const i=r(5964),o=r(6394),s=r(4837),a=r(7616),c=r(659)("mqttjs"),u={};function l(e,t){if(c("connecting to an MQTT broker..."),"object"!=typeof e||t||(t=e,e=null),t=t||{},e){const r=s.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=a(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){let t;e.auth&&(t=e.auth.match(/^(.+):(.+)$/),t?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!u[t.protocol]){const e=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(t,r){return(!e||r%2!=0)&&"function"==typeof u[t]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");t.protocol&&(t.defaultProtocol=t.protocol);const r=new i((function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),c("calling streambuilder for",t.protocol),u[t.protocol](e,t)}),t);return r.on("error",(function(){})),r}void 0!==n&&"browser"!==n.title||"function"!=typeof r?(u.mqtt=r(8793),u.tcp=r(8793),u.ssl=r(5351),u.tls=r(5351),u.mqtts=r(5351)):(u.wx=r(3027),u.wxs=r(3027),u.ali=r(2670),u.alis=r(2670)),u.ws=r(5838),u.wss=r(5838),e.exports=l,e.exports.connect=l,e.exports.MqttClient=i,e.exports.Store=o},8793:(e,t,r)=>{const n=r(5653),i=r(659)("mqttjs:tcp");e.exports=function(e,t){t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost";const r=t.port,o=t.hostname;return i("port %d and host %s",r,o),n.createConnection(r,o)}},5351:(e,t,r)=>{const n=r(8535),i=r(5653),o=r(659)("mqttjs:tls");e.exports=function(e,t){t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",0===i.isIP(t.host)&&(t.servername=t.host),t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,o("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);const r=n.connect(t);function s(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return r.on("secureConnect",(function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",s)})),r.on("error",s),r}},5838:(e,t,r)=>{var n=r(3908);const{Buffer:i}=r(2577),o=r(965),s=r(659)("mqttjs:ws"),a=r(3521),c=r(1181).Transform,u=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],l=void 0!==n&&"browser"===n.title||"function"==typeof r;function h(e,t){let r=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function f(e){const t=e;return e.hostname||(t.hostname="localhost"),e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),l||"wss"!==e.protocol||u.forEach((function(r){Object.prototype.hasOwnProperty.call(e,r)&&!Object.prototype.hasOwnProperty.call(e.wsOptions,r)&&(t.wsOptions[r]=e[r])})),t}e.exports=l?function(e,t){let r;s("browserStreamBuilder");const n=function(e){const t=f(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const e=new URL(document.URL);t.hostname=e.hostname,t.port||(t.port=e.port)}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}(t).browserBufferSize||524288,o=t.browserBufferTimeout||1e3,u=!t.objectMode,l=function(e,t){const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",n=h(t,e),i=new WebSocket(n,[r]);return i.binaryType="arraybuffer",i}(e,t),d=function(e,t,r){const n=new c({objectModeMode:e.objectMode});return n._write=t,n._flush=r,n}(t,(function e(t,r,s){l.bufferedAmount>n&&setTimeout(e,o,t,r,s),u&&"string"==typeof t&&(t=i.from(t,"utf8"));try{l.send(t)}catch(e){return s(e)}s()}),(function(e){l.close(),e()}));t.objectMode||(d._writev=b),d.on("close",(()=>{l.close()}));const p=void 0!==l.addEventListener;function g(){r.setReadable(d),r.setWritable(d),r.emit("connect")}function m(){r.end(),r.destroy()}function y(e){r.destroy(e)}function v(e){let t=e.data;t=t instanceof ArrayBuffer?i.from(t):i.from(t,"utf8"),d.push(t)}function b(e,t){const r=new Array(e.length);for(let t=0;t<e.length;t++)"string"==typeof e[t].chunk?r[t]=i.from(e[t],"utf8"):r[t]=e[t].chunk;this._write(i.concat(r),"binary",t)}return l.readyState===l.OPEN?r=d:(r=r=a(void 0,void 0,t),t.objectMode||(r._writev=b),p?l.addEventListener("open",g):l.onopen=g),r.socket=l,p?(l.addEventListener("close",m),l.addEventListener("error",y),l.addEventListener("message",v)):(l.onclose=m,l.onerror=y,l.onmessage=v),r}:function(e,t){s("streamBuilder");const r=f(t),n=h(r,e),i=function(e,t,r){s("createWebSocket"),s("protocol: "+r.protocolId+" "+r.protocolVersion);const n="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return s("creating new Websocket for url: "+t+" and protocol: "+n),new o(t,[n],r.wsOptions)}(0,n,r),a=o.createWebSocketStream(i,r.wsOptions);return a.url=n,i.on("close",(()=>{a.destroy()})),a}},3027:(e,t,r)=>{const{Buffer:n}=r(2577),i=r(1181).Transform,o=r(3521);let s,a,c;e.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);const u=function(e,t){const r="wxs"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s=wx.connectSocket({url:u,protocols:[r]}),a=function(){const e=new i;return e._write=function(e,t,r){s.send({data:0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),success:function(){r()},fail:function(e){r(new Error(e))}})},e._flush=function(e){s.close({success:function(){e()}})},e}(),c=o.obj(),s.onOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),s.onMessage((function(e){let t=e.data;t=t instanceof ArrayBuffer?n.from(t):n.from(t,"utf8"),a.push(t)})),s.onClose((function(){c.end(),c.destroy()})),s.onError((function(e){c.destroy(new Error(e.errMsg))})),c}},9996:e=>{function t(){if(!(this instanceof t))return new t;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}t.prototype.allocate=function(){const e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},t.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},t.prototype.register=function(e){return!0},t.prototype.deallocate=function(e){},t.prototype.clear=function(){},e.exports=t},6394:(e,t,r)=>{const n=r(7616),i=r(1181).Readable,o={objectMode:!0},s={clean:!0};function a(e){if(!(this instanceof a))return new a(e);this.options=e||{},this.options=n(s,e),this._inflights=new Map}a.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},a.prototype.createStream=function(){const e=new i(o),t=[];let r=!1,n=0;return this._inflights.forEach((function(e,r){t.push(e)})),e._read=function(){!r&&n<t.length?this.push(t[n++]):this.push(null)},e.destroy=function(){if(r)return;const e=this;r=!0,setTimeout((function(){e.emit("close")}),0)},e},a.prototype.del=function(e,t){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),t(null,e)):t&&t(new Error("missing packet")),this},a.prototype.get=function(e,t){return(e=this._inflights.get(e.messageId))?t(null,e):t&&t(new Error("missing packet")),this},a.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},e.exports=a},9790:e=>{function t(e){if(!(this instanceof t))return new t(e);this.aliasToTopic={},this.max=e}t.prototype.put=function(e,t){return!(0===t||t>this.max)&&(this.aliasToTopic[t]=e,this.length=Object.keys(this.aliasToTopic).length,!0)},t.prototype.getTopicByAlias=function(e){return this.aliasToTopic[e]},t.prototype.clear=function(){this.aliasToTopic={}},e.exports=t},3124:(e,t,r)=>{const n=r(8103),i=r(1846).t;function o(e){if(!(this instanceof o))return new o(e);e>0&&(this.aliasToTopic=new n({max:e}),this.topicToAlias={},this.numberAllocator=new i(1,e),this.max=e,this.length=0)}o.prototype.put=function(e,t){if(0===t||t>this.max)return!1;const r=this.aliasToTopic.get(t);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(t,e),this.topicToAlias[e]=t,this.numberAllocator.use(t),this.length=this.aliasToTopic.length,!0},o.prototype.getTopicByAlias=function(e){return this.aliasToTopic.get(e)},o.prototype.getAliasByTopic=function(e){const t=this.topicToAlias[e];return void 0!==t&&this.aliasToTopic.get(t),t},o.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},o.prototype.getLruAlias=function(){const e=this.numberAllocator.firstVacant();return e||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},e.exports=o},1223:e=>{function t(e){const t=e.split("/");for(let e=0;e<t.length;e++)if("+"!==t[e]){if("#"===t[e])return e===t.length-1;if(-1!==t[e].indexOf("+")||-1!==t[e].indexOf("#"))return!1}return!0}e.exports={validateTopics:function(e){if(0===e.length)return"empty_topic_list";for(let r=0;r<e.length;r++)if(!t(e[r]))return e[r];return null}}},8752:(e,t)=>{t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],c=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),l=0,h=c>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(c(e,a,a+s>u?u:a+s));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(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 c(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},1951:(e,t,r)=>{const{Buffer:n}=r(9183),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},o.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},o.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,l=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(c<=this._bufs[s[0]].length-l)return o?this._bufs[s[0]].copy(e,t,l,l+c):this._bufs[s[0]].slice(l,l+c);o||(e=n.allocUnsafe(a));for(let t=s[0];t<this._bufs.length;t++){const r=this._bufs[t].length-l;if(!(c>r)){this._bufs[t].copy(e,u,l,l+c),u+=r;break}this._bufs[t].copy(e,u,l),u+=r,c-=r,l&&(l=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},o.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},o.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},o.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o<this._bufs.length;o++){const t=this._bufs[o];for(;s<t.length;){if(t.length-s>=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)!function(t){o.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(r=0){return this.slice(r,r+e[t])[t](0)}}(t)}(),o.prototype._isBufferList=function(e){return e instanceof o||o.isBufferList(e)},o.isBufferList=function(e){return null!=e&&e[i]},e.exports=o},6431:(e,t,r)=>{const n=r(1181).Duplex,i=r(6371),o=r(1951);function s(e){if(!(this instanceof s))return new s(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)})),e=null}o._init.call(this,e),n.call(this)}i(s,n),Object.assign(s.prototype,o.prototype),s.prototype._new=function(e){return new s(e)},s.prototype._write=function(e,t,r){this._appendBuffer(e),"function"==typeof r&&r()},s.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},s.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},s.prototype._isBufferList=function(e){return e instanceof s||e instanceof o||s.isBufferList(e)},s.isBufferList=o.isBufferList,e.exports=s,e.exports.BufferListStream=s,e.exports.BufferList=o},9183:(e,t,r)=>{var n=r(8752),i=r(6701),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(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 h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|g(e,t),n=a(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(z(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(z(e,ArrayBuffer)||e&&z(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(z(e,SharedArrayBuffer)||e&&z(e.buffer,SharedArrayBuffer)))return d(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 c.from(n,t,r);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||V(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.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 l(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 h(e){return l(e),a(e<0?0:0|p(e))}function f(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(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;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(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 U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(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 P(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(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),V(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=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:b(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):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var o,s=1,a=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;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var h=!0,f=0;f<c;f++)if(u(e,o+f)!==u(t,f)){h=!1;break}if(h)return o}return-1}function w(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(V(a))return s;e[r+s]=a}return s}function _(e,t,r,n){return F(U(t,e.length-r),e,r,n)}function k(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return F(j(t),e,r,n)}function E(e,t,r,n){return F(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=A));return r}(n)}t.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.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,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=c.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(z(o,Uint8Array))i+o.length>n.length?c.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},c.byteLength=g,c.prototype._isBuffer=!0,c.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)y(this,t,t+1);return this},c.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)y(this,t,t+3),y(this,t+1,t+2);return this},c.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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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 o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r),h=0;h<a;++h)if(u[h]!==l[h]){o=u[h],s=l[h];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},c.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 o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return k(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function x(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 I(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 P(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=q[e[o]];return i}function R(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function M(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 O(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,o){return t=+t,r>>>=0,o||B(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,o){return t=+t,r>>>=0,o||B(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.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 Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.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;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},c.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&&!c.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:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=c.isBuffer(e)?e:c.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var D=/[^+/0-9A-Za-z-_]/g;function U(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function j(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(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 z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function V(e){return e!=e}var q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},2577:(e,t,r)=>{var n=r(8752),i=r(6701);t.Buffer=a,t.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},t.INSPECT_MAX_BYTES=50;var o=2147483647;function s(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(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 l(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(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|d(e,t),n=s(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return h(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(z(e,ArrayBuffer)||e&&z(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__=a.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 a.from(n,t,r);var i=function(e){if(a.isBuffer(e)){var t=0|f(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||V(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.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 l(e){return u(e),s(e<0?0:0|f(e))}function h(e){for(var t=e.length<0?0:0|f(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function d(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(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 U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function p(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 I(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(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),V(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=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(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):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,s=1,a=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;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var h=!0,f=0;f<c;f++)if(u(e,o+f)!==u(t,f)){h=!1;break}if(h)return o}return-1}function v(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(V(a))return s;e[r+s]=a}return s}function b(e,t,r,n){return F(U(t,e.length-r),e,r,n)}function w(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r,n){return w(e,t,r,n)}function k(e,t,r,n){return F(j(t),e,r,n)}function S(e,t,r,n){return F(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function C(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}t.kMaxLength=o,a.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}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(e,t,r){return c(e,t,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},a.allocUnsafe=function(e){return l(e)},a.allocUnsafeSlow=function(e){return l(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),z(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.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,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(z(o,Uint8Array)&&(o=a.from(o)),!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.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)g(this,t,t+1);return this},a.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)g(this,t,t+3),g(this,t+1,t+2);return this},a.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)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):p.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a.prototype.compare=function(e,t,r,n,i){if(z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.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 o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r),h=0;h<c;++h)if(u[h]!==l[h]){o=u[h],s=l[h];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},a.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 o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return _(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(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function A(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 x(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 I(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=D(e[o]);return i}function P(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function R(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 M(e,t,r,n,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)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,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function N(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}a.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__=a.prototype,n},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||R(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||R(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||R(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||R(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||R(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||R(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.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 o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.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&&!a.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 o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),c=s.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%c]}return this};var L=/[^+/0-9A-Za-z-_]/g;function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function j(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 F(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 z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function V(e){return e!=e}},659:(e,t,r)=>{var n=r(3908);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 n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==n&&"env"in n&&(e=n.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;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+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.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`."))}})(),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=r(8798)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},8798:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(r||i);n.diff=o,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(7103),t.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(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}},3521:(e,t,r)=>{var n=r(2577).Buffer,i=r(3908),o=r(1181),s=r(8717),a=r(6371),c=r(3462),u=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),l=function(e,t){e._corked?e.once("uncork",t):t()},h=function(e,t){return function(r){r?function(e,t){e._autoDestroy&&e.destroy(t)}(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},f=function(){},d=function(e,t,r){if(!(this instanceof d))return new d(e,t,r);o.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};a(d,o.Duplex),d.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new d(e,t,r)},d.prototype.cork=function(){1==++this._corked&&this.emit("cork")},d.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},d.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,r=s(e,{writable:!0,readable:!1},h(this,this._forwardEnd)),n=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&i.nextTick(n),this._writable=e,this._writable.on("drain",n),this._unwrite=function(){t._writable.removeListener("drain",n),r()},this.uncork()}else this.end()},d.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t,r=this,n=s(e,{writable:!1,readable:!0},h(this)),i=function(){r._forward()},a=function(){r.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:(t=e,new o.Readable({objectMode:!0,highWaterMark:16}).wrap(t)),this._readable2.on("readable",i),this._readable2.on("end",a),this._unread=function(){r._readable2.removeListener("readable",i),r._readable2.removeListener("end",a),n()},this._forward()}},d.prototype._read=function(){this._drained=!0,this._forward()},d.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=c(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},d.prototype.destroy=function(e,t){if(t||(t=f),this.destroyed)return t(null);this.destroyed=!0;var r=this;i.nextTick((function(){r._destroy(e),t(null)}))},d.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},d.prototype._write=function(e,t,r){if(!this.destroyed)return this._corked?l(this,this._write.bind(this,e,t,r)):e===u?this._finish(r):this._writable?void(!1===this._writable.write(e)?this._ondrain=r:this.destroyed||r()):r()},d.prototype._finish=function(e){var t=this;this.emit("preend"),l(this,(function(){var r,n;r=t._forwardEnd&&t._writable,n=function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),l(t,e)},r?r._writableState&&r._writableState.finished?n():r._writableState?r.end(n):(r.end(),n()):n()}))},d.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(u),o.Writable.prototype.end.call(this,r))},e.exports=d},8717:(e,t,r)=>{var n=r(3908),i=r(8377),o=function(){},s=function(e,t,r){if("function"==typeof t)return s(e,null,t);t||(t={}),r=i(r||o);var a=e._writableState,c=e._readableState,u=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,h=!1,f=function(){e.writable||d()},d=function(){l=!1,u||r.call(e)},p=function(){u=!1,l||r.call(e)},g=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){r.call(e,t)},y=function(){n.nextTick(v)},v=function(){if(!h)return(!u||c&&c.ended&&!c.destroyed)&&(!l||a&&a.ended&&!a.destroyed)?void 0:r.call(e,new Error("premature close"))},b=function(){e.req.on("finish",d)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?l&&!a&&(e.on("end",f),e.on("close",f)):(e.on("complete",d),e.on("abort",y),e.req?b():e.on("request",b)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",g),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",m),e.on("close",y),function(){h=!0,e.removeListener("complete",d),e.removeListener("abort",y),e.removeListener("request",b),e.req&&e.req.removeListener("finish",d),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",d),e.removeListener("exit",g),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",y)}};e.exports=s},9273:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){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 h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function f(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):p(i,i.length)}function d(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 p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(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(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.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},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(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},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(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,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;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,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.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,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[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},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},6701:(e,t)=>{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*g}},6371:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},310:(e,t,r)=>{r.d(t,{NZ:()=>k});var n=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function a(e){var t=this;void 0===e&&(e=[]);var r=0,a=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,a.length=0},this.front=function(){if(!this.empty())return a[0]},this.back=function(){if(!this.empty())return a[r-1]},this.forEach=function(e){a.forEach(e)},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");return a[e]},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");for(var t=e;t<r-1;++t)a[t]=a[t+1];this.popBack()},this.eraseElementByValue=function(e){var t=[];this.forEach((function(r){r!==e&&t.push(r)})),t.forEach((function(e,t){a[t]=e}));for(var n=t.length;r>n;)this.popBack()},this.pushBack=function(e){a.push(e),++r},this.popBack=function(){a.pop(),r>0&&--r},this.setElementByPos=function(e,t){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");a[e]=t},this.insert=function(e,t,n){if(void 0===n&&(n=1),e<0||e>r)throw new Error("pos must more than 0 and less than or equal to vector's size");a.splice.apply(a,o([e,0],i(new Array(n).fill(t)),!1)),r+=n},this.find=function(e){return a.includes(e)},this.reverse=function(){a.reverse()},this.unique=function(){var e,t=[];this.forEach((function(r,n){0!==n&&r===e||(t.push(r),e=r)})),t.forEach((function(e,t){a[t]=e}));for(var n=t.length;r>n;)this.popBack()},this.sort=function(e){a.sort(e)},this[Symbol.iterator]=function(){return function(){return n(this,(function(e){switch(e.label){case 0:return[5,s(a)];case 1:return[2,e.sent()]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.freeze(a);function c(e){var t=this;void 0===e&&(e=[]);var r=0,n=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,n.length=0},this.push=function(e){n.push(e),++r},this.pop=function(){n.pop(),r>0&&--r},this.top=function(){return n[r-1]},e.forEach((function(e){return t.push(e)})),Object.freeze(this)}Object.freeze(c);var u=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},l=function(e){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=e};function h(e){var t=this;void 0===e&&(e=[]);var r=0,n=void 0,i=void 0;this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){n=i=void 0,r=0},this.front=function(){return null==n?void 0:n.value},this.back=function(){return null==i?void 0:i.value},this.forEach=function(e){for(var t=n,r=0;t;){if(void 0===t.value)throw new Error("unknown error");e(t.value,r++),t=t.next}},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var t=n;e--&&t;)t=t.next;if(!t||void 0===t.value)throw new Error("unknown error");return t.value},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("erase pos must more then 0 and less then the list length");if(0===e)this.popFront();else if(e===r-1)this.popBack();else{for(var t=n;e--;){if(!(null==t?void 0:t.next))throw new Error("unknown error");t=t.next}if(!t||!t.pre||!t.next)throw new Error("unknown error");var i=t.pre,o=t.next;o.pre=i,i.next=o,r>0&&--r}},this.eraseElementByValue=function(e){for(;n&&n.value===e;)this.popFront();for(;i&&i.value===e;)this.popBack();if(n)for(var t=n;t;){if(t.value===e){var o=t.pre,s=t.next;s&&(s.pre=o),o&&(o.next=s),r>0&&--r}t=t.next}},this.pushBack=function(e){if(null==e)throw new Error("you can't push null or undefined here");++r;var t=new l(e);i?(i.next=t,t.pre=i,i=t):n=i=t},this.popBack=function(){i&&(r>0&&--r,i&&(n===i?n=i=void 0:(i=i.pre)&&(i.next=void 0)))},this.setElementByPos=function(e,t){if(null==t)throw new Error("you can't set null or undefined here");if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var i=n;e--;){if(!i)throw new Error("unknown error");i=i.next}i&&(i.value=t)},this.insert=function(e,t,i){if(void 0===i&&(i=1),null==t)throw new Error("you can't insert null or undefined here");if(e<0||e>r)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(i<0)throw new Error("insert size must more than 0");if(0===e)for(;i--;)this.pushFront(t);else if(e===r)for(;i--;)this.pushBack(t);else{for(var o=n,s=1;s<e;++s){if(!(null==o?void 0:o.next))throw new Error("unknown error");o=null==o?void 0:o.next}if(!o)throw new Error("unknown error");var a=o.next;for(r+=i;i--;)o.next=new l(t),o.next.pre=o,o=o.next;o.next=a,a&&(a.pre=o)}},this.find=function(e){for(var t=n;t;){if(t.value===e)return!0;t=t.next}return!1},this.reverse=function(){for(var e=n,t=i,o=0;e&&t&&2*o<r;){var s=e.value;e.value=t.value,t.value=s,e=e.next,t=t.pre,++o}},this.unique=function(){for(var e=n;e;){for(var t=e;t&&t.next&&t.value===t.next.value;)t=t.next,r>0&&--r;e.next=t.next,e.next&&(e.next.pre=e),e=e.next}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);var r=n;t.forEach((function(e){r&&(r.value=e,r=r.next)}))},this.pushFront=function(e){if(null==e)throw new Error("you can't push null or undefined here");++r;var t=new l(e);n?(t.next=n,n.pre=t,n=t):n=i=t},this.popFront=function(){n&&(r>0&&--r,n&&(n===i?n=i=void 0:(n=n.next)&&(n.pre=void 0)))},this.merge=function(e){var t=this,o=n;e.forEach((function(e){for(;o&&void 0!==o.value&&o.value<=e;)o=o.next;if(void 0===o)t.pushBack(e),o=i;else if(o===n)t.pushFront(e),o=n;else{++r;var s=o.pre;s&&(s.next=new l(e),s.next.pre=s,s.next.next=o,o&&(o.pre=s.next))}}))},this[Symbol.iterator]=function(){return function(){var e;return u(this,(function(t){switch(t.label){case 0:e=n,t.label=1;case 1:if(void 0===e)return[3,3];if(!e.value)throw new Error("unknown error");return[4,e.value];case 2:return t.sent(),e=e.next,[3,1];case 3:return[2]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.freeze(h);const f=h;function d(e){void 0===e&&(e=[]);var t=new f(e);this.size=function(){return t.size()},this.empty=function(){return t.empty()},this.clear=function(){t.clear()},this.push=function(e){t.pushBack(e)},this.pop=function(){t.popFront()},this.front=function(){return t.front()},Object.freeze(this)}Object.freeze(d);var p=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function g(e){var t=this;void 0===e&&(e=[]);var r=[],n=0,i=0,o=0,s=0,a=0,c=0;this.size=function(){return c},this.empty=function(){return 0===c},this.clear=function(){n=o=i=s=a=c=0,l.call(this,g.bucketSize),c=0},this.front=function(){return r[n][i]},this.back=function(){return r[o][s]},this.forEach=function(e){if(!this.empty()){var t=0;if(n!==o){for(c=i;c<g.bucketSize;++c)e(r[n][c],t++);for(c=n+1;c<o;++c)for(var a=0;a<g.bucketSize;++a)e(r[c][a],t++);for(c=0;c<=s;++c)e(r[o][c],t++)}else for(var c=i;c<=s;++c)e(r[n][c],t++)}};var u=function(e){var t=n*g.bucketSize+i,r=t+e,a=o*g.bucketSize+s;if(r<t||r>a)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(r/g.bucketSize),curNodePointerIndex:r%g.bucketSize}};this.getElementByPos=function(e){var t=u(e),n=t.curNodeBucketIndex,i=t.curNodePointerIndex;return r[n][i]},this.eraseElementByPos=function(e){var t=this;if(e<0||e>c)throw new Error("pos should more than 0 and less than queue's size");if(0===e)this.popFront();else if(e===this.size())this.popBack();else{for(var r=[],n=e+1;n<c;++n)r.push(this.getElementByPos(n));this.cut(e),this.popBack(),r.forEach((function(e){return t.pushBack(e)}))}},this.eraseElementByValue=function(e){if(!this.empty()){var t=[];this.forEach((function(r){r!==e&&t.push(r)}));for(var r=t.length,n=0;n<r;++n)this.setElementByPos(n,t[n]);this.cut(r-1)}};var l=function(e){for(var t=[],u=e*g.sigma,l=Math.max(Math.ceil(u/g.bucketSize),2),h=0;h<l;++h)t.push(new Array(g.bucketSize));var f=Math.ceil(e/g.bucketSize),d=Math.floor(l/2)-Math.floor(f/2),p=d,m=0;if(this.size())for(h=0;h<f;++h){for(var y=0;y<g.bucketSize;++y)if(t[d+h][y]=this.front(),this.popFront(),this.empty()){p=d+h,m=y;break}if(this.empty())break}r=t,n=d,i=0,o=p,s=m,a=l,c=e};this.pushBack=function(e){this.empty()||(o===a-1&&s===g.bucketSize-1&&l.call(this,this.size()),s<g.bucketSize-1?++s:o<a-1&&(++o,s=0)),++c,r[o][s]=e},this.popBack=function(){this.empty()||(1!==this.size()&&(s>0?--s:n<o&&(--o,s=g.bucketSize-1)),c>0&&--c)},this.setElementByPos=function(e,t){var n=u(e),i=n.curNodeBucketIndex,o=n.curNodePointerIndex;r[i][o]=t},this.insert=function(e,t,r){var n=this;if(void 0===r&&(r=1),0===e)for(;r--;)this.pushFront(t);else if(e===this.size())for(;r--;)this.pushBack(t);else{for(var i=[],o=e;o<c;++o)i.push(this.getElementByPos(o));this.cut(e-1);for(o=0;o<r;++o)this.pushBack(t);i.forEach((function(e){return n.pushBack(e)}))}},this.find=function(e){if(n===o){for(var t=i;t<=s;++t)if(r[n][t]===e)return!0;return!1}for(t=i;t<g.bucketSize;++t)if(r[n][t]===e)return!0;for(t=n+1;t<o;++t)for(var a=0;a<g.bucketSize;++a)if(r[t][a]===e)return!0;for(t=0;t<=s;++t)if(r[o][t]===e)return!0;return!1},this.reverse=function(){for(var e=0,t=c-1;e<t;){var r=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,r),++e,--t}},this.unique=function(){if(!this.empty()){var e=[],t=this.front();this.forEach((function(r,n){0!==n&&r===t||(e.push(r),t=r)}));for(var r=0;r<c;++r)this.setElementByPos(r,e[r]);this.cut(e.length-1)}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);for(var r=0;r<c;++r)this.setElementByPos(r,t[r])},this.pushFront=function(e){this.empty()||(0===n&&0===i&&l.call(this,this.size()),i>0?--i:n>0&&(--n,i=g.bucketSize-1)),++c,r[n][i]=e},this.popFront=function(){this.empty()||(1!==this.size()&&(i<g.bucketSize-1?++i:n<o&&(++n,i=0)),c>0&&--c)},this.shrinkToFit=function(){var e=this,t=[];this.forEach((function(e){t.push(e)}));var n=t.length;r=[];for(var i=Math.ceil(n/g.bucketSize),o=0;o<i;++o)r.push(new Array(g.bucketSize));this.clear(),t.forEach((function(t){return e.pushBack(t)}))},this.cut=function(e){if(e<0)this.clear();else{var t=u(e),r=t.curNodeBucketIndex,n=t.curNodePointerIndex;o=r,s=n,c=e+1}},this[Symbol.iterator]=function(){return function(){var e,t;return p(this,(function(a){switch(a.label){case 0:if(0===c)return[2];if(n!==o)return[3,5];t=i,a.label=1;case 1:return t<=s?[4,r[n][t]]:[3,4];case 2:a.sent(),a.label=3;case 3:return++t,[3,1];case 4:return[2];case 5:t=i,a.label=6;case 6:return t<g.bucketSize?[4,r[n][t]]:[3,9];case 7:a.sent(),a.label=8;case 8:return++t,[3,6];case 9:t=n+1,a.label=10;case 10:if(!(t<o))return[3,15];e=0,a.label=11;case 11:return e<g.bucketSize?[4,r[t][e]]:[3,14];case 12:a.sent(),a.label=13;case 13:return++e,[3,11];case 14:return++t,[3,10];case 15:t=0,a.label=16;case 16:return t<=s?[4,r[o][t]]:[3,19];case 17:a.sent(),a.label=18;case 18:return++t,[3,16];case 19:return[2]}}))}()},function(){var i=g.bucketSize;e.size?i=e.size():e.length&&(i=e.length);var s=i*g.sigma;a=Math.ceil(s/g.bucketSize),a=Math.max(a,3);for(var c=0;c<a;++c)r.push(new Array(g.bucketSize));var u=Math.ceil(i/g.bucketSize);n=Math.floor(a/2)-Math.floor(u/2),o=n,e.forEach((function(e){return t.pushBack(e)}))}(),Object.freeze(this)}g.sigma=3,g.bucketSize=5e3,Object.freeze(g);function m(e,t){void 0===e&&(e=[]),t=t||function(e,t){return e>t?-1:e<t?1:0};var r=[];e.forEach((function(e){return r.push(e)}));var n=r.length,i=function(e,t){if(e<0||e>=n)throw new Error("unknown error");if(t<0||t>=n)throw new Error("unknown error");var i=r[e];r[e]=r[t],r[t]=i},o=function(e){if(e<0||e>=n)throw new Error("unknown error");var o=2*e+1,s=2*e+2;o<n&&t(r[e],r[o])>0&&i(e,o),s<n&&t(r[e],r[s])>0&&i(e,s)};!function(){for(var e=Math.floor((n-1)/2);e>=0;--e)for(var o=e,s=2*o+1;s<n;){var a=s+1,c=s;if(a<n&&t(r[s],r[a])>0&&(c=a),t(r[o],r[c])<=0)break;i(o,c),s=2*(o=c)+1}}(),this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,r.length=0},this.push=function(e){if(r.push(e),1!==++n)for(var i=n-1;i>0;){var s=Math.floor((i-1)/2);if(t(r[s],e)<=0)break;o(s),i=s}},this.pop=function(){if(!this.empty())if(1!==this.size()){var e=r[n-1];--n;for(var i=0;i<this.size();){var o=2*i+1,s=2*i+2;if(o>=this.size())break;var a=o;if(s<this.size()&&t(r[o],r[s])>0&&(a=s),t(r[a],e)>=0)break;r[i]=r[a],i=a}r[i]=e}else--n},this.top=function(){return r[0]},Object.freeze(this)}Object.freeze(m);var y=function(){function e(e,t){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=e,this.value=t}return e.prototype.rotateLeft=function(){var e=this.parent,t=this.brother,r=this.leftChild,n=this.rightChild;if(!n)throw new Error("unknown error");var i=n.leftChild,o=n.rightChild;return e&&(e.leftChild===this?e.leftChild=n:e.rightChild===this&&(e.rightChild=n)),n.parent=e,n.brother=t,n.leftChild=this,n.rightChild=o,t&&(t.brother=n),this.parent=n,this.brother=o,this.leftChild=r,this.rightChild=i,o&&(o.parent=n,o.brother=this),r&&(r.parent=this,r.brother=i),i&&(i.parent=this,i.brother=r),n},e.prototype.rotateRight=function(){var e=this.parent,t=this.brother,r=this.leftChild;if(!r)throw new Error("unknown error");var n=this.rightChild,i=r.leftChild,o=r.rightChild;return e&&(e.leftChild===this?e.leftChild=r:e.rightChild===this&&(e.rightChild=r)),r.parent=e,r.brother=t,r.leftChild=i,r.rightChild=this,t&&(t.brother=r),i&&(i.parent=r,i.brother=this),this.parent=r,this.brother=i,this.leftChild=o,this.rightChild=n,o&&(o.parent=this,o.brother=n),n&&(n.parent=this,n.brother=o),r},e.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},e.TreeNodeColorType={red:!0,black:!1},e}();Object.freeze(y);const v=y;var b=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},w=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function _(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var n=0,i=new v;i.color=v.TreeNodeColorType.black,this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,i.key=void 0,i.leftChild=i.rightChild=i.brother=i.parent=void 0,i.color=v.TreeNodeColorType.black};var o=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?o(e.leftChild):e},s=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?s(e.rightChild):e};this.front=function(){if(!this.empty())return o(i).key},this.back=function(){if(!this.empty())return s(i).key},this.forEach=function(e){var t,r,n=0;try{for(var i=w(this),o=i.next();!o.done;o=i.next()){e(o.value,n++)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var i=w(this),o=i.next();!o.done;o=i.next()){var s=o.value;if(n===e)return s;++n}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}throw new Error("unknown error")};var a=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(e.color!==v.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild){if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;var n=t.rotateLeft();i===t&&(i=n),a(e)}else if(r.color===v.TreeNodeColorType.black)if(r.rightChild&&r.rightChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=t.rotateLeft();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,a(t));else{r.color=v.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=r.rotateRight();i===r&&(i=n),a(e)}}else if(e===t.rightChild)if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;n=t.rotateRight();i===t&&(i=n),a(e)}else if(r.color===v.TreeNodeColorType.black)if(r.leftChild&&r.leftChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=t.rotateRight();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,a(t));else{r.color=v.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=r.rotateLeft();i===r&&(i=n),a(e)}}else e.color=v.TreeNodeColorType.black},c=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=o(t.rightChild);var r=e.key;e.key=t.key,t.key=r,e=t}if(t.leftChild){t=s(t.leftChild);r=e.key;e.key=t.key,t.key=r,e=t}}a(t),t&&t.remove(),--n,i.color=v.TreeNodeColorType.black},u=function(e,t){return!(!e||void 0===e.key)&&(!!u(e.leftChild,t)||(!!t(e)||u(e.rightChild,t)))};this.eraseElementByPos=function(e){if(e<0||e>=n)throw new Error("pos must more than 0 and less than set's size");var t=0;u(i,(function(r){return e===t?(c(r),!0):(++t,!1)}))},this.eraseElementByValue=function(e){if(!this.empty()){var r=f(i,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&c(r)}};var l=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?l(e.leftChild,r):(e.leftChild=new v,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?l(e.rightChild,r):(e.rightChild=new v,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},h=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(t.color!==v.TreeNodeColorType.black&&t.color===v.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===v.TreeNodeColorType.red)r.color=t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red,h(n);else if(!r||r.color===v.TreeNodeColorType.black)if(t===n.leftChild){if(e===t.leftChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;var o=n.rotateRight();n===i&&(i=o)}else if(e===t.rightChild){o=t.rotateLeft();n===i&&(i=o),h(t)}}else if(t===n.rightChild)if(e===t.leftChild){o=t.rotateRight();n===i&&(i=o),h(t)}else if(e===t.rightChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;o=n.rotateLeft();n===i&&(i=o)}}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++n,i.key=e,void(i.color=v.TreeNodeColorType.black);var r=l(i,e);void 0!==r.key&&0===t(r.key,e)||(++n,r.key=e,h(r),i.color=v.TreeNodeColorType.black)};var f=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?f(e.leftChild,r):n>0?f(e.rightChild,r):e}};this.find=function(e){var r=f(i,e);return void 0!==r&&void 0!==r.key&&0===t(r.key,e)};var d=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);if(0===n)return e.key;if(n<0)return d(e.rightChild,r);var i=d(e.leftChild,r);return void 0!==i?i:e.key}};this.lowerBound=function(e){return d(i,e)};var p=function(e,r){if(e&&void 0!==e.key){if(t(e.key,r)<=0)return p(e.rightChild,r);var n=p(e.leftChild,r);return void 0!==n?n:e.key}};this.upperBound=function(e){return p(i,e)};var g=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);if(0===n)return e.key;if(n>0)return g(e.leftChild,r);var i=g(e.rightChild,r);return void 0!==i?i:e.key}};this.reverseLowerBound=function(e){return g(i,e)};var m=function(e,r){if(e&&void 0!==e.key){if(t(e.key,r)>=0)return m(e.leftChild,r);var n=m(e.rightChild,r);return void 0!==n?n:e.key}};this.reverseUpperBound=function(e){return m(i,e)},this.union=function(e){var t=this;e.forEach((function(e){return t.insert(e)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(i)};var y=function(e){return b(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key?[5,w(y(e.leftChild))]:[2];case 1:return t.sent(),[4,e.key];case 2:return t.sent(),[5,w(y(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return y(i)},e.forEach((function(e){return r.insert(e)})),Object.freeze(this)}Object.freeze(_);const k=_;var S=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},E=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function C(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var n=0,i=new v;i.color=v.TreeNodeColorType.black,this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,i.key=i.value=void 0,i.leftChild=i.rightChild=i.brother=void 0};var o=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?o(e.leftChild):e},s=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?s(e.rightChild):e};this.front=function(){if(!this.empty()){var e=o(i);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.back=function(){if(!this.empty()){var e=s(i);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.forEach=function(e){var t,r,n=0;try{for(var i=E(this),o=i.next();!o.done;o=i.next()){e(o.value,n++)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var i=E(this),o=i.next();!o.done;o=i.next()){var s=o.value;if(n===e)return s;++n}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}throw new Error("unknown Error")};var a=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n<0?a(e.rightChild,r):a(e.leftChild,r)||{key:e.key,value:e.value}}};this.lowerBound=function(e){return a(i,e)};var c=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)<=0?c(e.rightChild,r):c(e.leftChild,r)||{key:e.key,value:e.value}};this.upperBound=function(e){return c(i,e)};var u=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n>0?u(e.leftChild,r):u(e.rightChild,r)||{key:e.key,value:e.value}}};this.reverseLowerBound=function(e){return u(i,e)};var l=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)>=0?l(e.leftChild,r):l(e.rightChild,r)||{key:e.key,value:e.value}};this.reverseUpperBound=function(e){return l(i,e)};var h=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(e.color!==v.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild){if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;var n=t.rotateLeft();i===t&&(i=n),h(e)}else if(r.color===v.TreeNodeColorType.black)if(r.rightChild&&r.rightChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=t.rotateLeft();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,h(t));else{r.color=v.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=r.rotateRight();i===r&&(i=n),h(e)}}else if(e===t.rightChild)if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;n=t.rotateRight();i===t&&(i=n),h(e)}else if(r.color===v.TreeNodeColorType.black)if(r.leftChild&&r.leftChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=t.rotateRight();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,h(t));else{r.color=v.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=r.rotateLeft();i===r&&(i=n),h(e)}}else e.color=v.TreeNodeColorType.black},f=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=o(t.rightChild);var r=e.key;e.key=t.key,t.key=r;var a=e.value;e.value=t.value,t.value=a,e=t}if(t.leftChild){t=s(t.leftChild);r=e.key;e.key=t.key,t.key=r;a=e.value;e.value=t.value,t.value=a,e=t}}h(t),t&&t.remove(),--n,i.color=v.TreeNodeColorType.black},d=function(e,t){return!(!e||void 0===e.key)&&(!!d(e.leftChild,t)||(!!t(e)||d(e.rightChild,t)))};this.eraseElementByPos=function(e){if(e<0||e>=n)throw new Error("pos must more than 0 and less than set's size");var t=0;d(i,(function(r){return e===t?(f(r),!0):(++t,!1)}))},this.eraseElementByKey=function(e){if(!this.empty()){var r=m(i,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&f(r)}};var p=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?p(e.leftChild,r):(e.leftChild=new v,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?p(e.rightChild,r):(e.rightChild=new v,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},g=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(t.color!==v.TreeNodeColorType.black&&t.color===v.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===v.TreeNodeColorType.red)r.color=t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red,g(n);else if(!r||r.color===v.TreeNodeColorType.black)if(t===n.leftChild){if(e===t.leftChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;var o=n.rotateRight();n===i&&(i=o)}else if(e===t.rightChild){o=t.rotateLeft();n===i&&(i=o),g(t)}}else if(t===n.rightChild)if(e===t.leftChild){o=t.rotateRight();n===i&&(i=o),g(t)}else if(e===t.rightChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;o=n.rotateLeft();n===i&&(i=o)}}};this.setElement=function(e,r){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=r){if(this.empty())return++n,i.key=e,i.value=r,void(i.color=v.TreeNodeColorType.black);var o=p(i,e);void 0===o.key||0!==t(o.key,e)?(++n,o.key=e,o.value=r,g(o),i.color=v.TreeNodeColorType.black):o.value=r}else this.eraseElementByKey(e)};var m=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?m(e.leftChild,r):n>0?m(e.rightChild,r):e}};this.find=function(e){return!!m(i,e)},this.getElementByKey=function(e){var t=m(i,e);if(void 0===(null==t?void 0:t.key)||void 0===(null==t?void 0:t.value))throw new Error("unknown error");return t.value},this.union=function(e){var t=this;e.forEach((function(e){var r=e.key,n=e.value;return t.setElement(r,n)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(i)};var y=function(e){return S(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key&&void 0!==e.value?[5,E(y(e.leftChild))]:[2];case 1:return t.sent(),[4,{key:e.key,value:e.value}];case 2:return t.sent(),[5,E(y(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return y(i)},e.forEach((function(e){var t=e.key,n=e.value;return r.setElement(t,n)})),Object.freeze(this)}Object.freeze(C);const T=C;var A=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},x=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function I(e,t,r){var n=this;if(void 0===e&&(e=[]),void 0===t&&(t=I.initSize),r=r||function(e){var t=0,r="";if("number"==typeof e)t=((t=Math.floor(e))<<5)-t,t|=0;else{r="string"!=typeof e?JSON.stringify(e):e;for(var n=0;n<r.length;n++){t=(t<<5)-t+r.charCodeAt(n),t|=0}}return t^=t>>>16},t&t-1)throw new Error("initBucketNum must be 2 to the power of n");var i=0,o=[],s=Math.max(I.initSize,Math.min(I.maxSize,t));this.size=function(){return i},this.empty=function(){return 0===i},this.clear=function(){i=0,s=t,o=[]},this.forEach=function(e){var t=0;o.forEach((function(r){r.forEach((function(r){e(r,t++)}))}))};var a=function(e){if(!(e>=I.maxSize)){s=2*e;var t=[];o.forEach((function(n,i){if(!n.empty()){if(n instanceof f&&1===n.size()){var a=n.front();if(void 0===a)throw new Error("unknown error");t[r(a)&s-1]=new f([a])}else if(n instanceof k){var c=new f,u=new f;n.forEach((function(t){r(t)&e?u.pushBack(t):c.pushBack(t)})),c.size()>I.untreeifyThreshold?t[i]=new k(c):c.size()&&(t[i]=c),u.size()>I.untreeifyThreshold?t[i+e]=new k(u):u.size()&&(t[i+e]=u)}else{var l=new f,h=new f;n.forEach((function(t){r(t)&e?h.pushBack(t):l.pushBack(t)})),l.size()&&(t[i]=l),h.size()&&(t[i+e]=h)}o[i].clear()}})),o=t}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var t=r(e)&s-1;if(o[t]){var n=o[t].size();if(o[t]instanceof f){if(o[t].find(e))return;o[t].pushBack(e),o[t].size()>=I.treeifyThreshold&&(o[t]=new k(o[t]))}else o[t].insert(e);var c=o[t].size();i+=c-n}else o[t]=new f([e]),++i;i>s*I.sigma&&a.call(this,s)},this.eraseElementByValue=function(e){var t=r(e)&s-1;if(o[t]){var n=o[t].size();o[t].eraseElementByValue(e),o[t]instanceof k&&o[t].size()<=I.untreeifyThreshold&&(o[t]=new f(o[t]));var a=o[t].size();i+=a-n}},this.find=function(e){var t=r(e)&s-1;return!!o[t]&&o[t].find(e)},this[Symbol.iterator]=function(){return function(){var e,t,r,n,i,a;return A(this,(function(c){switch(c.label){case 0:e=0,c.label=1;case 1:if(!(e<s))return[3,10];for(;e<s&&!o[e];)++e;if(e>=s)return[3,10];c.label=2;case 2:c.trys.push([2,7,8,9]),i=void 0,t=x(o[e]),r=t.next(),c.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:c.sent(),c.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return n=c.sent(),i={error:n},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){return n.insert(e)})),Object.freeze(this)}I.initSize=16,I.maxSize=1<<30,I.sigma=.75,I.treeifyThreshold=8,I.untreeifyThreshold=6,I.minTreeifySize=64,Object.freeze(I);var P=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},R=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function M(e,t,r){var n=this;if(void 0===e&&(e=[]),void 0===t&&(t=M.initSize),r=r||function(e){var t,r,n=0,i="";if("number"==typeof e)n=((n=Math.floor(e))<<5)-n,n|=0;else{i="string"!=typeof e?JSON.stringify(e):e;try{for(var o=R(i),s=o.next();!s.done;s=o.next()){n=(n<<5)-n+s.value.charCodeAt(0),n|=0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}return n^=n>>>16},t&t-1)throw new Error("initBucketNum must be 2 to the power of n");var i=0,o=[],s=Math.max(M.initSize,Math.min(M.maxSize,t));this.size=function(){return i},this.empty=function(){return 0===i},this.clear=function(){i=0,s=t,o=[]},this.forEach=function(e){var t=0;o.forEach((function(r){r.forEach((function(r){e(r,t++)}))}))};var a=function(e){if(!(e>=M.maxSize)){s=2*e;var t=[];o.forEach((function(n,i){if(!n.empty()){if(n instanceof f&&1===n.size()){var a=n.front(),c=a.key,u=a.value;t[r(c)&s-1]=new f([{key:c,value:u}])}else if(n instanceof T){var l=new f,h=new f;n.forEach((function(t){r(t.key)&e?h.pushBack(t):l.pushBack(t)})),l.size()>M.untreeifyThreshold?t[i]=new T(l):l.size()&&(t[i]=l),h.size()>M.untreeifyThreshold?t[i+e]=new T(h):h.size()&&(t[i+e]=h)}else{var d=new f,p=new f;n.forEach((function(t){r(t.key)&e?p.pushBack(t):d.pushBack(t)})),d.size()&&(t[i]=d),p.size()&&(t[i+e]=p)}o[i].clear()}})),o=t}};this.setElement=function(e,t){var n,c;if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=t){var u=r(e)&s-1;if(o[u]){var l=o[u].size();if(o[u]instanceof f){try{for(var h=R(o[u]),d=h.next();!d.done;d=h.next()){var p=d.value;if(p.key===e)return void(p.value=t)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(c=h.return)&&c.call(h)}finally{if(n)throw n.error}}o[u].pushBack({key:e,value:t}),o[u].size()>=M.treeifyThreshold&&(o[u]=new T(o[u]))}else o[u].setElement(e,t);var g=o[u].size();i+=g-l}else++i,o[u]=new f([{key:e,value:t}]);i>s*M.sigma&&a.call(this,s)}else this.eraseElementByKey(e)},this.getElementByKey=function(e){var t,n,i=r(e)&s-1;if(o[i]){if(o[i]instanceof T)return o[i].getElementByKey(e);try{for(var a=R(o[i]),c=a.next();!c.done;c=a.next()){var u=c.value;if(u.key===e)return u.value}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},this.eraseElementByKey=function(e){var t,n,a=r(e)&s-1;if(o[a]){var c=o[a].size();if(o[a]instanceof T)o[a].eraseElementByKey(e),o[a].size()<=M.untreeifyThreshold&&(o[a]=new f(o[a]));else{var u=-1;try{for(var l=R(o[a]),h=l.next();!h.done;h=l.next()){var d=h.value;if(++u,d.key===e){o[a].eraseElementByPos(u);break}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}}var p=o[a].size();i+=p-c}},this.find=function(e){var t,n,i=r(e)&s-1;if(!o[i])return!1;if(o[i]instanceof T)return o[i].find(e);try{for(var a=R(o[i]),c=a.next();!c.done;c=a.next()){if(c.value.key===e)return!0}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return!1},this[Symbol.iterator]=function(){return function(){var e,t,r,n,i,a;return P(this,(function(c){switch(c.label){case 0:e=0,c.label=1;case 1:if(!(e<s))return[3,10];for(;e<s&&!o[e];)++e;if(e>=s)return[3,10];c.label=2;case 2:c.trys.push([2,7,8,9]),i=void 0,t=R(o[e]),r=t.next(),c.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:c.sent(),c.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return n=c.sent(),i={error:n},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){var t=e.key,r=e.value;return n.setElement(t,r)})),Object.freeze(this)}M.initSize=16,M.maxSize=1<<30,M.sigma=.75,M.treeifyThreshold=8,M.untreeifyThreshold=6,M.minTreeifySize=64,Object.freeze(M)},8103:(e,t,r)=>{const n=r(601),i=Symbol("max"),o=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),h=Symbol("lruList"),f=Symbol("cache"),d=Symbol("updateAgeOnGet"),p=()=>1;const g=(e,t,r)=>{const n=e[f].get(t);if(n){const t=n.value;if(m(e,t)){if(v(e,n),!e[a])return}else r&&(e[d]&&(n.value.now=Date.now()),e[h].unshiftNode(n));return t.value}},m=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},y=e=>{if(e[o]>e[i])for(let t=e[h].tail;e[o]>e[i]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[o]-=r.length,e[f].delete(r.key),e[h].removeNode(t)}};class b{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const w=(e,t,r,n)=>{let i=r.value;m(e,i)&&(v(e,r),e[a]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||p;if(this[s]="function"!=typeof t?p:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[d]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,y(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,y(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[s]&&(this[s]=e,this[o]=0,this[h].forEach((e=>{e.length=this[s](e.value,e.key),this[o]+=e.length}))),y(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let r=this[h].tail;null!==r;){const n=r.prev;w(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[h].head;null!==r;){const n=r.next;w(this,e,r,t),r=n}}keys(){return this[h].toArray().map((e=>e.key))}values(){return this[h].toArray().map((e=>e.value))}reset(){this[u]&&this[h]&&this[h].length&&this[h].forEach((e=>this[u](e.key,e.value))),this[f]=new Map,this[h]=new n,this[o]=0}dump(){return this[h].map((e=>!m(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[h]}set(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[s](t,e);if(this[f].has(e)){if(a>this[i])return v(this,this[f].get(e)),!1;const s=this[f].get(e).value;return this[u]&&(this[l]||this[u](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[o]+=a-s.length,s.length=a,this.get(e),y(this),!0}const d=new b(e,t,a,n,r);return d.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=d.length,this[h].unshift(d),this[f].set(e,this[h].head),y(this),!0)}has(e){if(!this[f].has(e))return!1;const t=this[f].get(e).value;return!m(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[h].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[f].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[f].forEach(((e,t)=>g(this,t,!1)))}}},9513:(e,t,r)=>{var n=r(2577).Buffer;const i=e.exports;i.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},i.codes={};for(const e in i.types){const t=i.types[e];i.codes[t]=e}i.CMD_SHIFT=4,i.CMD_MASK=240,i.DUP_MASK=8,i.QOS_MASK=3,i.QOS_SHIFT=1,i.RETAIN_MASK=1,i.VARBYTEINT_MASK=127,i.VARBYTEINT_FIN_MASK=128,i.VARBYTEINT_MAX=268435455,i.SESSIONPRESENT_MASK=1,i.SESSIONPRESENT_HEADER=n.from([i.SESSIONPRESENT_MASK]),i.CONNACK_HEADER=n.from([i.codes.connack<<i.CMD_SHIFT]),i.USERNAME_MASK=128,i.PASSWORD_MASK=64,i.WILL_RETAIN_MASK=32,i.WILL_QOS_MASK=24,i.WILL_QOS_SHIFT=3,i.WILL_FLAG_MASK=4,i.CLEAN_SESSION_MASK=2,i.CONNECT_HEADER=n.from([i.codes.connect<<i.CMD_SHIFT]),i.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},i.propertiesCodes={};for(const e in i.properties){const t=i.properties[e];i.propertiesCodes[t]=e}function o(e){return[0,1,2].map((t=>[0,1].map((r=>[0,1].map((o=>{const s=n.alloc(1);return s.writeUInt8(i.codes[e]<<i.CMD_SHIFT|(r?i.DUP_MASK:0)|t<<i.QOS_SHIFT|o,0,!0),s}))))))}i.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},i.PUBLISH_HEADER=o("publish"),i.SUBSCRIBE_HEADER=o("subscribe"),i.SUBSCRIBE_OPTIONS_QOS_MASK=3,i.SUBSCRIBE_OPTIONS_NL_MASK=1,i.SUBSCRIBE_OPTIONS_NL_SHIFT=2,i.SUBSCRIBE_OPTIONS_RAP_MASK=1,i.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,i.SUBSCRIBE_OPTIONS_RH_MASK=3,i.SUBSCRIBE_OPTIONS_RH_SHIFT=4,i.SUBSCRIBE_OPTIONS_RH=[0,16,32],i.SUBSCRIBE_OPTIONS_NL=4,i.SUBSCRIBE_OPTIONS_RAP=8,i.SUBSCRIBE_OPTIONS_QOS=[0,1,2],i.UNSUBSCRIBE_HEADER=o("unsubscribe"),i.ACKS={unsuback:o("unsuback"),puback:o("puback"),pubcomp:o("pubcomp"),pubrel:o("pubrel"),pubrec:o("pubrec")},i.SUBACK_HEADER=n.from([i.codes.suback<<i.CMD_SHIFT]),i.VERSION3=n.from([3]),i.VERSION4=n.from([4]),i.VERSION5=n.from([5]),i.VERSION131=n.from([131]),i.VERSION132=n.from([132]),i.QOS=[0,1,2].map((e=>n.from([e]))),i.EMPTY={pingreq:n.from([i.codes.pingreq<<4,0]),pingresp:n.from([i.codes.pingresp<<4,0]),disconnect:n.from([i.codes.disconnect<<4,0])}},1017:(e,t,r)=>{var n=r(2577).Buffer;const i=r(5706),o=r(9273);class s extends o{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const t=new Array(this._array.length),r=this._array;let i,o=0;for(i=0;i<r.length&&void 0!==r[i];i++)"string"!=typeof r[i]?t[i]=r[i].length:t[i]=n.byteLength(r[i]),e+=t[i];const s=n.allocUnsafe(e);for(i=0;i<r.length&&void 0!==r[i];i++)"string"!=typeof r[i]?(r[i].copy(s,o),o+=t[i]):(s.write(r[i],o),o+=t[i]);return s}}e.exports=function(e,t){const r=new s;return i(e,r,t),r.concat()}},3140:(e,t,r)=>{t.parser=r(4481).parser,t.generate=r(1017),t.writeToStream=r(5706)},534:(e,t,r)=>{var n=r(2577).Buffer;const i={},o=n.isBuffer(n.from([1,2]).subarray(0,1));function s(e){const t=n.allocUnsafe(2);return t.writeUInt8(e>>8,0),t.writeUInt8(255&e,1),t}e.exports={cache:i,generateCache:function(){for(let e=0;e<65536;e++)i[e]=s(e)},generateNumber:s,genBufVariableByteInt:function(e){let t=0,r=0;const i=n.allocUnsafe(4);do{t=e%128|0,(e=e/128|0)>0&&(t|=128),i.writeUInt8(t,r++)}while(e>0&&r<4);return e>0&&(r=0),o?i.subarray(0,r):i.slice(0,r)},generate4ByteBuffer:function(e){const t=n.allocUnsafe(4);return t.writeUInt32BE(e,0),t}}},2654:e=>{e.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},4481:(e,t,r)=>{const n=r(6431),i=r(9273),o=r(2654),s=r(9513),a=r(659)("mqtt-packet:parser");class c extends i{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof c?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new c).parser(e)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),a("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const e=this._list.readUInt8(0);return this.packet.cmd=s.types[e>>s.CMD_SHIFT],this.packet.retain=!!(e&s.RETAIN_MASK),this.packet.qos=e>>s.QOS_SHIFT&s.QOS_MASK,this.packet.dup=!!(e&s.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),a("_parseLength %d",e.value),!!e}_parsePayload(){a("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return a("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,r,n;a("_parseConnect");const i={},o=this.packet,c=this._parseString();if(null===c)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==c&&"MQIsdp"!==c)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=c,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),o.protocolVersion>=128&&(o.bridgeMode=!0,o.protocolVersion=o.protocolVersion-128),3!==o.protocolVersion&&4!==o.protocolVersion&&5!==o.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(i.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK,i.will&&(o.will={},o.will.retain=!!(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT),o.clean=!!(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK),this._pos++,o.keepalive=this._parseNum(),-1===o.keepalive)return this._emitError(new Error("Packet too short"));if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.properties=e)}const u=this._parseString();if(null===u)return this._emitError(new Error("Packet too short"));if(o.clientId=u,a("_parseConnect: packet.clientId: %s",o.clientId),i.will){if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.will.properties=e)}if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=e,a("_parseConnect: packet.will.topic: %s",o.will.topic),t=this._parseBuffer(),null===t)return this._emitError(new Error("Cannot parse will payload"));o.will.payload=t,a("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(i.username){if(n=this._parseString(),null===n)return this._emitError(new Error("Cannot parse username"));o.username=n,a("_parseConnect: packet.username: %s",o.username)}if(i.password){if(r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse password"));o.password=r}return this.settings=o,a("_parseConnect: complete"),o}_parseConnack(){a("_parseConnack");const e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&s.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}a("_parseConnack: complete")}_parsePublish(){a("_parsePublish");const e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),a("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){a("_parseSubscribe");const e=this.packet;let t,r,n,i,o,c,u;if(1!==e.qos)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));r=this._parseByte(),n=r&s.SUBSCRIBE_OPTIONS_QOS_MASK,c=!!(r>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK),o=!!(r>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK),i=r>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,u={topic:t,qos:n},5===this.settings.protocolVersion?(u.nl=c,u.rap=o,u.rh=i):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",u),e.subscriptions.push(u)}}}_parseSuback(){a("_parseSuback");const e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){a("_parseUnsubscribe");const e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){const t=this._parseString();if(null===t)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){a("_parseUnsuback");const e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2?(e.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){const e=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_parseAuth");const e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),a("_parseAuth: result: true"),!0}_parseMessageId(){const e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;const n=this._list.toString("utf8",this._pos,r);return this._pos+=t,a("_parseString: result: %s",n),n}_parseStringPair(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;const r=this._list.slice(this._pos,t);return this._pos+=e,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const e=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){a("_parseVarByteNum");let t,r=0,n=1,i=0,o=!1;const c=this._pos?this._pos:0;for(;r<4&&c+r<this._list.length;){if(t=this._list.readUInt8(c+r++),i+=n*(t&s.VARBYTEINT_MASK),n*=128,!(t&s.VARBYTEINT_FIN_MASK)){o=!0;break}if(this._list.length<=r)break}return!o&&4===r&&this._list.length>=r&&this._emitError(new Error("Invalid variable byte integer")),c&&(this._pos+=r),o=!!o&&(e?{bytes:r,value:i}:i),a("_parseVarByteNum: result: %o",o),o}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",e),e}_parseByType(e){switch(a("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){a("_parseProperties");const e=this._parseVarByteNum(),t=this._pos+e,r={};for(;this._pos<t;){const e=this._parseByte();if(!e)return this._emitError(new Error("Cannot parse property code type")),!1;const t=s.propertiesCodes[e];if(!t)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==t)r[t]?(Array.isArray(r[t])||(r[t]=[r[t]]),r[t].push(this._parseByType(s.propertiesTypes[t]))):r[t]=this._parseByType(s.propertiesTypes[t]);else{r[t]||(r[t]=Object.create(null));const e=this._parseByType(s.propertiesTypes[t]);if(r[t][e.name])if(Array.isArray(r[t][e.name]))r[t][e.name].push(e.value);else{const n=r[t][e.name];r[t][e.name]=[n],r[t][e.name].push(e.value)}else r[t][e.name]=e.value}}return r}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),a("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}_emitError(e){a("_emitError"),this.error=e,this.emit("error",e)}}e.exports=c},5706:(e,t,r)=>{var n=r(2577).Buffer;const i=r(9513),o=n.allocUnsafe(0),s=n.from([0]),a=r(534),c=r(4303).nextTick,u=r(659)("mqtt-packet:writeToStream"),l=a.cache,h=a.generateNumber,f=a.generateCache,d=a.genBufVariableByteInt,p=a.generate4ByteBuffer;let g=S,m=!0;function y(e,t,r){switch(u("generate called"),t.cork&&(t.cork(),c(v,t)),m&&(m=!1,f()),u("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return function(e,t,r){const o=e||{},s=o.protocolId||"MQTT";let a=o.protocolVersion||4;const c=o.will;let u=o.clean;const l=o.keepalive||0,h=o.clientId||"",f=o.username,d=o.password,p=o.properties;void 0===u&&(u=!0);let m=0;if(!s||"string"!=typeof s&&!n.isBuffer(s))return t.emit("error",new Error("Invalid protocolId")),!1;m+=s.length+2;if(3!==a&&4!==a&&5!==a)return t.emit("error",new Error("Invalid protocol version")),!1;m+=1;if(("string"==typeof h||n.isBuffer(h))&&(h||a>=4)&&(h||u))m+=n.byteLength(h)+2;else{if(a<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof l||l<0||l>65535||l%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;m+=2;if(m+=1,5===a){var y=T(t,p);if(!y)return!1;m+=y.length}if(c){if("object"!=typeof c)return t.emit("error",new Error("Invalid will")),!1;if(!c.topic||"string"!=typeof c.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(m+=n.byteLength(c.topic)+2,m+=2,c.payload){if(!(c.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof c.payload?m+=n.byteLength(c.payload):m+=c.payload.length}var v={};if(5===a){if(!(v=T(t,c.properties)))return!1;m+=v.length}}let b=!1;if(null!=f){if(!R(f))return t.emit("error",new Error("Invalid username")),!1;b=!0,m+=n.byteLength(f)+2}if(null!=d){if(!b)return t.emit("error",new Error("Username is required to use password")),!1;if(!R(d))return t.emit("error",new Error("Invalid password")),!1;m+=P(d)+2}t.write(i.CONNECT_HEADER),w(t,m),C(t,s),o.bridgeMode&&(a+=128);t.write(131===a?i.VERSION131:132===a?i.VERSION132:4===a?i.VERSION4:5===a?i.VERSION5:i.VERSION3);let k=0;k|=null!=f?i.USERNAME_MASK:0,k|=null!=d?i.PASSWORD_MASK:0,k|=c&&c.retain?i.WILL_RETAIN_MASK:0,k|=c&&c.qos?c.qos<<i.WILL_QOS_SHIFT:0,k|=c?i.WILL_FLAG_MASK:0,k|=u?i.CLEAN_SESSION_MASK:0,t.write(n.from([k])),g(t,l),5===a&&y.write();C(t,h),c&&(5===a&&v.write(),_(t,c.topic),C(t,c.payload));null!=f&&C(t,f);null!=d&&C(t,d);return!0}(e,t);case"connack":return function(e,t,r){const o=r?r.protocolVersion:4,a=e||{},c=5===o?a.reasonCode:a.returnCode,u=a.properties;let l=2;if("number"!=typeof c)return t.emit("error",new Error("Invalid return code")),!1;let h=null;if(5===o){if(h=T(t,u),!h)return!1;l+=h.length}t.write(i.CONNACK_HEADER),w(t,l),t.write(a.sessionPresent?i.SESSIONPRESENT_HEADER:s),t.write(n.from([c])),null!=h&&h.write();return!0}(e,t,r);case"publish":return function(e,t,r){u("publish: packet: %o",e);const s=r?r.protocolVersion:4,a=e||{},c=a.qos||0,l=a.retain?i.RETAIN_MASK:0,h=a.topic,f=a.payload||o,d=a.messageId,p=a.properties;let m=0;if("string"==typeof h)m+=n.byteLength(h)+2;else{if(!n.isBuffer(h))return t.emit("error",new Error("Invalid topic")),!1;m+=h.length+2}n.isBuffer(f)?m+=f.length:m+=n.byteLength(f);if(c&&"number"!=typeof d)return t.emit("error",new Error("Invalid messageId")),!1;c&&(m+=2);let y=null;if(5===s){if(y=T(t,p),!y)return!1;m+=y.length}t.write(i.PUBLISH_HEADER[c][a.dup?1:0][l?1:0]),w(t,m),g(t,P(h)),t.write(h),c>0&&g(t,d);null!=y&&y.write();return u("publish: payload: %o",f),t.write(f)}(e,t,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.cmd||"puback",c=s.messageId,u=s.dup&&"pubrel"===a?i.DUP_MASK:0;let l=0;const h=s.reasonCode,f=s.properties;let d=5===o?3:2;"pubrel"===a&&(l=1);if("number"!=typeof c)return t.emit("error",new Error("Invalid messageId")),!1;let p=null;if(5===o&&"object"==typeof f){if(p=A(t,f,r,d),!p)return!1;d+=p.length}t.write(i.ACKS[a][l][u][0]),w(t,d),g(t,c),5===o&&t.write(n.from([h]));null!==p&&p.write();return!0}(e,t,r);case"subscribe":return function(e,t,r){u("subscribe: packet: ");const o=r?r.protocolVersion:4,s=e||{},a=s.dup?i.DUP_MASK:0,c=s.messageId,l=s.subscriptions,h=s.properties;let f=0;if("number"!=typeof c)return t.emit("error",new Error("Invalid messageId")),!1;f+=2;let d=null;if(5===o){if(d=T(t,h),!d)return!1;f+=d.length}if("object"!=typeof l||!l.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(let e=0;e<l.length;e+=1){const r=l[e].topic,i=l[e].qos;if("string"!=typeof r)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof i)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===o){if("boolean"!=typeof(l[e].nl||!1))return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(l[e].rap||!1))return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const r=l[e].rh||0;if("number"!=typeof r||r>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=n.byteLength(r)+2+1}u("subscribe: writing to stream: %o",i.SUBSCRIBE_HEADER),t.write(i.SUBSCRIBE_HEADER[1][a?1:0][0]),w(t,f),g(t,c),null!==d&&d.write();let p=!0;for(const e of l){const r=e.topic,s=e.qos,a=+e.nl,c=+e.rap,u=e.rh;let l;_(t,r),l=i.SUBSCRIBE_OPTIONS_QOS[s],5===o&&(l|=a?i.SUBSCRIBE_OPTIONS_NL:0,l|=c?i.SUBSCRIBE_OPTIONS_RAP:0,l|=u?i.SUBSCRIBE_OPTIONS_RH[u]:0),p=t.write(n.from([l]))}return p}(e,t,r);case"suback":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.messageId,c=s.granted,u=s.properties;let l=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;l+=2;if("object"!=typeof c||!c.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<c.length;e+=1){if("number"!=typeof c[e])return t.emit("error",new Error("Invalid qos vector")),!1;l+=1}let h=null;if(5===o){if(h=A(t,u,r,l),!h)return!1;l+=h.length}t.write(i.SUBACK_HEADER),w(t,l),g(t,a),null!==h&&h.write();return t.write(n.from(c))}(e,t,r);case"unsubscribe":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.messageId,c=s.dup?i.DUP_MASK:0,u=s.unsubscriptions,l=s.properties;let h=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;h+=2;if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(let e=0;e<u.length;e+=1){if("string"!=typeof u[e])return t.emit("error",new Error("Invalid unsubscriptions")),!1;h+=n.byteLength(u[e])+2}let f=null;if(5===o){if(f=T(t,l),!f)return!1;h+=f.length}t.write(i.UNSUBSCRIBE_HEADER[1][c?1:0][0]),w(t,h),g(t,a),null!==f&&f.write();let d=!0;for(let e=0;e<u.length;e++)d=_(t,u[e]);return d}(e,t,r);case"unsuback":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.messageId,c=s.dup?i.DUP_MASK:0,u=s.granted,l=s.properties,h=s.cmd,f=0;let d=2;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(5===o){if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<u.length;e+=1){if("number"!=typeof u[e])return t.emit("error",new Error("Invalid qos vector")),!1;d+=1}}let p=null;if(5===o){if(p=A(t,l,r,d),!p)return!1;d+=p.length}t.write(i.ACKS[h][f][c][0]),w(t,d),g(t,a),null!==p&&p.write();5===o&&t.write(n.from(u));return!0}(e,t,r);case"pingreq":case"pingresp":return function(e,t,r){return t.write(i.EMPTY[e.cmd])}(e,t);case"disconnect":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.reasonCode,c=s.properties;let u=5===o?1:0,l=null;if(5===o){if(l=A(t,c,r,u),!l)return!1;u+=l.length}t.write(n.from([i.codes.disconnect<<4])),w(t,u),5===o&&t.write(n.from([a]));null!==l&&l.write();return!0}(e,t,r);case"auth":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.reasonCode,c=s.properties;let u=5===o?1:0;5!==o&&t.emit("error",new Error("Invalid mqtt version for auth packet"));const l=A(t,c,r,u);if(!l)return!1;u+=l.length,t.write(n.from([i.codes.auth<<4])),w(t,u),t.write(n.from([a])),null!==l&&l.write();return!0}(e,t,r);default:return t.emit("error",new Error("Unknown command")),!1}}function v(e){e.uncork()}Object.defineProperty(y,"cacheNumbers",{get:()=>g===S,set(e){e?(l&&0!==Object.keys(l).length||(m=!0),g=S):(m=!1,g=E)}});const b={};function w(e,t){if(t>i.VARBYTEINT_MAX)return e.emit("error",new Error(`Invalid variable byte integer: ${t}`)),!1;let r=b[t];return r||(r=d(t),t<16384&&(b[t]=r)),u("writeVarByteInt: writing to stream: %o",r),e.write(r)}function _(e,t){const r=n.byteLength(t);return g(e,r),u("writeString: %s",t),e.write(t,"utf8")}function k(e,t,r){_(e,t),_(e,r)}function S(e,t){return u("writeNumberCached: number: %d",t),u("writeNumberCached: %o",l[t]),e.write(l[t])}function E(e,t){const r=h(t);return u("writeNumberGenerated: %o",r),e.write(r)}function C(e,t){"string"==typeof t?_(e,t):t?(g(e,t.length),e.write(t)):g(e,0)}function T(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write(){I(e,{},0)}};let r=0;function o(t,r){let o=0;switch(i.propertiesTypes[t]){case"byte":if("boolean"!=typeof r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=2;break;case"int8":if("number"!=typeof r||r<0||r>255)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=2;break;case"binary":if(r&&null===r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=1+n.byteLength(r)+2;break;case"int16":if("number"!=typeof r||r<0||r>65535)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=3;break;case"int32":if("number"!=typeof r||r<0||r>4294967295)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=5;break;case"var":if("number"!=typeof r||r<0||r>268435455)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=1+n.byteLength(d(r));break;case"string":if("string"!=typeof r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=3+n.byteLength(r.toString());break;case"pair":if("object"!=typeof r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=Object.getOwnPropertyNames(r).reduce(((e,t)=>{const i=r[t];return Array.isArray(i)?e+=i.reduce(((e,r)=>e+=3+n.byteLength(t.toString())+2+n.byteLength(r.toString())),0):e+=3+n.byteLength(t.toString())+2+n.byteLength(r[t].toString()),e}),0);break;default:return e.emit("error",new Error(`Invalid property ${t}: ${r}`)),!1}return o}if(t)for(const e in t){let n=0,i=0;const s=t[e];if(Array.isArray(s))for(let t=0;t<s.length;t++){if(i=o(e,s[t]),!i)return!1;n+=i}else{if(i=o(e,s),!i)return!1;n=i}if(!n)return!1;r+=n}return{length:n.byteLength(d(r))+r,write(){I(e,t,r)}}}function A(e,t,r,n){const i=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let s=T(e,t);if(o)for(;n+s.length>o;){const r=i.shift();if(!r||!t[r])return!1;delete t[r],s=T(e,t)}return s}function x(e,t,r){switch(i.propertiesTypes[t]){case"byte":e.write(n.from([i.properties[t]])),e.write(n.from([+r]));break;case"int8":e.write(n.from([i.properties[t]])),e.write(n.from([r]));break;case"binary":e.write(n.from([i.properties[t]])),C(e,r);break;case"int16":e.write(n.from([i.properties[t]])),g(e,r);break;case"int32":e.write(n.from([i.properties[t]])),function(e,t){const r=p(t);u("write4ByteNumber: %o",r),e.write(r)}(e,r);break;case"var":e.write(n.from([i.properties[t]])),w(e,r);break;case"string":e.write(n.from([i.properties[t]])),_(e,r);break;case"pair":Object.getOwnPropertyNames(r).forEach((o=>{const s=r[o];Array.isArray(s)?s.forEach((r=>{e.write(n.from([i.properties[t]])),k(e,o.toString(),r.toString())})):(e.write(n.from([i.properties[t]])),k(e,o.toString(),s.toString()))}));break;default:return e.emit("error",new Error(`Invalid property ${t} value: ${r}`)),!1}}function I(e,t,r){w(e,r);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&null!==t[r]){const n=t[r];if(Array.isArray(n))for(let t=0;t<n.length;t++)x(e,r,n[t]);else x(e,r,n)}}function P(e){return e?e instanceof n?e.length:n.byteLength(e):0}function R(e){return"string"==typeof e||e instanceof n}e.exports=y},7103:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,s=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\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(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},1846:(e,t,r)=>{const n=r(3285);e.exports.t=n},3285:(e,t,r)=>{const n=r(310).NZ,i=r(659)("number-allocator:trace"),o=r(659)("number-allocator:error");function s(e,t){this.low=e,this.high=t}function a(e,t){if(!(this instanceof a))return new a(e,t);this.min=e,this.max=t,this.ss=new n([],((e,t)=>e.compare(t))),i("Create"),this.clear()}s.prototype.equals=function(e){return this.low===e.low&&this.high===e.high},s.prototype.compare=function(e){return this.low<e.low&&this.high<e.low?-1:e.low<this.low&&e.high<this.low?1:0},a.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},a.prototype.alloc=function(){if(0===this.ss.size())return i("alloc():empty"),null;const e=this.ss.front(),t=e.low;return t+1<=e.high?++e.low:this.ss.eraseElementByPos(0),i("alloc():"+t),t},a.prototype.use=function(e){const t=new s(e,e),r=this.ss.lowerBound(t);if(r){if(r.equals(t))return this.ss.eraseElementByValue(r),i("use():"+e),!0;if(r.low>e)return!1;if(r.low===e)return++r.low,i("use():"+e),!0;if(r.high===e)return--r.high,i("use():"+e),!0;const n=r.low;return r.low=e+1,this.ss.insert(new s(n,e-1)),i("use():"+e),!0}return i("use():failed"),!1},a.prototype.free=function(e){if(e<this.min||e>this.max)return void o("free():"+e+" is out of range");const t=new s(e,e),r=this.ss.lowerBound(t);if(r){if(r.low<=e&&e<=r.high)return void o("free():"+e+" has already been vacant");if(r===this.ss.front())e+1===r.low?--r.low:this.ss.insert(t);else{const n=this.ss.reverseLowerBound(t);n.high+1===e?e+1===r.low?(this.ss.eraseElementByValue(n),r.low=n.low):n.high=e:e+1===r.low?r.low=e:this.ss.insert(t)}}else{if(r===this.ss.front())return void this.ss.insert(t);const n=this.ss.reverseLowerBound(t);n.high+1===e?n.high=e:this.ss.insert(t)}i("free():"+e)},a.prototype.clear=function(){i("clear()"),this.ss.clear(),this.ss.insert(new s(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.size()},a.prototype.dump=function(){console.log("length:"+this.ss.size());for(const e of this.ss)console.log(e)},e.exports=a},8377:(e,t,r)=>{var n=r(2781);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},4303:(e,t,r)=>{var n=r(3908);void 0===n||!n.version||0===n.version.indexOf("v0.")||0===n.version.indexOf("v1.")&&0!==n.version.indexOf("v1.8.")?e.exports={nextTick:function(e,t,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return n.nextTick(e);case 2:return n.nextTick((function(){e.call(null,t)}));case 3:return n.nextTick((function(){e.call(null,t,r)}));case 4:return n.nextTick((function(){e.call(null,t,r,i)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return n.nextTick((function(){e.apply(null,o)}))}}}:e.exports=n},3908:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=s(h);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||u||s(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},7192:e=>{function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,r,n,i){r=r||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var s=/\+/g;e=e.split(r);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var c=e.length;a>0&&c>a&&(c=a);for(var u=0;u<c;++u){var l,h,f,d,p=e[u].replace(s,"%20"),g=p.indexOf(n);g>=0?(l=p.substr(0,g),h=p.substr(g+1)):(l=p,h=""),f=decodeURIComponent(l),d=decodeURIComponent(h),t(o,f)?Array.isArray(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o}},5696:e=>{var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,r,n,i){return r=r||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(i){var o=encodeURIComponent(t(i))+n;return Array.isArray(e[i])?e[i].map((function(e){return o+encodeURIComponent(t(e))})).join(r):o+encodeURIComponent(t(e[i]))})).join(r):i?encodeURIComponent(t(i))+n+encodeURIComponent(t(e)):""}},6316:(e,t,r)=>{t.decode=t.parse=r(7192),t.encode=t.stringify=r(5696)},1690:e=>{var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(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))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,s,a;if("string"==typeof t&&(o="not ",t.substr(!s||s<0?0:+s,o.length)===o)?(i="must not be",t=t.replace(/^not /,"")):i="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"))a="The ".concat(e," ").concat(i," ").concat(n(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";a='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(n(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},444:(e,t,r)=>{var n=r(3908),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(4258),s=r(4486);r(6371)(l,o);for(var a=i(s.prototype),c=0;c<a.length;c++){var u=a[c];l.prototype[u]||(l.prototype[u]=s.prototype[u])}function l(e){if(!(this instanceof l))return new l(e);o.call(this,e),s.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",h)))}function h(){this._writableState.ended||n.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.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)}})},9942:(e,t,r)=>{e.exports=i;var n=r(2892);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(6371)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},4258:(e,t,r)=>{var n,i=r(3908);e.exports=C,C.ReadableState=E;r(9273).EventEmitter;var o=function(e,t){return e.listeners(t).length},s=r(4363),a=r(2577).Buffer,c=r.g.Uint8Array||function(){};var u,l=r(2472);u=l&&l.debuglog?l.debuglog("stream"):function(){};var h,f,d,p=r(7703),g=r(4386),m=r(5069).getHighWaterMark,y=r(1690).F,v=y.ERR_INVALID_ARG_TYPE,b=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,_=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6371)(C,s);var k=g.errorOrDestroy,S=["error","close","destroy","pause","resume"];function E(e,t,i){n=n||r(444),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=r(6127).I),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function C(e){if(n=n||r(444),!(this instanceof C))return new C(e);var t=this instanceof n;this._readableState=new E(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function T(e,t,r,n,i){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(u("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?P(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,R(e)))}(e,s);else if(i||(o=function(e,t){var r;n=t,a.isBuffer(n)||n instanceof c||"string"==typeof t||void 0===t||e.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(s,t)),o)k(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)s.endEmitted?k(e,new _):A(e,s,t,!0);else if(s.ended)k(e,new b);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?A(e,s,t,!1):M(e,s)):A(e,s,t,!1)}else n||(s.reading=!1,M(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function A(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&&P(e)),M(e,t)}Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),C.prototype.destroy=g.destroy,C.prototype._undestroy=g.undestroy,C.prototype._destroy=function(e,t){t(e)},C.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=a.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},C.prototype.unshift=function(e){return T(this,e,null,!0,!1)},C.prototype.isPaused=function(){return!1===this._readableState.flowing},C.prototype.setEncoding=function(e){h||(h=r(6127).I);var t=new h(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var x=1073741824;function I(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>=x?e=x:(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 P(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(R,e))}function R(e){var t=e._readableState;u("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,D(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(u("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function B(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 N(e){u("readable nexttick read 0"),e.read(0)}function L(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function U(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 j(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(F,t,e))}function F(e,t){if(u("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 z(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}C.prototype.read=function(e){u("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 u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):P(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",i=!0),t.ended||t.reading?u("reading or ended",i=!1):i&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(n=e>0?U(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&&j(this)),null!==n&&this.emit("data",n),n},C.prototype._read=function(e){k(this,new w("_read()"))},C.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,u("pipe count=%d opts=%j",n.pipesCount,t);var s=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?c:m;function a(t,i){u("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,u("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",f),h=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){u("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,D(e))}}(r);e.on("drain",l);var h=!1;function f(t){u("ondata");var i=e.write(t);u("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==z(n.pipes,e))&&!h&&(u("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(t){u("onerror",t),m(),e.removeListener("error",d),0===o(e,"error")&&k(e,t)}function p(){e.removeListener("finish",g),m()}function g(){u("onfinish"),e.removeListener("close",p),m()}function m(){u("unpipe"),r.unpipe(e)}return r.on("data",f),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",d),e.once("close",p),e.once("finish",g),e.emit("pipe",r),n.flowing||(u("pipe resume"),r.resume()),e},C.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 o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=z(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},C.prototype.on=function(e,t){var r=s.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,u("on readable",n.length,n.reading),n.length?P(this):n.reading||i.nextTick(N,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(B,this),r},C.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(B,this),t},C.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(L,e,t))}(this,e)),e.paused=!1,this},C.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(u("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){(u("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 o=0;o<S.length;o++)e.on(S[o],this.emit.bind(this,S[o]));return this._read=function(t){u("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(C.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=r(5209)),f(this)}),Object.defineProperty(C.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(C.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(C.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),C._fromList=U,Object.defineProperty(C.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(C.from=function(e,t){return void 0===d&&(d=r(923)),d(C,e,t)})},2892:(e,t,r)=>{e.exports=l;var n=r(1690).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,c=r(444);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);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 l(e){if(!(this instanceof l))return new l(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",h)}function h(){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 a;if(e._transformState.transforming)throw new s;return e.push(null)}r(6371)(l,c),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,r){r(new i("_transform()"))},l.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)}},l.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))},l.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,(function(e){t(e)}))}},4486:(e,t,r)=>{var n,i=r(3908);function o(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)}}e.exports=C,C.WritableState=E;var s={deprecate:r(5721)},a=r(4363),c=r(2577).Buffer,u=r.g.Uint8Array||function(){};var l,h=r(4386),f=r(5069).getHighWaterMark,d=r(1690).F,p=d.ERR_INVALID_ARG_TYPE,g=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,b=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,k=h.errorOrDestroy;function S(){}function E(e,t,s){n=n||r(444),e=e||{},"boolean"!=typeof s&&(s=t instanceof n),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.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,o=r.writecb;if("function"!=typeof o)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,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(R,e,t),e._writableState.errorEmitted=!0,k(e,n)):(o(n),e._writableState.errorEmitted=!0,k(e,n),R(e,t))}(e,r,n,t,o);else{var s=I(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||x(e,r),n?i.nextTick(A,e,r,s,o):A(e,r,s,o)}}(t,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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function C(e){var t=this instanceof(n=n||r(444));if(!t&&!l.call(C,this))return new C(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function T(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function A(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),R(e,t)}function x(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)i[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;i.allBuffers=c,T(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,l=r.encoding,h=r.callback;if(T(e,t,!1,t.objectMode?1:u.length,u,l,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function P(e,t){e._final((function(r){t.pendingcb--,r&&k(e,r),t.prefinished=!0,e.emit("prefinish"),R(e,t)}))}function R(e,t){var r=I(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,i.nextTick(P,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}r(6371)(C,a),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:s.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]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(C,Symbol.hasInstance,{value:function(e){return!!l.call(this,e)||this===C&&(e&&e._writableState instanceof E)}})):l=function(e){return e instanceof this},C.prototype.pipe=function(){k(this,new y)},C.prototype.write=function(e,t,r){var n,o=this._writableState,s=!1,a=!o.objectMode&&(n=e,c.isBuffer(n)||n instanceof u);return a&&!c.isBuffer(e)&&(e=function(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(e,t){var r=new w;k(e,r),i.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var o;return null===r?o=new b:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(k(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,a,n,i,o);return u}(this,o,a,e,t,r)),s},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||x(this,e))},C.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(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(e,t,r){r(new g("_write()"))},C.prototype._writev=null,C.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,R(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),C.prototype.destroy=h.destroy,C.prototype._undestroy=h.undestroy,C.prototype._destroy=function(e,t){t(e)}},5209:(e,t,r)=>{var n,i=r(3908);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=r(2888),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var r=e[d].read();null!==r&&(e[h]=null,e[a]=null,e[c]=null,t(p(r,!1)))}}function m(e){i.nextTick(g,e)}var y=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[u]?r(e[u]):t(p(void 0,!0))}))}));var r,n=this[h];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[l]?r(p(void 0,!0)):t[f](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[f])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),y);e.exports=function(e){var t,r=Object.create(v,(o(t={},d,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var n=r[d].read();n?(r[h]=null,r[a]=null,r[c]=null,e(p(n,!1))):(r[a]=e,r[c]=t)},writable:!0}),t));return r[h]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[c];return null!==t&&(r[h]=null,r[a]=null,r[c]=null,t(e)),void(r[u]=e)}var n=r[a];null!==n&&(r[h]=null,r[a]=null,r[c]=null,n(p(void 0,!0))),r[l]=!0})),e.on("readable",m.bind(null,r)),r}},7703:(e,t,r)=>{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,t,r){return 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,n.key,n)}}var s=r(2577).Buffer,a=r(9546).inspect,c=a&&a.custom||"inspect";function u(e,t,r){s.prototype.copy.call(e,t,r)}e.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,l;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 s.alloc(0);for(var t=s.allocUnsafe(e>>>0),r=this.head,n=0;r;)u(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,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return a(this,function(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){i(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}({},t,{depth:0,customInspect:!1}))}}],r&&o(t.prototype,r),l&&o(t,l),e}()},4386:(e,t,r)=>{var n=r(3908);function i(e,t){s(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function s(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(s,this,e)):n.nextTick(s,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?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,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)}}},2888:(e,t,r)=>{var n=r(1690).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=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)}}}(o||i);var s=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||l()},u=t._writableState&&t._writableState.finished,l=function(){a=!1,u=!0,s||o.call(t)},h=t._readableState&&t._readableState.endEmitted,f=function(){s=!1,h=!0,a||o.call(t)},d=function(e){o.call(t,e)},p=function(){var e;return s&&!h?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):a&&!u?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},g=function(){t.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",c),t.on("close",c)):(t.on("complete",l),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",f),t.on("finish",l),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",l),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",l),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",l),t.removeListener("end",f),t.removeListener("error",d),t.removeListener("close",p)}}},923:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},9844:(e,t,r)=>{var n;var i=r(1690).F,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function c(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var l,h=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var f=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var a=!1;e.on("close",(function(){a=!0})),void 0===n&&(n=r(2888)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);a=!0,o()}));var c=!1;return function(t){if(!a&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}(e,o,i>0,(function(e){l||(l=e),e&&f.forEach(c),o||(f.forEach(c),h(l))}))}));return t.reduce(u)}},5069:(e,t,r)=>{var n=r(1690).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},4363:(e,t,r)=>{e.exports=r(9273).EventEmitter},1181:(e,t,r)=>{(t=e.exports=r(4258)).Stream=t,t.Readable=t,t.Writable=r(4486),t.Duplex=r(444),t.Transform=r(2892),t.PassThrough=r(9942),t.finished=r(2888),t.pipeline=r(9844)},5371:e=>{function t(e,t,r){var n=this;this._callback=e,this._args=r,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,e,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var r=0;r<e.length;r++)e[r]=arguments[r+2]}return new t(arguments[0],arguments[1],e)}},1691:(e,t,r)=>{e.exports=r(5962)()},5962:(e,t,r)=>{var n=r(2577).Buffer;function i(e){return e instanceof n?n.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}e.exports=function(e){return(e=e||{}).circles?function(e){var t=[],r=[];return e.proto?function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,e);if(o instanceof Map)return new Map(n(Array.from(o),e));if(o instanceof Set)return new Set(n(Array.from(o),e));var s={};for(var a in t.push(o),r.push(s),o){var c=o[a];if("object"!=typeof c||null===c)s[a]=c;else if(c instanceof Date)s[a]=new Date(c);else if(c instanceof Map)s[a]=new Map(n(Array.from(c),e));else if(c instanceof Set)s[a]=new Set(n(Array.from(c),e));else if(ArrayBuffer.isView(c))s[a]=i(c);else{var u=t.indexOf(c);s[a]=-1!==u?r[u]:e(c)}}return t.pop(),r.pop(),s}:function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,e);if(o instanceof Map)return new Map(n(Array.from(o),e));if(o instanceof Set)return new Set(n(Array.from(o),e));var s={};for(var a in t.push(o),r.push(s),o)if(!1!==Object.hasOwnProperty.call(o,a)){var c=o[a];if("object"!=typeof c||null===c)s[a]=c;else if(c instanceof Date)s[a]=new Date(c);else if(c instanceof Map)s[a]=new Map(n(Array.from(c),e));else if(c instanceof Set)s[a]=new Set(n(Array.from(c),e));else if(ArrayBuffer.isView(c))s[a]=i(c);else{var u=t.indexOf(c);s[a]=-1!==u?r[u]:e(c)}}return t.pop(),r.pop(),s};function n(e,n){for(var o=Object.keys(e),s=new Array(o.length),a=0;a<o.length;a++){var c=o[a],u=e[c];if("object"!=typeof u||null===u)s[c]=u;else if(u instanceof Date)s[c]=new Date(u);else if(ArrayBuffer.isView(u))s[c]=i(u);else{var l=t.indexOf(u);s[c]=-1!==l?r[l]:n(u)}}return s}}(e):e.proto?function e(r){if("object"!=typeof r||null===r)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return t(r,e);if(r instanceof Map)return new Map(t(Array.from(r),e));if(r instanceof Set)return new Set(t(Array.from(r),e));var n={};for(var o in r){var s=r[o];"object"!=typeof s||null===s?n[o]=s:s instanceof Date?n[o]=new Date(s):s instanceof Map?n[o]=new Map(t(Array.from(s),e)):s instanceof Set?n[o]=new Set(t(Array.from(s),e)):ArrayBuffer.isView(s)?n[o]=i(s):n[o]=e(s)}return n}:function e(r){if("object"!=typeof r||null===r)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return t(r,e);if(r instanceof Map)return new Map(t(Array.from(r),e));if(r instanceof Set)return new Set(t(Array.from(r),e));var n={};for(var o in r)if(!1!==Object.hasOwnProperty.call(r,o)){var s=r[o];"object"!=typeof s||null===s?n[o]=s:s instanceof Date?n[o]=new Date(s):s instanceof Map?n[o]=new Map(t(Array.from(s),e)):s instanceof Set?n[o]=new Set(t(Array.from(s),e)):ArrayBuffer.isView(s)?n[o]=i(s):n[o]=e(s)}return n};function t(e,t){for(var r=Object.keys(e),n=new Array(r.length),o=0;o<r.length;o++){var s=r[o],a=e[s];"object"!=typeof a||null===a?n[s]=a:a instanceof Date?n[s]=new Date(a):ArrayBuffer.isView(a)?n[s]=i(a):n[s]=t(a)}return n}}},3843:(e,t,r)=>{var n=r(2577),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.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},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},3462:e=>{e.exports=function(e){var t=e._readableState;return t?t.objectMode||"number"==typeof e._duplexState?e.read():e.read(function(e){if(e.buffer.length)return e.buffer.head?e.buffer.head.data.length:e.buffer[0].length;return e.length}(t)):null}},6127:(e,t,r)=>{var n=r(3843).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 o(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=a,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){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 l(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 h(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 d(e){return e&&e.length?this.write(e):""}t.I=o,o.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||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if(i=s(t[n]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if(i=s(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)},o.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}},8884:function(e,t,r){var n;e=r.nmd(e),function(i){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof r.g&&r.g;o.global!==o&&o.window!==o&&o.self;var s,a=2147483647,c=36,u=1,l=26,h=38,f=700,d=72,p=128,g="-",m=/^xn--/,y=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=c-u,_=Math.floor,k=String.fromCharCode;function S(e){throw RangeError(b[e])}function E(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function C(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+E((e=e.replace(v,".")).split("."),t).join(".")}function T(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function A(e){return E(e,(function(e){var t="";return e>65535&&(t+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=k(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var n=0;for(e=r?_(e/f):e>>1,e+=_(e/t);e>w*l>>1;n+=c)e=_(e/w);return _(n+(w+1)*e/(e+h))}function P(e){var t,r,n,i,o,s,h,f,m,y,v,b=[],w=e.length,k=0,E=p,C=d;for((r=e.lastIndexOf(g))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&S("not-basic"),b.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<w;){for(o=k,s=1,h=c;i>=w&&S("invalid-input"),((f=(v=e.charCodeAt(i++))-48<10?v-22:v-65<26?v-65:v-97<26?v-97:c)>=c||f>_((a-k)/s))&&S("overflow"),k+=f*s,!(f<(m=h<=C?u:h>=C+l?l:h-C));h+=c)s>_(a/(y=c-m))&&S("overflow"),s*=y;C=I(k-o,t=b.length+1,0==o),_(k/t)>a-E&&S("overflow"),E+=_(k/t),k%=t,b.splice(k++,0,E)}return A(b)}function R(e){var t,r,n,i,o,s,h,f,m,y,v,b,w,E,C,A=[];for(b=(e=T(e)).length,t=p,r=0,o=d,s=0;s<b;++s)(v=e[s])<128&&A.push(k(v));for(n=i=A.length,i&&A.push(g);n<b;){for(h=a,s=0;s<b;++s)(v=e[s])>=t&&v<h&&(h=v);for(h-t>_((a-r)/(w=n+1))&&S("overflow"),r+=(h-t)*w,t=h,s=0;s<b;++s)if((v=e[s])<t&&++r>a&&S("overflow"),v==t){for(f=r,m=c;!(f<(y=m<=o?u:m>=o+l?l:m-o));m+=c)C=f-y,E=c-y,A.push(k(x(y+C%E,0))),f=_(C/E);A.push(k(x(f,0))),o=I(r,w,n==i),r=0,++n}++r,++t}return A.join("")}s={version:"1.3.2",ucs2:{decode:T,encode:A},decode:P,encode:R,toASCII:function(e){return C(e,(function(e){return y.test(e)?"xn--"+R(e):e}))},toUnicode:function(e){return C(e,(function(e){return m.test(e)?P(e.slice(4).toLowerCase()):e}))}},void 0===(n=function(){return s}.call(t,r,t,e))||(e.exports=n)}()},4837:(e,t,r)=>{var n=r(8884),i=r(7342);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(u),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(6316);function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var b=e=u.join(a);if(b=b.trim(),!r&&1===e.split("#").length){var w=c.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var _=s.exec(b);if(_){var k=(_=_[0]).toLowerCase();this.protocol=k,b=b.substr(_.length)}if(r||_||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===b.substr(0,2);!S||_&&m[_]||(b=b.substr(2),this.slashes=!0)}if(!m[_]&&(S||_&&!y[_])){for(var E,C,T=-1,A=0;A<f.length;A++){-1!==(x=b.indexOf(f[A]))&&(-1===T||x<T)&&(T=x)}-1!==(C=-1===T?b.lastIndexOf("@"):b.lastIndexOf("@",T))&&(E=b.slice(0,C),b=b.slice(C+1),this.auth=decodeURIComponent(E)),T=-1;for(A=0;A<h.length;A++){var x;-1!==(x=b.indexOf(h[A]))&&(-1===T||x<T)&&(T=x)}-1===T&&(T=b.length),this.host=b.slice(0,T),b=b.slice(T),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var P=this.hostname.split(/\./),R=(A=0,P.length);A<R;A++){var M=P[A];if(M&&!M.match(d)){for(var O="",B=0,N=M.length;B<N;B++)M.charCodeAt(B)>127?O+="x":O+=M[B];if(!O.match(d)){var L=P.slice(0,A),D=P.slice(A+1),U=M.match(p);U&&(L.push(U[1]),D.unshift(U[2])),D.length&&(b="/"+D.join(".")+b),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=n.toASCII(this.hostname));var j=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+j,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!g[k])for(A=0,R=l.length;A<R;A++){var z=l[A];if(-1!==b.indexOf(z)){var V=encodeURIComponent(z);V===z&&(V=escape(z)),b=b.split(z).join(V)}}var q=b.indexOf("#");-1!==q&&(this.hash=b.substr(q),b=b.slice(0,q));var W=b.indexOf("?");if(-1!==W?(this.search=b.substr(W),this.query=b.substr(W+1),t&&(this.query=v.parse(this.query)),b=b.slice(0,W)):t&&(this.search="",this.query={}),b&&(this.pathname=b),y[k]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){j=this.pathname||"";var H=this.search||"";this.path=j+H}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=v.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||y[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},o.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var r=new o,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0;u<c.length;u++){var l=c[u];"protocol"!==l&&(r[l]=e[l])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!y[e.protocol]){for(var h=Object.keys(e),f=0;f<h.length;f++){var d=h[f];r[d]=e[d]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||m[e.protocol])r.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var g=r.pathname||"",v=r.search||"";r.path=g+v}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var b=r.pathname&&"/"===r.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=w||b||r.host&&e.pathname,k=_,S=r.pathname&&r.pathname.split("/")||[],E=(p=e.pathname&&e.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(E&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),_=_&&(""===p[0]||""===S[0])),w)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,S=p;else if(p.length)S||(S=[]),S.pop(),S=S.concat(p),r.search=e.search,r.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(E)r.hostname=r.host=S.shift(),(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var C=S.slice(-1)[0],T=(r.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,A=0,x=S.length;x>=0;x--)"."===(C=S[x])?S.splice(x,1):".."===C?(S.splice(x,1),A++):A&&(S.splice(x,1),A--);if(!_&&!k)for(;A--;A)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),T&&"/"!==S.join("/").substr(-1)&&S.push("");var I,P=""===S[0]||S[0]&&"/"===S[0].charAt(0);E&&(r.hostname=r.host=P?"":S.length?S.shift():"",(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift()));return(_=_||r.host&&S.length)&&!P&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},7342:e=>{e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},5721:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.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)}}},2781:e=>{e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var n=t.apply(this,e),i=e[e.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach((function(e){n[e]=i[e]})),n}}},965:e=>{e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},7616:e=>{e.exports=function(){for(var e={},r=0;r<arguments.length;r++){var n=arguments[r];for(var i in n)t.call(n,i)&&(e[i]=n[i])}return e};var t=Object.prototype.hasOwnProperty},785:e=>{e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},601:(e,t,r)=>{function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}function i(e,t,r){var n=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===n.next&&(e.tail=n),null===n.prev&&(e.head=n),e.length++,n}function o(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function s(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,n){if(!(this instanceof a))return new a(e,t,r,n);this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=n,n.Node=a,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;null!==r;n++)e.call(t,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;null!==r;n--)e.call(t,r.value,n,this),r=r.prev},n.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},n.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&i<e;i++)o=o.next;for(;null!==o&&i<t;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,o=this.head;null!==o&&n<e;n++)o=o.next;var s=[];for(n=0;o&&n<t;n++)s.push(o.value),o=this.removeNode(o);null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(n=0;n<r.length;n++)o=i(this,o,r[n]);return s},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};try{r(785)(n)}catch(e){}},6880:function(e){e.exports=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){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),o=e.getVersionPrecision(r),s=Math.max(i,o),a=0,c=e.map([t,r],(function(t){var r=s-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&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])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,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)a();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){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},o=r(18);function s(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 a=function(){function e(){}var t,r,n;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,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(r=null)&&s(t.prototype,r),n&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),o=c(r(94)),s=c(r(95)),a=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=a.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.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=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.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=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(r[t]=s,n+=1)})),n>0){var s=Object.keys(r),c=a.default.find(s,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var h=this.satisfies(r[l]);if(void 0!==h)return h}}if(o>0){var f=Object.keys(i),d=a.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==d)return this.compareVersion(i[d])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=a.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(a.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){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,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(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,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(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,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(o,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(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,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(o,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(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,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=s,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.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:o.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:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.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:o.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:o.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:o.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:o.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:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.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:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.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:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.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:o.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:o.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:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=s,e.exports=t.default}})},955:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],o=[],s=[],a=[],c=[],u=[],l=[],h=[],f=[],d=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,i[r]=p,o[p]=r;var g=e[r],m=e[g],y=e[m],v=257*e[p]^16843008*p;s[r]=v<<24|v>>>8,a[r]=v<<16|v>>>16,c[r]=v<<8|v>>>24,u[r]=v,v=16843009*y^65537*m^257*g^16843008*r,l[p]=v<<24|v>>>8,h[p]=v<<16|v>>>16,f[p]=v<<8|v>>>24,d[p]=v,r?(r=g^e[e[e[y^g]]],n^=e[e[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s<n;s++)s<r?o[s]=t[s]:(u=o[s-1],s%r?r>6&&s%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=p[s/r|0]<<24),o[s]=o[s-r]^u);for(var a=this._invKeySchedule=[],c=0;c<n;c++){if(s=n-c,c%4)var u=o[s];else u=o[s-4];a[c]=c<4||s<=4?u:l[i[u>>>24]]^h[i[u>>>16&255]]^f[i[u>>>8&255]]^d[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,h,f,d,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],h=e[t+2]^r[2],f=e[t+3]^r[3],d=4,p=1;p<c;p++){var g=n[u>>>24]^i[l>>>16&255]^o[h>>>8&255]^s[255&f]^r[d++],m=n[l>>>24]^i[h>>>16&255]^o[f>>>8&255]^s[255&u]^r[d++],y=n[h>>>24]^i[f>>>16&255]^o[u>>>8&255]^s[255&l]^r[d++],v=n[f>>>24]^i[u>>>16&255]^o[l>>>8&255]^s[255&h]^r[d++];u=g,l=m,h=y,f=v}g=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^r[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&u])^r[d++],y=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^r[d++],v=(a[f>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^r[d++],e[t]=g,e[t+1]=m,e[t+2]=y,e[t+3]=v},keySize:8});e.AES=t._createHelper(g)}(),n.AES)},3128:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.BlockCipher,r=e.algo;const i=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,i=t>>8&255,o=255&t,s=e.sbox[0][r]+e.sbox[1][n];return s^=e.sbox[2][i],s+=e.sbox[3][o],s}function u(e,t,r){let n,o=t,s=r;for(let t=0;t<i;++t)o^=e.pbox[t],s=c(e,o)^s,n=o,o=s,s=n;return n=o,o=s,s=n,s^=e.pbox[i],o^=e.pbox[i+1],{left:o,right:s}}function l(e,t,r){let n,o=t,s=r;for(let t=i+1;t>1;--t)o^=e.pbox[t],s=c(e,o)^s,n=o,o=s,s=n;return n=o,o=s,s=n,s^=e.pbox[1],o^=e.pbox[0],{left:o,right:s}}function h(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=s[t][r]}let n=0;for(let s=0;s<i+2;s++)e.pbox[s]=o[s]^t[n],n++,n>=r&&(n=0);let a=0,c=0,l=0;for(let t=0;t<i+2;t+=2)l=u(e,a,c),a=l.left,c=l.right,e.pbox[t]=a,e.pbox[t+1]=c;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)l=u(e,a,c),a=l.left,c=l.right,e.sbox[t][r]=a,e.sbox[t][r+1]=c;return!0}var f=r.Blowfish=t.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;h(a,t,r)}},encryptBlock:function(e,t){var r=u(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=l(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=t._createHelper(f)}(),n.Blowfish)},7165:function(e,t,r){var n;e.exports=(n=r(9021),r(9506),void(n.lib.Cipher||function(e){var t=n,r=t.lib,i=r.Base,o=r.WordArray,s=r.BufferedBlockAlgorithm,a=t.enc,c=(a.Utf8,a.Base64),u=t.algo.EvpKDF,l=r.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:y}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()}),h=(r.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),t.mode={}),f=r.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),d=h.CBC=function(){var t=f.extend();function r(t,r,n){var i,o=this._iv;o?(i=o,this._iv=e):i=this._prevBlock;for(var s=0;s<n;s++)t[r+s]^=i[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=o}}),t}(),p=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(i);var c=o.create(s,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},g=(r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:p}),reset:function(){var e;l.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),m=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),g.create({ciphertext:r,salt:t})}},y=r.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),s=i.cfg;return g.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),v=(t.kdf={}).OpenSSL={execute:function(e,t,r,n,i){if(n||(n=o.random(8)),i)s=u.create({keySize:t+r,hasher:i}).compute(e,n);else var s=u.create({keySize:t+r}).compute(e,n);var a=o.create(s.words.slice(t),4*r);return s.sigBytes=4*t,g.create({key:s,iv:a,salt:n})}},b=r.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:v}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=y.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,y.decrypt.call(this,e,t,i.key,n)}})}()))},9021:function(e,t,r){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r.g&&r.g.crypto&&(n=r.g.crypto),!n)try{n=r(477)}catch(e){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},a=s.lib={},c=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=c.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new u.init(t,e)}}),l=s.enc={},h=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},f=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},d=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,l=e.min(4*c,o);if(c){for(var h=0;h<c;h+=s)this._doProcessBlock(i,h);r=i.splice(0,c),n.sigBytes-=l}return new u.init(r,l)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),g=(a.Hasher=p.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new g.HMAC.init(e,r).finalize(t)}}}),s.algo={});return s}(Math),n)},754:function(e,t,r){var n;e.exports=(n=r(9021),function(){var e=n,t=e.lib.WordArray;function r(e,r,n){for(var i=[],o=0,s=0;s<r;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<n.length;o++)i[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return r(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),n.enc.Base64)},4725:function(e,t,r){var n;e.exports=(n=r(9021),function(){var e=n,t=e.lib.WordArray;function r(e,r,n){for(var i=[],o=0,s=0;s<r;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],s=0;s<n;s+=3)for(var a=(r[s>>>2]>>>24-s%4*8&255)<<16|(r[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|r[s+2>>>2]>>>24-(s+2)%4*8&255,c=0;c<4&&s+.75*c<n;c++)o.push(i.charAt(a>>>6*(3-c)&63));var u=i.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var n=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var s=0;s<i.length;s++)o[i.charCodeAt(s)]=s}var a=i.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(n=c)}return r(e,n,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),n.enc.Base64url)},5503:function(e,t,r){var n;e.exports=(n=r(9021),function(){var e=n,t=e.lib.WordArray,r=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var o=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},r.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var s=i(t[o>>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return t.create(n,2*r)}}}(),n.enc.Utf16)},9506:function(e,t,r){var n,i,o,s,a,c,u,l;e.exports=(l=r(9021),r(5471),r(1025),i=(n=l).lib,o=i.Base,s=i.WordArray,a=n.algo,c=a.MD5,u=a.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),o=s.create(),a=o.words,c=n.keySize,u=n.iterations;a.length<c;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(var l=1;l<u;l++)r=i.finalize(r),i.reset();o.concat(r)}return o.sigBytes=4*c,o}}),n.EvpKDF=function(e,t,r){return u.create(r).compute(e,t)},l.EvpKDF)},25:function(e,t,r){var n,i,o,s;e.exports=(s=r(9021),r(7165),i=(n=s).lib.CipherParams,o=n.enc.Hex,n.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return i.create({ciphertext:t})}},s.format.Hex)},3793:function(e,t,r){var n;e.exports=(n=r(9021),r(3009),r(1025),n.HmacSHA256)},1025:function(e,t,r){var n,i,o,s;e.exports=(n=r(9021),o=(i=n).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,c=o.words,u=0;u<r;u++)a[u]^=1549556828,c[u]^=909522486;i.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))},1396:function(e,t,r){var n;e.exports=(n=r(9021),r(3240),r(6440),r(5503),r(754),r(4725),r(4636),r(5471),r(3009),r(6308),r(1380),r(9557),r(5953),r(8056),r(1025),r(19),r(9506),r(7165),r(2169),r(6939),r(6372),r(3797),r(8454),r(2073),r(4905),r(482),r(2155),r(8124),r(25),r(955),r(7628),r(7193),r(6298),r(2696),r(3128),n)},6440:function(e,t,r){var n;e.exports=(n=r(9021),function(){if("function"==typeof ArrayBuffer){var e=n.lib.WordArray,t=e.init,r=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)};r.prototype=e}}(),n.lib.WordArray)},4636:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=e[t+0],c=e[t+1],d=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],v=e[t+7],b=e[t+8],w=e[t+9],_=e[t+10],k=e[t+11],S=e[t+12],E=e[t+13],C=e[t+14],T=e[t+15],A=o[0],x=o[1],I=o[2],P=o[3];A=u(A,x,I,P,s,7,a[0]),P=u(P,A,x,I,c,12,a[1]),I=u(I,P,A,x,d,17,a[2]),x=u(x,I,P,A,p,22,a[3]),A=u(A,x,I,P,g,7,a[4]),P=u(P,A,x,I,m,12,a[5]),I=u(I,P,A,x,y,17,a[6]),x=u(x,I,P,A,v,22,a[7]),A=u(A,x,I,P,b,7,a[8]),P=u(P,A,x,I,w,12,a[9]),I=u(I,P,A,x,_,17,a[10]),x=u(x,I,P,A,k,22,a[11]),A=u(A,x,I,P,S,7,a[12]),P=u(P,A,x,I,E,12,a[13]),I=u(I,P,A,x,C,17,a[14]),A=l(A,x=u(x,I,P,A,T,22,a[15]),I,P,c,5,a[16]),P=l(P,A,x,I,y,9,a[17]),I=l(I,P,A,x,k,14,a[18]),x=l(x,I,P,A,s,20,a[19]),A=l(A,x,I,P,m,5,a[20]),P=l(P,A,x,I,_,9,a[21]),I=l(I,P,A,x,T,14,a[22]),x=l(x,I,P,A,g,20,a[23]),A=l(A,x,I,P,w,5,a[24]),P=l(P,A,x,I,C,9,a[25]),I=l(I,P,A,x,p,14,a[26]),x=l(x,I,P,A,b,20,a[27]),A=l(A,x,I,P,E,5,a[28]),P=l(P,A,x,I,d,9,a[29]),I=l(I,P,A,x,v,14,a[30]),A=h(A,x=l(x,I,P,A,S,20,a[31]),I,P,m,4,a[32]),P=h(P,A,x,I,b,11,a[33]),I=h(I,P,A,x,k,16,a[34]),x=h(x,I,P,A,C,23,a[35]),A=h(A,x,I,P,c,4,a[36]),P=h(P,A,x,I,g,11,a[37]),I=h(I,P,A,x,v,16,a[38]),x=h(x,I,P,A,_,23,a[39]),A=h(A,x,I,P,E,4,a[40]),P=h(P,A,x,I,s,11,a[41]),I=h(I,P,A,x,p,16,a[42]),x=h(x,I,P,A,y,23,a[43]),A=h(A,x,I,P,w,4,a[44]),P=h(P,A,x,I,S,11,a[45]),I=h(I,P,A,x,T,16,a[46]),A=f(A,x=h(x,I,P,A,d,23,a[47]),I,P,s,6,a[48]),P=f(P,A,x,I,v,10,a[49]),I=f(I,P,A,x,C,15,a[50]),x=f(x,I,P,A,m,21,a[51]),A=f(A,x,I,P,S,6,a[52]),P=f(P,A,x,I,p,10,a[53]),I=f(I,P,A,x,_,15,a[54]),x=f(x,I,P,A,c,21,a[55]),A=f(A,x,I,P,b,6,a[56]),P=f(P,A,x,I,T,10,a[57]),I=f(I,P,A,x,y,15,a[58]),x=f(x,I,P,A,E,21,a[59]),A=f(A,x,I,P,g,6,a[60]),P=f(P,A,x,I,k,10,a[61]),I=f(I,P,A,x,d,15,a[62]),x=f(x,I,P,A,w,21,a[63]),o[0]=o[0]+A|0,o[1]=o[1]+x|0,o[2]=o[2]+I|0,o[3]=o[3]+P|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<<o|a>>>32-o)+t}function l(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<<o|a>>>32-o)+t}function h(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<<o|a>>>32-o)+t}function f(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<<o|a>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),n.MD5)},2169:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.mode.CFB=function(){var e=n.lib.BlockCipherMode.extend();function t(e,t,r,n){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize;t.call(this,e,r,i,n),this._prevBlock=e.slice(r,r+i)}}),e.Decryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize,o=e.slice(r,r+i);t.call(this,e,r,i,n),this._prevBlock=o}}),e}(),n.mode.CFB)},6372:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.mode.CTRGladman=function(){var e=n.lib.BlockCipherMode.extend();function t(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function r(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var i=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),r(s);var a=s.slice(0);n.encryptBlock(a,0);for(var c=0;c<i;c++)e[t+c]^=a[c]}});return e.Decryptor=i,e}(),n.mode.CTRGladman)},6939:function(e,t,r){var n,i,o;e.exports=(o=r(9021),r(7165),o.mode.CTR=(n=o.lib.BlockCipherMode.extend(),i=n.Encryptor=n.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0);var s=o.slice(0);r.encryptBlock(s,0),o[n-1]=o[n-1]+1|0;for(var a=0;a<n;a++)e[t+a]^=s[a]}}),n.Decryptor=i,n),o.mode.CTR)},8454:function(e,t,r){var n,i;e.exports=(i=r(9021),r(7165),i.mode.ECB=((n=i.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),n.Decryptor=n.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),n),i.mode.ECB)},3797:function(e,t,r){var n,i,o;e.exports=(o=r(9021),r(7165),o.mode.OFB=(n=o.lib.BlockCipherMode.extend(),i=n.Encryptor=n.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._keystream;i&&(o=this._keystream=i.slice(0),this._iv=void 0),r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}}),n.Decryptor=i,n),o.mode.OFB)},2073:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,i=n-r%n,o=r+i-1;e.clamp(),e.words[o>>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Ansix923)},4905:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.Iso10126={pad:function(e,t){var r=4*t,i=r-e.sigBytes%r;e.concat(n.lib.WordArray.random(i-1)).concat(n.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Iso10126)},482:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.Iso97971={pad:function(e,t){e.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(e,t)},unpad:function(e){n.pad.ZeroPadding.unpad(e),e.sigBytes--}},n.pad.Iso97971)},8124:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding)},2155:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},n.pad.ZeroPadding)},19:function(e,t,r){var n,i,o,s,a,c,u,l,h;e.exports=(h=r(9021),r(3009),r(1025),i=(n=h).lib,o=i.Base,s=i.WordArray,a=n.algo,c=a.SHA256,u=a.HMAC,l=a.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=u.create(r.hasher,e),i=s.create(),o=s.create([1]),a=i.words,c=o.words,l=r.keySize,h=r.iterations;a.length<l;){var f=n.update(t).finalize(o);n.reset();for(var d=f.words,p=d.length,g=f,m=1;m<h;m++){g=n.finalize(g),n.reset();for(var y=g.words,v=0;v<p;v++)d[v]^=y[v]}i.concat(f),c[0]++}return i.sigBytes=4*l,i}}),n.PBKDF2=function(e,t,r){return l.create(r).compute(e,t)},h.PBKDF2)},2696:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(n[0]^=u,n[1]^=h,n[2]^=l,n[3]^=f,n[4]^=u,n[5]^=h,n[6]^=l,n[7]^=f,i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,c=((i*i>>>17)+i*a>>>15)+a*a,u=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),n.RabbitLegacy)},6298:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(i[0]^=u,i[1]^=h,i[2]^=l,i[3]^=f,i[4]^=u,i[5]^=h,i[6]^=l,i[7]^=f,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,c=((i*i>>>17)+i*a>>>15)+a*a,u=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),n.Rabbit)},7193:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=r.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var o=0;i<256;i++){var s=i%r,a=t[s>>>2]>>>24-s%4*8&255;o=(o+n[i]+a)%256;var c=n[i];n[i]=n[o],n[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}e.RC4=t._createHelper(i);var s=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(),n.RC4)},8056:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=i.create([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=i.create([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=i.create([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]),l=i.create([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]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),f=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=s.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,s,d,w,_,k,S,E,C,T,A,x=this._hash.words,I=h.words,P=f.words,R=a.words,M=c.words,O=u.words,B=l.words;for(k=o=x[0],S=s=x[1],E=d=x[2],C=w=x[3],T=_=x[4],r=0;r<80;r+=1)A=o+e[t+R[r]]|0,A+=r<16?p(s,d,w)+I[0]:r<32?g(s,d,w)+I[1]:r<48?m(s,d,w)+I[2]:r<64?y(s,d,w)+I[3]:v(s,d,w)+I[4],A=(A=b(A|=0,O[r]))+_|0,o=_,_=w,w=b(d,10),d=s,s=A,A=k+e[t+M[r]]|0,A+=r<16?v(S,E,C)+P[0]:r<32?y(S,E,C)+P[1]:r<48?m(S,E,C)+P[2]:r<64?g(S,E,C)+P[3]:p(S,E,C)+P[4],A=(A=b(A|=0,B[r]))+T|0,k=T,T=C,C=b(E,10),E=S,S=A;A=x[1]+d+C|0,x[1]=x[2]+w+T|0,x[2]=x[3]+_+k|0,x[3]=x[4]+o+S|0,x[4]=x[0]+s+E|0,x[0]=A},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function g(e,t,r){return e&t|~e&r}function m(e,t,r){return(e|~t)^r}function y(e,t,r){return e&r|t&~r}function v(e,t,r){return e^(t|~r)}function b(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(d),t.HmacRIPEMD160=o._createHmacHelper(d)}(Math),n.RIPEMD160)},5471:function(e,t,r){var n,i,o,s,a,c,u,l;e.exports=(l=r(9021),i=(n=l).lib,o=i.WordArray,s=i.Hasher,a=n.algo,c=[],u=a.SHA1=s.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=0;u<80;u++){if(u<16)c[u]=0|e[t+u];else{var l=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=l<<1|l>>>31}var h=(n<<5|n>>>27)+a+c[u];h+=u<20?1518500249+(i&o|~i&s):u<40?1859775393+(i^o^s):u<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,a=s,s=o,o=i<<30|i>>>2,i=n,n=h}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=s._createHelper(u),n.HmacSHA1=s._createHmacHelper(u),l.SHA1)},6308:function(e,t,r){var n,i,o,s,a,c;e.exports=(c=r(9021),r(3009),i=(n=c).lib.WordArray,o=n.algo,s=o.SHA256,a=o.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=s._createHelper(a),n.HmacSHA224=s._createHmacHelper(a),c.SHA224)},3009:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(a[i]=r(e.pow(n,.5))),c[i]=r(e.pow(n,1/3)),i++),n++}();var u=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],h=r[6],f=r[7],d=0;d<64;d++){if(d<16)u[d]=0|e[t+d];else{var p=u[d-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[d-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[d]=g+u[d-7]+y+u[d-16]}var v=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+c[d]+u[d];f=h,h=l,l=a,a=s+w|0,s=o,o=i,i=n,n=w+(b+v)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+h|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)},5953:function(e,t,r){var n;e.exports=(n=r(9021),r(3240),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.x64.Word,a=t.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var a=0,h=0,f=0;f<7;f++){if(1&i){var d=(1<<f)-1;d<32?h^=1<<d:a^=1<<d-32}128&i?i=i<<1^113:i<<=1}l[o]=s.create(a,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=s.create()}();var f=a.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var o=e[t+2*i],s=e[t+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(x=r[i]).high^=s,x.low^=o}for(var a=0;a<24;a++){for(var f=0;f<5;f++){for(var d=0,p=0,g=0;g<5;g++)d^=(x=r[f+5*g]).high,p^=x.low;var m=h[f];m.high=d,m.low=p}for(f=0;f<5;f++){var y=h[(f+4)%5],v=h[(f+1)%5],b=v.high,w=v.low;for(d=y.high^(b<<1|w>>>31),p=y.low^(w<<1|b>>>31),g=0;g<5;g++)(x=r[f+5*g]).high^=d,x.low^=p}for(var _=1;_<25;_++){var k=(x=r[_]).high,S=x.low,E=c[_];E<32?(d=k<<E|S>>>32-E,p=S<<E|k>>>32-E):(d=S<<E-32|k>>>64-E,p=k<<E-32|S>>>64-E);var C=h[u[_]];C.high=d,C.low=p}var T=h[0],A=r[0];for(T.high=A.high,T.low=A.low,f=0;f<5;f++)for(g=0;g<5;g++){var x=r[_=f+5*g],I=h[_],P=h[(f+1)%5+5*g],R=h[(f+2)%5+5*g];x.high=I.high^~P.high&R.high,x.low=I.low^~P.low&R.low}x=r[0];var M=l[a];x.high^=M.high,x.low^=M.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,u=[],l=0;l<c;l++){var h=s[l],f=h.high,d=h.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),u.push(d),u.push(f)}return new i.init(u,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(f),t.HmacSHA3=o._createHmacHelper(f)}(Math),n.SHA3)},9557:function(e,t,r){var n,i,o,s,a,c,u,l;e.exports=(l=r(9021),r(3240),r(1380),i=(n=l).x64,o=i.Word,s=i.WordArray,a=n.algo,c=a.SHA512,u=a.SHA384=c.extend({_doReset:function(){this._hash=new s.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=c._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=c._createHelper(u),n.HmacSHA384=c._createHmacHelper(u),l.SHA384)},1380:function(e,t,r){var n;e.exports=(n=r(9021),r(3240),function(){var e=n,t=e.lib.Hasher,r=e.x64,i=r.Word,o=r.WordArray,s=e.algo;function a(){return i.create.apply(i,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var l=s.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],h=r[6],f=r[7],d=n.high,p=n.low,g=i.high,m=i.low,y=o.high,v=o.low,b=s.high,w=s.low,_=a.high,k=a.low,S=l.high,E=l.low,C=h.high,T=h.low,A=f.high,x=f.low,I=d,P=p,R=g,M=m,O=y,B=v,N=b,L=w,D=_,U=k,j=S,F=E,z=C,V=T,q=A,W=x,H=0;H<80;H++){var K,G,$=u[H];if(H<16)G=$.high=0|e[t+2*H],K=$.low=0|e[t+2*H+1];else{var Q=u[H-15],J=Q.high,Y=Q.low,X=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Z=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=u[H-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=u[H-7],se=oe.high,ae=oe.low,ce=u[H-16],ue=ce.high,le=ce.low;G=(G=(G=X+se+((K=Z+ae)>>>0<Z>>>0?1:0))+ne+((K+=ie)>>>0<ie>>>0?1:0))+ue+((K+=le)>>>0<le>>>0?1:0),$.high=G,$.low=K}var he,fe=D&j^~D&z,de=U&F^~U&V,pe=I&R^I&O^R&O,ge=P&M^P&B^M&B,me=(I>>>28|P<<4)^(I<<30|P>>>2)^(I<<25|P>>>7),ye=(P>>>28|I<<4)^(P<<30|I>>>2)^(P<<25|I>>>7),ve=(D>>>14|U<<18)^(D>>>18|U<<14)^(D<<23|U>>>9),be=(U>>>14|D<<18)^(U>>>18|D<<14)^(U<<23|D>>>9),we=c[H],_e=we.high,ke=we.low,Se=q+ve+((he=W+be)>>>0<W>>>0?1:0),Ee=ye+ge;q=z,W=V,z=j,V=F,j=D,F=U,D=N+(Se=(Se=(Se=Se+fe+((he+=de)>>>0<de>>>0?1:0))+_e+((he+=ke)>>>0<ke>>>0?1:0))+G+((he+=K)>>>0<K>>>0?1:0))+((U=L+he|0)>>>0<L>>>0?1:0)|0,N=O,L=B,O=R,B=M,R=I,M=P,I=Se+(me+pe+(Ee>>>0<ye>>>0?1:0))+((P=he+Ee|0)>>>0<he>>>0?1:0)|0}p=n.low=p+P,n.high=d+I+(p>>>0<P>>>0?1:0),m=i.low=m+M,i.high=g+R+(m>>>0<M>>>0?1:0),v=o.low=v+B,o.high=y+O+(v>>>0<B>>>0?1:0),w=s.low=w+L,s.high=b+N+(w>>>0<L>>>0?1:0),k=a.low=k+U,a.high=_+D+(k>>>0<U>>>0?1:0),E=l.low=E+F,l.high=S+j+(E>>>0<F>>>0?1:0),T=h.low=T+V,h.high=C+z+(T>>>0<V>>>0?1:0),x=f.low=x+W,f.high=A+q+(x>>>0<W>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),n.SHA512)},7628:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib,r=t.WordArray,i=t.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],l=c[o];for(r=0;r<24;r++)u[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(r=0;r<16;r++)h[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=u[c][((s^i[c])&l[c])>>>0];this._lBlock=s,this._rBlock=o^a}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,f.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function d(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=i._createHelper(h);var p=o.TripleDES=i.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),n=e.length<4?e.slice(0,2):e.slice(2,4),i=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=h.createEncryptor(r.create(t)),this._des2=h.createEncryptor(r.create(n)),this._des3=h.createEncryptor(r.create(i))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(p)}(),n.TripleDES)},3240:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.Base,o=r.WordArray,s=t.x64={};s.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=i.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:8*t.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return o.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),n)},7007:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){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 h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function f(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):p(i,i.length)}function d(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 p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(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(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.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},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(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},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(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,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;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,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.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,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[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},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},3790:(e,t,r)=>{e.exports=function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){var r=t[s][1][e];return i(r||e)}),u,u.exports,e,t,r,n)}return r[s].exports}for(var o=void 0,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,n){(function(e){var r,n,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,s=new i(l),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),r=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var c=new e.MessageChannel;c.port1.onmessage=l,r=function(){c.port2.postMessage(0)}}var u=[];function l(){var e,t;n=!0;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}n=!1}function h(e){1!==u.push(e)||n||r()}t.exports=h}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&d(this,e)}function l(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function h(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return o.reject(e,t)}n===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,n)}))}function f(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1;function n(t){r||(r=!0,o.reject(e,t))}function i(t){r||(r=!0,o.resolve(e,t))}function s(){t(i,n)}var a=p(s);"error"===a.status&&n(a.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}function g(e){return e instanceof this?e:o.resolve(new this(i),e)}function m(e){var t=new this(i);return o.reject(t,e)}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var s=new Array(r),a=0,c=-1,u=new this(i);++c<r;)l(e[c],c);return u;function l(e,i){function c(e){s[i]=e,++a!==r||n||(n=!0,o.resolve(u,s))}t.resolve(e).then(c,(function(e){n||(n=!0,o.reject(u,e))}))}}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var s=-1,a=new this(i);++s<r;)c(e[s]);return a;function c(e){t.resolve(e).then((function(e){n||(n=!0,o.resolve(a,e))}),(function(e){n||(n=!0,o.reject(a,e))}))}}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var r=new this.constructor(i);return this.state!==c?h(r,this.state===a?e:t,this.outcome):this.queue.push(new l(r,e,t)),r},l.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){o.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},o.resolve=function(e,t){var r=p(f,t);if("error"===r.status)return o.reject(e,r.value);var n=r.value;if(n)d(e,n);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=g,u.reject=m,u.all=y,u.race=v},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var 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};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var s=o();function a(){try{if(!s||!s.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function c(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var u=Promise;function l(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function h(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function d(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},y=Object.prototype.toString,v="readonly",b="readwrite";function w(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}function _(e){return new u((function(t){var r=e.transaction(p,b),n=c([""]);r.objectStore(p).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function k(e){return"boolean"==typeof g?u.resolve(g):_(e).then((function(e){return g=e}))}function S(e){var t=m[e.name],r={};r.promise=new u((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function E(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function C(e,t){var r=m[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function T(e,t){return new u((function(r,n){if(m[e.name]=m[e.name]||L(),e.db){if(!t)return r(e.db);S(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=s.open.apply(s,i);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(p)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),E(e)}}))}function A(e){return T(e,!1)}function x(e){return T(e,!0)}function I(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function P(e){return new u((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}function R(e){return c([w(atob(e.data))],{type:e.type})}function M(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,r=t._initReady().then((function(){var e=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(r,e,e),r}function B(e){S(e);for(var t=m[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,A(e).then((function(t){return e.db=t,I(e)?x(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw C(e,t),t}))}function N(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return u.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),x(e)})).then((function(){return B(e).then((function(){N(e,t,r,n-1)}))})).catch(r);r(i)}}function L(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function D(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=m[r.name];i||(i=L(),m[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var o=[];function s(){return u.resolve()}for(var a=0;a<i.forages.length;a++){var c=i.forages[a];c!==t&&o.push(c._initReady().catch(s))}var l=i.forages.slice(0);return u.all(o).then((function(){return r.db=i.db,A(r)})).then((function(e){return r.db=e,I(r,t._defaultConfig.version)?x(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<l.length;n++){var o=l[n];o!==t&&(o._dbInfo.db=r.db,o._dbInfo.version=r.version)}}))}function U(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){N(r._dbInfo,v,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),M(e)&&(e=R(e)),t(e)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function j(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){N(r._dbInfo,v,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var r=s.result;if(r){var n=r.value;M(n)&&(n=R(n));var i=e(n,r.key,a++);void 0!==i?t(i):r.continue()}else t()},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function F(e,t,r){var n=this;e=f(e);var i=new u((function(r,i){var o;n.ready().then((function(){return o=n._dbInfo,"[object Blob]"===y.call(t)?k(o.db).then((function(e){return e?t:P(t)})):t})).then((function(t){N(n._dbInfo,b,(function(o,s){if(o)return i(o);try{var a=s.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),r(t)},s.onabort=s.onerror=function(){var e=c.error?c.error:c.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return l(i,r),i}function z(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){N(r._dbInfo,b,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){n(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function V(e){var t=this,r=new u((function(e,r){t.ready().then((function(){N(t._dbInfo,b,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return l(r,e),r}function q(e){var t=this,r=new u((function(e,r){t.ready().then((function(){N(t._dbInfo,v,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return l(r,e),r}function W(e,t){var r=this,n=new u((function(t,n){e<0?t(null):r.ready().then((function(){N(r._dbInfo,v,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName),a=!1,c=s.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||a?t(r.key):(a=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function H(e){var t=this,r=new u((function(e,r){t.ready().then((function(){N(t._dbInfo,v,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var t=o.result;t?(s.push(t.key),t.continue()):e(s)},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return l(r,e),r}function K(e,t){t=d.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var o=e.name===r.name&&i._dbInfo.db?u.resolve(i._dbInfo.db):A(e).then((function(t){var r=m[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));n=e.storeName?o.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;S(e);var n=m[e.name],i=n.forages;t.close();for(var o=0;o<i.length;o++){var a=i[o];a._dbInfo.db=null,a._dbInfo.version=r}var c=new u((function(t,n){var i=s.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}));return c.then((function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,E(r._dbInfo)}})).catch((function(t){throw(C(e,t)||u.resolve()).catch((function(){})),t}))}})):o.then((function(t){S(e);var r=m[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;var o=new u((function(t,r){var n=s.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return o.then((function(e){r.db=e;for(var t=0;t<n.length;t++)E(n[t]._dbInfo)})).catch((function(t){throw(C(e,t)||u.resolve()).catch((function(){})),t}))}))}else n=u.reject("Invalid arguments");return l(n,t),n}var G={_driver:"asyncStorage",_initStorage:D,_support:a(),iterate:j,getItem:U,setItem:F,removeItem:z,clear:V,length:q,key:W,keys:H,dropInstance:K};function $(){return"function"==typeof openDatabase}var Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J="~~local_forage_type~",Y=/^~~local_forage_type~([^~]+)~/,X="__lfsc__:",Z=X.length,ee="arbf",te="blob",re="si08",ne="ui08",ie="uic8",oe="si16",se="si32",ae="ur16",ce="ui32",ue="fl32",le="fl64",he=Z+ee.length,fe=Object.prototype.toString;function de(e){var t,r,n,i,o,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var u=new ArrayBuffer(s),l=new Uint8Array(u);for(t=0;t<a;t+=4)r=Q.indexOf(e[t]),n=Q.indexOf(e[t+1]),i=Q.indexOf(e[t+2]),o=Q.indexOf(e[t+3]),l[c++]=r<<2|n>>4,l[c++]=(15&n)<<4|i>>2,l[c++]=(3&i)<<6|63&o;return u}function pe(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=Q[r[t]>>2],n+=Q[(3&r[t])<<4|r[t+1]>>4],n+=Q[(15&r[t+1])<<2|r[t+2]>>6],n+=Q[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function ge(e,t){var r="";if(e&&(r=fe.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===fe.call(e.buffer))){var n,i=X;e instanceof ArrayBuffer?(n=e,i+=ee):(n=e.buffer,"[object Int8Array]"===r?i+=re:"[object Uint8Array]"===r?i+=ne:"[object Uint8ClampedArray]"===r?i+=ie:"[object Int16Array]"===r?i+=oe:"[object Uint16Array]"===r?i+=ae:"[object Int32Array]"===r?i+=se:"[object Uint32Array]"===r?i+=ce:"[object Float32Array]"===r?i+=ue:"[object Float64Array]"===r?i+=le:t(new Error("Failed to get type for BinaryArray"))),t(i+pe(n))}else if("[object Blob]"===r){var o=new FileReader;o.onload=function(){var r=J+e.type+"~"+pe(this.result);t(X+te+r)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}}function me(e){if(e.substring(0,Z)!==X)return JSON.parse(e);var t,r=e.substring(he),n=e.substring(Z,he);if(n===te&&Y.test(r)){var i=r.match(Y);t=i[1],r=r.substring(i[0].length)}var o=de(r);switch(n){case ee:return o;case te:return c([o],{type:t});case re:return new Int8Array(o);case ne:return new Uint8Array(o);case ie:return new Uint8ClampedArray(o);case oe:return new Int16Array(o);case ae:return new Uint16Array(o);case se:return new Int32Array(o);case ce:return new Uint32Array(o);case ue:return new Float32Array(o);case le:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}}var ye={serialize:ge,deserialize:me,stringToBuffer:de,bufferToString:pe};function ve(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function be(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new u((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){ve(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=ye,i}function we(e,t,r,n,i,o){e.executeSql(r,n,i,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?o(e,s):ve(e,t,(function(){e.executeSql(r,n,i,o)}),o)}),o):o(e,s)}),o)}function _e(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function ke(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var o=n.rows,s=o.length,a=0;a<s;a++){var c=o.item(a),u=c.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=e(u,c.key,a+1)))return void t(u)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Se(e,t,r,n){var i=this;e=f(e);var o=new u((function(o,s){i.ready().then((function(){void 0===t&&(t=null);var a=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,u){u?s(u):c.db.transaction((function(r){we(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){o(a)}),(function(e,t){s(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void o(Se.apply(i,[e,a,r,n-1]));s(t)}}))}))})).catch(s)}));return l(o,r),o}function Ee(e,t,r){return Se.apply(this,[e,t,r,1])}function Ce(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Te(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Ae(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function xe(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Ie(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Pe(e){return new u((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],o=0;o<n.rows.length;o++)i.push(n.rows.item(o).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}function Re(e,t){t=d.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return l(n=e.name?new u((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(Pe(n))})).then((function(e){return new u((function(t,r){e.db.transaction((function(n){function i(e){return new u((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var o=[],s=0,a=e.storeNames.length;s<a;s++)o.push(i(e.storeNames[s]));u.all(o).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):u.reject("Invalid arguments"),t),n}var Me={_driver:"webSQLStorage",_initStorage:be,_support:$(),iterate:ke,getItem:_e,setItem:Ee,removeItem:Ce,clear:Te,length:Ae,key:xe,keys:Ie,dropInstance:Re};function Oe(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Be(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Ne(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Le(){return!Ne()||localStorage.length>0}function De(e){var t=this,r={};if(e)for(var n in e)r[n]=e[n];return r.keyPrefix=Be(e,t._defaultConfig),Le()?(t._dbInfo=r,r.serializer=ye,u.resolve()):u.reject()}function Ue(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return l(r,e),r}function je(e,t){var r=this;e=f(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return l(n,t),n}function Fe(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,o=localStorage.length,s=1,a=0;a<o;a++){var c=localStorage.key(a);if(0===c.indexOf(n)){var u=localStorage.getItem(c);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,c.substring(i),s++)))return u}}}));return l(n,t),n}function ze(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return l(n,t),n}function Ve(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var o=localStorage.key(i);0===o.indexOf(e.keyPrefix)&&n.push(o.substring(e.keyPrefix.length))}return n}));return l(r,e),r}function qe(e){var t=this.keys().then((function(e){return e.length}));return l(t,e),t}function We(e,t){var r=this;e=f(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return l(n,t),n}function He(e,t,r){var n=this;e=f(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new u((function(i,o){var s=n._dbInfo;s.serializer.serialize(t,(function(t,n){if(n)o(n);else try{localStorage.setItem(s.keyPrefix+e,t),i(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}}))}))}));return l(i,r),i}function Ke(e,t){if(t=d.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new u((function(t){e.storeName?t(Be(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):u.reject("Invalid arguments"),l(n,t),n}var Ge={_driver:"localStorageWrapper",_initStorage:De,_support:Oe(),iterate:Fe,getItem:je,setItem:He,removeItem:We,clear:Ue,length:qe,key:ze,keys:Ve,dropInstance:Ke},$e=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Qe=function(e,t){for(var r=e.length,n=0;n<r;){if($e(e[n],t))return!0;n++}return!1},Je=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Ye={},Xe={},Ze={INDEXEDDB:G,WEBSQL:Me,LOCALSTORAGE:Ge},et=[Ze.INDEXEDDB._driver,Ze.WEBSQL._driver,Ze.LOCALSTORAGE._driver],tt=["dropInstance"],rt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),nt={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function it(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function ot(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(Je(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var st=function(){function e(t){for(var r in i(this,e),Ze)if(Ze.hasOwnProperty(r)){var n=Ze[r],o=n._driver;this[r]=o,Ye[o]||this.defineDriver(n)}this._defaultConfig=ot({},nt),this._config=ot({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new u((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var o=rt.concat("_initStorage"),s=0,a=o.length;s<a;s++){var c=o[s];if((!Qe(tt,c)||e[c])&&"function"!=typeof e[c])return void r(i)}var h=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=u.reject(t);return l(r,arguments[arguments.length-1]),r}},r=0,n=tt.length;r<n;r++){var i=tt[r];e[i]||(e[i]=t(i))}};h();var f=function(r){Ye[n]&&console.info("Redefining LocalForage driver: "+n),Ye[n]=e,Xe[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(f,r):f(!!e._support):f(!0)}catch(e){r(e)}}));return h(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=Ye[e]?u.resolve(Ye[e]):u.reject(new Error("Driver not found."));return h(n,t,r),n},e.prototype.getSerializer=function(e){var t=u.resolve(ye);return h(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return h(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;Je(e)||(e=[e]);var i=this._getSupportedDrivers(e);function o(){n._config.driver=n.driver()}function s(e){return n._extend(e),o(),n._ready=n._initStorage(n._config),n._ready}function a(e){return function(){var t=0;function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(r)}o();var a=new Error("No available storage method found.");return n._driverSet=u.reject(a),n._driverSet}return r()}}var c=null!==this._driverSet?this._driverSet.catch((function(){return u.resolve()})):u.resolve();return this._driverSet=c.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,o(),n._wrapLibraryMethodsWithReady(),n._initDriver=a(i)}))})).catch((function(){o();var e=new Error("No available storage method found.");return n._driverSet=u.reject(e),n._driverSet})),h(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!Xe[e]},e.prototype._extend=function(e){ot(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=rt.length;e<t;e++)it(this,rt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new st;t.exports=at},{3:3}]},{},[4])(4)},5602:e=>{var t=e.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(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))},7363:(e,t,r)=>{var n=r(5020),i=r(3804);r(5602),t.M9=i,t.qg=n.parse,n.parseParams,n.parseFmtpConfig,n.parsePayloads,n.parseRemoteCandidates,n.parseImageAttributes,n.parseSimulcastStreamList},5020:(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 o=e.push?{}:i?t[e.name]:t;!function(e,t,r,i){if(i&&!r)t[i]=n(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(t[r[o]]=n(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},o=r(5602),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},r=[],n=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),n=r[r.length-1]);for(var a=0;a<(o[t]||[]).length;a+=1){var c=o[t][a];if(c.reg.test(s))return i(c,n,s)}})),t.media=r,t};var a=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};t.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.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},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.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}}))}))}},3804:(e,t,r)=>{var n=r(5602),i=/%[sdv%]/g,o=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""}}))},s=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 s=t.names[i];t.name?n.push(r[t.name][s]):n.push(r[t.names[i]])}else n.push(r[t.name]);return o.apply(null,n)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],c=["i","c","b","a"];e.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||a,i=t.innerOrder||c,o=[];return r.forEach((function(t){n[t].forEach((function(r){r.name in e&&null!=e[r.name]?o.push(s(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){o.push(s(t,r,e))}))}))})),e.media.forEach((function(e){o.push(s("m",n.m[0],e)),i.forEach((function(t){n[t].forEach((function(r){r.name in e&&null!=e[r.name]?o.push(s(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){o.push(s(t,r,e))}))}))}))})),o.join("\r\n")+"\r\n"}},5653:()=>{},8535:()=>{},9546:()=>{},2472:()=>{},477:()=>{},5995:()=>{},6351:e=>{e.exports={version:"0.3.7"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};r.d(n,{Yk:()=>Pr,Id:()=>i,Mz:()=>or,Ne:()=>O,bq:()=>L,hj:()=>o,h4:()=>u,dC:()=>c,xk:()=>l,J:()=>kr,a7:()=>Tr,s_:()=>Er,VO:()=>Sr,VF:()=>Ar,M0:()=>Cr,$b:()=>J,WI:()=>Q,cp:()=>xr,ez:()=>dr,EQ:()=>fr,$t:()=>gr,jL:()=>qr,Ps:()=>Mr,VV:()=>Rr,_b:()=>M,dT:()=>Ht,CM:()=>B,Zq:()=>hr});class i{type;data;constructor(e,t){this.type=e,this.data=t}}let o=function(e){return e[e.Error=-1]="Error",e[e.Self=1]="Self",e[e.Kicked=2]="Kicked",e[e.Replace=3]="Replace",e[e.Timeout=4]="Timeout",e[e.Destroy=5]="Destroy",e}({});class s{static CHANNEL_UPDATE="channel_update";static JOIN_SUCCEED="join_succeed";static ME_UPDATE="me_update";static RECONNECTING="reconnecting";static RECONNECTED="reconnected";static DISCONNECTED="disconnected";static USER_JOIN="user_join";static USER_UPDATE="user_update";static USER_LEAVE="user_leave";static USER_TRACK_ADD="user_track_add";static USER_TRACK_UPDATE="user_track_update";static USER_TRACK_REMOVE="user_track_remove";static CUSTOM_MSG="custom_msg";static TRACK_MUTED="track_muted";static TRACK_UNMUTED="track_unmuted";static TRACK_ENDED="track_ended"}class a{static INFO_UPDATE="info_update";static MUTED="muted";static UNMUTED="unmuted";static ENDED="ended"}class c{type;data;constructor(e,t){this.type=e,this.data=t}}let u=function(e){return e[e.Error=-1]="Error",e[e.Self=1]="Self",e[e.Kicked=2]="Kicked",e[e.Timeout=4]="Timeout",e}({});class l{static ENABLE_SUCCEED="enable_succeed";static RECONNECTING="reconnecting";static RECONNECTED="reconnected";static DISCONNECTED="disconnected";static IM_MSG="im_msg"}var h=r(7007),f=r.n(h),d=r(1396),p=r(955),g=r.n(p);function m(){return"undefined"!=typeof uni&&"mp-weixin"===uni.getSystemInfoSync().uniPlatform||"undefined"==typeof uni&&"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfo}function y(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function v(e){return Object.keys(e).filter((t=>null!==e[t]&&void 0!==e[t])).reduce(((t,r)=>({...t,[r]:e[r]})),{})}function b(e){return"string"==typeof e}function w(){}class _{m_lastPromise=Promise.resolve();async lock(e=!1){let t=w;if(e)return t;const r=this.m_lastPromise;return this.m_lastPromise=new Promise((e=>t=e)),await r,t}}async function k(e){return new Promise((t=>{setTimeout(t,e)}))}function S(e,t){let r=!1;t={maxRetries:10,initialDelay:500,...t};let n=()=>new Promise(((n,i)=>{let o=0,s=async a=>{if(r)i("canceled");else try{if(o>0){if(t?.onRetry&&!1===t.onRetry(o,a))return void i("canceled");let e=Math.pow(2,o-1)*t.initialDelay;await k(e)}let r=await e();n(r)}catch(e){t.maxRetries>0&&o>=t.maxRetries?i("maxretry"):(o++,s(e))}};s()}));return n.cancel=()=>{r=!0},n}function E(e,t,r){let n=[];var i;return(i=t,Object.getOwnPropertyNames(i)).forEach((i=>{let o=!0;y(e[i])?JSON.stringify(e[i])!==JSON.stringify(t[i])&&(o=!1):e[i]!==t[i]&&(o=!1),o||(n.push({prop:i,value:t[i],old:e[i]}),r&&r[i]?r[i](t[i],e[i]):e[i]=t[i])})),n}function C(e,t=new Date){for(var r="",n=t.getMonth(),i=n+1,o=t.getDay(),s=t.getDate(),a=t.getFullYear(),c=t.getHours(),u=t.getMinutes(),l=t.getSeconds(),h=0,f=e.length;h<f;h++)switch(e[h]){case"j":r+=s;break;case"d":r+=s<10?"0"+s:s;break;case"l":var d=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");r+=d[o];break;case"w":r+=o;break;case"D":r+=(d=Array("Sun","Mon","Tue","Wed","Thr","Fri","Sat"))[o];break;case"m":r+=i<10?"0"+i:i;break;case"n":r+=i;break;case"F":var p=Array("January","February","March","April","May","June","July","August","September","October","November","December");r+=p[n];break;case"M":r+=(p=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"))[n];break;case"Y":r+=a;break;case"y":r+=a.toString().slice(-2);break;case"H":r+=c<10?"0"+c:c;break;case"g":var g=0===c?12:c;r+=g>12?g-12:g;break;case"h":r+=(g=(g=0===c?12:c)>12?g-12:g)<10?"0"+g:g;break;case"a":r+=c<12?"am":"pm";break;case"i":r+=u<10?"0"+u:u;break;case"s":r+=l<10?"0"+l:l;break;case"c":r+=t.toISOString();break;default:r+=e[h]}return r}function T(e,t){if(t<0)throw new Error("小数位数必须是非负整数");const r=Math.pow(10,t);return Math.round(e*r)/r}function A(e=18){e=e||32;let t="ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz1234567890",r="";for(let n=0;n<e;n++)r+=t.charAt(Math.floor(61*Math.random()));return r}function x(e){const t=e.match(/^(?:.+?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+)/im);return t&&t[1]?t[1]:""}function I(e){return JSON.parse(g().decrypt(e,d.enc.Utf8.parse("6o30j79YRE39bEwI"),{iv:d.enc.Utf8.parse("2apW3WiFl72ZVS3x"),padding:d.pad.Pkcs7,mode:d.mode.CBC}).toString(d.enc.Utf8))}function P(e){return e<=0?-60:Math.max(-60,Math.round(20*Math.log10(e)))}const R="__amixer__";let M=function(e){return e.Video="video",e.Audio="audio",e}({}),O=function(e){return e[e.H264=27]="H264",e[e.H265=36]="H265",e[e.AAC=15]="AAC",e[e.VP8=56]="VP8",e[e.VP9=57]="VP9",e[e.AV1=58]="AV1",e[e.OPUS=1398100047]="OPUS",e}({});function B(e){for(const[t,r]of Object.entries(O))if(r===e)return t;return""}class N extends(f()){info;uid;prevStats;constructor(e,t){super(),this.info=e,this.uid=t}get id(){return this.info.id}get kind(){return this.info.kind}get desc(){return this.info.desc}getInfo(){let e={...this.info};return e.props={...e.props},e}updateInfo(e){let t=E(this.info,e);return t.length>0&&this.emit(a.INFO_UPDATE,this),t}getUid(){return this.uid}strPrefix(){return"流轨道"}toString(){const e=[this.uid?`uid:${this.uid}`:null,this.info.desc?`desc:${this.info.desc}`:null,this.id?`id:${this.info.id}`:null].filter(Boolean);return this.strPrefix()+"["+e.join("; ")+"]"}}let L=function(e){return e[e.Unknown=0]="Unknown",e[e.Windows=1]="Windows",e[e.Android=2]="Android",e[e.IOS=3]="IOS",e[e.Linux=4]="Linux",e[e.MacOS=5]="MacOS",e[e.WebRTC=6]="WebRTC",e[e.XCX=7]="XCX",e}({});class D{code;msg;prefixCode(){return m()?"107":"106"}constructor(e,t=0){this.msg=e,this.code=t<1e3?Number(this.prefixCode()+String(t).padStart(3,"0")):t}static fromError(e){return new D(e.name+":"+e.message)}toString(){return`${this.code}: ${this.msg}`}toJSON(){return{code:this.code,msg:this.msg}}}const U=new D("您不在频道内",1),j=new D("token已过期",2),F=function(e){return new D(e||"流轨道不存在",3)};var z=r(3790),V=r.n(z);let q={keyPrefix:"",_driver:"localForageWxDriver",_initStorage:function(e){this.keyPrefix=e.name+"/"+e.storeName+"/"},_support:!!m(),getItem:function(e,t){return new Promise(((t,r)=>{try{t(wx.getStorageSync(this.keyPrefix+e))}catch(e){r(e)}}))},setItem:function(e,t,r){return new Promise(((r,n)=>{try{wx.setStorageSync(this.keyPrefix+e,t),r(t)}catch(e){n(e)}}))},removeItem:function(e,t){return new Promise(((t,r)=>{try{wx.removeStorageSync(this.keyPrefix+e),t()}catch(e){r(e)}}))},clear:async function(e){const t=(await this.keys()).map((e=>this.removeItem(e)));await Promise.all(t)},length:async function(e){return(await this.keys()).length},key:async function(e,t){return(await this.keys())[e]},keys:function(e){return new Promise(((e,t)=>{try{var r=this.keyPrefix.length;const t=wx.getStorageInfoSync();let i=[];for(let e=0;e<t.keys.length;e++){var n=t.keys[e];n.startsWith(this.keyPrefix)&&i.push(n.substring(r))}e(i)}catch(e){t(e)}}))},iterate:async function(e,t){const r=await this.keys();let n=1;for(var i=0;i<r.length;i++){const t=r[i];let o=e(await this.getItem(t),t,n++);if(void 0!==o)return o}},dropInstance:function(e,t){return this.clear()}},W=function(e){return e[e.Undefined=0]="Undefined",e[e.Trace=1]="Trace",e[e.Debug=5]="Debug",e[e.Info=9]="Info",e[e.Warn=13]="Warn",e[e.Error=17]="Error",e[e.FATAL=21]="FATAL",e}({}),H=function(e){return e.AppStart="app.start",e.AppResource="app.resource",e.AppNetwork="app.network",e.RtcEvtAudioInput="rtc.event.audioinput",e.RtcEvtAudioOutput="rtc.event.audiooutput",e.RtcEvtVideoInput="rtc.event.videoinput",e.RtcEvtVideoOutput="rtc.event.videooutput",e.RtcEvtRemoteStream="rtc.event.remotestream",e.RtcEvtConnection="rtc.event.connection",e.RtcMqtt="rtc.mqtt",e.RtcRequest="rtc.request",e.RtcOok="rtc.ook",e.RtcMarker="rtc.marker",e.RtcLog="rtc.log",e.AppLog="app.log",e}({});var K=function(e){return e[e.Log=0]="Log",e[e.Metric=1]="Metric",e}(K||{});class G{enabled;token;deviceID;deviceType;api;storage;workTimer;isWorking=!1;keyIdx=0;startTime=Date.now();constructor(e,t,r,n){this.enabled=n,this.token=e,this.deviceID=t,this.deviceType=r,this.api=new $(e.app_id,e.log_center,t,r,"vaZ7MQ45m0KRjJ2u"),n&&(r==L.XCX&&V().defineDriver(q),r==L.XCX?this.storage=V().createInstance({name:"rtcsdk",storeName:e.app_id+":"+e.uid,driver:q._driver}):this.storage=V().createInstance({name:"rtcsdk",storeName:e.app_id+":"+e.uid}),this.storage.ready().then((()=>{console.debug("localforage initialized",this.storage.driver()),this.work()})).catch((e=>{console.debug("localforage initialize error",e),this.storage=void 0})),this.workTimer=setInterval((()=>{this.work()}),6e4))}flush(){this.work()}shutdown(){clearInterval(this.workTimer)}async work(){if(this.enabled&&!this.isWorking){this.isWorking=!0;try{await this.upload()}catch(e){console.error("rtc日志上传报错",e)}finally{this.isWorking=!1}}}makeKey(e){let t=[e==K.Log?"log":"metric",this.startTime,this.keyIdx].join("_");return this.keyIdx++,t}async appendToStorage(e,t){if(!this.storage)return;let r=this.makeKey(e);await this.storage.setItem(r,t);let n=await this.storage.keys();if(n.length>=5e3){n.sort(((e,t)=>{let r=parseFloat(e.split("_").slice(1).join(".")),n=parseFloat(t.split("_").slice(1).join("."));return r<n?-1:r>n?1:0}));const e=n.slice(0,1e3).map((e=>this.storage.removeItem(e)));await Promise.all(e)}}async peekFromStorage(){if(!this.storage)return[];let e=await this.storage.keys();e.sort(((e,t)=>{let r=parseFloat(e.split("_").slice(1).join(".")),n=parseFloat(t.split("_").slice(1).join("."));return r<n?-1:r>n?1:0})),console.debug("rtclog storage count="+e.length);let t=[];for(let r=0;r<e.length;r++){let n=e[r],i={type:K.Log,key:n,content:void 0};if(n.startsWith("log_"))i.type=K.Log;else{if(!n.startsWith("metric_"))continue;i.type=K.Metric}if(i.content=await this.storage.getItem(n),i.content&&i.content.body&&Array.isArray(i.content.body)&&(i.content.body=JSON.stringify(i.content.body)),t.push(i),t.length>=500)break}return t}async removeStorage(e){if(!this.storage)return;const t=e.map((e=>this.storage.removeItem(e.key)));await Promise.all(t)}async upload(){let e=await this.peekFromStorage();if(0==e.length)return;let t={device_id:this.deviceID,device_type:this.deviceType,app_id:this.token.app_id,uid:this.token.uid,logs:[],metrics:[]};for(let r=0;r<e.length;r++){let n=e[r];n.type==K.Log?t.logs.push(n.content):n.type==K.Metric&&t.metrics.push(n.content)}await this.api.push(t),await this.removeStorage(e)}async addLog({body:e,level:t=W.Undefined,type:r=H.AppLog}){if(!this.enabled)return;let n={time:Date.now(),type:r,serverity:t,channel:"channel"in this.token?this.token.channel:void 0,attr:y(e)?e:{},body:y(e)?"":b(e)?e:JSON.stringify(e)};return await this.appendToStorage(K.Log,n)}async addMetric(e){if(this.enabled)return e.time=Date.now(),e.channel="channel"in this.token?this.token.channel:void 0,await this.appendToStorage(K.Metric,e)}}class ${appID;serverPrefix;deviceID;deviceType;logSecretKey;logToken;constructor(e,t,r,n,i){this.appID=e,"/"!==t.substring(t.length-1)&&(t+="/"),t+="v1/",this.serverPrefix=t,this.deviceID=r,this.deviceType=n,this.logSecretKey=i}async refreshToken(){let e={app_id:this.appID,device_id:this.deviceID,device_type:this.deviceType,requested_at:Date.now()};e.sign=this.signutreRequest(e);let t=await this.request("auth/gettoken",e);if(0!=t.code)throw new D("获取rtc日志中心token失败: "+t.msg,t.code);this.logToken=t.data.token}async push(e){this.logToken||await this.refreshToken();let t=await this.request("data/push",e);if(10041==t.code||10042==t.code||10043==t.code)return this.logToken="",this.push(e);if(0!=t.code)throw new D(t.msg,t.code);console.debug("上传rtc日志成功")}signutreRequest(e){let t,r=[];for(t in e)r.push(t+"="+e[t]);r.sort();let n=r.join("&")+"&"+this.logSecretKey;return(0,d.SHA256)(n).toString()}request(e,t){let r=this.serverPrefix+e,n={"Content-Type":"application/json;charset=UTF-8"};return this.logToken&&(n.Authorization="Bearer "+this.logToken),this.deviceType==L.XCX?new Promise(((e,i)=>{wx.request({url:r,method:"POST",header:n,data:JSON.stringify(t),success(t){if(200!=t.statusCode)i(new Error(t.statusCode+":"+t.errMsg));else{let r=t.data;e(r)}},fail:function(e){i(new Error(e.errMsg))}})})):new Promise(((e,i)=>{fetch(r,{method:"POST",headers:n,body:JSON.stringify(t)}).then((t=>{200!=t.status?i(new Error(t.status+":"+t.statusText)):t.json().then((t=>{e(t)})).catch((e=>{i(e)}))})).catch((e=>{i(e)}))}))}}let Q=function(e){return e.CONSOLE="console",e.WXREALTIME="wxrealtime",e.NONE="none",e}({}),J=function(e){return e.DEBUG="debug",e.INFO="info",e.WARN="warn",e.ERROR="error",e}({});class Y{logTarget=Q.CONSOLE;logLevel=J.INFO;center;dftPrefix;dftCenterLogType;constructor(e="rtc",t=H.RtcLog){this.dftPrefix=e,this.dftCenterLogType=t}setTarget(e){this.logTarget=e}setLevel(e){this.logLevel=e}logCss="border: 1px solid; padding:2px 5px; border-radius: 3px";getPrefix(e){return`%c ${C("H:i:s")} ${this.dftPrefix}_${e}`}debug(...e){if(this.logTarget!=Q.NONE&&(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).debug(this.dftPrefix+"_debug",...e),this.center?.addLog({level:W.Debug,type:this.dftCenterLogType,body:e}),this.logLevel===J.DEBUG))switch(this.logTarget){case Q.CONSOLE:return console.debug(this.getPrefix("debug"),this.logCss,...e);case Q.WXREALTIME:return wx.getRealtimeLogManager().info(this.dftPrefix+"_debug",...e)}}info(...e){if(this.logTarget!=Q.NONE&&(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).info(this.dftPrefix+"_info",...e),this.center?.addLog({level:W.Info,type:this.dftCenterLogType,body:e}),this.logLevel===J.DEBUG||this.logLevel===J.INFO))switch(this.logTarget){case Q.CONSOLE:return console.log(this.getPrefix("info"),this.logCss,...e);case Q.WXREALTIME:return wx.getRealtimeLogManager().info(this.dftPrefix+"_info",...e)}}warn(...e){if(this.logTarget!=Q.NONE&&(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).warn(this.dftPrefix+"_warn",...e),this.center?.addLog({level:W.Warn,type:this.dftCenterLogType,body:e}),this.logLevel===J.DEBUG||this.logLevel===J.INFO||this.logLevel===J.WARN))switch(this.logTarget){case Q.CONSOLE:return console.warn(this.getPrefix("warn"),this.logCss,...e);case Q.WXREALTIME:return wx.getRealtimeLogManager().warn(this.dftPrefix+"_warn",...e)}}error(...e){if(this.logTarget!=Q.NONE)switch(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).warn(this.dftPrefix+"_error",...e),console.error(this.getPrefix("error"),this.logCss,...e),this.center?.addLog({level:W.Error,type:this.dftCenterLogType,body:e}),this.logTarget){case Q.CONSOLE:return;case Q.WXREALTIME:return wx.getRealtimeLogManager().error(this.dftPrefix+"_error",...e)}}snapshotArgs(e){e.forEach(((t,r)=>{y(t)&&(t instanceof Error?e[r]=t.toString():e[r]=JSON.parse(JSON.stringify(t)))}))}}let X=new Y,Z=function(e){return e.UserJoin="user_join",e.UserUpdate="user_update",e.UserLeave="user_leave",e.StreamUpdate="stream_update",e.ChannelUpdate="channel_update",e.ChannelDestroy="channel_destroy",e.Custom="custom",e.ImMsg="im_msg",e.ImDisconnect="im_disconnect",e}({});var ee,te,re,ne=r(7594),ie=r.n(ne),oe=r(5995).Buffer;try{ee=new TextDecoder}catch(e){}var se=0;const ae=[];var ce,ue,le,he,fe,de=ae,pe=0,ge={},me=0,ye=0,ve=[],be={useRecords:!1,mapsAsObjects:!0};class we{}const _e=new we;_e.name="MessagePack 0xC1";var ke,Se,Ee,Ce=!1,Te=2;try{new Function("")}catch(e){Te=1/0}class Ae{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.sequential&&!1!==e.trusted&&(e.trusted=!0,e.structures||0==e.useRecords||(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(te)return rt((()=>(nt(),this?this.unpack(e,t):Ae.prototype.unpack.call(be,e,t))));e.buffer||e.constructor!==ArrayBuffer||(e=void 0!==oe?oe.from(e):new Uint8Array(e)),"object"==typeof t?(re=t.end||e.length,se=t.start||0):(se=0,re=t>-1?t:e.length),pe=0,ye=0,ue=null,de=ae,le=null,te=e;try{fe=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(te=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof Ae){if(ge=this,this.structures)return ce=this.structures,xe(t);(!ce||ce.length>0)&&(ce=[])}else ge=be,(!ce||ce.length>0)&&(ce=[]);return xe(t)}unpackMultiple(e,t){let r,n=0;try{Ce=!0;let i=e.length,o=this?this.unpack(e,i):ot.unpack(e,i);if(!t){for(r=[o];se<i;)n=se,r.push(xe());return r}if(!1===t(o,n,se))return;for(;se<i;)if(n=se,!1===t(xe(),n,se))return}catch(e){throw e.lastPosition=n,e.values=r,e}finally{Ce=!1,nt()}}_mergeStructures(e,t){Se&&(e=Se.call(this,e)),e=e||[],Object.isFrozen(e)&&(e=e.map((e=>e.slice(0))));for(let t=0,r=e.length;t<r;t++){let r=e[t];r&&(r.isShared=!0,t>=32&&(r.highByte=t-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],i=t[r];i&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function xe(e){try{if(!ge.trusted&&!Ce){let e=ce.sharedLength||0;e<ce.length&&(ce.length=e)}let t;if(ge.randomAccessStructure&&te[se]<64&&te[se]>=32&&ke?(t=ke(te,se,re,ge),te=null,e&&e.lazy||!t||(t=t.toJSON()),se=re):t=Pe(),le&&(se=le.postBundlePosition,le=null),Ce&&(ce.restoreStructures=null),se==re)ce&&ce.restoreStructures&&Ie(),ce=null,te=null,he&&(he=null);else{if(se>re)throw new Error("Unexpected end of MessagePack data");if(!Ce){let e;try{e=JSON.stringify(t,((e,t)=>"bigint"==typeof t?`${t}n`:t)).slice(0,100)}catch(t){e="(JSON view not available "+t+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(e){throw ce&&ce.restoreStructures&&Ie(),nt(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||se>re)&&(e.incomplete=!0),e}}function Ie(){for(let e in ce.restoreStructures)ce[e]=ce.restoreStructures[e];ce.restoreStructures=null}function Pe(){let e=te[se++];if(e<160){if(e<128){if(e<64)return e;{let t=ce[63&e]||ge.getStructures&&Be()[63&e];return t?(t.read||(t.read=Me(t,63&e)),t.read()):e}}if(e<144){if(e-=128,ge.mapsAsObjects){let t={};for(let r=0;r<e;r++){let e=Qe();"__proto__"===e&&(e="__proto_"),t[e]=Pe()}return t}{let t=new Map;for(let r=0;r<e;r++)t.set(Pe(),Pe());return t}}{e-=144;let t=new Array(e);for(let r=0;r<e;r++)t[r]=Pe();return ge.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(ye>=se)return ue.slice(se-me,(se+=t)-me);if(0==ye&&re<140){let e=t<16?We(t):qe(t);if(null!=e)return e}return Ne(t)}{let t;switch(e){case 192:return null;case 193:return le?(t=Pe(),t>0?le[1].slice(le.position1,le.position1+=t):le[0].slice(le.position0,le.position0-=t)):_e;case 194:return!1;case 195:return!0;case 196:if(t=te[se++],void 0===t)throw new Error("Unexpected end of buffer");return Ke(t);case 197:return t=fe.getUint16(se),se+=2,Ke(t);case 198:return t=fe.getUint32(se),se+=4,Ke(t);case 199:return Ge(te[se++]);case 200:return t=fe.getUint16(se),se+=2,Ge(t);case 201:return t=fe.getUint32(se),se+=4,Ge(t);case 202:if(t=fe.getFloat32(se),ge.useFloat32>2){let e=it[(127&te[se])<<1|te[se+1]>>7];return se+=4,(e*t+(t>0?.5:-.5)|0)/e}return se+=4,t;case 203:return t=fe.getFloat64(se),se+=8,t;case 204:return te[se++];case 205:return t=fe.getUint16(se),se+=2,t;case 206:return t=fe.getUint32(se),se+=4,t;case 207:return"number"===ge.int64AsType?(t=4294967296*fe.getUint32(se),t+=fe.getUint32(se+4)):"string"===ge.int64AsType?t=fe.getBigUint64(se).toString():"auto"===ge.int64AsType?(t=fe.getBigUint64(se),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=fe.getBigUint64(se),se+=8,t;case 208:return fe.getInt8(se++);case 209:return t=fe.getInt16(se),se+=2,t;case 210:return t=fe.getInt32(se),se+=4,t;case 211:return"number"===ge.int64AsType?(t=4294967296*fe.getInt32(se),t+=fe.getUint32(se+4)):"string"===ge.int64AsType?t=fe.getBigInt64(se).toString():"auto"===ge.int64AsType?(t=fe.getBigInt64(se),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=fe.getBigInt64(se),se+=8,t;case 212:if(t=te[se++],114==t)return Ye(63&te[se++]);{let e=ve[t];if(e)return e.read?(se++,e.read(Pe())):e.noBuffer?(se++,e()):e(te.subarray(se,++se));throw new Error("Unknown extension "+t)}case 213:return t=te[se],114==t?(se++,Ye(63&te[se++],te[se++])):Ge(2);case 214:return Ge(4);case 215:return Ge(8);case 216:return Ge(16);case 217:return t=te[se++],ye>=se?ue.slice(se-me,(se+=t)-me):Le(t);case 218:return t=fe.getUint16(se),ye>=(se+=2)?ue.slice(se-me,(se+=t)-me):De(t);case 219:return t=fe.getUint32(se),ye>=(se+=4)?ue.slice(se-me,(se+=t)-me):Ue(t);case 220:return t=fe.getUint16(se),se+=2,Fe(t);case 221:return t=fe.getUint32(se),se+=4,Fe(t);case 222:return t=fe.getUint16(se),se+=2,ze(t);case 223:return t=fe.getUint32(se),se+=4,ze(t);default:if(e>=224)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e)}}}const Re=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Me(e,t){function r(){if(r.count++>Te){let r=e.read=new Function("r","return function(){return "+(ge.freezeData?"Object.freeze":"")+"({"+e.map((e=>"__proto__"===e?"__proto_:r()":Re.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"})}")(Pe);return 0===e.highByte&&(e.read=Oe(t,e.read)),r()}let n={};for(let t=0,r=e.length;t<r;t++){let r=e[t];"__proto__"===r&&(r="__proto_"),n[r]=Pe()}return ge.freezeData?Object.freeze(n):n}return r.count=0,0===e.highByte?Oe(t,r):r}const Oe=(e,t)=>function(){let r=te[se++];if(0===r)return t();let n=e<32?-(e+(r<<5)):e+(r<<5),i=ce[n]||Be()[n];if(!i)throw new Error("Record id is not defined for "+n);return i.read||(i.read=Me(i,e)),i.read()};function Be(){let e=rt((()=>(te=null,ge.getStructures())));return ce=ge._mergeStructures(e,ce)}var Ne=je,Le=je,De=je,Ue=je;function je(e){let t;if(e<16&&(t=We(e)))return t;if(e>64&&ee)return ee.decode(te.subarray(se,se+=e));const r=se+e,n=[];for(t="";se<r;){const e=te[se++];if(128&e)if(192==(224&e)){const t=63&te[se++];n.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&te[se++],r=63&te[se++];n.push((31&e)<<12|t<<6|r)}else if(240==(248&e)){let t=(7&e)<<18|(63&te[se++])<<12|(63&te[se++])<<6|63&te[se++];t>65535&&(t-=65536,n.push(t>>>10&1023|55296),t=56320|1023&t),n.push(t)}else n.push(e);else n.push(e);n.length>=4096&&(t+=Ve.apply(String,n),n.length=0)}return n.length>0&&(t+=Ve.apply(String,n)),t}function Fe(e){let t=new Array(e);for(let r=0;r<e;r++)t[r]=Pe();return ge.freezeData?Object.freeze(t):t}function ze(e){if(ge.mapsAsObjects){let t={};for(let r=0;r<e;r++){let e=Qe();"__proto__"===e&&(e="__proto_"),t[e]=Pe()}return t}{let t=new Map;for(let r=0;r<e;r++)t.set(Pe(),Pe());return t}}var Ve=String.fromCharCode;function qe(e){let t=se,r=new Array(e);for(let n=0;n<e;n++){const e=te[se++];if((128&e)>0)return void(se=t);r[n]=e}return Ve.apply(String,r)}function We(e){if(e<4){if(e<2){if(0===e)return"";{let e=te[se++];return(128&e)>1?void(se-=1):Ve(e)}}{let t=te[se++],r=te[se++];if((128&t)>0||(128&r)>0)return void(se-=2);if(e<3)return Ve(t,r);let n=te[se++];return(128&n)>0?void(se-=3):Ve(t,r,n)}}{let t=te[se++],r=te[se++],n=te[se++],i=te[se++];if((128&t)>0||(128&r)>0||(128&n)>0||(128&i)>0)return void(se-=4);if(e<6){if(4===e)return Ve(t,r,n,i);{let e=te[se++];return(128&e)>0?void(se-=5):Ve(t,r,n,i,e)}}if(e<8){let o=te[se++],s=te[se++];if((128&o)>0||(128&s)>0)return void(se-=6);if(e<7)return Ve(t,r,n,i,o,s);let a=te[se++];return(128&a)>0?void(se-=7):Ve(t,r,n,i,o,s,a)}{let o=te[se++],s=te[se++],a=te[se++],c=te[se++];if((128&o)>0||(128&s)>0||(128&a)>0||(128&c)>0)return void(se-=8);if(e<10){if(8===e)return Ve(t,r,n,i,o,s,a,c);{let e=te[se++];return(128&e)>0?void(se-=9):Ve(t,r,n,i,o,s,a,c,e)}}if(e<12){let u=te[se++],l=te[se++];if((128&u)>0||(128&l)>0)return void(se-=10);if(e<11)return Ve(t,r,n,i,o,s,a,c,u,l);let h=te[se++];return(128&h)>0?void(se-=11):Ve(t,r,n,i,o,s,a,c,u,l,h)}{let u=te[se++],l=te[se++],h=te[se++],f=te[se++];if((128&u)>0||(128&l)>0||(128&h)>0||(128&f)>0)return void(se-=12);if(e<14){if(12===e)return Ve(t,r,n,i,o,s,a,c,u,l,h,f);{let e=te[se++];return(128&e)>0?void(se-=13):Ve(t,r,n,i,o,s,a,c,u,l,h,f,e)}}{let d=te[se++],p=te[se++];if((128&d)>0||(128&p)>0)return void(se-=14);if(e<15)return Ve(t,r,n,i,o,s,a,c,u,l,h,f,d,p);let g=te[se++];return(128&g)>0?void(se-=15):Ve(t,r,n,i,o,s,a,c,u,l,h,f,d,p,g)}}}}}function He(){let e,t=te[se++];if(t<192)e=t-160;else switch(t){case 217:e=te[se++];break;case 218:e=fe.getUint16(se),se+=2;break;case 219:e=fe.getUint32(se),se+=4;break;default:throw new Error("Expected string")}return je(e)}function Ke(e){return ge.copyBuffers?Uint8Array.prototype.slice.call(te,se,se+=e):te.subarray(se,se+=e)}function Ge(e){let t=te[se++];if(ve[t]){let r;return ve[t](te.subarray(se,r=se+=e),(e=>{se=e;try{return Pe()}finally{se=r}}))}throw new Error("Unknown extension type "+t)}var $e=new Array(4096);function Qe(){let e=te[se++];if(!(e>=160&&e<192))return se--,Je(Pe());if(e-=160,ye>=se)return ue.slice(se-me,(se+=e)-me);if(!(0==ye&&re<180))return Ne(e);let t,r=4095&(e<<5^(e>1?fe.getUint16(se):e>0?te[se]:0)),n=$e[r],i=se,o=se+e-3,s=0;if(n&&n.bytes==e){for(;i<o;){if(t=fe.getUint32(i),t!=n[s++]){i=1879048192;break}i+=4}for(o+=3;i<o;)if(t=te[i++],t!=n[s++]){i=1879048192;break}if(i===o)return se=i,n.string;o-=3,i=se}for(n=[],$e[r]=n,n.bytes=e;i<o;)t=fe.getUint32(i),n.push(t),i+=4;for(o+=3;i<o;)t=te[i++],n.push(t);let a=e<16?We(e):qe(e);return n.string=null!=a?a:Ne(e)}function Je(e){if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return e.toString();if(null==e)return e+"";throw new Error("Invalid property type for record",typeof e)}const Ye=(e,t)=>{let r=Pe().map(Je),n=e;void 0!==t&&(e=e<32?-((t<<5)+e):(t<<5)+e,r.highByte=t);let i=ce[e];return i&&(i.isShared||Ce)&&((ce.restoreStructures||(ce.restoreStructures=[]))[e]=i),ce[e]=r,r.read=Me(r,n),r.read()};ve[0]=()=>{},ve[0].noBuffer=!0,ve[66]=e=>{let t=e.length,r=BigInt(128&e[0]?e[0]-256:e[0]);for(let n=1;n<t;n++)r<<=8n,r+=BigInt(e[n]);return r};let Xe={Error,TypeError,ReferenceError};ve[101]=()=>{let e=Pe();return(Xe[e[0]]||Error)(e[1],{cause:e[2]})},ve[105]=e=>{if(!1===ge.structuredClone)throw new Error("Structured clone extension is disabled");let t=fe.getUint32(se-4);he||(he=new Map);let r,n=te[se];r=n>=144&&n<160||220==n||221==n?[]:{};let i={target:r};he.set(t,i);let o=Pe();return i.used?Object.assign(r,o):(i.target=o,o)},ve[112]=e=>{if(!1===ge.structuredClone)throw new Error("Structured clone extension is disabled");let t=fe.getUint32(se-4),r=he.get(t);return r.used=!0,r.target},ve[115]=()=>new Set(Pe());const Ze=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((e=>e+"Array"));let et="object"==typeof globalThis?globalThis:window;ve[116]=e=>{let t=e[0],r=Ze[t];if(!r){if(16===t){let t=new ArrayBuffer(e.length-1);return new Uint8Array(t).set(e.subarray(1)),t}throw new Error("Could not find typed array for code "+t)}return new et[r](Uint8Array.prototype.slice.call(e,1).buffer)},ve[120]=()=>{let e=Pe();return new RegExp(e[0],e[1])};const tt=[];function rt(e){Ee&&Ee();let t=re,r=se,n=pe,i=me,o=ye,s=ue,a=de,c=he,u=le,l=new Uint8Array(te.slice(0,re)),h=ce,f=ce.slice(0,ce.length),d=ge,p=Ce,g=e();return re=t,se=r,pe=n,me=i,ye=o,ue=s,de=a,he=c,le=u,te=l,Ce=p,(ce=h).splice(0,ce.length,...f),ge=d,fe=new DataView(te.buffer,te.byteOffset,te.byteLength),g}function nt(){te=null,he=null,ce=null}ve[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],r=se;return se+=t-e.length,le=tt,(le=[He(),He()]).position0=0,le.position1=0,le.postBundlePosition=se,se=r,Pe()},ve[255]=e=>4==e.length?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):8==e.length?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):12==e.length?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid");const it=new Array(147);for(let e=0;e<256;e++)it[e]=+("1e"+Math.floor(45.15-.30103*e));var ot=new Ae({useRecords:!1});ot.unpack,ot.unpackMultiple,ot.unpack;let st=new Float32Array(1);new Uint8Array(st.buffer,0,4);var at=r(5995).Buffer;let ct,ut,lt;try{ct=new TextEncoder}catch(e){}const ht=void 0!==at,ft=ht?function(e){return at.allocUnsafeSlow(e)}:Uint8Array,dt=ht?at:Uint8Array,pt=ht?4294967296:2144337920;let gt,mt,yt,vt,bt,wt=0,_t=null;const kt=/[\u0080-\uFFFF]/,St=Symbol("record-id");class Et extends Ae{constructor(e){let t,r,n,i;super(e),this.offset=0;let o=dt.prototype.utf8Write?function(e,t){return gt.utf8Write(e,t,4294967295)}:!(!ct||!ct.encodeInto)&&function(e,t){return ct.encodeInto(e,gt.subarray(t)).written},s=this;e||(e={});let a=e&&e.sequential,c=e.structures||e.saveStructures,u=e.maxSharedStructures;if(null==u&&(u=c?32:0),u>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&null==e.moreTypes&&(this.moreTypes=!0);let l=e.maxOwnStructures;null==l&&(l=c?32:64),this.structures||0==e.useRecords||(this.structures=[]);let h=u>32||l+u>64,f=u+64,d=u+l+64;if(d>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let p=[],g=0,m=0;this.pack=this.encode=function(e,o){if(gt||(gt=new ft(8192),yt=gt.dataView||(gt.dataView=new DataView(gt.buffer,0,8192)),wt=0),vt=gt.length-10,vt-wt<2048?(gt=new ft(gt.length),yt=gt.dataView||(gt.dataView=new DataView(gt.buffer,0,gt.length)),vt=gt.length-10,wt=0):wt=wt+7&2147483640,t=wt,o&Dt&&(wt+=255&o),i=s.structuredClone?new Map:null,s.bundleStrings&&"string"!=typeof e?(_t=[],_t.size=1/0):_t=null,n=s.structures,n){n.uninitialized&&(n=s._mergeStructures(s.getStructures()));let e=n.sharedLength||0;if(e>u)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,i=n.transitions;for(let t=0,n=e.length;t<n;t++){let n=e[t];r=i[n],r||(r=i[n]=Object.create(null)),i=r}i[St]=t+64}this.lastNamedStructuresLength=e}a||(n.nextId=e+64)}let c;r&&(r=!1);try{s.randomAccessStructure&&e&&e.constructor&&e.constructor===Object?A(e):b(e);let r=_t;if(_t&&xt(t,b,0),i&&i.idsToInsert){let e=i.idsToInsert.sort(((e,t)=>e.offset>t.offset?1:-1)),n=e.length,o=-1;for(;r&&n>0;){let i=e[--n].offset+t;i<r.stringsPosition+t&&-1===o&&(o=0),i>r.position+t?o>=0&&(o+=6):(o>=0&&(yt.setUint32(r.position+t,yt.getUint32(r.position+t)+o),o=-1),r=r.previous,n++)}o>=0&&r&&yt.setUint32(r.position+t,yt.getUint32(r.position+t)+o),wt+=6*e.length,wt>vt&&E(wt),s.offset=wt;let a=function(e,t){let r,n=6*t.length,i=e.length-n;for(;r=t.pop();){let t=r.offset,o=r.id;e.copyWithin(t+n,t,i),n-=6;let s=t+n;e[s++]=214,e[s++]=105,e[s++]=o>>24,e[s++]=o>>16&255,e[s++]=o>>8&255,e[s++]=255&o,i=t}return e}(gt.subarray(t,wt),e);return i=null,a}return s.offset=wt,o&Nt?(gt.start=t,gt.end=wt,gt):gt.subarray(t,wt)}catch(e){throw c=e,e}finally{if(n&&(y(),r&&s.saveStructures)){let r=n.sharedLength||0,i=gt.subarray(t,wt),a=It(n,s);if(!c)return!1===s.saveStructures(a,a.isCompatible)?s.pack(e,o):(s.lastNamedStructuresLength=r,gt.length>1073741824&&(gt=null),i)}gt.length>1073741824&&(gt=null),o&Lt&&(wt=t)}};const y=()=>{m<10&&m++;let e=n.sharedLength||0;if(n.length>e&&!a&&(n.length=e),g>1e4)n.transitions=null,m=0,g=0,p.length>0&&(p=[]);else if(p.length>0&&!a){for(let e=0,t=p.length;e<t;e++)p[e][St]=0;p=[]}},v=e=>{var t=e.length;t<16?gt[wt++]=144|t:t<65536?(gt[wt++]=220,gt[wt++]=t>>8,gt[wt++]=255&t):(gt[wt++]=221,yt.setUint32(wt,t),wt+=4);for(let r=0;r<t;r++)b(e[r])},b=e=>{wt>vt&&(gt=E(wt));var r,n=typeof e;if("string"===n){let n,i=e.length;if(_t&&i>=4&&i<4096){if((_t.size+=i)>21760){let e,r,n=(_t[0]?3*_t[0].length+_t[1].length:0)+10;wt+n>vt&&(gt=E(wt+n)),_t.position?(r=_t,gt[wt]=200,wt+=3,gt[wt++]=98,e=wt-t,wt+=4,xt(t,b,0),yt.setUint16(e+t-3,wt-t-e)):(gt[wt++]=214,gt[wt++]=98,e=wt-t,wt+=4),_t=["",""],_t.previous=r,_t.size=0,_t.position=e}let r=kt.test(e);return _t[r?0:1]+=e,gt[wt++]=193,void b(r?-i:i)}n=i<32?1:i<256?2:i<65536?3:5;let s=3*i;if(wt+s>vt&&(gt=E(wt+s)),i<64||!o){let t,o,s,a=wt+n;for(t=0;t<i;t++)o=e.charCodeAt(t),o<128?gt[a++]=o:o<2048?(gt[a++]=o>>6|192,gt[a++]=63&o|128):55296==(64512&o)&&56320==(64512&(s=e.charCodeAt(t+1)))?(o=65536+((1023&o)<<10)+(1023&s),t++,gt[a++]=o>>18|240,gt[a++]=o>>12&63|128,gt[a++]=o>>6&63|128,gt[a++]=63&o|128):(gt[a++]=o>>12|224,gt[a++]=o>>6&63|128,gt[a++]=63&o|128);r=a-wt-n}else r=o(e,wt+n);r<32?gt[wt++]=160|r:r<256?(n<2&>.copyWithin(wt+2,wt+1,wt+1+r),gt[wt++]=217,gt[wt++]=r):r<65536?(n<3&>.copyWithin(wt+3,wt+2,wt+2+r),gt[wt++]=218,gt[wt++]=r>>8,gt[wt++]=255&r):(n<5&>.copyWithin(wt+5,wt+3,wt+3+r),gt[wt++]=219,yt.setUint32(wt,r),wt+=4),wt+=r}else if("number"===n)if(e>>>0===e)e<32||e<128&&!1===this.useRecords||e<64&&!this.randomAccessStructure?gt[wt++]=e:e<256?(gt[wt++]=204,gt[wt++]=e):e<65536?(gt[wt++]=205,gt[wt++]=e>>8,gt[wt++]=255&e):(gt[wt++]=206,yt.setUint32(wt,e),wt+=4);else if((e|0)===e)e>=-32?gt[wt++]=256+e:e>=-128?(gt[wt++]=208,gt[wt++]=e+256):e>=-32768?(gt[wt++]=209,yt.setInt16(wt,e),wt+=2):(gt[wt++]=210,yt.setInt32(wt,e),wt+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let r;if(gt[wt++]=202,yt.setFloat32(wt,e),t<4||((r=e*it[(127>[wt])<<1|gt[wt+1]>>7])|0)===r)return void(wt+=4);wt--}gt[wt++]=203,yt.setFloat64(wt,e),wt+=8}else if("object"===n||"function"===n)if(e){if(i){let r=i.get(e);if(r){if(!r.id){let e=i.idsToInsert||(i.idsToInsert=[]);r.id=e.push(r)}return gt[wt++]=214,gt[wt++]=112,yt.setUint32(wt,r.id),void(wt+=4)}i.set(e,{offset:wt-t})}let o=e.constructor;if(o===Object)S(e);else if(o===Array)v(e);else if(o===Map)if(this.mapAsEmptyObject)gt[wt++]=128;else{(r=e.size)<16?gt[wt++]=128|r:r<65536?(gt[wt++]=222,gt[wt++]=r>>8,gt[wt++]=255&r):(gt[wt++]=223,yt.setUint32(wt,r),wt+=4);for(let[t,r]of e)b(t),b(r)}else{for(let t=0,r=ut.length;t<r;t++){if(e instanceof lt[t]){let r=ut[t];if(r.write){r.type&&(gt[wt++]=212,gt[wt++]=r.type,gt[wt++]=0);let t=r.write.call(this,e);return void(t===e?Array.isArray(e)?v(e):S(e):b(t))}let n,i=gt,o=yt,s=wt;gt=null;try{n=r.pack.call(this,e,(e=>(gt=i,i=null,wt+=e,wt>vt&&E(wt),{target:gt,targetView:yt,position:wt-e})),b)}finally{i&&(gt=i,yt=o,wt=s,vt=gt.length-10)}return void(n&&(n.length+wt>vt&&E(n.length+wt),wt=At(n,gt,wt,r.type)))}}if(Array.isArray(e))v(e);else{if(e.toJSON){const t=e.toJSON();if(t!==e)return b(t)}if("function"===n)return b(this.writeFunction&&this.writeFunction(e));S(e)}}}else gt[wt++]=192;else if("boolean"===n)gt[wt++]=e?195:194;else if("bigint"===n){if(e<BigInt(1)<<BigInt(63)&&e>=-(BigInt(1)<<BigInt(63)))gt[wt++]=211,yt.setBigInt64(wt,e);else if(e<BigInt(1)<<BigInt(64)&&e>0)gt[wt++]=207,yt.setBigUint64(wt,e);else{if(!this.largeBigIntToFloat){if(this.useBigIntExtension&&e<2n**1023n&&e>-(2n**1023n)){gt[wt++]=199,wt++,gt[wt++]=66;let t,r=[];do{let n=0xffn&e;t=(0x80n&n)===(e<0n?0x80n:0n),r.push(n),e>>=8n}while(0n!==e&&-1n!==e||!t);gt[wt-2]=r.length;for(let e=r.length;e>0;)gt[wt++]=Number(r[--e]);return}throw new RangeError(e+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64")}gt[wt++]=203,yt.setFloat64(wt,Number(e))}wt+=8}else{if("undefined"!==n)throw new Error("Unknown type: "+n);this.encodeUndefinedAsNil?gt[wt++]=192:(gt[wt++]=212,gt[wt++]=0,gt[wt++]=0)}},w=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let r in e)"function"==typeof e.hasOwnProperty&&!e.hasOwnProperty(r)||this.skipValues.includes(e[r])||t.push(r)}else t=Object.keys(e);let r,n=t.length;if(n<16?gt[wt++]=128|n:n<65536?(gt[wt++]=222,gt[wt++]=n>>8,gt[wt++]=255&n):(gt[wt++]=223,yt.setUint32(wt,n),wt+=4),this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);b(isNaN(n)?r:n),b(e[r])}else for(let i=0;i<n;i++)b(r=t[i]),b(e[r])}:e=>{gt[wt++]=222;let r=wt-t;wt+=2;let n=0;for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(b(t),b(e[t]),n++);gt[r+++t]=n>>8,gt[r+t]=255&n},_=!1===this.useRecords?w:e.progressiveRecords&&!h?e=>{let r,i,o=n.transitions||(n.transitions=Object.create(null)),s=wt++-t;for(let a in e)if("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(a)){if(r=o[a],r)o=r;else{let c=Object.keys(e),u=o;o=n.transitions;let l=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];r=o[t],r||(r=o[t]=Object.create(null),l++),o=r}s+t+1==wt?(wt--,C(o,c,l)):T(o,c,s,l),i=!0,o=u[a]}b(e[a])}if(!i){let r=o[St];r?gt[s+t]=r:T(o,Object.keys(e),s,0)}}:e=>{let t,r=n.transitions||(n.transitions=Object.create(null)),i=0;for(let n in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(n))&&(t=r[n],t||(t=r[n]=Object.create(null),i++),r=t);let o=r[St];o?o>=96&&h?(gt[wt++]=96+(31&(o-=96)),gt[wt++]=o>>5):gt[wt++]=o:C(r,r.__keys__||Object.keys(e),i);for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&b(e[t])},k="function"==typeof this.useRecords&&this.useRecords,S=k?e=>{k(e)?_(e):w(e)}:_,E=e=>{let r;if(e>16777216){if(e-t>pt)throw new Error("Packed buffer would be larger than maximum buffer size");r=Math.min(pt,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else r=1+(Math.max(e-t<<2,gt.length-1)>>12)<<12;let n=new ft(r);return yt=n.dataView||(n.dataView=new DataView(n.buffer,0,r)),e=Math.min(e,gt.length),gt.copy?gt.copy(n,0,t,e):n.set(gt.slice(t,e)),wt-=t,t=0,vt=n.length-10,gt=n},C=(e,t,i)=>{let o=n.nextId;o||(o=64),o<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(o=n.nextOwnId,o<d||(o=f),n.nextOwnId=o+1):(o>=d&&(o=f),n.nextId=o+1);let s=t.highByte=o>=96&&h?o-96>>5:-1;e[St]=o,e.__keys__=t,n[o-64]=t,o<f?(t.isShared=!0,n.sharedLength=o-63,r=!0,s>=0?(gt[wt++]=96+(31&o),gt[wt++]=s):gt[wt++]=o):(s>=0?(gt[wt++]=213,gt[wt++]=114,gt[wt++]=96+(31&o),gt[wt++]=s):(gt[wt++]=212,gt[wt++]=114,gt[wt++]=o),i&&(g+=m*i),p.length>=l&&(p.shift()[St]=0),p.push(e),b(t))},T=(e,r,n,i)=>{let o=gt,s=wt,a=vt,c=t;gt=mt,wt=0,t=0,gt||(mt=gt=new ft(8192)),vt=gt.length-10,C(e,r,i),mt=gt;let u=wt;if(gt=o,wt=s,vt=a,t=c,u>1){let e=wt+u-1;e>vt&&E(e);let r=n+t;gt.copyWithin(r+u,r+1,wt),gt.set(mt.slice(0,u),r),wt=e}else gt[n+t]=mt[0]},A=e=>{let i=bt(e,gt,t,wt,n,E,((e,t,n)=>{if(n)return r=!0;wt=t;let i=gt;return b(e),y(),i!==gt?{position:wt,targetView:yt,target:gt}:wt}),this);if(0===i)return S(e);wt=i}}useBuffer(e){gt=e,gt.dataView||(gt.dataView=new DataView(gt.buffer,gt.byteOffset,gt.byteLength)),wt=0}set position(e){wt=e}get position(){return wt}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}function Ct(e,t,r,n){let i=e.byteLength;if(i+1<256){var{target:o,position:s}=r(4+i);o[s++]=199,o[s++]=i+1}else if(i+1<65536){var{target:o,position:s}=r(5+i);o[s++]=200,o[s++]=i+1>>8,o[s++]=i+1&255}else{var{target:o,position:s,targetView:a}=r(7+i);o[s++]=201,a.setUint32(s,i+1),s+=4}o[s++]=116,o[s++]=t,e.buffer||(e=new Uint8Array(e)),o.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s)}function Tt(e,t){let r=e.byteLength;var n,i;if(r<256){var{target:n,position:i}=t(r+2);n[i++]=196,n[i++]=r}else if(r<65536){var{target:n,position:i}=t(r+3);n[i++]=197,n[i++]=r>>8,n[i++]=255&r}else{var{target:n,position:i,targetView:o}=t(r+5);n[i++]=198,o.setUint32(i,r),i+=4}n.set(e,i)}function At(e,t,r,n){let i=e.length;switch(i){case 1:t[r++]=212;break;case 2:t[r++]=213;break;case 4:t[r++]=214;break;case 8:t[r++]=215;break;case 16:t[r++]=216;break;default:i<256?(t[r++]=199,t[r++]=i):i<65536?(t[r++]=200,t[r++]=i>>8,t[r++]=255&i):(t[r++]=201,t[r++]=i>>24,t[r++]=i>>16&255,t[r++]=i>>8&255,t[r++]=255&i)}return t[r++]=n,t.set(e,r),r+=i}function xt(e,t,r){if(_t.length>0){yt.setUint32(_t.position+e,wt+r-_t.position-e),_t.stringsPosition=wt-e;let n=_t;_t=null,t(n[0]),t(n[1])}}function It(e,t){return e.isCompatible=e=>{let r=!e||(t.lastNamedStructuresLength||0)===e.length;return r||t._mergeStructures(e),r},e}lt=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,we],ut=[{pack(e,t,r){let n=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&n>=0&&n<4294967296){let{target:e,targetView:r,position:i}=t(6);e[i++]=214,e[i++]=255,r.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:r,targetView:i,position:o}=t(10);r[o++]=215,r[o++]=255,i.setUint32(o,4e6*e.getMilliseconds()+(n/1e3/4294967296|0)),i.setUint32(o+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return t(0),r(this.onInvalidDate());let{target:e,targetView:n,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:r,targetView:i,position:o}=t(15);r[o++]=199,r[o++]=12,r[o++]=255,i.setUint32(o,1e6*e.getMilliseconds()),i.setBigInt64(o+4,BigInt(Math.floor(n)))}}},{pack(e,t,r){if(this.setAsEmptyObject)return t(0),r({});let n=Array.from(e),{target:i,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(i[o++]=212,i[o++]=115,i[o++]=0),r(n)}},{pack(e,t,r){let{target:n,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(n[i++]=212,n[i++]=101,n[i++]=0),r([e.name,e.message,e.cause])}},{pack(e,t,r){let{target:n,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(n[i++]=212,n[i++]=120,n[i++]=0),r([e.source,e.flags])}},{pack(e,t){this.moreTypes?Ct(e,16,t):Tt(ht?at.from(e):new Uint8Array(e),t)}},{pack(e,t){let r=e.constructor;r!==dt&&this.moreTypes?Ct(e,Ze.indexOf(r.name),t):Tt(e,t)}},{pack(e,t){let{target:r,position:n}=t(1);r[n]=193}}];let Pt=new Et({useRecords:!1});Pt.pack,Pt.pack;const{NEVER:Rt,ALWAYS:Mt,DECIMAL_ROUND:Ot,DECIMAL_FIT:Bt}={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},Nt=512,Lt=1024,Dt=2048;r(5995).Buffer;let Ut=function(e){return e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.CHANNEL_MESSAGE="channelmessage",e.IM_MESSAGE="immessage",e.WHITEBOARD_MESSAGE="whiteboardmessage",e.CUSTOM_TOPIC_MESSAGE="custommessage",e}({});class jt extends(f()){client;version=1;ssTopics={};authReconnect;isFirstConnect=!0;unpacker;constructor(e){super(),this.authReconnect=e,this.unpacker=new Ae({useRecords:!1,int64AsType:"number"})}initClient(e){let t=this.getBrokerUrl(e.ws);return ie().connect(t,{keepalive:30,clean:!1,connectTimeout:1e4,reconnectPeriod:3e3,resubscribe:!1,clientId:e.client_id,username:e.username,password:e.jwt_token,protocolVersion:5,properties:{sessionExpiryInterval:400},transformWsUrl:this.authReconnect})}getBrokerUrl(e){return e}async connect(e){return this.client&&await this.close(!0),this.isFirstConnect=!0,new Promise(((t,r)=>{this.client=this.initClient(e);let n=e=>{o(),setTimeout((()=>{this.close(!0)}),0);let t=e?D.fromError(e):new D("会控服务连接失败");r(t)},i=async n=>{o();try{await this.subscribe(e.topics,2)}catch(e){return this.close(!0),void r(e)}this.addListeners(),this.client.emit("connect",n),this.isFirstConnect=!1,t()},o=()=>{this.client.off("connect",i),this.client.off("error",n),this.client.off("offline",n),this.client.off("close",n)};this.client.once("connect",i),this.client.once("error",n),this.client.once("offline",n),this.client.once("close",n)}))}addListeners(){this.client.on("connect",(()=>{if(!this.isFirstConnect)for(const e in this.ssTopics)S((()=>this.subscribe(e,this.ssTopics[e])),{maxRetries:10})().catch((t=>{"maxretry"==t&&X.error(`socket尝试订阅${e}多次重试依旧失败,已放弃`)}));this.emit(Ut.CONNECTED)})),this.client.on("reconnect",(()=>{X.info("socket start reconnect"),this.emit(Ut.RECONNECTING)})),this.client.on("close",(()=>{X.info("socket closed")})),this.client.on("offline",(()=>{X.info("socket offline")})),this.client.on("error",(e=>{throw X.error("socket error",e),D.fromError(e)})),this.onMsg=this.onMsg.bind(this),this.client.on("message",this.onMsg)}subscribe(e,t=0){return new Promise(((r,n)=>{this.client.subscribe(e,{qos:t},((t,i)=>{t?(X.error(`subscribe ${e} error`,t),n(D.fromError(t))):i&&(X.debug(`subscribe ${e} success`,i),i.forEach((e=>{this.ssTopics[e.topic]=e.qos})),r())}))}))}unsubscribe(e){return new Promise(((t,r)=>{this.client.unsubscribe(e,(n=>{if(n)X.error(`unsubscribe ${e} error`,n),r(D.fromError(n));else{("string"==typeof e?[e]:e).forEach((e=>{delete this.ssTopics[e]})),t()}}))}))}async close(e=!1){return new Promise(((t,r)=>{this.client.end(e,(e=>{this.ssTopics={},null!=e?r(D.fromError(e)):t()}))}))}sendMsg(e,t,r=0){return new Promise(((n,i)=>{this.client.publish(t,e,{qos:r},(e=>{null!=e?i(D.fromError(e)):n()}))}))}onMsg(e,t,r){try{if(0!==e.indexOf("/rtc/"))return void this.emit(Ut.CUSTOM_TOPIC_MESSAGE,e,t);let r=this.unpacker.unpack(t);if(null==r)return void X.error("解析报文失败",e,t);X.debug(r.data.channel?"收到会控消息":r.data.board?"收到电子白板消息":"收到im消息",r),this.emit(r.data.channel?Ut.CHANNEL_MESSAGE:r.data.board?Ut.WHITEBOARD_MESSAGE:Ut.IM_MESSAGE,e,r)}catch(e){X.error("消息处理报错",e)}}}var Ft=function(e){return e.INIT="init",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.DISCONNECTED="disconnected",e}(Ft||{});class zt extends(f()){rtcApi;rtcSocket;connectState;heartbeatIntervalID;eventCB;constructor(e,t,r=null){super(),this.rtcApi=e,this.rtcSocket=t,this.eventCB=r,this.addSocketListeners(),this.connectState=Ft.INIT}addSocketListeners(){this.onConnected=this.onConnected.bind(this),this.onStartReconnect=this.onStartReconnect.bind(this),this.onImMessage=this.onImMessage.bind(this),this.rtcSocket.on(Ut.CONNECTED,this.onConnected),this.rtcSocket.on(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.on(Ut.IM_MESSAGE,this.onImMessage)}removeSocketListeners(){this.rtcSocket.off(Ut.CONNECTED,this.onConnected),this.rtcSocket.off(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.off(Ut.IM_MESSAGE,this.onImMessage)}triggerEvent(e,t){try{let r=new c(e,t);this.emit(e,r),this.eventCB&&this.eventCB(r)}catch(r){X.error(`im事件${e}上层响应出错,请sdk调用者检查`,r,t)}}async heartbeat(){let e=this.heartbeatIntervalID;if(this.connectState!=Ft.CONNECTED)throw X.info(`异常im心跳,当前im状态${this.connectState}`),clearInterval(e),new D(`异常im心跳,im状态为:${this.connectState}`);try{await this.rtcApi.imHeartbeat()}catch(e){X.error("im心跳失败",e),e instanceof D&&this.disconnnect(u.Error,e)}X.debug("im heartbeat interval",e)}async onConnected(){let e=this.connectState;X.warn(e==Ft.RECONNECTING?"imsocket重连成功":"imsocket连接成功"),this.connectState=Ft.CONNECTED,this.heartbeatIntervalID&&clearInterval(this.heartbeatIntervalID);let t=this.heartbeatIntervalID=setInterval((()=>this.heartbeat()),3e4);X.debug("imheartbeat interval started",t),e==Ft.RECONNECTING?this.triggerEvent(l.RECONNECTED):this.triggerEvent(l.ENABLE_SUCCEED)}onStartReconnect(){X.warn("imsocket开始重连"),clearInterval(this.heartbeatIntervalID),this.connectState=Ft.RECONNECTING,this.triggerEvent(l.RECONNECTING)}onImMessage(e,t){switch(t.type){case Z.ImDisconnect:const e=t.data;if(!e)return;this.disconnnect(e.reason);break;case Z.ImMsg:{const e=t.data;if(!e)return;this.triggerEvent(l.IM_MSG,e);break}}}async disconnnect(e,t){if(this.connectState!==Ft.DISCONNECTED){clearInterval(this.heartbeatIntervalID),this.removeSocketListeners();try{await this.rtcSocket.close()}catch(e){X.error("断开imsocket报错",e)}try{await this.rtcApi.imDisconnect()}catch(e){X.error("调im断开api报错",e)}this.connectState=Ft.DISCONNECTED,this.triggerEvent(l.DISCONNECTED,{reason:e,error:t}),this.removeAllListeners(),this.eventCB=null,X.center?.flush(),X.info("disconnected im",e)}}}class Vt{channel;im;isAppHide;onNotifyChannelEvent=null;onNotifyImEvent=null;constructor(e){this.isAppHide=!1,e.logLevel&&X.setLevel(e.logLevel),e.logTarget&&(m()||e.logTarget!=Q.WXREALTIME||(e.logTarget=Q.CONSOLE,X.warn("仅微信小程序支持实时日志")),X.setTarget(e.logTarget));let t=this.buildInfo();X.warn("srtc "+(m()?"wechat":"webrtc")+" sdk version:",t.version,"build time:",C("Y-m-d H:i:s",new Date(1e3*t.timestamp)))}get joinVersion(){return this.buildInfo().version}async join(e,t={autoSubscribeAudio:!1,autoSubscribeVideo:!1}){if(this.channel)throw new D("请先退出频道");const r=Math.floor(Date.now()/1e3);let n=I(e);if(n.exp_at&&n.exp_at<r)throw j;X.center&&X.center.shutdown(),n.log_center&&(X.center=new G(n,this.getStoredDeviceId(),this.getDeviceType(),!0));let i=this.newRtcApi(n),a=await i.join({deviceType:this.getDeviceType(),deviceID:this.getStoredDeviceId(),version:this.joinVersion}),c=this.newStreamEngine(t,a,i);await c.connect();let u=this.newRtcSocket(((e,t,r)=>{const n=Math.floor(Date.now()/1e3);return a.mqtt.token_exp_at<n&&i.reconnect({type:0}).then((e=>{a.mqtt=e.mqtt,a.upload=e.upload,a.rtmp=e.rtmp,a.webrtc=e.webrtc})).catch((e=>{e instanceof D&&l?.leave(o.Error,e)})),r.options.username=a.mqtt.username,r.options.clientId=a.mqtt.client_id,r.options.password=a.mqtt.jwt_token,a.mqtt.ws})),l=this.channel=this.newChannel(t,a,i,c,u);return new Promise((async(e,t)=>{l.once(s.JOIN_SUCCEED,(t=>{X.info("joined channel: "+a.channel),e(t.data)})),l.once(s.DISCONNECTED,(e=>{this.postLeave(),t(e.data)}));try{await u.connect(a.mqtt)}catch(e){t(e)}}))}async leave(){if(this.channel)try{await this.channel.leave(o.Self)}catch(e){this.postLeave(),X.error("离开频道报错,强制离开",e)}else X.warn("您不在频道中,无需调用离开")}postLeave(){this.channel=null}getChannelInfo(){return this.channel?this.channel.getInfo():null}getStreamMetric(){if(!this.channel)throw U;return this.channel.getStreamMetric()}getUserInfo(e){if(!this.channel)throw U;return this.channel.getUser(e).getInfo()}getUsersInfo(e=!1){if(!this.channel)throw U;return this.channel.getUsersInfo(e)}async subscribeRemoteAudioMixTrack(e){if(!this.channel)throw U;return await this.channel.subscribeRemoteAudioMixTrack(e)}async subscribeRemoteAudioTrack(e,t){if(!this.channel)throw U;return await this.channel.subscribeRemoteAudioTrack(e,t)}async subscribeRemoteVideoMcuTrack(){if(!this.channel)throw U;return await this.channel.subscribeRemoteVideoMcuTrack()}async subscribeRemoteVideoTrack(e,t){if(!this.channel)throw U;return await this.channel.subscribeRemoteVideoTrack(e,t)}async unsubscribeRemoteTrack(e){if(!this.channel)throw U;await this.channel.unsubscribeRemoteTrack(e)}getRemoteTrack(e,t,r){if(!this.channel)throw U;if(!t&&!r)throw new D("id或desc至少一项不为空");let n=t?this.channel.getUser(e).getTrack(t):this.channel.getUser(e).getTrackByDesc(r);if(!n)throw F(t?e+"没有id为"+t+"的音视频流":e+"没有desc为"+r+"的音视频流");return n}async enableIm(e){if(this.im)throw new D("您已启用im频道外消息通道");const t=Math.floor(Date.now()/1e3);let r=I(e);if(r.exp_at&&r.exp_at<t)throw j;!X.center&&r.log_center&&(X.center=new G(r,this.getStoredDeviceId(),this.getDeviceType(),!0));let n=this.newRtcApi(r),i=await n.imConnect({deviceType:this.getDeviceType(),deviceID:this.getStoredDeviceId(),version:this.joinVersion}),o=this.newRtcSocket(((e,t,r)=>{const o=Math.floor(Date.now()/1e3);return i.mqtt.token_exp_at<o&&n.imReconnect().then((e=>{i.mqtt=e.mqtt})).catch((e=>{e instanceof D&&s?.disconnnect(u.Error,e)})),r.options.username=i.mqtt.username,r.options.clientId=i.mqtt.client_id,r.options.password=i.mqtt.jwt_token,i.mqtt.ws})),s=this.im=new zt(n,o,(e=>{this.onNotifyImEvent&&this.onNotifyImEvent(e)}));return new Promise((async(e,t)=>{s.once(l.ENABLE_SUCCEED,(t=>{e(r.sid)})),s.once(l.DISCONNECTED,(e=>{this.postDisableIm(),t(e.data)}));try{await o.connect(i.mqtt)}catch(e){t(e)}}))}async disableIm(){if(this.im)try{await this.im.disconnnect(u.Self)}catch(e){this.postDisableIm(),X.error("离开频道报错,强制离开",e)}else X.warn("您尚未启用im频道外消息通道")}postDisableIm(){this.im=null}onAppShow(e){e?X.warn("页面恢复显示",e):X.warn("页面恢复显示"),this.isAppHide=!1}onAppHide(){X.warn("页面切后台或最小化"),this.isAppHide=!0}}var qt=r(3793),Wt=r.n(qt);let Ht;!function(e){e.BaseSRTC_I=Vt,e.CommonChannelEventType_I=s,e.isWxxcx_I=m,e.Logger_I=Y,e.SdkError_I=D,e.propAssign_I=E,e.isObject_I=y,e.isString_I=b,e.sleep_I=k,e.retry_I=S,e.dateFormat_I=C,e.genNonce_I=A,e.getHostnameFromUrl_I=x,e.dct_I=I;e.hmac_I=function(e,t){return Wt()(e,t).toString()}}(Ht||(Ht={}));let Kt=function(e){return e.OOK="ook",e.WangsuCDN="wangsucdn",e.Seastart="seastart",e}({});class Gt{joinRsp;published;subscribed;ability;monitorInterval;prevMetric;constructor(e,t){this.joinRsp=e,this.published={},this.subscribed={},t&&setTimeout((()=>{this.ability?E(this.ability,t):this.ability=t}),0)}async connect(){this.startMonitor()}async publish(e,t,r){let n=0;if(e.kind==M.Audio&&this.ability&&void 0!==this.ability.audioMaxPub&&-1!=this.ability.audioMaxPub){for(const e in this.published){this.published[e].kind==M.Audio&&n++}if(this.ability.audioMaxPub>0&&n>=this.ability.audioMaxPub)throw new D("最多允许发布"+this.ability.audioMaxPub+"个音频轨道")}else if(e.kind==M.Video&&this.ability&&void 0!==this.ability.videoMaxPub&&-1!=this.ability.videoMaxPub){for(const e in this.published){this.published[e].kind==M.Video&&n++}if(this.ability.videoMaxPub>0&&n>=this.ability.videoMaxPub)throw new D("最多允许发布"+this.ability.videoMaxPub+"个视频轨道")}}async subscribe(e,t){let r=0;if(e.kind==M.Audio&&this.ability&&void 0!==this.ability.audioMaxSub&&-1!=this.ability.audioMaxSub){for(const e in this.subscribed){this.subscribed[e].kind==M.Audio&&r++}if(this.ability.audioMaxSub>0&&r>=this.ability.audioMaxSub)throw new D("最多允许订阅"+this.ability.audioMaxSub+"个音频轨道")}else if(e.kind==M.Video&&this.ability&&void 0!==this.ability.videoMaxSub&&-1!=this.ability.videoMaxSub){for(const e in this.subscribed){this.subscribed[e].kind==M.Video&&r++}if(this.ability.videoMaxSub>0&&r>=this.ability.videoMaxSub)throw new D("最多允许订阅"+this.ability.videoMaxSub+"个视频轨道")}}haveSubscribed(e){return!!this.subscribed[e.id]}async disconnect(){this.stopMonitor();for(const e in this.published){const t=this.published[e];try{await this.unpublish(t.track)}catch(e){X.error(t.track.toString(),"取消发布失败",e)}}for(const e in this.subscribed){const t=this.subscribed[e];try{await this.unsubscribe(t.track)}catch(e){X.error(t.track.toString(),"取消订阅失败")}}this.published={},this.subscribed={}}getMetricSnapshot(){return this.prevMetric}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval((async()=>{try{const e=await this.getMetric();X.center?.addMetric(e),X.debug("metric",e)}catch(e){X.error("metric","采集metric失败")}}),1e4))}stopMonitor(){this.monitorInterval&&(window.clearInterval(this.monitorInterval),this.monitorInterval=void 0,this.prevMetric=void 0)}}var $t=r(6880),Qt=r.n($t);let Jt;function Yt(e=!1){return(e||void 0===Jt)&&(Jt={...Qt().parse(navigator?.userAgent),supported:"undefined"!=typeof RTCPeerConnection&&("addTransceiver"in RTCPeerConnection.prototype||"addTrack"in RTCPeerConnection.prototype),secure:isSecureContext,mediaDevices:void 0!==navigator?.mediaDevices,screenshare:void 0!==navigator?.mediaDevices?.getDisplayMedia,h264Enc:Xt.checkVideoCodec("h264"),h264Dec:Xt.checkVideoCodec("h264",!1),vp8Enc:Xt.checkVideoCodec("vp8"),vp8Dec:Xt.checkVideoCodec("vp8",!1),opusEnc:Xt.checkAudioCodec("opus"),opusDec:Xt.checkAudioCodec("opus",!1),videoEncCodecs:Xt.videoEncCodecs(),videoDecCodecs:Xt.videoDecCodecs(),audeoEncCodecs:Xt.audioEncCodecs(),audeoDecCodecs:Xt.audioDecCodecs(),ua:navigator?.userAgent,screenWidth:screen?.width||0,screenHeight:screen?.height||0,clientWidth:document?.documentElement?.clientWidth||0,clientHeight:document?.documentElement?.clientHeight||0,devicePixelRatio}),Jt}class Xt{static async checkCameraPermission(){}static async checkMicPermission(){}static videoEncCodecs(){return"getCapabilities"in RTCRtpSender?RTCRtpSender.getCapabilities("video"):(X.warn("当前环境不支持getCapabilities获取支持的视频编码类型"),null)}static audioEncCodecs(){return"getCapabilities"in RTCRtpSender?RTCRtpSender.getCapabilities("audio"):(X.warn("当前环境不支持getCapabilities获取支持的音频编码类型"),null)}static videoDecCodecs(){return"getCapabilities"in RTCRtpReceiver?RTCRtpReceiver.getCapabilities("video"):(X.warn("当前环境不支持getCapabilities获取支持的视频解码类型"),null)}static audioDecCodecs(){return"getCapabilities"in RTCRtpReceiver?RTCRtpReceiver.getCapabilities("audio"):(X.warn("当前环境不支持getCapabilities获取支持的音频解码类型"),null)}static checkVideoCodec(e,t=!0){const r=t?this.videoEncCodecs():this.videoDecCodecs();if(r)for(const t of r.codecs)if(t.mimeType.toLowerCase().replace("video/","")===e.toLowerCase())return!0;return!1}static checkAudioCodec(e,t=!0){const r=t?this.audioEncCodecs():this.audioDecCodecs();if(r)for(const t of r.codecs)if(t.mimeType.toLowerCase().replace("audio/","")===e.toLowerCase())return!0;return!1}static preferAudioEncCodec(e){let t=this.audioEncCodecs(),r=[],n=[];if(t)for(const i of t.codecs)i.mimeType.toLowerCase().replace("audio/","")===e.toLowerCase()?n.push(i):r.push(i);return n.push(...r),n}static preferVideoEncCodec(e){let t=this.videoEncCodecs(),r=[],n=[],i=[];if(t)for(const o of t.codecs)o.mimeType.toLowerCase().replace("video/","")===e.toLowerCase()?"h264"===e.toLowerCase()&&o.sdpFmtpLine&&o.sdpFmtpLine.includes("profile-level-id=42e01f")?n.push(o):i.push(o):r.push(o);return n.push(...i),n.push(...r),n}}class Zt{appID;sid;clientKey;serverPrefix;constructor(e,t,r,n){this.appID=e,this.sid=t,this.clientKey=r,"/"!==n.substring(n.length-1)&&(n+="/"),this.serverPrefix=n+"v1/"}async join(e){return await this.req("channel/join",{device_type:e.deviceType,device_id:e.deviceID,version:e.version})}async detail(e){let t=await this.req("channel/detail",{with_userlist:e});if(e){let e=t.users;return delete t.users,{channelinfo:t,userinfos:e}}return{channelinfo:t,userinfos:null}}async leave(){return this.req("channel/leave",{})}async heartbeat(){return this.req("channel/heartbeat",{})}async reconnect(e){return this.req("channel/reconnect",{type:e.type})}async updateStream(e){return this.req("channel/update-stream",{stream_tracks:e})}async imConnect(e){return this.req("im/connect",{device_type:e.deviceType,device_id:e.deviceID,version:e.version})}async imReconnect(){return this.req("im/reconnect",{})}async imHeartbeat(){return this.req("im/heartbeat",{})}async imDisconnect(){return this.req("im/disconnect",{})}async req(e,t={},r={}){const n=Math.floor(Date.now()/1e3),i=A(16);r.app_id=this.appID,r.sid=this.sid,r.nonce=i,r.timestamp=n+"";let o=this.signature(t,i,n);r.signature=o;let s=Date.now(),a=(r,n)=>{X[r]("rtc api: "+this.serverPrefix+e,t,n,Date.now()-s+"ms")};return this.http(e,t,{...r,"Content-Type":"application/json"}).then((e=>{if(0==e.code)return a(J.DEBUG,e),e.data;throw new D(e.msg,e.code)})).catch((e=>{throw a(J.ERROR,e),e}))}signature(e,t,r){let n=`app_id=${this.appID}&sid=${this.sid}&nonce=${t}×tamp=${r}&`+JSON.stringify(e);return Wt()(n,this.clientKey).toString()}}class er extends Zt{http(e,t,r){return new Promise(((n,i)=>{fetch(this.serverPrefix+e,{method:"POST",headers:r,body:JSON.stringify(t)}).then((e=>{200!=e.status?i(new Error(e.status+":"+e.statusText)):e.json().then((e=>{n(e)})).catch((e=>{i(e)}))})).catch((e=>{i(e)}))}))}async cdnURL(e){return(await this.req("cdn/url",e)).url}async sfuConnect(e){return this.req("sfu/connect",{publish_offer:e})}async sfuDisconnect(){return this.req("sfu/disconnect",{})}async sfuOfferPublish(e){return this.req("sfu/offer-publish",{offer:e})}async sfuSubscribe(e){return this.req("sfu/subscribe",{tracks:e})}async sfuAnswerSubscribe(e){return this.req("sfu/answer-subscribe",{answer:e})}}function tr(e,t,r){var n,i,o;void 0===t&&(t=50),void 0===r&&(r={});var s=null!=(n=r.isImmediate)&&n,a=null!=(i=r.callback)&&i,c=r.maxWait,u=Date.now(),l=[];function h(){if(void 0!==c){var e=Date.now()-u;if(e+t>=c)return c-e}return t}var f=function(){var t=[].slice.call(arguments),r=this;return new Promise((function(n,i){var c=s&&void 0===o;if(void 0!==o&&clearTimeout(o),o=setTimeout((function(){if(o=void 0,u=Date.now(),!s){var n=e.apply(r,t);a&&a(n),l.forEach((function(e){return(0,e.resolve)(n)})),l=[]}}),h()),c){var f=e.apply(r,t);return a&&a(f),n(f)}l.push({resolve:n,reject:i})}))};return f.cancel=function(e){void 0!==o&&clearTimeout(o),l.forEach((function(t){return(0,t.reject)(e)})),l=[]},f}class rr{ctn={};linkids={};[Symbol.iterator](){const e=Object.entries(this.ctn);let t=0;return{next:()=>t<e.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}set(e,t){this.ctn[e]=t,t.link_id&&(this.linkids[t.link_id]=e)}get(e){return this.ctn[e]}getByLinkid(e){return this.get(this.linkids[e])}del(e){delete this.ctn[e]}clear(){this.ctn={},this.linkids={}}listInfo(e){if(e){let e={};for(const t in this.ctn)e[t]=this.ctn[t].getInfo();return e}{let e=[];for(const t in this.ctn)e.push(this.ctn[t].getInfo());return e}}}var nr=function(e){return e.INIT="init",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.LEAVED="leaved",e}(nr||{});class ir extends(f()){options;joinRsp;me;users;info;heartbeatIntervalID;connectState;rtcApi;rtcSocket;rtcStreamEngine;audioMixTrack;videoMcuTrack;eventCB;trackMutex;trackDebounce;constructor(e,t,r,n,i,o=null){super(),this.options=e,this.joinRsp=t,this.users=new rr,this.trackMutex={},this.trackDebounce={},this.rtcApi=r,this.rtcSocket=i,this.rtcStreamEngine=n,this.eventCB=o,this.addSocketListeners(),this.connectState=nr.INIT}async refresh(e){if(!e){const{channelinfo:e,userinfos:t}=await this.rtcApi.detail(!0);this.info=e,this.users.clear(),t&&t.forEach((e=>{let t=this.newUser(e);this.users.set(e.uid,t),e.sid==this.joinRsp.sid&&(this.me=t)}))}this.heartbeatIntervalID&&clearInterval(this.heartbeatIntervalID);let t=this.heartbeatIntervalID=setInterval((()=>this.heartbeat()),3e4);X.debug("channel heartbeat interval started",t),this.connectState=nr.CONNECTED}checkConnected(){if(this.connectState!=nr.CONNECTED)switch(this.connectState){case nr.RECONNECTING:throw new D("网络重连中,请稍后");case nr.LEAVED:throw new D("您已离开频道")}}addSocketListeners(){this.onConnected=this.onConnected.bind(this),this.onStartReconnect=this.onStartReconnect.bind(this),this.onChannelMessage=this.onChannelMessage.bind(this),this.rtcSocket.on(Ut.CONNECTED,this.onConnected),this.rtcSocket.on(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.on(Ut.CHANNEL_MESSAGE,this.onChannelMessage)}removeSocketListeners(){this.rtcSocket.off(Ut.CONNECTED,this.onConnected),this.rtcSocket.off(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.off(Ut.CHANNEL_MESSAGE,this.onChannelMessage)}triggerEvent(e,t){try{let r=new i(e,t);this.emit(e,r),this.eventCB&&this.eventCB(r)}catch(r){X.error(`事件${e}上层响应出错,请sdk调用者检查`,r,t)}}async heartbeat(){let e=this.heartbeatIntervalID;if(this.connectState!=nr.CONNECTED)throw X.info(`异常channel心跳,当前频道状态${this.connectState}`),clearInterval(e),new D(`异常channel心跳,频道状态为:${this.connectState}`);try{await this.rtcApi.heartbeat()}catch(e){X.error("channel心跳失败",e),e instanceof D&&this.leave(o.Error,e)}X.debug("channel heartbeat interval",e)}async onConnected(){let e=this.connectState;X.warn(e==nr.RECONNECTING?"会控socket重连成功":"会控socket连接成功");try{this.connectState=nr.CONNECTED,await this.refresh(e==nr.RECONNECTING),e==nr.RECONNECTING?this.triggerEvent(s.RECONNECTED):this.triggerEvent(s.JOIN_SUCCEED,this.getInfo())}catch(e){this.leave(o.Error,e)}}onStartReconnect(){X.warn("会控socket开始重连"),clearInterval(this.heartbeatIntervalID),this.connectState=nr.RECONNECTING,this.triggerEvent(s.RECONNECTING)}onChannelMessage(e,t){switch(t.type){case Z.ChannelUpdate:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;this.info.props=e.props,this.info.updated_at=e.updated_at,this.triggerEvent(s.CHANNEL_UPDATE,this.getInfo());break}case Z.ChannelDestroy:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;this.leave(o.Destroy);break}case Z.UserUpdate:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;let r=this.users.get(e.uid);r&&(r.updateInfo(e),this.triggerEvent(e.sid==this.joinRsp.sid?s.ME_UPDATE:s.USER_UPDATE,r.getInfo()));break}case Z.UserLeave:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;if(e.sid==this.joinRsp.sid)this.leave(e.reason);else{let t=this.users.get(e.uid);if(!t)return void X.error(`收到用户${e.uid}离开消息,但其不在频道内`);for(const e in t.getTracks()){let r=t.getTracks()[e];this.rtcStreamEngine.haveSubscribed(r)&&this.unsubscribeRemoteTrack(r,0)}this.users.del(e.uid),this.triggerEvent(s.USER_LEAVE,{uid:e.uid,reason:e.reason})}break}case Z.UserJoin:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel||e.sid==this.joinRsp.sid)return;let r=this.users.get(e.uid);r&&(X.warn(`收到成员${e.uid}(${e.name})入会消息,但其已经在频道内,先模拟一次离开频道`),this.users.del(e.uid),this.triggerEvent(s.USER_LEAVE,{uid:e.uid,reason:o.Error})),r=this.newUser(e),this.users.set(e.uid,r),this.triggerEvent(s.USER_JOIN,r.getInfo());break}case Z.StreamUpdate:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel||e.sid==this.joinRsp.sid)return;let r=this.users.get(e.uid),{added:n,updated:i,deleted:o}=r.updateTracks(e.stream_tracks),a=r.getInfo();o.forEach((e=>{this.rtcStreamEngine.haveSubscribed(e)&&this.unsubscribeRemoteTrack(e,0),"stopPlay"in e&&"function"==typeof e.stopPlay&&e.stopPlay(),"removeAllPlayViews"in e&&"function"==typeof e.removeAllPlayViews&&e.removeAllPlayViews(),this.triggerEvent(s.USER_TRACK_REMOVE,{user:a,track:e.getInfo()})})),i.forEach((e=>{this.triggerEvent(s.USER_TRACK_UPDATE,{user:a,track:e.getInfo()})})),n.forEach((e=>{this.options.autoSubscribeAudio&&e.kind==M.Audio&&this.subscribeRemoteAudioTrack(a.uid,e.id),this.options.autoSubscribeVideo&&e.kind==M.Video&&this.subscribeRemoteVideoTrack(a.uid,e.id),this.triggerEvent(s.USER_TRACK_ADD,{user:a,track:e.getInfo()})})),this.triggerEvent(s.USER_UPDATE,a);break}case Z.Custom:{const r=t.data;if(!r||r.channel!=this.joinRsp.channel)return;r.private=-1!==e.indexOf("/channel-user/"),this.triggerEvent(s.CUSTOM_MSG,r);break}}}getMe(){if(!this.me)throw new D("尚未获取到自己信息");return this.me}getUser(e){let t=this.users.get(e);if(!t)throw new D(`频道内没有用户${e}`);return t}getUsersInfo(e){return this.users.listInfo(e)}async leave(e,t){if(this.connectState!==nr.LEAVED){clearInterval(this.heartbeatIntervalID),this.removeSocketListeners();try{await this.rtcSocket.close()}catch(e){X.error("断开会控socket报错",e)}try{await this.rtcApi.leave()}catch(e){X.error("调离开频道api报错",e)}try{await this.rtcStreamEngine.disconnect()}catch(e){X.error("断开流媒体引擎报错",e)}this.connectState=nr.LEAVED,this.triggerEvent(s.DISCONNECTED,{reason:e,error:t}),this.removeAllListeners(),this.eventCB=null,X.center?.flush(),X.info("leaved channel",this.joinRsp.channel,e)}}getInfo(){let e={...this.info};return e.props={...e.props},e}getStreamMetric(){return this.rtcStreamEngine.getMetricSnapshot()}getStreamEngineVendor(){return this.rtcStreamEngine.vendor()}async getPublishExOption(e,t){return{}}getAddedTracksAfterPublish(e,t){if(e.kind==M.Audio){let r=t;e.updateInfo(v({desc:r.desc,codec:r.codec,bitrate:r.maxBitrate,props:r.props}))}else{let r=t;e.updateInfo(v({desc:r.desc,codec:r.codec,width:r.width,height:r.height,fps:r.maxFramerate,bitrate:r.maxBitrate,props:r.props}))}return[e]}getDeletedTracksAfterUnpublish(e){return[e]}async publishLocalTrack(e,t){if(!t.desc)throw new D("轨道发布描述不能为空");let r=this.getMe();const n=await this.lockTrack(e.id);try{let n=await this.getPublishExOption(e,t);await this.rtcStreamEngine.publish(e,t,n);let i=this.getAddedTracksAfterPublish(e,t);try{let e=Object.values(r.getTracks()).map((e=>e.getInfo()));e.push(...i.map((e=>e.getInfo()))),await this.rtcApi.updateStream(e),i.forEach((e=>{r.getTracks()[e.id]=e})),r.updateInfo({stream_tracks:e}),this.triggerEvent(s.ME_UPDATE,r.getInfo())}catch(t){throw this.unpublishLocalTrack(e),t}}finally{n()}}async unpublishLocalTrack(e){let t=this.getMe();const r=await this.lockTrack(e.id);try{let r=Object.values(t.getTracks()).map((e=>e.getInfo()));if(!r.some((t=>t.id===e.id)))return void X.warn(e.toString()+"已取消发布,无需再次取消发布");let n=this.getDeletedTracksAfterUnpublish(e),i=r.filter((e=>!n.some((t=>t.id===e.id))));await this.rtcApi.updateStream(i);try{await this.rtcStreamEngine.unpublish(e),n.forEach((e=>{delete t.getTracks()[e.id]})),t.updateInfo({stream_tracks:i}),this.triggerEvent(s.ME_UPDATE,t.getInfo())}catch(e){throw await this.rtcApi.updateStream(r),e}}finally{r()}}async getSubscribeExOption(e){return{}}async subscribeRemoteAudioMixTrack(e){let t=this.audioMixTrack;if(t)if("RemoteAudioMixTrack"===t.__type){let r=t.getFilterUids(),n=[];e&&Array.isArray(e)&&(n=e),r.join(",")!==n.join(",")&&this.rtcStreamEngine.haveSubscribed(t)&&await this.unsubscribeRemoteTrack(t,0)}else t.stop(),this.audioMixTrack=t=void 0;t||(t=this.newRemoteAudioMixTrack(e));const r=await this.lockTrack(t.id);try{if("RemoteAudioMixTrack"===t.__type){let e=await this.getSubscribeExOption(t);await this.rtcStreamEngine.subscribe(t,e)}else if("LocalAudioMixTrack"===t.__type){this.options.autoSubscribeAudio=!0;for(const[e,r]of this.users){if(e===this.getMe().uid)continue;let n=r.getTracks();for(const r in n){let i=n[r];i.kind!==M.Audio||t.checkFilter(i)||(this.subscribeRemoteAudioTrack(e,r),t.addTrack(i))}}}return this.audioMixTrack=t,t}finally{r()}}async subscribeRemoteAudioTrack(e,t){let r=this.getUser(e).getTrack(t);if(!r)throw F(e+"没有id为"+t+"的音频流");if(r.kind!=M.Audio)throw new D(e+"id为"+t+"的流非音频,而是"+r.kind);const n=await this.lockTrack(r.id);try{let t=await this.getSubscribeExOption(r);return await this.rtcStreamEngine.subscribe(r,t),e!==this.getMe().uid&&this.audioMixTrack&&"LocalAudioMixTrack"===this.audioMixTrack.__type&&!this.audioMixTrack.checkFilter(r)&&this.audioMixTrack.addTrack(r),r}finally{n()}}async subscribeRemoteVideoMcuTrack(){let e=this.videoMcuTrack;e||(e=this.newRemoteVideoMcuTrack());const t=await this.lockTrack(e.id);try{let t=await this.getSubscribeExOption(e);return await this.rtcStreamEngine.subscribe(e,t),this.videoMcuTrack=e,e}finally{t()}}async subscribeRemoteVideoTrack(e,t){let r=this.getUser(e).getTrack(t);if(!r)throw F(e+"没有id为"+t+"的视频流");if(r.kind!=M.Video)throw new D(e+"id为"+t+"的流非视频,而是"+r.kind);this.trackDebounce[r.id]?.cancel("subscribe");const n=await this.lockTrack(r.id);try{let e=await this.getSubscribeExOption(r);return await this.rtcStreamEngine.subscribe(r,e),r}finally{n()}}async unsubscribeRemoteTrack(e,t=2e3){if(t<=0){const t=await this.lockTrack(e.id);try{this.audioMixTrack&&this.audioMixTrack===e&&"LocalAudioMixTrack"===this.audioMixTrack.__type?(this.audioMixTrack.stop(),this.audioMixTrack=void 0):(await this.rtcStreamEngine.unsubscribe(e),e.kind===M.Audio&&this.audioMixTrack&&"LocalAudioMixTrack"===this.audioMixTrack.__type&&this.audioMixTrack.removeTrack(e))}finally{t()}return}(this.trackDebounce[e.id]=tr((async()=>{await this.unsubscribeRemoteTrack(e,0)}),2e3))().catch((t=>{X.warn(e.toString()+"取消订阅动作被终止",t)}))}async lockTrack(e){let t=this.trackMutex[e];return t||(this.trackMutex[e]=t=new _),t.lock()}}class or extends s{static DEVICE_ADD="device_add";static DEVICE_REMOVE="device_remove";static TRACK_AUTOPLAY_FAIL="track_autoplay_fail"}class sr extends a{static AUTOPLAY_FAIL="autoplay_fail";static MSTRACK_REPLACED="mstrack_replaced";static RECONNECTING="reconnecting";static RECONNECTED="reconnected"}class ar extends N{mediaStream;mediaStreamTrack;constructor(e,t){super(e,t),this.onMute=this.onMute.bind(this),this.onUnmute=this.onUnmute.bind(this),this.onEnded=this.onEnded.bind(this),this.mediaStream=new MediaStream}addMsTrackListeners(e){e.addEventListener("mute",this.onMute),e.addEventListener("unmute",this.onUnmute),e.addEventListener("ended",this.onEnded)}removeMsTrackListeners(e){e.removeEventListener("mute",this.onMute),e.removeEventListener("unmute",this.onUnmute),e.removeEventListener("ended",this.onEnded)}onMute(){X.info(this.toString(),"muted"),this.emit(a.MUTED,this)}onUnmute(){X.info(this.toString(),"unmuted"),this.emit(a.UNMUTED,this)}onEnded(){X.info(this.toString(),"ended"),this.emit(a.ENDED,this)}setMediaStreamTrack(e){let t=this.mediaStreamTrack;if(t!=e){if(t&&(this.mediaStream.removeTrack(t),this.removeMsTrackListeners(t)),this.mediaStreamTrack=e,e){this.mediaStream.addTrack(e),this.addMsTrackListeners(e);let t=e.getSettings();X.debug(this.toString(),"实际采集到的mstrack设置",t)}this.emit(sr.MSTRACK_REPLACED,this,t)}}getMediaStreamTrack(){return this.mediaStreamTrack}getMediaStream(){return this.mediaStream}}class cr{track;audioElements;constructor(e){this.track=e,this.audioElements=[]}isPlaying(){return this.audioElements.length>0}async startPlay(e){if(this.stopPlay(),!this.track.getMediaStreamTrack())throw new D(this.track.toString()+"的mediaStreamTrack不存在,无法播放声音");let t=document.createElement("audio");return t.autoplay=!1,t.srcObject=this.track.getMediaStream(),t.style.display="none",document.body.appendChild(t),e?.deviceId&&("setSinkId"in t?await t.setSinkId(e.deviceId):X.error("当前环境不支持setSinkId,将从默认扬声器播放")),new Promise((async(e,r)=>{let n=setTimeout((()=>{X.warn("音频play超时未响应,默认视为浏览器权限问题处理"),t.remove(),e(!1)}),1e3);try{await t.play(),clearTimeout(n),this.audioElements.push(t),e(!0)}catch(i){clearTimeout(n),t.remove(),i instanceof DOMException&&"NotAllowedError"===i.name?e(!1):r(new D(this.track.toString()+"自动播放失败:"+i))}}))}stopPlay(){this.audioElements.forEach((e=>e.remove())),this.audioElements=[]}}class ur{track;videoElements;constructor(e){this.track=e,this.videoElements=[],this.track.on(sr.INFO_UPDATE,(()=>{this.videoElements.forEach((e=>{this.freshTransform(e)}))}))}addPlayView(e){if(!this.track.getMediaStreamTrack())throw new D(this.track.toString()+"的mediaStreamTrack不存在,无法添加播放view");if(this.videoElements.find((t=>t.parentElement==e)))return;let t=document.createElement("video");t.autoplay=!0,t.muted=!0,t.controls=!1,t.playsInline=!0,t.style.width="100%",t.style.height="100%",t.style.objectFit="contain",t.onloadedmetadata=()=>{this.freshTransform(t)},t.srcObject=this.track.getMediaStream(),e.appendChild(t),this.videoElements.push(t)}freshTransform(e){let t=this.track.getInfo().angle,r=1*e.videoHeight/e.videoWidth;switch(t){case 1129136434:e.style.transform=`rotate(270deg) scale(${r},${r})`;break;case 1129136433:e.style.transform="rotate(-180deg)";break;case 1129136441:e.style.transform=`scale(${r},${r}) rotateY(180deg) rotate(-90deg)`;break;default:e.style.transform=""}}hasPlayView(){return this.videoElements.length>0}removePlayView(e){let t=this.videoElements.findIndex((t=>t.parentElement==e));t>=0&&(this.videoElements[t].remove(),this.videoElements.splice(t,1))}removeAllPlayViews(){this.videoElements.forEach((e=>e.remove())),this.videoElements=[]}}class lr{static htmlTpl='<div id="$id$" class="autoplay-dialog-container">\n <div class="autoplay-dialog">\n <div class="autoplay-dialog-content">\n <p>因浏览器权限问题自动播放$desc$失败,点击恢复自动播放</p>\n </div>\n <div class="autoplay-dialog-actions">\n <button class="autoplay-dialog-button">确定</button>\n </div>\n </div>\n</div>';static cssTpl=".autoplay-dialog-container {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n}\n\n.autoplay-dialog {\n background-color: white;\n padding: 20px;\n border-radius: 5px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n text-align: center;\n}\n\n.autoplay-dialog-content {\n margin-bottom: 20px;\n}\n\n.autoplay-dialog-button {\n background-color: #007bff;\n color: white;\n border: none;\n padding: 10px 20px;\n border-radius: 5px;\n cursor: pointer;\n}";static show(e,t,r){const n=document.createElement("style");n.textContent=this.cssTpl,document.head.appendChild(n);let i="autoplay-"+e,o=document.createElement("div");document.body.append(o),o.outerHTML=this.htmlTpl.replace("$id$",i).replace("$desc$",t),document.getElementById(i).onclick=e=>{n.remove(),e.currentTarget.remove(),r()}}}function hr(e){const t=new AudioContext,r=t.createMediaStreamDestination(),n=r.stream.getAudioTracks()[0];if(!n)throw new Error("Failed to create mixed audio track");let i,o;if(n.context=t,e){i=t.createAnalyser(),i.fftSize=256;const r=i.frequencyBinCount,n=new Uint8Array(r),s=()=>{o=requestAnimationFrame(s),i.getByteFrequencyData(n);const t=e.canvas;e.fillStyle="rgb(0, 0, 0)",e.fillRect(0,0,t.width,t.height);const a=t.width/r*2.5;let c,u=0;for(let i=0;i<r;i++)c=n[i]/255*t.height,e.fillStyle=`rgb(${c+100}, 50, 50)`,e.fillRect(u,t.height-c/2,a,c/2),u+=a+1};s()}const s=new Map;return n.addTrack=e=>{if("ended"===e.readyState||!t)return;const o=new MediaStream([e]),a=t.createMediaStreamSource(o);i&&a.connect(i),a.connect(r),s.set(e,{source:a,stream:o}),e.addEventListener("ended",(()=>{n.removeTrack(e)}))},n.removeTrack=e=>{const t=s.get(e);t&&(t.source.disconnect(),s.delete(e))},n}class fr extends ar{playTrait;constructor(e,t){super(e,t),this.playTrait=new cr(this)}strPrefix(){return"远端音频流轨道"}isPlaying(){return this.playTrait.isPlaying()}async startPlay(e){await this.playTrait.startPlay(e)||(e&&e.disableAutoPlayDialog?this.emit(sr.AUTOPLAY_FAIL,this):lr.show(this.id,this.desc,(()=>{this.startPlay(e)})))}stopPlay(){this.playTrait.stopPlay()}}class dr extends fr{__type="RemoteAudioMixTrack";filterUids;constructor(e,t){super(e,""),this.filterUids=t||[]}getFilterUids(){return this.filterUids}strPrefix(){return"远端频道混音流轨道"}}class pr extends fr{__type="LocalAudioMixTrack";filter;tracks;constructor(e,t){super(e,"");let r=hr();this.setMediaStreamTrack(r),this.filter=t,this.tracks={}}checkFilter(e){return!!this.filter&&this.filter(e)}async startPlay(e){for(const t in this.tracks){const r=this.tracks[t].deref();if(r&&r.getMediaStreamTrack()){r.isPlaying()||(await r.startPlay(e),r.stopPlay());break}}if(super.startPlay(e),this.mediaStreamTrack){const e=this.mediaStreamTrack.context;"suspended"===e.state&&await e.resume()}}addTrack(e){if(this.checkFilter(e))return;if(this.tracks[e.id])return;let t=e.getMediaStreamTrack();t&&(this.mediaStreamTrack?.addTrack(t),e.isPlaying()||e.startPlay({disableAutoPlayDialog:!0}).finally((()=>{e.stopPlay()}))),e.on(sr.MSTRACK_REPLACED,this.onTrackMsTrackReplace),this.tracks[e.id]=new WeakRef(e)}removeTrack(e){let t=e.getMediaStreamTrack();t&&this.mediaStreamTrack?.removeTrack(t),e.off(sr.MSTRACK_REPLACED,this.onTrackMsTrackReplace),delete this.tracks[e.id]}onTrackMsTrackReplace=(e,t)=>{t&&this.mediaStreamTrack?.removeTrack(t);let r=e.getMediaStreamTrack();r&&(this.mediaStreamTrack?.addTrack(r),e.isPlaying()||e.startPlay({disableAutoPlayDialog:!0}).finally((()=>{e.stopPlay()})))};stop(){for(const e in this.tracks){const t=this.tracks[e].deref();t&&this.removeTrack(t)}this.tracks={},this.mediaStreamTrack?.context.close(),this.mediaStreamTrack?.stop()}strPrefix(){return"本地合成的远端混音流轨道"}}class gr extends ar{playTrait;constructor(e,t){super(e,t),this.playTrait=new ur(this)}strPrefix(){return"远端视频流轨道"}addPlayView(e){this.playTrait.addPlayView(e)}hasPlayView(){return this.playTrait.hasPlayView()}removePlayView(e){this.playTrait.removePlayView(e)}removeAllPlayViews(){this.playTrait.removeAllPlayViews()}}class mr extends gr{constructor(e){super(e,"")}strPrefix(){return"远端视频合成流轨道"}}class yr{tracks;info;constructor(e){this.info=e,this.tracks={},e.stream_tracks?.forEach((e=>{let t=this.newTrack(e);this.tracks[e.id]=t}))}getTrack(e){return this.tracks[e]}getTrackByDesc(e){for(let t in this.tracks)if(this.tracks[t].desc===e)return this.tracks[t]}getTracks(){return this.tracks}updateTracks(e){let t=[],r=[],n=[],i={},o={};for(let e in this.tracks)i[e]=!0,o[e]=this.tracks[e];e.forEach((e=>{let n=o[e.id];if(n){let t=n.updateInfo(e);delete i[e.id],t.length>0&&r.push(n)}else{let r=this.newTrack(e);this.tracks[e.id]=r,t.push(r)}}));for(let e in i){let t=this.tracks[e];t&&(delete this.tracks[e],n.push(t))}return this.info.stream_tracks=e,{added:t,updated:r,deleted:n}}get uid(){return this.info.uid}get sid(){return this.info.sid}get device_type(){return this.info.device_type}get device_id(){return this.info.device_id}get link_id(){return this.info.link_id}getInfo(){let e={...this.info};return e.props={...e.props},e.stream_tracks=e.stream_tracks?.map((e=>({...e}))),e}updateInfo(e){E(this.info,e)}}class vr extends yr{newTrack(e){switch(e.kind){case M.Video:return new gr(e,this.uid);case M.Audio:return new fr(e,this.uid)}}}class br extends ir{newUser(e){return new vr(e)}async getPublishExOption(e,t){let r={};if(this.rtcStreamEngine.vendor()===Kt.OOK){let t=-1;e.kind==M.Video&&(t=this.rtcStreamEngine.getAvailableVideoTrackNo()),r={track:t},e.updateInfo({track:t})}return r}getAddedTracksAfterPublish(e,t){let r=super.getAddedTracksAfterPublish(e,t);if(this.rtcStreamEngine.vendor()===Kt.Seastart)if(e.kind==M.Video){let n=t,i=e;if(n.simulcasts&&n.simulcasts.length>0)for(let e=0;e<n.simulcasts.length;e++){let t=n.simulcasts[e],o=i.getSimulcastTrack(t,n.width,n.height);o.updateInfo(v({desc:t.desc,codec:t.codec,width:t.width,height:t.height,fps:t.maxFramerate,bitrate:t.maxBitrate,props:t.props})),r.push(o)}}return r}getDeletedTracksAfterUnpublish(e){let t=super.getDeletedTracksAfterUnpublish(e);if(this.rtcStreamEngine.vendor()===Kt.Seastart)if(e.kind==M.Video){let r=e;t.push(...Object.values(r.getSimulcastTracks()))}return t}async getSubscribeExOption(e){let t={};if(this.rtcStreamEngine.vendor()===Kt.OOK)if(e instanceof dr){let r=this.getMe(),n=[];e.getFilterUids().forEach((e=>{if(e&&e!=r.uid)try{let t=this.getUser(e);n.push(t.link_id)}catch(e){}})),t={filter_link_ids:n}}else if(e instanceof mr)t={};else{let r=this.getUser(e.getUid()),n=e.getInfo();t={link_id:r.link_id,track:n.track}}return t}newRemoteAudioMixTrack(e){if(this.getStreamEngineVendor()==Kt.OOK)return new dr({id:R,desc:"频道混音流",kind:M.Audio},Array.isArray(e)?e:[]);if(e&&Array.isArray(e)){let t=e;e=e=>t.includes(e.getUid())}return new pr({id:R,desc:"频道混音流",kind:M.Audio},e)}newRemoteVideoMcuTrack(){return new mr({id:"__mcu__",desc:"视频合成流",kind:M.Video})}}const wr="default";class _r extends(f()){static instance;static devices=[];static debouncedDeviceChangeHandler=tr((async()=>{let e=_r.devices,t=await _r.instance.getDevices();const r=t.filter((t=>!e.some((e=>e.deviceId===t.deviceId)))),n=e.filter((e=>!t.some((t=>e.deviceId===t.deviceId))));r.forEach((e=>{X.info("新设备插入:",e),_r.instance.emit("add",e)})),n.forEach((e=>{X.info("设备被拔出:",e),_r.instance.emit("remove",e)}))}),100,{isImmediate:!1});static getInstance(){if(void 0===_r.instance){_r.instance=new _r;"undefined"==typeof window||window.isSecureContext||void 0!==navigator?.mediaDevices||X.warn("当前非安全环境(https或localhost或127.0.0.1),将无法获取麦克风、摄像头等媒体设备进行枚举、音视频采集、推流"),navigator?.mediaDevices?.addEventListener("devicechange",(()=>{_r.debouncedDeviceChangeHandler()}))}return _r.instance}static waitingMediaDevicePromises=[];async addWaitMediaDevice(e,t,r){let n=_r.waitingMediaDevicePromises;n.push(e);try{return await e}catch(e){throw X.error(`mediaDevices.${t} error`,e,r),e}finally{n.splice(n.indexOf(e),1)}}async enum(){let e=navigator.mediaDevices.enumerateDevices();return this.addWaitMediaDevice(e,"enumerateDevices")}async getUserMedia(e){let t=navigator.mediaDevices.getUserMedia(e);return this.addWaitMediaDevice(t,"getUserMedia",e)}async waitMediaDevices(){return Promise.allSettled(_r.waitingMediaDevicePromises)}async getDevices(e,t=!0){let r=await this.enum();if(t){if(0===r.length||r.some((t=>{const r=""===t.label,n=!e||t.kind===e;return r&&n}))){const t={video:"audioinput"!==e&&"audiooutput"!==e,audio:"videoinput"!==e};for(;;)try{const e=await this.getUserMedia(t);r=await this.enum(),e.getTracks().forEach((e=>{e.stop()}));break}catch(e){if(e instanceof DOMException&&"NotFoundError"===e.name&&(t.video?t.video=!1:t.audio&&(t.audio=!1),t.audio||t.video))continue;throw e}}}return e?r=r.filter((t=>t.kind===e)):t&&(_r.devices=r),r}async normalizeDeviceId(e,t,r){if(t!==wr)return t;const n=await this.getDevices(e),i=new Map(n.map((e=>[e.groupId,0])));n.forEach((e=>i.set(e.groupId,(i.get(e.groupId)??0)+1)));const o=n.find((e=>(r===e.groupId||(i.get(e.groupId)??0)>1)&&e.deviceId!==wr));return o?.deviceId}}class kr extends ar{playTrait;constructor(){super({id:A(20),kind:M.Audio,track:-1},""),this.playTrait=new cr(this)}getVolume(){return 0}strPrefix(){return"本地音频流轨道"}async startPlay(e){await this.playTrait.startPlay(e)||(e&&e.disableAutoPlayDialog?this.emit(sr.AUTOPLAY_FAIL,this):lr.show(this.id,this.desc,(()=>{this.startPlay(e)})))}stopPlay(){this.playTrait.stopPlay()}}class Sr extends kr{captureOptions;constructor(e){super(),this.captureOptions=!0===e||{...e}}strPrefix(){return"本地屏幕共享音频流轨道"}stopCapture(){let e=this.getMediaStreamTrack();e?e.stop():X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}}class Er extends kr{captureOptions;constructor(e){super(),this.captureOptions={...e}}strPrefix(){return"本地麦克风流轨道"}onEnded(){X.warn(this.toString(),"异常结束,自动尝试默认麦克风"),this.changeDeviceId(wr).catch((e=>{X.error(this.toString(),"异常结束,自动尝试默认麦克风失败",e),super.onEnded()}))}async startCapture(e){e&&E(this.captureOptions,e);let t=this.captureOptions;t.deviceId&&t.deviceId!=wr&&(t={...this.captureOptions},t.deviceId={exact:this.captureOptions.deviceId});let r=await _r.getInstance().getUserMedia({audio:t,video:!1});this.setMediaStreamTrack(r.getTracks()[0])}stopCapture(){let e=this.getMediaStreamTrack();e?e.stop():X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}async changeDeviceId(e){if(this.captureOptions.deviceId===e&&e!=wr)return;return this.captureOptions.deviceId=e,this.getMediaStreamTrack()?(this.stopCapture(),this.startCapture()):void 0}}class Cr extends ar{playTrait;simulcastTracks={};scaleResolutionDownBy=1;constructor(){super({id:A(20),kind:M.Video,track:-1},""),this.playTrait=new ur(this)}strPrefix(){return"本地视频流轨道"}setMediaStreamTrack(e){super.setMediaStreamTrack(e);for(let t in this.simulcastTracks)this.simulcastTracks[t].setMediaStreamTrack(e)}getSimulcastTrack(e,t,r){if(!e.desc)throw new D("联播轨道发布描述不能为空");let n=this.simulcastTracks[e.desc];if(!n){n=this.simulcastTracks[e.desc]=new Cr;const i=Math.min(t||this.mediaStreamTrack?.getSettings().width||0,r||this.mediaStreamTrack?.getSettings().height||0);i>0&&e.width&&e.height&&(n.scaleResolutionDownBy=Math.max(1,i/Math.min(e.width,e.height)),X.debug(n.toString(),`编码缩放倍数:${n.scaleResolutionDownBy}`)),n.setMediaStreamTrack(this.mediaStreamTrack)}return n}getSimulcastTracks(){return this.simulcastTracks}getScaleResolutionDownBy(){return this.scaleResolutionDownBy}addPlayView(e){this.playTrait.addPlayView(e)}hasPlayView(){return this.playTrait.hasPlayView()}removePlayView(e){this.playTrait.removePlayView(e)}removeAllPlayViews(){this.playTrait.removeAllPlayViews()}}class Tr extends Cr{captureOptions;constructor(e){super(),this.captureOptions={...e}}strPrefix(){return"本地摄像头视频流轨道"}onEnded(){X.warn(this.toString(),"异常结束,自动尝试默认摄像头"),this.changeDeviceId(wr).catch((e=>{X.error(this.toString(),"异常结束,自动尝试默认摄像头失败",e),super.onEnded()}))}async startCapture(e){e&&E(this.captureOptions,e);let t=this.captureOptions;t.deviceId&&t.deviceId!=wr&&(t={...this.captureOptions},t.deviceId={exact:this.captureOptions.deviceId});let r=await _r.getInstance().getUserMedia({audio:!1,video:t});this.setMediaStreamTrack(r.getTracks()[0])}stopCapture(){let e=this.getMediaStreamTrack();e?e.stop():X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}async changeDeviceId(e){if(this.captureOptions.deviceId===e&&e!=wr)return;return this.captureOptions.deviceId=e,this.getMediaStreamTrack()?(this.stopCapture(),this.startCapture()):void 0}async switchFacingMode(){this.captureOptions.facingMode="environment"==this.captureOptions.facingMode?"user":"environment";let e=this.getMediaStreamTrack();if(e)return e.applyConstraints(this.captureOptions)}}class Ar extends Cr{captureOptions;audioTrack;constructor(e){super(),this.captureOptions={...e}}strPrefix(){return"本地屏幕分享视频流轨道"}setAudioTrack(e){this.audioTrack=e}getAudioTrack(){return this.audioTrack}async startCapture(e){if(e&&E(this.captureOptions,e),void 0===navigator.mediaDevices.getDisplayMedia)throw new D("getDisplayMedia not supported");(await navigator.mediaDevices.getDisplayMedia({audio:!!this.audioTrack&&this.audioTrack.captureOptions,video:this.captureOptions})).getTracks().forEach((e=>{e.kind==M.Audio?this.audioTrack?.setMediaStreamTrack(e):(this.setMediaStreamTrack(e),this.captureOptions.contentHint&&(e.contentHint=this.captureOptions.contentHint))}))}stopCapture(){let e=this.getMediaStreamTrack();e?(e.stop(),this.audioTrack?.stopCapture()):X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}}const xr={speech:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,sampleRate:48e3},publish:{desc:"mic",maxBitrate:24e3,priority:"high"}},music:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,sampleRate:48e3},publish:{desc:"mic",maxBitrate:32e3,priority:"high"}},musicStereo:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:2,sampleRate:48e3},publish:{desc:"mic",maxBitrate:48e3,priority:"high"}},musicHighQuality:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,sampleRate:48e3},publish:{desc:"mic",maxBitrate:64e3,priority:"high"}},musicHighQualityStereo:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:2,sampleRate:48e3},publish:{desc:"mic",maxBitrate:96e3,priority:"high"}}},Ir=[{desc:"camera_small",width:320,height:180,maxBitrate:25e4,maxFramerate:15}],Pr={"1080p":{capture:{width:1920,height:1080,frameRate:15},publish:{desc:"camera_big",maxBitrate:25e5,maxFramerate:15,simulcasts:Ir,degradationPreference:"maintain-resolution"}},"720p":{capture:{width:1280,height:720,frameRate:15},publish:{desc:"camera_big",maxBitrate:12e5,maxFramerate:15,simulcasts:Ir}},"360p":{capture:{width:640,height:360,frameRate:15},publish:{maxBitrate:55e4,maxFramerate:15}},"180p":{capture:{width:320,height:180,frameRate:15},publish:{maxBitrate:25e4,maxFramerate:15}}},Rr={"1080p":{capture:{width:1920,height:1080,frameRate:10},publish:{desc:"screen",maxBitrate:2e6,maxFramerate:10,degradationPreference:"maintain-resolution"}},"720p":{capture:{width:1280,height:720,frameRate:10},publish:{desc:"screen",maxBitrate:15e5,maxFramerate:10,degradationPreference:"maintain-resolution"}}},Mr={default:{capture:!0,publish:{desc:"screen_audio",maxBitrate:24e3,priority:"high"}}};class Or extends jt{}function Br(e,t){if(!t)return 0;let r,n;return"bytesReceived"in e?(r=e.bytesReceived,n=t.bytesReceived):"bytesSent"in e&&(r=e.bytesSent,n=t.bytesSent),void 0===r||void 0===n||void 0===e.timestamp||void 0===t.timestamp?0:T(8*(r-n)/(e.timestamp-t.timestamp),2)}function Nr(e,t){return t?void 0===e.framesDecoded||void 0===t.framesDecoded?0:Math.round(1e3*(e.framesDecoded-t.framesDecoded)/(e.timestamp-t.timestamp)):0}class Lr extends Gt{dftPCConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}]};async publish(e,t,r){if(await super.publish(e,t,r),!e.getMediaStreamTrack())throw new D(e.toString()+"的mediaStreamTrack不存在,无法发布");if(e.kind==M.Audio&&!Xt.checkAudioCodec("OPUS"))throw new D("当前环境不支持OPUS音频编解码,"+e.toString()+"无法发布");if(e.kind==M.Video&&!Xt.checkVideoCodec("H264"))throw new D("当前环境不支持H264视频编解码,"+e.toString()+"无法发布");if(!("addTransceiver"in RTCPeerConnection.prototype)&&!("addTrack"in RTCPeerConnection.prototype))throw new D("当前环境不支持addTransceiver或addTrack,无法发布")}onPubMsTrackReplace=(e,t)=>{if(!this.published[e.id])return;const r=this.published[e.id];r.sender?.replaceTrack(e.getMediaStreamTrack()??null)};updateTrackInfoAfterPublish(e){if(!this.published[e.id])return;const t=this.published[e.id];if(!t.sender)return;let r=t.sender.getParameters().codecs;if(0===r.length)return void X.warn("推流成功后,无法获取编码器信息",e.toString());let n=r[0];X.debug("推流成功后,更新trackinfo codec",e.toString(),"codecInfo",n);let i=n.mimeType;if(e.kind==M.Video){let t=O[i.replace("video/","").toUpperCase()];e.updateInfo({codec:t})}else{let t=O[i.replace("audio/","").toUpperCase()];e.updateInfo({codec:t,sample_rate:n.clockRate,channel_count:n.channels})}}}class Dr extends Lr{async publish(e,t,r){this.published[e.id]?X.warn("推流",e.toString(),"进行中,当前状态",this.published[e.id].pc.connectionState):(await super.publish(e,t,r),await this.doPublish(e,t,r,!1),e.on(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace),e.on(sr.RECONNECTING,this.onPubTrackReconnecting))}async unpublish(e){if(!this.published[e.id])return void X.warn("推流",e.toString(),"已取消,无需取消发布");e.off(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace),e.off(sr.RECONNECTING,this.onPubTrackReconnecting);this.published[e.id].pc.close(),X.warn("推流",e.toString(),"unpublished"),delete this.published[e.id]}async doPublish(e,t,r,n){let i=e.getMediaStreamTrack(),o=new RTCPeerConnection(this.dftPCConfig),s={kind:e.kind,pc:o,track:e,opt:t,exopt:r||{}};this.published[e.id]=s;let a={maxBitrate:t.maxBitrate,priority:t.priority};e.kind==M.Video&&(a.maxFramerate=t.maxFramerate,a.scaleResolutionDownBy=e.getScaleResolutionDownBy());let c=S((()=>this.negotiateSDP(s,"publish")),{maxRetries:10,initialDelay:500,onRetry:(t,r)=>!!this.published[e.id]&&(X.warn("推流",e.toString(),`建连重试第${t}次`,r),!0)}),u=()=>{n?(this.vendor()!=Kt.OOK&&"closed"!=o.signalingState||c.cancel(),X.error("推流",e.toString(),"已断开,将自动尝试重连"),e.emit(sr.RECONNECTING,e,t,r)):(c.cancel(),this.unpublish(e))};return new Promise((async(r,l)=>{let h=setTimeout((()=>{u(),l("发布超时")}),6e4);o.addEventListener("negotiationneeded",(()=>{X.info("推流",e.toString(),"重新协商"),c().catch((t=>{"maxretry"==t&&X.error("推流",e.toString(),"建连多次重试依旧无法连接,已放弃")}))})),o.addEventListener("icecandidate",(t=>{X.debug("推流",e.toString(),"icecandidate",t.candidate)})),o.addEventListener("iceconnectionstatechange",(t=>{X.debug("推流",e.toString(),"ICE connection state change",o.iceConnectionState)})),o.addEventListener("signalingstatechange",(t=>{X.debug("推流",e.toString(),"signaling state change",o.signalingState),"closed"==o.signalingState&&(u(),l("发布失败"))})),o.addEventListener("connectionstatechange",(t=>{switch(X.debug("推流",e.toString(),"connection state",o.connectionState),o.connectionState){case"failed":case"closed":u(),l("发布失败");break;case"connected":X.warn("推流",e.toString(),"connected"),clearTimeout(h),n?e.emit(sr.RECONNECTED,e):n=!0,this.updateTrackInfoAfterPublish(e),r()}}));let f=!1;if("addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK){let e=o.addTransceiver(i,{direction:"sendonly",sendEncodings:[a]});s.sender=e.sender}else{let e=o.addTrack(i);s.sender=e,f=!0}let d=s.sender.getParameters();f&&(d.encodings=[a]),e.kind==M.Video&&t.degradationPreference&&(d.degradationPreference=t.degradationPreference),s.sender.setParameters(d)}))}onPubTrackReconnecting=(e,t,r)=>{if(!this.published[e.id])return;const n=this.published[e.id];"addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK&&"closed"!=n.pc.signalingState?n.pc.restartIce():(n.pc.close(),this.doPublish(e,t,r,!0))};async subscribe(e,t){this.subscribed[e.id]?X.warn("拉流",e.toString(),"进行中,当前状态",this.subscribed[e.id].pc.connectionState):(await super.subscribe(e,t),await this.doSubscribe(e,t,!1),e.on(sr.RECONNECTING,this.onSubTrackReconnecting))}async unsubscribe(e){if(!this.subscribed[e.id])return void X.warn("拉流",e.toString(),"未订阅或已取消,无需取消订阅");e.off(sr.RECONNECTING,this.onSubTrackReconnecting);this.subscribed[e.id].pc.close(),X.warn("拉流",e.toString(),"unsubscribed"),delete this.subscribed[e.id]}async doSubscribe(e,t,r){let n=new RTCPeerConnection(this.dftPCConfig),i={kind:e.kind,pc:n,track:e,exopt:t||{}};this.subscribed[e.id]=i;let o=S((()=>this.negotiateSDP(i,"subscribe")),{maxRetries:10,initialDelay:500,onRetry:(t,r)=>!!this.subscribed[e.id]&&(X.warn("拉流",e.toString(),`建连重试第${t}次`,r),!0)}),s=()=>{o().catch((t=>{"maxretry"==t&&X.error("拉流",e.toString(),"建连多次重试依旧无法连接,已放弃")}))},c=()=>{r?(this.vendor()!=Kt.OOK&&"closed"!=n.signalingState||o.cancel(),X.error("拉流",e.toString(),"已断开,将自动尝试重连"),e.emit(sr.RECONNECTING,e,t)):(o.cancel(),this.unsubscribe(e))};return new Promise((async(t,i)=>{let o=setTimeout((()=>{c(),i("订阅超时")}),6e4);n.addEventListener("negotiationneeded",(()=>{X.info("拉流",e.toString(),"重新协商"),s()})),n.addEventListener("icecandidate",(t=>{X.debug("拉流",e.toString(),"icecandidate",t.candidate)})),n.addEventListener("iceconnectionstatechange",(t=>{X.debug("拉流",e.toString(),"ICE connection state change",n.iceConnectionState)})),n.addEventListener("signalingstatechange",(t=>{X.debug("拉流",e.toString(),"signaling state change",n.signalingState),"closed"==n.signalingState&&(c(),i("订阅失败"))})),n.addEventListener("track",(t=>{e.setMediaStreamTrack(t.track),t.streams[0].onremovetrack=t=>{X.info("拉流",e.toString(),"mstrack removed"),e.emit(a.ENDED,e)},X.info("拉流",e.toString(),"mstrack got")})),n.addEventListener("connectionstatechange",(s=>{switch(X.debug("拉流",e.toString(),"connection state",n.connectionState),n.connectionState){case"failed":case"closed":c(),i("订阅失败");break;case"connected":X.warn("拉流",e.toString(),"connected"),clearTimeout(o),r?e.emit(sr.RECONNECTED,e):r=!0,t()}})),"addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK?n.addTransceiver(e.kind,{direction:"recvonly"}):s()}))}onSubTrackReconnecting=(e,t)=>{if(!this.subscribed[e.id])return!1;const r=this.subscribed[e.id];"addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK&&"closed"!=r.pc.signalingState?r.pc.restartIce():(r.pc.close(),this.doSubscribe(e,t,!0))};async getMetric(){const e={bitrate_down:0,bitrate_up:0,delay:0,lossrate_down:0,lossrate_up:0,up_level:0,pkt_up:0,pkt_down:0,pkt_loss_up:0,pkt_loss_down:0},t=this.prevMetric?.network,r=[],n=[];for(const t in this.published){const i=this.published[t],o=i.track.getInfo(),s=i.track.prevStats,a=await i.pc.getStats();i.kind==M.Audio?(a.forEach((t=>{if("outbound-rtp"===t.type){const r={type:"audio",streamId:t.id,packetsSent:t.packetsSent,bytesSent:t.bytesSent,timestamp:t.timestamp},n=a.get(t.mediaSourceId);n&&(r.audioLevel=n.audioLevel);const c=a.get(t.remoteId);c&&(r.jitter=c.jitter,r.packetsLost=c.packetsLost,r.roundTripTime=c.roundTripTime),o.bitrate=s?Br(r,s):0,o.db=r.audioLevel?P(r.audioLevel):-60,o.stats=r,i.track.prevStats=r,e.bitrate_up+=o.bitrate,e.pkt_up+=r.packetsSent||0,e.pkt_loss_up+=r.packetsLost||0}})),r.push(o)):(a.forEach((t=>{if("outbound-rtp"===t.type){const r={type:"video",streamId:t.id,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,firCount:t.firCount,pliCount:t.pliCount,nackCount:t.nackCount,packetsSent:t.packetsSent,bytesSent:t.bytesSent,qualityLimitationReason:t.qualityLimitationReason,qualityLimitationDurations:t.qualityLimitationDurations,qualityLimitationResolutionChanges:t.qualityLimitationResolutionChanges,rid:t.rid??t.id,retransmittedPacketsSent:t.retransmittedPacketsSent,targetBitrate:t.targetBitrate,timestamp:t.timestamp},n=a.get(t.remoteId);n&&(r.jitter=n.jitter,r.packetsLost=n.packetsLost,r.roundTripTime=n.roundTripTime),o.width=r.frameWidth,o.height=r.frameHeight,o.fps=r.framesPerSecond,o.bitrate=s?Br(r,s):0,o.stats=r,i.track.prevStats=r,e.bitrate_up+=o.bitrate,e.pkt_up+=r.packetsSent||0,e.pkt_loss_up+=r.packetsLost||0}})),n.push(o))}const i=[],o=[];for(const t in this.subscribed){const r=this.subscribed[t],n=r.track.getInfo();n.uid=r.track.getUid();const s=r.track.prevStats,a=await r.pc.getStats();r.kind==M.Audio?(a.forEach((t=>{if("inbound-rtp"===t.type){const i={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,packetsLost:t.packetsLost,packetsReceived:t.packetsReceived,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,audioLevel:t.audioLevel,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration};n.bitrate=s?Br(i,s):0,n.db=i.audioLevel?P(i.audioLevel):-60,n.stats=i,r.track.prevStats=i,e.bitrate_down+=n.bitrate,e.pkt_down+=i.packetsReceived||0,e.pkt_loss_down+=i.packetsLost||0}})),i.push(n)):(a.forEach((t=>{if("inbound-rtp"===t.type){const i={type:"video",streamId:t.id,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesReceived:t.framesReceived,packetsReceived:t.packetsReceived,packetsLost:t.packetsLost,framesPerSecond:t.framesPerSecond,frameWidth:t.frameWidth,frameHeight:t.frameHeight,pliCount:t.pliCount,firCount:t.firCount,nackCount:t.nackCount,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,timestamp:t.timestamp,bytesReceived:t.bytesReceived,decoderImplementation:t.decoderImplementation},o=a.get(t.codecId);o&&(i.mimeType=o.mimeType),n.width=i.frameWidth,n.height=i.frameHeight,n.fps=t.framesPerSecond||(s?Nr(i,s):0),n.bitrate=s?Br(i,s):0,n.stats=i,r.track.prevStats=i,e.bitrate_down+=n.bitrate,e.pkt_down+=i.packetsReceived||0,e.pkt_loss_down+=i.packetsLost||0}})),o.push(n))}const s=e.pkt_loss_up-t?.pkt_loss_up+e.pkt_up-t?.pkt_up,a=e.pkt_loss_down-t?.pkt_loss_down+e.pkt_down-t?.pkt_down;return e.lossrate_up=T(s?100*(e.pkt_loss_up-t?.pkt_loss_up/s):0,2),e.lossrate_down=T(a?(e.pkt_loss_down-t?.pkt_loss_down)/a*100:0,2),this.prevMetric={local_audios:r,local_videos:n,remote_audios:i,remote_videos:o,network:e}}}class Ur extends Dr{ability={audioCodecs:[O.OPUS,O.AAC],videoCodecs:[O.H264,O.H265],audioMaxPub:1,videoMaxPub:7,audioMaxSub:9,videoMaxSub:32};vendor(){return Kt.OOK}async connect(){try{await this.free()}catch(e){}await this.create(),await super.connect()}async disconnect(){await super.disconnect(),await this.free()}async unpublish(e){let t=this.published[e.id];if(await super.unpublish(e),t)try{await this.freshAVState(t.exopt.session),await this.hangup(t.exopt.session)}catch(e){X.error("ook webrtc取消发布接口报错",e)}}async unsubscribe(e){let t=this.subscribed[e.id];if(await super.unsubscribe(e),t)try{await this.hangup(t.exopt.session)}catch(e){X.error("ook webrtc取消订阅接口报错",e)}}async negotiateSDP(e,t){let r=this.genSessionId();if(e.exopt.session)try{await this.hangup(e.exopt.session)}catch(t){r=e.exopt.session,X.error("ook webrtc挂断接口报错",t)}e.exopt.session=r;let n=e.pc,i="";if("publish"==t&&e.kind==M.Audio)i=await this.offerWithRetry((()=>this.offerPushAudio(r)));else if("publish"==t&&e.kind==M.Video)i=await this.offerWithRetry((()=>this.offerPushVideo(r,e.exopt.track)));else if("subscribe"==t&&e.kind==M.Audio)i=e.track instanceof dr?await this.offerWithRetry((()=>this.offerPullAmixer(r,e.exopt.filter_link_ids.join(",")))):await this.offerWithRetry((()=>this.offerPullAudio(r,e.exopt.link_id)));else{if("subscribe"!=t||e.kind!=M.Video)throw new D("未知SDP操作:"+t+":"+e.track.toString());i=e.track instanceof mr?await this.offerWithRetry((()=>this.offerPullMcuVideo(r))):await this.offerWithRetry((()=>this.offerPullVideo(r,e.exopt.link_id,e.exopt.track)))}await n.setRemoteDescription({sdp:i,type:"offer"});let o=await n.createAnswer();await n.setLocalDescription(o),await(()=>new Promise(((e,t)=>{"complete"===n.iceGatheringState?e():n.onicegatheringstatechange=()=>{"complete"==n.iceGatheringState&&e()}}))).bind(this)(),await this.answer(r,n.localDescription?.sdp),"publish"==t&&await this.freshAVState(r)}async freshAVState(e){let t=!1,r=!1,n=0;for(const e in this.published){const i=this.published[e];i.kind==M.Audio?t=!0:i.kind==M.Video&&(r=!0,n|=Math.pow(2,i.exopt.track))}S((()=>this.setMcuTrack(e,n)),{maxRetries:3})(),await this.setAVState(e,t,r)}getAvailableVideoTrackNo(){let e=-1,t=[];for(const e in this.published){const r=this.published[e];r.kind==M.Video&&t.push(r.track.getInfo().track)}for(let r=0;r<this.ability.videoMaxPub;r++)if(-1==t.indexOf(r)){e=r;break}return e}create(){return this.req("create/"+this.joinRsp.link_id,{serv:this.joinRsp.webrtc.upload_host,conf:this.joinRsp.channel_link_id,token:this.joinRsp.session_key,amixer:1})}free(){return this.req("free/"+this.joinRsp.link_id)}async offerWithRetry(e){try{return await e()}catch(t){try{await this.create()}catch(e){}return e()}}async offerPushVideo(e,t){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,track:t+""}),{mode:"recvonly",type:"video"})).sdp}async offerPushAudio(e){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{mode:"recvonly",type:"audio"})).sdp}async offerPullVideo(e,t,r){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:t+"",track:r+""}),{mode:"sendonly",type:"video"})).sdp}async offerPullMcuVideo(e){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:"1",track:"0"}),{mode:"sendonly",type:"video"})).sdp}switchPullVideoTrack(e,t){return this.req("setting/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{type:"track",setting:{track:t}})}async offerPullAudio(e,t){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:t+""}),{mode:"sendonly",type:"audio"})).sdp}async offerPullAmixer(e,t=""){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:"amixer",filter:t}),{mode:"sendonly",type:"audio"})).sdp}answer(e,t){return this.req("answer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{totalBody:t})}setAVState(e,t,r){return this.req("setting/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{totalBody:JSON.stringify({type:"media",setting:{audio:t?1:0,video:r?1:0}})})}setMcuTrack(e,t){return this.req("setting/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{totalBody:JSON.stringify({type:"deftrack",setting:{mmask:t}})})}hangup(e){return this.req("hangup/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}))}req(e,t={},r={}){let n=this.joinRsp.webrtc.cmd_url;"/"!==n.substring(n.length-1)&&(n+="/");let i=t.totalBody;i||(i=Object.keys(t).filter((e=>void 0!==t[e]&&null!==t[e])).map((e=>`${e}=${t[e]}`)).join("\r\n"));let o=Date.now(),s=(r,n)=>{X[r]("ook webrtc gateway api: "+e,t,n,Date.now()-o+"ms")};return new Promise(((t,o)=>{fetch(n+e,{method:"POST",headers:{...r,Accept:"application/json"},body:i}).then((e=>{if(200!=e.status){let t=new Error(e.status+":"+e.statusText);s(J.ERROR,t),o(t)}else e.json().then((e=>{s(0==e.code?J.DEBUG:J.ERROR,e),0==e.code?t(e):o(new D(e.code+":"+e.msg))})).catch((e=>{s(J.ERROR,e),o(e)}))})).catch((e=>{s(J.ERROR,e),o(e)}))}))}genSessionId(){return`${`${this.joinRsp.app_id}`}-${A(6)}`}}var jr=r(7363),Fr=function(e){return e.INIT="init",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.DISCONNECTED="disconnected",e}(Fr||{});class zr extends Lr{publishPc;subscribePc;publishNegotiationPromise=null;isPublishNegotiating=!1;state=Fr.INIT;api;signalDataChannel=null;onDataChannelMessage=null;pendingSubscribeTracks=[];subscribeDebounce;simulcastTracks={};ability={audioCodecs:[O.OPUS],videoCodecs:[O.H264,O.VP8,O.VP9,O.AV1,O.H265],audioMaxPub:-1,videoMaxPub:-1,audioMaxSub:-1,videoMaxSub:-1};constructor(e,t,r){super(t,r),this.api=e,this.publishPc=this.newPublishPc(),this.subscribePc=this.newSubscribePc(),this.subscribeDebounce=tr((async()=>{if(0===this.pendingSubscribeTracks.length)return{ignored:{},failed:{}};try{const e=[...this.pendingSubscribeTracks];this.pendingSubscribeTracks=[],X.debug("执行批量订阅操作",JSON.stringify(e));const t=await this.sfuApiWithRetry("subscribe",(()=>this.api.sfuSubscribe(e)));return t.offer&&await this.handleSfuSubscribeOffer(t.offer),{ignored:t.ignored||{},failed:t.failed||{}}}catch(e){throw X.error("批量订阅操作失败",e),e}}),100,{isImmediate:!1})}newPublishPc(){return this.publishPc=new RTCPeerConnection(this.dftPCConfig),this.publishPc.createDataChannel("dummy",{ordered:!1,maxRetransmits:0}),this.setupPublishPcListeners(),this.publishPc}newSubscribePc(){return this.subscribePc=new RTCPeerConnection(this.dftPCConfig),this.setupSubscribePcListeners(),this.subscribePc}vendor(){return Kt.Seastart}async connect(){const e=await this.publishPc.createOffer();await this.publishPc.setLocalDescription(e);const{publish_answer:t,subscribe_offer:r,prefer_video_codec:n,prefer_audio_codec:i}=await this.sfuApiWithRetry("connect",(()=>this.api.sfuConnect(e)));n&&!this.ability.preferVideoCodec&&(this.ability.preferVideoCodec=O[n.toUpperCase()]),i&&!this.ability.preferAudioCodec&&(this.ability.preferAudioCodec=O[i.toUpperCase()]),await this.publishPc.setRemoteDescription(t),await this.handleSfuSubscribeOffer(r),await this.waitForPCConnected(this.publishPc,5e3),await this.waitForPCConnected(this.subscribePc,5e3),await super.connect(),this.state=Fr.CONNECTED}async sfuApiWithRetry(e,t){try{return await S(t,{maxRetries:3,initialDelay:10,onRetry:(t,r)=>(X.warn(`SFU API ${e} 调用失败第${t}次`,r),!(r instanceof D))})()}catch(t){throw"maxretry"==t?(t=new Error(`SFU API ${e} 调用多次重试依旧失败,已放弃调用`),X.error(`SFU API ${e} 多次重试依旧无法调用,已放弃调用`)):"canceled"==t&&(t=new Error(`SFU API ${e} 调用被取消`),X.error(`SFU API ${e} 调用被取消`)),t}}async reconnectWithRetry(e){if(this.state!=Fr.CONNECTED)return;this.state=Fr.RECONNECTING,X.warn("SFU 开始重连",e),this.stopMonitor(),this.publishPc.close(),this.subscribePc.close();for(const e in this.published){const t=this.published[e];t.track.emit(sr.RECONNECTING,t.track,t.opt,t.exopt)}for(const e in this.subscribed){const t=this.subscribed[e];t.track.emit(sr.RECONNECTING,t.track,t.exopt)}try{await S((async()=>{this.publishPc.close(),this.subscribePc.close(),this.publishPc=this.newPublishPc(),this.subscribePc=this.newSubscribePc(),await this.connect()}),{maxRetries:10,initialDelay:500,onRetry:(e,t)=>(X.warn(`SFU 重连失败第${e}次`,t),!(t instanceof D||this.state!=Fr.RECONNECTING))})()}catch(e){throw"maxretry"==e?X.error("SFU 重连多次重试依旧无法连接,已放弃重连"):"canceled"==e&&X.error("SFU 重连被取消"),e}let t=this.published,r=this.subscribed;this.published={},this.subscribed={};for(const e in t){const r=t[e];try{await this.publish(r.track,r.opt,r.exopt),r.track.emit(sr.RECONNECTED,r.track)}catch(e){X.error(`SFU 重连后,重新发布 ${r.track.toString()} 失败`,e)}}for(const e in r){const t=r[e];try{await this.subscribe(t.track,t.exopt),t.track.emit(sr.RECONNECTED,t.track)}catch(e){X.error(`SFU 重连后,重新订阅 ${t.track.toString()} 失败`,e)}}X.warn("SFU 重连成功"),this.state=Fr.CONNECTED}async disconnect(){await super.disconnect(),this.signalDataChannel&&(this.signalDataChannel.close(),this.signalDataChannel=null),this.publishPc.close(),this.subscribePc.close(),this.onDataChannelMessage=null,this.state=Fr.DISCONNECTED}setupPublishPcListeners(){this.publishPc.addEventListener("icecandidate",(e=>{X.debug("发布PeerConnection","icecandidate",e.candidate)})),this.publishPc.addEventListener("iceconnectionstatechange",(e=>{X.debug("发布PeerConnection","ICE connection state change",this.publishPc?.iceConnectionState)})),this.publishPc.addEventListener("signalingstatechange",(e=>{X.debug("发布PeerConnection","signaling state change",this.publishPc?.signalingState),"closed"==this.publishPc?.signalingState&&this.reconnectWithRetry("发布PeerConnection signaling state: closed")})),this.publishPc.addEventListener("connectionstatechange",(e=>{if(X.info("发布PeerConnection","connection state",this.publishPc?.connectionState),this.publishPc)switch(this.publishPc.connectionState){case"failed":case"closed":this.reconnectWithRetry("发布PeerConnection连接状态: "+this.publishPc.connectionState);break;case"connected":X.info("发布PeerConnection已连接")}}))}setupSubscribePcListeners(){this.subscribePc.addEventListener("icecandidate",(e=>{X.debug("订阅PeerConnection","icecandidate",e.candidate)})),this.subscribePc.addEventListener("iceconnectionstatechange",(e=>{X.debug("订阅PeerConnection","ICE connection state change",this.subscribePc?.iceConnectionState)})),this.subscribePc.addEventListener("signalingstatechange",(e=>{X.debug("订阅PeerConnection","signaling state change",this.subscribePc?.signalingState),"closed"==this.subscribePc?.signalingState&&this.reconnectWithRetry("订阅PeerConnection signaling state: closed")})),this.subscribePc.addEventListener("track",(e=>{X.info("订阅PeerConnection","收到远程轨道",e.track.kind,e.track.id,e.streams[0].id);let t=e.streams[0].id;if(!this.subscribed[t])return void X.warn("收到的远程轨道",e.track.kind,e.track.id,"未订阅或已取消");const r=this.subscribed[t];r.track.setMediaStreamTrack(e.track),X.info("拉流",r.track.toString(),"mstrack got"),e.streams[0].onremovetrack=()=>{X.info("拉流",r.track.toString(),"mstrack removed"),r.track.emit(a.ENDED,r.track)}})),this.subscribePc.addEventListener("connectionstatechange",(e=>{if(X.debug("订阅PeerConnection","connection state",this.subscribePc?.connectionState),this.subscribePc)switch(this.subscribePc.connectionState){case"failed":case"closed":this.reconnectWithRetry("订阅PeerConnection连接状态: "+this.subscribePc.connectionState);break;case"connected":X.info("订阅PeerConnection已连接")}})),this.subscribePc.addEventListener("datachannel",(e=>{X.info("订阅PeerConnection","收到数据通道",e.channel.label),this.signalDataChannel=e.channel,this.setupDataChannelListeners()}))}async publish(e,t,r){if(this.state!=Fr.CONNECTED)throw new D("当前状态: "+this.state+",无法发布");if("connected"!=this.publishPc.connectionState)throw new D("发布PeerConnection未连接,无法发布");if(this.published[e.id])return void X.warn("推流",e.toString(),"进行中,当前状态",this.published[e.id].pc.connectionState);await super.publish(e,t,r);let n={priority:t.priority,maxBitrate:t.maxBitrate},i=[n];if(e.kind==M.Video){let r=e,o=t;if(n.maxFramerate=o.maxFramerate,n.scaleResolutionDownBy=r.getScaleResolutionDownBy(),o.simulcasts&&o.simulcasts.length>0){if(!("addTransceiver"in RTCPeerConnection.prototype))throw new D("不支持simulcast,当前浏览器不支持addTransceiver");n.rid="0",this.simulcastTracks[e.id]={};for(let t=1;t<=o.simulcasts.length;t++){let n=o.simulcasts[t-1],s=r.getSimulcastTrack(n,o.width,o.height);i.push({rid:t.toString(),priority:n.priority,maxBitrate:n.maxBitrate,maxFramerate:n.maxFramerate,scaleResolutionDownBy:s.getScaleResolutionDownBy()}),this.simulcastTracks[e.id][t.toString()]=s}}}let o=this.publishPc,s={kind:e.kind,pc:o,track:e,opt:t,exopt:r||{}};this.published[e.id]=s,X.debug("推流编码参数",e.toString(),"encodings",i);let a=!1;if("addTransceiver"in RTCPeerConnection.prototype){let r=o.addTransceiver(e.getMediaStreamTrack(),{direction:"sendonly",sendEncodings:i,streams:[e.getMediaStream()]});if(s.sender=r.sender,e.kind==M.Video){let e=t.codec||this.ability.preferVideoCodec;if(e){let t=Xt.preferVideoEncCodec(B(e));r.setCodecPreferences(t)}}else{let e=t.codec||this.ability.preferAudioCodec;if(e){let t=Xt.preferAudioEncCodec(B(e));r.setCodecPreferences(t)}}}else{let t=o.addTrack(e.getMediaStreamTrack(),e.getMediaStream());s.sender=t,a=!0}let c=s.sender.getParameters();a&&(c.encodings=i),e.kind==M.Video&&t.degradationPreference&&(c.degradationPreference=t.degradationPreference),s.sender.setParameters(c);try{await this.negotiatePublishPc()}catch(t){throw delete this.published[e.id],delete this.simulcastTracks[e.id],t}this.updateTrackInfoAfterPublish(e),e.on(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace)}updateTrackInfoAfterPublish(e){if(super.updateTrackInfoAfterPublish(e),e.kind==M.Video)for(const t in this.simulcastTracks[e.id]){this.simulcastTracks[e.id][t].updateInfo({id:e.id+"_"+t,codec:e.getInfo().codec})}}async unpublish(e){if(!this.published[e.id])return void X.warn("推流",e.toString(),"已取消,无需取消发布");e.off(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace);const t=this.published[e.id];if(X.warn("推流",e.toString(),"unpublished"),delete this.published[e.id],delete this.simulcastTracks[e.id],this.state==Fr.CONNECTED)try{t.pc.removeTrack(t.sender),t.pc.getTransceivers().forEach((e=>{e.sender==t.sender&&e.stop()})),await this.negotiatePublishPc()}catch(t){X.warn("推流",e.toString(),"取消发布失败",t)}}async subscribe(e,t){if("connected"!=this.subscribePc.connectionState)throw new D("订阅PeerConnection未连接,无法订阅");if(this.subscribed[e.id])return void X.warn("拉流",e.toString(),"进行中,当前状态",this.subscribed[e.id].pc.connectionState);await super.subscribe(e,t);let r={kind:e.kind,pc:this.subscribePc,track:e,exopt:t||{}};this.subscribed[e.id]=r;try{await S((()=>this.debouncedSfuSubscribe(e.getUid(),e.id,!0)),{maxRetries:3,initialDelay:1e3,onRetry:(t,r)=>"not found"==r?(X.warn(`SFU track ${e.toString()}不存在,重试第${t}次`),!0):(X.warn(`SFU track ${e.toString()}订阅失败`,r),!1)})()}catch(t){throw delete this.subscribed[e.id],t}}async unsubscribe(e){if(this.subscribed[e.id]){if(X.warn("拉流",e.toString(),"unsubscribed"),delete this.subscribed[e.id],this.state==Fr.CONNECTED)try{await this.debouncedSfuSubscribe(e.getUid(),e.id,!1)}catch(t){X.warn("拉流",e.toString(),"取消订阅失败",t)}}else X.warn("拉流",e.toString(),"未订阅或已取消,无需取消订阅")}async debouncedSfuSubscribe(e,t,r){const n={pub_uid:e,track_id:t,subscribe:r},i=this.pendingSubscribeTracks.findIndex((r=>r.pub_uid===e&&r.track_id===t));if(-1!==i){this.pendingSubscribeTracks[i].subscribe!==r&&(this.pendingSubscribeTracks.splice(i,1),X.debug("订阅操作",`${e}:${t}`,"订阅和取消订阅操作相互抵消"))}else this.pendingSubscribeTracks.push(n);const o=await this.subscribeDebounce(),s=`${e}:${t}`;if(o.ignored[s]&&X.warn(`轨道 ${s} 订阅被忽略: ${o.ignored[s]}`),o.failed[s])throw o.failed[s]}async negotiatePublishPc(e=!1){if(this.isPublishNegotiating)return this.publishNegotiationPromise?void await this.publishNegotiationPromise:(await k(100),this.negotiatePublishPc(e));this.isPublishNegotiating=!0,this.publishNegotiationPromise=(async()=>{try{if(await new Promise((e=>setTimeout(e,100))),this.publishNegotiationPromise=null,"stable"===this.publishPc.signalingState&&"connected"===this.publishPc.connectionState){const t=await this.publishPc.createOffer({iceRestart:e}),r=jr.qg(t.sdp);let n=!1;r.media.forEach((e=>{!function(e){"number"==typeof e&&e.toFixed(0)}(e.mid);if("inactive"!=e.direction&&("video"==e.type||"audio"==e.type)){const t=e.msid.split(" ")[0],r=e.msid.split(" ")[1];for(const i in this.published){this.published[i].track.getMediaStream().id==t&&r!==i&&(e.msid=`${t} ${i}`,n=!0)}}})),n&&(t.sdp=jr.M9(r)),await this.publishPc.setLocalDescription(t),await this.waitForIceGathering(this.publishPc);const i=await this.sfuApiWithRetry("offerPublish",(()=>this.api.sfuOfferPublish(this.publishPc.localDescription)));await this.publishPc.setRemoteDescription(i.answer),X.info("发布PeerConnection协商成功")}}catch(e){throw X.error("发布PeerConnection协商失败",e),this.reconnectWithRetry(e),e}finally{this.isPublishNegotiating=!1}})(),await this.publishNegotiationPromise}async handleSfuSubscribeOffer(e){X.info("收到订阅PeerConnection Offer");try{await this.subscribePc.setRemoteDescription(e);const t=await this.subscribePc.createAnswer();await this.subscribePc.setLocalDescription(t),await this.waitForIceGathering(this.subscribePc),await this.sfuApiWithRetry("answerSubscribe",(()=>this.api.sfuAnswerSubscribe(this.subscribePc.localDescription))),X.info("订阅PeerConnection Answer已发送")}catch(e){throw X.error("处理订阅PeerConnection Offer失败",e),this.reconnectWithRetry(e),e}}async waitForPCConnected(e,t){if("connected"!==e.connectionState)return new Promise(((r,n)=>{const i=()=>{"connected"===e.connectionState&&(clearTimeout(o),e.removeEventListener("connectionstatechange",i),r())};e.addEventListener("connectionstatechange",i);const o=setTimeout((()=>{e.removeEventListener("connectionstatechange",i),n(new Error("peerconnection连接超时"))}),t)}))}async waitForIceGathering(e){if("complete"!==e.iceGatheringState)return new Promise((t=>{const r=()=>{"complete"===e.iceGatheringState&&(clearTimeout(n),e.removeEventListener("icegatheringstatechange",r),t())};e.addEventListener("icegatheringstatechange",r);const n=setTimeout((()=>{e.removeEventListener("icegatheringstatechange",r),X.warn("ICE收集超时,继续处理"),t()}),5e3)}))}setupDataChannelListeners(){this.signalDataChannel&&(this.signalDataChannel.onopen=()=>{X.info("信令DataChannel已打开")},this.signalDataChannel.onclose=()=>{X.info("信令DataChannel已关闭")},this.signalDataChannel.onerror=e=>{X.error("信令DataChannel错误",e)},this.onDataChannelMessage=e=>{try{const t=JSON.parse(e.data);if(X.debug("收到信令DataChannel消息",t),"active_speaker"===t.type)this.handleActiveSpeakerUpdate(t.speakers);else X.debug("未知的DataChannel消息类型",t.type)}catch(t){X.error("处理信令DataChannel消息失败",t,e.data)}},this.signalDataChannel.onmessage=this.onDataChannelMessage)}handleActiveSpeakerUpdate(e){X.debug("活跃发言者更新",e)}sendSignalMessage(e,t){if(!this.signalDataChannel||"open"!==this.signalDataChannel.readyState)return X.warn("信令DataChannel未打开,无法发送消息"),!1;try{const r=JSON.stringify({type:e,...t,timestamp:Date.now()});return this.signalDataChannel.send(r),!0}catch(e){return X.error("发送信令DataChannel消息失败",e),!1}}getRtcTrackIdByMsTrackIdentifier(e,t){if(t)for(const t in this.published){const r=this.published[t];if(r.track.getMediaStreamTrack()?.id==e)return t}else for(const t in this.subscribed){const r=this.subscribed[t];if(r.track.getMediaStreamTrack()?.id==e)return t}return""}async getMetric(){const e={bitrate_down:0,bitrate_up:0,delay:0,lossrate_down:0,lossrate_up:0,up_level:0,pkt_up:0,pkt_down:0,pkt_loss_up:0,pkt_loss_down:0},t=this.prevMetric?.network,r=[],n=[],i=await this.publishPc.getStats();i.forEach((t=>{if("outbound-rtp"===t.type){if(!t.mediaSourceId)return;const o=i.get(t.mediaSourceId);if(!o)return;const s=this.getRtcTrackIdByMsTrackIdentifier(o.trackIdentifier,!0),a=this.published[s];if(!a)return;const c=t.rid;let u=a.track;c&&"0"!=c&&(u=this.simulcastTracks[u.id][c]);const l=u.getInfo(),h=u.prevStats;if("audio"==t.kind){const n={type:"audio",streamId:t.id,packetsSent:t.packetsSent,bytesSent:t.bytesSent,timestamp:t.timestamp,audioLevel:o.audioLevel},s=i.get(t.remoteId);s&&(n.jitter=s.jitter,n.packetsLost=s.packetsLost,n.roundTripTime=s.roundTripTime),l.bitrate=h?Br(n,h):0,l.db=n.audioLevel?P(n.audioLevel):-60,l.stats=n,u.prevStats=n,e.bitrate_up+=l.bitrate,e.pkt_up+=n.packetsSent||0,e.pkt_loss_up+=n.packetsLost||0,r.push(l)}else if("video"==t.kind){const r={type:"video",streamId:t.id,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,firCount:t.firCount,pliCount:t.pliCount,nackCount:t.nackCount,packetsSent:t.packetsSent,bytesSent:t.bytesSent,qualityLimitationReason:t.qualityLimitationReason,qualityLimitationDurations:t.qualityLimitationDurations,qualityLimitationResolutionChanges:t.qualityLimitationResolutionChanges,rid:t.rid??t.id,retransmittedPacketsSent:t.retransmittedPacketsSent,targetBitrate:t.targetBitrate,timestamp:t.timestamp},o=i.get(t.remoteId);o&&(r.jitter=o.jitter,r.packetsLost=o.packetsLost,r.roundTripTime=o.roundTripTime),l.width=r.frameWidth,l.height=r.frameHeight,l.fps=r.framesPerSecond,l.bitrate=h?Br(r,h):0,l.stats=r,u.prevStats=r,e.bitrate_up+=l.bitrate,e.pkt_up+=r.packetsSent||0,e.pkt_loss_up+=r.packetsLost||0,n.push(l)}}}));const o=[],s=[],a=await this.subscribePc.getStats();a.forEach((t=>{if("inbound-rtp"===t.type){const r=this.getRtcTrackIdByMsTrackIdentifier(t.trackIdentifier,!1),n=this.subscribed[r];if(!n)return;const i=n.track,c=i.getInfo();c.uid=i.getUid();const u=i.prevStats;if("audio"==t.kind){const r={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,packetsLost:t.packetsLost,packetsReceived:t.packetsReceived,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,audioLevel:t.audioLevel,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration};c.bitrate=u?Br(r,u):0,c.db=r.audioLevel?P(r.audioLevel):-60,c.stats=r,i.prevStats=r,e.bitrate_down+=c.bitrate,e.pkt_down+=r.packetsReceived||0,e.pkt_loss_down+=r.packetsLost||0,o.push(c)}else if("video"==t.kind){const r={type:"video",streamId:t.id,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesReceived:t.framesReceived,packetsReceived:t.packetsReceived,packetsLost:t.packetsLost,framesPerSecond:t.framesPerSecond,frameWidth:t.frameWidth,frameHeight:t.frameHeight,pliCount:t.pliCount,firCount:t.firCount,nackCount:t.nackCount,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,timestamp:t.timestamp,bytesReceived:t.bytesReceived,decoderImplementation:t.decoderImplementation};if(t.codecId){const e=a.get(t.codecId);e&&(r.mimeType=e.mimeType)}c.width=r.frameWidth,c.height=r.frameHeight,c.fps=t.framesPerSecond||(u?Nr(r,u):0),c.bitrate=u?Br(r,u):0,c.stats=r,i.prevStats=r,e.bitrate_down+=c.bitrate,e.pkt_down+=r.packetsReceived||0,e.pkt_loss_down+=r.packetsLost||0,s.push(c)}}}));const c=e.pkt_loss_up-t?.pkt_loss_up+e.pkt_up-t?.pkt_up,u=e.pkt_loss_down-t?.pkt_loss_down+e.pkt_down-t?.pkt_down;return e.lossrate_up=T(c?100*(e.pkt_loss_up-t?.pkt_loss_up/c):0,2),e.lossrate_down=T(u?(e.pkt_loss_down-t?.pkt_loss_down)/u*100:0,2),this.prevMetric={local_audios:r,local_videos:n,remote_audios:o,remote_videos:s,network:e}}}class Vr extends Dr{api;ability={audioCodecs:[O.OPUS],videoCodecs:[O.H264],audioMaxPub:-1,videoMaxPub:-1,audioMaxSub:-1,videoMaxSub:-1};vendor(){return Kt.WangsuCDN}constructor(e,t,r){super(t,r),this.api=e}async negotiateSDP(e,t){let r=e.pc,n=await r.createOffer();await r.setLocalDescription(n);let i="";if("publish"==t&&e.kind==M.Audio)i="rtc_a_user_"+this.joinRsp.uid+"_"+e.track.id;else if("publish"==t&&e.kind==M.Video)i="rtc_v_user_"+this.joinRsp.uid+"_"+e.track.id;else if("subscribe"==t&&e.kind==M.Audio)i=e.track instanceof dr?"rtc_a_channel_"+this.joinRsp.channel:"rtc_a_user_"+e.track.getUid()+"_"+e.track.id;else{if("subscribe"!=t||e.kind!=M.Video)throw new D("未知SDP操作:"+t+":"+e.track.toString());i=e.track instanceof mr?"rtc_v_channel_"+this.joinRsp.channel:"rtc_v_user_"+e.track.getUid()+"_"+e.track.id}let o=await this.exchangeSDP("publish"==t,i,n);await r.setRemoteDescription(o)}async exchangeSDP(e,t,r){let n=await this.api.cdnURL({vendor:this.vendor(),stream_name:t,publish:e}),i=Date.now(),o=(r,n)=>{X[r](`wangsu ${e?"publish":"subscribe"} ${t}, sdp exchange cost: ${Date.now()-i}ms`,n)};return new Promise(((e,t)=>{fetch(n,{method:"POST",headers:{Accept:"application/json"},body:JSON.stringify({version:"v1.0",sessionId:"sidtest",localSdp:r})}).then((r=>{if(200!=r.status){let e=new Error(r.status+":"+r.statusText);o(J.ERROR,e),t(e)}else r.json().then((r=>{o(200==r.code?J.DEBUG:J.ERROR,r),200==r.code?e(r.remoteSdp):t(new D(r.code+":"+r.message))})).catch((e=>{o(J.ERROR,e),t(e)}))})).catch((e=>{o(J.ERROR,e),t(e)}))}))}}class qr extends Vt{localTracks;buildInfo(){let{version:e}=r(6351);return{version:e,timestamp:1761384105}}getEnvInfo(){return Yt()}getStoredDeviceId(){let e=localStorage.getItem("device_id");return e||(e=A(18),localStorage.setItem("device_id",e)),e}getDeviceType(){return L.WebRTC}newRtcApi(e){return new er(e.app_id,e.sid,e.client_key,e.client_api)}newRtcSocket(e){return new Or(e)}newChannel(e,t,r,n,i){return new br(e,t,r,n,i,(e=>{this.onNotifyChannelEvent&&this.onNotifyChannelEvent(e)}))}newStreamEngine(e,t,r){switch(t.stream_vendor){case void 0:case Kt.OOK:return new Ur(t);case Kt.WangsuCDN:return new Vr(r,t);case Kt.Seastart:return new zr(r,t,{preferVideoCodec:e.preferVideoCodec,preferAudioCodec:e.preferAudioCodec});default:throw new D("不支持的流媒体引擎")}}constructor(e){super(e),this.localTracks=new Map,_r.getInstance().on("add",(e=>{if(this.onNotifyChannelEvent){let t=new i(or.DEVICE_ADD,e);this.onNotifyChannelEvent(t)}})),_r.getInstance().on("remove",(e=>{if(this.onNotifyChannelEvent){let t=new i(or.DEVICE_REMOVE,e);this.onNotifyChannelEvent(t)}})),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState?this.onAppShow():this.onAppHide()}))}postLeave(){for(let e of this.localTracks.keys())try{e instanceof kr?e.stopPlay():e instanceof Cr&&e.removeAllPlayViews(),(e instanceof Er||e instanceof Tr||e instanceof Ar)&&(e.stopCapture(),X.info("离开频道",e.toString(),"自动停止采集"))}catch(e){}super.postLeave()}async getDevices(e,t=!0){return _r.getInstance().getDevices(e,t)}addTrackListeners(e){e.listeners(a.MUTED).includes(this.muteCallback)||e.on(a.MUTED,this.muteCallback),e.listeners(a.UNMUTED).includes(this.unmuteCallback)||e.on(a.UNMUTED,this.unmuteCallback),e.listeners(a.ENDED).includes(this.endCallback)||e.on(a.ENDED,this.endCallback),e.listeners(sr.AUTOPLAY_FAIL).includes(this.autoPlayFailCallback)||e.on(sr.AUTOPLAY_FAIL,this.autoPlayFailCallback)}muteCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_MUTED,e);this.onNotifyChannelEvent(t)}};unmuteCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_UNMUTED,e);this.onNotifyChannelEvent(t)}};endCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_ENDED,e);this.onNotifyChannelEvent(t)}};autoPlayFailCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_AUTOPLAY_FAIL,e);this.onNotifyChannelEvent(t)}};createLocalMicTrack(e=xr.music){let t=new Er(e.capture);return this.localTracks.set(t,{...e.publish}),this.addTrackListeners(t),t}createLocalCustomAudioTrack(e){if(e.kind!=M.Audio)throw new D("MediaStreamTrack必须是音频轨");let t=new kr;return t.setMediaStreamTrack(e),this.localTracks.set(t,void 0),this.addTrackListeners(t),t}createLocalCameraTrack(e=Pr["720p"]){let t=new Tr(e.capture);return this.localTracks.set(t,{width:e.capture.width,height:e.capture.height,...e.publish}),this.addTrackListeners(t),t}createLocalScreenTrack(e=Rr["1080p"],t=Mr.default){let r=new Ar(e.capture);if(this.localTracks.set(r,{width:e.capture.width,height:e.capture.height,...e.publish}),this.addTrackListeners(r),t){let e=new Sr(t.capture);this.localTracks.set(e,{...t.publish}),this.addTrackListeners(e),r.setAudioTrack(e)}return r}createLocalCustomVideoTrack(e){if(e.kind!=M.Video)throw new D("MediaStreamTrack必须是视频轨");let t=new Cr;return t.setMediaStreamTrack(e),this.localTracks.set(t,void 0),this.addTrackListeners(t),t}enableLocalTrack(e){let t=e.getMediaStreamTrack();if(t&&(t.enabled=!0),e instanceof Ar){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&this.enableLocalTrack(t)}}disableLocalTrack(e){let t=e.getMediaStreamTrack();if(t&&(t.enabled=!1),e instanceof Ar){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&this.disableLocalTrack(t)}}async publishLocalTrack(e,t){if(!this.channel)throw U;let r=this.localTracks.get(e);if(r&&(t&&E(r,t),t=r),!t)throw new D("轨道发布配置不能为空");if(e instanceof Ar){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&await this.publishLocalTrack(t)}if(e.kind==M.Video){let r=t,n=e;if(r.simulcasts&&r.simulcasts.length>0)for(let e=0;e<r.simulcasts.length;e++){let t=r.simulcasts[e],i=n.getSimulcastTrack(t,r.width,r.height);this.localTracks.set(i,void 0),this.addTrackListeners(i),this.channel.getStreamEngineVendor()!=Kt.Seastart&&await this.channel.publishLocalTrack(i,t)}}await this.channel.publishLocalTrack(e,t)}async unpublishLocalTrack(e){if(!this.channel)throw U;if(await this.channel.unpublishLocalTrack(e),e instanceof Ar){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&await this.unpublishLocalTrack(t)}if(this.channel.getStreamEngineVendor()!=Kt.Seastart&&e.kind==M.Video){let t=e.getSimulcastTracks();for(let e in t){let r=t[e];await this.channel.unpublishLocalTrack(r)}}}async subscribeRemoteAudioMixTrack(e){let t=await super.subscribeRemoteAudioMixTrack(e);return this.addTrackListeners(t),t}async subscribeRemoteAudioTrack(e,t){let r=await super.subscribeRemoteAudioTrack(e,t);return this.addTrackListeners(r),r}async subscribeRemoteVideoMcuTrack(){let e=await super.subscribeRemoteVideoMcuTrack();return this.addTrackListeners(e),e}async subscribeRemoteVideoTrack(e,t){let r=await super.subscribeRemoteVideoTrack(e,t);return this.addTrackListeners(r),r}async unsubscribeRemoteTrack(e){await super.unsubscribeRemoteTrack(e)}getRemoteTrack(e,t,r){return super.getRemoteTrack(e,t,r)}}var Wr=n.Yk,Hr=n.Id,Kr=n.Mz,Gr=n.Ne,$r=n.bq,Qr=n.hj,Jr=n.h4,Yr=n.dC,Xr=n.xk,Zr=n.J,en=n.a7,tn=n.s_,rn=n.VO,nn=n.VF,on=n.M0,sn=n.$b,an=n.WI,cn=n.cp,un=n.ez,ln=n.EQ,hn=n.$t,fn=n.jL,dn=n.Ps,pn=n.VV,gn=n._b,mn=n.dT,yn=n.CM,vn=n.Zq;export{Wr as CameraPresets,Hr as ChannelEvent,Kr as ChannelEventType,Gr as Codec,$r as DeviceType,Qr as DisconnectReason,Jr as ImDisconnectReason,Yr as ImEvent,Xr as ImEventType,Zr as LocalAudioTrack,en as LocalCameraTrack,tn as LocalMicTrack,rn as LocalScreenAudioTrack,nn as LocalScreenTrack,on as LocalVideoTrack,sn as LogLevel,an as LogTarget,cn as MicPresets,un as RemoteAudioMixTrack,ln as RemoteAudioTrack,hn as RemoteVideoTrack,fn as SRTC,dn as ScreenAudioPresets,pn as ScreenPresets,gn as TrackKind,mn as __INNER__,yn as codec2str,vn as createMixedAudioMediaStreamTrack};
|
|
1
|
+
var e={5964:(e,t,r)=>{var n=r(3908);const i=r(9273).EventEmitter,o=r(6394),s=r(9790),a=r(3124),c=r(3140),u=r(9996),l=r(1181).Writable,h=r(6371),f=r(5371),d=r(1691),p=r(1223),g=r(7616),m=r(659)("mqttjs:client"),y=n?n.nextTick:function(e){setTimeout(e,0)},v=r.g.setImmediate||function(e){y(e)},b={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},w=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND","ETIMEDOUT"],_={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function k(e,t){let r;t.properties&&(r=t.properties.topicAlias);let n=t.topic.toString();if(0===n.length){if(void 0===r)return new Error("Unregistered Topic Alias");if(n=e.topicAliasSend.getTopicByAlias(r),void 0===n)return new Error("Unregistered Topic Alias");t.topic=n}r&&delete t.properties.topicAlias}function S(e,t,r){m("sendPacket :: packet: %O",t),m("sendPacket :: emitting `packetsend`"),e.emit("packetsend",t),m("sendPacket :: writing to stream");const n=c.writeToStream(t,e.stream,e.options);m("sendPacket :: writeToStream result %s",n),!n&&r&&r!==T?(m("sendPacket :: handle events on `drain` once through callback."),e.stream.once("drain",r)):r&&(m("sendPacket :: invoking cb"),r())}function E(e,t,r,n){m("storeAndSend :: store packet with cmd %s to outgoingStore",t.cmd);let i,o=t;if("publish"===o.cmd&&(o=d(t),i=k(e,o),i))return r&&r(i);e.outgoingStore.put(o,(function(i){if(i)return r&&r(i);n(),S(e,t,r)}))}function T(e){m("nop ::",e)}function C(e,t){let r;const n=this;if(!(this instanceof C))return new C(e,t);for(r in this.options=t||{},b)void 0===this.options[r]?this.options[r]=b[r]:this.options[r]=t[r];m("MqttClient :: options.protocol",t.protocol),m("MqttClient :: options.protocolVersion",t.protocolVersion),m("MqttClient :: options.username",t.username),m("MqttClient :: options.keepalive",t.keepalive),m("MqttClient :: options.reconnectPeriod",t.reconnectPeriod),m("MqttClient :: options.rejectUnauthorized",t.rejectUnauthorized),m("MqttClient :: options.topicAliasMaximum",t.topicAliasMaximum),this.options.clientId="string"==typeof t.clientId?t.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),m("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===t.protocolVersion&&t.customHandleAcks?t.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=e,this.messageIdProvider=void 0===this.options.messageIdProvider?new u:this.options.messageIdProvider,this.outgoingStore=t.outgoingStore||new o,this.incomingStore=t.incomingStore||new o,this.queueQoSZero=void 0===t.queueQoSZero||t.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,t.topicAliasMaximum>0&&(t.topicAliasMaximum>65535?m("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new s(t.topicAliasMaximum)),this.on("connect",(function(){const e=this.queue;m("connect :: sending queued packets"),function t(){const r=e.shift();m("deliver :: entry %o",r);let i=null;if(!r)return void n._resubscribe();i=r.packet,m("deliver :: call _sendPacket for %o",i);let o=!0;i.messageId&&0!==i.messageId&&(n.messageIdProvider.register(i.messageId)||(o=!1)),o?n._sendPacket(i,(function(e){r.cb&&r.cb(e),t()})):(m("messageId: %d has already used. The message is skipped and removed.",i.messageId),t())}()})),this.on("close",(function(){m("close :: connected set to `false`"),this.connected=!1,m("close :: clearing connackTimer"),clearTimeout(this.connackTimer),m("close :: clearing ping timer"),null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),m("close :: calling _setupReconnect"),this._setupReconnect()})),i.call(this),m("MqttClient :: setting up stream"),this._setupStream()}h(C,i),C.prototype._setupStream=function(){const e=this,t=new l,r=c.parser(this.options);let n=null;const i=[];function o(){if(i.length)y(s);else{const e=n;n=null,e()}}function s(){m("work :: getting next packet in queue");const t=i.shift();if(t)m("work :: packet pulled from queue"),e._handlePacket(t,o);else{m("work :: no packets in queue");const e=n;n=null,m("work :: done flag is %s",!!e),e&&e()}}m("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),m("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",(function(e){m("parser :: on packet push to packets array."),i.push(e)})),t._write=function(e,t,i){n=i,m("writable stream :: parsing buffer"),r.parse(e),s()},m("_setupStream :: pipe stream to writable stream"),this.stream.pipe(t),this.stream.on("error",(function(t){m("streamErrorHandler :: error",t.message),w.includes(t.code)?(m("streamErrorHandler :: emitting error"),e.emit("error",t)):T(t)})),this.stream.on("close",(function(){var t;m("(%s)stream :: on close",e.options.clientId),(t=e.outgoing)&&(m("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach((function(e){t[e].volatile&&"function"==typeof t[e].cb&&(t[e].cb(new Error("Connection closed")),delete t[e])}))),m("stream: emit close to MqttClient"),e.emit("close")})),m("_setupStream: sending packet `connect`");const a=Object.create(this.options);if(a.cmd="connect",this.topicAliasRecv&&(a.properties||(a.properties={}),this.topicAliasRecv&&(a.properties.topicAliasMaximum=this.topicAliasRecv.max)),S(this,a),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return e.end((()=>this.emit("error",new Error("Packet has no Authentication Method")))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket){S(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){m("!!connectTimeout hit!! Calling _cleanUp with force `true`"),e._cleanUp(!0)}),this.options.connectTimeout)},C.prototype._handlePacket=function(e,t){const r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<e.length)return this.emit("error",new Error("exceeding packets size "+e.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(m("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"auth":this._handleAuth(e),t();break;case"pingresp":this._handlePingresp(e),t();break;case"disconnect":this._handleDisconnect(e),t()}},C.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e&&e!==T?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},C.prototype.publish=function(e,t,r,n){m("publish :: message `%s` to topic `%s`",t,e);const i=this.options;"function"==typeof r&&(n=r,r=null);if(r=g({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;const o=this,s=function(){let s=0;if((1===r.qos||2===r.qos)&&(s=o._nextId(),null===s))return m("No messageId left"),!1;const a={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:s,dup:r.dup};switch(5===i.protocolVersion&&(a.properties=r.properties),m("publish :: qos",r.qos),r.qos){case 1:case 2:o.outgoing[a.messageId]={volatile:!1,cb:n||T},m("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,void 0,r.cbStorePut);break;default:m("MqttClient:publish: packet cmd: %s",a.cmd),o._sendPacket(a,n,r.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,cbStorePut:r.cbStorePut,callback:n}),this},C.prototype.subscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];const r=[];let n=t.shift();const i=n.resubscribe;let o=t.pop()||T,s=t.pop();const a=this.options.protocolVersion;delete n.resubscribe,"string"==typeof n&&(n=[n]),"function"!=typeof o&&(s=o,o=T);const c=p.validateTopics(n);if(null!==c)return v(o,new Error("Invalid topic "+c)),this;if(this._checkDisconnecting(o))return m("subscribe: discconecting true"),this;const u={qos:0};if(5===a&&(u.nl=!1,u.rap=!1,u.rh=0),s=g(u,s),Array.isArray(n)?n.forEach((function(t){if(m("subscribe: array topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<s.qos||i){const e={topic:t,qos:s.qos};5===a&&(e.nl=s.nl,e.rap=s.rap,e.rh=s.rh,e.properties=s.properties),m("subscribe: pushing topic `%s` and qos `%s` to subs list",e.topic,e.qos),r.push(e)}})):Object.keys(n).forEach((function(t){if(m("subscribe: object topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<n[t].qos||i){const e={topic:t,qos:n[t].qos};5===a&&(e.nl=n[t].nl,e.rap=n[t].rap,e.rh=n[t].rh,e.properties=s.properties),m("subscribe: pushing `%s` to subs list",e),r.push(e)}})),!r.length)return o(null,[]),this;const l=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const n={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:t};if(s.properties&&(n.properties=s.properties),e.options.resubscribe){m("subscribe :: resubscribe true");const t=[];r.forEach((function(r){if(e.options.reconnectPeriod>0){const n={qos:r.qos};5===a&&(n.nl=r.nl||!1,n.rap=r.rap||!1,n.rh=r.rh||0,n.properties=r.properties),e._resubscribeTopics[r.topic]=n,t.push(r.topic)}})),e.messageIdToTopic[n.messageId]=t}return e.outgoing[n.messageId]={volatile:!0,cb:function(e,t){if(!e){const e=t.granted;for(let t=0;t<e.length;t+=1)r[t].qos=e[t]}o(e,r)}},m("subscribe :: call _sendPacket"),e._sendPacket(n),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!l())&&this._storeProcessingQueue.push({invoke:l,callback:o}),this},C.prototype.unsubscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];let r=t.shift(),n=t.pop()||T,i=t.pop();"string"==typeof r&&(r=[r]),"function"!=typeof n&&(i=n,n=T);const o=p.validateTopics(r);if(null!==o)return v(n,new Error("Invalid topic "+o)),this;if(e._checkDisconnecting(n))return this;const s=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const o={cmd:"unsubscribe",qos:1,messageId:t};return"string"==typeof r?o.unsubscriptions=[r]:Array.isArray(r)&&(o.unsubscriptions=r),e.options.resubscribe&&o.unsubscriptions.forEach((function(t){delete e._resubscribeTopics[t]})),"object"==typeof i&&i.properties&&(o.properties=i.properties),e.outgoing[o.messageId]={volatile:!0,cb:n},m("unsubscribe: call _sendPacket"),e._sendPacket(o),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,callback:n}),this},C.prototype.end=function(e,t,r){const n=this;function i(){m("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close((function(e){n.outgoingStore.close((function(t){if(m("end :: closeStores: emitting end"),n.emit("end"),r){const n=e||t;m("end :: closeStores: invoking callback with args"),r(n)}}))})),n._deferredReconnect&&n._deferredReconnect()}function o(){m("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,e),n._cleanUp(e,(()=>{m("end :: finish :: calling process.nextTick on closeStores"),y(i.bind(n))}),t)}return m("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(r=t||T,t=e,e=!1,"object"!=typeof t&&(r=t,t=null,"function"!=typeof r&&(r=T))),"object"!=typeof t&&(r=t,t=null),m("end :: cb? %s",!!r),r=r||T,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(m("end :: (%s) :: calling finish in 10ms once outgoing is empty",n.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,o,10))):(m("end :: (%s) :: immediately calling finish",n.options.clientId),o()),this)},C.prototype.removeOutgoingMessage=function(e){const t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},C.prototype.reconnect=function(e){m("client reconnect");const t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},C.prototype._reconnect=function(){m("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((()=>{this._setupStream()})),m("client already connected. disconnecting first.")):(m("_reconnect: calling _setupStream"),this._setupStream())},C.prototype._setupReconnect=function(){const e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(m("_setupReconnect :: emit `offline` state"),this.emit("offline"),m("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),m("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval((function(){m("reconnectTimer :: reconnect triggered!"),e._reconnect()}),e.options.reconnectPeriod)):m("_setupReconnect :: doing nothing...")},C.prototype._clearReconnect=function(){m("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},C.prototype._cleanUp=function(e,t){const r=arguments[2];if(t&&(m("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),m("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&(n=this.outgoing)&&(m("flush: queue exists? %b",!!n),Object.keys(n).forEach((function(e){"function"==typeof n[e].cb&&(n[e].cb(new Error("Connection closed")),delete n[e])}))),m("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const e=g({cmd:"disconnect"},r);m("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(e,v.bind(null,this.stream.end.bind(this.stream)))}var n;this.disconnecting||(m("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(m("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(m("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},C.prototype._sendPacket=function(e,t,r){m("_sendPacket :: (%s) :: start",this.options.clientId),r=r||T,t=t||T;const n=function(e,t){if(5===e.options.protocolVersion&&"publish"===t.cmd){let r;t.properties&&(r=t.properties.topicAlias);const n=t.topic.toString();if(e.topicAliasSend)if(r){if(0!==n.length&&(m("applyTopicAlias :: register topic: %s - alias: %d",n,r),!e.topicAliasSend.put(n,r)))return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}else 0!==n.length&&(e.options.autoAssignTopicAlias?(r=e.topicAliasSend.getAliasByTopic(n),r?(t.topic="",t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",n,r)):(r=e.topicAliasSend.getLruAlias(),e.topicAliasSend.put(n,r),t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto assign topic: %s - alias: %d",n,r))):e.options.autoUseTopicAlias&&(r=e.topicAliasSend.getAliasByTopic(n),r&&(t.topic="",t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto use topic: %s - alias: %d",n,r))));else if(r)return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}}(this,e);if(n)t(n);else{if(!this.connected)return"auth"===e.cmd?(this._shiftPingInterval(),void S(this,e,t)):(m("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,r));switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void E(this,e,t,r);default:return void S(this,e,t)}switch(e.qos){case 2:case 1:E(this,e,t,r);break;default:S(this,e,t)}m("_sendPacket :: (%s) :: end",this.options.clientId)}},C.prototype._storePacket=function(e,t,r){m("_storePacket :: packet: %o",e),m("_storePacket :: cb? %s",!!t),r=r||T;let n=e;if("publish"===n.cmd){n=d(e);const r=k(this,n);if(r)return t&&t(r)}0===(n.qos||0)&&this.queueQoSZero||"publish"!==n.cmd?this.queue.push({packet:n,cb:t}):n.qos>0?(t=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,(function(e){if(e)return t&&t(e);r()}))):t&&t(new Error("No connection to broker"))},C.prototype._setupPingTimer=function(){m("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=f((function(){e._checkPing()}),1e3*this.options.keepalive))},C.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},C.prototype._checkPing=function(){m("_checkPing :: checking ping..."),this.pingResp?(m("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(m("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},C.prototype._handlePingresp=function(){this.pingResp=!0},C.prototype._handleConnack=function(e){m("_handleConnack");const t=this.options,r=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));e.properties.topicAliasMaximum>0&&(this.topicAliasSend=new a(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(0===r)this.reconnecting=!1,this._onConnect(e);else if(r>0){const e=new Error("Connection refused: "+_[r]);e.code=r,this.emit("error",e)}},C.prototype._handleAuth=function(e){const t=this.options.protocolVersion,r=5===t?e.reasonCode:e.returnCode;if(5!==t){const e=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+t);return e.code=r,void this.emit("error",e)}const n=this;this.handleAuth(e,(function(e,t){if(e)n.emit("error",e);else if(24===r)n.reconnecting=!1,n._sendPacket(t);else{const t=new Error("Connection refused: "+_[r]);e.code=r,n.emit("error",t)}}))},C.prototype.handleAuth=function(e,t){t()},C.prototype._handlePublish=function(e,t){m("_handlePublish: packet %o",e),t=void 0!==t?t:T;let r=e.topic.toString();const n=e.payload,i=e.qos,o=e.messageId,s=this,a=this.options,c=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let t;if(e.properties&&(t=e.properties.topicAlias),void 0!==t)if(0===r.length){if(!(t>0&&t<=65535))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));{const e=this.topicAliasRecv.getTopicByAlias(t);if(!e)return m("_handlePublish :: unregistered topic alias. alias: %d",t),void this.emit("error",new Error("Received unregistered Topic Alias"));r=e,m("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",r,t)}}else{if(!this.topicAliasRecv.put(r,t))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));m("_handlePublish :: registered topic: %s - alias: %d",r,t)}}switch(m("_handlePublish: qos %d",i),i){case 2:a.customHandleAcks(r,n,e,(function(r,n){return r instanceof Error||(n=r,r=null),r?s.emit("error",r):-1===c.indexOf(n)?s.emit("error",new Error("Wrong reason code for pubrec")):void(n?s._sendPacket({cmd:"pubrec",messageId:o,reasonCode:n},t):s.incomingStore.put(e,(function(){s._sendPacket({cmd:"pubrec",messageId:o},t)})))}));break;case 1:a.customHandleAcks(r,n,e,(function(i,a){return i instanceof Error||(a=i,i=null),i?s.emit("error",i):-1===c.indexOf(a)?s.emit("error",new Error("Wrong reason code for puback")):(a||s.emit("message",r,n,e),void s.handleMessage(e,(function(e){if(e)return t&&t(e);s._sendPacket({cmd:"puback",messageId:o,reasonCode:a},t)})))}));break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t);break;default:m("_handlePublish: unknown QoS. Doing nothing.")}},C.prototype.handleMessage=function(e,t){t()},C.prototype._handleAck=function(e){const t=e.messageId,r=e.cmd;let n=null;const i=this.outgoing[t]?this.outgoing[t].cb:null,o=this;let s;if(i){switch(m("_handleAck :: packet type",r),r){case"pubcomp":case"puback":{const r=e.reasonCode;r&&r>0&&16!==r&&(s=new Error("Publish error: "+_[r]),s.code=r,i(s,e)),delete this.outgoing[t],this.outgoingStore.del(e,i),this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue();break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:t};const r=e.reasonCode;r&&r>0&&16!==r?(s=new Error("Publish error: "+_[r]),s.code=r,i(s,e)):this._sendPacket(n);break}case"suback":delete this.outgoing[t],this.messageIdProvider.deallocate(t);for(let r=0;r<e.granted.length;r++)if(128&e.granted[r]){const e=this.messageIdToTopic[t];e&&e.forEach((function(e){delete o._resubscribeTopics[e]}))}this._invokeStoreProcessingQueue(),i(null,e);break;case"unsuback":delete this.outgoing[t],this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue(),i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else m("_handleAck :: Server sent an ack in error. Ignoring.")},C.prototype._handlePubrel=function(e,t){m("handling pubrel packet"),t=void 0!==t?t:T;const r=e.messageId,n=this,i={cmd:"pubcomp",messageId:r};n.incomingStore.get(e,(function(e,r){e?n._sendPacket(i,t):(n.emit("message",r.topic,r.payload,r),n.handleMessage(r,(function(e){if(e)return t(e);n.incomingStore.del(r,T),n._sendPacket(i,t)})))}))},C.prototype._handleDisconnect=function(e){this.emit("disconnect",e)},C.prototype._nextId=function(){return this.messageIdProvider.allocate()},C.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},C.prototype._resubscribe=function(){m("_resubscribe");const e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){m("_resubscribe: protocolVersion 5");for(let t=0;t<e.length;t++){const r={};r[e[t]]=this._resubscribeTopics[e[t]],r.resubscribe=!0,this.subscribe(r,{properties:r[e[t]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},C.prototype._onConnect=function(e){if(this.disconnected)return void this.emit("connect",e);const t=this;this.connackPacket=e,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function r(){let n=t.outgoingStore.createStream();function i(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}}function o(){n.destroy(),n=null,t._flushStoreProcessingQueue(),i()}t.once("close",o),n.on("error",(function(e){i(),t._flushStoreProcessingQueue(),t.removeListener("close",o),t.emit("error",e)})),n.on("end",(function(){let n=!0;for(const e in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[e]){n=!1;break}n?(i(),t.removeListener("close",o),t._invokeAllStoreProcessingQueue(),t.emit("connect",e)):r()})),function e(){if(!n)return;t._storeProcessing=!0;const r=n.read(1);let i;r?t._packetIdsDuringStoreProcessing[r.messageId]?e():t.disconnecting||t.reconnectTimer?n.destroy&&n.destroy():(i=t.outgoing[r.messageId]?t.outgoing[r.messageId].cb:null,t.outgoing[r.messageId]={volatile:!1,cb:function(t,r){i&&i(t,r),e()}},t._packetIdsDuringStoreProcessing[r.messageId]=!0,t.messageIdProvider.register(r.messageId)?t._sendPacket(r):m("messageId: %d has already used.",r.messageId)):n.once("readable",e)}()}()},C.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1},C.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},C.prototype._flushStoreProcessingQueue=function(){for(const e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},e.exports=C},2670:(e,t,r)=>{const{Buffer:n}=r(2577),i=r(1181).Transform,o=r(3521);let s,a,c,u=!1;e.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);const l=function(e,t){const r="alis"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s=t.my,s.connectSocket({url:l,protocols:r}),a=function(){const e=new i;return e._write=function(e,t,r){s.sendSocketMessage({data:e.buffer,success:function(){r()},fail:function(){r(new Error)}})},e._flush=function(e){s.closeSocket({success:function(){e()}})},e}(),c=o.obj(),u||(u=!0,s.onSocketOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),s.onSocketMessage((function(e){if("string"==typeof e.data){const t=n.from(e.data,"base64");a.push(t)}else{const t=new FileReader;t.addEventListener("load",(function(){let e=t.result;e=e instanceof ArrayBuffer?n.from(e):n.from(e,"utf8"),a.push(e)})),t.readAsArrayBuffer(e.data)}})),s.onSocketClose((function(){c.end(),c.destroy()})),s.onSocketError((function(e){c.destroy(e)}))),c}},7594:(e,t,r)=>{var n=r(3908);const i=r(5964),o=r(6394),s=r(4837),a=r(7616),c=r(659)("mqttjs"),u={};function l(e,t){if(c("connecting to an MQTT broker..."),"object"!=typeof e||t||(t=e,e=null),t=t||{},e){const r=s.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=a(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){let t;e.auth&&(t=e.auth.match(/^(.+):(.+)$/),t?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!u[t.protocol]){const e=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(t,r){return(!e||r%2!=0)&&"function"==typeof u[t]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");t.protocol&&(t.defaultProtocol=t.protocol);const r=new i((function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),c("calling streambuilder for",t.protocol),u[t.protocol](e,t)}),t);return r.on("error",(function(){})),r}void 0!==n&&"browser"!==n.title||"function"!=typeof r?(u.mqtt=r(8793),u.tcp=r(8793),u.ssl=r(5351),u.tls=r(5351),u.mqtts=r(5351)):(u.wx=r(3027),u.wxs=r(3027),u.ali=r(2670),u.alis=r(2670)),u.ws=r(5838),u.wss=r(5838),e.exports=l,e.exports.connect=l,e.exports.MqttClient=i,e.exports.Store=o},8793:(e,t,r)=>{const n=r(5653),i=r(659)("mqttjs:tcp");e.exports=function(e,t){t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost";const r=t.port,o=t.hostname;return i("port %d and host %s",r,o),n.createConnection(r,o)}},5351:(e,t,r)=>{const n=r(8535),i=r(5653),o=r(659)("mqttjs:tls");e.exports=function(e,t){t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",0===i.isIP(t.host)&&(t.servername=t.host),t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,o("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);const r=n.connect(t);function s(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return r.on("secureConnect",(function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",s)})),r.on("error",s),r}},5838:(e,t,r)=>{var n=r(3908);const{Buffer:i}=r(2577),o=r(965),s=r(659)("mqttjs:ws"),a=r(3521),c=r(1181).Transform,u=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],l=void 0!==n&&"browser"===n.title||"function"==typeof r;function h(e,t){let r=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function f(e){const t=e;return e.hostname||(t.hostname="localhost"),e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),l||"wss"!==e.protocol||u.forEach((function(r){Object.prototype.hasOwnProperty.call(e,r)&&!Object.prototype.hasOwnProperty.call(e.wsOptions,r)&&(t.wsOptions[r]=e[r])})),t}e.exports=l?function(e,t){let r;s("browserStreamBuilder");const n=function(e){const t=f(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const e=new URL(document.URL);t.hostname=e.hostname,t.port||(t.port=e.port)}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}(t).browserBufferSize||524288,o=t.browserBufferTimeout||1e3,u=!t.objectMode,l=function(e,t){const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",n=h(t,e),i=new WebSocket(n,[r]);return i.binaryType="arraybuffer",i}(e,t),d=function(e,t,r){const n=new c({objectModeMode:e.objectMode});return n._write=t,n._flush=r,n}(t,(function e(t,r,s){l.bufferedAmount>n&&setTimeout(e,o,t,r,s),u&&"string"==typeof t&&(t=i.from(t,"utf8"));try{l.send(t)}catch(e){return s(e)}s()}),(function(e){l.close(),e()}));t.objectMode||(d._writev=b),d.on("close",(()=>{l.close()}));const p=void 0!==l.addEventListener;function g(){r.setReadable(d),r.setWritable(d),r.emit("connect")}function m(){r.end(),r.destroy()}function y(e){r.destroy(e)}function v(e){let t=e.data;t=t instanceof ArrayBuffer?i.from(t):i.from(t,"utf8"),d.push(t)}function b(e,t){const r=new Array(e.length);for(let t=0;t<e.length;t++)"string"==typeof e[t].chunk?r[t]=i.from(e[t],"utf8"):r[t]=e[t].chunk;this._write(i.concat(r),"binary",t)}return l.readyState===l.OPEN?r=d:(r=r=a(void 0,void 0,t),t.objectMode||(r._writev=b),p?l.addEventListener("open",g):l.onopen=g),r.socket=l,p?(l.addEventListener("close",m),l.addEventListener("error",y),l.addEventListener("message",v)):(l.onclose=m,l.onerror=y,l.onmessage=v),r}:function(e,t){s("streamBuilder");const r=f(t),n=h(r,e),i=function(e,t,r){s("createWebSocket"),s("protocol: "+r.protocolId+" "+r.protocolVersion);const n="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return s("creating new Websocket for url: "+t+" and protocol: "+n),new o(t,[n],r.wsOptions)}(0,n,r),a=o.createWebSocketStream(i,r.wsOptions);return a.url=n,i.on("close",(()=>{a.destroy()})),a}},3027:(e,t,r)=>{const{Buffer:n}=r(2577),i=r(1181).Transform,o=r(3521);let s,a,c;e.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);const u=function(e,t){const r="wxs"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s=wx.connectSocket({url:u,protocols:[r]}),a=function(){const e=new i;return e._write=function(e,t,r){s.send({data:0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),success:function(){r()},fail:function(e){r(new Error(e))}})},e._flush=function(e){s.close({success:function(){e()}})},e}(),c=o.obj(),s.onOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),s.onMessage((function(e){let t=e.data;t=t instanceof ArrayBuffer?n.from(t):n.from(t,"utf8"),a.push(t)})),s.onClose((function(){c.end(),c.destroy()})),s.onError((function(e){c.destroy(new Error(e.errMsg))})),c}},9996:e=>{function t(){if(!(this instanceof t))return new t;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}t.prototype.allocate=function(){const e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},t.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},t.prototype.register=function(e){return!0},t.prototype.deallocate=function(e){},t.prototype.clear=function(){},e.exports=t},6394:(e,t,r)=>{const n=r(7616),i=r(1181).Readable,o={objectMode:!0},s={clean:!0};function a(e){if(!(this instanceof a))return new a(e);this.options=e||{},this.options=n(s,e),this._inflights=new Map}a.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},a.prototype.createStream=function(){const e=new i(o),t=[];let r=!1,n=0;return this._inflights.forEach((function(e,r){t.push(e)})),e._read=function(){!r&&n<t.length?this.push(t[n++]):this.push(null)},e.destroy=function(){if(r)return;const e=this;r=!0,setTimeout((function(){e.emit("close")}),0)},e},a.prototype.del=function(e,t){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),t(null,e)):t&&t(new Error("missing packet")),this},a.prototype.get=function(e,t){return(e=this._inflights.get(e.messageId))?t(null,e):t&&t(new Error("missing packet")),this},a.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},e.exports=a},9790:e=>{function t(e){if(!(this instanceof t))return new t(e);this.aliasToTopic={},this.max=e}t.prototype.put=function(e,t){return!(0===t||t>this.max)&&(this.aliasToTopic[t]=e,this.length=Object.keys(this.aliasToTopic).length,!0)},t.prototype.getTopicByAlias=function(e){return this.aliasToTopic[e]},t.prototype.clear=function(){this.aliasToTopic={}},e.exports=t},3124:(e,t,r)=>{const n=r(8103),i=r(1846).t;function o(e){if(!(this instanceof o))return new o(e);e>0&&(this.aliasToTopic=new n({max:e}),this.topicToAlias={},this.numberAllocator=new i(1,e),this.max=e,this.length=0)}o.prototype.put=function(e,t){if(0===t||t>this.max)return!1;const r=this.aliasToTopic.get(t);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(t,e),this.topicToAlias[e]=t,this.numberAllocator.use(t),this.length=this.aliasToTopic.length,!0},o.prototype.getTopicByAlias=function(e){return this.aliasToTopic.get(e)},o.prototype.getAliasByTopic=function(e){const t=this.topicToAlias[e];return void 0!==t&&this.aliasToTopic.get(t),t},o.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},o.prototype.getLruAlias=function(){const e=this.numberAllocator.firstVacant();return e||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},e.exports=o},1223:e=>{function t(e){const t=e.split("/");for(let e=0;e<t.length;e++)if("+"!==t[e]){if("#"===t[e])return e===t.length-1;if(-1!==t[e].indexOf("+")||-1!==t[e].indexOf("#"))return!1}return!0}e.exports={validateTopics:function(e){if(0===e.length)return"empty_topic_list";for(let r=0;r<e.length;r++)if(!t(e[r]))return e[r];return null}}},8752:(e,t)=>{t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],c=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),l=0,h=c>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(c(e,a,a+s>u?u:a+s));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(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 c(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},1951:(e,t,r)=>{const{Buffer:n}=r(9183),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},o.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},o.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,l=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(c<=this._bufs[s[0]].length-l)return o?this._bufs[s[0]].copy(e,t,l,l+c):this._bufs[s[0]].slice(l,l+c);o||(e=n.allocUnsafe(a));for(let t=s[0];t<this._bufs.length;t++){const r=this._bufs[t].length-l;if(!(c>r)){this._bufs[t].copy(e,u,l,l+c),u+=r;break}this._bufs[t].copy(e,u,l),u+=r,c-=r,l&&(l=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},o.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},o.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},o.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o<this._bufs.length;o++){const t=this._bufs[o];for(;s<t.length;){if(t.length-s>=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)!function(t){o.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(r=0){return this.slice(r,r+e[t])[t](0)}}(t)}(),o.prototype._isBufferList=function(e){return e instanceof o||o.isBufferList(e)},o.isBufferList=function(e){return null!=e&&e[i]},e.exports=o},6431:(e,t,r)=>{const n=r(1181).Duplex,i=r(6371),o=r(1951);function s(e){if(!(this instanceof s))return new s(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)})),e=null}o._init.call(this,e),n.call(this)}i(s,n),Object.assign(s.prototype,o.prototype),s.prototype._new=function(e){return new s(e)},s.prototype._write=function(e,t,r){this._appendBuffer(e),"function"==typeof r&&r()},s.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},s.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},s.prototype._isBufferList=function(e){return e instanceof s||e instanceof o||s.isBufferList(e)},s.isBufferList=o.isBufferList,e.exports=s,e.exports.BufferListStream=s,e.exports.BufferList=o},9183:(e,t,r)=>{var n=r(8752),i=r(6701),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(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 h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|g(e,t),n=a(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(z(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(z(e,ArrayBuffer)||e&&z(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(z(e,SharedArrayBuffer)||e&&z(e.buffer,SharedArrayBuffer)))return d(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 c.from(n,t,r);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||V(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.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 l(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 h(e){return l(e),a(e<0?0:0|p(e))}function f(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(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;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(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 U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(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 R(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(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),V(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=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:b(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):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var o,s=1,a=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;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var h=!0,f=0;f<c;f++)if(u(e,o+f)!==u(t,f)){h=!1;break}if(h)return o}return-1}function w(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(V(a))return s;e[r+s]=a}return s}function _(e,t,r,n){return F(U(t,e.length-r),e,r,n)}function k(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return F(j(t),e,r,n)}function E(e,t,r,n){return F(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function C(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=A));return r}(n)}t.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.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,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=c.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(z(o,Uint8Array))i+o.length>n.length?c.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},c.byteLength=g,c.prototype._isBuffer=!0,c.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)y(this,t,t+1);return this},c.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)y(this,t,t+3),y(this,t+1,t+2);return this},c.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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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 o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r),h=0;h<a;++h)if(u[h]!==l[h]){o=u[h],s=l[h];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},c.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 o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return k(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function x(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 I(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 R(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=q[e[o]];return i}function P(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function M(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 O(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,o){return t=+t,r>>>=0,o||B(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,o){return t=+t,r>>>=0,o||B(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.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 Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(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},c.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.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;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},c.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&&!c.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:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=c.isBuffer(e)?e:c.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var D=/[^+/0-9A-Za-z-_]/g;function U(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function j(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(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 z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function V(e){return e!=e}var q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},2577:(e,t,r)=>{var n=r(8752),i=r(6701);t.Buffer=a,t.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},t.INSPECT_MAX_BYTES=50;var o=2147483647;function s(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(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 l(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(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|d(e,t),n=s(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return h(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(z(e,ArrayBuffer)||e&&z(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__=a.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 a.from(n,t,r);var i=function(e){if(a.isBuffer(e)){var t=0|f(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||V(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.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 l(e){return u(e),s(e<0?0:0|f(e))}function h(e){for(var t=e.length<0?0:0|f(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function d(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(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 U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function p(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 I(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(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),V(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=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(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):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,s=1,a=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;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var h=!0,f=0;f<c;f++)if(u(e,o+f)!==u(t,f)){h=!1;break}if(h)return o}return-1}function v(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(V(a))return s;e[r+s]=a}return s}function b(e,t,r,n){return F(U(t,e.length-r),e,r,n)}function w(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r,n){return w(e,t,r,n)}function k(e,t,r,n){return F(j(t),e,r,n)}function S(e,t,r,n){return F(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=C));return r}(n)}t.kMaxLength=o,a.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}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(e,t,r){return c(e,t,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},a.allocUnsafe=function(e){return l(e)},a.allocUnsafeSlow=function(e){return l(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),z(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.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,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(z(o,Uint8Array)&&(o=a.from(o)),!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.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)g(this,t,t+1);return this},a.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)g(this,t,t+3),g(this,t+1,t+2);return this},a.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)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):p.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a.prototype.compare=function(e,t,r,n,i){if(z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.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 o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r),h=0;h<c;++h)if(u[h]!==l[h]){o=u[h],s=l[h];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},a.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 o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return _(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(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function A(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 x(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 I(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=D(e[o]);return i}function R(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(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 M(e,t,r,n,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)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,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function N(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}a.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__=a.prototype,n},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},a.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.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 o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.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&&!a.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 o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),c=s.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%c]}return this};var L=/[^+/0-9A-Za-z-_]/g;function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function j(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 F(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 z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function V(e){return e!=e}},659:(e,t,r)=>{var n=r(3908);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 n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==n&&"env"in n&&(e=n.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;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+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.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`."))}})(),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=r(8798)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},8798:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(r||i);n.diff=o,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(7103),t.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(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}},3521:(e,t,r)=>{var n=r(2577).Buffer,i=r(3908),o=r(1181),s=r(8717),a=r(6371),c=r(3462),u=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),l=function(e,t){e._corked?e.once("uncork",t):t()},h=function(e,t){return function(r){r?function(e,t){e._autoDestroy&&e.destroy(t)}(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},f=function(){},d=function(e,t,r){if(!(this instanceof d))return new d(e,t,r);o.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};a(d,o.Duplex),d.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new d(e,t,r)},d.prototype.cork=function(){1==++this._corked&&this.emit("cork")},d.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},d.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,r=s(e,{writable:!0,readable:!1},h(this,this._forwardEnd)),n=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&i.nextTick(n),this._writable=e,this._writable.on("drain",n),this._unwrite=function(){t._writable.removeListener("drain",n),r()},this.uncork()}else this.end()},d.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t,r=this,n=s(e,{writable:!1,readable:!0},h(this)),i=function(){r._forward()},a=function(){r.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:(t=e,new o.Readable({objectMode:!0,highWaterMark:16}).wrap(t)),this._readable2.on("readable",i),this._readable2.on("end",a),this._unread=function(){r._readable2.removeListener("readable",i),r._readable2.removeListener("end",a),n()},this._forward()}},d.prototype._read=function(){this._drained=!0,this._forward()},d.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=c(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},d.prototype.destroy=function(e,t){if(t||(t=f),this.destroyed)return t(null);this.destroyed=!0;var r=this;i.nextTick((function(){r._destroy(e),t(null)}))},d.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},d.prototype._write=function(e,t,r){if(!this.destroyed)return this._corked?l(this,this._write.bind(this,e,t,r)):e===u?this._finish(r):this._writable?void(!1===this._writable.write(e)?this._ondrain=r:this.destroyed||r()):r()},d.prototype._finish=function(e){var t=this;this.emit("preend"),l(this,(function(){var r,n;r=t._forwardEnd&&t._writable,n=function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),l(t,e)},r?r._writableState&&r._writableState.finished?n():r._writableState?r.end(n):(r.end(),n()):n()}))},d.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(u),o.Writable.prototype.end.call(this,r))},e.exports=d},8717:(e,t,r)=>{var n=r(3908),i=r(8377),o=function(){},s=function(e,t,r){if("function"==typeof t)return s(e,null,t);t||(t={}),r=i(r||o);var a=e._writableState,c=e._readableState,u=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,h=!1,f=function(){e.writable||d()},d=function(){l=!1,u||r.call(e)},p=function(){u=!1,l||r.call(e)},g=function(t){r.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){r.call(e,t)},y=function(){n.nextTick(v)},v=function(){if(!h)return(!u||c&&c.ended&&!c.destroyed)&&(!l||a&&a.ended&&!a.destroyed)?void 0:r.call(e,new Error("premature close"))},b=function(){e.req.on("finish",d)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?l&&!a&&(e.on("end",f),e.on("close",f)):(e.on("complete",d),e.on("abort",y),e.req?b():e.on("request",b)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",g),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",m),e.on("close",y),function(){h=!0,e.removeListener("complete",d),e.removeListener("abort",y),e.removeListener("request",b),e.req&&e.req.removeListener("finish",d),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",d),e.removeListener("exit",g),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",y)}};e.exports=s},9273:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){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 h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function f(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):p(i,i.length)}function d(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 p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(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(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.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},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(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},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(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,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;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,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.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,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[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},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},6701:(e,t)=>{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*g}},6371:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},310:(e,t,r)=>{r.d(t,{NZ:()=>k});var n=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function a(e){var t=this;void 0===e&&(e=[]);var r=0,a=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,a.length=0},this.front=function(){if(!this.empty())return a[0]},this.back=function(){if(!this.empty())return a[r-1]},this.forEach=function(e){a.forEach(e)},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");return a[e]},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");for(var t=e;t<r-1;++t)a[t]=a[t+1];this.popBack()},this.eraseElementByValue=function(e){var t=[];this.forEach((function(r){r!==e&&t.push(r)})),t.forEach((function(e,t){a[t]=e}));for(var n=t.length;r>n;)this.popBack()},this.pushBack=function(e){a.push(e),++r},this.popBack=function(){a.pop(),r>0&&--r},this.setElementByPos=function(e,t){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");a[e]=t},this.insert=function(e,t,n){if(void 0===n&&(n=1),e<0||e>r)throw new Error("pos must more than 0 and less than or equal to vector's size");a.splice.apply(a,o([e,0],i(new Array(n).fill(t)),!1)),r+=n},this.find=function(e){return a.includes(e)},this.reverse=function(){a.reverse()},this.unique=function(){var e,t=[];this.forEach((function(r,n){0!==n&&r===e||(t.push(r),e=r)})),t.forEach((function(e,t){a[t]=e}));for(var n=t.length;r>n;)this.popBack()},this.sort=function(e){a.sort(e)},this[Symbol.iterator]=function(){return function(){return n(this,(function(e){switch(e.label){case 0:return[5,s(a)];case 1:return[2,e.sent()]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.freeze(a);function c(e){var t=this;void 0===e&&(e=[]);var r=0,n=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,n.length=0},this.push=function(e){n.push(e),++r},this.pop=function(){n.pop(),r>0&&--r},this.top=function(){return n[r-1]},e.forEach((function(e){return t.push(e)})),Object.freeze(this)}Object.freeze(c);var u=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},l=function(e){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=e};function h(e){var t=this;void 0===e&&(e=[]);var r=0,n=void 0,i=void 0;this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){n=i=void 0,r=0},this.front=function(){return null==n?void 0:n.value},this.back=function(){return null==i?void 0:i.value},this.forEach=function(e){for(var t=n,r=0;t;){if(void 0===t.value)throw new Error("unknown error");e(t.value,r++),t=t.next}},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var t=n;e--&&t;)t=t.next;if(!t||void 0===t.value)throw new Error("unknown error");return t.value},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("erase pos must more then 0 and less then the list length");if(0===e)this.popFront();else if(e===r-1)this.popBack();else{for(var t=n;e--;){if(!(null==t?void 0:t.next))throw new Error("unknown error");t=t.next}if(!t||!t.pre||!t.next)throw new Error("unknown error");var i=t.pre,o=t.next;o.pre=i,i.next=o,r>0&&--r}},this.eraseElementByValue=function(e){for(;n&&n.value===e;)this.popFront();for(;i&&i.value===e;)this.popBack();if(n)for(var t=n;t;){if(t.value===e){var o=t.pre,s=t.next;s&&(s.pre=o),o&&(o.next=s),r>0&&--r}t=t.next}},this.pushBack=function(e){if(null==e)throw new Error("you can't push null or undefined here");++r;var t=new l(e);i?(i.next=t,t.pre=i,i=t):n=i=t},this.popBack=function(){i&&(r>0&&--r,i&&(n===i?n=i=void 0:(i=i.pre)&&(i.next=void 0)))},this.setElementByPos=function(e,t){if(null==t)throw new Error("you can't set null or undefined here");if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var i=n;e--;){if(!i)throw new Error("unknown error");i=i.next}i&&(i.value=t)},this.insert=function(e,t,i){if(void 0===i&&(i=1),null==t)throw new Error("you can't insert null or undefined here");if(e<0||e>r)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(i<0)throw new Error("insert size must more than 0");if(0===e)for(;i--;)this.pushFront(t);else if(e===r)for(;i--;)this.pushBack(t);else{for(var o=n,s=1;s<e;++s){if(!(null==o?void 0:o.next))throw new Error("unknown error");o=null==o?void 0:o.next}if(!o)throw new Error("unknown error");var a=o.next;for(r+=i;i--;)o.next=new l(t),o.next.pre=o,o=o.next;o.next=a,a&&(a.pre=o)}},this.find=function(e){for(var t=n;t;){if(t.value===e)return!0;t=t.next}return!1},this.reverse=function(){for(var e=n,t=i,o=0;e&&t&&2*o<r;){var s=e.value;e.value=t.value,t.value=s,e=e.next,t=t.pre,++o}},this.unique=function(){for(var e=n;e;){for(var t=e;t&&t.next&&t.value===t.next.value;)t=t.next,r>0&&--r;e.next=t.next,e.next&&(e.next.pre=e),e=e.next}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);var r=n;t.forEach((function(e){r&&(r.value=e,r=r.next)}))},this.pushFront=function(e){if(null==e)throw new Error("you can't push null or undefined here");++r;var t=new l(e);n?(t.next=n,n.pre=t,n=t):n=i=t},this.popFront=function(){n&&(r>0&&--r,n&&(n===i?n=i=void 0:(n=n.next)&&(n.pre=void 0)))},this.merge=function(e){var t=this,o=n;e.forEach((function(e){for(;o&&void 0!==o.value&&o.value<=e;)o=o.next;if(void 0===o)t.pushBack(e),o=i;else if(o===n)t.pushFront(e),o=n;else{++r;var s=o.pre;s&&(s.next=new l(e),s.next.pre=s,s.next.next=o,o&&(o.pre=s.next))}}))},this[Symbol.iterator]=function(){return function(){var e;return u(this,(function(t){switch(t.label){case 0:e=n,t.label=1;case 1:if(void 0===e)return[3,3];if(!e.value)throw new Error("unknown error");return[4,e.value];case 2:return t.sent(),e=e.next,[3,1];case 3:return[2]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.freeze(h);const f=h;function d(e){void 0===e&&(e=[]);var t=new f(e);this.size=function(){return t.size()},this.empty=function(){return t.empty()},this.clear=function(){t.clear()},this.push=function(e){t.pushBack(e)},this.pop=function(){t.popFront()},this.front=function(){return t.front()},Object.freeze(this)}Object.freeze(d);var p=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function g(e){var t=this;void 0===e&&(e=[]);var r=[],n=0,i=0,o=0,s=0,a=0,c=0;this.size=function(){return c},this.empty=function(){return 0===c},this.clear=function(){n=o=i=s=a=c=0,l.call(this,g.bucketSize),c=0},this.front=function(){return r[n][i]},this.back=function(){return r[o][s]},this.forEach=function(e){if(!this.empty()){var t=0;if(n!==o){for(c=i;c<g.bucketSize;++c)e(r[n][c],t++);for(c=n+1;c<o;++c)for(var a=0;a<g.bucketSize;++a)e(r[c][a],t++);for(c=0;c<=s;++c)e(r[o][c],t++)}else for(var c=i;c<=s;++c)e(r[n][c],t++)}};var u=function(e){var t=n*g.bucketSize+i,r=t+e,a=o*g.bucketSize+s;if(r<t||r>a)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(r/g.bucketSize),curNodePointerIndex:r%g.bucketSize}};this.getElementByPos=function(e){var t=u(e),n=t.curNodeBucketIndex,i=t.curNodePointerIndex;return r[n][i]},this.eraseElementByPos=function(e){var t=this;if(e<0||e>c)throw new Error("pos should more than 0 and less than queue's size");if(0===e)this.popFront();else if(e===this.size())this.popBack();else{for(var r=[],n=e+1;n<c;++n)r.push(this.getElementByPos(n));this.cut(e),this.popBack(),r.forEach((function(e){return t.pushBack(e)}))}},this.eraseElementByValue=function(e){if(!this.empty()){var t=[];this.forEach((function(r){r!==e&&t.push(r)}));for(var r=t.length,n=0;n<r;++n)this.setElementByPos(n,t[n]);this.cut(r-1)}};var l=function(e){for(var t=[],u=e*g.sigma,l=Math.max(Math.ceil(u/g.bucketSize),2),h=0;h<l;++h)t.push(new Array(g.bucketSize));var f=Math.ceil(e/g.bucketSize),d=Math.floor(l/2)-Math.floor(f/2),p=d,m=0;if(this.size())for(h=0;h<f;++h){for(var y=0;y<g.bucketSize;++y)if(t[d+h][y]=this.front(),this.popFront(),this.empty()){p=d+h,m=y;break}if(this.empty())break}r=t,n=d,i=0,o=p,s=m,a=l,c=e};this.pushBack=function(e){this.empty()||(o===a-1&&s===g.bucketSize-1&&l.call(this,this.size()),s<g.bucketSize-1?++s:o<a-1&&(++o,s=0)),++c,r[o][s]=e},this.popBack=function(){this.empty()||(1!==this.size()&&(s>0?--s:n<o&&(--o,s=g.bucketSize-1)),c>0&&--c)},this.setElementByPos=function(e,t){var n=u(e),i=n.curNodeBucketIndex,o=n.curNodePointerIndex;r[i][o]=t},this.insert=function(e,t,r){var n=this;if(void 0===r&&(r=1),0===e)for(;r--;)this.pushFront(t);else if(e===this.size())for(;r--;)this.pushBack(t);else{for(var i=[],o=e;o<c;++o)i.push(this.getElementByPos(o));this.cut(e-1);for(o=0;o<r;++o)this.pushBack(t);i.forEach((function(e){return n.pushBack(e)}))}},this.find=function(e){if(n===o){for(var t=i;t<=s;++t)if(r[n][t]===e)return!0;return!1}for(t=i;t<g.bucketSize;++t)if(r[n][t]===e)return!0;for(t=n+1;t<o;++t)for(var a=0;a<g.bucketSize;++a)if(r[t][a]===e)return!0;for(t=0;t<=s;++t)if(r[o][t]===e)return!0;return!1},this.reverse=function(){for(var e=0,t=c-1;e<t;){var r=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,r),++e,--t}},this.unique=function(){if(!this.empty()){var e=[],t=this.front();this.forEach((function(r,n){0!==n&&r===t||(e.push(r),t=r)}));for(var r=0;r<c;++r)this.setElementByPos(r,e[r]);this.cut(e.length-1)}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);for(var r=0;r<c;++r)this.setElementByPos(r,t[r])},this.pushFront=function(e){this.empty()||(0===n&&0===i&&l.call(this,this.size()),i>0?--i:n>0&&(--n,i=g.bucketSize-1)),++c,r[n][i]=e},this.popFront=function(){this.empty()||(1!==this.size()&&(i<g.bucketSize-1?++i:n<o&&(++n,i=0)),c>0&&--c)},this.shrinkToFit=function(){var e=this,t=[];this.forEach((function(e){t.push(e)}));var n=t.length;r=[];for(var i=Math.ceil(n/g.bucketSize),o=0;o<i;++o)r.push(new Array(g.bucketSize));this.clear(),t.forEach((function(t){return e.pushBack(t)}))},this.cut=function(e){if(e<0)this.clear();else{var t=u(e),r=t.curNodeBucketIndex,n=t.curNodePointerIndex;o=r,s=n,c=e+1}},this[Symbol.iterator]=function(){return function(){var e,t;return p(this,(function(a){switch(a.label){case 0:if(0===c)return[2];if(n!==o)return[3,5];t=i,a.label=1;case 1:return t<=s?[4,r[n][t]]:[3,4];case 2:a.sent(),a.label=3;case 3:return++t,[3,1];case 4:return[2];case 5:t=i,a.label=6;case 6:return t<g.bucketSize?[4,r[n][t]]:[3,9];case 7:a.sent(),a.label=8;case 8:return++t,[3,6];case 9:t=n+1,a.label=10;case 10:if(!(t<o))return[3,15];e=0,a.label=11;case 11:return e<g.bucketSize?[4,r[t][e]]:[3,14];case 12:a.sent(),a.label=13;case 13:return++e,[3,11];case 14:return++t,[3,10];case 15:t=0,a.label=16;case 16:return t<=s?[4,r[o][t]]:[3,19];case 17:a.sent(),a.label=18;case 18:return++t,[3,16];case 19:return[2]}}))}()},function(){var i=g.bucketSize;e.size?i=e.size():e.length&&(i=e.length);var s=i*g.sigma;a=Math.ceil(s/g.bucketSize),a=Math.max(a,3);for(var c=0;c<a;++c)r.push(new Array(g.bucketSize));var u=Math.ceil(i/g.bucketSize);n=Math.floor(a/2)-Math.floor(u/2),o=n,e.forEach((function(e){return t.pushBack(e)}))}(),Object.freeze(this)}g.sigma=3,g.bucketSize=5e3,Object.freeze(g);function m(e,t){void 0===e&&(e=[]),t=t||function(e,t){return e>t?-1:e<t?1:0};var r=[];e.forEach((function(e){return r.push(e)}));var n=r.length,i=function(e,t){if(e<0||e>=n)throw new Error("unknown error");if(t<0||t>=n)throw new Error("unknown error");var i=r[e];r[e]=r[t],r[t]=i},o=function(e){if(e<0||e>=n)throw new Error("unknown error");var o=2*e+1,s=2*e+2;o<n&&t(r[e],r[o])>0&&i(e,o),s<n&&t(r[e],r[s])>0&&i(e,s)};!function(){for(var e=Math.floor((n-1)/2);e>=0;--e)for(var o=e,s=2*o+1;s<n;){var a=s+1,c=s;if(a<n&&t(r[s],r[a])>0&&(c=a),t(r[o],r[c])<=0)break;i(o,c),s=2*(o=c)+1}}(),this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,r.length=0},this.push=function(e){if(r.push(e),1!==++n)for(var i=n-1;i>0;){var s=Math.floor((i-1)/2);if(t(r[s],e)<=0)break;o(s),i=s}},this.pop=function(){if(!this.empty())if(1!==this.size()){var e=r[n-1];--n;for(var i=0;i<this.size();){var o=2*i+1,s=2*i+2;if(o>=this.size())break;var a=o;if(s<this.size()&&t(r[o],r[s])>0&&(a=s),t(r[a],e)>=0)break;r[i]=r[a],i=a}r[i]=e}else--n},this.top=function(){return r[0]},Object.freeze(this)}Object.freeze(m);var y=function(){function e(e,t){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=e,this.value=t}return e.prototype.rotateLeft=function(){var e=this.parent,t=this.brother,r=this.leftChild,n=this.rightChild;if(!n)throw new Error("unknown error");var i=n.leftChild,o=n.rightChild;return e&&(e.leftChild===this?e.leftChild=n:e.rightChild===this&&(e.rightChild=n)),n.parent=e,n.brother=t,n.leftChild=this,n.rightChild=o,t&&(t.brother=n),this.parent=n,this.brother=o,this.leftChild=r,this.rightChild=i,o&&(o.parent=n,o.brother=this),r&&(r.parent=this,r.brother=i),i&&(i.parent=this,i.brother=r),n},e.prototype.rotateRight=function(){var e=this.parent,t=this.brother,r=this.leftChild;if(!r)throw new Error("unknown error");var n=this.rightChild,i=r.leftChild,o=r.rightChild;return e&&(e.leftChild===this?e.leftChild=r:e.rightChild===this&&(e.rightChild=r)),r.parent=e,r.brother=t,r.leftChild=i,r.rightChild=this,t&&(t.brother=r),i&&(i.parent=r,i.brother=this),this.parent=r,this.brother=i,this.leftChild=o,this.rightChild=n,o&&(o.parent=this,o.brother=n),n&&(n.parent=this,n.brother=o),r},e.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},e.TreeNodeColorType={red:!0,black:!1},e}();Object.freeze(y);const v=y;var b=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},w=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function _(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var n=0,i=new v;i.color=v.TreeNodeColorType.black,this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,i.key=void 0,i.leftChild=i.rightChild=i.brother=i.parent=void 0,i.color=v.TreeNodeColorType.black};var o=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?o(e.leftChild):e},s=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?s(e.rightChild):e};this.front=function(){if(!this.empty())return o(i).key},this.back=function(){if(!this.empty())return s(i).key},this.forEach=function(e){var t,r,n=0;try{for(var i=w(this),o=i.next();!o.done;o=i.next()){e(o.value,n++)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var i=w(this),o=i.next();!o.done;o=i.next()){var s=o.value;if(n===e)return s;++n}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}throw new Error("unknown error")};var a=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(e.color!==v.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild){if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;var n=t.rotateLeft();i===t&&(i=n),a(e)}else if(r.color===v.TreeNodeColorType.black)if(r.rightChild&&r.rightChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=t.rotateLeft();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,a(t));else{r.color=v.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=r.rotateRight();i===r&&(i=n),a(e)}}else if(e===t.rightChild)if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;n=t.rotateRight();i===t&&(i=n),a(e)}else if(r.color===v.TreeNodeColorType.black)if(r.leftChild&&r.leftChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=t.rotateRight();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,a(t));else{r.color=v.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=r.rotateLeft();i===r&&(i=n),a(e)}}else e.color=v.TreeNodeColorType.black},c=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=o(t.rightChild);var r=e.key;e.key=t.key,t.key=r,e=t}if(t.leftChild){t=s(t.leftChild);r=e.key;e.key=t.key,t.key=r,e=t}}a(t),t&&t.remove(),--n,i.color=v.TreeNodeColorType.black},u=function(e,t){return!(!e||void 0===e.key)&&(!!u(e.leftChild,t)||(!!t(e)||u(e.rightChild,t)))};this.eraseElementByPos=function(e){if(e<0||e>=n)throw new Error("pos must more than 0 and less than set's size");var t=0;u(i,(function(r){return e===t?(c(r),!0):(++t,!1)}))},this.eraseElementByValue=function(e){if(!this.empty()){var r=f(i,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&c(r)}};var l=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?l(e.leftChild,r):(e.leftChild=new v,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?l(e.rightChild,r):(e.rightChild=new v,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},h=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(t.color!==v.TreeNodeColorType.black&&t.color===v.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===v.TreeNodeColorType.red)r.color=t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red,h(n);else if(!r||r.color===v.TreeNodeColorType.black)if(t===n.leftChild){if(e===t.leftChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;var o=n.rotateRight();n===i&&(i=o)}else if(e===t.rightChild){o=t.rotateLeft();n===i&&(i=o),h(t)}}else if(t===n.rightChild)if(e===t.leftChild){o=t.rotateRight();n===i&&(i=o),h(t)}else if(e===t.rightChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;o=n.rotateLeft();n===i&&(i=o)}}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++n,i.key=e,void(i.color=v.TreeNodeColorType.black);var r=l(i,e);void 0!==r.key&&0===t(r.key,e)||(++n,r.key=e,h(r),i.color=v.TreeNodeColorType.black)};var f=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?f(e.leftChild,r):n>0?f(e.rightChild,r):e}};this.find=function(e){var r=f(i,e);return void 0!==r&&void 0!==r.key&&0===t(r.key,e)};var d=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);if(0===n)return e.key;if(n<0)return d(e.rightChild,r);var i=d(e.leftChild,r);return void 0!==i?i:e.key}};this.lowerBound=function(e){return d(i,e)};var p=function(e,r){if(e&&void 0!==e.key){if(t(e.key,r)<=0)return p(e.rightChild,r);var n=p(e.leftChild,r);return void 0!==n?n:e.key}};this.upperBound=function(e){return p(i,e)};var g=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);if(0===n)return e.key;if(n>0)return g(e.leftChild,r);var i=g(e.rightChild,r);return void 0!==i?i:e.key}};this.reverseLowerBound=function(e){return g(i,e)};var m=function(e,r){if(e&&void 0!==e.key){if(t(e.key,r)>=0)return m(e.leftChild,r);var n=m(e.rightChild,r);return void 0!==n?n:e.key}};this.reverseUpperBound=function(e){return m(i,e)},this.union=function(e){var t=this;e.forEach((function(e){return t.insert(e)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(i)};var y=function(e){return b(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key?[5,w(y(e.leftChild))]:[2];case 1:return t.sent(),[4,e.key];case 2:return t.sent(),[5,w(y(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return y(i)},e.forEach((function(e){return r.insert(e)})),Object.freeze(this)}Object.freeze(_);const k=_;var S=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},E=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function T(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var n=0,i=new v;i.color=v.TreeNodeColorType.black,this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,i.key=i.value=void 0,i.leftChild=i.rightChild=i.brother=void 0};var o=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?o(e.leftChild):e},s=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?s(e.rightChild):e};this.front=function(){if(!this.empty()){var e=o(i);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.back=function(){if(!this.empty()){var e=s(i);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.forEach=function(e){var t,r,n=0;try{for(var i=E(this),o=i.next();!o.done;o=i.next()){e(o.value,n++)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var i=E(this),o=i.next();!o.done;o=i.next()){var s=o.value;if(n===e)return s;++n}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}throw new Error("unknown Error")};var a=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n<0?a(e.rightChild,r):a(e.leftChild,r)||{key:e.key,value:e.value}}};this.lowerBound=function(e){return a(i,e)};var c=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)<=0?c(e.rightChild,r):c(e.leftChild,r)||{key:e.key,value:e.value}};this.upperBound=function(e){return c(i,e)};var u=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n>0?u(e.leftChild,r):u(e.rightChild,r)||{key:e.key,value:e.value}}};this.reverseLowerBound=function(e){return u(i,e)};var l=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)>=0?l(e.leftChild,r):l(e.rightChild,r)||{key:e.key,value:e.value}};this.reverseUpperBound=function(e){return l(i,e)};var h=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(e.color!==v.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild){if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;var n=t.rotateLeft();i===t&&(i=n),h(e)}else if(r.color===v.TreeNodeColorType.black)if(r.rightChild&&r.rightChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=t.rotateLeft();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,h(t));else{r.color=v.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=r.rotateRight();i===r&&(i=n),h(e)}}else if(e===t.rightChild)if(r.color===v.TreeNodeColorType.red){r.color=v.TreeNodeColorType.black,t.color=v.TreeNodeColorType.red;n=t.rotateRight();i===t&&(i=n),h(e)}else if(r.color===v.TreeNodeColorType.black)if(r.leftChild&&r.leftChild.color===v.TreeNodeColorType.red){r.color=t.color,t.color=v.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=v.TreeNodeColorType.black);n=t.rotateRight();i===t&&(i=n),e.color=v.TreeNodeColorType.black}else if(r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==v.TreeNodeColorType.red)r.leftChild&&r.leftChild.color!==v.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==v.TreeNodeColorType.black||(r.color=v.TreeNodeColorType.red,h(t));else{r.color=v.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=v.TreeNodeColorType.black);n=r.rotateLeft();i===r&&(i=n),h(e)}}else e.color=v.TreeNodeColorType.black},f=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=o(t.rightChild);var r=e.key;e.key=t.key,t.key=r;var a=e.value;e.value=t.value,t.value=a,e=t}if(t.leftChild){t=s(t.leftChild);r=e.key;e.key=t.key,t.key=r;a=e.value;e.value=t.value,t.value=a,e=t}}h(t),t&&t.remove(),--n,i.color=v.TreeNodeColorType.black},d=function(e,t){return!(!e||void 0===e.key)&&(!!d(e.leftChild,t)||(!!t(e)||d(e.rightChild,t)))};this.eraseElementByPos=function(e){if(e<0||e>=n)throw new Error("pos must more than 0 and less than set's size");var t=0;d(i,(function(r){return e===t?(f(r),!0):(++t,!1)}))},this.eraseElementByKey=function(e){if(!this.empty()){var r=m(i,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&f(r)}};var p=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?p(e.leftChild,r):(e.leftChild=new v,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?p(e.rightChild,r):(e.rightChild=new v,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},g=function(e){var t=e.parent;if(!t){if(e===i)return;throw new Error("unknown error")}if(t.color!==v.TreeNodeColorType.black&&t.color===v.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===v.TreeNodeColorType.red)r.color=t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red,g(n);else if(!r||r.color===v.TreeNodeColorType.black)if(t===n.leftChild){if(e===t.leftChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;var o=n.rotateRight();n===i&&(i=o)}else if(e===t.rightChild){o=t.rotateLeft();n===i&&(i=o),g(t)}}else if(t===n.rightChild)if(e===t.leftChild){o=t.rotateRight();n===i&&(i=o),g(t)}else if(e===t.rightChild){t.color=v.TreeNodeColorType.black,n.color=v.TreeNodeColorType.red;o=n.rotateLeft();n===i&&(i=o)}}};this.setElement=function(e,r){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=r){if(this.empty())return++n,i.key=e,i.value=r,void(i.color=v.TreeNodeColorType.black);var o=p(i,e);void 0===o.key||0!==t(o.key,e)?(++n,o.key=e,o.value=r,g(o),i.color=v.TreeNodeColorType.black):o.value=r}else this.eraseElementByKey(e)};var m=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?m(e.leftChild,r):n>0?m(e.rightChild,r):e}};this.find=function(e){return!!m(i,e)},this.getElementByKey=function(e){var t=m(i,e);if(void 0===(null==t?void 0:t.key)||void 0===(null==t?void 0:t.value))throw new Error("unknown error");return t.value},this.union=function(e){var t=this;e.forEach((function(e){var r=e.key,n=e.value;return t.setElement(r,n)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(i)};var y=function(e){return S(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key&&void 0!==e.value?[5,E(y(e.leftChild))]:[2];case 1:return t.sent(),[4,{key:e.key,value:e.value}];case 2:return t.sent(),[5,E(y(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return y(i)},e.forEach((function(e){var t=e.key,n=e.value;return r.setElement(t,n)})),Object.freeze(this)}Object.freeze(T);const C=T;var A=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},x=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function I(e,t,r){var n=this;if(void 0===e&&(e=[]),void 0===t&&(t=I.initSize),r=r||function(e){var t=0,r="";if("number"==typeof e)t=((t=Math.floor(e))<<5)-t,t|=0;else{r="string"!=typeof e?JSON.stringify(e):e;for(var n=0;n<r.length;n++){t=(t<<5)-t+r.charCodeAt(n),t|=0}}return t^=t>>>16},t&t-1)throw new Error("initBucketNum must be 2 to the power of n");var i=0,o=[],s=Math.max(I.initSize,Math.min(I.maxSize,t));this.size=function(){return i},this.empty=function(){return 0===i},this.clear=function(){i=0,s=t,o=[]},this.forEach=function(e){var t=0;o.forEach((function(r){r.forEach((function(r){e(r,t++)}))}))};var a=function(e){if(!(e>=I.maxSize)){s=2*e;var t=[];o.forEach((function(n,i){if(!n.empty()){if(n instanceof f&&1===n.size()){var a=n.front();if(void 0===a)throw new Error("unknown error");t[r(a)&s-1]=new f([a])}else if(n instanceof k){var c=new f,u=new f;n.forEach((function(t){r(t)&e?u.pushBack(t):c.pushBack(t)})),c.size()>I.untreeifyThreshold?t[i]=new k(c):c.size()&&(t[i]=c),u.size()>I.untreeifyThreshold?t[i+e]=new k(u):u.size()&&(t[i+e]=u)}else{var l=new f,h=new f;n.forEach((function(t){r(t)&e?h.pushBack(t):l.pushBack(t)})),l.size()&&(t[i]=l),h.size()&&(t[i+e]=h)}o[i].clear()}})),o=t}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var t=r(e)&s-1;if(o[t]){var n=o[t].size();if(o[t]instanceof f){if(o[t].find(e))return;o[t].pushBack(e),o[t].size()>=I.treeifyThreshold&&(o[t]=new k(o[t]))}else o[t].insert(e);var c=o[t].size();i+=c-n}else o[t]=new f([e]),++i;i>s*I.sigma&&a.call(this,s)},this.eraseElementByValue=function(e){var t=r(e)&s-1;if(o[t]){var n=o[t].size();o[t].eraseElementByValue(e),o[t]instanceof k&&o[t].size()<=I.untreeifyThreshold&&(o[t]=new f(o[t]));var a=o[t].size();i+=a-n}},this.find=function(e){var t=r(e)&s-1;return!!o[t]&&o[t].find(e)},this[Symbol.iterator]=function(){return function(){var e,t,r,n,i,a;return A(this,(function(c){switch(c.label){case 0:e=0,c.label=1;case 1:if(!(e<s))return[3,10];for(;e<s&&!o[e];)++e;if(e>=s)return[3,10];c.label=2;case 2:c.trys.push([2,7,8,9]),i=void 0,t=x(o[e]),r=t.next(),c.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:c.sent(),c.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return n=c.sent(),i={error:n},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){return n.insert(e)})),Object.freeze(this)}I.initSize=16,I.maxSize=1<<30,I.sigma=.75,I.treeifyThreshold=8,I.untreeifyThreshold=6,I.minTreeifySize=64,Object.freeze(I);var R=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},P=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function M(e,t,r){var n=this;if(void 0===e&&(e=[]),void 0===t&&(t=M.initSize),r=r||function(e){var t,r,n=0,i="";if("number"==typeof e)n=((n=Math.floor(e))<<5)-n,n|=0;else{i="string"!=typeof e?JSON.stringify(e):e;try{for(var o=P(i),s=o.next();!s.done;s=o.next()){n=(n<<5)-n+s.value.charCodeAt(0),n|=0}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}return n^=n>>>16},t&t-1)throw new Error("initBucketNum must be 2 to the power of n");var i=0,o=[],s=Math.max(M.initSize,Math.min(M.maxSize,t));this.size=function(){return i},this.empty=function(){return 0===i},this.clear=function(){i=0,s=t,o=[]},this.forEach=function(e){var t=0;o.forEach((function(r){r.forEach((function(r){e(r,t++)}))}))};var a=function(e){if(!(e>=M.maxSize)){s=2*e;var t=[];o.forEach((function(n,i){if(!n.empty()){if(n instanceof f&&1===n.size()){var a=n.front(),c=a.key,u=a.value;t[r(c)&s-1]=new f([{key:c,value:u}])}else if(n instanceof C){var l=new f,h=new f;n.forEach((function(t){r(t.key)&e?h.pushBack(t):l.pushBack(t)})),l.size()>M.untreeifyThreshold?t[i]=new C(l):l.size()&&(t[i]=l),h.size()>M.untreeifyThreshold?t[i+e]=new C(h):h.size()&&(t[i+e]=h)}else{var d=new f,p=new f;n.forEach((function(t){r(t.key)&e?p.pushBack(t):d.pushBack(t)})),d.size()&&(t[i]=d),p.size()&&(t[i+e]=p)}o[i].clear()}})),o=t}};this.setElement=function(e,t){var n,c;if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=t){var u=r(e)&s-1;if(o[u]){var l=o[u].size();if(o[u]instanceof f){try{for(var h=P(o[u]),d=h.next();!d.done;d=h.next()){var p=d.value;if(p.key===e)return void(p.value=t)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(c=h.return)&&c.call(h)}finally{if(n)throw n.error}}o[u].pushBack({key:e,value:t}),o[u].size()>=M.treeifyThreshold&&(o[u]=new C(o[u]))}else o[u].setElement(e,t);var g=o[u].size();i+=g-l}else++i,o[u]=new f([{key:e,value:t}]);i>s*M.sigma&&a.call(this,s)}else this.eraseElementByKey(e)},this.getElementByKey=function(e){var t,n,i=r(e)&s-1;if(o[i]){if(o[i]instanceof C)return o[i].getElementByKey(e);try{for(var a=P(o[i]),c=a.next();!c.done;c=a.next()){var u=c.value;if(u.key===e)return u.value}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},this.eraseElementByKey=function(e){var t,n,a=r(e)&s-1;if(o[a]){var c=o[a].size();if(o[a]instanceof C)o[a].eraseElementByKey(e),o[a].size()<=M.untreeifyThreshold&&(o[a]=new f(o[a]));else{var u=-1;try{for(var l=P(o[a]),h=l.next();!h.done;h=l.next()){var d=h.value;if(++u,d.key===e){o[a].eraseElementByPos(u);break}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}}var p=o[a].size();i+=p-c}},this.find=function(e){var t,n,i=r(e)&s-1;if(!o[i])return!1;if(o[i]instanceof C)return o[i].find(e);try{for(var a=P(o[i]),c=a.next();!c.done;c=a.next()){if(c.value.key===e)return!0}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return!1},this[Symbol.iterator]=function(){return function(){var e,t,r,n,i,a;return R(this,(function(c){switch(c.label){case 0:e=0,c.label=1;case 1:if(!(e<s))return[3,10];for(;e<s&&!o[e];)++e;if(e>=s)return[3,10];c.label=2;case 2:c.trys.push([2,7,8,9]),i=void 0,t=P(o[e]),r=t.next(),c.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:c.sent(),c.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return n=c.sent(),i={error:n},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(i)throw i.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){var t=e.key,r=e.value;return n.setElement(t,r)})),Object.freeze(this)}M.initSize=16,M.maxSize=1<<30,M.sigma=.75,M.treeifyThreshold=8,M.untreeifyThreshold=6,M.minTreeifySize=64,Object.freeze(M)},8103:(e,t,r)=>{const n=r(601),i=Symbol("max"),o=Symbol("length"),s=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),h=Symbol("lruList"),f=Symbol("cache"),d=Symbol("updateAgeOnGet"),p=()=>1;const g=(e,t,r)=>{const n=e[f].get(t);if(n){const t=n.value;if(m(e,t)){if(v(e,n),!e[a])return}else r&&(e[d]&&(n.value.now=Date.now()),e[h].unshiftNode(n));return t.value}},m=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},y=e=>{if(e[o]>e[i])for(let t=e[h].tail;e[o]>e[i]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[o]-=r.length,e[f].delete(r.key),e[h].removeNode(t)}};class b{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const w=(e,t,r,n)=>{let i=r.value;m(e,i)&&(v(e,r),e[a]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||p;if(this[s]="function"!=typeof t?p:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[d]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,y(this)}get max(){return this[i]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,y(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[s]&&(this[s]=e,this[o]=0,this[h].forEach((e=>{e.length=this[s](e.value,e.key),this[o]+=e.length}))),y(this)}get lengthCalculator(){return this[s]}get length(){return this[o]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let r=this[h].tail;null!==r;){const n=r.prev;w(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[h].head;null!==r;){const n=r.next;w(this,e,r,t),r=n}}keys(){return this[h].toArray().map((e=>e.key))}values(){return this[h].toArray().map((e=>e.value))}reset(){this[u]&&this[h]&&this[h].length&&this[h].forEach((e=>this[u](e.key,e.value))),this[f]=new Map,this[h]=new n,this[o]=0}dump(){return this[h].map((e=>!m(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[h]}set(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[s](t,e);if(this[f].has(e)){if(a>this[i])return v(this,this[f].get(e)),!1;const s=this[f].get(e).value;return this[u]&&(this[l]||this[u](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[o]+=a-s.length,s.length=a,this.get(e),y(this),!0}const d=new b(e,t,a,n,r);return d.length>this[i]?(this[u]&&this[u](e,t),!1):(this[o]+=d.length,this[h].unshift(d),this[f].set(e,this[h].head),y(this),!0)}has(e){if(!this[f].has(e))return!1;const t=this[f].get(e).value;return!m(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[h].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[f].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[f].forEach(((e,t)=>g(this,t,!1)))}}},9513:(e,t,r)=>{var n=r(2577).Buffer;const i=e.exports;i.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},i.codes={};for(const e in i.types){const t=i.types[e];i.codes[t]=e}i.CMD_SHIFT=4,i.CMD_MASK=240,i.DUP_MASK=8,i.QOS_MASK=3,i.QOS_SHIFT=1,i.RETAIN_MASK=1,i.VARBYTEINT_MASK=127,i.VARBYTEINT_FIN_MASK=128,i.VARBYTEINT_MAX=268435455,i.SESSIONPRESENT_MASK=1,i.SESSIONPRESENT_HEADER=n.from([i.SESSIONPRESENT_MASK]),i.CONNACK_HEADER=n.from([i.codes.connack<<i.CMD_SHIFT]),i.USERNAME_MASK=128,i.PASSWORD_MASK=64,i.WILL_RETAIN_MASK=32,i.WILL_QOS_MASK=24,i.WILL_QOS_SHIFT=3,i.WILL_FLAG_MASK=4,i.CLEAN_SESSION_MASK=2,i.CONNECT_HEADER=n.from([i.codes.connect<<i.CMD_SHIFT]),i.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},i.propertiesCodes={};for(const e in i.properties){const t=i.properties[e];i.propertiesCodes[t]=e}function o(e){return[0,1,2].map((t=>[0,1].map((r=>[0,1].map((o=>{const s=n.alloc(1);return s.writeUInt8(i.codes[e]<<i.CMD_SHIFT|(r?i.DUP_MASK:0)|t<<i.QOS_SHIFT|o,0,!0),s}))))))}i.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},i.PUBLISH_HEADER=o("publish"),i.SUBSCRIBE_HEADER=o("subscribe"),i.SUBSCRIBE_OPTIONS_QOS_MASK=3,i.SUBSCRIBE_OPTIONS_NL_MASK=1,i.SUBSCRIBE_OPTIONS_NL_SHIFT=2,i.SUBSCRIBE_OPTIONS_RAP_MASK=1,i.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,i.SUBSCRIBE_OPTIONS_RH_MASK=3,i.SUBSCRIBE_OPTIONS_RH_SHIFT=4,i.SUBSCRIBE_OPTIONS_RH=[0,16,32],i.SUBSCRIBE_OPTIONS_NL=4,i.SUBSCRIBE_OPTIONS_RAP=8,i.SUBSCRIBE_OPTIONS_QOS=[0,1,2],i.UNSUBSCRIBE_HEADER=o("unsubscribe"),i.ACKS={unsuback:o("unsuback"),puback:o("puback"),pubcomp:o("pubcomp"),pubrel:o("pubrel"),pubrec:o("pubrec")},i.SUBACK_HEADER=n.from([i.codes.suback<<i.CMD_SHIFT]),i.VERSION3=n.from([3]),i.VERSION4=n.from([4]),i.VERSION5=n.from([5]),i.VERSION131=n.from([131]),i.VERSION132=n.from([132]),i.QOS=[0,1,2].map((e=>n.from([e]))),i.EMPTY={pingreq:n.from([i.codes.pingreq<<4,0]),pingresp:n.from([i.codes.pingresp<<4,0]),disconnect:n.from([i.codes.disconnect<<4,0])}},1017:(e,t,r)=>{var n=r(2577).Buffer;const i=r(5706),o=r(9273);class s extends o{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const t=new Array(this._array.length),r=this._array;let i,o=0;for(i=0;i<r.length&&void 0!==r[i];i++)"string"!=typeof r[i]?t[i]=r[i].length:t[i]=n.byteLength(r[i]),e+=t[i];const s=n.allocUnsafe(e);for(i=0;i<r.length&&void 0!==r[i];i++)"string"!=typeof r[i]?(r[i].copy(s,o),o+=t[i]):(s.write(r[i],o),o+=t[i]);return s}}e.exports=function(e,t){const r=new s;return i(e,r,t),r.concat()}},3140:(e,t,r)=>{t.parser=r(4481).parser,t.generate=r(1017),t.writeToStream=r(5706)},534:(e,t,r)=>{var n=r(2577).Buffer;const i={},o=n.isBuffer(n.from([1,2]).subarray(0,1));function s(e){const t=n.allocUnsafe(2);return t.writeUInt8(e>>8,0),t.writeUInt8(255&e,1),t}e.exports={cache:i,generateCache:function(){for(let e=0;e<65536;e++)i[e]=s(e)},generateNumber:s,genBufVariableByteInt:function(e){let t=0,r=0;const i=n.allocUnsafe(4);do{t=e%128|0,(e=e/128|0)>0&&(t|=128),i.writeUInt8(t,r++)}while(e>0&&r<4);return e>0&&(r=0),o?i.subarray(0,r):i.slice(0,r)},generate4ByteBuffer:function(e){const t=n.allocUnsafe(4);return t.writeUInt32BE(e,0),t}}},2654:e=>{e.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},4481:(e,t,r)=>{const n=r(6431),i=r(9273),o=r(2654),s=r(9513),a=r(659)("mqtt-packet:parser");class c extends i{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof c?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new c).parser(e)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),a("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const e=this._list.readUInt8(0);return this.packet.cmd=s.types[e>>s.CMD_SHIFT],this.packet.retain=!!(e&s.RETAIN_MASK),this.packet.qos=e>>s.QOS_SHIFT&s.QOS_MASK,this.packet.dup=!!(e&s.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),a("_parseLength %d",e.value),!!e}_parsePayload(){a("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return a("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,r,n;a("_parseConnect");const i={},o=this.packet,c=this._parseString();if(null===c)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==c&&"MQIsdp"!==c)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=c,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),o.protocolVersion>=128&&(o.bridgeMode=!0,o.protocolVersion=o.protocolVersion-128),3!==o.protocolVersion&&4!==o.protocolVersion&&5!==o.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(i.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK,i.will&&(o.will={},o.will.retain=!!(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT),o.clean=!!(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK),this._pos++,o.keepalive=this._parseNum(),-1===o.keepalive)return this._emitError(new Error("Packet too short"));if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.properties=e)}const u=this._parseString();if(null===u)return this._emitError(new Error("Packet too short"));if(o.clientId=u,a("_parseConnect: packet.clientId: %s",o.clientId),i.will){if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.will.properties=e)}if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=e,a("_parseConnect: packet.will.topic: %s",o.will.topic),t=this._parseBuffer(),null===t)return this._emitError(new Error("Cannot parse will payload"));o.will.payload=t,a("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(i.username){if(n=this._parseString(),null===n)return this._emitError(new Error("Cannot parse username"));o.username=n,a("_parseConnect: packet.username: %s",o.username)}if(i.password){if(r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse password"));o.password=r}return this.settings=o,a("_parseConnect: complete"),o}_parseConnack(){a("_parseConnack");const e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&s.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}a("_parseConnack: complete")}_parsePublish(){a("_parsePublish");const e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),a("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){a("_parseSubscribe");const e=this.packet;let t,r,n,i,o,c,u;if(1!==e.qos)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));r=this._parseByte(),n=r&s.SUBSCRIBE_OPTIONS_QOS_MASK,c=!!(r>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK),o=!!(r>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK),i=r>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,u={topic:t,qos:n},5===this.settings.protocolVersion?(u.nl=c,u.rap=o,u.rh=i):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",u),e.subscriptions.push(u)}}}_parseSuback(){a("_parseSuback");const e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){a("_parseUnsubscribe");const e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){const t=this._parseString();if(null===t)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){a("_parseUnsuback");const e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2?(e.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){const e=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_parseAuth");const e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),a("_parseAuth: result: true"),!0}_parseMessageId(){const e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;const n=this._list.toString("utf8",this._pos,r);return this._pos+=t,a("_parseString: result: %s",n),n}_parseStringPair(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;const r=this._list.slice(this._pos,t);return this._pos+=e,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const e=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){a("_parseVarByteNum");let t,r=0,n=1,i=0,o=!1;const c=this._pos?this._pos:0;for(;r<4&&c+r<this._list.length;){if(t=this._list.readUInt8(c+r++),i+=n*(t&s.VARBYTEINT_MASK),n*=128,!(t&s.VARBYTEINT_FIN_MASK)){o=!0;break}if(this._list.length<=r)break}return!o&&4===r&&this._list.length>=r&&this._emitError(new Error("Invalid variable byte integer")),c&&(this._pos+=r),o=!!o&&(e?{bytes:r,value:i}:i),a("_parseVarByteNum: result: %o",o),o}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",e),e}_parseByType(e){switch(a("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){a("_parseProperties");const e=this._parseVarByteNum(),t=this._pos+e,r={};for(;this._pos<t;){const e=this._parseByte();if(!e)return this._emitError(new Error("Cannot parse property code type")),!1;const t=s.propertiesCodes[e];if(!t)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==t)r[t]?(Array.isArray(r[t])||(r[t]=[r[t]]),r[t].push(this._parseByType(s.propertiesTypes[t]))):r[t]=this._parseByType(s.propertiesTypes[t]);else{r[t]||(r[t]=Object.create(null));const e=this._parseByType(s.propertiesTypes[t]);if(r[t][e.name])if(Array.isArray(r[t][e.name]))r[t][e.name].push(e.value);else{const n=r[t][e.name];r[t][e.name]=[n],r[t][e.name].push(e.value)}else r[t][e.name]=e.value}}return r}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),a("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}_emitError(e){a("_emitError"),this.error=e,this.emit("error",e)}}e.exports=c},5706:(e,t,r)=>{var n=r(2577).Buffer;const i=r(9513),o=n.allocUnsafe(0),s=n.from([0]),a=r(534),c=r(4303).nextTick,u=r(659)("mqtt-packet:writeToStream"),l=a.cache,h=a.generateNumber,f=a.generateCache,d=a.genBufVariableByteInt,p=a.generate4ByteBuffer;let g=S,m=!0;function y(e,t,r){switch(u("generate called"),t.cork&&(t.cork(),c(v,t)),m&&(m=!1,f()),u("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return function(e,t,r){const o=e||{},s=o.protocolId||"MQTT";let a=o.protocolVersion||4;const c=o.will;let u=o.clean;const l=o.keepalive||0,h=o.clientId||"",f=o.username,d=o.password,p=o.properties;void 0===u&&(u=!0);let m=0;if(!s||"string"!=typeof s&&!n.isBuffer(s))return t.emit("error",new Error("Invalid protocolId")),!1;m+=s.length+2;if(3!==a&&4!==a&&5!==a)return t.emit("error",new Error("Invalid protocol version")),!1;m+=1;if(("string"==typeof h||n.isBuffer(h))&&(h||a>=4)&&(h||u))m+=n.byteLength(h)+2;else{if(a<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof l||l<0||l>65535||l%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;m+=2;if(m+=1,5===a){var y=C(t,p);if(!y)return!1;m+=y.length}if(c){if("object"!=typeof c)return t.emit("error",new Error("Invalid will")),!1;if(!c.topic||"string"!=typeof c.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(m+=n.byteLength(c.topic)+2,m+=2,c.payload){if(!(c.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof c.payload?m+=n.byteLength(c.payload):m+=c.payload.length}var v={};if(5===a){if(!(v=C(t,c.properties)))return!1;m+=v.length}}let b=!1;if(null!=f){if(!P(f))return t.emit("error",new Error("Invalid username")),!1;b=!0,m+=n.byteLength(f)+2}if(null!=d){if(!b)return t.emit("error",new Error("Username is required to use password")),!1;if(!P(d))return t.emit("error",new Error("Invalid password")),!1;m+=R(d)+2}t.write(i.CONNECT_HEADER),w(t,m),T(t,s),o.bridgeMode&&(a+=128);t.write(131===a?i.VERSION131:132===a?i.VERSION132:4===a?i.VERSION4:5===a?i.VERSION5:i.VERSION3);let k=0;k|=null!=f?i.USERNAME_MASK:0,k|=null!=d?i.PASSWORD_MASK:0,k|=c&&c.retain?i.WILL_RETAIN_MASK:0,k|=c&&c.qos?c.qos<<i.WILL_QOS_SHIFT:0,k|=c?i.WILL_FLAG_MASK:0,k|=u?i.CLEAN_SESSION_MASK:0,t.write(n.from([k])),g(t,l),5===a&&y.write();T(t,h),c&&(5===a&&v.write(),_(t,c.topic),T(t,c.payload));null!=f&&T(t,f);null!=d&&T(t,d);return!0}(e,t);case"connack":return function(e,t,r){const o=r?r.protocolVersion:4,a=e||{},c=5===o?a.reasonCode:a.returnCode,u=a.properties;let l=2;if("number"!=typeof c)return t.emit("error",new Error("Invalid return code")),!1;let h=null;if(5===o){if(h=C(t,u),!h)return!1;l+=h.length}t.write(i.CONNACK_HEADER),w(t,l),t.write(a.sessionPresent?i.SESSIONPRESENT_HEADER:s),t.write(n.from([c])),null!=h&&h.write();return!0}(e,t,r);case"publish":return function(e,t,r){u("publish: packet: %o",e);const s=r?r.protocolVersion:4,a=e||{},c=a.qos||0,l=a.retain?i.RETAIN_MASK:0,h=a.topic,f=a.payload||o,d=a.messageId,p=a.properties;let m=0;if("string"==typeof h)m+=n.byteLength(h)+2;else{if(!n.isBuffer(h))return t.emit("error",new Error("Invalid topic")),!1;m+=h.length+2}n.isBuffer(f)?m+=f.length:m+=n.byteLength(f);if(c&&"number"!=typeof d)return t.emit("error",new Error("Invalid messageId")),!1;c&&(m+=2);let y=null;if(5===s){if(y=C(t,p),!y)return!1;m+=y.length}t.write(i.PUBLISH_HEADER[c][a.dup?1:0][l?1:0]),w(t,m),g(t,R(h)),t.write(h),c>0&&g(t,d);null!=y&&y.write();return u("publish: payload: %o",f),t.write(f)}(e,t,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.cmd||"puback",c=s.messageId,u=s.dup&&"pubrel"===a?i.DUP_MASK:0;let l=0;const h=s.reasonCode,f=s.properties;let d=5===o?3:2;"pubrel"===a&&(l=1);if("number"!=typeof c)return t.emit("error",new Error("Invalid messageId")),!1;let p=null;if(5===o&&"object"==typeof f){if(p=A(t,f,r,d),!p)return!1;d+=p.length}t.write(i.ACKS[a][l][u][0]),w(t,d),g(t,c),5===o&&t.write(n.from([h]));null!==p&&p.write();return!0}(e,t,r);case"subscribe":return function(e,t,r){u("subscribe: packet: ");const o=r?r.protocolVersion:4,s=e||{},a=s.dup?i.DUP_MASK:0,c=s.messageId,l=s.subscriptions,h=s.properties;let f=0;if("number"!=typeof c)return t.emit("error",new Error("Invalid messageId")),!1;f+=2;let d=null;if(5===o){if(d=C(t,h),!d)return!1;f+=d.length}if("object"!=typeof l||!l.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(let e=0;e<l.length;e+=1){const r=l[e].topic,i=l[e].qos;if("string"!=typeof r)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof i)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===o){if("boolean"!=typeof(l[e].nl||!1))return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(l[e].rap||!1))return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const r=l[e].rh||0;if("number"!=typeof r||r>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=n.byteLength(r)+2+1}u("subscribe: writing to stream: %o",i.SUBSCRIBE_HEADER),t.write(i.SUBSCRIBE_HEADER[1][a?1:0][0]),w(t,f),g(t,c),null!==d&&d.write();let p=!0;for(const e of l){const r=e.topic,s=e.qos,a=+e.nl,c=+e.rap,u=e.rh;let l;_(t,r),l=i.SUBSCRIBE_OPTIONS_QOS[s],5===o&&(l|=a?i.SUBSCRIBE_OPTIONS_NL:0,l|=c?i.SUBSCRIBE_OPTIONS_RAP:0,l|=u?i.SUBSCRIBE_OPTIONS_RH[u]:0),p=t.write(n.from([l]))}return p}(e,t,r);case"suback":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.messageId,c=s.granted,u=s.properties;let l=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;l+=2;if("object"!=typeof c||!c.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<c.length;e+=1){if("number"!=typeof c[e])return t.emit("error",new Error("Invalid qos vector")),!1;l+=1}let h=null;if(5===o){if(h=A(t,u,r,l),!h)return!1;l+=h.length}t.write(i.SUBACK_HEADER),w(t,l),g(t,a),null!==h&&h.write();return t.write(n.from(c))}(e,t,r);case"unsubscribe":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.messageId,c=s.dup?i.DUP_MASK:0,u=s.unsubscriptions,l=s.properties;let h=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;h+=2;if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(let e=0;e<u.length;e+=1){if("string"!=typeof u[e])return t.emit("error",new Error("Invalid unsubscriptions")),!1;h+=n.byteLength(u[e])+2}let f=null;if(5===o){if(f=C(t,l),!f)return!1;h+=f.length}t.write(i.UNSUBSCRIBE_HEADER[1][c?1:0][0]),w(t,h),g(t,a),null!==f&&f.write();let d=!0;for(let e=0;e<u.length;e++)d=_(t,u[e]);return d}(e,t,r);case"unsuback":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.messageId,c=s.dup?i.DUP_MASK:0,u=s.granted,l=s.properties,h=s.cmd,f=0;let d=2;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(5===o){if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<u.length;e+=1){if("number"!=typeof u[e])return t.emit("error",new Error("Invalid qos vector")),!1;d+=1}}let p=null;if(5===o){if(p=A(t,l,r,d),!p)return!1;d+=p.length}t.write(i.ACKS[h][f][c][0]),w(t,d),g(t,a),null!==p&&p.write();5===o&&t.write(n.from(u));return!0}(e,t,r);case"pingreq":case"pingresp":return function(e,t,r){return t.write(i.EMPTY[e.cmd])}(e,t);case"disconnect":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.reasonCode,c=s.properties;let u=5===o?1:0,l=null;if(5===o){if(l=A(t,c,r,u),!l)return!1;u+=l.length}t.write(n.from([i.codes.disconnect<<4])),w(t,u),5===o&&t.write(n.from([a]));null!==l&&l.write();return!0}(e,t,r);case"auth":return function(e,t,r){const o=r?r.protocolVersion:4,s=e||{},a=s.reasonCode,c=s.properties;let u=5===o?1:0;5!==o&&t.emit("error",new Error("Invalid mqtt version for auth packet"));const l=A(t,c,r,u);if(!l)return!1;u+=l.length,t.write(n.from([i.codes.auth<<4])),w(t,u),t.write(n.from([a])),null!==l&&l.write();return!0}(e,t,r);default:return t.emit("error",new Error("Unknown command")),!1}}function v(e){e.uncork()}Object.defineProperty(y,"cacheNumbers",{get:()=>g===S,set(e){e?(l&&0!==Object.keys(l).length||(m=!0),g=S):(m=!1,g=E)}});const b={};function w(e,t){if(t>i.VARBYTEINT_MAX)return e.emit("error",new Error(`Invalid variable byte integer: ${t}`)),!1;let r=b[t];return r||(r=d(t),t<16384&&(b[t]=r)),u("writeVarByteInt: writing to stream: %o",r),e.write(r)}function _(e,t){const r=n.byteLength(t);return g(e,r),u("writeString: %s",t),e.write(t,"utf8")}function k(e,t,r){_(e,t),_(e,r)}function S(e,t){return u("writeNumberCached: number: %d",t),u("writeNumberCached: %o",l[t]),e.write(l[t])}function E(e,t){const r=h(t);return u("writeNumberGenerated: %o",r),e.write(r)}function T(e,t){"string"==typeof t?_(e,t):t?(g(e,t.length),e.write(t)):g(e,0)}function C(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write(){I(e,{},0)}};let r=0;function o(t,r){let o=0;switch(i.propertiesTypes[t]){case"byte":if("boolean"!=typeof r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=2;break;case"int8":if("number"!=typeof r||r<0||r>255)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=2;break;case"binary":if(r&&null===r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=1+n.byteLength(r)+2;break;case"int16":if("number"!=typeof r||r<0||r>65535)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=3;break;case"int32":if("number"!=typeof r||r<0||r>4294967295)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=5;break;case"var":if("number"!=typeof r||r<0||r>268435455)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=1+n.byteLength(d(r));break;case"string":if("string"!=typeof r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=3+n.byteLength(r.toString());break;case"pair":if("object"!=typeof r)return e.emit("error",new Error(`Invalid ${t}: ${r}`)),!1;o+=Object.getOwnPropertyNames(r).reduce(((e,t)=>{const i=r[t];return Array.isArray(i)?e+=i.reduce(((e,r)=>e+=3+n.byteLength(t.toString())+2+n.byteLength(r.toString())),0):e+=3+n.byteLength(t.toString())+2+n.byteLength(r[t].toString()),e}),0);break;default:return e.emit("error",new Error(`Invalid property ${t}: ${r}`)),!1}return o}if(t)for(const e in t){let n=0,i=0;const s=t[e];if(Array.isArray(s))for(let t=0;t<s.length;t++){if(i=o(e,s[t]),!i)return!1;n+=i}else{if(i=o(e,s),!i)return!1;n=i}if(!n)return!1;r+=n}return{length:n.byteLength(d(r))+r,write(){I(e,t,r)}}}function A(e,t,r,n){const i=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let s=C(e,t);if(o)for(;n+s.length>o;){const r=i.shift();if(!r||!t[r])return!1;delete t[r],s=C(e,t)}return s}function x(e,t,r){switch(i.propertiesTypes[t]){case"byte":e.write(n.from([i.properties[t]])),e.write(n.from([+r]));break;case"int8":e.write(n.from([i.properties[t]])),e.write(n.from([r]));break;case"binary":e.write(n.from([i.properties[t]])),T(e,r);break;case"int16":e.write(n.from([i.properties[t]])),g(e,r);break;case"int32":e.write(n.from([i.properties[t]])),function(e,t){const r=p(t);u("write4ByteNumber: %o",r),e.write(r)}(e,r);break;case"var":e.write(n.from([i.properties[t]])),w(e,r);break;case"string":e.write(n.from([i.properties[t]])),_(e,r);break;case"pair":Object.getOwnPropertyNames(r).forEach((o=>{const s=r[o];Array.isArray(s)?s.forEach((r=>{e.write(n.from([i.properties[t]])),k(e,o.toString(),r.toString())})):(e.write(n.from([i.properties[t]])),k(e,o.toString(),s.toString()))}));break;default:return e.emit("error",new Error(`Invalid property ${t} value: ${r}`)),!1}}function I(e,t,r){w(e,r);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&null!==t[r]){const n=t[r];if(Array.isArray(n))for(let t=0;t<n.length;t++)x(e,r,n[t]);else x(e,r,n)}}function R(e){return e?e instanceof n?e.length:n.byteLength(e):0}function P(e){return"string"==typeof e||e instanceof n}e.exports=y},7103:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,s=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\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(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},1846:(e,t,r)=>{const n=r(3285);e.exports.t=n},3285:(e,t,r)=>{const n=r(310).NZ,i=r(659)("number-allocator:trace"),o=r(659)("number-allocator:error");function s(e,t){this.low=e,this.high=t}function a(e,t){if(!(this instanceof a))return new a(e,t);this.min=e,this.max=t,this.ss=new n([],((e,t)=>e.compare(t))),i("Create"),this.clear()}s.prototype.equals=function(e){return this.low===e.low&&this.high===e.high},s.prototype.compare=function(e){return this.low<e.low&&this.high<e.low?-1:e.low<this.low&&e.high<this.low?1:0},a.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},a.prototype.alloc=function(){if(0===this.ss.size())return i("alloc():empty"),null;const e=this.ss.front(),t=e.low;return t+1<=e.high?++e.low:this.ss.eraseElementByPos(0),i("alloc():"+t),t},a.prototype.use=function(e){const t=new s(e,e),r=this.ss.lowerBound(t);if(r){if(r.equals(t))return this.ss.eraseElementByValue(r),i("use():"+e),!0;if(r.low>e)return!1;if(r.low===e)return++r.low,i("use():"+e),!0;if(r.high===e)return--r.high,i("use():"+e),!0;const n=r.low;return r.low=e+1,this.ss.insert(new s(n,e-1)),i("use():"+e),!0}return i("use():failed"),!1},a.prototype.free=function(e){if(e<this.min||e>this.max)return void o("free():"+e+" is out of range");const t=new s(e,e),r=this.ss.lowerBound(t);if(r){if(r.low<=e&&e<=r.high)return void o("free():"+e+" has already been vacant");if(r===this.ss.front())e+1===r.low?--r.low:this.ss.insert(t);else{const n=this.ss.reverseLowerBound(t);n.high+1===e?e+1===r.low?(this.ss.eraseElementByValue(n),r.low=n.low):n.high=e:e+1===r.low?r.low=e:this.ss.insert(t)}}else{if(r===this.ss.front())return void this.ss.insert(t);const n=this.ss.reverseLowerBound(t);n.high+1===e?n.high=e:this.ss.insert(t)}i("free():"+e)},a.prototype.clear=function(){i("clear()"),this.ss.clear(),this.ss.insert(new s(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.size()},a.prototype.dump=function(){console.log("length:"+this.ss.size());for(const e of this.ss)console.log(e)},e.exports=a},8377:(e,t,r)=>{var n=r(2781);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},4303:(e,t,r)=>{var n=r(3908);void 0===n||!n.version||0===n.version.indexOf("v0.")||0===n.version.indexOf("v1.")&&0!==n.version.indexOf("v1.8.")?e.exports={nextTick:function(e,t,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return n.nextTick(e);case 2:return n.nextTick((function(){e.call(null,t)}));case 3:return n.nextTick((function(){e.call(null,t,r)}));case 4:return n.nextTick((function(){e.call(null,t,r,i)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return n.nextTick((function(){e.apply(null,o)}))}}}:e.exports=n},3908:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=s(h);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||u||s(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},7192:e=>{function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,r,n,i){r=r||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var s=/\+/g;e=e.split(r);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var c=e.length;a>0&&c>a&&(c=a);for(var u=0;u<c;++u){var l,h,f,d,p=e[u].replace(s,"%20"),g=p.indexOf(n);g>=0?(l=p.substr(0,g),h=p.substr(g+1)):(l=p,h=""),f=decodeURIComponent(l),d=decodeURIComponent(h),t(o,f)?Array.isArray(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o}},5696:e=>{var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,r,n,i){return r=r||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(i){var o=encodeURIComponent(t(i))+n;return Array.isArray(e[i])?e[i].map((function(e){return o+encodeURIComponent(t(e))})).join(r):o+encodeURIComponent(t(e[i]))})).join(r):i?encodeURIComponent(t(i))+n+encodeURIComponent(t(e)):""}},6316:(e,t,r)=>{t.decode=t.parse=r(7192),t.encode=t.stringify=r(5696)},1690:e=>{var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(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))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,s,a;if("string"==typeof t&&(o="not ",t.substr(!s||s<0?0:+s,o.length)===o)?(i="must not be",t=t.replace(/^not /,"")):i="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"))a="The ".concat(e," ").concat(i," ").concat(n(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";a='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(n(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},444:(e,t,r)=>{var n=r(3908),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(4258),s=r(4486);r(6371)(l,o);for(var a=i(s.prototype),c=0;c<a.length;c++){var u=a[c];l.prototype[u]||(l.prototype[u]=s.prototype[u])}function l(e){if(!(this instanceof l))return new l(e);o.call(this,e),s.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",h)))}function h(){this._writableState.ended||n.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.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)}})},9942:(e,t,r)=>{e.exports=i;var n=r(2892);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(6371)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},4258:(e,t,r)=>{var n,i=r(3908);e.exports=T,T.ReadableState=E;r(9273).EventEmitter;var o=function(e,t){return e.listeners(t).length},s=r(4363),a=r(2577).Buffer,c=r.g.Uint8Array||function(){};var u,l=r(2472);u=l&&l.debuglog?l.debuglog("stream"):function(){};var h,f,d,p=r(7703),g=r(4386),m=r(5069).getHighWaterMark,y=r(1690).F,v=y.ERR_INVALID_ARG_TYPE,b=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,_=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6371)(T,s);var k=g.errorOrDestroy,S=["error","close","destroy","pause","resume"];function E(e,t,i){n=n||r(444),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=r(6127).I),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function T(e){if(n=n||r(444),!(this instanceof T))return new T(e);var t=this instanceof n;this._readableState=new E(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function C(e,t,r,n,i){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(u("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?R(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,P(e)))}(e,s);else if(i||(o=function(e,t){var r;n=t,a.isBuffer(n)||n instanceof c||"string"==typeof t||void 0===t||e.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(s,t)),o)k(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)s.endEmitted?k(e,new _):A(e,s,t,!0);else if(s.ended)k(e,new b);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?A(e,s,t,!1):M(e,s)):A(e,s,t,!1)}else n||(s.reading=!1,M(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function A(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&&R(e)),M(e,t)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=g.destroy,T.prototype._undestroy=g.undestroy,T.prototype._destroy=function(e,t){t(e)},T.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=a.from(e,t),t=""),r=!0),C(this,e,t,!1,r)},T.prototype.unshift=function(e){return C(this,e,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(e){h||(h=r(6127).I);var t=new h(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var x=1073741824;function I(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>=x?e=x:(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 R(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(P,e))}function P(e){var t=e._readableState;u("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,D(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(u("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function B(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 N(e){u("readable nexttick read 0"),e.read(0)}function L(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function U(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 j(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(F,t,e))}function F(e,t){if(u("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 z(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}T.prototype.read=function(e){u("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 u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):R(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",i=!0),t.ended||t.reading?u("reading or ended",i=!1):i&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(n=e>0?U(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&&j(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(e){k(this,new w("_read()"))},T.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,u("pipe count=%d opts=%j",n.pipesCount,t);var s=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?c:m;function a(t,i){u("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,u("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",f),h=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){u("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,D(e))}}(r);e.on("drain",l);var h=!1;function f(t){u("ondata");var i=e.write(t);u("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==z(n.pipes,e))&&!h&&(u("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(t){u("onerror",t),m(),e.removeListener("error",d),0===o(e,"error")&&k(e,t)}function p(){e.removeListener("finish",g),m()}function g(){u("onfinish"),e.removeListener("close",p),m()}function m(){u("unpipe"),r.unpipe(e)}return r.on("data",f),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",d),e.once("close",p),e.once("finish",g),e.emit("pipe",r),n.flowing||(u("pipe resume"),r.resume()),e},T.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 o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=z(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},T.prototype.on=function(e,t){var r=s.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,u("on readable",n.length,n.reading),n.length?R(this):n.reading||i.nextTick(N,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(B,this),r},T.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(B,this),t},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(L,e,t))}(this,e)),e.paused=!1,this},T.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(u("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){(u("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 o=0;o<S.length;o++)e.on(S[o],this.emit.bind(this,S[o]));return this._read=function(t){u("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=r(5209)),f(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),T._fromList=U,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(e,t){return void 0===d&&(d=r(923)),d(T,e,t)})},2892:(e,t,r)=>{e.exports=l;var n=r(1690).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,c=r(444);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);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 l(e){if(!(this instanceof l))return new l(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",h)}function h(){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 a;if(e._transformState.transforming)throw new s;return e.push(null)}r(6371)(l,c),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,r){r(new i("_transform()"))},l.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)}},l.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))},l.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,(function(e){t(e)}))}},4486:(e,t,r)=>{var n,i=r(3908);function o(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)}}e.exports=T,T.WritableState=E;var s={deprecate:r(5721)},a=r(4363),c=r(2577).Buffer,u=r.g.Uint8Array||function(){};var l,h=r(4386),f=r(5069).getHighWaterMark,d=r(1690).F,p=d.ERR_INVALID_ARG_TYPE,g=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,b=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,k=h.errorOrDestroy;function S(){}function E(e,t,s){n=n||r(444),e=e||{},"boolean"!=typeof s&&(s=t instanceof n),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.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,o=r.writecb;if("function"!=typeof o)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,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(P,e,t),e._writableState.errorEmitted=!0,k(e,n)):(o(n),e._writableState.errorEmitted=!0,k(e,n),P(e,t))}(e,r,n,t,o);else{var s=I(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||x(e,r),n?i.nextTick(A,e,r,s,o):A(e,r,s,o)}}(t,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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function T(e){var t=this instanceof(n=n||r(444));if(!t&&!l.call(T,this))return new T(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function C(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function A(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),P(e,t)}function x(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)i[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;i.allBuffers=c,C(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,l=r.encoding,h=r.callback;if(C(e,t,!1,t.objectMode?1:u.length,u,l,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function R(e,t){e._final((function(r){t.pendingcb--,r&&k(e,r),t.prefinished=!0,e.emit("prefinish"),P(e,t)}))}function P(e,t){var r=I(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,i.nextTick(R,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}r(6371)(T,a),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:s.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]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(e){return!!l.call(this,e)||this===T&&(e&&e._writableState instanceof E)}})):l=function(e){return e instanceof this},T.prototype.pipe=function(){k(this,new y)},T.prototype.write=function(e,t,r){var n,o=this._writableState,s=!1,a=!o.objectMode&&(n=e,c.isBuffer(n)||n instanceof u);return a&&!c.isBuffer(e)&&(e=function(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(e,t){var r=new w;k(e,r),i.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var o;return null===r?o=new b:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(k(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else C(e,t,!1,a,n,i,o);return u}(this,o,a,e,t,r)),s},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||x(this,e))},T.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(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new g("_write()"))},T.prototype._writev=null,T.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,P(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=h.destroy,T.prototype._undestroy=h.undestroy,T.prototype._destroy=function(e,t){t(e)}},5209:(e,t,r)=>{var n,i=r(3908);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=r(2888),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var r=e[d].read();null!==r&&(e[h]=null,e[a]=null,e[c]=null,t(p(r,!1)))}}function m(e){i.nextTick(g,e)}var y=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[u]?r(e[u]):t(p(void 0,!0))}))}));var r,n=this[h];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[l]?r(p(void 0,!0)):t[f](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[f])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),y);e.exports=function(e){var t,r=Object.create(v,(o(t={},d,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var n=r[d].read();n?(r[h]=null,r[a]=null,r[c]=null,e(p(n,!1))):(r[a]=e,r[c]=t)},writable:!0}),t));return r[h]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[c];return null!==t&&(r[h]=null,r[a]=null,r[c]=null,t(e)),void(r[u]=e)}var n=r[a];null!==n&&(r[h]=null,r[a]=null,r[c]=null,n(p(void 0,!0))),r[l]=!0})),e.on("readable",m.bind(null,r)),r}},7703:(e,t,r)=>{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,t,r){return 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,n.key,n)}}var s=r(2577).Buffer,a=r(9546).inspect,c=a&&a.custom||"inspect";function u(e,t,r){s.prototype.copy.call(e,t,r)}e.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,l;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 s.alloc(0);for(var t=s.allocUnsafe(e>>>0),r=this.head,n=0;r;)u(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,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return a(this,function(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){i(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}({},t,{depth:0,customInspect:!1}))}}],r&&o(t.prototype,r),l&&o(t,l),e}()},4386:(e,t,r)=>{var n=r(3908);function i(e,t){s(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function s(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(s,this,e)):n.nextTick(s,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?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,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)}}},2888:(e,t,r)=>{var n=r(1690).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=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)}}}(o||i);var s=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||l()},u=t._writableState&&t._writableState.finished,l=function(){a=!1,u=!0,s||o.call(t)},h=t._readableState&&t._readableState.endEmitted,f=function(){s=!1,h=!0,a||o.call(t)},d=function(e){o.call(t,e)},p=function(){var e;return s&&!h?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):a&&!u?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},g=function(){t.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",c),t.on("close",c)):(t.on("complete",l),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",f),t.on("finish",l),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",l),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",l),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",l),t.removeListener("end",f),t.removeListener("error",d),t.removeListener("close",p)}}},923:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},9844:(e,t,r)=>{var n;var i=r(1690).F,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function c(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var l,h=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var f=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var a=!1;e.on("close",(function(){a=!0})),void 0===n&&(n=r(2888)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);a=!0,o()}));var c=!1;return function(t){if(!a&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}(e,o,i>0,(function(e){l||(l=e),e&&f.forEach(c),o||(f.forEach(c),h(l))}))}));return t.reduce(u)}},5069:(e,t,r)=>{var n=r(1690).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},4363:(e,t,r)=>{e.exports=r(9273).EventEmitter},1181:(e,t,r)=>{(t=e.exports=r(4258)).Stream=t,t.Readable=t,t.Writable=r(4486),t.Duplex=r(444),t.Transform=r(2892),t.PassThrough=r(9942),t.finished=r(2888),t.pipeline=r(9844)},5371:e=>{function t(e,t,r){var n=this;this._callback=e,this._args=r,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,e,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var r=0;r<e.length;r++)e[r]=arguments[r+2]}return new t(arguments[0],arguments[1],e)}},1691:(e,t,r)=>{e.exports=r(5962)()},5962:(e,t,r)=>{var n=r(2577).Buffer;function i(e){return e instanceof n?n.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}e.exports=function(e){return(e=e||{}).circles?function(e){var t=[],r=[];return e.proto?function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,e);if(o instanceof Map)return new Map(n(Array.from(o),e));if(o instanceof Set)return new Set(n(Array.from(o),e));var s={};for(var a in t.push(o),r.push(s),o){var c=o[a];if("object"!=typeof c||null===c)s[a]=c;else if(c instanceof Date)s[a]=new Date(c);else if(c instanceof Map)s[a]=new Map(n(Array.from(c),e));else if(c instanceof Set)s[a]=new Set(n(Array.from(c),e));else if(ArrayBuffer.isView(c))s[a]=i(c);else{var u=t.indexOf(c);s[a]=-1!==u?r[u]:e(c)}}return t.pop(),r.pop(),s}:function e(o){if("object"!=typeof o||null===o)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,e);if(o instanceof Map)return new Map(n(Array.from(o),e));if(o instanceof Set)return new Set(n(Array.from(o),e));var s={};for(var a in t.push(o),r.push(s),o)if(!1!==Object.hasOwnProperty.call(o,a)){var c=o[a];if("object"!=typeof c||null===c)s[a]=c;else if(c instanceof Date)s[a]=new Date(c);else if(c instanceof Map)s[a]=new Map(n(Array.from(c),e));else if(c instanceof Set)s[a]=new Set(n(Array.from(c),e));else if(ArrayBuffer.isView(c))s[a]=i(c);else{var u=t.indexOf(c);s[a]=-1!==u?r[u]:e(c)}}return t.pop(),r.pop(),s};function n(e,n){for(var o=Object.keys(e),s=new Array(o.length),a=0;a<o.length;a++){var c=o[a],u=e[c];if("object"!=typeof u||null===u)s[c]=u;else if(u instanceof Date)s[c]=new Date(u);else if(ArrayBuffer.isView(u))s[c]=i(u);else{var l=t.indexOf(u);s[c]=-1!==l?r[l]:n(u)}}return s}}(e):e.proto?function e(r){if("object"!=typeof r||null===r)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return t(r,e);if(r instanceof Map)return new Map(t(Array.from(r),e));if(r instanceof Set)return new Set(t(Array.from(r),e));var n={};for(var o in r){var s=r[o];"object"!=typeof s||null===s?n[o]=s:s instanceof Date?n[o]=new Date(s):s instanceof Map?n[o]=new Map(t(Array.from(s),e)):s instanceof Set?n[o]=new Set(t(Array.from(s),e)):ArrayBuffer.isView(s)?n[o]=i(s):n[o]=e(s)}return n}:function e(r){if("object"!=typeof r||null===r)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return t(r,e);if(r instanceof Map)return new Map(t(Array.from(r),e));if(r instanceof Set)return new Set(t(Array.from(r),e));var n={};for(var o in r)if(!1!==Object.hasOwnProperty.call(r,o)){var s=r[o];"object"!=typeof s||null===s?n[o]=s:s instanceof Date?n[o]=new Date(s):s instanceof Map?n[o]=new Map(t(Array.from(s),e)):s instanceof Set?n[o]=new Set(t(Array.from(s),e)):ArrayBuffer.isView(s)?n[o]=i(s):n[o]=e(s)}return n};function t(e,t){for(var r=Object.keys(e),n=new Array(r.length),o=0;o<r.length;o++){var s=r[o],a=e[s];"object"!=typeof a||null===a?n[s]=a:a instanceof Date?n[s]=new Date(a):ArrayBuffer.isView(a)?n[s]=i(a):n[s]=t(a)}return n}}},3843:(e,t,r)=>{var n=r(2577),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.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},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},3462:e=>{e.exports=function(e){var t=e._readableState;return t?t.objectMode||"number"==typeof e._duplexState?e.read():e.read(function(e){if(e.buffer.length)return e.buffer.head?e.buffer.head.data.length:e.buffer[0].length;return e.length}(t)):null}},6127:(e,t,r)=>{var n=r(3843).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 o(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=a,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){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 l(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 h(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 d(e){return e&&e.length?this.write(e):""}t.I=o,o.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||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if(i=s(t[n]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if(i=s(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)},o.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}},8884:function(e,t,r){var n;e=r.nmd(e),function(i){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof r.g&&r.g;o.global!==o&&o.window!==o&&o.self;var s,a=2147483647,c=36,u=1,l=26,h=38,f=700,d=72,p=128,g="-",m=/^xn--/,y=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=c-u,_=Math.floor,k=String.fromCharCode;function S(e){throw RangeError(b[e])}function E(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function T(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+E((e=e.replace(v,".")).split("."),t).join(".")}function C(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function A(e){return E(e,(function(e){var t="";return e>65535&&(t+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=k(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var n=0;for(e=r?_(e/f):e>>1,e+=_(e/t);e>w*l>>1;n+=c)e=_(e/w);return _(n+(w+1)*e/(e+h))}function R(e){var t,r,n,i,o,s,h,f,m,y,v,b=[],w=e.length,k=0,E=p,T=d;for((r=e.lastIndexOf(g))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&S("not-basic"),b.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<w;){for(o=k,s=1,h=c;i>=w&&S("invalid-input"),((f=(v=e.charCodeAt(i++))-48<10?v-22:v-65<26?v-65:v-97<26?v-97:c)>=c||f>_((a-k)/s))&&S("overflow"),k+=f*s,!(f<(m=h<=T?u:h>=T+l?l:h-T));h+=c)s>_(a/(y=c-m))&&S("overflow"),s*=y;T=I(k-o,t=b.length+1,0==o),_(k/t)>a-E&&S("overflow"),E+=_(k/t),k%=t,b.splice(k++,0,E)}return A(b)}function P(e){var t,r,n,i,o,s,h,f,m,y,v,b,w,E,T,A=[];for(b=(e=C(e)).length,t=p,r=0,o=d,s=0;s<b;++s)(v=e[s])<128&&A.push(k(v));for(n=i=A.length,i&&A.push(g);n<b;){for(h=a,s=0;s<b;++s)(v=e[s])>=t&&v<h&&(h=v);for(h-t>_((a-r)/(w=n+1))&&S("overflow"),r+=(h-t)*w,t=h,s=0;s<b;++s)if((v=e[s])<t&&++r>a&&S("overflow"),v==t){for(f=r,m=c;!(f<(y=m<=o?u:m>=o+l?l:m-o));m+=c)T=f-y,E=c-y,A.push(k(x(y+T%E,0))),f=_(T/E);A.push(k(x(f,0))),o=I(r,w,n==i),r=0,++n}++r,++t}return A.join("")}s={version:"1.3.2",ucs2:{decode:C,encode:A},decode:R,encode:P,toASCII:function(e){return T(e,(function(e){return y.test(e)?"xn--"+P(e):e}))},toUnicode:function(e){return T(e,(function(e){return m.test(e)?R(e.slice(4).toLowerCase()):e}))}},void 0===(n=function(){return s}.call(t,r,t,e))||(e.exports=n)}()},4837:(e,t,r)=>{var n=r(8884),i=r(7342);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(u),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(6316);function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var b=e=u.join(a);if(b=b.trim(),!r&&1===e.split("#").length){var w=c.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var _=s.exec(b);if(_){var k=(_=_[0]).toLowerCase();this.protocol=k,b=b.substr(_.length)}if(r||_||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===b.substr(0,2);!S||_&&m[_]||(b=b.substr(2),this.slashes=!0)}if(!m[_]&&(S||_&&!y[_])){for(var E,T,C=-1,A=0;A<f.length;A++){-1!==(x=b.indexOf(f[A]))&&(-1===C||x<C)&&(C=x)}-1!==(T=-1===C?b.lastIndexOf("@"):b.lastIndexOf("@",C))&&(E=b.slice(0,T),b=b.slice(T+1),this.auth=decodeURIComponent(E)),C=-1;for(A=0;A<h.length;A++){var x;-1!==(x=b.indexOf(h[A]))&&(-1===C||x<C)&&(C=x)}-1===C&&(C=b.length),this.host=b.slice(0,C),b=b.slice(C),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var R=this.hostname.split(/\./),P=(A=0,R.length);A<P;A++){var M=R[A];if(M&&!M.match(d)){for(var O="",B=0,N=M.length;B<N;B++)M.charCodeAt(B)>127?O+="x":O+=M[B];if(!O.match(d)){var L=R.slice(0,A),D=R.slice(A+1),U=M.match(p);U&&(L.push(U[1]),D.unshift(U[2])),D.length&&(b="/"+D.join(".")+b),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=n.toASCII(this.hostname));var j=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+j,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!g[k])for(A=0,P=l.length;A<P;A++){var z=l[A];if(-1!==b.indexOf(z)){var V=encodeURIComponent(z);V===z&&(V=escape(z)),b=b.split(z).join(V)}}var q=b.indexOf("#");-1!==q&&(this.hash=b.substr(q),b=b.slice(0,q));var W=b.indexOf("?");if(-1!==W?(this.search=b.substr(W),this.query=b.substr(W+1),t&&(this.query=v.parse(this.query)),b=b.slice(0,W)):t&&(this.search="",this.query={}),b&&(this.pathname=b),y[k]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){j=this.pathname||"";var H=this.search||"";this.path=j+H}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=v.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||y[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},o.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var r=new o,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0;u<c.length;u++){var l=c[u];"protocol"!==l&&(r[l]=e[l])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!y[e.protocol]){for(var h=Object.keys(e),f=0;f<h.length;f++){var d=h[f];r[d]=e[d]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||m[e.protocol])r.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var g=r.pathname||"",v=r.search||"";r.path=g+v}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var b=r.pathname&&"/"===r.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=w||b||r.host&&e.pathname,k=_,S=r.pathname&&r.pathname.split("/")||[],E=(p=e.pathname&&e.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(E&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),_=_&&(""===p[0]||""===S[0])),w)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,S=p;else if(p.length)S||(S=[]),S.pop(),S=S.concat(p),r.search=e.search,r.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(E)r.hostname=r.host=S.shift(),(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=S.slice(-1)[0],C=(r.host||e.host||S.length>1)&&("."===T||".."===T)||""===T,A=0,x=S.length;x>=0;x--)"."===(T=S[x])?S.splice(x,1):".."===T?(S.splice(x,1),A++):A&&(S.splice(x,1),A--);if(!_&&!k)for(;A--;A)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),C&&"/"!==S.join("/").substr(-1)&&S.push("");var I,R=""===S[0]||S[0]&&"/"===S[0].charAt(0);E&&(r.hostname=r.host=R?"":S.length?S.shift():"",(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift()));return(_=_||r.host&&S.length)&&!R&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},7342:e=>{e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},5721:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.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)}}},2781:e=>{e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var n=t.apply(this,e),i=e[e.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach((function(e){n[e]=i[e]})),n}}},965:e=>{e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},7616:e=>{e.exports=function(){for(var e={},r=0;r<arguments.length;r++){var n=arguments[r];for(var i in n)t.call(n,i)&&(e[i]=n[i])}return e};var t=Object.prototype.hasOwnProperty},785:e=>{e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},601:(e,t,r)=>{function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}function i(e,t,r){var n=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===n.next&&(e.tail=n),null===n.prev&&(e.head=n),e.length++,n}function o(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function s(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,n){if(!(this instanceof a))return new a(e,t,r,n);this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=n,n.Node=a,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;null!==r;n++)e.call(t,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;null!==r;n--)e.call(t,r.value,n,this),r=r.prev},n.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},n.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&i<e;i++)o=o.next;for(;null!==o&&i<t;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,o=this.head;null!==o&&n<e;n++)o=o.next;var s=[];for(n=0;o&&n<t;n++)s.push(o.value),o=this.removeNode(o);null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(n=0;n<r.length;n++)o=i(this,o,r[n]);return s},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};try{r(785)(n)}catch(e){}},6880:function(e){e.exports=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){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),o=e.getVersionPrecision(r),s=Math.max(i,o),a=0,c=e.map([t,r],(function(t){var r=s-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&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])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,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)a();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){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},o=r(18);function s(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 a=function(){function e(){}var t,r,n;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,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(r=null)&&s(t.prototype,r),n&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),o=c(r(94)),s=c(r(95)),a=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=a.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.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=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.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=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(r[t]=s,n+=1)})),n>0){var s=Object.keys(r),c=a.default.find(s,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var h=this.satisfies(r[l]);if(void 0!==h)return h}}if(o>0){var f=Object.keys(i),d=a.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==d)return this.compareVersion(i[d])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=a.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(a.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){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,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(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,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(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,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(o,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(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,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(o,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(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,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(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,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=s,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.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:o.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:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.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:o.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:o.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:o.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:o.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:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.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:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.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:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.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:o.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:o.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:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=s,e.exports=t.default}})},955:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],o=[],s=[],a=[],c=[],u=[],l=[],h=[],f=[],d=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,i[r]=p,o[p]=r;var g=e[r],m=e[g],y=e[m],v=257*e[p]^16843008*p;s[r]=v<<24|v>>>8,a[r]=v<<16|v>>>16,c[r]=v<<8|v>>>24,u[r]=v,v=16843009*y^65537*m^257*g^16843008*r,l[p]=v<<24|v>>>8,h[p]=v<<16|v>>>16,f[p]=v<<8|v>>>24,d[p]=v,r?(r=g^e[e[e[y^g]]],n^=e[e[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s<n;s++)s<r?o[s]=t[s]:(u=o[s-1],s%r?r>6&&s%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=p[s/r|0]<<24),o[s]=o[s-r]^u);for(var a=this._invKeySchedule=[],c=0;c<n;c++){if(s=n-c,c%4)var u=o[s];else u=o[s-4];a[c]=c<4||s<=4?u:l[i[u>>>24]]^h[i[u>>>16&255]]^f[i[u>>>8&255]]^d[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,h,f,d,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],h=e[t+2]^r[2],f=e[t+3]^r[3],d=4,p=1;p<c;p++){var g=n[u>>>24]^i[l>>>16&255]^o[h>>>8&255]^s[255&f]^r[d++],m=n[l>>>24]^i[h>>>16&255]^o[f>>>8&255]^s[255&u]^r[d++],y=n[h>>>24]^i[f>>>16&255]^o[u>>>8&255]^s[255&l]^r[d++],v=n[f>>>24]^i[u>>>16&255]^o[l>>>8&255]^s[255&h]^r[d++];u=g,l=m,h=y,f=v}g=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^r[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&u])^r[d++],y=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^r[d++],v=(a[f>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^r[d++],e[t]=g,e[t+1]=m,e[t+2]=y,e[t+3]=v},keySize:8});e.AES=t._createHelper(g)}(),n.AES)},3128:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.BlockCipher,r=e.algo;const i=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,i=t>>8&255,o=255&t,s=e.sbox[0][r]+e.sbox[1][n];return s^=e.sbox[2][i],s+=e.sbox[3][o],s}function u(e,t,r){let n,o=t,s=r;for(let t=0;t<i;++t)o^=e.pbox[t],s=c(e,o)^s,n=o,o=s,s=n;return n=o,o=s,s=n,s^=e.pbox[i],o^=e.pbox[i+1],{left:o,right:s}}function l(e,t,r){let n,o=t,s=r;for(let t=i+1;t>1;--t)o^=e.pbox[t],s=c(e,o)^s,n=o,o=s,s=n;return n=o,o=s,s=n,s^=e.pbox[1],o^=e.pbox[0],{left:o,right:s}}function h(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=s[t][r]}let n=0;for(let s=0;s<i+2;s++)e.pbox[s]=o[s]^t[n],n++,n>=r&&(n=0);let a=0,c=0,l=0;for(let t=0;t<i+2;t+=2)l=u(e,a,c),a=l.left,c=l.right,e.pbox[t]=a,e.pbox[t+1]=c;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)l=u(e,a,c),a=l.left,c=l.right,e.sbox[t][r]=a,e.sbox[t][r+1]=c;return!0}var f=r.Blowfish=t.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;h(a,t,r)}},encryptBlock:function(e,t){var r=u(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=l(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=t._createHelper(f)}(),n.Blowfish)},7165:function(e,t,r){var n;e.exports=(n=r(9021),r(9506),void(n.lib.Cipher||function(e){var t=n,r=t.lib,i=r.Base,o=r.WordArray,s=r.BufferedBlockAlgorithm,a=t.enc,c=(a.Utf8,a.Base64),u=t.algo.EvpKDF,l=r.Cipher=s.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:y}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()}),h=(r.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),t.mode={}),f=r.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),d=h.CBC=function(){var t=f.extend();function r(t,r,n){var i,o=this._iv;o?(i=o,this._iv=e):i=this._prevBlock;for(var s=0;s<n;s++)t[r+s]^=i[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=o}}),t}(),p=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(i);var c=o.create(s,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},g=(r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:p}),reset:function(){var e;l.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),m=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),g.create({ciphertext:r,salt:t})}},y=r.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),s=i.cfg;return g.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),v=(t.kdf={}).OpenSSL={execute:function(e,t,r,n,i){if(n||(n=o.random(8)),i)s=u.create({keySize:t+r,hasher:i}).compute(e,n);else var s=u.create({keySize:t+r}).compute(e,n);var a=o.create(s.words.slice(t),4*r);return s.sigBytes=4*t,g.create({key:s,iv:a,salt:n})}},b=r.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:v}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=y.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,y.decrypt.call(this,e,t,i.key,n)}})}()))},9021:function(e,t,r){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r.g&&r.g.crypto&&(n=r.g.crypto),!n)try{n=r(477)}catch(e){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},a=s.lib={},c=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=c.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new u.init(t,e)}}),l=s.enc={},h=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},f=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},d=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,l=e.min(4*c,o);if(c){for(var h=0;h<c;h+=s)this._doProcessBlock(i,h);r=i.splice(0,c),n.sigBytes-=l}return new u.init(r,l)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),g=(a.Hasher=p.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new g.HMAC.init(e,r).finalize(t)}}}),s.algo={});return s}(Math),n)},754:function(e,t,r){var n;e.exports=(n=r(9021),function(){var e=n,t=e.lib.WordArray;function r(e,r,n){for(var i=[],o=0,s=0;s<r;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<n.length;o++)i[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return r(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),n.enc.Base64)},4725:function(e,t,r){var n;e.exports=(n=r(9021),function(){var e=n,t=e.lib.WordArray;function r(e,r,n){for(var i=[],o=0,s=0;s<r;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],s=0;s<n;s+=3)for(var a=(r[s>>>2]>>>24-s%4*8&255)<<16|(r[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|r[s+2>>>2]>>>24-(s+2)%4*8&255,c=0;c<4&&s+.75*c<n;c++)o.push(i.charAt(a>>>6*(3-c)&63));var u=i.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var n=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var s=0;s<i.length;s++)o[i.charCodeAt(s)]=s}var a=i.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(n=c)}return r(e,n,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),n.enc.Base64url)},5503:function(e,t,r){var n;e.exports=(n=r(9021),function(){var e=n,t=e.lib.WordArray,r=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var o=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},r.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var s=i(t[o>>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return t.create(n,2*r)}}}(),n.enc.Utf16)},9506:function(e,t,r){var n,i,o,s,a,c,u,l;e.exports=(l=r(9021),r(5471),r(1025),i=(n=l).lib,o=i.Base,s=i.WordArray,a=n.algo,c=a.MD5,u=a.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),o=s.create(),a=o.words,c=n.keySize,u=n.iterations;a.length<c;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(var l=1;l<u;l++)r=i.finalize(r),i.reset();o.concat(r)}return o.sigBytes=4*c,o}}),n.EvpKDF=function(e,t,r){return u.create(r).compute(e,t)},l.EvpKDF)},25:function(e,t,r){var n,i,o,s;e.exports=(s=r(9021),r(7165),i=(n=s).lib.CipherParams,o=n.enc.Hex,n.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return i.create({ciphertext:t})}},s.format.Hex)},3793:function(e,t,r){var n;e.exports=(n=r(9021),r(3009),r(1025),n.HmacSHA256)},1025:function(e,t,r){var n,i,o,s;e.exports=(n=r(9021),o=(i=n).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,c=o.words,u=0;u<r;u++)a[u]^=1549556828,c[u]^=909522486;i.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))},1396:function(e,t,r){var n;e.exports=(n=r(9021),r(3240),r(6440),r(5503),r(754),r(4725),r(4636),r(5471),r(3009),r(6308),r(1380),r(9557),r(5953),r(8056),r(1025),r(19),r(9506),r(7165),r(2169),r(6939),r(6372),r(3797),r(8454),r(2073),r(4905),r(482),r(2155),r(8124),r(25),r(955),r(7628),r(7193),r(6298),r(2696),r(3128),n)},6440:function(e,t,r){var n;e.exports=(n=r(9021),function(){if("function"==typeof ArrayBuffer){var e=n.lib.WordArray,t=e.init,r=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)};r.prototype=e}}(),n.lib.WordArray)},4636:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=e[t+0],c=e[t+1],d=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],v=e[t+7],b=e[t+8],w=e[t+9],_=e[t+10],k=e[t+11],S=e[t+12],E=e[t+13],T=e[t+14],C=e[t+15],A=o[0],x=o[1],I=o[2],R=o[3];A=u(A,x,I,R,s,7,a[0]),R=u(R,A,x,I,c,12,a[1]),I=u(I,R,A,x,d,17,a[2]),x=u(x,I,R,A,p,22,a[3]),A=u(A,x,I,R,g,7,a[4]),R=u(R,A,x,I,m,12,a[5]),I=u(I,R,A,x,y,17,a[6]),x=u(x,I,R,A,v,22,a[7]),A=u(A,x,I,R,b,7,a[8]),R=u(R,A,x,I,w,12,a[9]),I=u(I,R,A,x,_,17,a[10]),x=u(x,I,R,A,k,22,a[11]),A=u(A,x,I,R,S,7,a[12]),R=u(R,A,x,I,E,12,a[13]),I=u(I,R,A,x,T,17,a[14]),A=l(A,x=u(x,I,R,A,C,22,a[15]),I,R,c,5,a[16]),R=l(R,A,x,I,y,9,a[17]),I=l(I,R,A,x,k,14,a[18]),x=l(x,I,R,A,s,20,a[19]),A=l(A,x,I,R,m,5,a[20]),R=l(R,A,x,I,_,9,a[21]),I=l(I,R,A,x,C,14,a[22]),x=l(x,I,R,A,g,20,a[23]),A=l(A,x,I,R,w,5,a[24]),R=l(R,A,x,I,T,9,a[25]),I=l(I,R,A,x,p,14,a[26]),x=l(x,I,R,A,b,20,a[27]),A=l(A,x,I,R,E,5,a[28]),R=l(R,A,x,I,d,9,a[29]),I=l(I,R,A,x,v,14,a[30]),A=h(A,x=l(x,I,R,A,S,20,a[31]),I,R,m,4,a[32]),R=h(R,A,x,I,b,11,a[33]),I=h(I,R,A,x,k,16,a[34]),x=h(x,I,R,A,T,23,a[35]),A=h(A,x,I,R,c,4,a[36]),R=h(R,A,x,I,g,11,a[37]),I=h(I,R,A,x,v,16,a[38]),x=h(x,I,R,A,_,23,a[39]),A=h(A,x,I,R,E,4,a[40]),R=h(R,A,x,I,s,11,a[41]),I=h(I,R,A,x,p,16,a[42]),x=h(x,I,R,A,y,23,a[43]),A=h(A,x,I,R,w,4,a[44]),R=h(R,A,x,I,S,11,a[45]),I=h(I,R,A,x,C,16,a[46]),A=f(A,x=h(x,I,R,A,d,23,a[47]),I,R,s,6,a[48]),R=f(R,A,x,I,v,10,a[49]),I=f(I,R,A,x,T,15,a[50]),x=f(x,I,R,A,m,21,a[51]),A=f(A,x,I,R,S,6,a[52]),R=f(R,A,x,I,p,10,a[53]),I=f(I,R,A,x,_,15,a[54]),x=f(x,I,R,A,c,21,a[55]),A=f(A,x,I,R,b,6,a[56]),R=f(R,A,x,I,C,10,a[57]),I=f(I,R,A,x,y,15,a[58]),x=f(x,I,R,A,E,21,a[59]),A=f(A,x,I,R,g,6,a[60]),R=f(R,A,x,I,k,10,a[61]),I=f(I,R,A,x,d,15,a[62]),x=f(x,I,R,A,w,21,a[63]),o[0]=o[0]+A|0,o[1]=o[1]+x|0,o[2]=o[2]+I|0,o[3]=o[3]+R|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<<o|a>>>32-o)+t}function l(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<<o|a>>>32-o)+t}function h(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<<o|a>>>32-o)+t}function f(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<<o|a>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),n.MD5)},2169:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.mode.CFB=function(){var e=n.lib.BlockCipherMode.extend();function t(e,t,r,n){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize;t.call(this,e,r,i,n),this._prevBlock=e.slice(r,r+i)}}),e.Decryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize,o=e.slice(r,r+i);t.call(this,e,r,i,n),this._prevBlock=o}}),e}(),n.mode.CFB)},6372:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.mode.CTRGladman=function(){var e=n.lib.BlockCipherMode.extend();function t(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function r(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var i=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),r(s);var a=s.slice(0);n.encryptBlock(a,0);for(var c=0;c<i;c++)e[t+c]^=a[c]}});return e.Decryptor=i,e}(),n.mode.CTRGladman)},6939:function(e,t,r){var n,i,o;e.exports=(o=r(9021),r(7165),o.mode.CTR=(n=o.lib.BlockCipherMode.extend(),i=n.Encryptor=n.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0);var s=o.slice(0);r.encryptBlock(s,0),o[n-1]=o[n-1]+1|0;for(var a=0;a<n;a++)e[t+a]^=s[a]}}),n.Decryptor=i,n),o.mode.CTR)},8454:function(e,t,r){var n,i;e.exports=(i=r(9021),r(7165),i.mode.ECB=((n=i.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),n.Decryptor=n.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),n),i.mode.ECB)},3797:function(e,t,r){var n,i,o;e.exports=(o=r(9021),r(7165),o.mode.OFB=(n=o.lib.BlockCipherMode.extend(),i=n.Encryptor=n.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._keystream;i&&(o=this._keystream=i.slice(0),this._iv=void 0),r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}}),n.Decryptor=i,n),o.mode.OFB)},2073:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,i=n-r%n,o=r+i-1;e.clamp(),e.words[o>>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Ansix923)},4905:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.Iso10126={pad:function(e,t){var r=4*t,i=r-e.sigBytes%r;e.concat(n.lib.WordArray.random(i-1)).concat(n.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Iso10126)},482:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.Iso97971={pad:function(e,t){e.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(e,t)},unpad:function(e){n.pad.ZeroPadding.unpad(e),e.sigBytes--}},n.pad.Iso97971)},8124:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding)},2155:function(e,t,r){var n;e.exports=(n=r(9021),r(7165),n.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},n.pad.ZeroPadding)},19:function(e,t,r){var n,i,o,s,a,c,u,l,h;e.exports=(h=r(9021),r(3009),r(1025),i=(n=h).lib,o=i.Base,s=i.WordArray,a=n.algo,c=a.SHA256,u=a.HMAC,l=a.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=u.create(r.hasher,e),i=s.create(),o=s.create([1]),a=i.words,c=o.words,l=r.keySize,h=r.iterations;a.length<l;){var f=n.update(t).finalize(o);n.reset();for(var d=f.words,p=d.length,g=f,m=1;m<h;m++){g=n.finalize(g),n.reset();for(var y=g.words,v=0;v<p;v++)d[v]^=y[v]}i.concat(f),c[0]++}return i.sigBytes=4*l,i}}),n.PBKDF2=function(e,t,r){return l.create(r).compute(e,t)},h.PBKDF2)},2696:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(n[0]^=u,n[1]^=h,n[2]^=l,n[3]^=f,n[4]^=u,n[5]^=h,n[6]^=l,n[7]^=f,i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,c=((i*i>>>17)+i*a>>>15)+a*a,u=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),n.RabbitLegacy)},6298:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(i[0]^=u,i[1]^=h,i[2]^=l,i[3]^=f,i[4]^=u,i[5]^=h,i[6]^=l,i[7]^=f,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,c=((i*i>>>17)+i*a>>>15)+a*a,u=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),n.Rabbit)},7193:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=r.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var o=0;i<256;i++){var s=i%r,a=t[s>>>2]>>>24-s%4*8&255;o=(o+n[i]+a)%256;var c=n[i];n[i]=n[o],n[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}e.RC4=t._createHelper(i);var s=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(),n.RC4)},8056:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=i.create([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=i.create([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=i.create([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]),l=i.create([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]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),f=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=s.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,s,d,w,_,k,S,E,T,C,A,x=this._hash.words,I=h.words,R=f.words,P=a.words,M=c.words,O=u.words,B=l.words;for(k=o=x[0],S=s=x[1],E=d=x[2],T=w=x[3],C=_=x[4],r=0;r<80;r+=1)A=o+e[t+P[r]]|0,A+=r<16?p(s,d,w)+I[0]:r<32?g(s,d,w)+I[1]:r<48?m(s,d,w)+I[2]:r<64?y(s,d,w)+I[3]:v(s,d,w)+I[4],A=(A=b(A|=0,O[r]))+_|0,o=_,_=w,w=b(d,10),d=s,s=A,A=k+e[t+M[r]]|0,A+=r<16?v(S,E,T)+R[0]:r<32?y(S,E,T)+R[1]:r<48?m(S,E,T)+R[2]:r<64?g(S,E,T)+R[3]:p(S,E,T)+R[4],A=(A=b(A|=0,B[r]))+C|0,k=C,C=T,T=b(E,10),E=S,S=A;A=x[1]+d+T|0,x[1]=x[2]+w+C|0,x[2]=x[3]+_+k|0,x[3]=x[4]+o+S|0,x[4]=x[0]+s+E|0,x[0]=A},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function g(e,t,r){return e&t|~e&r}function m(e,t,r){return(e|~t)^r}function y(e,t,r){return e&r|t&~r}function v(e,t,r){return e^(t|~r)}function b(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(d),t.HmacRIPEMD160=o._createHmacHelper(d)}(Math),n.RIPEMD160)},5471:function(e,t,r){var n,i,o,s,a,c,u,l;e.exports=(l=r(9021),i=(n=l).lib,o=i.WordArray,s=i.Hasher,a=n.algo,c=[],u=a.SHA1=s.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=0;u<80;u++){if(u<16)c[u]=0|e[t+u];else{var l=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=l<<1|l>>>31}var h=(n<<5|n>>>27)+a+c[u];h+=u<20?1518500249+(i&o|~i&s):u<40?1859775393+(i^o^s):u<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,a=s,s=o,o=i<<30|i>>>2,i=n,n=h}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=s._createHelper(u),n.HmacSHA1=s._createHmacHelper(u),l.SHA1)},6308:function(e,t,r){var n,i,o,s,a,c;e.exports=(c=r(9021),r(3009),i=(n=c).lib.WordArray,o=n.algo,s=o.SHA256,a=o.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=s._createHelper(a),n.HmacSHA224=s._createHmacHelper(a),c.SHA224)},3009:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(a[i]=r(e.pow(n,.5))),c[i]=r(e.pow(n,1/3)),i++),n++}();var u=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],h=r[6],f=r[7],d=0;d<64;d++){if(d<16)u[d]=0|e[t+d];else{var p=u[d-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[d-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[d]=g+u[d-7]+y+u[d-16]}var v=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+c[d]+u[d];f=h,h=l,l=a,a=s+w|0,s=o,o=i,i=n,n=w+(b+v)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+h|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)},5953:function(e,t,r){var n;e.exports=(n=r(9021),r(3240),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.x64.Word,a=t.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var a=0,h=0,f=0;f<7;f++){if(1&i){var d=(1<<f)-1;d<32?h^=1<<d:a^=1<<d-32}128&i?i=i<<1^113:i<<=1}l[o]=s.create(a,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=s.create()}();var f=a.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var o=e[t+2*i],s=e[t+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(x=r[i]).high^=s,x.low^=o}for(var a=0;a<24;a++){for(var f=0;f<5;f++){for(var d=0,p=0,g=0;g<5;g++)d^=(x=r[f+5*g]).high,p^=x.low;var m=h[f];m.high=d,m.low=p}for(f=0;f<5;f++){var y=h[(f+4)%5],v=h[(f+1)%5],b=v.high,w=v.low;for(d=y.high^(b<<1|w>>>31),p=y.low^(w<<1|b>>>31),g=0;g<5;g++)(x=r[f+5*g]).high^=d,x.low^=p}for(var _=1;_<25;_++){var k=(x=r[_]).high,S=x.low,E=c[_];E<32?(d=k<<E|S>>>32-E,p=S<<E|k>>>32-E):(d=S<<E-32|k>>>64-E,p=k<<E-32|S>>>64-E);var T=h[u[_]];T.high=d,T.low=p}var C=h[0],A=r[0];for(C.high=A.high,C.low=A.low,f=0;f<5;f++)for(g=0;g<5;g++){var x=r[_=f+5*g],I=h[_],R=h[(f+1)%5+5*g],P=h[(f+2)%5+5*g];x.high=I.high^~R.high&P.high,x.low=I.low^~R.low&P.low}x=r[0];var M=l[a];x.high^=M.high,x.low^=M.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,u=[],l=0;l<c;l++){var h=s[l],f=h.high,d=h.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),u.push(d),u.push(f)}return new i.init(u,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(f),t.HmacSHA3=o._createHmacHelper(f)}(Math),n.SHA3)},9557:function(e,t,r){var n,i,o,s,a,c,u,l;e.exports=(l=r(9021),r(3240),r(1380),i=(n=l).x64,o=i.Word,s=i.WordArray,a=n.algo,c=a.SHA512,u=a.SHA384=c.extend({_doReset:function(){this._hash=new s.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=c._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=c._createHelper(u),n.HmacSHA384=c._createHmacHelper(u),l.SHA384)},1380:function(e,t,r){var n;e.exports=(n=r(9021),r(3240),function(){var e=n,t=e.lib.Hasher,r=e.x64,i=r.Word,o=r.WordArray,s=e.algo;function a(){return i.create.apply(i,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var l=s.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],h=r[6],f=r[7],d=n.high,p=n.low,g=i.high,m=i.low,y=o.high,v=o.low,b=s.high,w=s.low,_=a.high,k=a.low,S=l.high,E=l.low,T=h.high,C=h.low,A=f.high,x=f.low,I=d,R=p,P=g,M=m,O=y,B=v,N=b,L=w,D=_,U=k,j=S,F=E,z=T,V=C,q=A,W=x,H=0;H<80;H++){var K,G,$=u[H];if(H<16)G=$.high=0|e[t+2*H],K=$.low=0|e[t+2*H+1];else{var Q=u[H-15],J=Q.high,Y=Q.low,X=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Z=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=u[H-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=u[H-7],se=oe.high,ae=oe.low,ce=u[H-16],ue=ce.high,le=ce.low;G=(G=(G=X+se+((K=Z+ae)>>>0<Z>>>0?1:0))+ne+((K+=ie)>>>0<ie>>>0?1:0))+ue+((K+=le)>>>0<le>>>0?1:0),$.high=G,$.low=K}var he,fe=D&j^~D&z,de=U&F^~U&V,pe=I&P^I&O^P&O,ge=R&M^R&B^M&B,me=(I>>>28|R<<4)^(I<<30|R>>>2)^(I<<25|R>>>7),ye=(R>>>28|I<<4)^(R<<30|I>>>2)^(R<<25|I>>>7),ve=(D>>>14|U<<18)^(D>>>18|U<<14)^(D<<23|U>>>9),be=(U>>>14|D<<18)^(U>>>18|D<<14)^(U<<23|D>>>9),we=c[H],_e=we.high,ke=we.low,Se=q+ve+((he=W+be)>>>0<W>>>0?1:0),Ee=ye+ge;q=z,W=V,z=j,V=F,j=D,F=U,D=N+(Se=(Se=(Se=Se+fe+((he+=de)>>>0<de>>>0?1:0))+_e+((he+=ke)>>>0<ke>>>0?1:0))+G+((he+=K)>>>0<K>>>0?1:0))+((U=L+he|0)>>>0<L>>>0?1:0)|0,N=O,L=B,O=P,B=M,P=I,M=R,I=Se+(me+pe+(Ee>>>0<ye>>>0?1:0))+((R=he+Ee|0)>>>0<he>>>0?1:0)|0}p=n.low=p+R,n.high=d+I+(p>>>0<R>>>0?1:0),m=i.low=m+M,i.high=g+P+(m>>>0<M>>>0?1:0),v=o.low=v+B,o.high=y+O+(v>>>0<B>>>0?1:0),w=s.low=w+L,s.high=b+N+(w>>>0<L>>>0?1:0),k=a.low=k+U,a.high=_+D+(k>>>0<U>>>0?1:0),E=l.low=E+F,l.high=S+j+(E>>>0<F>>>0?1:0),C=h.low=C+V,h.high=T+z+(C>>>0<V>>>0?1:0),x=f.low=x+W,f.high=A+q+(x>>>0<W>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),n.SHA512)},7628:function(e,t,r){var n;e.exports=(n=r(9021),r(754),r(4636),r(9506),r(7165),function(){var e=n,t=e.lib,r=t.WordArray,i=t.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],l=c[o];for(r=0;r<24;r++)u[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(r=0;r<16;r++)h[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=u[c][((s^i[c])&l[c])>>>0];this._lBlock=s,this._rBlock=o^a}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,f.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function d(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=i._createHelper(h);var p=o.TripleDES=i.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),n=e.length<4?e.slice(0,2):e.slice(2,4),i=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=h.createEncryptor(r.create(t)),this._des2=h.createEncryptor(r.create(n)),this._des3=h.createEncryptor(r.create(i))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(p)}(),n.TripleDES)},3240:function(e,t,r){var n;e.exports=(n=r(9021),function(e){var t=n,r=t.lib,i=r.Base,o=r.WordArray,s=t.x64={};s.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=i.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:8*t.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return o.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),n)},7007:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){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 h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function f(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):p(i,i.length)}function d(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 p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(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(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.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},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(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},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(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,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;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,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.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,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[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},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},3790:(e,t,r)=>{e.exports=function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){var r=t[s][1][e];return i(r||e)}),u,u.exports,e,t,r,n)}return r[s].exports}for(var o=void 0,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,n){(function(e){var r,n,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,s=new i(l),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),r=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var c=new e.MessageChannel;c.port1.onmessage=l,r=function(){c.port2.postMessage(0)}}var u=[];function l(){var e,t;n=!0;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}n=!1}function h(e){1!==u.push(e)||n||r()}t.exports=h}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&d(this,e)}function l(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function h(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return o.reject(e,t)}n===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,n)}))}function f(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1;function n(t){r||(r=!0,o.reject(e,t))}function i(t){r||(r=!0,o.resolve(e,t))}function s(){t(i,n)}var a=p(s);"error"===a.status&&n(a.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}function g(e){return e instanceof this?e:o.resolve(new this(i),e)}function m(e){var t=new this(i);return o.reject(t,e)}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var s=new Array(r),a=0,c=-1,u=new this(i);++c<r;)l(e[c],c);return u;function l(e,i){function c(e){s[i]=e,++a!==r||n||(n=!0,o.resolve(u,s))}t.resolve(e).then(c,(function(e){n||(n=!0,o.reject(u,e))}))}}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var s=-1,a=new this(i);++s<r;)c(e[s]);return a;function c(e){t.resolve(e).then((function(e){n||(n=!0,o.resolve(a,e))}),(function(e){n||(n=!0,o.reject(a,e))}))}}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var r=new this.constructor(i);return this.state!==c?h(r,this.state===a?e:t,this.outcome):this.queue.push(new l(r,e,t)),r},l.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){o.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},o.resolve=function(e,t){var r=p(f,t);if("error"===r.status)return o.reject(e,r.value);var n=r.value;if(n)d(e,n);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=g,u.reject=m,u.all=y,u.race=v},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var 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};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var s=o();function a(){try{if(!s||!s.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function c(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var u=Promise;function l(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function h(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function d(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},y=Object.prototype.toString,v="readonly",b="readwrite";function w(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}function _(e){return new u((function(t){var r=e.transaction(p,b),n=c([""]);r.objectStore(p).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function k(e){return"boolean"==typeof g?u.resolve(g):_(e).then((function(e){return g=e}))}function S(e){var t=m[e.name],r={};r.promise=new u((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function E(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var r=m[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function C(e,t){return new u((function(r,n){if(m[e.name]=m[e.name]||L(),e.db){if(!t)return r(e.db);S(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=s.open.apply(s,i);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(p)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),E(e)}}))}function A(e){return C(e,!1)}function x(e){return C(e,!0)}function I(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function R(e){return new u((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}function P(e){return c([w(atob(e.data))],{type:e.type})}function M(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,r=t._initReady().then((function(){var e=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(r,e,e),r}function B(e){S(e);for(var t=m[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,A(e).then((function(t){return e.db=t,I(e)?x(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw T(e,t),t}))}function N(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return u.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),x(e)})).then((function(){return B(e).then((function(){N(e,t,r,n-1)}))})).catch(r);r(i)}}function L(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function D(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=m[r.name];i||(i=L(),m[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var o=[];function s(){return u.resolve()}for(var a=0;a<i.forages.length;a++){var c=i.forages[a];c!==t&&o.push(c._initReady().catch(s))}var l=i.forages.slice(0);return u.all(o).then((function(){return r.db=i.db,A(r)})).then((function(e){return r.db=e,I(r,t._defaultConfig.version)?x(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<l.length;n++){var o=l[n];o!==t&&(o._dbInfo.db=r.db,o._dbInfo.version=r.version)}}))}function U(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){N(r._dbInfo,v,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),M(e)&&(e=P(e)),t(e)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function j(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){N(r._dbInfo,v,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var r=s.result;if(r){var n=r.value;M(n)&&(n=P(n));var i=e(n,r.key,a++);void 0!==i?t(i):r.continue()}else t()},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function F(e,t,r){var n=this;e=f(e);var i=new u((function(r,i){var o;n.ready().then((function(){return o=n._dbInfo,"[object Blob]"===y.call(t)?k(o.db).then((function(e){return e?t:R(t)})):t})).then((function(t){N(n._dbInfo,b,(function(o,s){if(o)return i(o);try{var a=s.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),r(t)},s.onabort=s.onerror=function(){var e=c.error?c.error:c.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return l(i,r),i}function z(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){N(r._dbInfo,b,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){n(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function V(e){var t=this,r=new u((function(e,r){t.ready().then((function(){N(t._dbInfo,b,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return l(r,e),r}function q(e){var t=this,r=new u((function(e,r){t.ready().then((function(){N(t._dbInfo,v,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return l(r,e),r}function W(e,t){var r=this,n=new u((function(t,n){e<0?t(null):r.ready().then((function(){N(r._dbInfo,v,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName),a=!1,c=s.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||a?t(r.key):(a=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}}))})).catch(n)}));return l(n,t),n}function H(e){var t=this,r=new u((function(e,r){t.ready().then((function(){N(t._dbInfo,v,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var t=o.result;t?(s.push(t.key),t.continue()):e(s)},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return l(r,e),r}function K(e,t){t=d.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var o=e.name===r.name&&i._dbInfo.db?u.resolve(i._dbInfo.db):A(e).then((function(t){var r=m[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));n=e.storeName?o.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;S(e);var n=m[e.name],i=n.forages;t.close();for(var o=0;o<i.length;o++){var a=i[o];a._dbInfo.db=null,a._dbInfo.version=r}var c=new u((function(t,n){var i=s.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}));return c.then((function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,E(r._dbInfo)}})).catch((function(t){throw(T(e,t)||u.resolve()).catch((function(){})),t}))}})):o.then((function(t){S(e);var r=m[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;var o=new u((function(t,r){var n=s.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return o.then((function(e){r.db=e;for(var t=0;t<n.length;t++)E(n[t]._dbInfo)})).catch((function(t){throw(T(e,t)||u.resolve()).catch((function(){})),t}))}))}else n=u.reject("Invalid arguments");return l(n,t),n}var G={_driver:"asyncStorage",_initStorage:D,_support:a(),iterate:j,getItem:U,setItem:F,removeItem:z,clear:V,length:q,key:W,keys:H,dropInstance:K};function $(){return"function"==typeof openDatabase}var Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J="~~local_forage_type~",Y=/^~~local_forage_type~([^~]+)~/,X="__lfsc__:",Z=X.length,ee="arbf",te="blob",re="si08",ne="ui08",ie="uic8",oe="si16",se="si32",ae="ur16",ce="ui32",ue="fl32",le="fl64",he=Z+ee.length,fe=Object.prototype.toString;function de(e){var t,r,n,i,o,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var u=new ArrayBuffer(s),l=new Uint8Array(u);for(t=0;t<a;t+=4)r=Q.indexOf(e[t]),n=Q.indexOf(e[t+1]),i=Q.indexOf(e[t+2]),o=Q.indexOf(e[t+3]),l[c++]=r<<2|n>>4,l[c++]=(15&n)<<4|i>>2,l[c++]=(3&i)<<6|63&o;return u}function pe(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=Q[r[t]>>2],n+=Q[(3&r[t])<<4|r[t+1]>>4],n+=Q[(15&r[t+1])<<2|r[t+2]>>6],n+=Q[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function ge(e,t){var r="";if(e&&(r=fe.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===fe.call(e.buffer))){var n,i=X;e instanceof ArrayBuffer?(n=e,i+=ee):(n=e.buffer,"[object Int8Array]"===r?i+=re:"[object Uint8Array]"===r?i+=ne:"[object Uint8ClampedArray]"===r?i+=ie:"[object Int16Array]"===r?i+=oe:"[object Uint16Array]"===r?i+=ae:"[object Int32Array]"===r?i+=se:"[object Uint32Array]"===r?i+=ce:"[object Float32Array]"===r?i+=ue:"[object Float64Array]"===r?i+=le:t(new Error("Failed to get type for BinaryArray"))),t(i+pe(n))}else if("[object Blob]"===r){var o=new FileReader;o.onload=function(){var r=J+e.type+"~"+pe(this.result);t(X+te+r)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}}function me(e){if(e.substring(0,Z)!==X)return JSON.parse(e);var t,r=e.substring(he),n=e.substring(Z,he);if(n===te&&Y.test(r)){var i=r.match(Y);t=i[1],r=r.substring(i[0].length)}var o=de(r);switch(n){case ee:return o;case te:return c([o],{type:t});case re:return new Int8Array(o);case ne:return new Uint8Array(o);case ie:return new Uint8ClampedArray(o);case oe:return new Int16Array(o);case ae:return new Uint16Array(o);case se:return new Int32Array(o);case ce:return new Uint32Array(o);case ue:return new Float32Array(o);case le:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}}var ye={serialize:ge,deserialize:me,stringToBuffer:de,bufferToString:pe};function ve(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function be(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new u((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){ve(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=ye,i}function we(e,t,r,n,i,o){e.executeSql(r,n,i,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?o(e,s):ve(e,t,(function(){e.executeSql(r,n,i,o)}),o)}),o):o(e,s)}),o)}function _e(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function ke(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var o=n.rows,s=o.length,a=0;a<s;a++){var c=o.item(a),u=c.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=e(u,c.key,a+1)))return void t(u)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Se(e,t,r,n){var i=this;e=f(e);var o=new u((function(o,s){i.ready().then((function(){void 0===t&&(t=null);var a=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,u){u?s(u):c.db.transaction((function(r){we(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){o(a)}),(function(e,t){s(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void o(Se.apply(i,[e,a,r,n-1]));s(t)}}))}))})).catch(s)}));return l(o,r),o}function Ee(e,t,r){return Se.apply(this,[e,t,r,1])}function Te(e,t){var r=this;e=f(e);var n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Ce(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Ae(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function xe(e,t){var r=this,n=new u((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){we(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return l(n,t),n}function Ie(e){var t=this,r=new u((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){we(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return l(r,e),r}function Re(e){return new u((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],o=0;o<n.rows.length;o++)i.push(n.rows.item(o).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}function Pe(e,t){t=d.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return l(n=e.name?new u((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(Re(n))})).then((function(e){return new u((function(t,r){e.db.transaction((function(n){function i(e){return new u((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var o=[],s=0,a=e.storeNames.length;s<a;s++)o.push(i(e.storeNames[s]));u.all(o).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):u.reject("Invalid arguments"),t),n}var Me={_driver:"webSQLStorage",_initStorage:be,_support:$(),iterate:ke,getItem:_e,setItem:Ee,removeItem:Te,clear:Ce,length:Ae,key:xe,keys:Ie,dropInstance:Pe};function Oe(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Be(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Ne(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Le(){return!Ne()||localStorage.length>0}function De(e){var t=this,r={};if(e)for(var n in e)r[n]=e[n];return r.keyPrefix=Be(e,t._defaultConfig),Le()?(t._dbInfo=r,r.serializer=ye,u.resolve()):u.reject()}function Ue(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return l(r,e),r}function je(e,t){var r=this;e=f(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return l(n,t),n}function Fe(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,o=localStorage.length,s=1,a=0;a<o;a++){var c=localStorage.key(a);if(0===c.indexOf(n)){var u=localStorage.getItem(c);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,c.substring(i),s++)))return u}}}));return l(n,t),n}function ze(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return l(n,t),n}function Ve(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var o=localStorage.key(i);0===o.indexOf(e.keyPrefix)&&n.push(o.substring(e.keyPrefix.length))}return n}));return l(r,e),r}function qe(e){var t=this.keys().then((function(e){return e.length}));return l(t,e),t}function We(e,t){var r=this;e=f(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return l(n,t),n}function He(e,t,r){var n=this;e=f(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new u((function(i,o){var s=n._dbInfo;s.serializer.serialize(t,(function(t,n){if(n)o(n);else try{localStorage.setItem(s.keyPrefix+e,t),i(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}}))}))}));return l(i,r),i}function Ke(e,t){if(t=d.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new u((function(t){e.storeName?t(Be(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):u.reject("Invalid arguments"),l(n,t),n}var Ge={_driver:"localStorageWrapper",_initStorage:De,_support:Oe(),iterate:Fe,getItem:je,setItem:He,removeItem:We,clear:Ue,length:qe,key:ze,keys:Ve,dropInstance:Ke},$e=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Qe=function(e,t){for(var r=e.length,n=0;n<r;){if($e(e[n],t))return!0;n++}return!1},Je=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Ye={},Xe={},Ze={INDEXEDDB:G,WEBSQL:Me,LOCALSTORAGE:Ge},et=[Ze.INDEXEDDB._driver,Ze.WEBSQL._driver,Ze.LOCALSTORAGE._driver],tt=["dropInstance"],rt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),nt={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function it(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function ot(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(Je(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var st=function(){function e(t){for(var r in i(this,e),Ze)if(Ze.hasOwnProperty(r)){var n=Ze[r],o=n._driver;this[r]=o,Ye[o]||this.defineDriver(n)}this._defaultConfig=ot({},nt),this._config=ot({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new u((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var o=rt.concat("_initStorage"),s=0,a=o.length;s<a;s++){var c=o[s];if((!Qe(tt,c)||e[c])&&"function"!=typeof e[c])return void r(i)}var h=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=u.reject(t);return l(r,arguments[arguments.length-1]),r}},r=0,n=tt.length;r<n;r++){var i=tt[r];e[i]||(e[i]=t(i))}};h();var f=function(r){Ye[n]&&console.info("Redefining LocalForage driver: "+n),Ye[n]=e,Xe[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(f,r):f(!!e._support):f(!0)}catch(e){r(e)}}));return h(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=Ye[e]?u.resolve(Ye[e]):u.reject(new Error("Driver not found."));return h(n,t,r),n},e.prototype.getSerializer=function(e){var t=u.resolve(ye);return h(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return h(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;Je(e)||(e=[e]);var i=this._getSupportedDrivers(e);function o(){n._config.driver=n.driver()}function s(e){return n._extend(e),o(),n._ready=n._initStorage(n._config),n._ready}function a(e){return function(){var t=0;function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(r)}o();var a=new Error("No available storage method found.");return n._driverSet=u.reject(a),n._driverSet}return r()}}var c=null!==this._driverSet?this._driverSet.catch((function(){return u.resolve()})):u.resolve();return this._driverSet=c.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,o(),n._wrapLibraryMethodsWithReady(),n._initDriver=a(i)}))})).catch((function(){o();var e=new Error("No available storage method found.");return n._driverSet=u.reject(e),n._driverSet})),h(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!Xe[e]},e.prototype._extend=function(e){ot(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=rt.length;e<t;e++)it(this,rt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new st;t.exports=at},{3:3}]},{},[4])(4)},5602:e=>{var t=e.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(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))},7363:(e,t,r)=>{var n=r(5020),i=r(3804);r(5602),t.M9=i,t.qg=n.parse,n.parseParams,n.parseFmtpConfig,n.parsePayloads,n.parseRemoteCandidates,n.parseImageAttributes,n.parseSimulcastStreamList},5020:(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 o=e.push?{}:i?t[e.name]:t;!function(e,t,r,i){if(i&&!r)t[i]=n(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(t[r[o]]=n(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},o=r(5602),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},r=[],n=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),n=r[r.length-1]);for(var a=0;a<(o[t]||[]).length;a+=1){var c=o[t][a];if(c.reg.test(s))return i(c,n,s)}})),t.media=r,t};var a=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};t.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.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},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.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}}))}))}},3804:(e,t,r)=>{var n=r(5602),i=/%[sdv%]/g,o=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""}}))},s=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 s=t.names[i];t.name?n.push(r[t.name][s]):n.push(r[t.names[i]])}else n.push(r[t.name]);return o.apply(null,n)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],c=["i","c","b","a"];e.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||a,i=t.innerOrder||c,o=[];return r.forEach((function(t){n[t].forEach((function(r){r.name in e&&null!=e[r.name]?o.push(s(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){o.push(s(t,r,e))}))}))})),e.media.forEach((function(e){o.push(s("m",n.m[0],e)),i.forEach((function(t){n[t].forEach((function(r){r.name in e&&null!=e[r.name]?o.push(s(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){o.push(s(t,r,e))}))}))}))})),o.join("\r\n")+"\r\n"}},5653:()=>{},8535:()=>{},9546:()=>{},2472:()=>{},477:()=>{},5995:()=>{},6351:e=>{e.exports={version:"0.4.0"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};r.d(n,{Yk:()=>Mr,Id:()=>i,Mz:()=>or,Ne:()=>O,bq:()=>L,hj:()=>o,h4:()=>u,dC:()=>c,xk:()=>l,J:()=>Sr,a7:()=>xr,s_:()=>Cr,VO:()=>Tr,VF:()=>Ir,M0:()=>Ar,$b:()=>J,WI:()=>Q,cp:()=>Rr,ez:()=>pr,EQ:()=>dr,$t:()=>mr,jL:()=>Hr,Ps:()=>Br,VV:()=>Or,_b:()=>M,dT:()=>Ht,CM:()=>B,Zq:()=>hr});class i{type;data;constructor(e,t){this.type=e,this.data=t}}let o=function(e){return e[e.Error=-1]="Error",e[e.Self=1]="Self",e[e.Kicked=2]="Kicked",e[e.Replace=3]="Replace",e[e.Timeout=4]="Timeout",e[e.Destroy=5]="Destroy",e}({});class s{static CHANNEL_UPDATE="channel_update";static JOIN_SUCCEED="join_succeed";static ME_UPDATE="me_update";static RECONNECTING="reconnecting";static RECONNECTED="reconnected";static DISCONNECTED="disconnected";static USER_JOIN="user_join";static USER_UPDATE="user_update";static USER_LEAVE="user_leave";static USER_TRACK_ADD="user_track_add";static USER_TRACK_UPDATE="user_track_update";static USER_TRACK_REMOVE="user_track_remove";static CUSTOM_MSG="custom_msg";static TRACK_MUTED="track_muted";static TRACK_UNMUTED="track_unmuted";static TRACK_ENDED="track_ended"}class a{static INFO_UPDATE="info_update";static MUTED="muted";static UNMUTED="unmuted";static ENDED="ended"}class c{type;data;constructor(e,t){this.type=e,this.data=t}}let u=function(e){return e[e.Error=-1]="Error",e[e.Self=1]="Self",e[e.Kicked=2]="Kicked",e[e.Timeout=4]="Timeout",e}({});class l{static ENABLE_SUCCEED="enable_succeed";static RECONNECTING="reconnecting";static RECONNECTED="reconnected";static DISCONNECTED="disconnected";static IM_MSG="im_msg"}var h=r(7007),f=r.n(h),d=r(1396),p=r(955),g=r.n(p);function m(){return"undefined"!=typeof uni&&"mp-weixin"===uni.getSystemInfoSync().uniPlatform||"undefined"==typeof uni&&"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfo}function y(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function v(e){return Object.keys(e).filter((t=>null!==e[t]&&void 0!==e[t])).reduce(((t,r)=>({...t,[r]:e[r]})),{})}function b(e){return"string"==typeof e}function w(){}class _{m_lastPromise=Promise.resolve();async lock(e=!1){let t=w;if(e)return t;const r=this.m_lastPromise;return this.m_lastPromise=new Promise((e=>t=e)),await r,t}}async function k(e){return new Promise((t=>{setTimeout(t,e)}))}function S(e,t){let r=!1;t={maxRetries:10,initialDelay:500,...t};let n=()=>new Promise(((n,i)=>{let o=0,s=async a=>{if(r)i("canceled");else try{if(o>0){if(t?.onRetry&&!1===t.onRetry(o,a))return void i("canceled");let e=Math.pow(2,o-1)*t.initialDelay;await k(e)}let r=await e();n(r)}catch(e){t.maxRetries>0&&o>=t.maxRetries?i("maxretry"):(o++,s(e))}};s()}));return n.cancel=()=>{r=!0},n}function E(e,t,r){let n=[];var i;return(i=t,Object.getOwnPropertyNames(i)).forEach((i=>{let o=!0;y(e[i])?JSON.stringify(e[i])!==JSON.stringify(t[i])&&(o=!1):e[i]!==t[i]&&(o=!1),o||(n.push({prop:i,value:t[i],old:e[i]}),r&&r[i]?r[i](t[i],e[i]):e[i]=t[i])})),n}function T(e,t=new Date){for(var r="",n=t.getMonth(),i=n+1,o=t.getDay(),s=t.getDate(),a=t.getFullYear(),c=t.getHours(),u=t.getMinutes(),l=t.getSeconds(),h=0,f=e.length;h<f;h++)switch(e[h]){case"j":r+=s;break;case"d":r+=s<10?"0"+s:s;break;case"l":var d=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");r+=d[o];break;case"w":r+=o;break;case"D":r+=(d=Array("Sun","Mon","Tue","Wed","Thr","Fri","Sat"))[o];break;case"m":r+=i<10?"0"+i:i;break;case"n":r+=i;break;case"F":var p=Array("January","February","March","April","May","June","July","August","September","October","November","December");r+=p[n];break;case"M":r+=(p=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"))[n];break;case"Y":r+=a;break;case"y":r+=a.toString().slice(-2);break;case"H":r+=c<10?"0"+c:c;break;case"g":var g=0===c?12:c;r+=g>12?g-12:g;break;case"h":r+=(g=(g=0===c?12:c)>12?g-12:g)<10?"0"+g:g;break;case"a":r+=c<12?"am":"pm";break;case"i":r+=u<10?"0"+u:u;break;case"s":r+=l<10?"0"+l:l;break;case"c":r+=t.toISOString();break;default:r+=e[h]}return r}function C(e,t){if(t<0)throw new Error("小数位数必须是非负整数");const r=Math.pow(10,t);return Math.round(e*r)/r}function A(e=18){e=e||32;let t="ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz1234567890",r="";for(let n=0;n<e;n++)r+=t.charAt(Math.floor(61*Math.random()));return r}function x(e){const t=e.match(/^(?:.+?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+)/im);return t&&t[1]?t[1]:""}function I(e){return JSON.parse(g().decrypt(e,d.enc.Utf8.parse("6o30j79YRE39bEwI"),{iv:d.enc.Utf8.parse("2apW3WiFl72ZVS3x"),padding:d.pad.Pkcs7,mode:d.mode.CBC}).toString(d.enc.Utf8))}function R(e){return e<=0?-60:Math.max(-60,Math.round(20*Math.log10(e)))}const P="__amixer__";let M=function(e){return e.Video="video",e.Audio="audio",e}({}),O=function(e){return e[e.H264=27]="H264",e[e.H265=36]="H265",e[e.AAC=15]="AAC",e[e.VP8=56]="VP8",e[e.VP9=57]="VP9",e[e.AV1=58]="AV1",e[e.OPUS=1398100047]="OPUS",e}({});function B(e){for(const[t,r]of Object.entries(O))if(r===e)return t;return""}class N extends(f()){info;uid;prevStats;constructor(e,t){super(),this.info=e,this.uid=t}get id(){return this.info.id}get kind(){return this.info.kind}get desc(){return this.info.desc}getInfo(){let e={...this.info};return e.props={...e.props},e}updateInfo(e){let t=E(this.info,e);return t.length>0&&this.emit(a.INFO_UPDATE,this),t}getUid(){return this.uid}strPrefix(){return"流轨道"}toString(){const e=[this.uid?`uid:${this.uid}`:null,this.info.desc?`desc:${this.info.desc}`:null,this.id?`id:${this.info.id}`:null].filter(Boolean);return this.strPrefix()+"["+e.join("; ")+"]"}}let L=function(e){return e[e.Unknown=0]="Unknown",e[e.Windows=1]="Windows",e[e.Android=2]="Android",e[e.IOS=3]="IOS",e[e.Linux=4]="Linux",e[e.MacOS=5]="MacOS",e[e.WebRTC=6]="WebRTC",e[e.XCX=7]="XCX",e}({});class D{code;msg;prefixCode(){return m()?"107":"106"}constructor(e,t=0){this.msg=e,this.code=t<1e3?Number(this.prefixCode()+String(t).padStart(3,"0")):t}static fromError(e){return new D(e.name+":"+e.message)}toString(){return`${this.code}: ${this.msg}`}toJSON(){return{code:this.code,msg:this.msg}}}const U=new D("您不在频道内",1),j=new D("token已过期",2),F=function(e){return new D(e||"流轨道不存在",3)};var z=r(3790),V=r.n(z);let q={keyPrefix:"",_driver:"localForageWxDriver",_initStorage:function(e){this.keyPrefix=e.name+"/"+e.storeName+"/"},_support:!!m(),getItem:function(e,t){return new Promise(((t,r)=>{try{t(wx.getStorageSync(this.keyPrefix+e))}catch(e){r(e)}}))},setItem:function(e,t,r){return new Promise(((r,n)=>{try{wx.setStorageSync(this.keyPrefix+e,t),r(t)}catch(e){n(e)}}))},removeItem:function(e,t){return new Promise(((t,r)=>{try{wx.removeStorageSync(this.keyPrefix+e),t()}catch(e){r(e)}}))},clear:async function(e){const t=(await this.keys()).map((e=>this.removeItem(e)));await Promise.all(t)},length:async function(e){return(await this.keys()).length},key:async function(e,t){return(await this.keys())[e]},keys:function(e){return new Promise(((e,t)=>{try{var r=this.keyPrefix.length;const t=wx.getStorageInfoSync();let i=[];for(let e=0;e<t.keys.length;e++){var n=t.keys[e];n.startsWith(this.keyPrefix)&&i.push(n.substring(r))}e(i)}catch(e){t(e)}}))},iterate:async function(e,t){const r=await this.keys();let n=1;for(var i=0;i<r.length;i++){const t=r[i];let o=e(await this.getItem(t),t,n++);if(void 0!==o)return o}},dropInstance:function(e,t){return this.clear()}},W=function(e){return e[e.Undefined=0]="Undefined",e[e.Trace=1]="Trace",e[e.Debug=5]="Debug",e[e.Info=9]="Info",e[e.Warn=13]="Warn",e[e.Error=17]="Error",e[e.FATAL=21]="FATAL",e}({}),H=function(e){return e.AppStart="app.start",e.AppResource="app.resource",e.AppNetwork="app.network",e.RtcEvtAudioInput="rtc.event.audioinput",e.RtcEvtAudioOutput="rtc.event.audiooutput",e.RtcEvtVideoInput="rtc.event.videoinput",e.RtcEvtVideoOutput="rtc.event.videooutput",e.RtcEvtRemoteStream="rtc.event.remotestream",e.RtcEvtConnection="rtc.event.connection",e.RtcMqtt="rtc.mqtt",e.RtcRequest="rtc.request",e.RtcOok="rtc.ook",e.RtcMarker="rtc.marker",e.RtcLog="rtc.log",e.AppLog="app.log",e}({});var K=function(e){return e[e.Log=0]="Log",e[e.Metric=1]="Metric",e}(K||{});class G{enabled;token;deviceID;deviceType;api;storage;workTimer;isWorking=!1;keyIdx=0;startTime=Date.now();constructor(e,t,r,n){this.enabled=n,this.token=e,this.deviceID=t,this.deviceType=r,this.api=new $(e.app_id,e.log_center,t,r,"vaZ7MQ45m0KRjJ2u"),n&&(r==L.XCX&&V().defineDriver(q),r==L.XCX?this.storage=V().createInstance({name:"rtcsdk",storeName:e.app_id+":"+e.uid,driver:q._driver}):this.storage=V().createInstance({name:"rtcsdk",storeName:e.app_id+":"+e.uid}),this.storage.ready().then((()=>{console.debug("localforage initialized",this.storage.driver()),this.work()})).catch((e=>{console.debug("localforage initialize error",e),this.storage=void 0})),this.workTimer=setInterval((()=>{this.work()}),6e4))}flush(){this.work()}shutdown(){clearInterval(this.workTimer)}async work(){if(this.enabled&&!this.isWorking){this.isWorking=!0;try{await this.upload()}catch(e){console.error("rtc日志上传报错",e)}finally{this.isWorking=!1}}}makeKey(e){let t=[e==K.Log?"log":"metric",this.startTime,this.keyIdx].join("_");return this.keyIdx++,t}async appendToStorage(e,t){if(!this.storage)return;let r=this.makeKey(e);await this.storage.setItem(r,t);let n=await this.storage.keys();if(n.length>=5e3){n.sort(((e,t)=>{let r=parseFloat(e.split("_").slice(1).join(".")),n=parseFloat(t.split("_").slice(1).join("."));return r<n?-1:r>n?1:0}));const e=n.slice(0,1e3).map((e=>this.storage.removeItem(e)));await Promise.all(e)}}async peekFromStorage(){if(!this.storage)return[];let e=await this.storage.keys();e.sort(((e,t)=>{let r=parseFloat(e.split("_").slice(1).join(".")),n=parseFloat(t.split("_").slice(1).join("."));return r<n?-1:r>n?1:0})),console.debug("rtclog storage count="+e.length);let t=[];for(let r=0;r<e.length;r++){let n=e[r],i={type:K.Log,key:n,content:void 0};if(n.startsWith("log_"))i.type=K.Log;else{if(!n.startsWith("metric_"))continue;i.type=K.Metric}if(i.content=await this.storage.getItem(n),i.content&&i.content.body&&Array.isArray(i.content.body)&&(i.content.body=JSON.stringify(i.content.body)),t.push(i),t.length>=500)break}return t}async removeStorage(e){if(!this.storage)return;const t=e.map((e=>this.storage.removeItem(e.key)));await Promise.all(t)}async upload(){let e=await this.peekFromStorage();if(0==e.length)return;let t={device_id:this.deviceID,device_type:this.deviceType,app_id:this.token.app_id,uid:this.token.uid,logs:[],metrics:[]};for(let r=0;r<e.length;r++){let n=e[r];n.type==K.Log?t.logs.push(n.content):n.type==K.Metric&&t.metrics.push(n.content)}await this.api.push(t),await this.removeStorage(e)}async addLog({body:e,level:t=W.Undefined,type:r=H.AppLog}){if(!this.enabled)return;let n={time:Date.now(),type:r,serverity:t,channel:"channel"in this.token?this.token.channel:void 0,attr:y(e)?e:{},body:y(e)?"":b(e)?e:JSON.stringify(e)};return await this.appendToStorage(K.Log,n)}async addMetric(e){if(this.enabled)return e.time=Date.now(),e.channel="channel"in this.token?this.token.channel:void 0,await this.appendToStorage(K.Metric,e)}}class ${appID;serverPrefix;deviceID;deviceType;logSecretKey;logToken;constructor(e,t,r,n,i){this.appID=e,"/"!==t.substring(t.length-1)&&(t+="/"),t+="v1/",this.serverPrefix=t,this.deviceID=r,this.deviceType=n,this.logSecretKey=i}async refreshToken(){let e={app_id:this.appID,device_id:this.deviceID,device_type:this.deviceType,requested_at:Date.now()};e.sign=this.signutreRequest(e);let t=await this.request("auth/gettoken",e);if(0!=t.code)throw new D("获取rtc日志中心token失败: "+t.msg,t.code);this.logToken=t.data.token}async push(e){this.logToken||await this.refreshToken();let t=await this.request("data/push",e);if(10041==t.code||10042==t.code||10043==t.code)return this.logToken="",this.push(e);if(0!=t.code)throw new D(t.msg,t.code);console.debug("上传rtc日志成功")}signutreRequest(e){let t,r=[];for(t in e)r.push(t+"="+e[t]);r.sort();let n=r.join("&")+"&"+this.logSecretKey;return(0,d.SHA256)(n).toString()}request(e,t){let r=this.serverPrefix+e,n={"Content-Type":"application/json;charset=UTF-8"};return this.logToken&&(n.Authorization="Bearer "+this.logToken),this.deviceType==L.XCX?new Promise(((e,i)=>{wx.request({url:r,method:"POST",header:n,data:JSON.stringify(t),success(t){if(200!=t.statusCode)i(new Error(t.statusCode+":"+t.errMsg));else{let r=t.data;e(r)}},fail:function(e){i(new Error(e.errMsg))}})})):new Promise(((e,i)=>{fetch(r,{method:"POST",headers:n,body:JSON.stringify(t)}).then((t=>{200!=t.status?i(new Error(t.status+":"+t.statusText)):t.json().then((t=>{e(t)})).catch((e=>{i(e)}))})).catch((e=>{i(e)}))}))}}let Q=function(e){return e.CONSOLE="console",e.WXREALTIME="wxrealtime",e.NONE="none",e}({}),J=function(e){return e.DEBUG="debug",e.INFO="info",e.WARN="warn",e.ERROR="error",e}({});class Y{logTarget=Q.CONSOLE;logLevel=J.INFO;center;dftPrefix;dftCenterLogType;constructor(e="rtc",t=H.RtcLog){this.dftPrefix=e,this.dftCenterLogType=t}setTarget(e){this.logTarget=e}setLevel(e){this.logLevel=e}logCss="border: 1px solid; padding:2px 5px; border-radius: 3px";getPrefix(e){return`%c ${T("H:i:s")} ${this.dftPrefix}_${e}`}debug(...e){if(this.logTarget!=Q.NONE&&(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).debug(this.dftPrefix+"_debug",...e),this.center?.addLog({level:W.Debug,type:this.dftCenterLogType,body:e}),this.logLevel===J.DEBUG))switch(this.logTarget){case Q.CONSOLE:return console.debug(this.getPrefix("debug"),this.logCss,...e);case Q.WXREALTIME:return wx.getRealtimeLogManager().info(this.dftPrefix+"_debug",...e)}}info(...e){if(this.logTarget!=Q.NONE&&(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).info(this.dftPrefix+"_info",...e),this.center?.addLog({level:W.Info,type:this.dftCenterLogType,body:e}),this.logLevel===J.DEBUG||this.logLevel===J.INFO))switch(this.logTarget){case Q.CONSOLE:return console.log(this.getPrefix("info"),this.logCss,...e);case Q.WXREALTIME:return wx.getRealtimeLogManager().info(this.dftPrefix+"_info",...e)}}warn(...e){if(this.logTarget!=Q.NONE&&(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).warn(this.dftPrefix+"_warn",...e),this.center?.addLog({level:W.Warn,type:this.dftCenterLogType,body:e}),this.logLevel===J.DEBUG||this.logLevel===J.INFO||this.logLevel===J.WARN))switch(this.logTarget){case Q.CONSOLE:return console.warn(this.getPrefix("warn"),this.logCss,...e);case Q.WXREALTIME:return wx.getRealtimeLogManager().warn(this.dftPrefix+"_warn",...e)}}error(...e){if(this.logTarget!=Q.NONE)switch(this.snapshotArgs(e),m()&&wx.getLogManager({level:1}).warn(this.dftPrefix+"_error",...e),console.error(this.getPrefix("error"),this.logCss,...e),this.center?.addLog({level:W.Error,type:this.dftCenterLogType,body:e}),this.logTarget){case Q.CONSOLE:return;case Q.WXREALTIME:return wx.getRealtimeLogManager().error(this.dftPrefix+"_error",...e)}}snapshotArgs(e){e.forEach(((t,r)=>{y(t)&&(t instanceof Error?e[r]=t.toString():e[r]=JSON.parse(JSON.stringify(t)))}))}}let X=new Y,Z=function(e){return e.UserJoin="user_join",e.UserUpdate="user_update",e.UserLeave="user_leave",e.StreamUpdate="stream_update",e.ChannelUpdate="channel_update",e.ChannelDestroy="channel_destroy",e.Custom="custom",e.ImMsg="im_msg",e.ImDisconnect="im_disconnect",e}({});var ee,te,re,ne=r(7594),ie=r.n(ne),oe=r(5995).Buffer;try{ee=new TextDecoder}catch(e){}var se=0;const ae=[];var ce,ue,le,he,fe,de=ae,pe=0,ge={},me=0,ye=0,ve=[],be={useRecords:!1,mapsAsObjects:!0};class we{}const _e=new we;_e.name="MessagePack 0xC1";var ke,Se,Ee,Te=!1,Ce=2;try{new Function("")}catch(e){Ce=1/0}class Ae{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.sequential&&!1!==e.trusted&&(e.trusted=!0,e.structures||0==e.useRecords||(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(te)return rt((()=>(nt(),this?this.unpack(e,t):Ae.prototype.unpack.call(be,e,t))));e.buffer||e.constructor!==ArrayBuffer||(e=void 0!==oe?oe.from(e):new Uint8Array(e)),"object"==typeof t?(re=t.end||e.length,se=t.start||0):(se=0,re=t>-1?t:e.length),pe=0,ye=0,ue=null,de=ae,le=null,te=e;try{fe=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(te=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof Ae){if(ge=this,this.structures)return ce=this.structures,xe(t);(!ce||ce.length>0)&&(ce=[])}else ge=be,(!ce||ce.length>0)&&(ce=[]);return xe(t)}unpackMultiple(e,t){let r,n=0;try{Te=!0;let i=e.length,o=this?this.unpack(e,i):ot.unpack(e,i);if(!t){for(r=[o];se<i;)n=se,r.push(xe());return r}if(!1===t(o,n,se))return;for(;se<i;)if(n=se,!1===t(xe(),n,se))return}catch(e){throw e.lastPosition=n,e.values=r,e}finally{Te=!1,nt()}}_mergeStructures(e,t){Se&&(e=Se.call(this,e)),e=e||[],Object.isFrozen(e)&&(e=e.map((e=>e.slice(0))));for(let t=0,r=e.length;t<r;t++){let r=e[t];r&&(r.isShared=!0,t>=32&&(r.highByte=t-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],i=t[r];i&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function xe(e){try{if(!ge.trusted&&!Te){let e=ce.sharedLength||0;e<ce.length&&(ce.length=e)}let t;if(ge.randomAccessStructure&&te[se]<64&&te[se]>=32&&ke?(t=ke(te,se,re,ge),te=null,e&&e.lazy||!t||(t=t.toJSON()),se=re):t=Re(),le&&(se=le.postBundlePosition,le=null),Te&&(ce.restoreStructures=null),se==re)ce&&ce.restoreStructures&&Ie(),ce=null,te=null,he&&(he=null);else{if(se>re)throw new Error("Unexpected end of MessagePack data");if(!Te){let e;try{e=JSON.stringify(t,((e,t)=>"bigint"==typeof t?`${t}n`:t)).slice(0,100)}catch(t){e="(JSON view not available "+t+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(e){throw ce&&ce.restoreStructures&&Ie(),nt(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||se>re)&&(e.incomplete=!0),e}}function Ie(){for(let e in ce.restoreStructures)ce[e]=ce.restoreStructures[e];ce.restoreStructures=null}function Re(){let e=te[se++];if(e<160){if(e<128){if(e<64)return e;{let t=ce[63&e]||ge.getStructures&&Be()[63&e];return t?(t.read||(t.read=Me(t,63&e)),t.read()):e}}if(e<144){if(e-=128,ge.mapsAsObjects){let t={};for(let r=0;r<e;r++){let e=Qe();"__proto__"===e&&(e="__proto_"),t[e]=Re()}return t}{let t=new Map;for(let r=0;r<e;r++)t.set(Re(),Re());return t}}{e-=144;let t=new Array(e);for(let r=0;r<e;r++)t[r]=Re();return ge.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(ye>=se)return ue.slice(se-me,(se+=t)-me);if(0==ye&&re<140){let e=t<16?We(t):qe(t);if(null!=e)return e}return Ne(t)}{let t;switch(e){case 192:return null;case 193:return le?(t=Re(),t>0?le[1].slice(le.position1,le.position1+=t):le[0].slice(le.position0,le.position0-=t)):_e;case 194:return!1;case 195:return!0;case 196:if(t=te[se++],void 0===t)throw new Error("Unexpected end of buffer");return Ke(t);case 197:return t=fe.getUint16(se),se+=2,Ke(t);case 198:return t=fe.getUint32(se),se+=4,Ke(t);case 199:return Ge(te[se++]);case 200:return t=fe.getUint16(se),se+=2,Ge(t);case 201:return t=fe.getUint32(se),se+=4,Ge(t);case 202:if(t=fe.getFloat32(se),ge.useFloat32>2){let e=it[(127&te[se])<<1|te[se+1]>>7];return se+=4,(e*t+(t>0?.5:-.5)|0)/e}return se+=4,t;case 203:return t=fe.getFloat64(se),se+=8,t;case 204:return te[se++];case 205:return t=fe.getUint16(se),se+=2,t;case 206:return t=fe.getUint32(se),se+=4,t;case 207:return"number"===ge.int64AsType?(t=4294967296*fe.getUint32(se),t+=fe.getUint32(se+4)):"string"===ge.int64AsType?t=fe.getBigUint64(se).toString():"auto"===ge.int64AsType?(t=fe.getBigUint64(se),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=fe.getBigUint64(se),se+=8,t;case 208:return fe.getInt8(se++);case 209:return t=fe.getInt16(se),se+=2,t;case 210:return t=fe.getInt32(se),se+=4,t;case 211:return"number"===ge.int64AsType?(t=4294967296*fe.getInt32(se),t+=fe.getUint32(se+4)):"string"===ge.int64AsType?t=fe.getBigInt64(se).toString():"auto"===ge.int64AsType?(t=fe.getBigInt64(se),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=fe.getBigInt64(se),se+=8,t;case 212:if(t=te[se++],114==t)return Ye(63&te[se++]);{let e=ve[t];if(e)return e.read?(se++,e.read(Re())):e.noBuffer?(se++,e()):e(te.subarray(se,++se));throw new Error("Unknown extension "+t)}case 213:return t=te[se],114==t?(se++,Ye(63&te[se++],te[se++])):Ge(2);case 214:return Ge(4);case 215:return Ge(8);case 216:return Ge(16);case 217:return t=te[se++],ye>=se?ue.slice(se-me,(se+=t)-me):Le(t);case 218:return t=fe.getUint16(se),ye>=(se+=2)?ue.slice(se-me,(se+=t)-me):De(t);case 219:return t=fe.getUint32(se),ye>=(se+=4)?ue.slice(se-me,(se+=t)-me):Ue(t);case 220:return t=fe.getUint16(se),se+=2,Fe(t);case 221:return t=fe.getUint32(se),se+=4,Fe(t);case 222:return t=fe.getUint16(se),se+=2,ze(t);case 223:return t=fe.getUint32(se),se+=4,ze(t);default:if(e>=224)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e)}}}const Pe=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Me(e,t){function r(){if(r.count++>Ce){let r=e.read=new Function("r","return function(){return "+(ge.freezeData?"Object.freeze":"")+"({"+e.map((e=>"__proto__"===e?"__proto_:r()":Pe.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"})}")(Re);return 0===e.highByte&&(e.read=Oe(t,e.read)),r()}let n={};for(let t=0,r=e.length;t<r;t++){let r=e[t];"__proto__"===r&&(r="__proto_"),n[r]=Re()}return ge.freezeData?Object.freeze(n):n}return r.count=0,0===e.highByte?Oe(t,r):r}const Oe=(e,t)=>function(){let r=te[se++];if(0===r)return t();let n=e<32?-(e+(r<<5)):e+(r<<5),i=ce[n]||Be()[n];if(!i)throw new Error("Record id is not defined for "+n);return i.read||(i.read=Me(i,e)),i.read()};function Be(){let e=rt((()=>(te=null,ge.getStructures())));return ce=ge._mergeStructures(e,ce)}var Ne=je,Le=je,De=je,Ue=je;function je(e){let t;if(e<16&&(t=We(e)))return t;if(e>64&&ee)return ee.decode(te.subarray(se,se+=e));const r=se+e,n=[];for(t="";se<r;){const e=te[se++];if(128&e)if(192==(224&e)){const t=63&te[se++];n.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&te[se++],r=63&te[se++];n.push((31&e)<<12|t<<6|r)}else if(240==(248&e)){let t=(7&e)<<18|(63&te[se++])<<12|(63&te[se++])<<6|63&te[se++];t>65535&&(t-=65536,n.push(t>>>10&1023|55296),t=56320|1023&t),n.push(t)}else n.push(e);else n.push(e);n.length>=4096&&(t+=Ve.apply(String,n),n.length=0)}return n.length>0&&(t+=Ve.apply(String,n)),t}function Fe(e){let t=new Array(e);for(let r=0;r<e;r++)t[r]=Re();return ge.freezeData?Object.freeze(t):t}function ze(e){if(ge.mapsAsObjects){let t={};for(let r=0;r<e;r++){let e=Qe();"__proto__"===e&&(e="__proto_"),t[e]=Re()}return t}{let t=new Map;for(let r=0;r<e;r++)t.set(Re(),Re());return t}}var Ve=String.fromCharCode;function qe(e){let t=se,r=new Array(e);for(let n=0;n<e;n++){const e=te[se++];if((128&e)>0)return void(se=t);r[n]=e}return Ve.apply(String,r)}function We(e){if(e<4){if(e<2){if(0===e)return"";{let e=te[se++];return(128&e)>1?void(se-=1):Ve(e)}}{let t=te[se++],r=te[se++];if((128&t)>0||(128&r)>0)return void(se-=2);if(e<3)return Ve(t,r);let n=te[se++];return(128&n)>0?void(se-=3):Ve(t,r,n)}}{let t=te[se++],r=te[se++],n=te[se++],i=te[se++];if((128&t)>0||(128&r)>0||(128&n)>0||(128&i)>0)return void(se-=4);if(e<6){if(4===e)return Ve(t,r,n,i);{let e=te[se++];return(128&e)>0?void(se-=5):Ve(t,r,n,i,e)}}if(e<8){let o=te[se++],s=te[se++];if((128&o)>0||(128&s)>0)return void(se-=6);if(e<7)return Ve(t,r,n,i,o,s);let a=te[se++];return(128&a)>0?void(se-=7):Ve(t,r,n,i,o,s,a)}{let o=te[se++],s=te[se++],a=te[se++],c=te[se++];if((128&o)>0||(128&s)>0||(128&a)>0||(128&c)>0)return void(se-=8);if(e<10){if(8===e)return Ve(t,r,n,i,o,s,a,c);{let e=te[se++];return(128&e)>0?void(se-=9):Ve(t,r,n,i,o,s,a,c,e)}}if(e<12){let u=te[se++],l=te[se++];if((128&u)>0||(128&l)>0)return void(se-=10);if(e<11)return Ve(t,r,n,i,o,s,a,c,u,l);let h=te[se++];return(128&h)>0?void(se-=11):Ve(t,r,n,i,o,s,a,c,u,l,h)}{let u=te[se++],l=te[se++],h=te[se++],f=te[se++];if((128&u)>0||(128&l)>0||(128&h)>0||(128&f)>0)return void(se-=12);if(e<14){if(12===e)return Ve(t,r,n,i,o,s,a,c,u,l,h,f);{let e=te[se++];return(128&e)>0?void(se-=13):Ve(t,r,n,i,o,s,a,c,u,l,h,f,e)}}{let d=te[se++],p=te[se++];if((128&d)>0||(128&p)>0)return void(se-=14);if(e<15)return Ve(t,r,n,i,o,s,a,c,u,l,h,f,d,p);let g=te[se++];return(128&g)>0?void(se-=15):Ve(t,r,n,i,o,s,a,c,u,l,h,f,d,p,g)}}}}}function He(){let e,t=te[se++];if(t<192)e=t-160;else switch(t){case 217:e=te[se++];break;case 218:e=fe.getUint16(se),se+=2;break;case 219:e=fe.getUint32(se),se+=4;break;default:throw new Error("Expected string")}return je(e)}function Ke(e){return ge.copyBuffers?Uint8Array.prototype.slice.call(te,se,se+=e):te.subarray(se,se+=e)}function Ge(e){let t=te[se++];if(ve[t]){let r;return ve[t](te.subarray(se,r=se+=e),(e=>{se=e;try{return Re()}finally{se=r}}))}throw new Error("Unknown extension type "+t)}var $e=new Array(4096);function Qe(){let e=te[se++];if(!(e>=160&&e<192))return se--,Je(Re());if(e-=160,ye>=se)return ue.slice(se-me,(se+=e)-me);if(!(0==ye&&re<180))return Ne(e);let t,r=4095&(e<<5^(e>1?fe.getUint16(se):e>0?te[se]:0)),n=$e[r],i=se,o=se+e-3,s=0;if(n&&n.bytes==e){for(;i<o;){if(t=fe.getUint32(i),t!=n[s++]){i=1879048192;break}i+=4}for(o+=3;i<o;)if(t=te[i++],t!=n[s++]){i=1879048192;break}if(i===o)return se=i,n.string;o-=3,i=se}for(n=[],$e[r]=n,n.bytes=e;i<o;)t=fe.getUint32(i),n.push(t),i+=4;for(o+=3;i<o;)t=te[i++],n.push(t);let a=e<16?We(e):qe(e);return n.string=null!=a?a:Ne(e)}function Je(e){if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return e.toString();if(null==e)return e+"";throw new Error("Invalid property type for record",typeof e)}const Ye=(e,t)=>{let r=Re().map(Je),n=e;void 0!==t&&(e=e<32?-((t<<5)+e):(t<<5)+e,r.highByte=t);let i=ce[e];return i&&(i.isShared||Te)&&((ce.restoreStructures||(ce.restoreStructures=[]))[e]=i),ce[e]=r,r.read=Me(r,n),r.read()};ve[0]=()=>{},ve[0].noBuffer=!0,ve[66]=e=>{let t=e.length,r=BigInt(128&e[0]?e[0]-256:e[0]);for(let n=1;n<t;n++)r<<=8n,r+=BigInt(e[n]);return r};let Xe={Error,TypeError,ReferenceError};ve[101]=()=>{let e=Re();return(Xe[e[0]]||Error)(e[1],{cause:e[2]})},ve[105]=e=>{if(!1===ge.structuredClone)throw new Error("Structured clone extension is disabled");let t=fe.getUint32(se-4);he||(he=new Map);let r,n=te[se];r=n>=144&&n<160||220==n||221==n?[]:{};let i={target:r};he.set(t,i);let o=Re();return i.used?Object.assign(r,o):(i.target=o,o)},ve[112]=e=>{if(!1===ge.structuredClone)throw new Error("Structured clone extension is disabled");let t=fe.getUint32(se-4),r=he.get(t);return r.used=!0,r.target},ve[115]=()=>new Set(Re());const Ze=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((e=>e+"Array"));let et="object"==typeof globalThis?globalThis:window;ve[116]=e=>{let t=e[0],r=Ze[t];if(!r){if(16===t){let t=new ArrayBuffer(e.length-1);return new Uint8Array(t).set(e.subarray(1)),t}throw new Error("Could not find typed array for code "+t)}return new et[r](Uint8Array.prototype.slice.call(e,1).buffer)},ve[120]=()=>{let e=Re();return new RegExp(e[0],e[1])};const tt=[];function rt(e){Ee&&Ee();let t=re,r=se,n=pe,i=me,o=ye,s=ue,a=de,c=he,u=le,l=new Uint8Array(te.slice(0,re)),h=ce,f=ce.slice(0,ce.length),d=ge,p=Te,g=e();return re=t,se=r,pe=n,me=i,ye=o,ue=s,de=a,he=c,le=u,te=l,Te=p,(ce=h).splice(0,ce.length,...f),ge=d,fe=new DataView(te.buffer,te.byteOffset,te.byteLength),g}function nt(){te=null,he=null,ce=null}ve[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],r=se;return se+=t-e.length,le=tt,(le=[He(),He()]).position0=0,le.position1=0,le.postBundlePosition=se,se=r,Re()},ve[255]=e=>4==e.length?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):8==e.length?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):12==e.length?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid");const it=new Array(147);for(let e=0;e<256;e++)it[e]=+("1e"+Math.floor(45.15-.30103*e));var ot=new Ae({useRecords:!1});ot.unpack,ot.unpackMultiple,ot.unpack;let st=new Float32Array(1);new Uint8Array(st.buffer,0,4);var at=r(5995).Buffer;let ct,ut,lt;try{ct=new TextEncoder}catch(e){}const ht=void 0!==at,ft=ht?function(e){return at.allocUnsafeSlow(e)}:Uint8Array,dt=ht?at:Uint8Array,pt=ht?4294967296:2144337920;let gt,mt,yt,vt,bt,wt=0,_t=null;const kt=/[\u0080-\uFFFF]/,St=Symbol("record-id");class Et extends Ae{constructor(e){let t,r,n,i;super(e),this.offset=0;let o=dt.prototype.utf8Write?function(e,t){return gt.utf8Write(e,t,4294967295)}:!(!ct||!ct.encodeInto)&&function(e,t){return ct.encodeInto(e,gt.subarray(t)).written},s=this;e||(e={});let a=e&&e.sequential,c=e.structures||e.saveStructures,u=e.maxSharedStructures;if(null==u&&(u=c?32:0),u>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&null==e.moreTypes&&(this.moreTypes=!0);let l=e.maxOwnStructures;null==l&&(l=c?32:64),this.structures||0==e.useRecords||(this.structures=[]);let h=u>32||l+u>64,f=u+64,d=u+l+64;if(d>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let p=[],g=0,m=0;this.pack=this.encode=function(e,o){if(gt||(gt=new ft(8192),yt=gt.dataView||(gt.dataView=new DataView(gt.buffer,0,8192)),wt=0),vt=gt.length-10,vt-wt<2048?(gt=new ft(gt.length),yt=gt.dataView||(gt.dataView=new DataView(gt.buffer,0,gt.length)),vt=gt.length-10,wt=0):wt=wt+7&2147483640,t=wt,o&Dt&&(wt+=255&o),i=s.structuredClone?new Map:null,s.bundleStrings&&"string"!=typeof e?(_t=[],_t.size=1/0):_t=null,n=s.structures,n){n.uninitialized&&(n=s._mergeStructures(s.getStructures()));let e=n.sharedLength||0;if(e>u)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,i=n.transitions;for(let t=0,n=e.length;t<n;t++){let n=e[t];r=i[n],r||(r=i[n]=Object.create(null)),i=r}i[St]=t+64}this.lastNamedStructuresLength=e}a||(n.nextId=e+64)}let c;r&&(r=!1);try{s.randomAccessStructure&&e&&e.constructor&&e.constructor===Object?A(e):b(e);let r=_t;if(_t&&xt(t,b,0),i&&i.idsToInsert){let e=i.idsToInsert.sort(((e,t)=>e.offset>t.offset?1:-1)),n=e.length,o=-1;for(;r&&n>0;){let i=e[--n].offset+t;i<r.stringsPosition+t&&-1===o&&(o=0),i>r.position+t?o>=0&&(o+=6):(o>=0&&(yt.setUint32(r.position+t,yt.getUint32(r.position+t)+o),o=-1),r=r.previous,n++)}o>=0&&r&&yt.setUint32(r.position+t,yt.getUint32(r.position+t)+o),wt+=6*e.length,wt>vt&&E(wt),s.offset=wt;let a=function(e,t){let r,n=6*t.length,i=e.length-n;for(;r=t.pop();){let t=r.offset,o=r.id;e.copyWithin(t+n,t,i),n-=6;let s=t+n;e[s++]=214,e[s++]=105,e[s++]=o>>24,e[s++]=o>>16&255,e[s++]=o>>8&255,e[s++]=255&o,i=t}return e}(gt.subarray(t,wt),e);return i=null,a}return s.offset=wt,o&Nt?(gt.start=t,gt.end=wt,gt):gt.subarray(t,wt)}catch(e){throw c=e,e}finally{if(n&&(y(),r&&s.saveStructures)){let r=n.sharedLength||0,i=gt.subarray(t,wt),a=It(n,s);if(!c)return!1===s.saveStructures(a,a.isCompatible)?s.pack(e,o):(s.lastNamedStructuresLength=r,gt.length>1073741824&&(gt=null),i)}gt.length>1073741824&&(gt=null),o&Lt&&(wt=t)}};const y=()=>{m<10&&m++;let e=n.sharedLength||0;if(n.length>e&&!a&&(n.length=e),g>1e4)n.transitions=null,m=0,g=0,p.length>0&&(p=[]);else if(p.length>0&&!a){for(let e=0,t=p.length;e<t;e++)p[e][St]=0;p=[]}},v=e=>{var t=e.length;t<16?gt[wt++]=144|t:t<65536?(gt[wt++]=220,gt[wt++]=t>>8,gt[wt++]=255&t):(gt[wt++]=221,yt.setUint32(wt,t),wt+=4);for(let r=0;r<t;r++)b(e[r])},b=e=>{wt>vt&&(gt=E(wt));var r,n=typeof e;if("string"===n){let n,i=e.length;if(_t&&i>=4&&i<4096){if((_t.size+=i)>21760){let e,r,n=(_t[0]?3*_t[0].length+_t[1].length:0)+10;wt+n>vt&&(gt=E(wt+n)),_t.position?(r=_t,gt[wt]=200,wt+=3,gt[wt++]=98,e=wt-t,wt+=4,xt(t,b,0),yt.setUint16(e+t-3,wt-t-e)):(gt[wt++]=214,gt[wt++]=98,e=wt-t,wt+=4),_t=["",""],_t.previous=r,_t.size=0,_t.position=e}let r=kt.test(e);return _t[r?0:1]+=e,gt[wt++]=193,void b(r?-i:i)}n=i<32?1:i<256?2:i<65536?3:5;let s=3*i;if(wt+s>vt&&(gt=E(wt+s)),i<64||!o){let t,o,s,a=wt+n;for(t=0;t<i;t++)o=e.charCodeAt(t),o<128?gt[a++]=o:o<2048?(gt[a++]=o>>6|192,gt[a++]=63&o|128):55296==(64512&o)&&56320==(64512&(s=e.charCodeAt(t+1)))?(o=65536+((1023&o)<<10)+(1023&s),t++,gt[a++]=o>>18|240,gt[a++]=o>>12&63|128,gt[a++]=o>>6&63|128,gt[a++]=63&o|128):(gt[a++]=o>>12|224,gt[a++]=o>>6&63|128,gt[a++]=63&o|128);r=a-wt-n}else r=o(e,wt+n);r<32?gt[wt++]=160|r:r<256?(n<2&>.copyWithin(wt+2,wt+1,wt+1+r),gt[wt++]=217,gt[wt++]=r):r<65536?(n<3&>.copyWithin(wt+3,wt+2,wt+2+r),gt[wt++]=218,gt[wt++]=r>>8,gt[wt++]=255&r):(n<5&>.copyWithin(wt+5,wt+3,wt+3+r),gt[wt++]=219,yt.setUint32(wt,r),wt+=4),wt+=r}else if("number"===n)if(e>>>0===e)e<32||e<128&&!1===this.useRecords||e<64&&!this.randomAccessStructure?gt[wt++]=e:e<256?(gt[wt++]=204,gt[wt++]=e):e<65536?(gt[wt++]=205,gt[wt++]=e>>8,gt[wt++]=255&e):(gt[wt++]=206,yt.setUint32(wt,e),wt+=4);else if((e|0)===e)e>=-32?gt[wt++]=256+e:e>=-128?(gt[wt++]=208,gt[wt++]=e+256):e>=-32768?(gt[wt++]=209,yt.setInt16(wt,e),wt+=2):(gt[wt++]=210,yt.setInt32(wt,e),wt+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let r;if(gt[wt++]=202,yt.setFloat32(wt,e),t<4||((r=e*it[(127>[wt])<<1|gt[wt+1]>>7])|0)===r)return void(wt+=4);wt--}gt[wt++]=203,yt.setFloat64(wt,e),wt+=8}else if("object"===n||"function"===n)if(e){if(i){let r=i.get(e);if(r){if(!r.id){let e=i.idsToInsert||(i.idsToInsert=[]);r.id=e.push(r)}return gt[wt++]=214,gt[wt++]=112,yt.setUint32(wt,r.id),void(wt+=4)}i.set(e,{offset:wt-t})}let o=e.constructor;if(o===Object)S(e);else if(o===Array)v(e);else if(o===Map)if(this.mapAsEmptyObject)gt[wt++]=128;else{(r=e.size)<16?gt[wt++]=128|r:r<65536?(gt[wt++]=222,gt[wt++]=r>>8,gt[wt++]=255&r):(gt[wt++]=223,yt.setUint32(wt,r),wt+=4);for(let[t,r]of e)b(t),b(r)}else{for(let t=0,r=ut.length;t<r;t++){if(e instanceof lt[t]){let r=ut[t];if(r.write){r.type&&(gt[wt++]=212,gt[wt++]=r.type,gt[wt++]=0);let t=r.write.call(this,e);return void(t===e?Array.isArray(e)?v(e):S(e):b(t))}let n,i=gt,o=yt,s=wt;gt=null;try{n=r.pack.call(this,e,(e=>(gt=i,i=null,wt+=e,wt>vt&&E(wt),{target:gt,targetView:yt,position:wt-e})),b)}finally{i&&(gt=i,yt=o,wt=s,vt=gt.length-10)}return void(n&&(n.length+wt>vt&&E(n.length+wt),wt=At(n,gt,wt,r.type)))}}if(Array.isArray(e))v(e);else{if(e.toJSON){const t=e.toJSON();if(t!==e)return b(t)}if("function"===n)return b(this.writeFunction&&this.writeFunction(e));S(e)}}}else gt[wt++]=192;else if("boolean"===n)gt[wt++]=e?195:194;else if("bigint"===n){if(e<BigInt(1)<<BigInt(63)&&e>=-(BigInt(1)<<BigInt(63)))gt[wt++]=211,yt.setBigInt64(wt,e);else if(e<BigInt(1)<<BigInt(64)&&e>0)gt[wt++]=207,yt.setBigUint64(wt,e);else{if(!this.largeBigIntToFloat){if(this.useBigIntExtension&&e<2n**1023n&&e>-(2n**1023n)){gt[wt++]=199,wt++,gt[wt++]=66;let t,r=[];do{let n=0xffn&e;t=(0x80n&n)===(e<0n?0x80n:0n),r.push(n),e>>=8n}while(0n!==e&&-1n!==e||!t);gt[wt-2]=r.length;for(let e=r.length;e>0;)gt[wt++]=Number(r[--e]);return}throw new RangeError(e+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64")}gt[wt++]=203,yt.setFloat64(wt,Number(e))}wt+=8}else{if("undefined"!==n)throw new Error("Unknown type: "+n);this.encodeUndefinedAsNil?gt[wt++]=192:(gt[wt++]=212,gt[wt++]=0,gt[wt++]=0)}},w=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let r in e)"function"==typeof e.hasOwnProperty&&!e.hasOwnProperty(r)||this.skipValues.includes(e[r])||t.push(r)}else t=Object.keys(e);let r,n=t.length;if(n<16?gt[wt++]=128|n:n<65536?(gt[wt++]=222,gt[wt++]=n>>8,gt[wt++]=255&n):(gt[wt++]=223,yt.setUint32(wt,n),wt+=4),this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);b(isNaN(n)?r:n),b(e[r])}else for(let i=0;i<n;i++)b(r=t[i]),b(e[r])}:e=>{gt[wt++]=222;let r=wt-t;wt+=2;let n=0;for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&(b(t),b(e[t]),n++);gt[r+++t]=n>>8,gt[r+t]=255&n},_=!1===this.useRecords?w:e.progressiveRecords&&!h?e=>{let r,i,o=n.transitions||(n.transitions=Object.create(null)),s=wt++-t;for(let a in e)if("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(a)){if(r=o[a],r)o=r;else{let c=Object.keys(e),u=o;o=n.transitions;let l=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];r=o[t],r||(r=o[t]=Object.create(null),l++),o=r}s+t+1==wt?(wt--,T(o,c,l)):C(o,c,s,l),i=!0,o=u[a]}b(e[a])}if(!i){let r=o[St];r?gt[s+t]=r:C(o,Object.keys(e),s,0)}}:e=>{let t,r=n.transitions||(n.transitions=Object.create(null)),i=0;for(let n in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(n))&&(t=r[n],t||(t=r[n]=Object.create(null),i++),r=t);let o=r[St];o?o>=96&&h?(gt[wt++]=96+(31&(o-=96)),gt[wt++]=o>>5):gt[wt++]=o:T(r,r.__keys__||Object.keys(e),i);for(let t in e)("function"!=typeof e.hasOwnProperty||e.hasOwnProperty(t))&&b(e[t])},k="function"==typeof this.useRecords&&this.useRecords,S=k?e=>{k(e)?_(e):w(e)}:_,E=e=>{let r;if(e>16777216){if(e-t>pt)throw new Error("Packed buffer would be larger than maximum buffer size");r=Math.min(pt,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else r=1+(Math.max(e-t<<2,gt.length-1)>>12)<<12;let n=new ft(r);return yt=n.dataView||(n.dataView=new DataView(n.buffer,0,r)),e=Math.min(e,gt.length),gt.copy?gt.copy(n,0,t,e):n.set(gt.slice(t,e)),wt-=t,t=0,vt=n.length-10,gt=n},T=(e,t,i)=>{let o=n.nextId;o||(o=64),o<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(o=n.nextOwnId,o<d||(o=f),n.nextOwnId=o+1):(o>=d&&(o=f),n.nextId=o+1);let s=t.highByte=o>=96&&h?o-96>>5:-1;e[St]=o,e.__keys__=t,n[o-64]=t,o<f?(t.isShared=!0,n.sharedLength=o-63,r=!0,s>=0?(gt[wt++]=96+(31&o),gt[wt++]=s):gt[wt++]=o):(s>=0?(gt[wt++]=213,gt[wt++]=114,gt[wt++]=96+(31&o),gt[wt++]=s):(gt[wt++]=212,gt[wt++]=114,gt[wt++]=o),i&&(g+=m*i),p.length>=l&&(p.shift()[St]=0),p.push(e),b(t))},C=(e,r,n,i)=>{let o=gt,s=wt,a=vt,c=t;gt=mt,wt=0,t=0,gt||(mt=gt=new ft(8192)),vt=gt.length-10,T(e,r,i),mt=gt;let u=wt;if(gt=o,wt=s,vt=a,t=c,u>1){let e=wt+u-1;e>vt&&E(e);let r=n+t;gt.copyWithin(r+u,r+1,wt),gt.set(mt.slice(0,u),r),wt=e}else gt[n+t]=mt[0]},A=e=>{let i=bt(e,gt,t,wt,n,E,((e,t,n)=>{if(n)return r=!0;wt=t;let i=gt;return b(e),y(),i!==gt?{position:wt,targetView:yt,target:gt}:wt}),this);if(0===i)return S(e);wt=i}}useBuffer(e){gt=e,gt.dataView||(gt.dataView=new DataView(gt.buffer,gt.byteOffset,gt.byteLength)),wt=0}set position(e){wt=e}get position(){return wt}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}function Tt(e,t,r,n){let i=e.byteLength;if(i+1<256){var{target:o,position:s}=r(4+i);o[s++]=199,o[s++]=i+1}else if(i+1<65536){var{target:o,position:s}=r(5+i);o[s++]=200,o[s++]=i+1>>8,o[s++]=i+1&255}else{var{target:o,position:s,targetView:a}=r(7+i);o[s++]=201,a.setUint32(s,i+1),s+=4}o[s++]=116,o[s++]=t,e.buffer||(e=new Uint8Array(e)),o.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s)}function Ct(e,t){let r=e.byteLength;var n,i;if(r<256){var{target:n,position:i}=t(r+2);n[i++]=196,n[i++]=r}else if(r<65536){var{target:n,position:i}=t(r+3);n[i++]=197,n[i++]=r>>8,n[i++]=255&r}else{var{target:n,position:i,targetView:o}=t(r+5);n[i++]=198,o.setUint32(i,r),i+=4}n.set(e,i)}function At(e,t,r,n){let i=e.length;switch(i){case 1:t[r++]=212;break;case 2:t[r++]=213;break;case 4:t[r++]=214;break;case 8:t[r++]=215;break;case 16:t[r++]=216;break;default:i<256?(t[r++]=199,t[r++]=i):i<65536?(t[r++]=200,t[r++]=i>>8,t[r++]=255&i):(t[r++]=201,t[r++]=i>>24,t[r++]=i>>16&255,t[r++]=i>>8&255,t[r++]=255&i)}return t[r++]=n,t.set(e,r),r+=i}function xt(e,t,r){if(_t.length>0){yt.setUint32(_t.position+e,wt+r-_t.position-e),_t.stringsPosition=wt-e;let n=_t;_t=null,t(n[0]),t(n[1])}}function It(e,t){return e.isCompatible=e=>{let r=!e||(t.lastNamedStructuresLength||0)===e.length;return r||t._mergeStructures(e),r},e}lt=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,we],ut=[{pack(e,t,r){let n=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&n>=0&&n<4294967296){let{target:e,targetView:r,position:i}=t(6);e[i++]=214,e[i++]=255,r.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:r,targetView:i,position:o}=t(10);r[o++]=215,r[o++]=255,i.setUint32(o,4e6*e.getMilliseconds()+(n/1e3/4294967296|0)),i.setUint32(o+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return t(0),r(this.onInvalidDate());let{target:e,targetView:n,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:r,targetView:i,position:o}=t(15);r[o++]=199,r[o++]=12,r[o++]=255,i.setUint32(o,1e6*e.getMilliseconds()),i.setBigInt64(o+4,BigInt(Math.floor(n)))}}},{pack(e,t,r){if(this.setAsEmptyObject)return t(0),r({});let n=Array.from(e),{target:i,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(i[o++]=212,i[o++]=115,i[o++]=0),r(n)}},{pack(e,t,r){let{target:n,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(n[i++]=212,n[i++]=101,n[i++]=0),r([e.name,e.message,e.cause])}},{pack(e,t,r){let{target:n,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(n[i++]=212,n[i++]=120,n[i++]=0),r([e.source,e.flags])}},{pack(e,t){this.moreTypes?Tt(e,16,t):Ct(ht?at.from(e):new Uint8Array(e),t)}},{pack(e,t){let r=e.constructor;r!==dt&&this.moreTypes?Tt(e,Ze.indexOf(r.name),t):Ct(e,t)}},{pack(e,t){let{target:r,position:n}=t(1);r[n]=193}}];let Rt=new Et({useRecords:!1});Rt.pack,Rt.pack;const{NEVER:Pt,ALWAYS:Mt,DECIMAL_ROUND:Ot,DECIMAL_FIT:Bt}={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},Nt=512,Lt=1024,Dt=2048;r(5995).Buffer;let Ut=function(e){return e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.CHANNEL_MESSAGE="channelmessage",e.IM_MESSAGE="immessage",e.WHITEBOARD_MESSAGE="whiteboardmessage",e.CUSTOM_TOPIC_MESSAGE="custommessage",e}({});class jt extends(f()){client;version=1;ssTopics={};authReconnect;isFirstConnect=!0;unpacker;constructor(e){super(),this.authReconnect=e,this.unpacker=new Ae({useRecords:!1,int64AsType:"number"})}initClient(e){let t=this.getBrokerUrl(e.ws);return ie().connect(t,{keepalive:30,clean:!1,connectTimeout:1e4,reconnectPeriod:3e3,resubscribe:!1,clientId:e.client_id,username:e.username,password:e.jwt_token,protocolVersion:5,properties:{sessionExpiryInterval:400},transformWsUrl:this.authReconnect})}getBrokerUrl(e){return e}async connect(e){return this.client&&await this.close(!0),this.isFirstConnect=!0,new Promise(((t,r)=>{this.client=this.initClient(e);let n=e=>{o(),setTimeout((()=>{this.close(!0)}),0);let t=e?D.fromError(e):new D("会控服务连接失败");r(t)},i=async n=>{o();try{await this.subscribe(e.topics,2)}catch(e){return this.close(!0),void r(e)}this.addListeners(),this.client.emit("connect",n),this.isFirstConnect=!1,t()},o=()=>{this.client.off("connect",i),this.client.off("error",n),this.client.off("offline",n),this.client.off("close",n)};this.client.once("connect",i),this.client.once("error",n),this.client.once("offline",n),this.client.once("close",n)}))}addListeners(){this.client.on("connect",(()=>{if(!this.isFirstConnect)for(const e in this.ssTopics)S((()=>this.subscribe(e,this.ssTopics[e])),{maxRetries:10})().catch((t=>{"maxretry"==t&&X.error(`socket尝试订阅${e}多次重试依旧失败,已放弃`)}));this.emit(Ut.CONNECTED)})),this.client.on("reconnect",(()=>{X.info("socket start reconnect"),this.emit(Ut.RECONNECTING)})),this.client.on("close",(()=>{X.info("socket closed")})),this.client.on("offline",(()=>{X.info("socket offline")})),this.client.on("error",(e=>{throw X.error("socket error",e),D.fromError(e)})),this.onMsg=this.onMsg.bind(this),this.client.on("message",this.onMsg)}subscribe(e,t=0){return new Promise(((r,n)=>{this.client.subscribe(e,{qos:t},((t,i)=>{t?(X.error(`subscribe ${e} error`,t),n(D.fromError(t))):i&&(X.debug(`subscribe ${e} success`,i),i.forEach((e=>{this.ssTopics[e.topic]=e.qos})),r())}))}))}unsubscribe(e){return new Promise(((t,r)=>{this.client.unsubscribe(e,(n=>{if(n)X.error(`unsubscribe ${e} error`,n),r(D.fromError(n));else{("string"==typeof e?[e]:e).forEach((e=>{delete this.ssTopics[e]})),t()}}))}))}async close(e=!1){return new Promise(((t,r)=>{this.client.end(e,(e=>{this.ssTopics={},null!=e?r(D.fromError(e)):t()}))}))}sendMsg(e,t,r=0){return new Promise(((n,i)=>{this.client.publish(t,e,{qos:r},(e=>{null!=e?i(D.fromError(e)):n()}))}))}onMsg(e,t,r){try{if(0!==e.indexOf("/rtc/"))return void this.emit(Ut.CUSTOM_TOPIC_MESSAGE,e,t);let r=this.unpacker.unpack(t);if(null==r)return void X.error("解析报文失败",e,t);X.debug(r.data.channel?"收到会控消息":r.data.board?"收到电子白板消息":"收到im消息",r),this.emit(r.data.channel?Ut.CHANNEL_MESSAGE:r.data.board?Ut.WHITEBOARD_MESSAGE:Ut.IM_MESSAGE,e,r)}catch(e){X.error("消息处理报错",e)}}}var Ft=function(e){return e.INIT="init",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.DISCONNECTED="disconnected",e}(Ft||{});class zt extends(f()){rtcApi;rtcSocket;connectState;heartbeatIntervalID;eventCB;constructor(e,t,r=null){super(),this.rtcApi=e,this.rtcSocket=t,this.eventCB=r,this.addSocketListeners(),this.connectState=Ft.INIT}addSocketListeners(){this.onConnected=this.onConnected.bind(this),this.onStartReconnect=this.onStartReconnect.bind(this),this.onImMessage=this.onImMessage.bind(this),this.rtcSocket.on(Ut.CONNECTED,this.onConnected),this.rtcSocket.on(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.on(Ut.IM_MESSAGE,this.onImMessage)}removeSocketListeners(){this.rtcSocket.off(Ut.CONNECTED,this.onConnected),this.rtcSocket.off(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.off(Ut.IM_MESSAGE,this.onImMessage)}triggerEvent(e,t){try{let r=new c(e,t);this.emit(e,r),this.eventCB&&this.eventCB(r)}catch(r){X.error(`im事件${e}上层响应出错,请sdk调用者检查`,r,t)}}async heartbeat(){let e=this.heartbeatIntervalID;if(this.connectState!=Ft.CONNECTED)throw X.info(`异常im心跳,当前im状态${this.connectState}`),clearInterval(e),new D(`异常im心跳,im状态为:${this.connectState}`);try{await this.rtcApi.imHeartbeat()}catch(e){X.error("im心跳失败",e),e instanceof D&&this.disconnnect(u.Error,e)}X.debug("im heartbeat interval",e)}async onConnected(){let e=this.connectState;X.warn(e==Ft.RECONNECTING?"imsocket重连成功":"imsocket连接成功"),this.connectState=Ft.CONNECTED,this.heartbeatIntervalID&&clearInterval(this.heartbeatIntervalID);let t=this.heartbeatIntervalID=setInterval((()=>this.heartbeat()),3e4);X.debug("imheartbeat interval started",t),e==Ft.RECONNECTING?this.triggerEvent(l.RECONNECTED):this.triggerEvent(l.ENABLE_SUCCEED)}onStartReconnect(){X.warn("imsocket开始重连"),clearInterval(this.heartbeatIntervalID),this.connectState=Ft.RECONNECTING,this.triggerEvent(l.RECONNECTING)}onImMessage(e,t){switch(t.type){case Z.ImDisconnect:const e=t.data;if(!e)return;this.disconnnect(e.reason);break;case Z.ImMsg:{const e=t.data;if(!e)return;this.triggerEvent(l.IM_MSG,e);break}}}async disconnnect(e,t){if(this.connectState!==Ft.DISCONNECTED){clearInterval(this.heartbeatIntervalID),this.removeSocketListeners();try{await this.rtcSocket.close()}catch(e){X.error("断开imsocket报错",e)}try{await this.rtcApi.imDisconnect()}catch(e){X.error("调im断开api报错",e)}this.connectState=Ft.DISCONNECTED,this.triggerEvent(l.DISCONNECTED,{reason:e,error:t}),this.removeAllListeners(),this.eventCB=null,X.center?.flush(),X.info("disconnected im",e)}}}class Vt{channel;im;isAppHide;onNotifyChannelEvent=null;onNotifyImEvent=null;constructor(e){this.isAppHide=!1,e.logLevel&&X.setLevel(e.logLevel),e.logTarget&&(m()||e.logTarget!=Q.WXREALTIME||(e.logTarget=Q.CONSOLE,X.warn("仅微信小程序支持实时日志")),X.setTarget(e.logTarget));let t=this.buildInfo();X.warn("srtc "+(m()?"wechat":"webrtc")+" sdk version:",t.version,"build time:",T("Y-m-d H:i:s",new Date(1e3*t.timestamp)))}get joinVersion(){return this.buildInfo().version}async join(e,t={autoSubscribeAudio:!1,autoSubscribeVideo:!1}){if(this.channel)throw new D("请先退出频道");const r=Math.floor(Date.now()/1e3);let n=I(e);if(n.exp_at&&n.exp_at<r)throw j;X.center&&X.center.shutdown(),n.log_center&&(X.center=new G(n,this.getStoredDeviceId(),this.getDeviceType(),!0));let i=this.newRtcApi(n),a=await i.join({deviceType:this.getDeviceType(),deviceID:this.getStoredDeviceId(),version:this.joinVersion}),c=this.newStreamEngine(t,a,i);await c.connect();let u=this.newRtcSocket(((e,t,r)=>{const n=Math.floor(Date.now()/1e3);return a.mqtt.token_exp_at<n&&i.reconnect({type:0}).then((e=>{a.mqtt=e.mqtt,a.upload=e.upload,a.rtmp=e.rtmp,a.webrtc=e.webrtc})).catch((e=>{e instanceof D&&l?.leave(o.Error,e)})),r.options.username=a.mqtt.username,r.options.clientId=a.mqtt.client_id,r.options.password=a.mqtt.jwt_token,a.mqtt.ws})),l=this.channel=this.newChannel(t,a,i,c,u);return new Promise((async(e,t)=>{l.once(s.JOIN_SUCCEED,(t=>{X.info("joined channel: "+a.channel),e(t.data)})),l.once(s.DISCONNECTED,(e=>{this.postLeave(),t(e.data)}));try{await u.connect(a.mqtt)}catch(e){t(e)}}))}async leave(){if(this.channel)try{await this.channel.leave(o.Self)}catch(e){this.postLeave(),X.error("离开频道报错,强制离开",e)}else X.warn("您不在频道中,无需调用离开")}postLeave(){this.channel=null}getChannelInfo(){return this.channel?this.channel.getInfo():null}getStreamMetric(){if(!this.channel)throw U;return this.channel.getStreamMetric()}getUserInfo(e){if(!this.channel)throw U;return this.channel.getUser(e).getInfo()}getUsersInfo(e=!1){if(!this.channel)throw U;return this.channel.getUsersInfo(e)}async subscribeRemoteAudioMixTrack(e){if(!this.channel)throw U;return await this.channel.subscribeRemoteAudioMixTrack(e)}async subscribeRemoteAudioTrack(e,t){if(!this.channel)throw U;return await this.channel.subscribeRemoteAudioTrack(e,t)}async subscribeRemoteVideoMcuTrack(){if(!this.channel)throw U;return await this.channel.subscribeRemoteVideoMcuTrack()}async subscribeRemoteVideoTrack(e,t){if(!this.channel)throw U;return await this.channel.subscribeRemoteVideoTrack(e,t)}async unsubscribeRemoteTrack(e){if(!this.channel)throw U;await this.channel.unsubscribeRemoteTrack(e)}getRemoteTrack(e,t,r){if(!this.channel)throw U;if(!t&&!r)throw new D("id或desc至少一项不为空");let n=t?this.channel.getUser(e).getTrack(t):this.channel.getUser(e).getTrackByDesc(r);if(!n)throw F(t?e+"没有id为"+t+"的音视频流":e+"没有desc为"+r+"的音视频流");return n}async enableIm(e){if(this.im)throw new D("您已启用im频道外消息通道");const t=Math.floor(Date.now()/1e3);let r=I(e);if(r.exp_at&&r.exp_at<t)throw j;!X.center&&r.log_center&&(X.center=new G(r,this.getStoredDeviceId(),this.getDeviceType(),!0));let n=this.newRtcApi(r),i=await n.imConnect({deviceType:this.getDeviceType(),deviceID:this.getStoredDeviceId(),version:this.joinVersion}),o=this.newRtcSocket(((e,t,r)=>{const o=Math.floor(Date.now()/1e3);return i.mqtt.token_exp_at<o&&n.imReconnect().then((e=>{i.mqtt=e.mqtt})).catch((e=>{e instanceof D&&s?.disconnnect(u.Error,e)})),r.options.username=i.mqtt.username,r.options.clientId=i.mqtt.client_id,r.options.password=i.mqtt.jwt_token,i.mqtt.ws})),s=this.im=new zt(n,o,(e=>{this.onNotifyImEvent&&this.onNotifyImEvent(e)}));return new Promise((async(e,t)=>{s.once(l.ENABLE_SUCCEED,(t=>{e(r.sid)})),s.once(l.DISCONNECTED,(e=>{this.postDisableIm(),t(e.data)}));try{await o.connect(i.mqtt)}catch(e){t(e)}}))}async disableIm(){if(this.im)try{await this.im.disconnnect(u.Self)}catch(e){this.postDisableIm(),X.error("离开频道报错,强制离开",e)}else X.warn("您尚未启用im频道外消息通道")}postDisableIm(){this.im=null}onAppShow(e){e?X.warn("页面恢复显示",e):X.warn("页面恢复显示"),this.isAppHide=!1}onAppHide(){X.warn("页面切后台或最小化"),this.isAppHide=!0}}var qt=r(3793),Wt=r.n(qt);let Ht;!function(e){e.BaseSRTC_I=Vt,e.CommonChannelEventType_I=s,e.isWxxcx_I=m,e.Logger_I=Y,e.SdkError_I=D,e.propAssign_I=E,e.isObject_I=y,e.isString_I=b,e.sleep_I=k,e.retry_I=S,e.dateFormat_I=T,e.genNonce_I=A,e.getHostnameFromUrl_I=x,e.dct_I=I;e.hmac_I=function(e,t){return Wt()(e,t).toString()}}(Ht||(Ht={}));let Kt=function(e){return e.OOK="ook",e.WangsuCDN="wangsucdn",e.Seastart="seastart",e}({});class Gt{joinRsp;published;subscribed;ability;monitorInterval;prevMetric;constructor(e,t){this.joinRsp=e,this.published={},this.subscribed={},t&&setTimeout((()=>{this.ability?E(this.ability,t):this.ability=t}),0)}async connect(){this.startMonitor()}async publish(e,t,r){let n=0;if(e.kind==M.Audio&&this.ability&&void 0!==this.ability.audioMaxPub&&-1!=this.ability.audioMaxPub){for(const e in this.published){this.published[e].kind==M.Audio&&n++}if(this.ability.audioMaxPub>0&&n>=this.ability.audioMaxPub)throw new D("最多允许发布"+this.ability.audioMaxPub+"个音频轨道")}else if(e.kind==M.Video&&this.ability&&void 0!==this.ability.videoMaxPub&&-1!=this.ability.videoMaxPub){for(const e in this.published){this.published[e].kind==M.Video&&n++}if(this.ability.videoMaxPub>0&&n>=this.ability.videoMaxPub)throw new D("最多允许发布"+this.ability.videoMaxPub+"个视频轨道")}}async subscribe(e,t){let r=0;if(e.kind==M.Audio&&this.ability&&void 0!==this.ability.audioMaxSub&&-1!=this.ability.audioMaxSub){for(const e in this.subscribed){this.subscribed[e].kind==M.Audio&&r++}if(this.ability.audioMaxSub>0&&r>=this.ability.audioMaxSub)throw new D("最多允许订阅"+this.ability.audioMaxSub+"个音频轨道")}else if(e.kind==M.Video&&this.ability&&void 0!==this.ability.videoMaxSub&&-1!=this.ability.videoMaxSub){for(const e in this.subscribed){this.subscribed[e].kind==M.Video&&r++}if(this.ability.videoMaxSub>0&&r>=this.ability.videoMaxSub)throw new D("最多允许订阅"+this.ability.videoMaxSub+"个视频轨道")}}haveSubscribed(e){return!!this.subscribed[e.id]}async disconnect(){this.stopMonitor();for(const e in this.published){const t=this.published[e];try{await this.unpublish(t.track)}catch(e){X.error(t.track.toString(),"取消发布失败",e)}}for(const e in this.subscribed){const t=this.subscribed[e];try{await this.unsubscribe(t.track)}catch(e){X.error(t.track.toString(),"取消订阅失败")}}this.published={},this.subscribed={}}getMetricSnapshot(){return this.prevMetric}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval((async()=>{try{const e=await this.getMetric();X.center?.addMetric(e),X.debug("metric",e)}catch(e){X.error("metric","采集metric失败")}}),1e4))}stopMonitor(){this.monitorInterval&&(window.clearInterval(this.monitorInterval),this.monitorInterval=void 0,this.prevMetric=void 0)}}var $t=r(6880),Qt=r.n($t);let Jt;function Yt(e=!1){return(e||void 0===Jt)&&(Jt={...Qt().parse(navigator?.userAgent),supported:"undefined"!=typeof RTCPeerConnection&&("addTransceiver"in RTCPeerConnection.prototype||"addTrack"in RTCPeerConnection.prototype),secure:isSecureContext,mediaDevices:void 0!==navigator?.mediaDevices,screenshare:void 0!==navigator?.mediaDevices?.getDisplayMedia,h264Enc:Xt.checkVideoCodec("h264"),h264Dec:Xt.checkVideoCodec("h264",!1),vp8Enc:Xt.checkVideoCodec("vp8"),vp8Dec:Xt.checkVideoCodec("vp8",!1),opusEnc:Xt.checkAudioCodec("opus"),opusDec:Xt.checkAudioCodec("opus",!1),videoEncCodecs:Xt.videoEncCodecs(),videoDecCodecs:Xt.videoDecCodecs(),audeoEncCodecs:Xt.audioEncCodecs(),audeoDecCodecs:Xt.audioDecCodecs(),ua:navigator?.userAgent,screenWidth:screen?.width||0,screenHeight:screen?.height||0,clientWidth:document?.documentElement?.clientWidth||0,clientHeight:document?.documentElement?.clientHeight||0,devicePixelRatio}),Jt}class Xt{static async checkCameraPermission(){}static async checkMicPermission(){}static videoEncCodecs(){return"getCapabilities"in RTCRtpSender?RTCRtpSender.getCapabilities("video"):(X.warn("当前环境不支持getCapabilities获取支持的视频编码类型"),null)}static audioEncCodecs(){return"getCapabilities"in RTCRtpSender?RTCRtpSender.getCapabilities("audio"):(X.warn("当前环境不支持getCapabilities获取支持的音频编码类型"),null)}static videoDecCodecs(){return"getCapabilities"in RTCRtpReceiver?RTCRtpReceiver.getCapabilities("video"):(X.warn("当前环境不支持getCapabilities获取支持的视频解码类型"),null)}static audioDecCodecs(){return"getCapabilities"in RTCRtpReceiver?RTCRtpReceiver.getCapabilities("audio"):(X.warn("当前环境不支持getCapabilities获取支持的音频解码类型"),null)}static checkVideoCodec(e,t=!0){const r=t?this.videoEncCodecs():this.videoDecCodecs();if(r)for(const t of r.codecs)if(t.mimeType.toLowerCase().replace("video/","")===e.toLowerCase())return!0;return!1}static checkAudioCodec(e,t=!0){const r=t?this.audioEncCodecs():this.audioDecCodecs();if(r)for(const t of r.codecs)if(t.mimeType.toLowerCase().replace("audio/","")===e.toLowerCase())return!0;return!1}static preferAudioEncCodec(e){let t=this.audioEncCodecs(),r=[],n=[];if(t)for(const i of t.codecs)i.mimeType.toLowerCase().replace("audio/","")===e.toLowerCase()?n.push(i):r.push(i);return n.push(...r),n}static preferVideoEncCodec(e){let t=this.videoEncCodecs(),r=[],n=[],i=[];if(t)for(const o of t.codecs)o.mimeType.toLowerCase().replace("video/","")===e.toLowerCase()?"h264"===e.toLowerCase()&&o.sdpFmtpLine&&o.sdpFmtpLine.includes("profile-level-id=42e01f")?n.push(o):i.push(o):r.push(o);return n.push(...i),n.push(...r),n}}class Zt{appID;sid;clientKey;serverPrefix;constructor(e,t,r,n){this.appID=e,this.sid=t,this.clientKey=r,"/"!==n.substring(n.length-1)&&(n+="/"),this.serverPrefix=n+"v1/"}async join(e){let t=await this.req("channel/join",{device_type:e.deviceType,device_id:e.deviceID,version:e.version});return t.device_type=e.deviceType,t.device_id=e.deviceID,t.version=e.version,t}async detail(e){let t=await this.req("channel/detail",{with_userlist:e});if(e){let e=t.users;return delete t.users,{channelinfo:t,userinfos:e}}return{channelinfo:t,userinfos:null}}async leave(){return this.req("channel/leave",{})}async heartbeat(){return this.req("channel/heartbeat",{})}async reconnect(e){return this.req("channel/reconnect",{type:e.type})}async updateStream(e){return this.req("channel/update-stream",{stream_tracks:e})}async imConnect(e){return this.req("im/connect",{device_type:e.deviceType,device_id:e.deviceID,version:e.version})}async imReconnect(){return this.req("im/reconnect",{})}async imHeartbeat(){return this.req("im/heartbeat",{})}async imDisconnect(){return this.req("im/disconnect",{})}async req(e,t={},r={}){const n=Math.floor(Date.now()/1e3),i=A(16);r.app_id=this.appID,r.sid=this.sid,r.nonce=i,r.timestamp=n+"";let o=this.signature(t,i,n);r.signature=o;let s=Date.now(),a=(r,n)=>{X[r]("rtc api: "+this.serverPrefix+e,t,n,Date.now()-s+"ms")};return this.http(e,t,{...r,"Content-Type":"application/json"}).then((e=>{if(0==e.code)return a(J.DEBUG,e),e.data;throw new D(e.msg,e.code)})).catch((e=>{throw a(J.ERROR,e),e}))}signature(e,t,r){let n=`app_id=${this.appID}&sid=${this.sid}&nonce=${t}×tamp=${r}&`+JSON.stringify(e);return Wt()(n,this.clientKey).toString()}}class er extends Zt{http(e,t,r){return new Promise(((n,i)=>{fetch(this.serverPrefix+e,{method:"POST",headers:r,body:JSON.stringify(t)}).then((e=>{200!=e.status?i(new Error(e.status+":"+e.statusText)):e.json().then((e=>{n(e)})).catch((e=>{i(e)}))})).catch((e=>{i(e)}))}))}async cdnURL(e){return(await this.req("cdn/url",e)).url}async sfuConnect(e){return this.req("sfu/connect",{publish_offer:e})}async sfuDisconnect(){return this.req("sfu/disconnect",{})}async sfuOfferPublish(e){return this.req("sfu/offer-publish",{offer:e})}async sfuSubscribe(e){return this.req("sfu/subscribe",{tracks:e})}async sfuAnswerSubscribe(e){return this.req("sfu/answer-subscribe",{answer:e})}}function tr(e,t,r){var n,i,o;void 0===t&&(t=50),void 0===r&&(r={});var s=null!=(n=r.isImmediate)&&n,a=null!=(i=r.callback)&&i,c=r.maxWait,u=Date.now(),l=[];function h(){if(void 0!==c){var e=Date.now()-u;if(e+t>=c)return c-e}return t}var f=function(){var t=[].slice.call(arguments),r=this;return new Promise((function(n,i){var c=s&&void 0===o;if(void 0!==o&&clearTimeout(o),o=setTimeout((function(){if(o=void 0,u=Date.now(),!s){var n=e.apply(r,t);a&&a(n),l.forEach((function(e){return(0,e.resolve)(n)})),l=[]}}),h()),c){var f=e.apply(r,t);return a&&a(f),n(f)}l.push({resolve:n,reject:i})}))};return f.cancel=function(e){void 0!==o&&clearTimeout(o),l.forEach((function(t){return(0,t.reject)(e)})),l=[]},f}class rr{ctn={};linkids={};[Symbol.iterator](){const e=Object.entries(this.ctn);let t=0;return{next:()=>t<e.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}set(e,t){this.ctn[e]=t,t.link_id&&(this.linkids[t.link_id]=e)}get(e){return this.ctn[e]}getByLinkid(e){return this.get(this.linkids[e])}del(e){delete this.ctn[e]}clear(){this.ctn={},this.linkids={}}listInfo(e){if(e){let e={};for(const t in this.ctn)e[t]=this.ctn[t].getInfo();return e}{let e=[];for(const t in this.ctn)e.push(this.ctn[t].getInfo());return e}}}var nr=function(e){return e.INIT="init",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.LEAVED="leaved",e}(nr||{});class ir extends(f()){options;joinRsp;me;users;info;heartbeatIntervalID;connectState;rtcApi;rtcSocket;rtcStreamEngine;audioMixTrack;videoMcuTrack;eventCB;trackMutex;trackDebounce;constructor(e,t,r,n,i,o=null){super(),this.options=e,this.joinRsp=t,this.users=new rr,this.trackMutex={},this.trackDebounce={},this.rtcApi=r,this.rtcSocket=i,this.rtcStreamEngine=n,this.eventCB=o,this.addSocketListeners(),this.connectState=nr.INIT}async refresh(e){if(!e){const{channelinfo:e,userinfos:t}=await this.rtcApi.detail(!0);if(this.info=e,this.users.clear(),t&&t.forEach((e=>{let t=this.newUser(e);this.users.set(e.uid,t),e.sid==this.joinRsp.sid&&(this.me=t)})),null==this.me){let e={app_id:this.joinRsp.app_id,uid:this.joinRsp.uid,name:"隐身用户",device_id:this.joinRsp.device_id,device_type:this.joinRsp.device_type,version:this.joinRsp.version,channel:this.joinRsp.channel,sid:this.joinRsp.sid,join_at:Math.floor((new Date).getTime()/1e3)};this.me=this.newUser(e),this.users.set(this.joinRsp.uid,this.me)}this.autoSubscribeExistingTracks()}this.heartbeatIntervalID&&clearInterval(this.heartbeatIntervalID);let t=this.heartbeatIntervalID=setInterval((()=>this.heartbeat()),3e4);X.debug("channel heartbeat interval started",t),this.connectState=nr.CONNECTED}autoSubscribeExistingTracks(){if(this.options.autoSubscribeAudio||this.options.autoSubscribeVideo)for(const[e,t]of this.users){if(e===this.joinRsp.uid)continue;const r=t.getTracks();for(const t in r){const n=r[t];this.options.autoSubscribeAudio&&n.kind===M.Audio&&this.subscribeRemoteAudioTrack(e,t),this.options.autoSubscribeVideo&&n.kind===M.Video&&this.subscribeRemoteVideoTrack(e,t)}}}checkConnected(){if(this.connectState!=nr.CONNECTED)switch(this.connectState){case nr.RECONNECTING:throw new D("网络重连中,请稍后");case nr.LEAVED:throw new D("您已离开频道")}}addSocketListeners(){this.onConnected=this.onConnected.bind(this),this.onStartReconnect=this.onStartReconnect.bind(this),this.onChannelMessage=this.onChannelMessage.bind(this),this.rtcSocket.on(Ut.CONNECTED,this.onConnected),this.rtcSocket.on(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.on(Ut.CHANNEL_MESSAGE,this.onChannelMessage)}removeSocketListeners(){this.rtcSocket.off(Ut.CONNECTED,this.onConnected),this.rtcSocket.off(Ut.RECONNECTING,this.onStartReconnect),this.rtcSocket.off(Ut.CHANNEL_MESSAGE,this.onChannelMessage)}triggerEvent(e,t){try{let r=new i(e,t);this.emit(e,r),this.eventCB&&this.eventCB(r)}catch(r){X.error(`事件${e}上层响应出错,请sdk调用者检查`,r,t)}}async heartbeat(){let e=this.heartbeatIntervalID;if(this.connectState!=nr.CONNECTED)throw X.info(`异常channel心跳,当前频道状态${this.connectState}`),clearInterval(e),new D(`异常channel心跳,频道状态为:${this.connectState}`);try{await this.rtcApi.heartbeat()}catch(e){X.error("channel心跳失败",e),e instanceof D&&this.leave(o.Error,e)}X.debug("channel heartbeat interval",e)}async onConnected(){let e=this.connectState;X.warn(e==nr.RECONNECTING?"会控socket重连成功":"会控socket连接成功");try{this.connectState=nr.CONNECTED,await this.refresh(e==nr.RECONNECTING),e==nr.RECONNECTING?this.triggerEvent(s.RECONNECTED):this.triggerEvent(s.JOIN_SUCCEED,this.getInfo())}catch(e){this.leave(o.Error,e)}}onStartReconnect(){X.warn("会控socket开始重连"),clearInterval(this.heartbeatIntervalID),this.connectState=nr.RECONNECTING,this.triggerEvent(s.RECONNECTING)}onChannelMessage(e,t){switch(t.type){case Z.ChannelUpdate:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;this.info.props=e.props,this.info.updated_at=e.updated_at,this.triggerEvent(s.CHANNEL_UPDATE,this.getInfo());break}case Z.ChannelDestroy:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;this.leave(o.Destroy);break}case Z.UserUpdate:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;let r=this.users.get(e.uid);r&&(r.updateInfo(e),this.triggerEvent(e.sid==this.joinRsp.sid?s.ME_UPDATE:s.USER_UPDATE,r.getInfo()));break}case Z.UserLeave:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel)return;if(e.sid==this.joinRsp.sid)this.leave(e.reason);else{let t=this.users.get(e.uid);if(!t)return void X.error(`收到用户${e.uid}离开消息,但其不在频道内`);for(const e in t.getTracks()){let r=t.getTracks()[e];this.rtcStreamEngine.haveSubscribed(r)&&this.unsubscribeRemoteTrack(r,0)}this.users.del(e.uid),this.triggerEvent(s.USER_LEAVE,{uid:e.uid,reason:e.reason})}break}case Z.UserJoin:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel||e.sid==this.joinRsp.sid)return;let r=this.users.get(e.uid);r&&(X.warn(`收到成员${e.uid}(${e.name})入会消息,但其已经在频道内,先模拟一次离开频道`),this.users.del(e.uid),this.triggerEvent(s.USER_LEAVE,{uid:e.uid,reason:o.Error})),r=this.newUser(e),this.users.set(e.uid,r),this.triggerEvent(s.USER_JOIN,r.getInfo());break}case Z.StreamUpdate:{const e=t.data;if(!e||e.channel!=this.joinRsp.channel||e.sid==this.joinRsp.sid)return;let r=this.users.get(e.uid),{added:n,updated:i,deleted:o}=r.updateTracks(e.stream_tracks),a=r.getInfo();o.forEach((e=>{this.rtcStreamEngine.haveSubscribed(e)&&this.unsubscribeRemoteTrack(e,0),"stopPlay"in e&&"function"==typeof e.stopPlay&&e.stopPlay(),"removeAllPlayViews"in e&&"function"==typeof e.removeAllPlayViews&&e.removeAllPlayViews(),this.triggerEvent(s.USER_TRACK_REMOVE,{user:a,track:e.getInfo()})})),i.forEach((e=>{this.triggerEvent(s.USER_TRACK_UPDATE,{user:a,track:e.getInfo()})})),n.forEach((e=>{this.options.autoSubscribeAudio&&e.kind==M.Audio&&this.subscribeRemoteAudioTrack(a.uid,e.id),this.options.autoSubscribeVideo&&e.kind==M.Video&&this.subscribeRemoteVideoTrack(a.uid,e.id),this.triggerEvent(s.USER_TRACK_ADD,{user:a,track:e.getInfo()})})),this.triggerEvent(s.USER_UPDATE,a);break}case Z.Custom:{const r=t.data;if(!r||r.channel!=this.joinRsp.channel)return;r.private=-1!==e.indexOf("/channel-user/"),this.triggerEvent(s.CUSTOM_MSG,r);break}}}getMe(){if(!this.me)throw new D("尚未获取到自己信息");return this.me}getUser(e){let t=this.users.get(e);if(!t)throw new D(`频道内没有用户${e}`);return t}getUsersInfo(e){return this.users.listInfo(e)}async leave(e,t){if(this.connectState!==nr.LEAVED){clearInterval(this.heartbeatIntervalID),this.removeSocketListeners();try{await this.rtcSocket.close()}catch(e){X.error("断开会控socket报错",e)}try{await this.rtcApi.leave()}catch(e){X.error("调离开频道api报错",e)}try{await this.rtcStreamEngine.disconnect()}catch(e){X.error("断开流媒体引擎报错",e)}this.connectState=nr.LEAVED,this.triggerEvent(s.DISCONNECTED,{reason:e,error:t}),this.removeAllListeners(),this.eventCB=null,X.center?.flush(),X.info("leaved channel",this.joinRsp.channel,e)}}getInfo(){let e={...this.info};return e.props={...e.props},e}getStreamMetric(){return this.rtcStreamEngine.getMetricSnapshot()}getStreamEngineVendor(){return this.rtcStreamEngine.vendor()}async getPublishExOption(e,t){return{}}getAddedTracksAfterPublish(e,t){if(e.kind==M.Audio){let r=t;e.updateInfo(v({desc:r.desc,codec:r.codec,bitrate:r.maxBitrate,props:r.props}))}else{let r=t;e.updateInfo(v({desc:r.desc,codec:r.codec,width:r.width,height:r.height,fps:r.maxFramerate,bitrate:r.maxBitrate,props:r.props}))}return[e]}getDeletedTracksAfterUnpublish(e){return[e]}async publishLocalTrack(e,t){if(!t.desc)throw new D("轨道发布描述不能为空");let r=this.getMe();const n=await this.lockTrack(e.id);try{let n=await this.getPublishExOption(e,t);await this.rtcStreamEngine.publish(e,t,n);let i=this.getAddedTracksAfterPublish(e,t);try{let e=Object.values(r.getTracks()).map((e=>e.getInfo()));e.push(...i.map((e=>e.getInfo()))),await this.rtcApi.updateStream(e),i.forEach((e=>{r.getTracks()[e.id]=e})),r.updateInfo({stream_tracks:e}),this.triggerEvent(s.ME_UPDATE,r.getInfo())}catch(t){throw this.unpublishLocalTrack(e),t}}finally{n()}}async unpublishLocalTrack(e){let t=this.getMe();const r=await this.lockTrack(e.id);try{let r=Object.values(t.getTracks()).map((e=>e.getInfo()));if(!r.some((t=>t.id===e.id)))return void X.warn(e.toString()+"已取消发布,无需再次取消发布");let n=this.getDeletedTracksAfterUnpublish(e),i=r.filter((e=>!n.some((t=>t.id===e.id))));await this.rtcApi.updateStream(i);try{await this.rtcStreamEngine.unpublish(e),n.forEach((e=>{delete t.getTracks()[e.id]})),t.updateInfo({stream_tracks:i}),this.triggerEvent(s.ME_UPDATE,t.getInfo())}catch(e){throw await this.rtcApi.updateStream(r),e}}finally{r()}}async getSubscribeExOption(e){return{}}async subscribeRemoteAudioMixTrack(e){let t=this.audioMixTrack;if(t)if("RemoteAudioMixTrack"===t.__type){let r=t.getFilterUids(),n=[];e&&Array.isArray(e)&&(n=e),r.join(",")!==n.join(",")&&this.rtcStreamEngine.haveSubscribed(t)&&await this.unsubscribeRemoteTrack(t,0)}else t.stop(),this.audioMixTrack=t=void 0;t||(t=this.newRemoteAudioMixTrack(e));const r=await this.lockTrack(t.id);try{if("RemoteAudioMixTrack"===t.__type){let e=await this.getSubscribeExOption(t);await this.rtcStreamEngine.subscribe(t,e)}else if("MockRemoteAudioMixTrack"===t.__type){this.options.autoSubscribeAudio=!0;for(const[e,r]of this.users){if(e===this.joinRsp.uid)continue;let n=r.getTracks();for(const r in n){let i=n[r];i.kind!==M.Audio||t.checkFilter(i)||(this.subscribeRemoteAudioTrack(e,r),t.addTrack(i))}}}return this.audioMixTrack=t,t}finally{r()}}async subscribeRemoteAudioTrack(e,t){let r=this.getUser(e).getTrack(t);if(!r)throw F(e+"没有id为"+t+"的音频流");if(r.kind!=M.Audio)throw new D(e+"id为"+t+"的流非音频,而是"+r.kind);const n=await this.lockTrack(r.id);try{let t=await this.getSubscribeExOption(r);return await this.rtcStreamEngine.subscribe(r,t),e!==this.joinRsp.uid&&this.audioMixTrack&&"MockRemoteAudioMixTrack"===this.audioMixTrack.__type&&!this.audioMixTrack.checkFilter(r)&&this.audioMixTrack.addTrack(r),r}finally{n()}}async subscribeRemoteVideoMcuTrack(){let e=this.videoMcuTrack;e||(e=this.newRemoteVideoMcuTrack());const t=await this.lockTrack(e.id);try{let t=await this.getSubscribeExOption(e);return await this.rtcStreamEngine.subscribe(e,t),this.videoMcuTrack=e,e}finally{t()}}async subscribeRemoteVideoTrack(e,t){let r=this.getUser(e).getTrack(t);if(!r)throw F(e+"没有id为"+t+"的视频流");if(r.kind!=M.Video)throw new D(e+"id为"+t+"的流非视频,而是"+r.kind);this.trackDebounce[r.id]?.cancel("subscribe");const n=await this.lockTrack(r.id);try{let e=await this.getSubscribeExOption(r);return await this.rtcStreamEngine.subscribe(r,e),r}finally{n()}}async unsubscribeRemoteTrack(e,t=2e3){if(t<=0){const t=await this.lockTrack(e.id);try{this.audioMixTrack&&this.audioMixTrack===e&&"MockRemoteAudioMixTrack"===this.audioMixTrack.__type?(this.audioMixTrack.stop(),this.audioMixTrack=void 0):(await this.rtcStreamEngine.unsubscribe(e),e.kind===M.Audio&&this.audioMixTrack&&"MockRemoteAudioMixTrack"===this.audioMixTrack.__type&&this.audioMixTrack.removeTrack(e))}finally{t()}return}(this.trackDebounce[e.id]=tr((async()=>{await this.unsubscribeRemoteTrack(e,0)}),2e3))().catch((t=>{X.warn(e.toString()+"取消订阅动作被终止",t)}))}async lockTrack(e){let t=this.trackMutex[e];return t||(this.trackMutex[e]=t=new _),t.lock()}}class or extends s{static DEVICE_ADD="device_add";static DEVICE_REMOVE="device_remove";static TRACK_AUTOPLAY_FAIL="track_autoplay_fail"}class sr extends a{static AUTOPLAY_FAIL="autoplay_fail";static MSTRACK_REPLACED="mstrack_replaced";static RECONNECTING="reconnecting";static RECONNECTED="reconnected"}class ar extends N{mediaStream;mediaStreamTrack;constructor(e,t){super(e,t),this.onMute=this.onMute.bind(this),this.onUnmute=this.onUnmute.bind(this),this.onEnded=this.onEnded.bind(this),this.mediaStream=new MediaStream}addMsTrackListeners(e){e.addEventListener("mute",this.onMute),e.addEventListener("unmute",this.onUnmute),e.addEventListener("ended",this.onEnded)}removeMsTrackListeners(e){e.removeEventListener("mute",this.onMute),e.removeEventListener("unmute",this.onUnmute),e.removeEventListener("ended",this.onEnded)}onMute(){X.info(this.toString(),"muted"),this.emit(a.MUTED,this)}onUnmute(){X.info(this.toString(),"unmuted"),this.emit(a.UNMUTED,this)}onEnded(){X.info(this.toString(),"ended"),this.emit(a.ENDED,this)}setMediaStreamTrack(e){let t=this.mediaStreamTrack;if(t!=e){if(t&&(this.mediaStream.removeTrack(t),this.removeMsTrackListeners(t)),this.mediaStreamTrack=e,e){this.mediaStream.addTrack(e),this.addMsTrackListeners(e);let t=e.getSettings();X.debug(this.toString(),"实际采集到的mstrack设置",t)}this.emit(sr.MSTRACK_REPLACED,this,t)}}getMediaStreamTrack(){return this.mediaStreamTrack}getMediaStream(){return this.mediaStream}}class cr{track;audioElements;constructor(e){this.track=e,this.audioElements=[]}isPlaying(){return this.audioElements.length>0}destroyAudioElement(e){e.srcObject=null,e.remove()}async startPlay(e){if(this.stopPlay(),!this.track.getMediaStreamTrack())throw new D(this.track.toString()+"的mediaStreamTrack不存在,无法播放声音");let t=document.createElement("audio");return t.autoplay=!1,t.srcObject=this.track.getMediaStream(),t.style.display="none",document.body.appendChild(t),e?.deviceId&&("setSinkId"in t?await t.setSinkId(e.deviceId):X.error("当前环境不支持setSinkId,将从默认扬声器播放")),e?.volume&&(t.volume=e.volume),t.addEventListener("pause",(()=>{t.play().catch((e=>{console.error("音频暂停,尝试恢复播放失败",e)}))})),new Promise((async(e,r)=>{let n=setTimeout((()=>{X.warn("音频play超时未响应,默认视为浏览器权限问题处理"),this.destroyAudioElement(t),e(!1)}),1e3);try{await t.play(),clearTimeout(n),this.audioElements.push(t),e(!0)}catch(i){clearTimeout(n),this.destroyAudioElement(t),i instanceof DOMException&&"NotAllowedError"===i.name?e(!1):r(new D(this.track.toString()+"自动播放失败:"+i))}}))}stopPlay(){this.audioElements.forEach((e=>this.destroyAudioElement(e))),this.audioElements=[]}setVolume(e){this.audioElements.forEach((t=>t.volume=e))}}class ur{track;videoElements;resizeObserver;constructor(e){this.track=e,this.videoElements=[],this.track.on(sr.INFO_UPDATE,(()=>{this.videoElements.forEach((e=>{this.freshTransform(e)}))})),this.resizeObserver=new ResizeObserver((e=>{for(const t of e){const e=this.videoElements.find((e=>e.parentElement===t.target));e&&this.freshTransform(e)}}))}addPlayView(e){if(!this.track.getMediaStreamTrack())throw new D(this.track.toString()+"的mediaStreamTrack不存在,无法添加播放view");if(this.videoElements.find((t=>t.parentElement==e)))return;"static"===getComputedStyle(e).position&&(e.style.position="relative"),e.style.overflow="hidden";let t=document.createElement("video");t.muted=!0,t.controls=!1,t.playsInline=!0,t.style.objectFit="contain",t.onloadedmetadata=()=>{this.freshTransform(t)},t.srcObject=this.track.getMediaStream(),"safari"===Yt().browser?.name?.toLowerCase()||"firefox"===Yt()?.browser?.name?.toLowerCase()?setTimeout((()=>{t.srcObject=this.track.getMediaStream(),t.play().catch((e=>{console.error("视频播放失败",e)}))}),0):t.autoplay=!0,("miniprogram"===window.__wxjs_environment||navigator?.userAgent.toLowerCase().includes("miniprogram")||navigator?.userAgent.toLowerCase().includes("micromessenger"))&&t.play().catch((e=>{lr.show(this.track.id,this.track.desc,(()=>{t.play().catch((e=>{console.error("视频播放失败",e)}))}))})),t.addEventListener("pause",(()=>{t.play().catch((e=>{console.error("视频暂停,尝试恢复播放失败",e)}))})),e.appendChild(t),this.videoElements.push(t),this.resizeObserver.observe(e),1==this.videoElements.length&&this.watchAppShowHide()}onAppShowHide=()=>{"hidden"!==document.visibilityState&&this.videoElements.forEach((e=>{e.play().catch((e=>{console.error("视频播放失败",e)}))}))};watchAppShowHide(){document.addEventListener("visibilitychange",this.onAppShowHide)}unwatchAppShowHide(){document.removeEventListener("visibilitychange",this.onAppShowHide)}needSwapDimensions(e){return 1129136434===e||1129136441===e}freshTransform(e){const t=e.parentElement;if(!t)return;const r=this.track.getInfo().angle,n=t.clientWidth,i=t.clientHeight;switch(e.style.position="absolute",e.style.left="50%",e.style.top="50%",this.needSwapDimensions(r)?(e.style.width=`${i}px`,e.style.height=`${n}px`):(e.style.width=`${n}px`,e.style.height=`${i}px`),r){case 1129136434:e.style.transform="translate(-50%, -50%) rotate(270deg)";break;case 1129136433:e.style.transform="translate(-50%, -50%) rotate(180deg)";break;case 1129136441:e.style.transform="translate(-50%, -50%) rotateY(180deg) rotate(-90deg)";break;default:e.style.transform="translate(-50%, -50%)"}}hasPlayView(){return this.videoElements.length>0}removePlayView(e){let t=this.videoElements.findIndex((t=>t.parentElement==e));t>=0&&(this.resizeObserver.unobserve(e),this.videoElements[t].remove(),this.videoElements.splice(t,1)),0==this.videoElements.length&&this.unwatchAppShowHide()}removeAllPlayViews(){this.videoElements.forEach((e=>{e.parentElement&&this.resizeObserver.unobserve(e.parentElement),e.remove()})),this.videoElements=[],this.unwatchAppShowHide()}destroy(){this.removeAllPlayViews(),this.resizeObserver.disconnect()}}class lr{static htmlTpl='<div id="$id$" class="autoplay-dialog-container">\n <div class="autoplay-dialog">\n <div class="autoplay-dialog-content">\n <p>因浏览器权限问题自动播放$desc$失败,点击恢复自动播放</p>\n </div>\n <div class="autoplay-dialog-actions">\n <button class="autoplay-dialog-button">确定</button>\n </div>\n </div>\n</div>';static cssTpl=".autoplay-dialog-container {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n}\n\n.autoplay-dialog {\n background-color: white;\n padding: 20px;\n border-radius: 5px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n text-align: center;\n}\n\n.autoplay-dialog-content {\n margin-bottom: 20px;\n}\n\n.autoplay-dialog-button {\n background-color: #007bff;\n color: white;\n border: none;\n padding: 10px 20px;\n border-radius: 5px;\n cursor: pointer;\n}";static callbacks=[];static isShowing=!1;static show(e,t,r){if(this.callbacks.push(r),this.isShowing)return;this.isShowing=!0;const n=document.createElement("style");n.textContent=this.cssTpl,document.head.appendChild(n);let i="autoplay-"+e,o=document.createElement("div");document.body.append(o),o.outerHTML=this.htmlTpl.replace("$id$",i).replace("$desc$",t),document.getElementById(i).onclick=e=>{n.remove(),e.currentTarget.remove();const t=this.callbacks.slice();this.callbacks=[],this.isShowing=!1,t.forEach((e=>{try{e()}catch(e){X.error("AutoPlayDialog callback error",e)}}))}}}function hr(e){const t=new AudioContext,r=t.createMediaStreamDestination(),n=r.stream.getAudioTracks()[0];if(!n)throw new Error("Failed to create mixed audio track");let i,o;if(n.context=t,n.trackCount=0,e){i=t.createAnalyser(),i.fftSize=256;const r=i.frequencyBinCount,n=new Uint8Array(r),s=()=>{o=requestAnimationFrame(s),i.getByteFrequencyData(n);const t=e.canvas;e.fillStyle="rgb(0, 0, 0)",e.fillRect(0,0,t.width,t.height);const a=t.width/r*2.5;let c,u=0;for(let i=0;i<r;i++)c=n[i]/255*t.height,e.fillStyle=`rgb(${c+100}, 50, 50)`,e.fillRect(u,t.height-c/2,a,c/2),u+=a+1};s()}const s=new Map;return n.addTrack=e=>{if("ended"===e.readyState||!t||s.has(e))return;const o=new MediaStream([e]),a=t.createMediaStreamSource(o);i&&a.connect(i),a.connect(r),s.set(e,{source:a,stream:o}),e.addEventListener("ended",(()=>{n.removeTrack(e)})),n.trackCount++},n.removeTrack=e=>{const t=s.get(e);t&&(t.source.disconnect(),s.delete(e),n.trackCount--)},n}class fr{mediaStreamTrack;tracks;contextResumeRequested;constructor(){this.mediaStreamTrack=hr(),this.tracks={},this.contextResumeRequested=!1}requestContextResumeIfNeeded(){const e=this.mediaStreamTrack?.context;e&&"running"!==e.state&&!this.contextResumeRequested&&(this.contextResumeRequested=!0,e.resume().then((()=>{this.contextResumeRequested=!1})).catch((t=>{lr.show(this.mediaStreamTrack.id,"混音音频",(async()=>{try{"suspended"===e.state&&await e.resume()}catch(e){X.error("混音音频上下文恢复失败",e)}finally{this.contextResumeRequested=!1}}))})))}warnupRemoteAudioTrack(e){const t=e.getMediaStreamTrack();t&&!e.isPlaying()&&((new Audio).srcObject=new MediaStream([t]))}addTrack(e){if(this.tracks[e.id])return;const t=e.getMediaStreamTrack();t&&(e instanceof dr&&this.warnupRemoteAudioTrack(e),this.mediaStreamTrack?.addTrack(t),this.requestContextResumeIfNeeded()),e.on(sr.MSTRACK_REPLACED,this.onTrackMsTrackReplace),this.tracks[e.id]=new WeakRef(e)}removeTrack(e){let t=e.getMediaStreamTrack();t&&this.mediaStreamTrack?.removeTrack(t),e.off(sr.MSTRACK_REPLACED,this.onTrackMsTrackReplace),delete this.tracks[e.id]}onTrackMsTrackReplace=(e,t)=>{t&&this.mediaStreamTrack?.removeTrack(t);const r=e.getMediaStreamTrack();r&&(e instanceof dr&&this.warnupRemoteAudioTrack(e),this.mediaStreamTrack?.addTrack(r),this.requestContextResumeIfNeeded())};getTrackCount(){return Object.keys(this.tracks).length}stop(){for(const e in this.tracks){const t=this.tracks[e].deref();t&&this.removeTrack(t)}this.tracks={},this.mediaStreamTrack?.context.close(),this.mediaStreamTrack?.stop()}getMixedMediaStreamTrack(){return this.mediaStreamTrack}}class dr extends ar{playTrait;constructor(e,t){super(e,t),this.playTrait=new cr(this)}strPrefix(){return"远端音频流轨道"}isPlaying(){return this.playTrait.isPlaying()}async startPlay(e){await this.playTrait.startPlay(e)||(e&&e.disableAutoPlayDialog?this.emit(sr.AUTOPLAY_FAIL,this):lr.show(this.id,this.desc,(()=>{this.startPlay(e)})))}stopPlay(){this.playTrait.stopPlay()}}class pr extends dr{__type="RemoteAudioMixTrack";filterUids;constructor(e,t){super(e,""),this.filterUids=t||[]}getFilterUids(){return this.filterUids}strPrefix(){return"远端频道混音流轨道"}}class gr extends dr{__type="MockRemoteAudioMixTrack";audioMixTrait;filter;constructor(e,t){super(e,""),this.audioMixTrait=new fr,this.setMediaStreamTrack(this.audioMixTrait.getMixedMediaStreamTrack()),this.filter=t}checkFilter(e){return!!this.filter&&this.filter(e)}addTrack(e){this.checkFilter(e)||this.audioMixTrait.addTrack(e)}removeTrack(e){this.audioMixTrait.removeTrack(e)}stop(){this.audioMixTrait.stop()}strPrefix(){return"本地合成的远端混音流轨道"}}class mr extends ar{playTrait;constructor(e,t){super(e,t),this.playTrait=new ur(this)}strPrefix(){return"远端视频流轨道"}addPlayView(e){this.playTrait.addPlayView(e)}hasPlayView(){return this.playTrait.hasPlayView()}removePlayView(e){this.playTrait.removePlayView(e)}removeAllPlayViews(){this.playTrait.removeAllPlayViews()}}class yr extends mr{constructor(e){super(e,"")}strPrefix(){return"远端视频合成流轨道"}}class vr{tracks;info;constructor(e){this.info=e,this.tracks={},e.stream_tracks?.forEach((e=>{let t=this.newTrack(e);this.tracks[e.id]=t}))}getTrack(e){return this.tracks[e]}getTrackByDesc(e){for(let t in this.tracks)if(this.tracks[t].desc===e)return this.tracks[t]}getTracks(){return this.tracks}updateTracks(e){let t=[],r=[],n=[],i={},o={};for(let e in this.tracks)i[e]=!0,o[e]=this.tracks[e];e.forEach((e=>{let n=o[e.id];if(n){let t=n.updateInfo(e);delete i[e.id],t.length>0&&r.push(n)}else{let r=this.newTrack(e);this.tracks[e.id]=r,t.push(r)}}));for(let e in i){let t=this.tracks[e];t&&(delete this.tracks[e],n.push(t))}return this.info.stream_tracks=e,{added:t,updated:r,deleted:n}}get uid(){return this.info.uid}get sid(){return this.info.sid}get device_type(){return this.info.device_type}get device_id(){return this.info.device_id}get link_id(){return this.info.link_id}getInfo(){let e={...this.info};return e.props={...e.props},e.stream_tracks=e.stream_tracks?.map((e=>({...e}))),e}updateInfo(e){E(this.info,e)}}class br extends vr{newTrack(e){switch(e.kind){case M.Video:return new mr(e,this.uid);case M.Audio:return new dr(e,this.uid)}}}class wr extends ir{_trackIdx=0;newUser(e){return new br(e)}async getPublishExOption(e,t){let r={};if(this.rtcStreamEngine.vendor()===Kt.OOK){let t=-1;e.kind==M.Video&&(t=this.rtcStreamEngine.getAvailableVideoTrackNo()),r={track:t},e.updateInfo({track:t})}else e.updateInfo({track:this._trackIdx++});return r}getAddedTracksAfterPublish(e,t){let r=super.getAddedTracksAfterPublish(e,t);if(this.rtcStreamEngine.vendor()===Kt.Seastart)if(e.kind==M.Video){let n=t,i=e;if(n.simulcasts&&n.simulcasts.length>0)for(let e=0;e<n.simulcasts.length;e++){let t=n.simulcasts[e],o=i.getSimulcastTrack(t,n.width,n.height);o.updateInfo(v({desc:t.desc,codec:t.codec,width:t.width,height:t.height,fps:t.maxFramerate,bitrate:t.maxBitrate,props:t.props})),r.push(o)}}return r}getDeletedTracksAfterUnpublish(e){let t=super.getDeletedTracksAfterUnpublish(e);if(this.rtcStreamEngine.vendor()===Kt.Seastart)if(e.kind==M.Video){let r=e;t.push(...Object.values(r.getSimulcastTracks()))}return t}async getSubscribeExOption(e){let t={};if(this.rtcStreamEngine.vendor()===Kt.OOK)if(e instanceof pr){let r=[];e.getFilterUids().forEach((e=>{if(e&&e!=this.joinRsp.uid)try{let t=this.getUser(e);r.push(t.link_id)}catch(e){}})),t={filter_link_ids:r}}else if(e instanceof yr)t={};else{let r=this.getUser(e.getUid()),n=e.getInfo();t={link_id:r.link_id,track:n.track}}return t}newRemoteAudioMixTrack(e){if(this.getStreamEngineVendor()==Kt.OOK)return new pr({id:P,desc:"频道混音流",kind:M.Audio},Array.isArray(e)?e:[]);if(e&&Array.isArray(e)){let t=e;e=e=>t.includes(e.getUid())}return new gr({id:P,desc:"频道混音流",kind:M.Audio},e)}newRemoteVideoMcuTrack(){return new yr({id:"__mcu__",desc:"视频合成流",kind:M.Video})}}const _r="default";class kr extends(f()){static instance;static devices=[];static debouncedDeviceChangeHandler=tr((async()=>{let e=kr.devices,t=await kr.instance.getDevices();const r=t.filter((t=>!e.some((e=>e.deviceId===t.deviceId)))),n=e.filter((e=>!t.some((t=>e.deviceId===t.deviceId))));r.forEach((e=>{X.info("新设备插入:",e),kr.instance.emit("add",e)})),n.forEach((e=>{X.info("设备被拔出:",e),kr.instance.emit("remove",e)}))}),100,{isImmediate:!1});static getInstance(){if(void 0===kr.instance){kr.instance=new kr;"undefined"==typeof window||window.isSecureContext||void 0!==navigator?.mediaDevices||X.warn("当前非安全环境(https或localhost或127.0.0.1),将无法获取麦克风、摄像头等媒体设备进行枚举、音视频采集、推流"),navigator?.mediaDevices?.addEventListener("devicechange",(()=>{kr.debouncedDeviceChangeHandler()}))}return kr.instance}static waitingMediaDevicePromises=[];async addWaitMediaDevice(e,t,r){let n=kr.waitingMediaDevicePromises;n.push(e);try{return await e}catch(e){throw X.error(`mediaDevices.${t} error`,e,r),e}finally{n.splice(n.indexOf(e),1)}}async enum(){let e=navigator.mediaDevices.enumerateDevices();return this.addWaitMediaDevice(e,"enumerateDevices")}async getUserMedia(e){let t=navigator.mediaDevices.getUserMedia(e);return this.addWaitMediaDevice(t,"getUserMedia",e)}async waitMediaDevices(){return Promise.allSettled(kr.waitingMediaDevicePromises)}async getDevices(e,t=!0){let r=await this.enum();if(t){if(0===r.length||r.some((t=>{const r=""===t.label,n=!e||t.kind===e;return r&&n}))){const t={video:"audioinput"!==e&&"audiooutput"!==e,audio:"videoinput"!==e};for(;;)try{const e=await this.getUserMedia(t);r=await this.enum(),e.getTracks().forEach((e=>{e.stop()}));break}catch(e){if(e instanceof DOMException&&"NotFoundError"===e.name&&(t.video?t.video=!1:t.audio&&(t.audio=!1),t.audio||t.video))continue;throw e}}}return e?r=r.filter((t=>t.kind===e)):t&&(kr.devices=r),r}async normalizeDeviceId(e,t,r){if(t!==_r)return t;const n=await this.getDevices(e),i=new Map(n.map((e=>[e.groupId,0])));n.forEach((e=>i.set(e.groupId,(i.get(e.groupId)??0)+1)));const o=n.find((e=>(r===e.groupId||(i.get(e.groupId)??0)>1)&&e.deviceId!==_r));return o?.deviceId}}class Sr extends ar{playTrait;constructor(){super({id:A(20),kind:M.Audio,track:-1},""),this.playTrait=new cr(this)}getVolume(){return 0}strPrefix(){return"本地音频流轨道"}isPlaying(){return this.playTrait.isPlaying()}async startPlay(e){await this.playTrait.startPlay(e)||(e&&e.disableAutoPlayDialog?this.emit(sr.AUTOPLAY_FAIL,this):lr.show(this.id,this.desc,(()=>{this.startPlay(e)})))}stopPlay(){this.playTrait.stopPlay()}}class Er extends Sr{audioMixTrait;constructor(){super(),this.audioMixTrait=new fr,this.setMediaStreamTrack(this.audioMixTrait.getMixedMediaStreamTrack())}addTrack(e){this.audioMixTrait.addTrack(e)}removeTrack(e){this.audioMixTrait.removeTrack(e)}getTrackCount(){return this.audioMixTrait.getTrackCount()}stop(){this.audioMixTrait.stop()}strPrefix(){return"本地混音流轨道"}}class Tr extends Sr{captureOptions;constructor(e){super(),this.captureOptions=!0===e||{...e}}strPrefix(){return"本地屏幕共享音频流轨道"}stopCapture(){let e=this.getMediaStreamTrack();e?e.stop():X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}}class Cr extends Sr{captureOptions;constructor(e){super(),this.captureOptions={...e}}strPrefix(){return"本地麦克风流轨道"}onEnded(){X.warn(this.toString(),"异常结束,自动尝试默认麦克风"),this.changeDeviceId(_r).catch((e=>{X.error(this.toString(),"异常结束,自动尝试默认麦克风失败",e),super.onEnded()}))}async startCapture(e){e&&E(this.captureOptions,e);let t=this.captureOptions;t.deviceId&&t.deviceId!=_r&&(t={...this.captureOptions},t.deviceId={exact:this.captureOptions.deviceId});let r=await kr.getInstance().getUserMedia({audio:t,video:!1});this.setMediaStreamTrack(r.getTracks()[0])}stopCapture(){let e=this.getMediaStreamTrack();e?e.stop():X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}async changeDeviceId(e){if(this.captureOptions.deviceId===e&&e!=_r)return;return this.captureOptions.deviceId=e,this.getMediaStreamTrack()?(this.stopCapture(),this.startCapture()):void 0}}class Ar extends ar{playTrait;simulcastTracks={};scaleResolutionDownBy=1;constructor(){super({id:A(20),kind:M.Video,track:-1},""),this.playTrait=new ur(this)}strPrefix(){return"本地视频流轨道"}setMediaStreamTrack(e){super.setMediaStreamTrack(e);for(let t in this.simulcastTracks)this.simulcastTracks[t].setMediaStreamTrack(e)}getSimulcastTrack(e,t,r){if(!e.desc)throw new D("联播轨道发布描述不能为空");let n=this.simulcastTracks[e.desc];if(!n){n=this.simulcastTracks[e.desc]=new Ar;const i=Math.min(t||this.mediaStreamTrack?.getSettings().width||0,r||this.mediaStreamTrack?.getSettings().height||0);i>0&&e.width&&e.height&&(n.scaleResolutionDownBy=Math.max(1,i/Math.min(e.width,e.height)),X.debug(n.toString(),`编码缩放倍数:${n.scaleResolutionDownBy}`)),n.setMediaStreamTrack(this.mediaStreamTrack)}return n}getSimulcastTracks(){return this.simulcastTracks}getScaleResolutionDownBy(){return this.scaleResolutionDownBy}addPlayView(e){this.playTrait.addPlayView(e)}hasPlayView(){return this.playTrait.hasPlayView()}removePlayView(e){this.playTrait.removePlayView(e)}removeAllPlayViews(){this.playTrait.removeAllPlayViews()}}class xr extends Ar{captureOptions;constructor(e){super(),this.captureOptions={...e}}strPrefix(){return"本地摄像头视频流轨道"}onEnded(){X.warn(this.toString(),"异常结束,自动尝试默认摄像头"),this.changeDeviceId(_r).catch((e=>{X.error(this.toString(),"异常结束,自动尝试默认摄像头失败",e),super.onEnded()}))}async startCapture(e){e&&E(this.captureOptions,e);let t=this.captureOptions;t.deviceId&&t.deviceId!=_r&&(t={...this.captureOptions},t.deviceId={exact:this.captureOptions.deviceId});let r=await kr.getInstance().getUserMedia({audio:!1,video:t});this.setMediaStreamTrack(r.getTracks()[0])}stopCapture(){let e=this.getMediaStreamTrack();e?e.stop():X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}async changeDeviceId(e){if(this.captureOptions.deviceId===e&&e!=_r)return;return this.captureOptions.deviceId=e,this.getMediaStreamTrack()?(this.stopCapture(),this.startCapture()):void 0}async switchFacingMode(){if(this.captureOptions.facingMode="environment"==this.captureOptions.facingMode?"user":"environment",this.getMediaStreamTrack())return this.stopCapture(),this.startCapture()}}class Ir extends Ar{captureOptions;audioTrack;constructor(e){super(),this.captureOptions={...e}}strPrefix(){return"本地屏幕分享视频流轨道"}setAudioTrack(e){this.audioTrack=e}getAudioTrack(){return this.audioTrack}async startCapture(e){if(e&&E(this.captureOptions,e),void 0===navigator.mediaDevices.getDisplayMedia)throw new D("getDisplayMedia not supported");(await navigator.mediaDevices.getDisplayMedia({audio:!!this.audioTrack&&this.audioTrack.captureOptions,video:this.captureOptions})).getTracks().forEach((e=>{e.kind==M.Audio?this.audioTrack?.setMediaStreamTrack(e):(this.setMediaStreamTrack(e),this.captureOptions.contentHint&&(e.contentHint=this.captureOptions.contentHint))}))}stopCapture(){let e=this.getMediaStreamTrack();e?(e.stop(),this.audioTrack?.stopCapture()):X.warn(this.toString()+"的mediaStreamTrack不存在,无需停止采集")}}const Rr={speech:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,sampleRate:48e3},publish:{desc:"mic",maxBitrate:24e3,priority:"high"}},music:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,sampleRate:48e3},publish:{desc:"mic",maxBitrate:32e3,priority:"high"}},musicStereo:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:2,sampleRate:48e3},publish:{desc:"mic",maxBitrate:48e3,priority:"high"}},musicHighQuality:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:1,sampleRate:48e3},publish:{desc:"mic",maxBitrate:64e3,priority:"high"}},musicHighQualityStereo:{capture:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,channelCount:2,sampleRate:48e3},publish:{desc:"mic",maxBitrate:96e3,priority:"high"}}},Pr=[{desc:"camera_small",width:320,height:180,maxBitrate:25e4,maxFramerate:15}],Mr={"1080p":{capture:{width:1920,height:1080,frameRate:15},publish:{desc:"camera_big",maxBitrate:25e5,maxFramerate:15,simulcasts:Pr,degradationPreference:"maintain-resolution"}},"720p":{capture:{width:1280,height:720,frameRate:15},publish:{desc:"camera_big",maxBitrate:12e5,maxFramerate:15,simulcasts:Pr}},"360p":{capture:{width:640,height:360,frameRate:15},publish:{maxBitrate:55e4,maxFramerate:15}},"180p":{capture:{width:320,height:180,frameRate:15},publish:{maxBitrate:25e4,maxFramerate:15}}},Or={"1080p":{capture:{width:1920,height:1080,frameRate:10},publish:{desc:"screen",maxBitrate:2e6,maxFramerate:10,degradationPreference:"maintain-resolution"}},"720p":{capture:{width:1280,height:720,frameRate:10},publish:{desc:"screen",maxBitrate:15e5,maxFramerate:10,degradationPreference:"maintain-resolution"}}},Br={default:{capture:!0,publish:{desc:"screen_audio",maxBitrate:24e3,priority:"high"}}};class Nr extends jt{}function Lr(e,t){if(!t)return 0;let r,n;return"bytesReceived"in e?(r=e.bytesReceived,n=t.bytesReceived):"bytesSent"in e&&(r=e.bytesSent,n=t.bytesSent),void 0===r||void 0===n||void 0===e.timestamp||void 0===t.timestamp?0:C(8*(r-n)/(e.timestamp-t.timestamp),2)}function Dr(e,t){return t?void 0===e.framesDecoded||void 0===t.framesDecoded?0:Math.round(1e3*(e.framesDecoded-t.framesDecoded)/(e.timestamp-t.timestamp)):0}class Ur extends Gt{dftPCConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}]};async publish(e,t,r){if(await super.publish(e,t,r),!e.getMediaStreamTrack())throw new D(e.toString()+"的mediaStreamTrack不存在,无法发布");if(e.kind==M.Audio&&!Xt.checkAudioCodec("OPUS"))throw new D("当前环境不支持OPUS音频编解码,"+e.toString()+"无法发布");if(e.kind==M.Video&&!Xt.checkVideoCodec("H264"))throw new D("当前环境不支持H264视频编解码,"+e.toString()+"无法发布");if(!("addTransceiver"in RTCPeerConnection.prototype)&&!("addTrack"in RTCPeerConnection.prototype))throw new D("当前环境不支持addTransceiver或addTrack,无法发布")}onPubMsTrackReplace=(e,t)=>{if(!this.published[e.id])return;const r=this.published[e.id];r.sender?.replaceTrack(e.getMediaStreamTrack()??null)};updateTrackInfoAfterPublish(e){if(!this.published[e.id])return;const t=this.published[e.id];if(!t.sender)return;let r=t.sender.getParameters().codecs;if(0===r.length)return void X.warn("推流成功后,无法获取编码器信息",e.toString());let n=r[0];X.debug("推流成功后,更新trackinfo codec",e.toString(),"codecInfo",n);let i=n.mimeType;if(e.kind==M.Video){let t=O[i.replace("video/","").toUpperCase()];e.updateInfo({codec:t})}else{let t=O[i.replace("audio/","").toUpperCase()];e.updateInfo({codec:t,sample_rate:n.clockRate,channel_count:n.channels})}}}class jr extends Ur{async publish(e,t,r){this.published[e.id]?X.warn("推流",e.toString(),"进行中,当前状态",this.published[e.id].pc.connectionState):(await super.publish(e,t,r),await this.doPublish(e,t,r,!1),e.on(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace),e.on(sr.RECONNECTING,this.onPubTrackReconnecting))}async unpublish(e){if(!this.published[e.id])return void X.warn("推流",e.toString(),"已取消,无需取消发布");e.off(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace),e.off(sr.RECONNECTING,this.onPubTrackReconnecting);this.published[e.id].pc.close(),X.warn("推流",e.toString(),"unpublished"),delete this.published[e.id]}async doPublish(e,t,r,n){let i=e.getMediaStreamTrack(),o=new RTCPeerConnection(this.dftPCConfig),s={kind:e.kind,pc:o,track:e,opt:t,exopt:r||{}};this.published[e.id]=s;let a={maxBitrate:t.maxBitrate,priority:t.priority};e.kind==M.Video&&(a.maxFramerate=t.maxFramerate,a.scaleResolutionDownBy=e.getScaleResolutionDownBy());let c=S((()=>this.negotiateSDP(s,"publish")),{maxRetries:10,initialDelay:500,onRetry:(t,r)=>!!this.published[e.id]&&(X.warn("推流",e.toString(),`建连重试第${t}次`,r),!0)}),u=()=>{n?(this.vendor()!=Kt.OOK&&"closed"!=o.signalingState||c.cancel(),X.error("推流",e.toString(),"已断开,将自动尝试重连"),e.emit(sr.RECONNECTING,e,t,r)):(c.cancel(),this.unpublish(e))};return new Promise((async(r,l)=>{let h=setTimeout((()=>{u(),l("发布超时")}),6e4);o.addEventListener("negotiationneeded",(()=>{X.info("推流",e.toString(),"重新协商"),c().catch((t=>{"maxretry"==t&&X.error("推流",e.toString(),"建连多次重试依旧无法连接,已放弃")}))})),o.addEventListener("icecandidate",(t=>{X.debug("推流",e.toString(),"icecandidate",t.candidate)})),o.addEventListener("iceconnectionstatechange",(t=>{X.debug("推流",e.toString(),"ICE connection state change",o.iceConnectionState)})),o.addEventListener("signalingstatechange",(t=>{X.debug("推流",e.toString(),"signaling state change",o.signalingState),"closed"==o.signalingState&&(u(),l("发布失败"))})),o.addEventListener("connectionstatechange",(t=>{switch(X.debug("推流",e.toString(),"connection state",o.connectionState),o.connectionState){case"failed":case"closed":u(),l("发布失败");break;case"connected":X.warn("推流",e.toString(),"connected"),clearTimeout(h),n?e.emit(sr.RECONNECTED,e):n=!0,this.updateTrackInfoAfterPublish(e),r()}}));let f=!1;if("addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK){let e=o.addTransceiver(i,{direction:"sendonly",sendEncodings:[a]});s.sender=e.sender}else{let e=o.addTrack(i);s.sender=e,f=!0}let d=s.sender.getParameters();f&&(d.encodings=[a]),e.kind==M.Video&&t.degradationPreference&&(d.degradationPreference=t.degradationPreference),s.sender.setParameters(d)}))}onPubTrackReconnecting=(e,t,r)=>{if(!this.published[e.id])return;const n=this.published[e.id];"addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK&&"closed"!=n.pc.signalingState?n.pc.restartIce():(n.pc.close(),this.doPublish(e,t,r,!0))};async subscribe(e,t){this.subscribed[e.id]?X.warn("拉流",e.toString(),"进行中,当前状态",this.subscribed[e.id].pc.connectionState):(await super.subscribe(e,t),await this.doSubscribe(e,t,!1),e.on(sr.RECONNECTING,this.onSubTrackReconnecting))}async unsubscribe(e){if(!this.subscribed[e.id])return void X.warn("拉流",e.toString(),"未订阅或已取消,无需取消订阅");e.off(sr.RECONNECTING,this.onSubTrackReconnecting);this.subscribed[e.id].pc.close(),X.warn("拉流",e.toString(),"unsubscribed"),delete this.subscribed[e.id]}async doSubscribe(e,t,r){let n=new RTCPeerConnection(this.dftPCConfig),i={kind:e.kind,pc:n,track:e,exopt:t||{}};this.subscribed[e.id]=i;let o=S((()=>this.negotiateSDP(i,"subscribe")),{maxRetries:10,initialDelay:500,onRetry:(t,r)=>!!this.subscribed[e.id]&&(X.warn("拉流",e.toString(),`建连重试第${t}次`,r),!0)}),s=()=>{o().catch((t=>{"maxretry"==t&&X.error("拉流",e.toString(),"建连多次重试依旧无法连接,已放弃")}))},c=()=>{r?(this.vendor()!=Kt.OOK&&"closed"!=n.signalingState||o.cancel(),X.error("拉流",e.toString(),"已断开,将自动尝试重连"),e.emit(sr.RECONNECTING,e,t)):(o.cancel(),this.unsubscribe(e))};return new Promise((async(t,i)=>{let o=setTimeout((()=>{c(),i("订阅超时")}),6e4);n.addEventListener("negotiationneeded",(()=>{X.info("拉流",e.toString(),"重新协商"),s()})),n.addEventListener("icecandidate",(t=>{X.debug("拉流",e.toString(),"icecandidate",t.candidate)})),n.addEventListener("iceconnectionstatechange",(t=>{X.debug("拉流",e.toString(),"ICE connection state change",n.iceConnectionState)})),n.addEventListener("signalingstatechange",(t=>{X.debug("拉流",e.toString(),"signaling state change",n.signalingState),"closed"==n.signalingState&&(c(),i("订阅失败"))})),n.addEventListener("track",(t=>{e.setMediaStreamTrack(t.track),t.streams[0].onremovetrack=t=>{X.warn("拉流",e.toString(),"mstrack removed"),e.emit(a.ENDED,e)},X.warn("拉流",e.toString(),"mstrack got")})),n.addEventListener("connectionstatechange",(s=>{switch(X.debug("拉流",e.toString(),"connection state",n.connectionState),n.connectionState){case"failed":case"closed":c(),i("订阅失败");break;case"connected":X.warn("拉流",e.toString(),"connected"),clearTimeout(o),r?e.emit(sr.RECONNECTED,e):r=!0,t()}})),"addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK?n.addTransceiver(e.kind,{direction:"recvonly"}):s()}))}onSubTrackReconnecting=(e,t)=>{if(!this.subscribed[e.id])return!1;const r=this.subscribed[e.id];"addTransceiver"in RTCPeerConnection.prototype&&this.vendor()!=Kt.OOK&&"closed"!=r.pc.signalingState?r.pc.restartIce():(r.pc.close(),this.doSubscribe(e,t,!0))};async getMetric(){const e={bitrate_down:0,bitrate_up:0,delay:0,lossrate_down:0,lossrate_up:0,up_level:0,pkt_up:0,pkt_down:0,pkt_loss_up:0,pkt_loss_down:0},t=this.prevMetric?.network,r=[],n=[];for(const t in this.published){const i=this.published[t],o=i.track.getInfo(),s=i.track.prevStats,a=await i.pc.getStats();i.kind==M.Audio?(a.forEach((t=>{if("outbound-rtp"===t.type){const r={type:"audio",streamId:t.id,packetsSent:t.packetsSent,bytesSent:t.bytesSent,timestamp:t.timestamp},n=a.get(t.mediaSourceId);n&&(r.audioLevel=n.audioLevel);const c=a.get(t.remoteId);c&&(r.jitter=c.jitter,r.packetsLost=c.packetsLost,r.roundTripTime=c.roundTripTime),o.bitrate=s?Lr(r,s):0,o.db=r.audioLevel?R(r.audioLevel):-60,o.stats=r,i.track.prevStats=r,e.bitrate_up+=o.bitrate,e.pkt_up+=r.packetsSent||0,e.pkt_loss_up+=r.packetsLost||0}})),r.push(o)):(a.forEach((t=>{if("outbound-rtp"===t.type){const r={type:"video",streamId:t.id,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,firCount:t.firCount,pliCount:t.pliCount,nackCount:t.nackCount,packetsSent:t.packetsSent,bytesSent:t.bytesSent,qualityLimitationReason:t.qualityLimitationReason,qualityLimitationDurations:t.qualityLimitationDurations,qualityLimitationResolutionChanges:t.qualityLimitationResolutionChanges,rid:t.rid??t.id,retransmittedPacketsSent:t.retransmittedPacketsSent,targetBitrate:t.targetBitrate,timestamp:t.timestamp},n=a.get(t.remoteId);n&&(r.jitter=n.jitter,r.packetsLost=n.packetsLost,r.roundTripTime=n.roundTripTime),o.width=r.frameWidth,o.height=r.frameHeight,o.fps=r.framesPerSecond,o.bitrate=s?Lr(r,s):0,o.stats=r,i.track.prevStats=r,e.bitrate_up+=o.bitrate,e.pkt_up+=r.packetsSent||0,e.pkt_loss_up+=r.packetsLost||0}})),n.push(o))}const i=[],o=[];for(const t in this.subscribed){const r=this.subscribed[t],n=r.track.getInfo();n.uid=r.track.getUid();const s=r.track.prevStats,a=await r.pc.getStats();r.kind==M.Audio?(a.forEach((t=>{if("inbound-rtp"===t.type){const i={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,packetsLost:t.packetsLost,packetsReceived:t.packetsReceived,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,audioLevel:t.audioLevel,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration};n.bitrate=s?Lr(i,s):0,n.db=i.audioLevel?R(i.audioLevel):-60,n.stats=i,r.track.prevStats=i,e.bitrate_down+=n.bitrate,e.pkt_down+=i.packetsReceived||0,e.pkt_loss_down+=i.packetsLost||0}})),i.push(n)):(a.forEach((t=>{if("inbound-rtp"===t.type){const i={type:"video",streamId:t.id,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesReceived:t.framesReceived,packetsReceived:t.packetsReceived,packetsLost:t.packetsLost,framesPerSecond:t.framesPerSecond,frameWidth:t.frameWidth,frameHeight:t.frameHeight,pliCount:t.pliCount,firCount:t.firCount,nackCount:t.nackCount,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,timestamp:t.timestamp,bytesReceived:t.bytesReceived,decoderImplementation:t.decoderImplementation},o=a.get(t.codecId);o&&(i.mimeType=o.mimeType),n.width=i.frameWidth,n.height=i.frameHeight,n.fps=t.framesPerSecond||(s?Dr(i,s):0),n.bitrate=s?Lr(i,s):0,n.stats=i,r.track.prevStats=i,e.bitrate_down+=n.bitrate,e.pkt_down+=i.packetsReceived||0,e.pkt_loss_down+=i.packetsLost||0}})),o.push(n))}const s=e.pkt_loss_up-t?.pkt_loss_up+e.pkt_up-t?.pkt_up,a=e.pkt_loss_down-t?.pkt_loss_down+e.pkt_down-t?.pkt_down;return e.lossrate_up=C(s?100*(e.pkt_loss_up-t?.pkt_loss_up/s):0,2),e.lossrate_down=C(a?(e.pkt_loss_down-t?.pkt_loss_down)/a*100:0,2),this.prevMetric={local_audios:r,local_videos:n,remote_audios:i,remote_videos:o,network:e}}}class Fr extends jr{localAudioMixTrack=new Er;ability={audioCodecs:[O.OPUS,O.AAC],videoCodecs:[O.H264,O.H265],audioMaxPub:1,videoMaxPub:7,audioMaxSub:9,videoMaxSub:32};vendor(){return Kt.OOK}async connect(){try{await this.free()}catch(e){}await this.create(),await super.connect()}async disconnect(){await super.disconnect(),await this.free()}async publish(e,t,r){if(e!=this.localAudioMixTrack&&e.kind==M.Audio)return this.localAudioMixTrack.addTrack(e),this.published[this.localAudioMixTrack.id]?void 0:await this.publish(this.localAudioMixTrack,t,r);await super.publish(e,t,r)}async unpublish(e){if(e!=this.localAudioMixTrack&&e.kind==M.Audio)return this.localAudioMixTrack.removeTrack(e),void(0==this.localAudioMixTrack.getTrackCount()&&await this.unpublish(this.localAudioMixTrack));let t=this.published[e.id];if(await super.unpublish(e),t)try{await this.freshAVState(t.exopt.session),await this.hangup(t.exopt.session)}catch(e){X.error("ook webrtc取消发布接口报错",e)}}async unsubscribe(e){let t=this.subscribed[e.id];if(await super.unsubscribe(e),t)try{await this.hangup(t.exopt.session)}catch(e){X.error("ook webrtc取消订阅接口报错",e)}}async negotiateSDP(e,t){let r=this.genSessionId();if(e.exopt.session)try{await this.hangup(e.exopt.session)}catch(t){r=e.exopt.session,X.error("ook webrtc挂断接口报错",t)}e.exopt.session=r;let n=e.pc,i="";if("publish"==t&&e.kind==M.Audio)i=await this.offerWithRetry((()=>this.offerPushAudio(r)));else if("publish"==t&&e.kind==M.Video)i=await this.offerWithRetry((()=>this.offerPushVideo(r,e.exopt.track)));else if("subscribe"==t&&e.kind==M.Audio)i=e.track instanceof pr?await this.offerWithRetry((()=>this.offerPullAmixer(r,e.exopt.filter_link_ids.join(",")))):await this.offerWithRetry((()=>this.offerPullAudio(r,e.exopt.link_id)));else{if("subscribe"!=t||e.kind!=M.Video)throw new D("未知SDP操作:"+t+":"+e.track.toString());i=e.track instanceof yr?await this.offerWithRetry((()=>this.offerPullMcuVideo(r))):await this.offerWithRetry((()=>this.offerPullVideo(r,e.exopt.link_id,e.exopt.track)))}await n.setRemoteDescription({sdp:i,type:"offer"});let o=await n.createAnswer();await n.setLocalDescription(o),await(()=>new Promise(((e,t)=>{"complete"===n.iceGatheringState?e():n.onicegatheringstatechange=()=>{"complete"==n.iceGatheringState&&e()}}))).bind(this)(),await this.answer(r,n.localDescription?.sdp),"publish"==t&&await this.freshAVState(r)}async freshAVState(e){let t=!1,r=!1,n=0;for(const e in this.published){const i=this.published[e];i.kind==M.Audio?t=!0:i.kind==M.Video&&(r=!0,n|=Math.pow(2,i.exopt.track))}S((()=>this.setMcuTrack(e,n)),{maxRetries:3})(),await this.setAVState(e,t,r)}getAvailableVideoTrackNo(){let e=-1,t=[];for(const e in this.published){const r=this.published[e];r.kind==M.Video&&t.push(r.track.getInfo().track)}for(let r=0;r<this.ability.videoMaxPub;r++)if(-1==t.indexOf(r)){e=r;break}return e}create(){return this.req("create/"+this.joinRsp.link_id,{serv:this.joinRsp.webrtc.upload_host,conf:this.joinRsp.channel_link_id,token:this.joinRsp.session_key,amixer:1})}free(){return this.req("free/"+this.joinRsp.link_id)}async offerWithRetry(e){try{return await e()}catch(t){try{await this.create()}catch(e){}return e()}}async offerPushVideo(e,t){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,track:t+""}),{mode:"recvonly",type:"video"})).sdp}async offerPushAudio(e){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{mode:"recvonly",type:"audio"})).sdp}async offerPullVideo(e,t,r){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:t+"",track:r+""}),{mode:"sendonly",type:"video"})).sdp}async offerPullMcuVideo(e){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:"1",track:"0"}),{mode:"sendonly",type:"video"})).sdp}switchPullVideoTrack(e,t){return this.req("setting/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{type:"track",setting:{track:t}})}async offerPullAudio(e,t){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:t+""}),{mode:"sendonly",type:"audio"})).sdp}async offerPullAmixer(e,t=""){return(await this.req("offer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e,peer:"amixer",filter:t}),{mode:"sendonly",type:"audio"})).sdp}answer(e,t){return this.req("answer/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{totalBody:t})}setAVState(e,t,r){return this.req("setting/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{totalBody:JSON.stringify({type:"media",setting:{audio:t?1:0,video:r?1:0}})})}setMcuTrack(e,t){return this.req("setting/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}),{totalBody:JSON.stringify({type:"deftrack",setting:{mmask:t}})})}hangup(e){return this.req("hangup/"+this.joinRsp.link_id+"?"+new URLSearchParams({session:e}))}req(e,t={},r={}){let n=this.joinRsp.webrtc.cmd_url;"/"!==n.substring(n.length-1)&&(n+="/");let i=t.totalBody;i||(i=Object.keys(t).filter((e=>void 0!==t[e]&&null!==t[e])).map((e=>`${e}=${t[e]}`)).join("\r\n"));let o=Date.now(),s=(r,n)=>{X[r]("ook webrtc gateway api: "+e,t,n,Date.now()-o+"ms")};return new Promise(((t,o)=>{fetch(n+e,{method:"POST",headers:{...r,Accept:"application/json"},body:i}).then((e=>{if(200!=e.status){let t=new Error(e.status+":"+e.statusText);s(J.ERROR,t),o(t)}else e.json().then((e=>{s(0==e.code?J.DEBUG:J.ERROR,e),0==e.code?t(e):o(new D(e.code+":"+e.msg))})).catch((e=>{s(J.ERROR,e),o(e)}))})).catch((e=>{s(J.ERROR,e),o(e)}))}))}genSessionId(){return`${`${this.joinRsp.app_id}`}-${A(6)}`}}var zr=r(7363),Vr=function(e){return e.INIT="init",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.DISCONNECTED="disconnected",e}(Vr||{});class qr extends Ur{publishPc;subscribePc;publishNegotiationPromise=null;isPublishNegotiating=!1;state=Vr.INIT;api;signalDataChannel=null;onDataChannelMessage=null;pendingSubscribeTracks=[];subscribeDebounce;simulcastTracks={};ability={audioCodecs:[O.OPUS],videoCodecs:[O.H264,O.VP8,O.VP9,O.AV1,O.H265],audioMaxPub:-1,videoMaxPub:-1,audioMaxSub:-1,videoMaxSub:-1};constructor(e,t,r){super(t,r),this.api=e,this.publishPc=this.newPublishPc(),this.subscribePc=this.newSubscribePc(),this.subscribeDebounce=tr((async()=>{if(0===this.pendingSubscribeTracks.length)return{ignored:{},failed:{}};try{const e=[...this.pendingSubscribeTracks];this.pendingSubscribeTracks=[],X.debug("执行批量订阅操作",JSON.stringify(e));const t=await this.sfuApiWithRetry("subscribe",(()=>this.api.sfuSubscribe(e)));return t.offer&&await this.handleSfuSubscribeOffer(t.offer),{ignored:t.ignored||{},failed:t.failed||{}}}catch(e){throw X.error("批量订阅操作失败",e),e}}),100,{isImmediate:!1})}newPublishPc(){return this.publishPc=new RTCPeerConnection(this.dftPCConfig),this.publishPc.createDataChannel("dummy",{ordered:!1,maxRetransmits:0}),this.setupPublishPcListeners(),this.publishPc}newSubscribePc(){return this.subscribePc=new RTCPeerConnection(this.dftPCConfig),this.setupSubscribePcListeners(),this.subscribePc}vendor(){return Kt.Seastart}async connect(){const e=await this.publishPc.createOffer();await this.publishPc.setLocalDescription(e);const{publish_answer:t,subscribe_offer:r,prefer_video_codec:n,prefer_audio_codec:i}=await this.sfuApiWithRetry("connect",(()=>this.api.sfuConnect(e)));n&&!this.ability.preferVideoCodec&&(this.ability.preferVideoCodec=O[n.toUpperCase()]),i&&!this.ability.preferAudioCodec&&(this.ability.preferAudioCodec=O[i.toUpperCase()]),await this.publishPc.setRemoteDescription(t),await this.handleSfuSubscribeOffer(r),await this.waitForPCConnected(this.publishPc,5e3),await this.waitForPCConnected(this.subscribePc,5e3),await super.connect(),this.state=Vr.CONNECTED}async sfuApiWithRetry(e,t){try{return await S(t,{maxRetries:3,initialDelay:10,onRetry:(t,r)=>(X.warn(`SFU API ${e} 调用失败第${t}次`,r),!(r instanceof D))})()}catch(t){throw"maxretry"==t?(t=new Error(`SFU API ${e} 调用多次重试依旧失败,已放弃调用`),X.error(`SFU API ${e} 多次重试依旧无法调用,已放弃调用`)):"canceled"==t&&(t=new Error(`SFU API ${e} 调用被取消`),X.error(`SFU API ${e} 调用被取消`)),t}}async reconnectWithRetry(e){if(this.state!=Vr.CONNECTED)return;this.state=Vr.RECONNECTING,X.warn("SFU 开始重连",e),this.stopMonitor(),this.publishPc.close(),this.subscribePc.close();for(const e in this.published){const t=this.published[e];t.track.emit(sr.RECONNECTING,t.track,t.opt,t.exopt)}for(const e in this.subscribed){const t=this.subscribed[e];t.track.emit(sr.RECONNECTING,t.track,t.exopt)}try{await S((async()=>{this.publishPc.close(),this.subscribePc.close(),this.publishPc=this.newPublishPc(),this.subscribePc=this.newSubscribePc(),await this.connect()}),{maxRetries:10,initialDelay:500,onRetry:(e,t)=>(X.warn(`SFU 重连失败第${e}次`,t),!(t instanceof D||this.state!=Vr.RECONNECTING))})()}catch(e){throw"maxretry"==e?X.error("SFU 重连多次重试依旧无法连接,已放弃重连"):"canceled"==e&&X.error("SFU 重连被取消"),e}let t=this.published,r=this.subscribed;this.published={},this.subscribed={};for(const e in t){const r=t[e];try{await this.publish(r.track,r.opt,r.exopt),r.track.emit(sr.RECONNECTED,r.track)}catch(e){X.error(`SFU 重连后,重新发布 ${r.track.toString()} 失败`,e)}}for(const e in r){const t=r[e];try{await this.subscribe(t.track,t.exopt),t.track.emit(sr.RECONNECTED,t.track)}catch(e){X.error(`SFU 重连后,重新订阅 ${t.track.toString()} 失败`,e)}}X.warn("SFU 重连成功"),this.state=Vr.CONNECTED}async disconnect(){await super.disconnect(),this.signalDataChannel&&(this.signalDataChannel.close(),this.signalDataChannel=null),this.publishPc.close(),this.subscribePc.close(),this.onDataChannelMessage=null,this.state=Vr.DISCONNECTED}setupPublishPcListeners(){this.publishPc.addEventListener("icecandidate",(e=>{X.debug("发布PeerConnection","icecandidate",e.candidate)})),this.publishPc.addEventListener("iceconnectionstatechange",(e=>{X.debug("发布PeerConnection","ICE connection state change",this.publishPc?.iceConnectionState),"failed"==this.publishPc?.iceConnectionState&&this.reconnectWithRetry("发布PeerConnection iceConnectionState: failed")})),this.publishPc.addEventListener("signalingstatechange",(e=>{X.debug("发布PeerConnection","signaling state change",this.publishPc?.signalingState),"closed"==this.publishPc?.signalingState&&this.reconnectWithRetry("发布PeerConnection signaling state: closed")})),this.publishPc.addEventListener("connectionstatechange",(e=>{if(X.info("发布PeerConnection","connection state",this.publishPc?.connectionState),this.publishPc)switch(this.publishPc.connectionState){case"failed":case"closed":this.reconnectWithRetry("发布PeerConnection连接状态: "+this.publishPc.connectionState);break;case"connected":X.info("发布PeerConnection已连接")}}))}setupSubscribePcListeners(){this.subscribePc.addEventListener("icecandidate",(e=>{X.debug("订阅PeerConnection","icecandidate",e.candidate)})),this.subscribePc.addEventListener("iceconnectionstatechange",(e=>{X.debug("订阅PeerConnection","ICE connection state change",this.subscribePc?.iceConnectionState),"failed"==this.subscribePc?.iceConnectionState&&this.reconnectWithRetry("订阅PeerConnection iceConnectionState: failed")})),this.subscribePc.addEventListener("signalingstatechange",(e=>{X.debug("订阅PeerConnection","signaling state change",this.subscribePc?.signalingState),"closed"==this.subscribePc?.signalingState&&this.reconnectWithRetry("订阅PeerConnection signaling state: closed")})),this.subscribePc.addEventListener("track",(e=>{X.info("订阅PeerConnection","收到远程轨道",e.track.kind,e.track.id,e.streams[0].id);let t=e.streams[0].id;if(!this.subscribed[t])return void X.warn("收到的远程轨道",e.track.kind,e.track.id,"未订阅或已取消");const r=this.subscribed[t];r.track.setMediaStreamTrack(e.track),X.warn("拉流",r.track.toString(),"mstrack got"),e.streams[0].onremovetrack=()=>{X.warn("拉流",r.track.toString(),"mstrack removed"),r.track.emit(a.ENDED,r.track)}})),this.subscribePc.addEventListener("connectionstatechange",(e=>{if(X.debug("订阅PeerConnection","connection state",this.subscribePc?.connectionState),this.subscribePc)switch(this.subscribePc.connectionState){case"failed":case"closed":this.reconnectWithRetry("订阅PeerConnection连接状态: "+this.subscribePc.connectionState);break;case"connected":X.info("订阅PeerConnection已连接")}})),this.subscribePc.addEventListener("datachannel",(e=>{X.info("订阅PeerConnection","收到数据通道",e.channel.label),this.signalDataChannel=e.channel,this.setupDataChannelListeners()}))}async publish(e,t,r){if(this.state!=Vr.CONNECTED)throw new D("当前状态: "+this.state+",无法发布");if("connected"!=this.publishPc.connectionState)throw new D("发布PeerConnection未连接,无法发布");if(this.published[e.id])return void X.warn("推流",e.toString(),"进行中,当前状态",this.published[e.id].pc.connectionState);await super.publish(e,t,r);let n={priority:t.priority,maxBitrate:t.maxBitrate},i=[n];if(e.kind==M.Video){let r=e,o=t;if(n.maxFramerate=o.maxFramerate,n.scaleResolutionDownBy=r.getScaleResolutionDownBy(),o.simulcasts&&o.simulcasts.length>0){if(!("addTransceiver"in RTCPeerConnection.prototype))throw new D("不支持simulcast,当前浏览器不支持addTransceiver");n.rid="0",this.simulcastTracks[e.id]={};for(let t=1;t<=o.simulcasts.length;t++){let n=o.simulcasts[t-1],s=r.getSimulcastTrack(n,o.width,o.height);i.push({rid:t.toString(),priority:n.priority,maxBitrate:n.maxBitrate,maxFramerate:n.maxFramerate,scaleResolutionDownBy:s.getScaleResolutionDownBy()}),this.simulcastTracks[e.id][t.toString()]=s}}}let o=this.publishPc,s={kind:e.kind,pc:o,track:e,opt:t,exopt:r||{}};this.published[e.id]=s,X.debug("推流编码参数",e.toString(),"encodings",i);let a=!1;if("addTransceiver"in RTCPeerConnection.prototype){let r=o.addTransceiver(e.getMediaStreamTrack(),{direction:"sendonly",sendEncodings:i,streams:[e.getMediaStream()]});if(s.sender=r.sender,e.kind==M.Video){let e=t.codec||this.ability.preferVideoCodec;if(e){let t=Xt.preferVideoEncCodec(B(e));r.setCodecPreferences(t)}}else{let e=t.codec||this.ability.preferAudioCodec;if(e){let t=Xt.preferAudioEncCodec(B(e));r.setCodecPreferences(t)}}}else{let t=o.addTrack(e.getMediaStreamTrack(),e.getMediaStream());s.sender=t,a=!0}let c=s.sender.getParameters();a&&(c.encodings=i),e.kind==M.Video&&t.degradationPreference&&(c.degradationPreference=t.degradationPreference),s.sender.setParameters(c);try{await this.negotiatePublishPc()}catch(t){throw delete this.published[e.id],delete this.simulcastTracks[e.id],t}this.updateTrackInfoAfterPublish(e),e.on(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace)}updateTrackInfoAfterPublish(e){if(super.updateTrackInfoAfterPublish(e),e.kind==M.Video)for(const t in this.simulcastTracks[e.id]){this.simulcastTracks[e.id][t].updateInfo({id:e.id+"_"+t,codec:e.getInfo().codec})}}async unpublish(e){if(!this.published[e.id])return void X.warn("推流",e.toString(),"已取消,无需取消发布");e.off(sr.MSTRACK_REPLACED,this.onPubMsTrackReplace);const t=this.published[e.id];if(X.warn("推流",e.toString(),"unpublished"),delete this.published[e.id],delete this.simulcastTracks[e.id],this.state==Vr.CONNECTED)try{t.pc.removeTrack(t.sender),t.pc.getTransceivers().forEach((e=>{e.sender==t.sender&&e.stop()})),await this.negotiatePublishPc()}catch(t){X.warn("推流",e.toString(),"取消发布失败",t)}}async subscribe(e,t){if("connected"!=this.subscribePc.connectionState)throw new D("订阅PeerConnection未连接,无法订阅");if(this.subscribed[e.id])return void X.warn("拉流",e.toString(),"进行中,当前状态",this.subscribed[e.id].pc.connectionState);await super.subscribe(e,t);let r={kind:e.kind,pc:this.subscribePc,track:e,exopt:t||{}};this.subscribed[e.id]=r;try{await S((()=>this.debouncedSfuSubscribe(e.getUid(),e.id,!0)),{maxRetries:3,initialDelay:1e3,onRetry:(t,r)=>"not found"==r?(X.warn(`SFU track ${e.toString()}不存在,重试第${t}次`),!0):(X.warn(`SFU track ${e.toString()}订阅失败`,r),!1)})()}catch(t){throw delete this.subscribed[e.id],t}}async unsubscribe(e){if(this.subscribed[e.id]){if(X.warn("拉流",e.toString(),"unsubscribed"),delete this.subscribed[e.id],this.state==Vr.CONNECTED)try{await this.debouncedSfuSubscribe(e.getUid(),e.id,!1)}catch(t){X.warn("拉流",e.toString(),"取消订阅失败",t)}}else X.warn("拉流",e.toString(),"未订阅或已取消,无需取消订阅")}async debouncedSfuSubscribe(e,t,r){const n={pub_uid:e,track_id:t,subscribe:r},i=this.pendingSubscribeTracks.findIndex((r=>r.pub_uid===e&&r.track_id===t));if(-1!==i){this.pendingSubscribeTracks[i].subscribe!==r&&(this.pendingSubscribeTracks.splice(i,1),X.debug("订阅操作",`${e}:${t}`,"订阅和取消订阅操作相互抵消"))}else this.pendingSubscribeTracks.push(n);const o=await this.subscribeDebounce(),s=`${e}:${t}`;if(o.ignored[s]&&X.warn(`轨道 ${s} 订阅被忽略: ${o.ignored[s]}`),o.failed[s])throw o.failed[s]}async negotiatePublishPc(e=!1){if(this.isPublishNegotiating)return this.publishNegotiationPromise?void await this.publishNegotiationPromise:(await k(100),this.negotiatePublishPc(e));this.isPublishNegotiating=!0,this.publishNegotiationPromise=(async()=>{try{if(await new Promise((e=>setTimeout(e,100))),this.publishNegotiationPromise=null,"stable"===this.publishPc.signalingState&&"connected"===this.publishPc.connectionState){const t=await this.publishPc.createOffer({iceRestart:e}),r=zr.qg(t.sdp);let n=!1;r.media.forEach((e=>{!function(e){"number"==typeof e&&e.toFixed(0)}(e.mid);if("inactive"!=e.direction&&("video"==e.type||"audio"==e.type)){const t=e.msid.split(" ")[0],r=e.msid.split(" ")[1];for(const i in this.published){this.published[i].track.getMediaStream().id==t&&r!==i&&(e.msid=`${t} ${i}`,n=!0)}}})),n&&(t.sdp=zr.M9(r)),await this.publishPc.setLocalDescription(t),await this.waitForIceGathering(this.publishPc);const i=await this.sfuApiWithRetry("offerPublish",(()=>this.api.sfuOfferPublish(this.publishPc.localDescription)));await this.publishPc.setRemoteDescription(i.answer),X.info("发布PeerConnection协商成功")}}catch(e){throw X.error("发布PeerConnection协商失败",e),this.reconnectWithRetry(e),e}finally{this.isPublishNegotiating=!1}})(),await this.publishNegotiationPromise}async handleSfuSubscribeOffer(e){X.info("收到订阅PeerConnection Offer");try{await this.subscribePc.setRemoteDescription(e);const t=await this.subscribePc.createAnswer();await this.subscribePc.setLocalDescription(t),await this.waitForIceGathering(this.subscribePc),await this.sfuApiWithRetry("answerSubscribe",(()=>this.api.sfuAnswerSubscribe(this.subscribePc.localDescription))),X.info("订阅PeerConnection Answer已发送")}catch(e){throw X.error("处理订阅PeerConnection Offer失败",e),this.reconnectWithRetry(e),e}}async waitForPCConnected(e,t){if("connected"!==e.connectionState)return new Promise(((r,n)=>{const i=()=>{"connected"===e.connectionState&&(clearTimeout(o),e.removeEventListener("connectionstatechange",i),r())};e.addEventListener("connectionstatechange",i);const o=setTimeout((()=>{e.removeEventListener("connectionstatechange",i),n(new Error("peerconnection连接超时"))}),t)}))}async waitForIceGathering(e){if("complete"!==e.iceGatheringState)return new Promise((t=>{const r=()=>{"complete"===e.iceGatheringState&&(clearTimeout(n),e.removeEventListener("icegatheringstatechange",r),t())};e.addEventListener("icegatheringstatechange",r);const n=setTimeout((()=>{e.removeEventListener("icegatheringstatechange",r),X.warn("ICE收集超时,继续处理"),t()}),5e3)}))}setupDataChannelListeners(){this.signalDataChannel&&(this.signalDataChannel.onopen=()=>{X.info("信令DataChannel已打开")},this.signalDataChannel.onclose=()=>{X.info("信令DataChannel已关闭")},this.signalDataChannel.onerror=e=>{X.error("信令DataChannel错误",e)},this.onDataChannelMessage=e=>{try{const t=JSON.parse(e.data);if(X.debug("收到信令DataChannel消息",t),"active_speaker"===t.type)this.handleActiveSpeakerUpdate(t.speakers);else X.debug("未知的DataChannel消息类型",t.type)}catch(t){X.error("处理信令DataChannel消息失败",t,e.data)}},this.signalDataChannel.onmessage=this.onDataChannelMessage)}handleActiveSpeakerUpdate(e){X.debug("活跃发言者更新",e)}sendSignalMessage(e,t){if(!this.signalDataChannel||"open"!==this.signalDataChannel.readyState)return X.warn("信令DataChannel未打开,无法发送消息"),!1;try{const r=JSON.stringify({type:e,...t,timestamp:Date.now()});return this.signalDataChannel.send(r),!0}catch(e){return X.error("发送信令DataChannel消息失败",e),!1}}getRtcTrackIdByMsTrackIdentifier(e,t){if(t)for(const t in this.published){const r=this.published[t];if(r.track.getMediaStreamTrack()?.id==e)return t}else for(const t in this.subscribed){const r=this.subscribed[t];if(r.track.getMediaStreamTrack()?.id==e)return t}return""}async getMetric(){const e={bitrate_down:0,bitrate_up:0,delay:0,lossrate_down:0,lossrate_up:0,up_level:0,pkt_up:0,pkt_down:0,pkt_loss_up:0,pkt_loss_down:0},t=this.prevMetric?.network,r=[],n=[],i=await this.publishPc.getStats();i.forEach((t=>{if("outbound-rtp"===t.type){if(!t.mediaSourceId)return;const o=i.get(t.mediaSourceId);if(!o)return;const s=this.getRtcTrackIdByMsTrackIdentifier(o.trackIdentifier,!0),a=this.published[s];if(!a)return;const c=t.rid;let u=a.track;c&&"0"!=c&&(u=this.simulcastTracks[u.id][c]);const l=u.getInfo(),h=u.prevStats;if("audio"==t.kind){const n={type:"audio",streamId:t.id,packetsSent:t.packetsSent,bytesSent:t.bytesSent,timestamp:t.timestamp,audioLevel:o.audioLevel},s=i.get(t.remoteId);s&&(n.jitter=s.jitter,n.packetsLost=s.packetsLost,n.roundTripTime=s.roundTripTime),l.bitrate=h?Lr(n,h):0,l.db=n.audioLevel?R(n.audioLevel):-60,l.stats=n,u.prevStats=n,e.bitrate_up+=l.bitrate,e.pkt_up+=n.packetsSent||0,e.pkt_loss_up+=n.packetsLost||0,r.push(l)}else if("video"==t.kind){const r={type:"video",streamId:t.id,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,firCount:t.firCount,pliCount:t.pliCount,nackCount:t.nackCount,packetsSent:t.packetsSent,bytesSent:t.bytesSent,qualityLimitationReason:t.qualityLimitationReason,qualityLimitationDurations:t.qualityLimitationDurations,qualityLimitationResolutionChanges:t.qualityLimitationResolutionChanges,rid:t.rid??t.id,retransmittedPacketsSent:t.retransmittedPacketsSent,targetBitrate:t.targetBitrate,timestamp:t.timestamp},o=i.get(t.remoteId);o&&(r.jitter=o.jitter,r.packetsLost=o.packetsLost,r.roundTripTime=o.roundTripTime),l.width=r.frameWidth,l.height=r.frameHeight,l.fps=r.framesPerSecond,l.bitrate=h?Lr(r,h):0,l.stats=r,u.prevStats=r,e.bitrate_up+=l.bitrate,e.pkt_up+=r.packetsSent||0,e.pkt_loss_up+=r.packetsLost||0,n.push(l)}}}));const o=[],s=[],a=await this.subscribePc.getStats();a.forEach((t=>{if("inbound-rtp"===t.type){const r=this.getRtcTrackIdByMsTrackIdentifier(t.trackIdentifier,!1),n=this.subscribed[r];if(!n)return;const i=n.track,c=i.getInfo();c.uid=i.getUid();const u=i.prevStats;if("audio"==t.kind){const r={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,packetsLost:t.packetsLost,packetsReceived:t.packetsReceived,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,audioLevel:t.audioLevel,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration};c.bitrate=u?Lr(r,u):0,c.db=r.audioLevel?R(r.audioLevel):-60,c.stats=r,i.prevStats=r,e.bitrate_down+=c.bitrate,e.pkt_down+=r.packetsReceived||0,e.pkt_loss_down+=r.packetsLost||0,o.push(c)}else if("video"==t.kind){const r={type:"video",streamId:t.id,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesReceived:t.framesReceived,packetsReceived:t.packetsReceived,packetsLost:t.packetsLost,framesPerSecond:t.framesPerSecond,frameWidth:t.frameWidth,frameHeight:t.frameHeight,pliCount:t.pliCount,firCount:t.firCount,nackCount:t.nackCount,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,timestamp:t.timestamp,bytesReceived:t.bytesReceived,decoderImplementation:t.decoderImplementation};if(t.codecId){const e=a.get(t.codecId);e&&(r.mimeType=e.mimeType)}c.width=r.frameWidth,c.height=r.frameHeight,c.fps=t.framesPerSecond||(u?Dr(r,u):0),c.bitrate=u?Lr(r,u):0,c.stats=r,i.prevStats=r,e.bitrate_down+=c.bitrate,e.pkt_down+=r.packetsReceived||0,e.pkt_loss_down+=r.packetsLost||0,s.push(c)}}}));const c=e.pkt_loss_up-t?.pkt_loss_up+e.pkt_up-t?.pkt_up,u=e.pkt_loss_down-t?.pkt_loss_down+e.pkt_down-t?.pkt_down;return e.lossrate_up=C(c?100*(e.pkt_loss_up-t?.pkt_loss_up/c):0,2),e.lossrate_down=C(u?(e.pkt_loss_down-t?.pkt_loss_down)/u*100:0,2),this.prevMetric={local_audios:r,local_videos:n,remote_audios:o,remote_videos:s,network:e}}}class Wr extends jr{api;ability={audioCodecs:[O.OPUS],videoCodecs:[O.H264],audioMaxPub:-1,videoMaxPub:-1,audioMaxSub:-1,videoMaxSub:-1};vendor(){return Kt.WangsuCDN}constructor(e,t,r){super(t,r),this.api=e}async negotiateSDP(e,t){let r=e.pc,n=await r.createOffer();await r.setLocalDescription(n);let i="";if("publish"==t&&e.kind==M.Audio)i="rtc_a_user_"+this.joinRsp.uid+"_"+e.track.id;else if("publish"==t&&e.kind==M.Video)i="rtc_v_user_"+this.joinRsp.uid+"_"+e.track.id;else if("subscribe"==t&&e.kind==M.Audio)i=e.track instanceof pr?"rtc_a_channel_"+this.joinRsp.channel:"rtc_a_user_"+e.track.getUid()+"_"+e.track.id;else{if("subscribe"!=t||e.kind!=M.Video)throw new D("未知SDP操作:"+t+":"+e.track.toString());i=e.track instanceof yr?"rtc_v_channel_"+this.joinRsp.channel:"rtc_v_user_"+e.track.getUid()+"_"+e.track.id}let o=await this.exchangeSDP("publish"==t,i,n);await r.setRemoteDescription(o)}async exchangeSDP(e,t,r){let n=await this.api.cdnURL({vendor:this.vendor(),stream_name:t,publish:e}),i=Date.now(),o=(r,n)=>{X[r](`wangsu ${e?"publish":"subscribe"} ${t}, sdp exchange cost: ${Date.now()-i}ms`,n)};return new Promise(((e,t)=>{fetch(n,{method:"POST",headers:{Accept:"application/json"},body:JSON.stringify({version:"v1.0",sessionId:"sidtest",localSdp:r})}).then((r=>{if(200!=r.status){let e=new Error(r.status+":"+r.statusText);o(J.ERROR,e),t(e)}else r.json().then((r=>{o(200==r.code?J.DEBUG:J.ERROR,r),200==r.code?e(r.remoteSdp):t(new D(r.code+":"+r.message))})).catch((e=>{o(J.ERROR,e),t(e)}))})).catch((e=>{o(J.ERROR,e),t(e)}))}))}}class Hr extends Vt{localTracks;buildInfo(){let{version:e}=r(6351);return{version:e,timestamp:1769494551}}getEnvInfo(){return Yt()}getStoredDeviceId(){let e=localStorage.getItem("device_id");return e||(e=A(18),localStorage.setItem("device_id",e)),e}getDeviceType(){return L.WebRTC}newRtcApi(e){return new er(e.app_id,e.sid,e.client_key,e.client_api)}newRtcSocket(e){return new Nr(e)}newChannel(e,t,r,n,i){return new wr(e,t,r,n,i,(e=>{this.onNotifyChannelEvent&&this.onNotifyChannelEvent(e)}))}newStreamEngine(e,t,r){switch(t.stream_vendor){case void 0:case Kt.OOK:return new Fr(t);case Kt.WangsuCDN:return new Wr(r,t);case Kt.Seastart:return new qr(r,t,{preferVideoCodec:e.preferVideoCodec,preferAudioCodec:e.preferAudioCodec});default:throw new D("不支持的流媒体引擎")}}constructor(e){super(e),this.localTracks=new Map,kr.getInstance().on("add",(e=>{if(this.onNotifyChannelEvent){let t=new i(or.DEVICE_ADD,e);this.onNotifyChannelEvent(t)}})),kr.getInstance().on("remove",(e=>{if(this.onNotifyChannelEvent){let t=new i(or.DEVICE_REMOVE,e);this.onNotifyChannelEvent(t)}})),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState?this.onAppShow():this.onAppHide()}))}postLeave(){for(let e of this.localTracks.keys())try{e instanceof Sr?e.stopPlay():e instanceof Ar&&e.removeAllPlayViews(),(e instanceof Cr||e instanceof xr||e instanceof Ir)&&(e.stopCapture(),X.info("离开频道",e.toString(),"自动停止采集"))}catch(e){}super.postLeave()}async getDevices(e,t=!0){return kr.getInstance().getDevices(e,t)}addTrackListeners(e){e.listeners(a.MUTED).includes(this.muteCallback)||e.on(a.MUTED,this.muteCallback),e.listeners(a.UNMUTED).includes(this.unmuteCallback)||e.on(a.UNMUTED,this.unmuteCallback),e.listeners(a.ENDED).includes(this.endCallback)||e.on(a.ENDED,this.endCallback),e.listeners(sr.AUTOPLAY_FAIL).includes(this.autoPlayFailCallback)||e.on(sr.AUTOPLAY_FAIL,this.autoPlayFailCallback)}muteCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_MUTED,e);this.onNotifyChannelEvent(t)}};unmuteCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_UNMUTED,e);this.onNotifyChannelEvent(t)}};endCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_ENDED,e);this.onNotifyChannelEvent(t)}};autoPlayFailCallback=e=>{if(this.onNotifyChannelEvent){let t=new i(or.TRACK_AUTOPLAY_FAIL,e);this.onNotifyChannelEvent(t)}};createLocalMicTrack(e=Rr.music){let t=new Cr(e.capture);return this.localTracks.set(t,{...e.publish}),this.addTrackListeners(t),t}createLocalCustomAudioTrack(e){if(e.kind!=M.Audio)throw new D("MediaStreamTrack必须是音频轨");let t=new Sr;return t.setMediaStreamTrack(e),this.localTracks.set(t,void 0),this.addTrackListeners(t),t}createLocalCameraTrack(e=Mr["720p"]){let t=new xr(e.capture);return this.localTracks.set(t,{width:e.capture.width,height:e.capture.height,...e.publish}),this.addTrackListeners(t),t}createLocalScreenTrack(e=Or["1080p"],t=Br.default){let r=new Ir(e.capture);if(this.localTracks.set(r,{width:e.capture.width,height:e.capture.height,...e.publish}),this.addTrackListeners(r),t){let e=new Tr(t.capture);this.localTracks.set(e,{...t.publish}),this.addTrackListeners(e),r.setAudioTrack(e)}return r}createLocalCustomVideoTrack(e){if(e.kind!=M.Video)throw new D("MediaStreamTrack必须是视频轨");let t=new Ar;return t.setMediaStreamTrack(e),this.localTracks.set(t,void 0),this.addTrackListeners(t),t}enableLocalTrack(e){let t=e.getMediaStreamTrack();if(t&&(t.enabled=!0),e instanceof Ir){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&this.enableLocalTrack(t)}}disableLocalTrack(e){let t=e.getMediaStreamTrack();if(t&&(t.enabled=!1),e instanceof Ir){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&this.disableLocalTrack(t)}}async publishLocalTrack(e,t){if(!this.channel)throw U;let r=this.localTracks.get(e);if(r&&(t&&E(r,t),t=r),!t)throw new D("轨道发布配置不能为空");if(e instanceof Ir){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&await this.publishLocalTrack(t)}if(e.kind==M.Video){let r=t,n=e;if(r.simulcasts&&r.simulcasts.length>0)for(let e=0;e<r.simulcasts.length;e++){let t=r.simulcasts[e],i=n.getSimulcastTrack(t,r.width,r.height);this.localTracks.set(i,void 0),this.addTrackListeners(i),this.channel.getStreamEngineVendor()!=Kt.Seastart&&await this.channel.publishLocalTrack(i,t)}}await this.channel.publishLocalTrack(e,t)}async unpublishLocalTrack(e){if(!this.channel)throw U;if(await this.channel.unpublishLocalTrack(e),e instanceof Ir){let t=e.getAudioTrack();t&&t.getMediaStreamTrack()&&await this.unpublishLocalTrack(t)}if(this.channel.getStreamEngineVendor()!=Kt.Seastart&&e.kind==M.Video){let t=e.getSimulcastTracks();for(let e in t){let r=t[e];await this.channel.unpublishLocalTrack(r)}}}async subscribeRemoteAudioMixTrack(e){let t=await super.subscribeRemoteAudioMixTrack(e);return this.addTrackListeners(t),t}async subscribeRemoteAudioTrack(e,t){let r=await super.subscribeRemoteAudioTrack(e,t);return this.addTrackListeners(r),r}async subscribeRemoteVideoMcuTrack(){let e=await super.subscribeRemoteVideoMcuTrack();return this.addTrackListeners(e),e}async subscribeRemoteVideoTrack(e,t){let r=await super.subscribeRemoteVideoTrack(e,t);return this.addTrackListeners(r),r}async unsubscribeRemoteTrack(e){await super.unsubscribeRemoteTrack(e)}getRemoteTrack(e,t,r){return super.getRemoteTrack(e,t,r)}}var Kr=n.Yk,Gr=n.Id,$r=n.Mz,Qr=n.Ne,Jr=n.bq,Yr=n.hj,Xr=n.h4,Zr=n.dC,en=n.xk,tn=n.J,rn=n.a7,nn=n.s_,on=n.VO,sn=n.VF,an=n.M0,cn=n.$b,un=n.WI,ln=n.cp,hn=n.ez,fn=n.EQ,dn=n.$t,pn=n.jL,gn=n.Ps,mn=n.VV,yn=n._b,vn=n.dT,bn=n.CM,wn=n.Zq;export{Kr as CameraPresets,Gr as ChannelEvent,$r as ChannelEventType,Qr as Codec,Jr as DeviceType,Yr as DisconnectReason,Xr as ImDisconnectReason,Zr as ImEvent,en as ImEventType,tn as LocalAudioTrack,rn as LocalCameraTrack,nn as LocalMicTrack,on as LocalScreenAudioTrack,sn as LocalScreenTrack,an as LocalVideoTrack,cn as LogLevel,un as LogTarget,ln as MicPresets,hn as RemoteAudioMixTrack,fn as RemoteAudioTrack,dn as RemoteVideoTrack,pn as SRTC,gn as ScreenAudioPresets,mn as ScreenPresets,yn as TrackKind,vn as __INNER__,bn as codec2str,wn as createMixedAudioMediaStreamTrack};
|