UNPKG

@videosdk.live/js-sdk

Version:

<h1 align="center"> <img src="https://static.videosdk.live/videosdk_logo_website_black.png"/><br/> <p align="center"> Video SDK for JavaScript<br/> <a href="https://videosdk.live/">videosdk.live</a> </p> </h1>

1,304 lines (1,302 loc) 2.26 MB
/*! For license information please see videosdk.js.LICENSE.txt */ !(function (e, t) { if ("object" == typeof exports && "object" == typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else { var r = t(); for (var n in r) ("object" == typeof exports ? exports : e)[n] = r[n]; } })(self, () => (() => { var e = { 11: function (e, t, r) { "use strict"; var n = (this && this.__createBinding) || (Object.create ? function (e, t, r, n) { void 0 === n && (n = r); var s = Object.getOwnPropertyDescriptor(t, r); (s && !("get" in s ? !t.__esModule : s.writable || s.configurable)) || (s = { enumerable: !0, get: function () { return t[r]; }, }), Object.defineProperty(e, n, s); } : function (e, t, r, n) { void 0 === n && (n = r), (e[n] = t[r]); }), s = (this && this.__setModuleDefault) || (Object.create ? function (e, t) { Object.defineProperty(e, "default", { enumerable: !0, value: t, }); } : function (e, t) { e.default = t; }), i = (this && this.__importStar) || function (e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var r in e) "default" !== r && Object.prototype.hasOwnProperty.call(e, r) && n(t, e, r); return s(t, e), t; }; Object.defineProperty(t, "__esModule", { value: !0 }), (t.Chrome74 = void 0); const a = i(r(7363)), o = r(2994), c = i(r(1765)), d = i(r(8046)), l = i(r(5544)), u = i(r(5938)), p = i(r(4256)), h = r(4893), m = r(521), f = r(1305), g = r(3303), _ = new o.Logger("Chrome74"), v = { OS: 1024, MIS: 1024 }; class b extends m.HandlerInterface { static createFactory() { return () => new b(); } constructor() { super(), (this._closed = !1), (this._mapMidTransceiver = new Map()), (this._sendStream = new MediaStream()), (this._hasDataChannelMediaSection = !1), (this._nextSendSctpStreamId = 0), (this._transportReady = !1); } get name() { return "Chrome74"; } close() { if ((_.debug("close()"), !this._closed)) { if (((this._closed = !0), this._pc)) try { this._pc.close(); } catch (e) {} this.emit("@close"); } } async getNativeRtpCapabilities() { _.debug("getNativeRtpCapabilities()"); const e = new RTCPeerConnection({ iceServers: [], iceTransportPolicy: "all", bundlePolicy: "max-bundle", rtcpMuxPolicy: "require", sdpSemantics: "unified-plan", }); try { e.addTransceiver("audio"), e.addTransceiver("video"); const t = await e.createOffer(); try { e.close(); } catch (e) {} const r = a.parse(t.sdp), n = l.extractRtpCapabilities({ sdpObject: r }); return p.addNackSuppportForOpus(n), n; } catch (t) { try { e.close(); } catch (e) {} throw t; } } async getNativeSctpCapabilities() { return _.debug("getNativeSctpCapabilities()"), { numStreams: v }; } run({ direction: e, iceParameters: t, iceCandidates: r, dtlsParameters: n, sctpParameters: s, iceServers: i, iceTransportPolicy: a, additionalSettings: o, proprietaryConstraints: c, extendedRtpCapabilities: l, }) { _.debug("run()"), (this._direction = e), (this._remoteSdp = new f.RemoteSdp({ iceParameters: t, iceCandidates: r, dtlsParameters: n, sctpParameters: s, })), (this._sendingRtpParametersByKind = { audio: d.getSendingRtpParameters("audio", l), video: d.getSendingRtpParameters("video", l), }), (this._sendingRemoteRtpParametersByKind = { audio: d.getSendingRemoteRtpParameters("audio", l), video: d.getSendingRemoteRtpParameters("video", l), }), n.role && "auto" !== n.role && (this._forcedLocalDtlsRole = "server" === n.role ? "client" : "server"), (this._pc = new RTCPeerConnection( { iceServers: i || [], iceTransportPolicy: a || "all", bundlePolicy: "max-bundle", rtcpMuxPolicy: "require", sdpSemantics: "unified-plan", ...o, }, c )), this._pc.addEventListener("icegatheringstatechange", () => { this.emit( "@icegatheringstatechange", this._pc.iceGatheringState ); }), this._pc.connectionState ? this._pc.addEventListener("connectionstatechange", () => { this.emit( "@connectionstatechange", this._pc.connectionState ); }) : (_.warn( "run() | pc.connectionState not supported, using pc.iceConnectionState" ), this._pc.addEventListener( "iceconnectionstatechange", () => { switch (this._pc.iceConnectionState) { case "checking": this.emit("@connectionstatechange", "connecting"); break; case "connected": case "completed": this.emit("@connectionstatechange", "connected"); break; case "failed": this.emit("@connectionstatechange", "failed"); break; case "disconnected": this.emit("@connectionstatechange", "disconnected"); break; case "closed": this.emit("@connectionstatechange", "closed"); } } )); } async updateIceServers(e) { this.assertNotClosed(), _.debug("updateIceServers()"); const t = this._pc.getConfiguration(); (t.iceServers = e), this._pc.setConfiguration(t); } async restartIce(e) { if ( (this.assertNotClosed(), _.debug("restartIce()"), this._remoteSdp.updateIceParameters(e), this._transportReady) ) if ("send" === this._direction) { const e = await this._pc.createOffer({ iceRestart: !0 }); _.debug( "restartIce() | calling pc.setLocalDescription() [offer:%o]", e ), await this._pc.setLocalDescription(e); const t = { type: "answer", sdp: this._remoteSdp.getSdp() }; _.debug( "restartIce() | calling pc.setRemoteDescription() [answer:%o]", t ), await this._pc.setRemoteDescription(t); } else { const e = { type: "offer", sdp: this._remoteSdp.getSdp() }; _.debug( "restartIce() | calling pc.setRemoteDescription() [offer:%o]", e ), await this._pc.setRemoteDescription(e); const t = await this._pc.createAnswer(); _.debug( "restartIce() | calling pc.setLocalDescription() [answer:%o]", t ), await this._pc.setLocalDescription(t); } } async getTransportStats() { return this.assertNotClosed(), this._pc.getStats(); } async send({ track: e, encodings: t, codecOptions: r, codec: n }) { this.assertNotClosed(), this.assertSendDirection(), _.debug("send() [kind:%s, track.id:%s]", e.kind, e.id), t && t.length > 1 && t.forEach((e, t) => { e.rid = `r${t}`; }); const s = c.clone(this._sendingRtpParametersByKind[e.kind]); s.codecs = d.reduceCodecs(s.codecs, n); const i = c.clone(this._sendingRemoteRtpParametersByKind[e.kind]); i.codecs = d.reduceCodecs(i.codecs, n); const o = this._remoteSdp.getNextMediaSectionIdx(), p = this._pc.addTransceiver(e, { direction: "sendonly", streams: [this._sendStream], sendEncodings: t, }); let h, m = await this._pc.createOffer(), f = a.parse(m.sdp); this._transportReady || (await this.setupTransport({ localDtlsRole: this._forcedLocalDtlsRole ?? "client", localSdpObject: f, })); let v = !1; const b = (0, g.parse)((t || [{}])[0].scalabilityMode); t && 1 === t.length && b.spatialLayers > 1 && "video/vp9" === s.codecs[0].mimeType.toLowerCase() && (_.debug("send() | enabling legacy simulcast for VP9 SVC"), (v = !0), (f = a.parse(m.sdp)), (h = f.media[o.idx]), u.addLegacySimulcast({ offerMediaObject: h, numStreams: b.spatialLayers, }), (m = { type: "offer", sdp: a.write(f) })), _.debug( "send() | calling pc.setLocalDescription() [offer:%o]", m ), await this._pc.setLocalDescription(m); const y = p.mid; if ( ((s.mid = y), (f = a.parse(this._pc.localDescription.sdp)), (h = f.media[o.idx]), (s.rtcp.cname = l.getCname({ offerMediaObject: h })), t) ) if (1 === t.length) { let e = u.getRtpEncodings({ offerMediaObject: h }); Object.assign(e[0], t[0]), v && (e = [e[0]]), (s.encodings = e); } else s.encodings = t; else s.encodings = u.getRtpEncodings({ offerMediaObject: h }); if ( s.encodings.length > 1 && ("video/vp8" === s.codecs[0].mimeType.toLowerCase() || "video/h264" === s.codecs[0].mimeType.toLowerCase()) ) for (const e of s.encodings) e.scalabilityMode ? (e.scalabilityMode = `L1T${b.temporalLayers}`) : (e.scalabilityMode = "L1T3"); this._remoteSdp.send({ offerMediaObject: h, reuseMid: o.reuseMid, offerRtpParameters: s, answerRtpParameters: i, codecOptions: r, extmapAllowMixed: !0, }); const w = { type: "answer", sdp: this._remoteSdp.getSdp() }; return ( _.debug( "send() | calling pc.setRemoteDescription() [answer:%o]", w ), await this._pc.setRemoteDescription(w), this._mapMidTransceiver.set(y, p), { localId: y, rtpParameters: s, rtpSender: p.sender } ); } async stopSending(e) { if ( (this.assertSendDirection(), _.debug("stopSending() [localId:%s]", e), this._closed) ) return; const t = this._mapMidTransceiver.get(e); if (!t) throw new Error("associated RTCRtpTransceiver not found"); t.sender.replaceTrack(null), this._pc.removeTrack(t.sender); if (this._remoteSdp.closeMediaSection(t.mid)) try { t.stop(); } catch (e) {} const r = await this._pc.createOffer(); _.debug( "stopSending() | calling pc.setLocalDescription() [offer:%o]", r ), await this._pc.setLocalDescription(r); const n = { type: "answer", sdp: this._remoteSdp.getSdp() }; _.debug( "stopSending() | calling pc.setRemoteDescription() [answer:%o]", n ), await this._pc.setRemoteDescription(n), this._mapMidTransceiver.delete(e); } async pauseSending(e) { this.assertNotClosed(), this.assertSendDirection(), _.debug("pauseSending() [localId:%s]", e); const t = this._mapMidTransceiver.get(e); if (!t) throw new Error("associated RTCRtpTransceiver not found"); (t.direction = "inactive"), this._remoteSdp.pauseMediaSection(e); const r = await this._pc.createOffer(); _.debug( "pauseSending() | calling pc.setLocalDescription() [offer:%o]", r ), await this._pc.setLocalDescription(r); const n = { type: "answer", sdp: this._remoteSdp.getSdp() }; _.debug( "pauseSending() | calling pc.setRemoteDescription() [answer:%o]", n ), await this._pc.setRemoteDescription(n); } async resumeSending(e) { this.assertNotClosed(), this.assertSendDirection(), _.debug("resumeSending() [localId:%s]", e); const t = this._mapMidTransceiver.get(e); if ((this._remoteSdp.resumeSendingMediaSection(e), !t)) throw new Error("associated RTCRtpTransceiver not found"); t.direction = "sendonly"; const r = await this._pc.createOffer(); _.debug( "resumeSending() | calling pc.setLocalDescription() [offer:%o]", r ), await this._pc.setLocalDescription(r); const n = { type: "answer", sdp: this._remoteSdp.getSdp() }; _.debug( "resumeSending() | calling pc.setRemoteDescription() [answer:%o]", n ), await this._pc.setRemoteDescription(n); } async replaceTrack(e, t) { this.assertNotClosed(), this.assertSendDirection(), t ? _.debug("replaceTrack() [localId:%s, track.id:%s]", e, t.id) : _.debug("replaceTrack() [localId:%s, no track]", e); const r = this._mapMidTransceiver.get(e); if (!r) throw new Error("associated RTCRtpTransceiver not found"); await r.sender.replaceTrack(t); } async setMaxSpatialLayer(e, t) { this.assertNotClosed(), this.assertSendDirection(), _.debug( "setMaxSpatialLayer() [localId:%s, spatialLayer:%s]", e, t ); const r = this._mapMidTransceiver.get(e); if (!r) throw new Error("associated RTCRtpTransceiver not found"); const n = r.sender.getParameters(); n.encodings.forEach((e, r) => { e.active = r <= t; }), await r.sender.setParameters(n), this._remoteSdp.muxMediaSectionSimulcast(e, n.encodings); const s = await this._pc.createOffer(); _.debug( "setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]", s ), await this._pc.setLocalDescription(s); const i = { type: "answer", sdp: this._remoteSdp.getSdp() }; _.debug( "setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]", i ), await this._pc.setRemoteDescription(i); } async setRtpEncodingParameters(e, t) { this.assertNotClosed(), this.assertSendDirection(), _.debug( "setRtpEncodingParameters() [localId:%s, params:%o]", e, t ); const r = this._mapMidTransceiver.get(e); if (!r) throw new Error("associated RTCRtpTransceiver not found"); const n = r.sender.getParameters(); n.encodings.forEach((e, r) => { n.encodings[r] = { ...e, ...t }; }), await r.sender.setParameters(n), this._remoteSdp.muxMediaSectionSimulcast(e, n.encodings); const s = await this._pc.createOffer(); _.debug( "setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]", s ), await this._pc.setLocalDescription(s); const i = { type: "answer", sdp: this._remoteSdp.getSdp() }; _.debug( "setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]", i ), await this._pc.setRemoteDescription(i); } async getSenderStats(e) { this.assertNotClosed(), this.assertSendDirection(); const t = this._mapMidTransceiver.get(e); if (!t) throw new Error("associated RTCRtpTransceiver not found"); return t.sender.getStats(); } async sendDataChannel({ ordered: e, maxPacketLifeTime: t, maxRetransmits: r, label: n, protocol: s, }) { this.assertNotClosed(), this.assertSendDirection(); const i = { negotiated: !0, id: this._nextSendSctpStreamId, ordered: e, maxPacketLifeTime: t, maxRetransmits: r, protocol: s, }; _.debug("sendDataChannel() [options:%o]", i); const o = this._pc.createDataChannel(n, i); if ( ((this._nextSendSctpStreamId = ++this._nextSendSctpStreamId % v.MIS), !this._hasDataChannelMediaSection) ) { const e = await this._pc.createOffer(), t = a.parse(e.sdp), r = t.media.find((e) => "application" === e.type); this._transportReady || (await this.setupTransport({ localDtlsRole: this._forcedLocalDtlsRole ?? "client", localSdpObject: t, })), _.debug( "sendDataChannel() | calling pc.setLocalDescription() [offer:%o]", e ), await this._pc.setLocalDescription(e), this._remoteSdp.sendSctpAssociation({ offerMediaObject: r }); const n = { type: "answer", sdp: this._remoteSdp.getSdp() }; _.debug( "sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]", n ), await this._pc.setRemoteDescription(n), (this._hasDataChannelMediaSection = !0); } return { dataChannel: o, sctpStreamParameters: { streamId: i.id, ordered: i.ordered, maxPacketLifeTime: i.maxPacketLifeTime, maxRetransmits: i.maxRetransmits, }, }; } async receive(e) { this.assertNotClosed(), this.assertRecvDirection(); const t = [], r = new Map(); for (const t of e) { const { trackId: e, kind: n, rtpParameters: s, streamId: i, } = t; _.debug("receive() [trackId:%s, kind:%s]", e, n); const a = s.mid || String(this._mapMidTransceiver.size); r.set(e, a), this._remoteSdp.receive({ mid: a, kind: n, offerRtpParameters: s, streamId: i || s.rtcp.cname, trackId: e, }); } const n = { type: "offer", sdp: this._remoteSdp.getSdp() }; _.debug( "receive() | calling pc.setRemoteDescription() [offer:%o]", n ), await this._pc.setRemoteDescription(n); let s = await this._pc.createAnswer(); const i = a.parse(s.sdp); for (const t of e) { const { trackId: e, rtpParameters: n } = t, s = r.get(e), a = i.media.find((e) => String(e.mid) === s); l.applyCodecParameters({ offerRtpParameters: n, answerMediaObject: a, }); } (s = { type: "answer", sdp: a.write(i) }), this._transportReady || (await this.setupTransport({ localDtlsRole: this._forcedLocalDtlsRole ?? "client", localSdpObject: i, })), _.debug( "receive() | calling pc.setLocalDescription() [answer:%o]", s ), await this._pc.setLocalDescription(s); for (const n of e) { const { trackId: e } = n, s = r.get(e), i = this._pc.getTransceivers().find((e) => e.mid === s); if (!i) throw new Error("new RTCRtpTransceiver not found"); this._mapMidTransceiver.set(s, i), t.push({ localId: s, track: i.receiver.track, rtpReceiver: i.receiver, }); } return t; } async stopReceiving(e) { if ((this.assertRecvDirection(), this._closed)) return; for (const t of e) { _.debug("stopReceiving() [localId:%s]", t); const e = this._mapMidTransceiver.get(t); if (!e) throw new Error("associated RTCRtpTransceiver not found"); this._remoteSdp.closeMediaSection(e.mid); } const t = { type: "offer", sdp: this._remoteSdp.getSdp() }; _.debug( "stopReceiving() | calling pc.setRemoteDescription() [offer:%o]", t ), await this._pc.setRemoteDescription(t); const r = await this._pc.createAnswer(); _.debug( "stopReceiving() | calling pc.setLocalDescription() [answer:%o]", r ), await this._pc.setLocalDescription(r); for (const t of e) this._mapMidTransceiver.delete(t); } async pauseReceiving(e) { this.assertNotClosed(), this.assertRecvDirection(); for (const t of e) { _.debug("pauseReceiving() [localId:%s]", t); const e = this._mapMidTransceiver.get(t); if (!e) throw new Error("associated RTCRtpTransceiver not found"); (e.direction = "inactive"), this._remoteSdp.pauseMediaSection(t); } const t = { type: "offer", sdp: this._remoteSdp.getSdp() }; _.debug( "pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]", t ), await this._pc.setRemoteDescription(t); const r = await this._pc.createAnswer(); _.debug( "pauseReceiving() | calling pc.setLocalDescription() [answer:%o]", r ), await this._pc.setLocalDescription(r); } async resumeReceiving(e) { this.assertNotClosed(), this.assertRecvDirection(); for (const t of e) { _.debug("resumeReceiving() [localId:%s]", t); const e = this._mapMidTransceiver.get(t); if (!e) throw new Error("associated RTCRtpTransceiver not found"); (e.direction = "recvonly"), this._remoteSdp.resumeReceivingMediaSection(t); } const t = { type: "offer", sdp: this._remoteSdp.getSdp() }; _.debug( "resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]", t ), await this._pc.setRemoteDescription(t); const r = await this._pc.createAnswer(); _.debug( "resumeReceiving() | calling pc.setLocalDescription() [answer:%o]", r ), await this._pc.setLocalDescription(r); } async getReceiverStats(e) { this.assertNotClosed(), this.assertRecvDirection(); const t = this._mapMidTransceiver.get(e); if (!t) throw new Error("associated RTCRtpTransceiver not found"); return t.receiver.getStats(); } async receiveDataChannel({ sctpStreamParameters: e, label: t, protocol: r, }) { this.assertNotClosed(), this.assertRecvDirection(); const { streamId: n, ordered: s, maxPacketLifeTime: i, maxRetransmits: o, } = e, c = { negotiated: !0, id: n, ordered: s, maxPacketLifeTime: i, maxRetransmits: o, protocol: r, }; _.debug("receiveDataChannel() [options:%o]", c); const d = this._pc.createDataChannel(t, c); if (!this._hasDataChannelMediaSection) { this._remoteSdp.receiveSctpAssociation(); const e = { type: "offer", sdp: this._remoteSdp.getSdp() }; _.debug( "receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]", e ), await this._pc.setRemoteDescription(e); const t = await this._pc.createAnswer(); if (!this._transportReady) { const e = a.parse(t.sdp); await this.setupTransport({ localDtlsRole: this._forcedLocalDtlsRole ?? "client", localSdpObject: e, }); } _.debug( "receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]", t ), await this._pc.setLocalDescription(t), (this._hasDataChannelMediaSection = !0); } return { dataChannel: d }; } async setupTransport({ localDtlsRole: e, localSdpObject: t }) { t || (t = a.parse(this._pc.localDescription.sdp)); const r = l.extractDtlsParameters({ sdpObject: t }); (r.role = e), this._remoteSdp.updateDtlsRole( "client" === e ? "server" : "client" ), await new Promise((e, t) => { this.safeEmit("@connect", { dtlsParameters: r }, e, t); }), (this._transportReady = !0); } assertNotClosed() { if (this._closed) throw new h.InvalidStateError( "method called in a closed handler" ); } assertSendDirection() { if ("send" !== this._direction) throw new Error( 'method can just be called for handlers with "send" direction' ); } assertRecvDirection() { if ("recv" !== this._direction) throw new Error( 'method can just be called for handlers with "recv" direction' ); } } t.Chrome74 = b; }, 19: function (e, t, r) { var n, s, i, a, o, c, d, l, u; e.exports = ((u = r(9021)), r(3009), r(1025), (s = (n = u).lib), (i = s.Base), (a = s.WordArray), (o = n.algo), (c = o.SHA256), (d = o.HMAC), (l = o.PBKDF2 = i.extend({ cfg: i.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 = d.create(r.hasher, e), s = a.create(), i = a.create([1]), o = s.words, c = i.words, l = r.keySize, u = r.iterations; o.length < l; ) { var p = n.update(t).finalize(i); n.reset(); for ( var h = p.words, m = h.length, f = p, g = 1; g < u; g++ ) { (f = n.finalize(f)), n.reset(); for (var _ = f.words, v = 0; v < m; v++) h[v] ^= _[v]; } s.concat(p), c[0]++; } return (s.sigBytes = 4 * l), s; }, })), (n.PBKDF2 = function (e, t, r) { return l.create(r).compute(e, t); }), u.PBKDF2); }, 25: function (e, t, r) { var n, s, i, a; e.exports = ((a = r(9021)), r(7165), (s = (n = a).lib.CipherParams), (i = n.enc.Hex), (n.format.Hex = { stringify: function (e) { return e.ciphertext.toString(i); }, parse: function (e) { var t = i.parse(e); return s.create({ ciphertext: t }); }, }), a.format.Hex); }, 76: function (e, t, r) { "use strict"; var n = (this && this.__createBinding) || (Object.create ? function (e, t, r, n) { void 0 === n && (n = r); var s = Object.getOwnPropertyDescriptor(t, r); (s && !("get" in s ? !t.__esModule : s.writable || s.configurable)) || (s = { enumerable: !0, get: function () { return t[r]; }, }), Object.defineProperty(e, n, s); } : function (e, t, r, n) { void 0 === n && (n = r), (e[n] = t[r]); }), s = (this && this.__setModuleDefault) || (Object.create ? function (e, t) { Object.defineProperty(e, "default", { enumerable: !0, value: t, }); } : function (e, t) { e.default = t; }), i = (this && this.__importStar) || function (e) { if (e && e.__esModule) return e; var t = {}; if (null != e) for (var r in e) "default" !== r && Object.prototype.hasOwnProperty.call(e, r) && n(t, e, r); return s(t, e), t; }, a = (this && this.__importDefault) || function (e) { return e && e.__esModule ? e : { default: e }; }; Object.defineProperty(t, "__esModule", { value: !0 }), (t.debug = t.parseScalabilityMode = t.detectDevice = t.Device = t.version = t.types = void 0); const o = a(r(7833)); t.debug = o.default; const c = r(6004); Object.defineProperty(t, "Device", { enumerable: !0, get: function () { return c.Device; }, }), Object.defineProperty(t, "detectDevice", { enumerable: !0, get: function () { return c.detectDevice; }, }); const d = i(r(8057)); (t.types = d), (t.version = "3.7.7"); var l = r(3303); Object.defineProperty(t, "parseScalabilityMode", { enumerable: !0, get: function () { return l.parse; }, }); }, 296: (e, t, r) => { "use strict"; r.d(t, { A: () => s }); var n = r(7800); function s(e, t) { return ( (function (e) { if (Array.isArray(e)) return e; })(e) || (function (e, t) { var r = null == e ? null : ("undefined" != typeof Symbol && e[Symbol.iterator]) || e["@@iterator"]; if (null != r) { var n, s, i, a, o = [], c = !0, d = !1; try { if (((i = (r = r.call(e)).next), 0 === t)) { if (Object(r) !== r) return; c = !1; } else for ( ; !(c = (n = i.call(r)).done) && (o.push(n.value), o.length !== t); c = !0 ); } catch (e) { (d = !0), (s = e); } finally { try { if ( !c && null != r.return && ((a = r.return()), Object(a) !== a) ) return; } finally { if (d) throw s; } } return o; } })(e, t) || (0, n.A)(e, t) || (function () { throw new TypeError( "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ); })() ); } }, 328: (e, t, r) => { r(8624), (e.exports = self.fetch.bind(self)); }, 467: (e, t, r) => { "use strict"; function n(e, t, r, n, s, i, a) { try { var o = e[i](a), c = o.value; } catch (e) { return void r(e); } o.done ? t(c) : Promise.resolve(c).then(n, s); } function s(e) { return function () { var t = this, r = arguments; return new Promise(function (s, i) { var a = e.apply(t, r); function o(e) { n(a, s, i, o, c, "next", e); } function c(e) { n(a, s, i, o, c, "throw", e); } o(void 0); }); }; } r.d(t, { A: () => s }); }, 477: () => {}, 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); }, 521: (e, t, r) => { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), (t.HandlerInterface = void 0); const n = r(2010); class s extends n.EnhancedEventEmitter { constructor() { super(); } } t.HandlerInterface = s; }, 736: (e, t, r) => { e.exports = function (e) { function t(e) { let r, s, i, a = null; function o(...e) { if (!o.enabled) return; const n = o, s = Number(new Date()), i = s - (r || s); (n.diff = i), (n.prev = r), (n.curr = s), (r = s), (e[0] = t.coerce(e[0])), "string" != typeof e[0] && e.unshift("%O"); let a = 0; (e[0] = e[0].replace(/%([a-zA-Z%])/g, (r, s) => { if ("%%" === r) return "%"; a++; const i = t.formatters[s]; if ("function" == typeof i) { const t = e[a]; (r = i.call(n, t)), e.splice(a, 1), a--; } return r; })), t.formatArgs.call(n, e); (n.log || t.log).apply(n, e); } return ( (o.namespace = e), (o.useColors = t.useColors()), (o.color = t.selectColor(e)), (o.extend = n), (o.destroy = t.destroy), Object.defineProperty(o, "enabled", { enumerable: !0, configurable: !1, get: () => null !== a ? a : (s !== t.namespaces && ((s = t.namespaces), (i = t.enabled(e))), i), set: (e) => { a = e; }, }), "function" == typeof t.init && t.init(o), o ); } function n(e, r) { const n = t(this.namespace + (void 0 === r ? ":" : r) + e); return (n.log = this.log), n; } function s(e, t) { let r = 0, n = 0, s = -1, i = 0; for (; r < e.length; ) if (n < t.length && (t[n] === e[r] || "*" === t[n])) "*" === t[n] ? ((s = n), (i = r), n++) : (r++, n++); else { if (-1 === s) return !1; (n = s + 1), i++, (r = i); } for (; n < t.length && "*" === t[n]; ) n++; return n === t.length; } 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, ...t.skips.map((e) => "-" + e)].join( "," ); return t.enable(""), e; }), (t.enable = function (e) { t.save(e), (t.namespaces = e), (t.names = []), (t.skips = []); const r = ("string" == typeof e ? e : "") .trim() .replace(" ", ",") .split(",") .filter(Boolean); for (const e of r) "-" === e[0] ? t.skips.push(e.slice(1)) : t.names.push(e); }), (t.enabled = function (e) { for (const r of t.skips) if (s(e, r)) return !1; for (const r of t.names) if (s(e, r)) return !0; return !1; }), (t.humanize = r(6585)), (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 ); }; }, 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 s = [], i = 0, a = 0; a < r; a++) if (a % 4) { var o = (n[e.charCodeAt(a - 1)] << ((a % 4) * 2)) | (n[e.charCodeAt(a)] >>> (6 - (a % 4) * 2)); (s[i >>> 2] |= o << (24 - (i % 4) * 8)), i++; } return t.create(s, i); } e.enc.Base64 = { stringify: function (e) { var t = e.words, r = e.sigBytes, n = this._map; e.clamp(); for (var s = [], i = 0; i < r; i += 3) for ( var a = (((t[i >>> 2] >>> (24 - (i % 4) * 8)) & 255) << 16) | (((t[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 255) << 8) | ((t[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 255), o = 0; o < 4 && i + 0.75 * o < r; o++ ) s.push(n.charAt((a >>> (6 * (3 - o))) & 63)); var c = n.charAt(64); if (c) for (; s.length % 4; ) s.push(c); return s.join(""); }, parse: function (e) { var t = e.length, n = this._map, s = this._reverseMap; if (!s) { s = this._reverseMap = []; for (var i = 0; i < n.length; i++) s[n.charCodeAt(i)] = i; } var a = n.charAt(64); if (a) { var o = e.indexOf(a); -1 !== o && (t = o); } return r(e, t, s); }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", }; })(), n.enc.Base64); }, 816: (e, t, r) => { "use strict"; r.d(t, { A: () => s }); var n = r(2284); function s(e) { var t = (function (e, t) { if ("object" != (0, n.A)(e) || !e) return e; var r = e[Symbol.toPrimitive]; if (void 0 !== r) { var s = r.call(e, t || "default"); if ("object" != (0, n.A)(s)) return s; throw new TypeError( "@@toPrimitive must return a primitive value." ); } return ("string" === t ? String : Number)(e); })(e, "string"); return "symbol" == (0, n.A)(t) ? t : t + ""; } }, 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, s = [], i = [], a = [], o = [], c = [], d = [], l = [], u = [], p = [], h = []; !(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 m = n ^ (n << 1) ^ (n << 2) ^ (n << 3) ^ (n << 4); (m = (m >>> 8) ^ (255 & m) ^ 99), (s[r] = m), (i[m] = r); var f = e[r], g = e[f], _ = e[g], v = (257 * e[m]) ^ (16843008 * m); (a[r] = (v << 24) | (v >>> 8)), (o[r] = (v << 16) | (v >>> 16)), (c[r] = (v << 8) | (v >>> 24)), (d[r] = v), (v = (16843009 * _) ^ (65537 * g) ^ (257 * f) ^ (16843008 * r)), (l[m] = (v << 24) | (v >>> 8)), (u[m] = (v << 16) | (v >>> 16)), (p[m] = (v << 8) | (v >>> 24)), (h[m] = v), r ? ((r = f ^ e[e[e[_ ^ f]]]), (n ^= e[e[n]])) : (r = n = 1); } })(); var m = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], f = (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), i = (this._keySchedule = []), a = 0;