quickvo-player 0.1.9 → 0.2.1

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/dist/index.js CHANGED
@@ -2,19 +2,19 @@ var Q = Object.defineProperty;
2
2
  var X = (h) => {
3
3
  throw TypeError(h);
4
4
  };
5
- var tt = (h, n, a) => n in h ? Q(h, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : h[n] = a;
6
- var m = (h, n, a) => tt(h, typeof n != "symbol" ? n + "" : n, a), Z = (h, n, a) => n.has(h) || X("Cannot " + a);
7
- var I = (h, n, a) => (Z(h, n, "read from private field"), a ? a.call(h) : n.get(h)), J = (h, n, a) => n.has(h) ? X("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(h) : n.set(h, a), H = (h, n, a, u) => (Z(h, n, "write to private field"), u ? u.call(h, a) : n.set(h, a), a);
5
+ var tt = (h, o, a) => o in h ? Q(h, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : h[o] = a;
6
+ var m = (h, o, a) => tt(h, typeof o != "symbol" ? o + "" : o, a), Z = (h, o, a) => o.has(h) || X("Cannot " + a);
7
+ var I = (h, o, a) => (Z(h, o, "read from private field"), a ? a.call(h) : o.get(h)), J = (h, o, a) => o.has(h) ? X("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(h) : o.set(h, a), H = (h, o, a, u) => (Z(h, o, "write to private field"), u ? u.call(h, a) : o.set(h, a), a);
8
8
  const D = '(function(){"use strict";class P{pendingPayloads=[];payload=new Uint8Array(0);chunks=[];push=t=>{this.pendingPayloads.push(t)};next=(t=0)=>{this.payload=this.payload.slice(t);const s=this.pendingPayloads.shift();if(!s)return!1;const e=new Uint8Array(this.payload.byteLength+s.byteLength);return e.set(this.payload,0),e.set(s,this.payload.byteLength),this.payload=e,new DataView(this.payload.buffer)};pushChunk=t=>{this.chunks.push(t),this.chunks.length>1e3&&this.chunks.shift()};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array(0),this.chunks=[]}}const I=(y,t)=>{const s=new Uint8Array(y),e=new Uint8Array(t),n=new Uint8Array(11+s.length+e.length);let a=0;return n[a++]=1,n[a++]=s[1],n[a++]=s[2],n[a++]=s[3],n[a++]=255,n[a++]=225,n[a++]=s.length>>8&255,n[a++]=s.length&255,n.set(s,a),a+=s.length,n[a++]=1,n[a++]=e.length>>8&255,n[a++]=e.length&255,n.set(e,a),n},T=y=>{let t=0;const s=new DataView(y.buffer),e=s.getUint8(t);if(t=t+1,e!==1)throw new Error("Invalid AVC version");const n=s.getUint8(t)&255;t=t+1;const a=s.getUint8(t)&255;t=t+1;const o=s.getUint8(t)&255;t=t+1;const c=`avc1.${Array.from([n,a,o],U=>U.toString(16).padStart(2,"0")).join("")}`,r=(s.getUint8(t)&3)-1;t=t+1;const g=s.getUint8(t)&31;t=t+1;const p=s.getUint16(t,!1);t=t+2;const h=new Uint8Array(s.buffer.slice(t,t+p));t=t+p;const d=s.getUint8(t)&31;t=t+1;const u=s.getUint16(t,!1);t=t+2;const f=new Uint8Array(s.buffer.slice(t,t+u));return t=t+u,{version:e,codec:c,profile:n,compatibility:a,level:o,lengthSizeMinusOne:r,numOfSequenceParameterSets:g,sequenceParameterSetLength:p,sps:h,numOfPictureParameterSets:d,pictureParameterSetLength:u,pps:f}},M=y=>{const t=new Uint8Array(4+y.length);return new DataView(t.buffer).setUint32(0,y.length,!1),t.set(y,4),t},C=y=>{let t=0;for(const n of y)t+=n.length;const s=new Uint8Array(t);let e=0;for(const n of y){const a=n;s.set(a,e),e+=a.length}return s},D=y=>{let t="unknown";switch(y){case 1:case 2:case 27:case 36:t="video";break;case 3:case 4:case 15:t="audio";break;case 6:t="subtitle";break;case 134:t="ad";break}return t};class x{pat;pmt;audioConfig;videoConfig;payloadMap=new Map;on={};constructor(){}parse=async t=>{let s=0;for(;!(s+188>t.byteLength);){if(t.getInt8(s)!=71){s++;continue}await this.parsePacket(t,s),s+=188}return s};parsePacket=async(t,s)=>{if(s+188>t.byteLength)throw new Error("Invalid TS packet");if(t.getUint8(s)!==71)throw new Error("Invalid TS packet");let e=s;const n=this.parseHeader(t,e);e+=4;const{transport_error_indicator:a,pid:o,payload_unit_start_indicator:l,adaptation_field_control:i}=n;if(a===1||o===void 0)return;let c=184;if(i===2||i===3){const r=t.getUint8(e);e+=1,this.parseAdaptationField(t,e),e+=r,c-=r}if(i===3&&(c-=1),i===1||i===3){const r=new Uint8Array(t.buffer.slice(e,e+c));if(o===0)return this.parsePAT(t,e);{const{programs:h=[]}=this.pat||{};if(h.find(u=>u.pmt_pid===o))return this.parsePMT(t,e)}const{streams:g=[]}=this.pmt||{},p=g.find(h=>h.elementary_pid===o);if(p){if(l===1){const h=this.payloadMap.get(o);if(h){switch(p.kind){case"audio":{const d=await this.parseAudio(h);this.on.chunk&&this.on.chunk(d)}break;case"video":{const d=await this.parseVideo(h);this.on.chunk&&this.on.chunk(d),await new Promise(u=>setTimeout(()=>u(!0),0))}break}this.payloadMap.delete(o)}}{this.payloadMap.has(o)||this.payloadMap.set(o,new Uint8Array);const h=this.payloadMap.get(o),d=new Uint8Array(h.byteLength+r.byteLength);d.set(h,0),d.set(r,h.byteLength),this.payloadMap.set(o,d)}}}};parseHeader=(t,s)=>{let e=s;const n=t.getUint8(e),a=t.getUint8(e+1),o=t.getUint8(e+2),l=t.getUint8(e+3),i=(a&128)>>7;if(i===1)return{sync_byte:n,transport_error_indicator:i};const c=(a&64)>>6,r=(a&32)>>5,g=(a&31)<<8|o,p=(l&192)>>6,h=l>>4&3,d=l&15;return{sync_byte:n,transport_error_indicator:i,payload_unit_start_indicator:c,transport_priority:r,pid:g,transport_scrambling_control:p,adaptation_field_control:h,continuity_counter:d}};parsePAT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==0)throw new Error("Invalid PAT table_id");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d}}const a=[];{const l=n.section_length-5-4,i=e+l;for(;e<i;){const c=t.getUint16(e),r=t.getUint16(e+2)&8191;e+=4,c!==0&&r>=32&&r<=8190&&a.push({program_number:c,pmt_pid:r})}}const o=t.getUint32(e);this.pat={header:n,programs:a,crc32:o},this.on.debug&&this.on.debug({pat:this.pat})};parsePMT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==2)throw new Error("Invalid PMT table_id");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1;const u=t.getUint16(e)&8191;e+=2;const f=t.getUint16(e)&4095;e+=2,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d,pcr_pid:u,program_info_length:f}}const a=[];{const l=n.section_length-9-4,i=e+l;for(;e<i;){const c=t.getUint8(e),r=D(c),g=t.getUint16(e+1)&8191,p=t.getUint16(e+3)&4095;if(e+=5,g<32||g>8190){console.warn(`Invalid elementary_pid: 0x${g.toString(16)}`);continue}a.push({kind:r,stream_type:c,elementary_pid:g,es_info_length:p})}}const o=t.getUint32(e);this.pmt={header:n,streams:a,crc32:o},this.on.debug&&this.on.debug({pmt:this.pmt})};parseAdaptationField=(t,s)=>{let e=s,n,a,o,l;const i=t.getUint8(e),c=!!(i&128),r=!!(i&64),g=!!(i&32),p=!!(i&16),h=!!(i&8),d=!!(i&4),u=!!(i&2),f=!!(i&1);e+=1;const U=(_,b)=>{let m=BigInt(0);m|=BigInt(_.getUint16(b))<<25n,m|=BigInt(_.getUint16(b+1))<<17n,m|=BigInt(_.getUint16(b+2))<<9n,m|=BigInt(_.getUint16(b+3))<<1n,m|=BigInt(_.getUint16(b+4)>>7);const S=(_.getUint16(b+4)&1)<<8|_.getUint16(b+5);return m=m*300n+BigInt(S),m};if(p&&(n=U(t,e),e+=6),h&&(a=U(t,e),e+=6),d&&(o=t.getInt8(e),e+=1),u){const _=t.getUint8(e);e+=1,l=new Uint8Array(t.buffer,e,_),e+=_}return{discontinuity_indicator:c,random_access_indicator:r,elementary_stream_priority_indicator:g,pcr_flag:p,opcr_flag:h,splicing_point_flag:d,transport_private_data_flag:u,adaptation_field_extension_flag:f,pcr:n,opcr:a,splice_countdown:o,transport_private_data:l}};parseAudio=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error("invalid ts audio payload.");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{if(!this.audioConfig&&s.getUint8(e)===255){const g=s.getUint8(e+2),p=s.getUint8(e+3);let h,d;d=g>>2&15,h=(g&1)<<2|p>>6;const u=`mp4a.40.${h}`,U=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][d];this.audioConfig={kind:"audio",codec:u,sampleRate:U,numberOfChannels:h},this.on.config&&this.on.config(this.audioConfig)}const{dts:o=0,pts:l=0}=n,i=l-o,c=a.slice(7);return{kind:"audio",type:"key",dts:o,pts:l,cts:i,data:c}}};parseVideo=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error("invalid ts video payload.");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{const o=this.getNalus(a);if(!this.videoConfig){let h,d;if(h=o.find(f=>f.type===7)?.nalu.slice(4),d=o.find(f=>f.type===8)?.nalu.slice(4),h&&d){const u=I(h,d),{codec:f}=T(u);this.videoConfig={kind:"video",codec:f,description:u,sps:h,pps:d},this.on.config&&this.on.config(this.videoConfig)}}const l=[];let i="delta";for(const h of o){const{type:d,nalu:u}=h;switch(d){case 6:case 9:l.push(u);break;case 1:i="delta",l.push(u);break;case 5:i="key",l.push(u);break}}const c=C(l),{dts:r=0,pts:g=0}=n,p=g-r;return{kind:"video",type:i,dts:r,pts:g,cts:p,data:c,nalus:l}}};parsePtsDts(t,s){const e=t.getUint8(s),n=t.getUint8(s+1),a=t.getUint8(s+2),o=t.getUint8(s+3),l=t.getUint8(s+4),i=(BigInt(e)&0b00001110n)<<29n|(BigInt(n)&0b11111111n)<<22n|(BigInt(a)&0b11111110n)<<14n|(BigInt(o)&0b11111111n)<<7n|(BigInt(l)&0b11111110n)>>1n;return Number(i)/90}getNalus=t=>{const s=[];let e=0;for(;!(e+4>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}e+=3;let n=e;const a=t[e]&31;for(e+=1;!(e+1>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}break}let o=e-n;if(t[e-1]===0&&(o-=1),o!==0){const l=t.slice(n,n+o),i=M(l);s.push({type:a,nalu:i})}}return s}}const k=(y,t)=>y.getUint8(t)<<16|y.getUint8(t+1)<<8|y.getUint8(t+2);class L{audioConfig;videoConfig;header;textDecoder=new TextDecoder("utf-8");on={};constructor(){}parse=async t=>{let s=0;for(this.header||(this.parseHeader(t,s),s+=9);this.isSurplusTag(t,s)!==!1;){const n=this.parseTagHeader(t,s+4),{tagType:a,dataSize:o,timestamp:l}=n;if(a){const i=this.parseTagBody(a,t,s+4+11,o);switch(a){case"script":this.on.info&&this.on.info(i);break;case"audio":{const{accPacketType:c}=i;if(c===0){const{codec:r,sampleRate:g,channelConfiguration:p}=i;this.audioConfig={kind:"audio",codec:r,sampleRate:g,numberOfChannels:p},this.on.config&&this.on.config(this.audioConfig)}else{const{cts:r,data:g}=i,p="key",h=r===void 0?void 0:r+l;this.on.chunk&&this.on.chunk({kind:"audio",type:p,dts:l,pts:h,cts:r,data:g})}}break;case"video":{const{avcPacketType:c}=i;if(c===0){const{codec:r,sps:g,pps:p,data:h}=i;this.videoConfig={kind:"video",codec:r,description:h,sps:g,pps:p},this.on.config&&this.on.config(this.videoConfig)}else{const{frameType:r,cts:g,data:p,nalus:h}=i,d=r===1?"key":"delta",u=g===void 0?void 0:g+l;this.on.chunk&&this.on.chunk({kind:"video",type:d,dts:l,pts:u,cts:g,data:p,nalus:h})}}break}s=s+4+11+o}await new Promise(i=>setTimeout(()=>i(!0),8))}return s};parseHeader=(t,s)=>{let e,n,a,o;e=t.getUint8(s)<<16|t.getUint8(s+1)<<8|t.getUint8(s+2),n=t.getUint8(3);{const i=t.getUint8(0).toString(2).padStart(5,"0").split(""),[,,c,,r]=i;a={audio:r==="1",video:c==="1"}}o=t.getUint32(5),this.header={signature:e,version:n,flags:a,dataOffset:o}};isSurplusTag=(t,s)=>{let e=!0;const n=t.byteLength;if(s+4>n)e=!1;else if(s+4+11>n)e=!1;else{const a=k(t,s+4+1);s+4+11+a>n&&(e=!1)}return e};parseTagHeader=(t,s)=>{let e,n,a,o,l;{const i=t.getUint8(s);let c;switch(i){case 18:c="script";break;case 8:c="audio";break;case 9:c="video";break}e=c}return n=k(t,s+1),a=k(t,s+4),o=t.getUint8(s+7),l=k(t,s+8),{tagType:e,dataSize:n,timestamp:a,timestampExtended:o,streamID:l}};parseTagBody=(t,s,e,n)=>{let a;switch(t){case"script":a=this.parseMetaData(s,e);break;case"audio":a=this.parseAudio(s,e,n);break;case"video":a=this.parseVideo(s,e,n);break}return a};parseMetaData=(t,s)=>{let e=s;{if(t.getUint8(e)!==2)throw new Error("Invalid AMF type for onMetaData (expected 0x02)");e=e+1}const n=t.getUint16(e,!1);e=e+2;{const l=new Int8Array(t.buffer.slice(e,e+n));if((this.textDecoder?.decode(l)||"")!=="onMetaData")throw new Error("Expected \'onMetaData\' string");e=e+n}const a=this.getAmfType(t,e);return e=e+1,this.getAMFValue(t,e,a).value};parseAudio=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a>>2&3,i=a>>1&1,c=a&1;n=n+1;const r=t.getUint8(n);n=n+1;const g=e,p=new Uint8Array(t.buffer.slice(n,n+g));if(o===10&&r===0){const h=t.getUint8(n),d=t.getUint8(n+1),u=h>>3&31,f=(h&7)<<1|d>>7,U=d>>3&15,_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],b=`mp4a.40.${u}`,m=_[f];return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p,samplingFrequencyIndex:f,channelConfiguration:U,codec:b,sampleRate:m}}return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p}};parseVideo=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a&15;n=n+1;const i=t.getUint8(n);n=n+1;const c=k(t,n);n=n+3;const r=e-5,g=new Uint8Array(t.buffer.slice(n,n+r));switch(l){case 7:if(i===0){const p=T(g);return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,...p}}else if(i===1){const p=[],h=n+e-5;for(;!(n+4>h);){const d=t.getUint32(n,!1),u=new Uint8Array(t.buffer.slice(n,n+4+d));n+=4+d,p.push(u)}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,nalus:p}}break;default:throw new Error("Unsupported codecID")}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g}};getAmfType=(t,s)=>t.getUint8(s);getAMFName=(t,s,e)=>{const n=new Uint8Array(t.buffer.slice(s,s+e));return this.textDecoder?.decode(n)||""};getAMFValue=(t,s,e)=>{let n=s,a,o=0;switch(e){case 0:a=t.getFloat64(n,!1),o=8;break;case 1:a=!!t.getUint8(n),o=1;break;case 2:{a="";const i=t.getUint16(n,!1);n=n+2;const c=new Int8Array(t.buffer,n,i).filter(g=>g!==0);a=(this.textDecoder?.decode(c)||"").trim(),o=2+i}break;case 3:for(a={};n<t.byteLength;){const i=t.getUint16(n,!1);if(i===0)break;n=n+2;const c=this.getAMFName(t,n,i);n=n+i;const r=this.getAmfType(t,n);if(r===6)break;n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a[c]=g.value,o=2+i+1+g.length}break;case 8:{a={};const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=t.getUint16(n,!1);n=n+2;const g=this.getAMFName(t,n,r);n=n+r;const p=this.getAmfType(t,n);n=n+1;const h=this.getAMFValue(t,n,p);n=n+h.length,a[g]=h.value,o=2+r+1+h.length}}break;case 10:{a=[];const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=this.getAmfType(t,n);n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a.push(g.value),o=1+g.length}}break}return{amfType:e,length:o,value:a}}}class O{pattern;cacher=new P;isParseing=!1;offset=0;on={};parser;constructor(){}init=t=>{switch(this.destroy(),this.pattern=t,this.pattern){case"flv":this.parser=new L;break;case"hls":this.parser=new x;break;default:throw new Error("is error pattern.")}this.parser.on.debug=s=>this.on.debug&&this.on.debug(s),this.parser.on.info=s=>this.on.info&&this.on.info(s),this.parser.on.config=s=>this.on.config&&this.on.config(s),this.parser.on.chunk=s=>{this.cacher.pushChunk(s),this.on.chunk&&this.on.chunk(s)}};push=t=>{this.cacher.push(t),this.isParseing===!1&&this.parse()};destroy=()=>{this.cacher.destroy(),this.isParseing=!1,this.offset=0};parse=async()=>{try{if(this.isParseing=!0,!this.pattern)throw new Error("You need to set the pattern.");if(!this.parser)throw new Error("You need to init parser.");for(;;){const t=this.cacher.next(this.offset);if(this.offset=0,!t)break;this.offset=await this.parser.parse(t)}this.isParseing=!1}catch{this.destroy()}}}const A=new O;A.on.info=y=>postMessage({action:"on.info",data:y}),A.on.config=y=>postMessage({action:"on.config",data:y}),A.on.chunk=y=>postMessage({action:"on.chunk",data:y}),A.on.debug=y=>postMessage({action:"on.debug",data:y}),onmessage=y=>{const{action:t,data:s}=y.data,e=A[t];e&&e(s)}})();\n', _ = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", D], { type: "text/javascript;charset=utf-8" });
9
9
  function L(h) {
10
- let n;
10
+ let o;
11
11
  try {
12
- if (n = _ && (self.URL || self.webkitURL).createObjectURL(_), !n) throw "";
13
- const a = new Worker(n, {
12
+ if (o = _ && (self.URL || self.webkitURL).createObjectURL(_), !o) throw "";
13
+ const a = new Worker(o, {
14
14
  name: h == null ? void 0 : h.name
15
15
  });
16
16
  return a.addEventListener("error", () => {
17
- (self.URL || self.webkitURL).revokeObjectURL(n);
17
+ (self.URL || self.webkitURL).revokeObjectURL(o);
18
18
  }), a;
19
19
  } catch {
20
20
  return new Worker(
@@ -29,13 +29,13 @@ class V {
29
29
  constructor() {
30
30
  m(this, "worker", new L());
31
31
  m(this, "on", {});
32
- m(this, "init", (n) => this.worker.postMessage({ action: "init", data: n }));
33
- m(this, "push", (n) => this.worker.postMessage({ action: "push", data: n }));
32
+ m(this, "init", (o) => this.worker.postMessage({ action: "init", data: o }));
33
+ m(this, "push", (o) => this.worker.postMessage({ action: "push", data: o }));
34
34
  m(this, "destroy", () => {
35
35
  this.worker.postMessage({ action: "destroy", data: {} }), this.worker.terminate();
36
36
  });
37
- this.worker.onmessage = (n) => {
38
- const { action: a, data: u } = n.data;
37
+ this.worker.onmessage = (o) => {
38
+ const { action: a, data: u } = o.data;
39
39
  switch (a) {
40
40
  case "on.info":
41
41
  this.on.info && this.on.info(u);
@@ -53,17 +53,17 @@ class V {
53
53
  };
54
54
  }
55
55
  }
56
- const S = `(function(){"use strict";class a{pattern="flv";audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];currentChunk;isProcessing=!1;decodeTimer=0;frameTrack=!1;isFrameTrack=!1;fameTrackOption={flv:[20,50],hls:[200,300],dash:[50,100],rtmp:[50,100]};decodingSpeed=16;fps=0;firstVideoChunkTimestamp;secondVideoChunkTimestamp;decodingSpeedRatio=1;maxDecodingSpeedRatio=2;frameStartTime;lastRenderTime;nextRenderTime;on={audio:{},video:{}};constructor(){}init=e=>{this.destroy(),this.pattern=e,this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()};initAudio=e=>{this.audio.destroy(),this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:i=>{const t=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:i,playbackRate:t})},error:i=>{this.on.audio.error&&this.on.audio.error(i)}}),this.audioDecoder.configure(this.audioDecoderConfig)};initVideo=e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:async i=>{this.frameStartTime||(this.frameStartTime=i.timestamp);const t=i.timestamp-this.frameStartTime+this.baseTime*1e3,s=await createImageBitmap(i);i.close(),s.width>0&&s.height>0?(this.on.video.decode&&this.on.video.decode({timestamp:t,bitmap:s}),this.currentChunk&&this.currentChunk.kind==="video"&&this.currentChunk.nalus&&this.on.nalus&&this.on.nalus(this.currentChunk.nalus)):s.close()},error:i=>{this.on.video.error&&this.on.video.error(i)}}),this.videoDecoder.configure(this.videoDecoderConfig)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};push=e=>{this.pendingChunks.push(e)};destroy=()=>{this.audio.destroy(),this.video.destroy(),clearInterval(this.decodeTimer)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio;const i=this.baseTime+performance.now();if(this.lastRenderTime||(this.lastRenderTime=i),this.fps=Math.round(1e3/(i-this.lastRenderTime)),this.lastRenderTime=i,this.nextRenderTime){const t=this.lastRenderTime-this.nextRenderTime;e-=t}this.nextRenderTime=this.lastRenderTime+e,this.decodeTimer=setTimeout(()=>{this.decode(),this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;;){this.currentChunk=this.pendingChunks.shift();const e=this.pendingChunks.length;if(this.frameTrack){const[s,n]=this.fameTrackOption[this.pattern];if(e<=s&&(this.isFrameTrack=!1),e>=n&&(this.isFrameTrack=!0),this.isFrameTrack){const r=Math.min(1+(e-s)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(r.toFixed(1))}else this.decodingSpeedRatio=1}if(this.on.debug){const{decodingSpeed:s,decodingSpeedRatio:n,fps:r}=this;this.on.debug({decodingSpeed:s,decodingSpeedRatio:n,fps:r,cacheLength:e})}if(!this.currentChunk)break;const{kind:i,init:t}=this.currentChunk;switch(i){case"audio":this.decodeAudio(t);break;case"video":this.decodeVideo(t);break}if(i==="video")break}this.isProcessing=!1}};decodeAudio=e=>{if(!this.audioDecoder)return;const i=new EncodedAudioChunk(e);this.audioDecoder.decode(i)};decodeVideo=e=>{if(this.videoDecoder&&(e.type==="key"&&(this.hasKeyFrame=!0),this.firstVideoChunkTimestamp?this.secondVideoChunkTimestamp||(this.secondVideoChunkTimestamp=e.timestamp,this.decodingSpeed=(this.secondVideoChunkTimestamp-this.firstVideoChunkTimestamp)/1e3):this.firstVideoChunkTimestamp=e.timestamp,this.hasKeyFrame)){const i=new EncodedVideoChunk(e);this.videoDecoder.decode(i)}};audio={flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}}const d=new a;d.on.audio.decode=o=>postMessage({action:"on.audio.decode",data:o}),d.on.audio.error=o=>postMessage({action:"on.audio.error",data:o}),d.on.video.decode=o=>postMessage({action:"on.video.decode",data:o}),d.on.video.error=o=>postMessage({action:"on.video.error",data:o}),d.on.nalus=o=>postMessage({action:"on.nalus",data:o}),d.on.debug=o=>postMessage({action:"on.debug",data:o}),onmessage=o=>{const{action:e,data:i}=o.data,t=d[e];t&&t(i)}})();
56
+ const S = `(function(){"use strict";class a{pattern="flv";audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];currentChunk;isProcessing=!1;decodeTimer=0;frameTrack=!1;isFrameTrack=!1;fameTrackOption={flv:[30,50],hls:[200,300],dash:[50,100],rtmp:[50,100]};decodingSpeedRatio=1;maxDecodingSpeedRatio=2;decodingSpeed=16;fps=0;firstVideoChunkTimestamp;secondVideoChunkTimestamp;frameStartTime;lastRenderTime;nextRenderTime;on={audio:{},video:{}};constructor(){}init=e=>{this.destroy(),this.pattern=e,this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()};initAudio=e=>{this.audio.destroy(),this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:i=>{const o=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:i,playbackRate:o})},error:i=>{this.on.audio.error&&this.on.audio.error(i)}}),this.audioDecoder.configure(this.audioDecoderConfig)};initVideo=e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:async i=>{this.frameStartTime||(this.frameStartTime=i.timestamp);const o=i.timestamp-this.frameStartTime+this.baseTime*1e3,s=await createImageBitmap(i);i.close(),s.width>0&&s.height>0?(this.on.video.decode&&this.on.video.decode({timestamp:o,bitmap:s}),this.currentChunk&&this.currentChunk.kind==="video"&&this.currentChunk.nalus&&this.on.nalus&&this.on.nalus(this.currentChunk.nalus)):s.close()},error:i=>{this.on.video.error&&this.on.video.error(i)}}),this.videoDecoder.configure(this.videoDecoderConfig)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};push=e=>{this.pendingChunks.push(e)};destroy=()=>{this.audio.destroy(),this.video.destroy(),this.pendingChunks=[],this.firstVideoChunkTimestamp=void 0,this.secondVideoChunkTimestamp=void 0,this.frameStartTime=void 0,this.lastRenderTime=void 0,this.nextRenderTime=void 0,clearInterval(this.decodeTimer)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio;const i=this.baseTime+performance.now();if(this.lastRenderTime||(this.lastRenderTime=i),this.fps=Math.round(1e3/(i-this.lastRenderTime)),this.lastRenderTime=i,this.nextRenderTime){const o=this.lastRenderTime-this.nextRenderTime;e-=o}this.nextRenderTime=this.lastRenderTime+e,this.decodeTimer=setTimeout(()=>{this.decode(),this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;;){this.currentChunk=this.pendingChunks.shift();const e=this.pendingChunks.length;if(this.frameTrack){const[s,n]=this.fameTrackOption[this.pattern];if(e<=s&&(this.isFrameTrack=!1),e>=n&&(this.isFrameTrack=!0),this.isFrameTrack){const r=Math.min(1+(e-s)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(r.toFixed(1))}else this.decodingSpeedRatio=1}if(this.on.debug){const{decodingSpeed:s,decodingSpeedRatio:n,fps:r}=this;this.on.debug({decodingSpeed:s,decodingSpeedRatio:n,fps:r,cacheLength:e})}if(!this.currentChunk)break;const{kind:i,init:o}=this.currentChunk;switch(i){case"audio":this.decodeAudio(o);break;case"video":this.decodeVideo(o);break}if(i==="video")break}this.isProcessing=!1}};decodeAudio=e=>{if(!this.audioDecoder)return;const i=new EncodedAudioChunk(e);this.audioDecoder.decode(i)};decodeVideo=e=>{if(this.videoDecoder&&(e.type==="key"&&(this.hasKeyFrame=!0),this.firstVideoChunkTimestamp?this.secondVideoChunkTimestamp||(this.secondVideoChunkTimestamp=e.timestamp,this.decodingSpeed=(this.secondVideoChunkTimestamp-this.firstVideoChunkTimestamp)/1e3):this.firstVideoChunkTimestamp=e.timestamp,this.hasKeyFrame)){const i=new EncodedVideoChunk(e);this.videoDecoder.decode(i)}};audio={flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}}const d=new a;d.on.audio.decode=t=>postMessage({action:"on.audio.decode",data:t}),d.on.audio.error=t=>postMessage({action:"on.audio.error",data:t}),d.on.video.decode=t=>postMessage({action:"on.video.decode",data:t}),d.on.video.error=t=>postMessage({action:"on.video.error",data:t}),d.on.nalus=t=>postMessage({action:"on.nalus",data:t}),d.on.debug=t=>postMessage({action:"on.debug",data:t}),onmessage=t=>{const{action:e,data:i}=t.data,o=d[e];o&&o(i)}})();
57
57
  `, C = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", S], { type: "text/javascript;charset=utf-8" });
58
58
  function F(h) {
59
- let n;
59
+ let o;
60
60
  try {
61
- if (n = C && (self.URL || self.webkitURL).createObjectURL(C), !n) throw "";
62
- const a = new Worker(n, {
61
+ if (o = C && (self.URL || self.webkitURL).createObjectURL(C), !o) throw "";
62
+ const a = new Worker(o, {
63
63
  name: h == null ? void 0 : h.name
64
64
  });
65
65
  return a.addEventListener("error", () => {
66
- (self.URL || self.webkitURL).revokeObjectURL(n);
66
+ (self.URL || self.webkitURL).revokeObjectURL(o);
67
67
  }), a;
68
68
  } catch {
69
69
  return new Worker(
@@ -78,16 +78,16 @@ class N {
78
78
  constructor() {
79
79
  m(this, "worker", new F());
80
80
  m(this, "on", { audio: {}, video: {} });
81
- m(this, "init", (n) => this.worker.postMessage({ action: "init", data: n }));
82
- m(this, "initAudio", (n) => this.worker.postMessage({ action: "initAudio", data: n }));
83
- m(this, "initVideo", (n) => this.worker.postMessage({ action: "initVideo", data: n }));
84
- m(this, "push", (n) => this.worker.postMessage({ action: "push", data: n }));
85
- m(this, "setFrameTrack", (n) => this.worker.postMessage({ action: "setFrameTrack", data: n }));
81
+ m(this, "init", (o) => this.worker.postMessage({ action: "init", data: o }));
82
+ m(this, "initAudio", (o) => this.worker.postMessage({ action: "initAudio", data: o }));
83
+ m(this, "initVideo", (o) => this.worker.postMessage({ action: "initVideo", data: o }));
84
+ m(this, "push", (o) => this.worker.postMessage({ action: "push", data: o }));
85
+ m(this, "setFrameTrack", (o) => this.worker.postMessage({ action: "setFrameTrack", data: o }));
86
86
  m(this, "destroy", () => {
87
87
  this.worker.postMessage({ action: "destroy" }), this.worker.terminate();
88
88
  });
89
- this.worker.onmessage = (n) => {
90
- const { action: a, data: u } = n.data;
89
+ this.worker.onmessage = (o) => {
90
+ const { action: a, data: u } = o.data;
91
91
  switch (a) {
92
92
  case "on.audio.decode":
93
93
  this.on.audio.decode && this.on.audio.decode(u);
@@ -111,9 +111,9 @@ class N {
111
111
  };
112
112
  }
113
113
  }
114
- var B = Object.defineProperty, G = (h, n, a) => n in h ? B(h, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : h[n] = a, y = (h, n, a) => G(h, typeof n != "symbol" ? n + "" : n, a);
114
+ var B = Object.defineProperty, G = (h, o, a) => o in h ? B(h, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : h[o] = a, y = (h, o, a) => G(h, typeof o != "symbol" ? o + "" : o, a);
115
115
  class O {
116
- constructor(n, a) {
116
+ constructor(o, a) {
117
117
  y(this, "inputStream", new MediaStream()), y(this, "outputStream", new MediaStream()), y(this, "inputGain", 1), y(this, "enhanceGain", 1), y(this, "bgsGain", 1), y(this, "bgmGain", 1), y(this, "outputGain", 1), y(this, "mixAudioMap", /* @__PURE__ */ new Map()), y(this, "audioContext", new AudioContext()), y(this, "sourceNode"), y(this, "inputGainNode"), y(this, "enhanceGainNode"), y(this, "bgsGainNode"), y(this, "bgmGainNode"), y(this, "analyserNode"), y(this, "analyserArrayData"), y(this, "outputGainNode"), y(this, "destinationNode"), y(this, "filterStream", (u) => u), y(this, "stop", () => {
118
118
  {
119
119
  const u = this.inputStream.getTracks();
@@ -135,11 +135,11 @@ class O {
135
135
  }), y(this, "getVolume", () => {
136
136
  const { analyserNode: u, analyserArrayData: r } = this;
137
137
  u.getByteFrequencyData(r);
138
- let o = 0;
138
+ let n = 0;
139
139
  for (let i = 0; i < r.length; i++)
140
- o += r[i];
141
- return Math.ceil(o / r.length);
142
- }), y(this, "mixAudio", (u, r = "bgm") => new Promise(async (o, i) => {
140
+ n += r[i];
141
+ return Math.ceil(n / r.length);
142
+ }), y(this, "mixAudio", (u, r = "bgm") => new Promise(async (n, i) => {
143
143
  try {
144
144
  {
145
145
  const s = this.mixAudioMap.get(r);
@@ -147,7 +147,7 @@ class O {
147
147
  }
148
148
  const t = r === "bgs" ? this.bgsGainNode : this.bgmGainNode, e = this.audioContext.createBufferSource();
149
149
  this.mixAudioMap.set(r, e), e.buffer = u, e.connect(t), e.onended = () => {
150
- e.disconnect(t), this.mixAudioMap.delete(r), o(!0);
150
+ e.disconnect(t), this.mixAudioMap.delete(r), n(!0);
151
151
  }, e.start(0);
152
152
  } catch (t) {
153
153
  i(t);
@@ -156,22 +156,22 @@ class O {
156
156
  const r = this.mixAudioMap.get(u);
157
157
  r == null || r.stop();
158
158
  }), y(this, "changeMix", (u, r) => {
159
- const o = u === "bgs" ? this.bgsGainNode : this.bgmGainNode;
160
- r ? o.connect(this.destinationNode) : o.disconnect(this.destinationNode);
161
- }), a && (this.audioContext = a), this.inputStream = n, this.sourceNode = this.audioContext.createMediaStreamSource(this.inputStream), this.inputGainNode = this.audioContext.createGain(), this.inputGainNode.gain.setValueAtTime(this.inputGain, this.audioContext.currentTime), this.enhanceGainNode = this.audioContext.createGain(), this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain, this.audioContext.currentTime), this.bgsGainNode = this.audioContext.createGain(), this.bgsGainNode.gain.setValueAtTime(this.bgsGain, this.audioContext.currentTime), this.bgmGainNode = this.audioContext.createGain(), this.bgmGainNode.gain.setValueAtTime(this.bgmGain, this.audioContext.currentTime), this.analyserNode = this.audioContext.createAnalyser(), this.analyserNode.fftSize = 512, this.analyserArrayData = new Uint8Array(this.analyserNode.frequencyBinCount), this.outputGainNode = this.audioContext.createGain(), this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime), this.destinationNode = this.audioContext.createMediaStreamDestination(), this.outputStream = this.destinationNode.stream;
159
+ const n = u === "bgs" ? this.bgsGainNode : this.bgmGainNode;
160
+ r ? n.connect(this.destinationNode) : n.disconnect(this.destinationNode);
161
+ }), a && (this.audioContext = a), this.inputStream = o, this.sourceNode = this.audioContext.createMediaStreamSource(this.inputStream), this.inputGainNode = this.audioContext.createGain(), this.inputGainNode.gain.setValueAtTime(this.inputGain, this.audioContext.currentTime), this.enhanceGainNode = this.audioContext.createGain(), this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain, this.audioContext.currentTime), this.bgsGainNode = this.audioContext.createGain(), this.bgsGainNode.gain.setValueAtTime(this.bgsGain, this.audioContext.currentTime), this.bgmGainNode = this.audioContext.createGain(), this.bgmGainNode.gain.setValueAtTime(this.bgmGain, this.audioContext.currentTime), this.analyserNode = this.audioContext.createAnalyser(), this.analyserNode.fftSize = 512, this.analyserArrayData = new Uint8Array(this.analyserNode.frequencyBinCount), this.outputGainNode = this.audioContext.createGain(), this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime), this.destinationNode = this.audioContext.createMediaStreamDestination(), this.outputStream = this.destinationNode.stream;
162
162
  {
163
- const { sourceNode: u, inputGainNode: r, enhanceGainNode: o, bgsGainNode: i, bgmGainNode: t, analyserNode: e, outputGainNode: s, destinationNode: l } = this;
164
- u.connect(r), r.connect(o), o.connect(e), i.connect(e), t.connect(e), o.connect(l), i.connect(l), t.connect(l), e.connect(s), s.connect(this.audioContext.destination);
163
+ const { sourceNode: u, inputGainNode: r, enhanceGainNode: n, bgsGainNode: i, bgmGainNode: t, analyserNode: e, outputGainNode: s, destinationNode: l } = this;
164
+ u.connect(r), r.connect(n), n.connect(e), i.connect(e), t.connect(e), n.connect(l), i.connect(l), t.connect(l), e.connect(s), s.connect(this.audioContext.destination);
165
165
  }
166
166
  this.setMute(!0), this.audioContext.resume();
167
167
  }
168
168
  }
169
- const E = async (h, n) => {
169
+ const E = async (h, o) => {
170
170
  try {
171
- const { format: a, numberOfChannels: u, numberOfFrames: r, sampleRate: o } = n, i = h.createBuffer(u, r, o);
171
+ const { format: a, numberOfChannels: u, numberOfFrames: r, sampleRate: n } = o, i = h.createBuffer(u, r, n);
172
172
  for (let t = 0; t < u; t++) {
173
- const e = n.allocationSize({ planeIndex: t }), s = new Uint8Array(e);
174
- n.copyTo(s, { planeIndex: t });
173
+ const e = o.allocationSize({ planeIndex: t }), s = new Uint8Array(e);
174
+ o.copyTo(s, { planeIndex: t });
175
175
  const l = new DataView(s.buffer), c = i.getChannelData(t);
176
176
  for (let d = 0; d < r; d++) {
177
177
  let p;
@@ -210,52 +210,52 @@ class W {
210
210
  m(this, "stream", new MediaStream());
211
211
  m(this, "nextStartTime", 0);
212
212
  m(this, "pendingSources", []);
213
- m(this, "init", (n) => {
214
- n || (n = new (window.AudioContext || window.webkitAudioContext)()), this.audioContext = n, this.destination = this.audioContext.createMediaStreamDestination(), this.stream = new MediaStream(), this.stream.addTrack(this.destination.stream.getAudioTracks()[0]), this.prAudioStream = new O(this.stream, this.audioContext), this.nextStartTime = 0, this.pendingSources = [];
213
+ m(this, "init", (o) => {
214
+ o || (o = new (window.AudioContext || window.webkitAudioContext)()), this.audioContext = o, this.destination = this.audioContext.createMediaStreamDestination(), this.stream = new MediaStream(), this.stream.addTrack(this.destination.stream.getAudioTracks()[0]), this.prAudioStream = new O(this.stream, this.audioContext), this.nextStartTime = 0, this.pendingSources = [];
215
215
  });
216
216
  m(this, "getStream", () => {
217
- var n;
218
- return (n = this.prAudioStream) == null ? void 0 : n.getStream();
217
+ var o;
218
+ return (o = this.prAudioStream) == null ? void 0 : o.getStream();
219
219
  });
220
220
  }
221
- async push(n) {
222
- const { audioData: a, playbackRate: u = 1 } = n;
221
+ async push(o) {
222
+ const { audioData: a, playbackRate: u = 1 } = o;
223
223
  try {
224
224
  if (!this.audioContext || !this.destination) return;
225
225
  let r = await E(this.audioContext, a);
226
226
  if (!r) return;
227
- const o = this.audioContext.createBufferSource();
228
- o.buffer = r, o.playbackRate.value = u;
227
+ const n = this.audioContext.createBufferSource();
228
+ n.buffer = r, n.playbackRate.value = u;
229
229
  const i = -1200 * Math.log2(u);
230
- o.detune.value = i, o.connect(this.destination);
230
+ n.detune.value = i, n.connect(this.destination);
231
231
  const t = Math.max(this.nextStartTime, this.audioContext.currentTime), e = r.duration / u;
232
- this.nextStartTime = t + e, o.start(t), this.pendingSources.push(o), o.onended = () => {
233
- this.pendingSources = this.pendingSources.filter((s) => s !== o);
232
+ this.nextStartTime = t + e, n.start(t), this.pendingSources.push(n), n.onended = () => {
233
+ this.pendingSources = this.pendingSources.filter((s) => s !== n);
234
234
  }, this.audioContext.state === "suspended" && await this.audioContext.resume();
235
235
  } finally {
236
236
  a.close();
237
237
  }
238
238
  }
239
239
  destroy() {
240
- var n, a;
241
- (n = this.audioContext) == null || n.close(), this.audioContext = void 0, this.destination = void 0, this.nextStartTime = 0, (a = this.prAudioStream) == null || a.stop(), this.pendingSources.forEach((u) => u.stop()), this.pendingSources = [];
240
+ var o, a;
241
+ (o = this.audioContext) == null || o.close(), this.audioContext = void 0, this.destination = void 0, this.nextStartTime = 0, (a = this.prAudioStream) == null || a.stop(), this.pendingSources.forEach((u) => u.stop()), this.pendingSources = [];
242
242
  }
243
243
  }
244
- const M = `(function(){"use strict";class o{writable;writer;cutOption;pause=!1;constructor(){}init=({writable:t})=>{this.destroy(),this.writable=t,this.writer=this.writable.getWriter()};push=async t=>{if(this.pause)return;const{timestamp:s}=t;let{bitmap:i}=t;if(this.cutOption){const{sx:n=0,sy:c=0,sw:h=i.width,sh:u=i.height}=this.cutOption;i=await createImageBitmap(i,n,c,h,u)}const r=new VideoFrame(i,{timestamp:s});this.cutOption&&i.close(),this.writer.write(r),r.close()};setCut=t=>{this.cutOption=t};setPause=t=>{this.pause=t};destroy=()=>{this.writable=void 0,this.writer=void 0,this.cutOption=void 0}}const a=new o;onmessage=e=>{const{action:t,data:s}=e.data,i=a[t];i&&i(s)}})();
245
- `, A = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", M], { type: "text/javascript;charset=utf-8" });
244
+ const R = `(function(){"use strict";class o{writable;writer;cutOption;pause=!1;constructor(){}init=({writable:t})=>{this.destroy(),this.writable=t,this.writer=this.writable.getWriter()};push=async t=>{if(this.pause)return;const{timestamp:s}=t;let{bitmap:i}=t;if(this.cutOption){const{sx:n=0,sy:c=0,sw:h=i.width,sh:u=i.height}=this.cutOption;i=await createImageBitmap(i,n,c,h,u)}const r=new VideoFrame(i,{timestamp:s});this.cutOption&&i.close(),this.writer.write(r),r.close()};setCut=t=>{this.cutOption=t};setPause=t=>{this.pause=t};destroy=()=>{this.writable=void 0,this.writer=void 0,this.cutOption=void 0}}const a=new o;onmessage=e=>{const{action:t,data:s}=e.data,i=a[t];i&&i(s)}})();
245
+ `, v = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", R], { type: "text/javascript;charset=utf-8" });
246
246
  function j(h) {
247
- let n;
247
+ let o;
248
248
  try {
249
- if (n = A && (self.URL || self.webkitURL).createObjectURL(A), !n) throw "";
250
- const a = new Worker(n, {
249
+ if (o = v && (self.URL || self.webkitURL).createObjectURL(v), !o) throw "";
250
+ const a = new Worker(o, {
251
251
  name: h == null ? void 0 : h.name
252
252
  });
253
253
  return a.addEventListener("error", () => {
254
- (self.URL || self.webkitURL).revokeObjectURL(n);
254
+ (self.URL || self.webkitURL).revokeObjectURL(o);
255
255
  }), a;
256
256
  } catch {
257
257
  return new Worker(
258
- "data:text/javascript;charset=utf-8," + encodeURIComponent(M),
258
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(R),
259
259
  {
260
260
  name: h == null ? void 0 : h.name
261
261
  }
@@ -265,26 +265,26 @@ function j(h) {
265
265
  class z {
266
266
  constructor() {
267
267
  m(this, "worker", new j());
268
- m(this, "init", ({ writable: n }) => this.worker.postMessage({ action: "init", data: { writable: n } }, [n]));
269
- m(this, "push", (n) => this.worker.postMessage({ action: "push", data: n }));
270
- m(this, "setCut", async (n) => this.worker.postMessage({ action: "setCut", data: n }));
271
- m(this, "setPause", (n) => this.worker.postMessage({ action: "setPause", data: n }));
268
+ m(this, "init", ({ writable: o }) => this.worker.postMessage({ action: "init", data: { writable: o } }, [o]));
269
+ m(this, "push", (o) => this.worker.postMessage({ action: "push", data: o }));
270
+ m(this, "setCut", async (o) => this.worker.postMessage({ action: "setCut", data: o }));
271
+ m(this, "setPause", (o) => this.worker.postMessage({ action: "setPause", data: o }));
272
272
  m(this, "destroy", () => {
273
273
  this.worker.postMessage({ action: "destroy", data: {} }), this.worker.terminate();
274
274
  });
275
275
  }
276
276
  }
277
277
  const q = (h) => {
278
- const n = h.toLowerCase();
279
- return n.includes(".m3u8") || n.includes("hls") || n.includes("master.m3u8") || n.match(/index\d*\.m3u8/) ? "hls" : n.includes(".mpd") || n.includes("dash") ? "dash" : n.startsWith("rtmp://") || n.startsWith("rtmps://") ? "rtmp" : n.includes(".flv") || n.includes("flv") && !n.includes("flash") ? "flv" : "unknown";
280
- }, R = (h) => {
281
- const n = (h == null ? void 0 : h.getTracks()) || [];
282
- for (const a of n)
278
+ const o = h.toLowerCase();
279
+ return o.includes(".m3u8") || o.includes("hls") || o.includes("master.m3u8") || o.match(/index\d*\.m3u8/) ? "hls" : o.includes(".mpd") || o.includes("dash") ? "dash" : o.startsWith("rtmp://") || o.startsWith("rtmps://") ? "rtmp" : o.includes(".flv") || o.includes("flv") && !o.includes("flash") ? "flv" : "unknown";
280
+ }, M = (h) => {
281
+ const o = (h == null ? void 0 : h.getTracks()) || [];
282
+ for (const a of o)
283
283
  a.stop();
284
- }, x = () => {
285
- const h = new MediaStreamTrackGenerator({ kind: "video" }), n = new MediaStream([h]), a = new z();
286
- return a.init({ writable: h.writable }), { worker: a, stream: n, destroy: () => {
287
- a.destroy(), R(n);
284
+ }, A = () => {
285
+ const h = new MediaStreamTrackGenerator({ kind: "video" }), o = new MediaStream([h]), a = new z();
286
+ return a.init({ writable: h.writable }), { worker: a, stream: o, destroy: () => {
287
+ a.destroy(), M(o);
288
288
  } };
289
289
  };
290
290
  class $ {
@@ -298,48 +298,48 @@ class $ {
298
298
  * @param timeout 超时时间 ms
299
299
  * @returns
300
300
  */
301
- m(this, "add", (n, a = () => !1, u = 0) => new Promise((r) => {
301
+ m(this, "add", (o, a = () => !1, u = 0) => new Promise((r) => {
302
302
  var t, e;
303
303
  if (a()) return r(!0);
304
- this.resolvesMap.has(n) || this.resolvesMap.set(n, /* @__PURE__ */ new Map()), this.index++;
305
- const o = `${this.index}`;
304
+ this.resolvesMap.has(o) || this.resolvesMap.set(o, /* @__PURE__ */ new Map()), this.index++;
305
+ const n = `${this.index}`;
306
306
  if (u = Math.max(0, u), u === 0) {
307
- (t = this.resolvesMap.get(n)) == null || t.set(o, { resolve: r, timer: 0 });
307
+ (t = this.resolvesMap.get(o)) == null || t.set(n, { resolve: r, timer: 0 });
308
308
  return;
309
309
  }
310
310
  const i = window.setTimeout(() => {
311
- this.emit(n);
311
+ this.emit(o);
312
312
  }, u);
313
- (e = this.resolvesMap.get(n)) == null || e.set(o, { resolve: r, timer: i });
313
+ (e = this.resolvesMap.get(o)) == null || e.set(n, { resolve: r, timer: i });
314
314
  }));
315
- m(this, "emit", async (n) => {
316
- const a = this.resolvesMap.get(n);
315
+ m(this, "emit", async (o) => {
316
+ const a = this.resolvesMap.get(o);
317
317
  if (!a) return;
318
318
  const u = [...a.keys()];
319
319
  for (const r of u) {
320
- const o = a.get(r);
321
- o && (clearTimeout(o.timer), o.resolve(), a.delete(r));
320
+ const n = a.get(r);
321
+ n && (clearTimeout(n.timer), n.resolve(), a.delete(r));
322
322
  }
323
323
  });
324
324
  }
325
325
  }
326
326
  const Y = (h) => {
327
- const n = new DataView(h.buffer);
328
- let a = 0, u, r, o;
329
- u = n.getUint32(a, !1), a += 4;
327
+ const o = new DataView(h.buffer);
328
+ let a = 0, u, r, n;
329
+ u = o.getUint32(a, !1), a += 4;
330
330
  {
331
- const i = n.getUint8(a), t = i >> 7 & 1, e = i >> 5 & 3, s = i & 31;
331
+ const i = o.getUint8(a), t = i >> 7 & 1, e = i >> 5 & 3, s = i & 31;
332
332
  r = { forbidden_zero_bit: t, nal_ref_idc: e, nal_unit_type: s }, a += 1;
333
333
  }
334
334
  {
335
335
  const i = u - 1;
336
- o = new Uint8Array(n.buffer.slice(a, a + i));
336
+ n = new Uint8Array(o.buffer.slice(a, a + i));
337
337
  }
338
- return { size: u, header: r, data: o };
338
+ return { size: u, header: r, data: n };
339
339
  };
340
340
  var P, U;
341
- class v {
342
- constructor(n = {}) {
341
+ class x {
342
+ constructor(o = {}) {
343
343
  J(this, P, {
344
344
  timeout: 5 * 1e3,
345
345
  check: !1
@@ -350,31 +350,31 @@ class v {
350
350
  * @param input string | URL | Request
351
351
  * @param init RequestInit
352
352
  */
353
- m(this, "check", (n, a) => new Promise(async (u, r) => {
353
+ m(this, "check", (o, a) => new Promise(async (u, r) => {
354
354
  var i;
355
355
  this.stop(), H(this, U, new AbortController());
356
- const o = window.setTimeout(() => {
356
+ const n = window.setTimeout(() => {
357
357
  var t;
358
358
  (t = I(this, U)) == null || t.abort("Timeout."), r({ status: "timeout", reason: "" });
359
359
  }, I(this, P).timeout);
360
360
  try {
361
- const t = await fetch(n, { ...a, method: "HEAD", signal: (i = I(this, U)) == null ? void 0 : i.signal });
361
+ const t = await fetch(o, { ...a, method: "HEAD", signal: (i = I(this, U)) == null ? void 0 : i.signal });
362
362
  t.status === 200 ? u({ status: "successed", reason: "" }) : r({ status: "failed", reason: `${t.status}` });
363
363
  } catch (t) {
364
364
  r({ status: "error", reason: t.message });
365
365
  }
366
- clearTimeout(o);
366
+ clearTimeout(n);
367
367
  }));
368
368
  /**
369
369
  *
370
370
  * @param input string | URL | Request
371
371
  * @param init RequestInit
372
372
  */
373
- m(this, "request", async (n, a) => new Promise(async (u, r) => {
374
- var o;
373
+ m(this, "request", async (o, a) => new Promise(async (u, r) => {
374
+ var n;
375
375
  try {
376
- I(this, P).check && await this.check(n, a), H(this, U, new AbortController());
377
- const i = await fetch(n, { ...a, signal: (o = I(this, U)) == null ? void 0 : o.signal });
376
+ I(this, P).check && await this.check(o, a), H(this, U, new AbortController());
377
+ const i = await fetch(o, { ...a, signal: (n = I(this, U)) == null ? void 0 : n.signal });
378
378
  u(i);
379
379
  } catch (i) {
380
380
  this.stop(), r(i);
@@ -384,20 +384,20 @@ class v {
384
384
  * stop
385
385
  */
386
386
  m(this, "stop", () => {
387
- var n;
388
- ((n = I(this, U)) == null ? void 0 : n.signal.aborted) === !1 && I(this, U).abort("Actively stop.");
387
+ var o;
388
+ ((o = I(this, U)) == null ? void 0 : o.signal.aborted) === !1 && I(this, U).abort("Actively stop.");
389
389
  });
390
- H(this, P, { ...I(this, P), ...n });
390
+ H(this, P, { ...I(this, P), ...o });
391
391
  }
392
392
  }
393
393
  P = new WeakMap(), U = new WeakMap();
394
394
  class et {
395
- constructor(n = {}) {
395
+ constructor(o = {}) {
396
396
  m(this, "option", {
397
397
  debug: !1,
398
398
  frameTrack: !1
399
399
  });
400
- m(this, "prFetch", new v());
400
+ m(this, "prFetch", new x());
401
401
  m(this, "prResolves", new $());
402
402
  m(this, "url", "");
403
403
  m(this, "demuxerWorker");
@@ -413,9 +413,9 @@ class et {
413
413
  * 开始播放
414
414
  * @param url : string
415
415
  */
416
- m(this, "start", async (n) => {
417
- this.stop(), this.url = n;
418
- const a = q(n);
416
+ m(this, "start", async (o) => {
417
+ this.stop(), this.url = o;
418
+ const a = q(o);
419
419
  if (a === "unknown") throw new Error("This address cannot be parsed.");
420
420
  switch (this.init(a), a) {
421
421
  case "flv":
@@ -430,17 +430,17 @@ class et {
430
430
  * 停止
431
431
  */
432
432
  m(this, "stop", async () => {
433
- var a, u, r, o, i;
433
+ var a, u, r, n, i;
434
434
  try {
435
435
  clearInterval(this.hls.getSegmentsTimer), this.prFetch.stop();
436
436
  } catch (t) {
437
437
  console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: error", t);
438
438
  }
439
439
  (a = this.demuxerWorker) == null || a.destroy(), (u = this.decoderWorker) == null || u.destroy(), (r = this.renderWorker) == null || r.destroy();
440
- const n = [...this.cutRenders.keys()];
441
- for (const t of n)
442
- (o = this.cutRenders.get(t)) == null || o.worker.destroy(), this.cutRenders.delete(t);
443
- R(this.stream), (i = this.audioPlayer) == null || i.destroy();
440
+ const o = [...this.cutRenders.keys()];
441
+ for (const t of o)
442
+ (n = this.cutRenders.get(t)) == null || n.worker.destroy(), this.cutRenders.delete(t);
443
+ M(this.stream), (i = this.audioPlayer) == null || i.destroy();
444
444
  });
445
445
  /**
446
446
  * 获取媒体流
@@ -450,83 +450,83 @@ class et {
450
450
  * 设置暂停
451
451
  * @param pause: boolean
452
452
  */
453
- m(this, "setPause", (n) => {
453
+ m(this, "setPause", (o) => {
454
454
  var a;
455
- (a = this.renderWorker) == null || a.setPause(n);
455
+ (a = this.renderWorker) == null || a.setPause(o);
456
456
  });
457
457
  /**
458
458
  * 是否静音 默认为true
459
459
  * @param state?: boolean
460
460
  */
461
- m(this, "setMute", (n) => {
461
+ m(this, "setMute", (o) => {
462
462
  var a, u;
463
- return (u = (a = this.audioPlayer) == null ? void 0 : a.prAudioStream) == null ? void 0 : u.setMute(n);
463
+ return (u = (a = this.audioPlayer) == null ? void 0 : a.prAudioStream) == null ? void 0 : u.setMute(o);
464
464
  });
465
465
  /**
466
466
  * 是否开启追帧
467
467
  * @param frameTrack?: boolean
468
468
  */
469
- m(this, "setFrameTrack", (n) => {
469
+ m(this, "setFrameTrack", (o) => {
470
470
  var a;
471
- (a = this.decoderWorker) == null || a.setFrameTrack(n);
471
+ this.option.frameTrack = o, (a = this.decoderWorker) == null || a.setFrameTrack(o);
472
472
  });
473
473
  /**
474
474
  * 是否已准备好
475
475
  */
476
476
  m(this, "isReady", () => {
477
- const n = () => {
477
+ const o = () => {
478
478
  var a;
479
479
  return ((a = this.stream) == null ? void 0 : a.active) === !0;
480
480
  };
481
- return this.prResolves.add("isReady", n);
481
+ return this.prResolves.add("isReady", o);
482
482
  });
483
483
  m(this, "cut", {
484
484
  /**
485
485
  * 创建剪切
486
486
  */
487
- create: (n, a) => {
488
- let u = this.cutRenders.get(n);
489
- return u ? (u.worker.setCut(a), u.worker.setPause(!1), u) : (u = x(), u.worker.setCut(a), this.cutRenders.set(n, u), u);
487
+ create: (o, a) => {
488
+ let u = this.cutRenders.get(o);
489
+ return u ? (u.worker.setCut(a), u.worker.setPause(!1), u) : (u = A(), u.worker.setCut(a), this.cutRenders.set(o, u), u);
490
490
  },
491
491
  /**
492
492
  * 获取媒体流
493
493
  */
494
- getStream: (n) => {
494
+ getStream: (o) => {
495
495
  var a;
496
- return (a = this.cutRenders.get(n)) == null ? void 0 : a.stream;
496
+ return (a = this.cutRenders.get(o)) == null ? void 0 : a.stream;
497
497
  },
498
498
  /**
499
499
  * 设置暂停
500
500
  * @param pause: boolean
501
501
  */
502
- setPause: (n, a) => {
502
+ setPause: (o, a) => {
503
503
  var u;
504
- (u = this.cutRenders.get(n)) == null || u.worker.setPause(a);
504
+ (u = this.cutRenders.get(o)) == null || u.worker.setPause(a);
505
505
  },
506
506
  /**
507
507
  * 移除剪切
508
508
  */
509
- remove: (n) => {
509
+ remove: (o) => {
510
510
  var a;
511
- (a = this.cutRenders.get(n)) == null || a.destroy(), this.cutRenders.delete(n);
511
+ (a = this.cutRenders.get(o)) == null || a.destroy(), this.cutRenders.delete(o);
512
512
  }
513
513
  });
514
514
  /**
515
515
  * 初始化
516
516
  */
517
- m(this, "init", (n) => {
518
- this.initDecoder(n), this.initRender(), this.initDemuxer(n), this.audioPlayer = new W(), this.audioPlayer.init();
517
+ m(this, "init", (o) => {
518
+ this.initDecoder(o), this.initRender(), this.initDemuxer(o), this.audioPlayer = new W(), this.audioPlayer.init();
519
519
  });
520
520
  /**
521
521
  * 初始化解复器
522
522
  */
523
- m(this, "initDemuxer", (n) => {
524
- this.demuxerWorker = new V(), this.demuxerWorker.init(n), this.demuxerWorker.on.debug = (a) => {
525
- this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: debug", a);
523
+ m(this, "initDemuxer", (o) => {
524
+ this.demuxerWorker = new V(), this.demuxerWorker.init(o), this.demuxerWorker.on.debug = (a) => {
525
+ this.option.debug && this.on.debug && this.on.debug(a);
526
526
  }, this.demuxerWorker.on.info = (a) => {
527
527
  this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: info", a), this.on.demuxer.info && this.on.demuxer.info(a);
528
528
  }, this.demuxerWorker.on.config = (a) => {
529
- var r, o;
529
+ var r, n;
530
530
  this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: config", a), this.on.demuxer.config && this.on.demuxer.config(a);
531
531
  const { kind: u } = a;
532
532
  switch (u) {
@@ -539,7 +539,7 @@ class et {
539
539
  case "video":
540
540
  {
541
541
  const { codec: i, description: t } = a;
542
- (o = this.decoderWorker) == null || o.initVideo({ codec: i, description: t });
542
+ (n = this.decoderWorker) == null || n.initVideo({ codec: i, description: t });
543
543
  }
544
544
  break;
545
545
  }
@@ -549,13 +549,13 @@ class et {
549
549
  switch (u) {
550
550
  case "audio":
551
551
  {
552
- const { type: r, dts: o, data: i } = a, t = o * 1e3;
552
+ const { type: r, dts: n, data: i } = a, t = n * 1e3;
553
553
  this.decoderWorker.push({ kind: u, init: { type: r, timestamp: t, data: i } });
554
554
  }
555
555
  break;
556
556
  case "video":
557
557
  {
558
- const { type: r, dts: o, data: i, nalus: t = [] } = a, e = o * 1e3;
558
+ const { type: r, dts: n, data: i, nalus: t = [] } = a, e = n * 1e3;
559
559
  this.decoderWorker.push({ kind: u, init: { type: r, timestamp: e, data: i }, nalus: t });
560
560
  }
561
561
  break;
@@ -565,28 +565,30 @@ class et {
565
565
  /**
566
566
  * 初始化解码器
567
567
  */
568
- m(this, "initDecoder", (n) => {
569
- this.decoderWorker = new N(), this.decoderWorker.init(n), this.decoderWorker.on.debug = (a) => {
570
- this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: debug", a);
571
- }, this.decoderWorker.on.audio.decode = (a) => {
572
- var u;
573
- (u = this.audioPlayer) == null || u.push(a), this.on.decoder.audio && this.on.decoder.audio(a);
574
- }, this.decoderWorker.on.audio.error = (a) => {
575
- this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: audio.error ", a), this.on.error && this.on.error(a);
576
- }, this.decoderWorker.on.video.decode = async (a) => {
577
- var r, o;
578
- (r = this.renderWorker) == null || r.push(a);
579
- const u = [...this.cutRenders.keys()];
580
- for (const i of u)
581
- (o = this.cutRenders.get(i)) == null || o.worker.push(a);
582
- this.on.decoder.video && this.on.decoder.video(a), a.bitmap.close();
583
- }, this.decoderWorker.on.video.error = (a) => {
584
- this.stop(), this.on.error && this.on.error(a);
585
- }, this.decoderWorker.on.nalus = async (a) => {
586
- for (const u of a) {
587
- if (u.byteLength <= 4) continue;
588
- const { header: r, data: o } = Y(u), { nal_unit_type: i } = r;
589
- i === 6 && this.on.decoder.sei && this.on.decoder.sei(o);
568
+ m(this, "initDecoder", (o) => {
569
+ this.decoderWorker = new N(), this.decoderWorker.init(o);
570
+ const { frameTrack: a = !1 } = this.option;
571
+ this.decoderWorker.setFrameTrack(a), this.decoderWorker.on.debug = (u) => {
572
+ this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: debug", u);
573
+ }, this.decoderWorker.on.audio.decode = (u) => {
574
+ var r;
575
+ (r = this.audioPlayer) == null || r.push(u), this.on.decoder.audio && this.on.decoder.audio(u);
576
+ }, this.decoderWorker.on.audio.error = (u) => {
577
+ this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: audio.error ", u), this.on.error && this.on.error(u);
578
+ }, this.decoderWorker.on.video.decode = async (u) => {
579
+ var n, i;
580
+ (n = this.renderWorker) == null || n.push(u);
581
+ const r = [...this.cutRenders.keys()];
582
+ for (const t of r)
583
+ (i = this.cutRenders.get(t)) == null || i.worker.push(u);
584
+ this.on.decoder.video && this.on.decoder.video(u), u.bitmap.close();
585
+ }, this.decoderWorker.on.video.error = (u) => {
586
+ this.stop(), this.on.error && this.on.error(u);
587
+ }, this.decoderWorker.on.nalus = async (u) => {
588
+ for (const r of u) {
589
+ if (r.byteLength <= 4) continue;
590
+ const { header: n, data: i } = Y(r), { nal_unit_type: t } = n;
591
+ t === 6 && this.on.decoder.sei && this.on.decoder.sei(i);
590
592
  }
591
593
  };
592
594
  });
@@ -594,20 +596,20 @@ class et {
594
596
  * 初始化渲染器
595
597
  */
596
598
  m(this, "initRender", () => {
597
- const { worker: n, stream: a } = x();
598
- this.renderWorker = n, this.stream = a, this.renderWorker.setPause(!1);
599
+ const { worker: o, stream: a } = A();
600
+ this.renderWorker = o, this.stream = a, this.renderWorker.setPause(!1);
599
601
  });
600
602
  m(this, "flv", {
601
603
  start: async () => {
602
- var n, a;
604
+ var o, a;
603
605
  try {
604
606
  let u = await this.prFetch.request(this.url);
605
- if (u.status !== 200 && (await new Promise((o) => setTimeout(() => o(!0), 500)), u = await this.prFetch.request(this.url)), u.status !== 200 && (await new Promise((o) => setTimeout(() => o(!0), 500)), u = await this.prFetch.request(this.url)), u.status !== 200) throw new Error("request is error.");
606
- const r = (n = u.body) == null ? void 0 : n.getReader();
607
+ if (u.status !== 200 && (await new Promise((n) => setTimeout(() => n(!0), 500)), u = await this.prFetch.request(this.url)), u.status !== 200 && (await new Promise((n) => setTimeout(() => n(!0), 500)), u = await this.prFetch.request(this.url)), u.status !== 200) throw new Error("request is error.");
608
+ const r = (o = u.body) == null ? void 0 : o.getReader();
607
609
  if (!r) throw new Error("reader is error.");
608
610
  for (; ; ) {
609
- const { done: o, value: i } = await r.read();
610
- if (i && ((a = this.demuxerWorker) == null || a.push(i)), o) break;
611
+ const { done: n, value: i } = await r.read();
612
+ if (i && ((a = this.demuxerWorker) == null || a.push(i)), n) break;
611
613
  }
612
614
  } catch (u) {
613
615
  if ((u == null ? void 0 : u.name) !== "AbortError") throw Error(u);
@@ -620,29 +622,29 @@ class et {
620
622
  urls: [],
621
623
  url: "",
622
624
  getSegmentsTimer: 0,
623
- parse: async (n) => {
624
- const a = new TextDecoder("utf-8").decode(n).split(`
625
+ parse: async (o) => {
626
+ const a = new TextDecoder("utf-8").decode(o).split(`
625
627
  `).map((e) => e.replace("\r", "")), u = this.url.substring(0, this.url.lastIndexOf("/") + 1);
626
- let r = 4, o = 0, i = !1;
628
+ let r = 4, n = 0, i = !1;
627
629
  const t = [];
628
630
  for (const e of a)
629
- e.startsWith("#EXTINF:") ? r = parseFloat(e.split(":")[1].split(",")[0]) : e.startsWith("#EXT-X-TARGETDURATION:") ? o = parseInt(e.split(":")[1]) : e.startsWith("#EXT-X-ENDLIST") ? i = !1 : e.startsWith("#EXT-X-MEDIA-SEQUENCE:") ? i = !0 : e.includes(".ts") && !e.startsWith("#") && t.push({
631
+ e.startsWith("#EXTINF:") ? r = parseFloat(e.split(":")[1].split(",")[0]) : e.startsWith("#EXT-X-TARGETDURATION:") ? n = parseInt(e.split(":")[1]) : e.startsWith("#EXT-X-ENDLIST") ? i = !1 : e.startsWith("#EXT-X-MEDIA-SEQUENCE:") ? i = !0 : e.includes(".ts") && !e.startsWith("#") && t.push({
630
632
  url: e.startsWith("http") ? e : u + e,
631
633
  duration: r,
632
634
  isLive: i
633
635
  });
634
- return { baseUrl: u, targetDuration: o, isLive: i, segments: t };
636
+ return { baseUrl: u, targetDuration: n, isLive: i, segments: t };
635
637
  },
636
638
  getSegments: async () => {
637
- var n;
639
+ var o;
638
640
  try {
639
- const a = new v();
641
+ const a = new x();
640
642
  let u = await a.request(this.url);
641
- if (u.status !== 200 && (await new Promise((o) => setTimeout(() => o(!0), 500)), u = await a.request(this.url)), u.status !== 200 && (await new Promise((o) => setTimeout(() => o(!0), 500)), u = await a.request(this.url)), u.status !== 200) throw new Error("request is error.");
642
- const r = (n = u.body) == null ? void 0 : n.getReader();
643
+ if (u.status !== 200 && (await new Promise((n) => setTimeout(() => n(!0), 500)), u = await a.request(this.url)), u.status !== 200 && (await new Promise((n) => setTimeout(() => n(!0), 500)), u = await a.request(this.url)), u.status !== 200) throw new Error("request is error.");
644
+ const r = (o = u.body) == null ? void 0 : o.getReader();
643
645
  if (!r) throw new Error("reader is error.");
644
646
  for (; ; ) {
645
- const { done: o, value: i } = await r.read();
647
+ const { done: n, value: i } = await r.read();
646
648
  if (i) {
647
649
  const t = await this.hls.parse(i), { segments: e = [], isLive: s = !1 } = t;
648
650
  this.hls.isLive = s, s === !1 && (this.option.frameTrack = !1);
@@ -650,34 +652,34 @@ class et {
650
652
  const c = l.findIndex((d) => d === this.hls.url);
651
653
  c !== -1 && (l = l.slice(c + 1)), this.hls.urls = l;
652
654
  }
653
- if (o) break;
655
+ if (n) break;
654
656
  }
655
657
  } catch (a) {
656
658
  this.on.error && this.on.error(a);
657
659
  }
658
660
  },
659
661
  start: async () => {
660
- var n, a, u;
662
+ var o, a, u;
661
663
  try {
662
- for (await this.hls.getSegments(), this.hls.getSegmentsTimer = window.setInterval(this.hls.getSegments, 500), this.hls.isLive === !1 && (clearInterval(this.hls.getSegmentsTimer), (n = this.decoderWorker) == null ? void 0 : n.setFrameTrack(!1)); ; ) {
664
+ for (await this.hls.getSegments(), this.hls.getSegmentsTimer = window.setInterval(this.hls.getSegments, 500), this.hls.isLive === !1 && (clearInterval(this.hls.getSegmentsTimer), (o = this.decoderWorker) == null ? void 0 : o.setFrameTrack(!1)); ; ) {
663
665
  const r = this.hls.urls.shift();
664
666
  if (r) {
665
667
  this.hls.url = r;
666
- const o = (a = (await this.prFetch.request(r)).body) == null ? void 0 : a.getReader();
667
- if (!o) throw new Error("segment reader is error.");
668
+ const n = (a = (await this.prFetch.request(r)).body) == null ? void 0 : a.getReader();
669
+ if (!n) throw new Error("segment reader is error.");
668
670
  for (; ; ) {
669
- const { done: i, value: t } = await o.read();
671
+ const { done: i, value: t } = await n.read();
670
672
  if (t && ((u = this.demuxerWorker) == null || u.push(t)), i) break;
671
673
  }
672
674
  } else
673
- await new Promise((o) => setTimeout(() => o(!0), 300));
675
+ await new Promise((n) => setTimeout(() => n(!0), 300));
674
676
  }
675
677
  } catch (r) {
676
678
  if ((r == null ? void 0 : r.name) !== "AbortError") throw Error(r);
677
679
  }
678
680
  }
679
681
  });
680
- const { debug: a = !1 } = n;
682
+ const { debug: a = !1 } = o;
681
683
  this.option.debug = a;
682
684
  }
683
685
  }
@@ -685,9 +687,9 @@ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u"
685
687
  function requireAspromise() {
686
688
  if (hasRequiredAspromise) return aspromise;
687
689
  hasRequiredAspromise = 1, aspromise = h;
688
- function h(n, a) {
689
- for (var u = new Array(arguments.length - 1), r = 0, o = 2, i = !0; o < arguments.length; )
690
- u[r++] = arguments[o++];
690
+ function h(o, a) {
691
+ for (var u = new Array(arguments.length - 1), r = 0, n = 2, i = !0; n < arguments.length; )
692
+ u[r++] = arguments[n++];
691
693
  return new Promise(function(e, s) {
692
694
  u[r] = function(c) {
693
695
  if (i)
@@ -700,7 +702,7 @@ function requireAspromise() {
700
702
  }
701
703
  };
702
704
  try {
703
- n.apply(a || null, u);
705
+ o.apply(a || null, u);
704
706
  } catch (l) {
705
707
  i && (i = !1, s(l));
706
708
  }
@@ -711,8 +713,8 @@ function requireAspromise() {
711
713
  var base64 = {}, hasRequiredBase64;
712
714
  function requireBase64() {
713
715
  return hasRequiredBase64 || (hasRequiredBase64 = 1, function(h) {
714
- var n = h;
715
- n.length = function(t) {
716
+ var o = h;
717
+ o.length = function(t) {
716
718
  var e = t.length;
717
719
  if (!e)
718
720
  return 0;
@@ -722,7 +724,7 @@ function requireBase64() {
722
724
  };
723
725
  for (var a = new Array(64), u = new Array(123), r = 0; r < 64; )
724
726
  u[a[r] = r < 26 ? r + 65 : r < 52 ? r + 71 : r < 62 ? r - 4 : r - 59 | 43] = r++;
725
- n.encode = function(t, e, s) {
727
+ o.encode = function(t, e, s) {
726
728
  for (var l = null, c = [], d = 0, p = 0, f; e < s; ) {
727
729
  var w = t[e++];
728
730
  switch (p) {
@@ -740,14 +742,14 @@ function requireBase64() {
740
742
  }
741
743
  return p && (c[d++] = a[f], c[d++] = 61, p === 1 && (c[d++] = 61)), l ? (d && l.push(String.fromCharCode.apply(String, c.slice(0, d))), l.join("")) : String.fromCharCode.apply(String, c.slice(0, d));
742
744
  };
743
- var o = "invalid encoding";
744
- n.decode = function(t, e, s) {
745
+ var n = "invalid encoding";
746
+ o.decode = function(t, e, s) {
745
747
  for (var l = s, c = 0, d, p = 0; p < t.length; ) {
746
748
  var f = t.charCodeAt(p++);
747
749
  if (f === 61 && c > 1)
748
750
  break;
749
751
  if ((f = u[f]) === void 0)
750
- throw Error(o);
752
+ throw Error(n);
751
753
  switch (c) {
752
754
  case 0:
753
755
  d = f, c = 1;
@@ -764,9 +766,9 @@ function requireBase64() {
764
766
  }
765
767
  }
766
768
  if (c === 1)
767
- throw Error(o);
769
+ throw Error(n);
768
770
  return s - l;
769
- }, n.test = function(t) {
771
+ }, o.test = function(t) {
770
772
  return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t);
771
773
  };
772
774
  }(base64)), base64;
@@ -789,16 +791,16 @@ function requireEventemitter() {
789
791
  else if (u === void 0)
790
792
  this._listeners[a] = [];
791
793
  else
792
- for (var r = this._listeners[a], o = 0; o < r.length; )
793
- r[o].fn === u ? r.splice(o, 1) : ++o;
794
+ for (var r = this._listeners[a], n = 0; n < r.length; )
795
+ r[n].fn === u ? r.splice(n, 1) : ++n;
794
796
  return this;
795
797
  }, h.prototype.emit = function(a) {
796
798
  var u = this._listeners[a];
797
799
  if (u) {
798
- for (var r = [], o = 1; o < arguments.length; )
799
- r.push(arguments[o++]);
800
- for (o = 0; o < u.length; )
801
- u[o].fn.apply(u[o++].ctx, r);
800
+ for (var r = [], n = 1; n < arguments.length; )
801
+ r.push(arguments[n++]);
802
+ for (n = 0; n < u.length; )
803
+ u[n].fn.apply(u[n++].ctx, r);
802
804
  }
803
805
  return this;
804
806
  }, eventemitter;
@@ -807,7 +809,7 @@ var float, hasRequiredFloat;
807
809
  function requireFloat() {
808
810
  if (hasRequiredFloat) return float;
809
811
  hasRequiredFloat = 1, float = h(h);
810
- function h(o) {
812
+ function h(n) {
811
813
  return typeof Float32Array < "u" ? function() {
812
814
  var i = new Float32Array([-0]), t = new Uint8Array(i.buffer), e = t[3] === 128;
813
815
  function s(p, f, w) {
@@ -816,14 +818,14 @@ function requireFloat() {
816
818
  function l(p, f, w) {
817
819
  i[0] = p, f[w] = t[3], f[w + 1] = t[2], f[w + 2] = t[1], f[w + 3] = t[0];
818
820
  }
819
- o.writeFloatLE = e ? s : l, o.writeFloatBE = e ? l : s;
821
+ n.writeFloatLE = e ? s : l, n.writeFloatBE = e ? l : s;
820
822
  function c(p, f) {
821
823
  return t[0] = p[f], t[1] = p[f + 1], t[2] = p[f + 2], t[3] = p[f + 3], i[0];
822
824
  }
823
825
  function d(p, f) {
824
826
  return t[3] = p[f], t[2] = p[f + 1], t[1] = p[f + 2], t[0] = p[f + 3], i[0];
825
827
  }
826
- o.readFloatLE = e ? c : d, o.readFloatBE = e ? d : c;
828
+ n.readFloatLE = e ? c : d, n.readFloatBE = e ? d : c;
827
829
  }() : function() {
828
830
  function i(e, s, l, c) {
829
831
  var d = s < 0 ? 1 : 0;
@@ -846,12 +848,12 @@ function requireFloat() {
846
848
  e((d << 31 | p + 127 << 23 | f) >>> 0, l, c);
847
849
  }
848
850
  }
849
- o.writeFloatLE = i.bind(null, n), o.writeFloatBE = i.bind(null, a);
851
+ n.writeFloatLE = i.bind(null, o), n.writeFloatBE = i.bind(null, a);
850
852
  function t(e, s, l) {
851
853
  var c = e(s, l), d = (c >> 31) * 2 + 1, p = c >>> 23 & 255, f = c & 8388607;
852
854
  return p === 255 ? f ? NaN : d * (1 / 0) : p === 0 ? d * 1401298464324817e-60 * f : d * Math.pow(2, p - 150) * (f + 8388608);
853
855
  }
854
- o.readFloatLE = t.bind(null, u), o.readFloatBE = t.bind(null, r);
856
+ n.readFloatLE = t.bind(null, u), n.readFloatBE = t.bind(null, r);
855
857
  }(), typeof Float64Array < "u" ? function() {
856
858
  var i = new Float64Array([-0]), t = new Uint8Array(i.buffer), e = t[7] === 128;
857
859
  function s(p, f, w) {
@@ -860,14 +862,14 @@ function requireFloat() {
860
862
  function l(p, f, w) {
861
863
  i[0] = p, f[w] = t[7], f[w + 1] = t[6], f[w + 2] = t[5], f[w + 3] = t[4], f[w + 4] = t[3], f[w + 5] = t[2], f[w + 6] = t[1], f[w + 7] = t[0];
862
864
  }
863
- o.writeDoubleLE = e ? s : l, o.writeDoubleBE = e ? l : s;
865
+ n.writeDoubleLE = e ? s : l, n.writeDoubleBE = e ? l : s;
864
866
  function c(p, f) {
865
867
  return t[0] = p[f], t[1] = p[f + 1], t[2] = p[f + 2], t[3] = p[f + 3], t[4] = p[f + 4], t[5] = p[f + 5], t[6] = p[f + 6], t[7] = p[f + 7], i[0];
866
868
  }
867
869
  function d(p, f) {
868
870
  return t[7] = p[f], t[6] = p[f + 1], t[5] = p[f + 2], t[4] = p[f + 3], t[3] = p[f + 4], t[2] = p[f + 5], t[1] = p[f + 6], t[0] = p[f + 7], i[0];
869
871
  }
870
- o.readDoubleLE = e ? c : d, o.readDoubleBE = e ? d : c;
872
+ n.readDoubleLE = e ? c : d, n.readDoubleBE = e ? d : c;
871
873
  }() : function() {
872
874
  function i(e, s, l, c, d, p) {
873
875
  var f = c < 0 ? 1 : 0;
@@ -893,25 +895,25 @@ function requireFloat() {
893
895
  }
894
896
  }
895
897
  }
896
- o.writeDoubleLE = i.bind(null, n, 0, 4), o.writeDoubleBE = i.bind(null, a, 4, 0);
898
+ n.writeDoubleLE = i.bind(null, o, 0, 4), n.writeDoubleBE = i.bind(null, a, 4, 0);
897
899
  function t(e, s, l, c, d) {
898
900
  var p = e(c, d + s), f = e(c, d + l), w = (f >> 31) * 2 + 1, b = f >>> 20 & 2047, g = 4294967296 * (f & 1048575) + p;
899
901
  return b === 2047 ? g ? NaN : w * (1 / 0) : b === 0 ? w * 5e-324 * g : w * Math.pow(2, b - 1075) * (g + 4503599627370496);
900
902
  }
901
- o.readDoubleLE = t.bind(null, u, 0, 4), o.readDoubleBE = t.bind(null, r, 4, 0);
902
- }(), o;
903
+ n.readDoubleLE = t.bind(null, u, 0, 4), n.readDoubleBE = t.bind(null, r, 4, 0);
904
+ }(), n;
903
905
  }
904
- function n(o, i, t) {
905
- i[t] = o & 255, i[t + 1] = o >>> 8 & 255, i[t + 2] = o >>> 16 & 255, i[t + 3] = o >>> 24;
906
+ function o(n, i, t) {
907
+ i[t] = n & 255, i[t + 1] = n >>> 8 & 255, i[t + 2] = n >>> 16 & 255, i[t + 3] = n >>> 24;
906
908
  }
907
- function a(o, i, t) {
908
- i[t] = o >>> 24, i[t + 1] = o >>> 16 & 255, i[t + 2] = o >>> 8 & 255, i[t + 3] = o & 255;
909
+ function a(n, i, t) {
910
+ i[t] = n >>> 24, i[t + 1] = n >>> 16 & 255, i[t + 2] = n >>> 8 & 255, i[t + 3] = n & 255;
909
911
  }
910
- function u(o, i) {
911
- return (o[i] | o[i + 1] << 8 | o[i + 2] << 16 | o[i + 3] << 24) >>> 0;
912
+ function u(n, i) {
913
+ return (n[i] | n[i + 1] << 8 | n[i + 2] << 16 | n[i + 3] << 24) >>> 0;
912
914
  }
913
- function r(o, i) {
914
- return (o[i] << 24 | o[i + 1] << 16 | o[i + 2] << 8 | o[i + 3]) >>> 0;
915
+ function r(n, i) {
916
+ return (n[i] << 24 | n[i + 1] << 16 | n[i + 2] << 8 | n[i + 3]) >>> 0;
915
917
  }
916
918
  return float;
917
919
  }
@@ -933,22 +935,22 @@ function requireInquire() {
933
935
  var utf8 = {}, hasRequiredUtf8;
934
936
  function requireUtf8() {
935
937
  return hasRequiredUtf8 || (hasRequiredUtf8 = 1, function(h) {
936
- var n = h;
937
- n.length = function(u) {
938
- for (var r = 0, o = 0, i = 0; i < u.length; ++i)
939
- o = u.charCodeAt(i), o < 128 ? r += 1 : o < 2048 ? r += 2 : (o & 64512) === 55296 && (u.charCodeAt(i + 1) & 64512) === 56320 ? (++i, r += 4) : r += 3;
938
+ var o = h;
939
+ o.length = function(u) {
940
+ for (var r = 0, n = 0, i = 0; i < u.length; ++i)
941
+ n = u.charCodeAt(i), n < 128 ? r += 1 : n < 2048 ? r += 2 : (n & 64512) === 55296 && (u.charCodeAt(i + 1) & 64512) === 56320 ? (++i, r += 4) : r += 3;
940
942
  return r;
941
- }, n.read = function(u, r, o) {
942
- var i = o - r;
943
+ }, o.read = function(u, r, n) {
944
+ var i = n - r;
943
945
  if (i < 1)
944
946
  return "";
945
- for (var t = null, e = [], s = 0, l; r < o; )
947
+ for (var t = null, e = [], s = 0, l; r < n; )
946
948
  l = u[r++], l < 128 ? e[s++] = l : l > 191 && l < 224 ? e[s++] = (l & 31) << 6 | u[r++] & 63 : l > 239 && l < 365 ? (l = ((l & 7) << 18 | (u[r++] & 63) << 12 | (u[r++] & 63) << 6 | u[r++] & 63) - 65536, e[s++] = 55296 + (l >> 10), e[s++] = 56320 + (l & 1023)) : e[s++] = (l & 15) << 12 | (u[r++] & 63) << 6 | u[r++] & 63, s > 8191 && ((t || (t = [])).push(String.fromCharCode.apply(String, e)), s = 0);
947
949
  return t ? (s && t.push(String.fromCharCode.apply(String, e.slice(0, s))), t.join("")) : String.fromCharCode.apply(String, e.slice(0, s));
948
- }, n.write = function(u, r, o) {
949
- for (var i = o, t, e, s = 0; s < u.length; ++s)
950
- t = u.charCodeAt(s), t < 128 ? r[o++] = t : t < 2048 ? (r[o++] = t >> 6 | 192, r[o++] = t & 63 | 128) : (t & 64512) === 55296 && ((e = u.charCodeAt(s + 1)) & 64512) === 56320 ? (t = 65536 + ((t & 1023) << 10) + (e & 1023), ++s, r[o++] = t >> 18 | 240, r[o++] = t >> 12 & 63 | 128, r[o++] = t >> 6 & 63 | 128, r[o++] = t & 63 | 128) : (r[o++] = t >> 12 | 224, r[o++] = t >> 6 & 63 | 128, r[o++] = t & 63 | 128);
951
- return o - i;
950
+ }, o.write = function(u, r, n) {
951
+ for (var i = n, t, e, s = 0; s < u.length; ++s)
952
+ t = u.charCodeAt(s), t < 128 ? r[n++] = t : t < 2048 ? (r[n++] = t >> 6 | 192, r[n++] = t & 63 | 128) : (t & 64512) === 55296 && ((e = u.charCodeAt(s + 1)) & 64512) === 56320 ? (t = 65536 + ((t & 1023) << 10) + (e & 1023), ++s, r[n++] = t >> 18 | 240, r[n++] = t >> 12 & 63 | 128, r[n++] = t >> 6 & 63 | 128, r[n++] = t & 63 | 128) : (r[n++] = t >> 12 | 224, r[n++] = t >> 6 & 63 | 128, r[n++] = t & 63 | 128);
953
+ return n - i;
952
954
  };
953
955
  }(utf8)), utf8;
954
956
  }
@@ -956,12 +958,12 @@ var pool_1, hasRequiredPool;
956
958
  function requirePool() {
957
959
  if (hasRequiredPool) return pool_1;
958
960
  hasRequiredPool = 1, pool_1 = h;
959
- function h(n, a, u) {
960
- var r = u || 8192, o = r >>> 1, i = null, t = r;
961
+ function h(o, a, u) {
962
+ var r = u || 8192, n = r >>> 1, i = null, t = r;
961
963
  return function(s) {
962
- if (s < 1 || s > o)
963
- return n(s);
964
- t + s > r && (i = n(r), t = 0);
964
+ if (s < 1 || s > n)
965
+ return o(s);
966
+ t + s > r && (i = o(r), t = 0);
965
967
  var l = a.call(i, t, t += s);
966
968
  return t & 7 && (t = (t | 7) + 1), l;
967
969
  };
@@ -971,12 +973,12 @@ function requirePool() {
971
973
  var longbits, hasRequiredLongbits;
972
974
  function requireLongbits() {
973
975
  if (hasRequiredLongbits) return longbits;
974
- hasRequiredLongbits = 1, longbits = n;
976
+ hasRequiredLongbits = 1, longbits = o;
975
977
  var h = requireMinimal$1();
976
- function n(o, i) {
977
- this.lo = o >>> 0, this.hi = i >>> 0;
978
+ function o(n, i) {
979
+ this.lo = n >>> 0, this.hi = i >>> 0;
978
980
  }
979
- var a = n.zero = new n(0, 0);
981
+ var a = o.zero = new o(0, 0);
980
982
  a.toNumber = function() {
981
983
  return 0;
982
984
  }, a.zzEncode = a.zzDecode = function() {
@@ -984,39 +986,39 @@ function requireLongbits() {
984
986
  }, a.length = function() {
985
987
  return 1;
986
988
  };
987
- var u = n.zeroHash = "\0\0\0\0\0\0\0\0";
988
- n.fromNumber = function(i) {
989
+ var u = o.zeroHash = "\0\0\0\0\0\0\0\0";
990
+ o.fromNumber = function(i) {
989
991
  if (i === 0)
990
992
  return a;
991
993
  var t = i < 0;
992
994
  t && (i = -i);
993
995
  var e = i >>> 0, s = (i - e) / 4294967296 >>> 0;
994
- return t && (s = ~s >>> 0, e = ~e >>> 0, ++e > 4294967295 && (e = 0, ++s > 4294967295 && (s = 0))), new n(e, s);
995
- }, n.from = function(i) {
996
+ return t && (s = ~s >>> 0, e = ~e >>> 0, ++e > 4294967295 && (e = 0, ++s > 4294967295 && (s = 0))), new o(e, s);
997
+ }, o.from = function(i) {
996
998
  if (typeof i == "number")
997
- return n.fromNumber(i);
999
+ return o.fromNumber(i);
998
1000
  if (h.isString(i))
999
1001
  if (h.Long)
1000
1002
  i = h.Long.fromString(i);
1001
1003
  else
1002
- return n.fromNumber(parseInt(i, 10));
1003
- return i.low || i.high ? new n(i.low >>> 0, i.high >>> 0) : a;
1004
- }, n.prototype.toNumber = function(i) {
1004
+ return o.fromNumber(parseInt(i, 10));
1005
+ return i.low || i.high ? new o(i.low >>> 0, i.high >>> 0) : a;
1006
+ }, o.prototype.toNumber = function(i) {
1005
1007
  if (!i && this.hi >>> 31) {
1006
1008
  var t = ~this.lo + 1 >>> 0, e = ~this.hi >>> 0;
1007
1009
  return t || (e = e + 1 >>> 0), -(t + e * 4294967296);
1008
1010
  }
1009
1011
  return this.lo + this.hi * 4294967296;
1010
- }, n.prototype.toLong = function(i) {
1012
+ }, o.prototype.toLong = function(i) {
1011
1013
  return h.Long ? new h.Long(this.lo | 0, this.hi | 0, !!i) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!i };
1012
1014
  };
1013
1015
  var r = String.prototype.charCodeAt;
1014
- return n.fromHash = function(i) {
1015
- return i === u ? a : new n(
1016
+ return o.fromHash = function(i) {
1017
+ return i === u ? a : new o(
1016
1018
  (r.call(i, 0) | r.call(i, 1) << 8 | r.call(i, 2) << 16 | r.call(i, 3) << 24) >>> 0,
1017
1019
  (r.call(i, 4) | r.call(i, 5) << 8 | r.call(i, 6) << 16 | r.call(i, 7) << 24) >>> 0
1018
1020
  );
1019
- }, n.prototype.toHash = function() {
1021
+ }, o.prototype.toHash = function() {
1020
1022
  return String.fromCharCode(
1021
1023
  this.lo & 255,
1022
1024
  this.lo >>> 8 & 255,
@@ -1027,13 +1029,13 @@ function requireLongbits() {
1027
1029
  this.hi >>> 16 & 255,
1028
1030
  this.hi >>> 24
1029
1031
  );
1030
- }, n.prototype.zzEncode = function() {
1032
+ }, o.prototype.zzEncode = function() {
1031
1033
  var i = this.hi >> 31;
1032
1034
  return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ i) >>> 0, this.lo = (this.lo << 1 ^ i) >>> 0, this;
1033
- }, n.prototype.zzDecode = function() {
1035
+ }, o.prototype.zzDecode = function() {
1034
1036
  var i = -(this.lo & 1);
1035
1037
  return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ i) >>> 0, this.hi = (this.hi >>> 1 ^ i) >>> 0, this;
1036
- }, n.prototype.length = function() {
1038
+ }, o.prototype.length = function() {
1037
1039
  var i = this.lo, t = (this.lo >>> 28 | this.hi << 4) >>> 0, e = this.hi >>> 24;
1038
1040
  return e === 0 ? t === 0 ? i < 16384 ? i < 128 ? 1 : 2 : i < 2097152 ? 3 : 4 : t < 16384 ? t < 128 ? 5 : 6 : t < 2097152 ? 7 : 8 : e < 128 ? 9 : 10;
1039
1041
  }, longbits;
@@ -1041,32 +1043,32 @@ function requireLongbits() {
1041
1043
  var hasRequiredMinimal$1;
1042
1044
  function requireMinimal$1() {
1043
1045
  return hasRequiredMinimal$1 || (hasRequiredMinimal$1 = 1, function(h) {
1044
- var n = h;
1045
- n.asPromise = requireAspromise(), n.base64 = requireBase64(), n.EventEmitter = requireEventemitter(), n.float = requireFloat(), n.inquire = requireInquire(), n.utf8 = requireUtf8(), n.pool = requirePool(), n.LongBits = requireLongbits(), n.isNode = !!(typeof commonjsGlobal < "u" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node), n.global = n.isNode && commonjsGlobal || typeof window < "u" && window || typeof self < "u" && self || minimal$1, n.emptyArray = Object.freeze ? Object.freeze([]) : (
1046
+ var o = h;
1047
+ o.asPromise = requireAspromise(), o.base64 = requireBase64(), o.EventEmitter = requireEventemitter(), o.float = requireFloat(), o.inquire = requireInquire(), o.utf8 = requireUtf8(), o.pool = requirePool(), o.LongBits = requireLongbits(), o.isNode = !!(typeof commonjsGlobal < "u" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node), o.global = o.isNode && commonjsGlobal || typeof window < "u" && window || typeof self < "u" && self || minimal$1, o.emptyArray = Object.freeze ? Object.freeze([]) : (
1046
1048
  /* istanbul ignore next */
1047
1049
  []
1048
- ), n.emptyObject = Object.freeze ? Object.freeze({}) : (
1050
+ ), o.emptyObject = Object.freeze ? Object.freeze({}) : (
1049
1051
  /* istanbul ignore next */
1050
1052
  {}
1051
- ), n.isInteger = Number.isInteger || /* istanbul ignore next */
1052
- function(o) {
1053
- return typeof o == "number" && isFinite(o) && Math.floor(o) === o;
1054
- }, n.isString = function(o) {
1055
- return typeof o == "string" || o instanceof String;
1056
- }, n.isObject = function(o) {
1057
- return o && typeof o == "object";
1058
- }, n.isset = /**
1053
+ ), o.isInteger = Number.isInteger || /* istanbul ignore next */
1054
+ function(n) {
1055
+ return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1056
+ }, o.isString = function(n) {
1057
+ return typeof n == "string" || n instanceof String;
1058
+ }, o.isObject = function(n) {
1059
+ return n && typeof n == "object";
1060
+ }, o.isset = /**
1059
1061
  * Checks if a property on a message is considered to be present.
1060
1062
  * @param {Object} obj Plain object or message instance
1061
1063
  * @param {string} prop Property name
1062
1064
  * @returns {boolean} `true` if considered to be present, otherwise `false`
1063
1065
  */
1064
- n.isSet = function(o, i) {
1065
- var t = o[i];
1066
- return t != null && o.hasOwnProperty(i) ? typeof t != "object" || (Array.isArray(t) ? t.length : Object.keys(t).length) > 0 : !1;
1067
- }, n.Buffer = function() {
1066
+ o.isSet = function(n, i) {
1067
+ var t = n[i];
1068
+ return t != null && n.hasOwnProperty(i) ? typeof t != "object" || (Array.isArray(t) ? t.length : Object.keys(t).length) > 0 : !1;
1069
+ }, o.Buffer = function() {
1068
1070
  try {
1069
- var r = n.inquire("buffer").Buffer;
1071
+ var r = o.inquire("buffer").Buffer;
1070
1072
  return r.prototype.utf8Write ? r : (
1071
1073
  /* istanbul ignore next */
1072
1074
  null
@@ -1074,36 +1076,36 @@ function requireMinimal$1() {
1074
1076
  } catch {
1075
1077
  return null;
1076
1078
  }
1077
- }(), n._Buffer_from = null, n._Buffer_allocUnsafe = null, n.newBuffer = function(o) {
1078
- return typeof o == "number" ? n.Buffer ? n._Buffer_allocUnsafe(o) : new n.Array(o) : n.Buffer ? n._Buffer_from(o) : typeof Uint8Array > "u" ? o : new Uint8Array(o);
1079
- }, n.Array = typeof Uint8Array < "u" ? Uint8Array : Array, n.Long = /* istanbul ignore next */
1080
- n.global.dcodeIO && /* istanbul ignore next */
1081
- n.global.dcodeIO.Long || /* istanbul ignore next */
1082
- n.global.Long || n.inquire("long"), n.key2Re = /^true|false|0|1$/, n.key32Re = /^-?(?:0|[1-9][0-9]*)$/, n.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, n.longToHash = function(o) {
1083
- return o ? n.LongBits.from(o).toHash() : n.LongBits.zeroHash;
1084
- }, n.longFromHash = function(o, i) {
1085
- var t = n.LongBits.fromHash(o);
1086
- return n.Long ? n.Long.fromBits(t.lo, t.hi, i) : t.toNumber(!!i);
1079
+ }(), o._Buffer_from = null, o._Buffer_allocUnsafe = null, o.newBuffer = function(n) {
1080
+ return typeof n == "number" ? o.Buffer ? o._Buffer_allocUnsafe(n) : new o.Array(n) : o.Buffer ? o._Buffer_from(n) : typeof Uint8Array > "u" ? n : new Uint8Array(n);
1081
+ }, o.Array = typeof Uint8Array < "u" ? Uint8Array : Array, o.Long = /* istanbul ignore next */
1082
+ o.global.dcodeIO && /* istanbul ignore next */
1083
+ o.global.dcodeIO.Long || /* istanbul ignore next */
1084
+ o.global.Long || o.inquire("long"), o.key2Re = /^true|false|0|1$/, o.key32Re = /^-?(?:0|[1-9][0-9]*)$/, o.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, o.longToHash = function(n) {
1085
+ return n ? o.LongBits.from(n).toHash() : o.LongBits.zeroHash;
1086
+ }, o.longFromHash = function(n, i) {
1087
+ var t = o.LongBits.fromHash(n);
1088
+ return o.Long ? o.Long.fromBits(t.lo, t.hi, i) : t.toNumber(!!i);
1087
1089
  };
1088
- function a(r, o, i) {
1089
- for (var t = Object.keys(o), e = 0; e < t.length; ++e)
1090
- (r[t[e]] === void 0 || !i) && (r[t[e]] = o[t[e]]);
1090
+ function a(r, n, i) {
1091
+ for (var t = Object.keys(n), e = 0; e < t.length; ++e)
1092
+ (r[t[e]] === void 0 || !i) && (r[t[e]] = n[t[e]]);
1091
1093
  return r;
1092
1094
  }
1093
- n.merge = a, n.lcFirst = function(o) {
1094
- return o.charAt(0).toLowerCase() + o.substring(1);
1095
+ o.merge = a, o.lcFirst = function(n) {
1096
+ return n.charAt(0).toLowerCase() + n.substring(1);
1095
1097
  };
1096
1098
  function u(r) {
1097
- function o(i, t) {
1098
- if (!(this instanceof o))
1099
- return new o(i, t);
1099
+ function n(i, t) {
1100
+ if (!(this instanceof n))
1101
+ return new n(i, t);
1100
1102
  Object.defineProperty(this, "message", { get: function() {
1101
1103
  return i;
1102
- } }), Error.captureStackTrace ? Error.captureStackTrace(this, o) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), t && a(this, t);
1104
+ } }), Error.captureStackTrace ? Error.captureStackTrace(this, n) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), t && a(this, t);
1103
1105
  }
1104
- return o.prototype = Object.create(Error.prototype, {
1106
+ return n.prototype = Object.create(Error.prototype, {
1105
1107
  constructor: {
1106
- value: o,
1108
+ value: n,
1107
1109
  writable: !0,
1108
1110
  enumerable: !1,
1109
1111
  configurable: !0
@@ -1128,36 +1130,36 @@ function requireMinimal$1() {
1128
1130
  enumerable: !1,
1129
1131
  configurable: !0
1130
1132
  }
1131
- }), o;
1133
+ }), n;
1132
1134
  }
1133
- n.newError = u, n.ProtocolError = u("ProtocolError"), n.oneOfGetter = function(o) {
1134
- for (var i = {}, t = 0; t < o.length; ++t)
1135
- i[o[t]] = 1;
1135
+ o.newError = u, o.ProtocolError = u("ProtocolError"), o.oneOfGetter = function(n) {
1136
+ for (var i = {}, t = 0; t < n.length; ++t)
1137
+ i[n[t]] = 1;
1136
1138
  return function() {
1137
1139
  for (var e = Object.keys(this), s = e.length - 1; s > -1; --s)
1138
1140
  if (i[e[s]] === 1 && this[e[s]] !== void 0 && this[e[s]] !== null)
1139
1141
  return e[s];
1140
1142
  };
1141
- }, n.oneOfSetter = function(o) {
1143
+ }, o.oneOfSetter = function(n) {
1142
1144
  return function(i) {
1143
- for (var t = 0; t < o.length; ++t)
1144
- o[t] !== i && delete this[o[t]];
1145
+ for (var t = 0; t < n.length; ++t)
1146
+ n[t] !== i && delete this[n[t]];
1145
1147
  };
1146
- }, n.toJSONOptions = {
1148
+ }, o.toJSONOptions = {
1147
1149
  longs: String,
1148
1150
  enums: String,
1149
1151
  bytes: String,
1150
1152
  json: !0
1151
- }, n._configure = function() {
1152
- var r = n.Buffer;
1153
+ }, o._configure = function() {
1154
+ var r = o.Buffer;
1153
1155
  if (!r) {
1154
- n._Buffer_from = n._Buffer_allocUnsafe = null;
1156
+ o._Buffer_from = o._Buffer_allocUnsafe = null;
1155
1157
  return;
1156
1158
  }
1157
- n._Buffer_from = r.from !== Uint8Array.from && r.from || /* istanbul ignore next */
1159
+ o._Buffer_from = r.from !== Uint8Array.from && r.from || /* istanbul ignore next */
1158
1160
  function(i, t) {
1159
1161
  return new r(i, t);
1160
- }, n._Buffer_allocUnsafe = r.allocUnsafe || /* istanbul ignore next */
1162
+ }, o._Buffer_allocUnsafe = r.allocUnsafe || /* istanbul ignore next */
1161
1163
  function(i) {
1162
1164
  return new r(i);
1163
1165
  };
@@ -1168,8 +1170,8 @@ var writer, hasRequiredWriter;
1168
1170
  function requireWriter() {
1169
1171
  if (hasRequiredWriter) return writer;
1170
1172
  hasRequiredWriter = 1, writer = e;
1171
- var h = requireMinimal$1(), n, a = h.LongBits, u = h.base64, r = h.utf8;
1172
- function o(b, g, k) {
1173
+ var h = requireMinimal$1(), o, a = h.LongBits, u = h.base64, r = h.utf8;
1174
+ function n(b, g, k) {
1173
1175
  this.fn = b, this.len = g, this.next = void 0, this.val = k;
1174
1176
  }
1175
1177
  function i() {
@@ -1178,12 +1180,12 @@ function requireWriter() {
1178
1180
  this.head = b.head, this.tail = b.tail, this.len = b.len, this.next = b.states;
1179
1181
  }
1180
1182
  function e() {
1181
- this.len = 0, this.head = new o(i, 0, 0), this.tail = this.head, this.states = null;
1183
+ this.len = 0, this.head = new n(i, 0, 0), this.tail = this.head, this.states = null;
1182
1184
  }
1183
1185
  var s = function() {
1184
1186
  return h.Buffer ? function() {
1185
1187
  return (e.create = function() {
1186
- return new n();
1188
+ return new o();
1187
1189
  })();
1188
1190
  } : function() {
1189
1191
  return new e();
@@ -1192,7 +1194,7 @@ function requireWriter() {
1192
1194
  e.create = s(), e.alloc = function(g) {
1193
1195
  return new h.Array(g);
1194
1196
  }, h.Array !== Array && (e.alloc = h.pool(e.alloc, h.Array.prototype.subarray)), e.prototype._push = function(g, k, T) {
1195
- return this.tail = this.tail.next = new o(g, k, T), this.len += k, this;
1197
+ return this.tail = this.tail.next = new n(g, k, T), this.len += k, this;
1196
1198
  };
1197
1199
  function l(b, g, k) {
1198
1200
  g[k] = b & 255;
@@ -1205,7 +1207,7 @@ function requireWriter() {
1205
1207
  function d(b, g) {
1206
1208
  this.len = b, this.next = void 0, this.val = g;
1207
1209
  }
1208
- d.prototype = Object.create(o.prototype), d.prototype.fn = c, e.prototype.uint32 = function(g) {
1210
+ d.prototype = Object.create(n.prototype), d.prototype.fn = c, e.prototype.uint32 = function(g) {
1209
1211
  return this.len += (this.tail = this.tail.next = new d(
1210
1212
  (g = g >>> 0) < 128 ? 1 : g < 16384 ? 2 : g < 2097152 ? 3 : g < 268435456 ? 4 : 5,
1211
1213
  g
@@ -1263,9 +1265,9 @@ function requireWriter() {
1263
1265
  var k = r.length(g);
1264
1266
  return k ? this.uint32(k)._push(r.write, k, g) : this._push(l, 1, 0);
1265
1267
  }, e.prototype.fork = function() {
1266
- return this.states = new t(this), this.head = this.tail = new o(i, 0, 0), this.len = 0, this;
1268
+ return this.states = new t(this), this.head = this.tail = new n(i, 0, 0), this.len = 0, this;
1267
1269
  }, e.prototype.reset = function() {
1268
- return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new o(i, 0, 0), this.len = 0), this;
1270
+ return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new n(i, 0, 0), this.len = 0), this;
1269
1271
  }, e.prototype.ldelim = function() {
1270
1272
  var g = this.head, k = this.tail, T = this.len;
1271
1273
  return this.reset().uint32(T), T && (this.tail.next = g.next, this.tail = k, this.len += T), this;
@@ -1274,7 +1276,7 @@ function requireWriter() {
1274
1276
  g.fn(g.val, k, T), T += g.len, g = g.next;
1275
1277
  return k;
1276
1278
  }, e._configure = function(b) {
1277
- n = b, e.create = s(), n._configure();
1279
+ o = b, e.create = s(), o._configure();
1278
1280
  }, writer;
1279
1281
  }
1280
1282
  var writer_buffer, hasRequiredWriter_buffer;
@@ -1283,60 +1285,60 @@ function requireWriter_buffer() {
1283
1285
  hasRequiredWriter_buffer = 1, writer_buffer = a;
1284
1286
  var h = requireWriter();
1285
1287
  (a.prototype = Object.create(h.prototype)).constructor = a;
1286
- var n = requireMinimal$1();
1288
+ var o = requireMinimal$1();
1287
1289
  function a() {
1288
1290
  h.call(this);
1289
1291
  }
1290
1292
  a._configure = function() {
1291
- a.alloc = n._Buffer_allocUnsafe, a.writeBytesBuffer = n.Buffer && n.Buffer.prototype instanceof Uint8Array && n.Buffer.prototype.set.name === "set" ? function(o, i, t) {
1292
- i.set(o, t);
1293
- } : function(o, i, t) {
1294
- if (o.copy)
1295
- o.copy(i, t, 0, o.length);
1296
- else for (var e = 0; e < o.length; )
1297
- i[t++] = o[e++];
1293
+ a.alloc = o._Buffer_allocUnsafe, a.writeBytesBuffer = o.Buffer && o.Buffer.prototype instanceof Uint8Array && o.Buffer.prototype.set.name === "set" ? function(n, i, t) {
1294
+ i.set(n, t);
1295
+ } : function(n, i, t) {
1296
+ if (n.copy)
1297
+ n.copy(i, t, 0, n.length);
1298
+ else for (var e = 0; e < n.length; )
1299
+ i[t++] = n[e++];
1298
1300
  };
1299
- }, a.prototype.bytes = function(o) {
1300
- n.isString(o) && (o = n._Buffer_from(o, "base64"));
1301
- var i = o.length >>> 0;
1302
- return this.uint32(i), i && this._push(a.writeBytesBuffer, i, o), this;
1301
+ }, a.prototype.bytes = function(n) {
1302
+ o.isString(n) && (n = o._Buffer_from(n, "base64"));
1303
+ var i = n.length >>> 0;
1304
+ return this.uint32(i), i && this._push(a.writeBytesBuffer, i, n), this;
1303
1305
  };
1304
- function u(r, o, i) {
1305
- r.length < 40 ? n.utf8.write(r, o, i) : o.utf8Write ? o.utf8Write(r, i) : o.write(r, i);
1306
+ function u(r, n, i) {
1307
+ r.length < 40 ? o.utf8.write(r, n, i) : n.utf8Write ? n.utf8Write(r, i) : n.write(r, i);
1306
1308
  }
1307
- return a.prototype.string = function(o) {
1308
- var i = n.Buffer.byteLength(o);
1309
- return this.uint32(i), i && this._push(u, i, o), this;
1309
+ return a.prototype.string = function(n) {
1310
+ var i = o.Buffer.byteLength(n);
1311
+ return this.uint32(i), i && this._push(u, i, n), this;
1310
1312
  }, a._configure(), writer_buffer;
1311
1313
  }
1312
1314
  var reader, hasRequiredReader;
1313
1315
  function requireReader() {
1314
1316
  if (hasRequiredReader) return reader;
1315
- hasRequiredReader = 1, reader = o;
1316
- var h = requireMinimal$1(), n, a = h.LongBits, u = h.utf8;
1317
+ hasRequiredReader = 1, reader = n;
1318
+ var h = requireMinimal$1(), o, a = h.LongBits, u = h.utf8;
1317
1319
  function r(c, d) {
1318
1320
  return RangeError("index out of range: " + c.pos + " + " + (d || 1) + " > " + c.len);
1319
1321
  }
1320
- function o(c) {
1322
+ function n(c) {
1321
1323
  this.buf = c, this.pos = 0, this.len = c.length;
1322
1324
  }
1323
1325
  var i = typeof Uint8Array < "u" ? function(d) {
1324
1326
  if (d instanceof Uint8Array || Array.isArray(d))
1325
- return new o(d);
1327
+ return new n(d);
1326
1328
  throw Error("illegal buffer");
1327
1329
  } : function(d) {
1328
1330
  if (Array.isArray(d))
1329
- return new o(d);
1331
+ return new n(d);
1330
1332
  throw Error("illegal buffer");
1331
1333
  }, t = function() {
1332
1334
  return h.Buffer ? function(p) {
1333
- return (o.create = function(w) {
1334
- return h.Buffer.isBuffer(w) ? new n(w) : i(w);
1335
+ return (n.create = function(w) {
1336
+ return h.Buffer.isBuffer(w) ? new o(w) : i(w);
1335
1337
  })(p);
1336
1338
  } : i;
1337
1339
  };
1338
- o.create = t(), o.prototype._slice = h.Array.prototype.subarray || /* istanbul ignore next */
1339
- h.Array.prototype.slice, o.prototype.uint32 = /* @__PURE__ */ function() {
1340
+ n.create = t(), n.prototype._slice = h.Array.prototype.subarray || /* istanbul ignore next */
1341
+ h.Array.prototype.slice, n.prototype.uint32 = /* @__PURE__ */ function() {
1340
1342
  var d = 4294967295;
1341
1343
  return function() {
1342
1344
  if (d = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (d = (d | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (d = (d | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (d = (d | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (d = (d | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return d;
@@ -1344,9 +1346,9 @@ function requireReader() {
1344
1346
  throw this.pos = this.len, r(this, 10);
1345
1347
  return d;
1346
1348
  };
1347
- }(), o.prototype.int32 = function() {
1349
+ }(), n.prototype.int32 = function() {
1348
1350
  return this.uint32() | 0;
1349
- }, o.prototype.sint32 = function() {
1351
+ }, n.prototype.sint32 = function() {
1350
1352
  var d = this.uint32();
1351
1353
  return d >>> 1 ^ -(d & 1) | 0;
1352
1354
  };
@@ -1381,17 +1383,17 @@ function requireReader() {
1381
1383
  }
1382
1384
  throw Error("invalid varint encoding");
1383
1385
  }
1384
- o.prototype.bool = function() {
1386
+ n.prototype.bool = function() {
1385
1387
  return this.uint32() !== 0;
1386
1388
  };
1387
1389
  function s(c, d) {
1388
1390
  return (c[d - 4] | c[d - 3] << 8 | c[d - 2] << 16 | c[d - 1] << 24) >>> 0;
1389
1391
  }
1390
- o.prototype.fixed32 = function() {
1392
+ n.prototype.fixed32 = function() {
1391
1393
  if (this.pos + 4 > this.len)
1392
1394
  throw r(this, 4);
1393
1395
  return s(this.buf, this.pos += 4);
1394
- }, o.prototype.sfixed32 = function() {
1396
+ }, n.prototype.sfixed32 = function() {
1395
1397
  if (this.pos + 4 > this.len)
1396
1398
  throw r(this, 4);
1397
1399
  return s(this.buf, this.pos += 4) | 0;
@@ -1401,17 +1403,17 @@ function requireReader() {
1401
1403
  throw r(this, 8);
1402
1404
  return new a(s(this.buf, this.pos += 4), s(this.buf, this.pos += 4));
1403
1405
  }
1404
- return o.prototype.float = function() {
1406
+ return n.prototype.float = function() {
1405
1407
  if (this.pos + 4 > this.len)
1406
1408
  throw r(this, 4);
1407
1409
  var d = h.float.readFloatLE(this.buf, this.pos);
1408
1410
  return this.pos += 4, d;
1409
- }, o.prototype.double = function() {
1411
+ }, n.prototype.double = function() {
1410
1412
  if (this.pos + 8 > this.len)
1411
1413
  throw r(this, 4);
1412
1414
  var d = h.float.readDoubleLE(this.buf, this.pos);
1413
1415
  return this.pos += 8, d;
1414
- }, o.prototype.bytes = function() {
1416
+ }, n.prototype.bytes = function() {
1415
1417
  var d = this.uint32(), p = this.pos, f = this.pos + d;
1416
1418
  if (f > this.len)
1417
1419
  throw r(this, d);
@@ -1422,10 +1424,10 @@ function requireReader() {
1422
1424
  return w ? w.alloc(0) : new this.buf.constructor(0);
1423
1425
  }
1424
1426
  return this._slice.call(this.buf, p, f);
1425
- }, o.prototype.string = function() {
1427
+ }, n.prototype.string = function() {
1426
1428
  var d = this.bytes();
1427
1429
  return u.read(d, 0, d.length);
1428
- }, o.prototype.skip = function(d) {
1430
+ }, n.prototype.skip = function(d) {
1429
1431
  if (typeof d == "number") {
1430
1432
  if (this.pos + d > this.len)
1431
1433
  throw r(this, d);
@@ -1436,7 +1438,7 @@ function requireReader() {
1436
1438
  throw r(this);
1437
1439
  while (this.buf[this.pos++] & 128);
1438
1440
  return this;
1439
- }, o.prototype.skipType = function(c) {
1441
+ }, n.prototype.skipType = function(c) {
1440
1442
  switch (c) {
1441
1443
  case 0:
1442
1444
  this.skip();
@@ -1459,13 +1461,13 @@ function requireReader() {
1459
1461
  throw Error("invalid wire type " + c + " at offset " + this.pos);
1460
1462
  }
1461
1463
  return this;
1462
- }, o._configure = function(c) {
1463
- n = c, o.create = t(), n._configure();
1464
+ }, n._configure = function(c) {
1465
+ o = c, n.create = t(), o._configure();
1464
1466
  var d = h.Long ? "toLong" : (
1465
1467
  /* istanbul ignore next */
1466
1468
  "toNumber"
1467
1469
  );
1468
- h.merge(o.prototype, {
1470
+ h.merge(n.prototype, {
1469
1471
  int64: function() {
1470
1472
  return e.call(this)[d](!1);
1471
1473
  },
@@ -1490,12 +1492,12 @@ function requireReader_buffer() {
1490
1492
  hasRequiredReader_buffer = 1, reader_buffer = a;
1491
1493
  var h = requireReader();
1492
1494
  (a.prototype = Object.create(h.prototype)).constructor = a;
1493
- var n = requireMinimal$1();
1495
+ var o = requireMinimal$1();
1494
1496
  function a(u) {
1495
1497
  h.call(this, u);
1496
1498
  }
1497
1499
  return a._configure = function() {
1498
- n.Buffer && (a.prototype._slice = n.Buffer.prototype.slice);
1500
+ o.Buffer && (a.prototype._slice = o.Buffer.prototype.slice);
1499
1501
  }, a.prototype.string = function() {
1500
1502
  var r = this.uint32();
1501
1503
  return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + r, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + r, this.len));
@@ -1504,20 +1506,20 @@ function requireReader_buffer() {
1504
1506
  var rpc = {}, service, hasRequiredService;
1505
1507
  function requireService() {
1506
1508
  if (hasRequiredService) return service;
1507
- hasRequiredService = 1, service = n;
1509
+ hasRequiredService = 1, service = o;
1508
1510
  var h = requireMinimal$1();
1509
- (n.prototype = Object.create(h.EventEmitter.prototype)).constructor = n;
1510
- function n(a, u, r) {
1511
+ (o.prototype = Object.create(h.EventEmitter.prototype)).constructor = o;
1512
+ function o(a, u, r) {
1511
1513
  if (typeof a != "function")
1512
1514
  throw TypeError("rpcImpl must be a function");
1513
1515
  h.EventEmitter.call(this), this.rpcImpl = a, this.requestDelimited = !!u, this.responseDelimited = !!r;
1514
1516
  }
1515
- return n.prototype.rpcCall = function a(u, r, o, i, t) {
1517
+ return o.prototype.rpcCall = function a(u, r, n, i, t) {
1516
1518
  if (!i)
1517
1519
  throw TypeError("request must be specified");
1518
1520
  var e = this;
1519
1521
  if (!t)
1520
- return h.asPromise(a, e, u, r, o, i);
1522
+ return h.asPromise(a, e, u, r, n, i);
1521
1523
  if (!e.rpcImpl) {
1522
1524
  setTimeout(function() {
1523
1525
  t(Error("already ended"));
@@ -1538,9 +1540,9 @@ function requireService() {
1538
1540
  );
1539
1541
  return;
1540
1542
  }
1541
- if (!(c instanceof o))
1543
+ if (!(c instanceof n))
1542
1544
  try {
1543
- c = o[e.responseDelimited ? "decodeDelimited" : "decode"](c);
1545
+ c = n[e.responseDelimited ? "decodeDelimited" : "decode"](c);
1544
1546
  } catch (d) {
1545
1547
  return e.emit("error", d, u), t(d);
1546
1548
  }
@@ -1553,15 +1555,15 @@ function requireService() {
1553
1555
  }, 0);
1554
1556
  return;
1555
1557
  }
1556
- }, n.prototype.end = function(u) {
1558
+ }, o.prototype.end = function(u) {
1557
1559
  return this.rpcImpl && (u || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
1558
1560
  }, service;
1559
1561
  }
1560
1562
  var hasRequiredRpc;
1561
1563
  function requireRpc() {
1562
1564
  return hasRequiredRpc || (hasRequiredRpc = 1, function(h) {
1563
- var n = h;
1564
- n.Service = requireService();
1565
+ var o = h;
1566
+ o.Service = requireService();
1565
1567
  }(rpc)), rpc;
1566
1568
  }
1567
1569
  var roots, hasRequiredRoots;
@@ -1571,10 +1573,10 @@ function requireRoots() {
1571
1573
  var hasRequiredIndexMinimal;
1572
1574
  function requireIndexMinimal() {
1573
1575
  return hasRequiredIndexMinimal || (hasRequiredIndexMinimal = 1, function(h) {
1574
- var n = h;
1575
- n.build = "minimal", n.Writer = requireWriter(), n.BufferWriter = requireWriter_buffer(), n.Reader = requireReader(), n.BufferReader = requireReader_buffer(), n.util = requireMinimal$1(), n.rpc = requireRpc(), n.roots = requireRoots(), n.configure = a;
1576
+ var o = h;
1577
+ o.build = "minimal", o.Writer = requireWriter(), o.BufferWriter = requireWriter_buffer(), o.Reader = requireReader(), o.BufferReader = requireReader_buffer(), o.util = requireMinimal$1(), o.rpc = requireRpc(), o.roots = requireRoots(), o.configure = a;
1576
1578
  function a() {
1577
- n.util._configure(), n.Writer._configure(n.BufferWriter), n.Reader._configure(n.BufferReader);
1579
+ o.util._configure(), o.Writer._configure(o.BufferWriter), o.Reader._configure(o.BufferReader);
1578
1580
  }
1579
1581
  a();
1580
1582
  }(indexMinimal)), indexMinimal;
@@ -1587,14 +1589,14 @@ var minimalExports = requireMinimal();
1587
1589
  const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util = minimalExports.util, $root = minimalExports.roots.default || (minimalExports.roots.default = {}), com = $root.com = (() => {
1588
1590
  const h = {};
1589
1591
  return h.quick = function() {
1590
- const n = {};
1591
- return n.voice = function() {
1592
+ const o = {};
1593
+ return o.voice = function() {
1592
1594
  const a = {};
1593
1595
  return a.proto = function() {
1594
1596
  const u = {};
1595
1597
  return u.SeiData = function() {
1596
- function r(o) {
1597
- if (o) for (let i = Object.keys(o), t = 0; t < i.length; ++t) o[i[t]] != null && (this[i[t]] = o[i[t]]);
1598
+ function r(n) {
1599
+ if (n) for (let i = Object.keys(n), t = 0; t < i.length; ++t) n[i[t]] != null && (this[i[t]] = n[i[t]]);
1598
1600
  }
1599
1601
  return r.prototype.event = 0, r.prototype.data = $util.newBuffer([]), r.prototype.compress = !1, r.prototype.version = 0, r.create = function(i) {
1600
1602
  return new r(i);
@@ -1686,17 +1688,17 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1686
1688
  return i === void 0 && (i = "type.googleapis.com"), i + "/com.quick.voice.proto.SeiData";
1687
1689
  }, r;
1688
1690
  }(), u.EventType = function() {
1689
- const r = {}, o = Object.create(r);
1690
- return o[r[0] = "Layout"] = 0, o[r[1] = "Custom"] = 1, o;
1691
+ const r = {}, n = Object.create(r);
1692
+ return n[r[0] = "Layout"] = 0, n[r[1] = "Custom"] = 1, n;
1691
1693
  }(), u.LayoutData = function() {
1692
1694
  function r(i) {
1693
1695
  if (this.userMap = {}, i) for (let t = Object.keys(i), e = 0; e < t.length; ++e) i[t[e]] != null && (this[t[e]] = i[t[e]]);
1694
1696
  }
1695
1697
  r.prototype.roomId = "", r.prototype.type = 0, r.prototype.userMap = $util.emptyObject, r.prototype.globalCustom = null;
1696
- let o;
1698
+ let n;
1697
1699
  return Object.defineProperty(r.prototype, "_globalCustom", {
1698
- get: $util.oneOfGetter(o = ["globalCustom"]),
1699
- set: $util.oneOfSetter(o)
1700
+ get: $util.oneOfGetter(n = ["globalCustom"]),
1701
+ set: $util.oneOfSetter(n)
1700
1702
  }), r.create = function(t) {
1701
1703
  return new r(t);
1702
1704
  }, r.encode = function(t, e) {
@@ -1852,10 +1854,10 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1852
1854
  if (this.audios = [], this.videos = [], i) for (let t = Object.keys(i), e = 0; e < t.length; ++e) i[t[e]] != null && (this[t[e]] = i[t[e]]);
1853
1855
  }
1854
1856
  r.prototype.id = "", r.prototype.audios = $util.emptyArray, r.prototype.videos = $util.emptyArray, r.prototype.custom = null;
1855
- let o;
1857
+ let n;
1856
1858
  return Object.defineProperty(r.prototype, "_custom", {
1857
- get: $util.oneOfGetter(o = ["custom"]),
1858
- set: $util.oneOfSetter(o)
1859
+ get: $util.oneOfGetter(n = ["custom"]),
1860
+ set: $util.oneOfSetter(n)
1859
1861
  }), r.create = function(t) {
1860
1862
  return new r(t);
1861
1863
  }, r.encode = function(t, e) {
@@ -1975,10 +1977,10 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1975
1977
  if (i) for (let t = Object.keys(i), e = 0; e < t.length; ++e) i[t[e]] != null && (this[t[e]] = i[t[e]]);
1976
1978
  }
1977
1979
  r.prototype.type = 0, r.prototype.isEnable = !1, r.prototype.isMute = !1, r.prototype.volume = 0, r.prototype.updateTime = null;
1978
- let o;
1980
+ let n;
1979
1981
  return Object.defineProperty(r.prototype, "_updateTime", {
1980
- get: $util.oneOfGetter(o = ["updateTime"]),
1981
- set: $util.oneOfSetter(o)
1982
+ get: $util.oneOfGetter(n = ["updateTime"]),
1983
+ set: $util.oneOfSetter(n)
1982
1984
  }), r.create = function(t) {
1983
1985
  return new r(t);
1984
1986
  }, r.encode = function(t, e) {
@@ -2080,10 +2082,10 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2080
2082
  if (i) for (let t = Object.keys(i), e = 0; e < t.length; ++e) i[t[e]] != null && (this[t[e]] = i[t[e]]);
2081
2083
  }
2082
2084
  r.prototype.type = 0, r.prototype.isEnable = !1, r.prototype.isMute = !1, r.prototype.width = 0, r.prototype.height = 0, r.prototype.x = 0, r.prototype.y = 0, r.prototype.updateTime = null;
2083
- let o;
2085
+ let n;
2084
2086
  return Object.defineProperty(r.prototype, "_updateTime", {
2085
- get: $util.oneOfGetter(o = ["updateTime"]),
2086
- set: $util.oneOfSetter(o)
2087
+ get: $util.oneOfGetter(n = ["updateTime"]),
2088
+ set: $util.oneOfSetter(n)
2087
2089
  }), r.create = function(t) {
2088
2090
  return new r(t);
2089
2091
  }, r.encode = function(t, e) {
@@ -2206,10 +2208,10 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2206
2208
  if (this.customKeyMap = {}, i) for (let t = Object.keys(i), e = 0; e < t.length; ++e) i[t[e]] != null && (this[t[e]] = i[t[e]]);
2207
2209
  }
2208
2210
  r.prototype.roomId = "", r.prototype.customKeyMap = $util.emptyObject, r.prototype.updateTime = null;
2209
- let o;
2211
+ let n;
2210
2212
  return Object.defineProperty(r.prototype, "_updateTime", {
2211
- get: $util.oneOfGetter(o = ["updateTime"]),
2212
- set: $util.oneOfSetter(o)
2213
+ get: $util.oneOfGetter(n = ["updateTime"]),
2214
+ set: $util.oneOfSetter(n)
2213
2215
  }), r.create = function(t) {
2214
2216
  return new r(t);
2215
2217
  }, r.encode = function(t, e) {
@@ -2309,17 +2311,17 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2309
2311
  return t === void 0 && (t = "type.googleapis.com"), t + "/com.quick.voice.proto.CustomInfo";
2310
2312
  }, r;
2311
2313
  }(), u.LayoutType = function() {
2312
- const r = {}, o = Object.create(r);
2313
- return o[r[0] = "AudioAndVideo"] = 0, o[r[1] = "OnlyAudio"] = 1, o[r[2] = "OnlyVideo"] = 2, o;
2314
+ const r = {}, n = Object.create(r);
2315
+ return n[r[0] = "AudioAndVideo"] = 0, n[r[1] = "OnlyAudio"] = 1, n[r[2] = "OnlyVideo"] = 2, n;
2314
2316
  }(), u.AudioType = function() {
2315
- const r = {}, o = Object.create(r);
2316
- return o[r[0] = "Microphone"] = 0, o[r[1] = "SystemVoice"] = 1, o;
2317
+ const r = {}, n = Object.create(r);
2318
+ return n[r[0] = "Microphone"] = 0, n[r[1] = "SystemVoice"] = 1, n;
2317
2319
  }(), u.VideoType = function() {
2318
- const r = {}, o = Object.create(r);
2319
- return o[r[0] = "Camera"] = 0, o[r[1] = "Screen"] = 1, o;
2320
+ const r = {}, n = Object.create(r);
2321
+ return n[r[0] = "Camera"] = 0, n[r[1] = "Screen"] = 1, n;
2320
2322
  }(), u;
2321
2323
  }(), a;
2322
- }(), n;
2324
+ }(), o;
2323
2325
  }(), h;
2324
2326
  })(), createAudioInfo = () => ({
2325
2327
  remove: !1,
@@ -2350,14 +2352,14 @@ class RoomUser {
2350
2352
  // 屏幕共享音频
2351
2353
  m(this, "updateTime", 0);
2352
2354
  m(this, "getUpdateTimeKey", () => {
2353
- const n = [];
2354
- return this.mc_audio && n.push(this.mc_audio.updateTime), this.mc_video && n.push(this.mc_video.updateTime), this.ss_audio && n.push(this.ss_audio.updateTime), this.ss_video && n.push(this.ss_video.updateTime), n.join("_");
2355
+ const o = [];
2356
+ return this.mc_audio && o.push(this.mc_audio.updateTime), this.mc_video && o.push(this.mc_video.updateTime), this.ss_audio && o.push(this.ss_audio.updateTime), this.ss_video && o.push(this.ss_video.updateTime), o.join("_");
2355
2357
  });
2356
- m(this, "init", (n) => {
2358
+ m(this, "init", (o) => {
2357
2359
  var t, e, s, l;
2358
- const { id: a, audios: u = [], videos: r = [] } = n;
2360
+ const { id: a, audios: u = [], videos: r = [] } = o;
2359
2361
  this.userId = a;
2360
- const o = this.getUpdateTimeKey();
2362
+ const n = this.getUpdateTimeKey();
2361
2363
  this.mc_audio && (this.mc_audio.remove = !0), this.mc_video && (this.mc_video.remove = !0), this.ss_audio && (this.ss_audio.remove = !0), this.ss_video && (this.ss_video.remove = !0);
2362
2364
  for (const c of u) {
2363
2365
  const { type: d = 0, isEnable: p = !1, isMute: f = !1, updateTime: w, volume: b = 0 } = c;
@@ -2395,29 +2397,29 @@ class RoomUser {
2395
2397
  }
2396
2398
  (t = this.mc_audio) != null && t.remove && (this.mc_audio = void 0), (e = this.mc_video) != null && e.remove && (this.mc_video = void 0), (s = this.ss_audio) != null && s.remove && (this.ss_audio = void 0), (l = this.ss_video) != null && l.remove && (this.ss_video = void 0);
2397
2399
  const i = this.getUpdateTimeKey();
2398
- o !== i && (this.updateTime = (/* @__PURE__ */ new Date()).getTime());
2400
+ n !== i && (this.updateTime = (/* @__PURE__ */ new Date()).getTime());
2399
2401
  });
2400
2402
  m(this, "destroy", () => {
2401
- var n, a;
2402
- (n = this.mc_video) != null && n.destroy && this.mc_video.destroy(), (a = this.ss_video) != null && a.destroy && this.ss_video.destroy(), this.mc_audio = void 0, this.mc_video = void 0, this.ss_audio = void 0, this.ss_video = void 0;
2403
+ var o, a;
2404
+ (o = this.mc_video) != null && o.destroy && this.mc_video.destroy(), (a = this.ss_video) != null && a.destroy && this.ss_video.destroy(), this.mc_audio = void 0, this.mc_video = void 0, this.ss_audio = void 0, this.ss_video = void 0;
2403
2405
  });
2404
2406
  }
2405
2407
  }
2406
2408
  const parseSEI = (h) => {
2407
- let n = 0, a = 0;
2409
+ let o = 0, a = 0;
2408
2410
  for (; ; ) {
2409
- const r = h[n];
2410
- if (a = a + r, n = n + 1, r !== 255) break;
2411
+ const r = h[o];
2412
+ if (a = a + r, o = o + 1, r !== 255) break;
2411
2413
  }
2412
2414
  let u = 0;
2413
2415
  for (; ; ) {
2414
- const r = h[n];
2415
- if (u = u + r, n = n + 1, r !== 255) break;
2416
+ const r = h[o];
2417
+ if (u = u + r, o = o + 1, r !== 255) break;
2416
2418
  }
2417
2419
  if (a === 5) {
2418
- const r = h.slice(n, n + 16), i = Array.from(r, (f) => f.toString(16).padStart(2, "0")).join("");
2419
- n = n + 16;
2420
- const t = u - 16, e = h.slice(n, n + t), s = com.quick.voice.proto.SeiData.decode(e), { event: l = 0 } = s, c = s.data;
2420
+ const r = h.slice(o, o + 16), i = Array.from(r, (f) => f.toString(16).padStart(2, "0")).join("");
2421
+ o = o + 16;
2422
+ const t = u - 16, e = h.slice(o, o + t), s = com.quick.voice.proto.SeiData.decode(e), { event: l = 0 } = s, c = s.data;
2421
2423
  let d;
2422
2424
  switch (l) {
2423
2425
  case 0:
@@ -2431,9 +2433,10 @@ const parseSEI = (h) => {
2431
2433
  }
2432
2434
  };
2433
2435
  class QuickVoPlayer {
2434
- constructor(n = {}) {
2436
+ constructor(o = {}) {
2435
2437
  m(this, "option", {
2436
- debug: !1
2438
+ debug: !1,
2439
+ ws: "wss://livep2p.devplay.cc/websocket"
2437
2440
  });
2438
2441
  m(this, "displayMode", "original");
2439
2442
  m(this, "prPlayer");
@@ -2446,46 +2449,46 @@ class QuickVoPlayer {
2446
2449
  });
2447
2450
  m(this, "usersMap", /* @__PURE__ */ new Map());
2448
2451
  m(this, "on", {
2449
- users: (n) => {
2452
+ users: (o) => {
2450
2453
  }
2451
2454
  });
2452
- m(this, "start", async (n) => (this.stop(), this.prPlayer.start(n)));
2455
+ m(this, "start", async (o) => (this.stop(), this.prPlayer.start(o)));
2453
2456
  m(this, "stop", () => {
2454
2457
  this.prPlayer.stop(), this.usersMap = /* @__PURE__ */ new Map(), this.room.roomId = "", this.room.author = "", this.room.updateTime = "", this.room.version = "";
2455
2458
  });
2456
- m(this, "setMute", (n) => {
2457
- this.prPlayer.setMute(n);
2459
+ m(this, "setMute", (o) => {
2460
+ this.prPlayer.setMute(o);
2458
2461
  });
2459
2462
  m(this, "getStream", () => this.prPlayer.getStream());
2460
2463
  m(this, "getAllUseUpdateKey", () => {
2461
- const n = [...this.usersMap.values()];
2462
- return Array.from(n, (u) => u.updateTime).join("_");
2464
+ const o = [...this.usersMap.values()];
2465
+ return Array.from(o, (u) => u.updateTime).join("_");
2463
2466
  });
2464
- m(this, "checkAndCreateUser", (n, a) => {
2467
+ m(this, "checkAndCreateUser", (o, a) => {
2465
2468
  var u, r;
2466
- if (this.usersMap.has(n)) {
2467
- const o = this.usersMap.get(n);
2468
- if (o == null || o.init(a), o != null && o.mc_video) {
2469
- const { sx: i, sy: t, sw: e, sh: s } = o.mc_video;
2470
- (u = o == null ? void 0 : o.mc_video.worker) == null || u.setCut({ sx: i, sy: t, sw: e, sh: s });
2469
+ if (this.usersMap.has(o)) {
2470
+ const n = this.usersMap.get(o);
2471
+ if (n == null || n.init(a), n != null && n.mc_video) {
2472
+ const { sx: i, sy: t, sw: e, sh: s } = n.mc_video;
2473
+ (u = n == null ? void 0 : n.mc_video.worker) == null || u.setCut({ sx: i, sy: t, sw: e, sh: s });
2471
2474
  }
2472
- if (o != null && o.ss_video) {
2473
- const { sx: i, sy: t, sw: e, sh: s } = o.ss_video;
2474
- (r = o == null ? void 0 : o.ss_video.worker) == null || r.setCut({ sx: i, sy: t, sw: e, sh: s });
2475
+ if (n != null && n.ss_video) {
2476
+ const { sx: i, sy: t, sw: e, sh: s } = n.ss_video;
2477
+ (r = n == null ? void 0 : n.ss_video.worker) == null || r.setCut({ sx: i, sy: t, sw: e, sh: s });
2475
2478
  }
2476
2479
  } else {
2477
- const o = new RoomUser();
2478
- if (this.usersMap.set(n, o), o.init(a), o) {
2479
- if (o.mc_video) {
2480
- const { sx: i, sy: t, sw: e, sh: s } = o.mc_video, l = `${o.userId}_mc_video`, { worker: c, stream: d, destroy: p } = this.prPlayer.cut.create(l, { sx: i, sy: t, sw: e, sh: s });
2481
- o.mc_video.worker = c, this.displayMode === "original" && c.setPause(!0), o.mc_video.stream = d, o.mc_video.destroy = () => {
2482
- p(), this.prPlayer.cut.remove(l), this.usersMap.delete(o.userId);
2480
+ const n = new RoomUser();
2481
+ if (this.usersMap.set(o, n), n.init(a), n) {
2482
+ if (n.mc_video) {
2483
+ const { sx: i, sy: t, sw: e, sh: s } = n.mc_video, l = `${n.userId}_mc_video`, { worker: c, stream: d, destroy: p } = this.prPlayer.cut.create(l, { sx: i, sy: t, sw: e, sh: s });
2484
+ n.mc_video.worker = c, this.displayMode === "original" && c.setPause(!0), n.mc_video.stream = d, n.mc_video.destroy = () => {
2485
+ p(), this.prPlayer.cut.remove(l), this.usersMap.delete(n.userId);
2483
2486
  };
2484
2487
  }
2485
- if (o.ss_video) {
2486
- const { sx: i, sy: t, sw: e, sh: s } = o.ss_video, l = `${o.userId}_ss_video`, { worker: c, stream: d, destroy: p } = this.prPlayer.cut.create(l, { sx: i, sy: t, sw: e, sh: s });
2487
- o.ss_video.worker = c, this.displayMode === "original" && c.setPause(!0), o.ss_video.stream = d, o.ss_video.destroy = () => {
2488
- p(), this.prPlayer.cut.remove(l), this.usersMap.delete(o.userId);
2488
+ if (n.ss_video) {
2489
+ const { sx: i, sy: t, sw: e, sh: s } = n.ss_video, l = `${n.userId}_ss_video`, { worker: c, stream: d, destroy: p } = this.prPlayer.cut.create(l, { sx: i, sy: t, sw: e, sh: s });
2490
+ n.ss_video.worker = c, this.displayMode === "original" && c.setPause(!0), n.ss_video.stream = d, n.ss_video.destroy = () => {
2491
+ p(), this.prPlayer.cut.remove(l), this.usersMap.delete(n.userId);
2489
2492
  };
2490
2493
  }
2491
2494
  }
@@ -2494,16 +2497,16 @@ class QuickVoPlayer {
2494
2497
  /**
2495
2498
  * 监听SEI信息
2496
2499
  */
2497
- m(this, "onSEI", (n) => {
2500
+ m(this, "onSEI", (o) => {
2498
2501
  try {
2499
- const a = parseSEI(n);
2502
+ const a = parseSEI(o);
2500
2503
  if (!a) return;
2501
2504
  const { event: u, data: r } = a;
2502
2505
  switch (u) {
2503
2506
  case 0:
2504
2507
  {
2505
- const { roomId: o, userMap: i } = r;
2506
- if (o !== this.room.roomId) return;
2508
+ const { roomId: n, userMap: i } = r;
2509
+ if (n !== this.room.roomId) return;
2507
2510
  const t = this.getAllUseUpdateKey(), e = Object.keys(i);
2508
2511
  {
2509
2512
  const l = [...this.usersMap.values()];
@@ -2523,8 +2526,8 @@ class QuickVoPlayer {
2523
2526
  break;
2524
2527
  case 1:
2525
2528
  {
2526
- const { roomId: o, updateTime: i } = r, { author: t, version: e } = r.customKeyMap;
2527
- this.room.roomId = o, this.room.updateTime = i, this.room.author = t, this.room.version = e;
2529
+ const { roomId: n, updateTime: i } = r, { author: t, version: e } = r.customKeyMap;
2530
+ this.room.roomId = n, this.room.updateTime = i, this.room.author = t, this.room.version = e;
2528
2531
  }
2529
2532
  break;
2530
2533
  }
@@ -2532,15 +2535,15 @@ class QuickVoPlayer {
2532
2535
  console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->onSEI: error", a);
2533
2536
  }
2534
2537
  });
2535
- m(this, "setDisplayMode", (n) => {
2536
- var a, u, r, o, i, t, e, s;
2537
- switch (this.displayMode = n, n) {
2538
+ m(this, "setDisplayMode", (o) => {
2539
+ var a, u, r, n, i, t, e, s;
2540
+ switch (this.displayMode = o, o) {
2538
2541
  case "original":
2539
2542
  {
2540
2543
  this.prPlayer.setPause(!1);
2541
2544
  const l = [...this.usersMap.values()];
2542
2545
  for (const c of l)
2543
- (u = (a = c.mc_video) == null ? void 0 : a.worker) == null || u.setPause(!0), (o = (r = c.ss_video) == null ? void 0 : r.worker) == null || o.setPause(!0);
2546
+ (u = (a = c.mc_video) == null ? void 0 : a.worker) == null || u.setPause(!0), (n = (r = c.ss_video) == null ? void 0 : r.worker) == null || n.setPause(!0);
2544
2547
  }
2545
2548
  break;
2546
2549
  case "cut":
@@ -2553,7 +2556,7 @@ class QuickVoPlayer {
2553
2556
  break;
2554
2557
  }
2555
2558
  });
2556
- const { debug: a = !1 } = n;
2559
+ const { debug: a = !1 } = o;
2557
2560
  this.option.debug = a, this.prPlayer = new et({ debug: a }), this.prPlayer.on.demuxer.chunk = (u) => {
2558
2561
  }, this.prPlayer.on.decoder.sei = this.onSEI;
2559
2562
  }