quickvo-player 0.1.1 → 0.1.3

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
@@ -1,15 +1,15 @@
1
- var Z = Object.defineProperty;
1
+ var Q = Object.defineProperty;
2
2
  var X = (h) => {
3
3
  throw TypeError(h);
4
4
  };
5
- var tt = (h, o, a) => o in h ? Z(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), Q = (h, o, a) => o.has(h) || X("Cannot " + a);
7
- var I = (h, o, a) => (Q(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), K = (h, o, a, u) => (Q(h, o, "write to private field"), u ? u.call(h, a) : o.set(h, a), a);
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),8))}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.debug=y=>postMessage({action:"onDebug",data:y}),A.on.info=y=>postMessage({action:"onInfo",data:y}),A.on.config=y=>postMessage({action:"onConfig",data:y}),A.on.chunk=y=>postMessage({action:"onChunk",data:y}),onmessage=y=>{const{action:t,data:s}=y.data,e=A[t];e&&e(s)}})();\n', v = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", D], { type: "text/javascript;charset=utf-8" });
9
- function B(h) {
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
+ 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.debug=y=>postMessage({action:"onDebug",data:y}),A.on.info=y=>postMessage({action:"onInfo",data:y}),A.on.config=y=>postMessage({action:"onConfig",data:y}),A.on.chunk=y=>postMessage({action:"onChunk",data:y}),onmessage=y=>{const{action:t,data:s}=y.data,e=A[t];e&&e(s)}})();\n', T = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", D], { type: "text/javascript;charset=utf-8" });
9
+ function L(h) {
10
10
  let o;
11
11
  try {
12
- if (o = v && (self.URL || self.webkitURL).createObjectURL(v), !o) throw "";
12
+ if (o = T && (self.URL || self.webkitURL).createObjectURL(T), !o) throw "";
13
13
  const a = new Worker(o, {
14
14
  name: h == null ? void 0 : h.name
15
15
  });
@@ -25,9 +25,9 @@ function B(h) {
25
25
  );
26
26
  }
27
27
  }
28
- class L {
28
+ class N {
29
29
  constructor() {
30
- m(this, "worker", new B());
30
+ m(this, "worker", new L());
31
31
  m(this, "on", {});
32
32
  m(this, "init", (o) => this.worker.postMessage({ action: "init", data: o }));
33
33
  m(this, "push", (o) => this.worker.postMessage({ action: "push", data: o }));
@@ -53,12 +53,12 @@ class L {
53
53
  };
54
54
  }
55
55
  }
56
- const M = `(function(){"use strict";class r{audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;on={audio:{},video:{}};constructor(){}audio={init:i=>{this.audio.destroy(),this.audioDecoderConfig={...i},this.audioDecoder=new AudioDecoder({output:e=>{this.on.audio.decode&&this.on.audio.decode(e)},error:e=>{this.on.audio.error&&this.on.audio.error(e)}}),this.audioDecoder.configure(this.audioDecoderConfig)},decode:i=>{if(!this.audioDecoder)return;const e=new EncodedAudioChunk(i);this.audioDecoder.decode(e)},flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={init:i=>{this.video.destroy(),this.videoDecoderConfig={...i},this.videoDecoder=new VideoDecoder({output:async e=>{const d=await createImageBitmap(e),s=e.timestamp;e.close(),d.width>0&&d.height>0?this.on.video.decode&&this.on.video.decode({timestamp:s,bitmap:d}):d.close()},error:e=>{console.log("\\x1B[38;2;0;151;255m%c%s\\x1B[0m","color:#0097ff;","------->Breathe: e",e),this.on.video.error&&this.on.video.error(e)}}),this.videoDecoder.configure(this.videoDecoderConfig)},decode:i=>{if(this.videoDecoder&&(i.type==="key"&&(this.hasKeyFrame=!0),this.hasKeyFrame&&this.videoDecoder.decodeQueueSize<2)){const e=new EncodedVideoChunk(i);this.videoDecoder.decode(e)}},flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}}const t=new r;t.on.audio.decode=o=>postMessage({type:"audio",action:"onDecode",data:o}),t.on.audio.error=o=>postMessage({type:"audio",action:"onError",data:o}),t.on.video.decode=o=>postMessage({type:"video",action:"onDecode",data:o}),t.on.video.error=o=>postMessage({type:"video",action:"onError",data:o}),onmessage=o=>{const{type:i,action:e,data:d}=o.data,s=t[i][e];s&&s(d)}})();
57
- `, T = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", M], { type: "text/javascript;charset=utf-8" });
56
+ const S = `(function(){"use strict";class n{audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];isProcessing=!1;decodeTimer=0;frameTrack=!1;minFrameTrackCacheNum=20;decodingSpeed=40;decodingSpeedRatio=1;maxDecodingSpeedRatio=2;nextRenderTime;on={audio:{},video:{}};constructor(){this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()}init=e=>{const{decodingSpeed:i,frameTrack:d,minFrameTrackCacheNum:o}=e;i!==void 0&&(this.decodingSpeed=i),d!==void 0&&(this.frameTrack=d),o!==void 0&&(this.minFrameTrackCacheNum=o)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio;const i=this.baseTime+performance.now();if(this.nextRenderTime){const d=i-this.nextRenderTime;e-=d}this.nextRenderTime=i+e,this.decodeTimer=setTimeout(()=>{this.decode(),this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;;){const e=this.pendingChunks.shift();if(this.frameTrack){const o=this.pendingChunks.length;if(o>=this.minFrameTrackCacheNum){const r=Math.min(1+(o-this.minFrameTrackCacheNum)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(r.toFixed(1))}else this.decodingSpeedRatio=1}if(!e)break;const{type:i,init:d}=e;switch(i){case"audio":this.decodeAudio(d);break;case"video":this.decodeVideo(d);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.hasKeyFrame)){const i=new EncodedVideoChunk(e);this.videoDecoder.decode(i)}};destroy=()=>{this.audio.destroy(),this.video.destroy(),clearInterval(this.decodeTimer)};audio={init:e=>{this.audio.destroy(),this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:i=>{const d=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:i,playbackRate:d})},error:i=>{this.on.audio.error&&this.on.audio.error(i)}}),this.audioDecoder.configure(this.audioDecoderConfig)},push:e=>{this.pendingChunks.push({type:"audio",init:e})},flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={init:e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:async i=>{const d=i.timestamp+this.baseTime*1e3,o=await createImageBitmap(i);i.close(),o.width>0&&o.height>0?this.on.video.decode&&this.on.video.decode({timestamp:d,bitmap:o}):o.close()},error:i=>{this.on.video.error&&this.on.video.error(i)}}),this.videoDecoder.configure(this.videoDecoderConfig)},push:e=>{this.pendingChunks.push({type:"video",init:e})},flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}}const s=new n;s.on.audio.decode=t=>postMessage({type:"audio",action:"onDecode",data:t}),s.on.audio.error=t=>postMessage({type:"audio",action:"onError",data:t}),s.on.video.decode=t=>postMessage({type:"video",action:"onDecode",data:t}),s.on.video.error=t=>postMessage({type:"video",action:"onError",data:t}),onmessage=t=>{const{type:e,action:i,data:d}=t.data;if(e){const o=s[e][i];o&&o(d)}else{const o=s[i];o&&o(d)}}})();
57
+ `, v = 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
59
  let o;
60
60
  try {
61
- if (o = T && (self.URL || self.webkitURL).createObjectURL(T), !o) throw "";
61
+ if (o = v && (self.URL || self.webkitURL).createObjectURL(v), !o) throw "";
62
62
  const a = new Worker(o, {
63
63
  name: h == null ? void 0 : h.name
64
64
  });
@@ -67,20 +67,22 @@ function F(h) {
67
67
  }), a;
68
68
  } catch {
69
69
  return new Worker(
70
- "data:text/javascript;charset=utf-8," + encodeURIComponent(M),
70
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(S),
71
71
  {
72
72
  name: h == null ? void 0 : h.name
73
73
  }
74
74
  );
75
75
  }
76
76
  }
77
- class N {
77
+ class B {
78
78
  constructor() {
79
79
  m(this, "worker", new F());
80
80
  m(this, "on", { audio: {}, video: {} });
81
+ m(this, "init", (o) => this.worker.postMessage({ action: "init", data: o }));
82
+ m(this, "setFrameTrack", (o) => this.worker.postMessage({ action: "setFrameTrack", data: o }));
81
83
  m(this, "audio", {
82
84
  init: (o) => this.worker.postMessage({ type: "audio", action: "init", data: o }),
83
- decode: (o) => this.worker.postMessage({ type: "audio", action: "decode", data: o }),
85
+ push: (o) => this.worker.postMessage({ type: "audio", action: "push", data: o }),
84
86
  flush: () => this.worker.postMessage({ type: "audio", action: "flush" }),
85
87
  destroy: () => {
86
88
  this.worker.postMessage({ type: "audio", action: "destroy" });
@@ -88,23 +90,23 @@ class N {
88
90
  });
89
91
  m(this, "video", {
90
92
  init: (o) => this.worker.postMessage({ type: "video", action: "init", data: o }),
91
- decode: (o) => this.worker.postMessage({ type: "video", action: "decode", data: o }),
93
+ push: (o) => this.worker.postMessage({ type: "video", action: "push", data: o }),
92
94
  flush: () => this.worker.postMessage({ type: "video", action: "flush" }),
93
95
  destroy: () => {
94
96
  this.worker.postMessage({ type: "video", action: "destroy", data: {} });
95
97
  }
96
98
  });
97
99
  m(this, "destroy", () => {
98
- this.worker.postMessage({ type: "audio", action: "destroy" }), this.worker.postMessage({ type: "video", action: "destroy", data: {} }), this.worker.terminate();
100
+ this.worker.postMessage({ action: "destroy" }), this.worker.terminate();
99
101
  });
100
102
  this.worker.onmessage = (o) => {
101
- const { type: a, action: u, data: n } = o.data;
103
+ const { type: a, action: u, data: r } = o.data;
102
104
  switch (a) {
103
105
  case "audio":
104
- u === "onDecode" && this.on.audio.decode && this.on.audio.decode(n), u === "onError" && this.on.audio.error && this.on.audio.error(n);
106
+ u === "onDecode" && this.on.audio.decode && this.on.audio.decode(r), u === "onError" && this.on.audio.error && this.on.audio.error(r);
105
107
  break;
106
108
  case "video":
107
- u === "onDecode" && this.on.video.decode && this.on.video.decode(n), u === "onError" && this.on.video.error && this.on.video.error(n);
109
+ u === "onDecode" && this.on.video.decode && this.on.video.decode(r), u === "onError" && this.on.video.error && this.on.video.error(r);
108
110
  break;
109
111
  }
110
112
  };
@@ -116,8 +118,8 @@ class O {
116
118
  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", () => {
117
119
  {
118
120
  const u = this.inputStream.getTracks();
119
- for (const n of u)
120
- n.stop(), this.inputStream.removeTrack(n);
121
+ for (const r of u)
122
+ r.stop(), this.inputStream.removeTrack(r);
121
123
  }
122
124
  }), y(this, "getStream", () => this.filterStream(this.outputStream)), y(this, "setMute", (u = !0) => {
123
125
  u ? this.analyserNode.disconnect(this.outputGainNode) : this.analyserNode.connect(this.outputGainNode);
@@ -132,47 +134,47 @@ class O {
132
134
  }), y(this, "setOutputGain", (u) => {
133
135
  this.outputGain = u, this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime);
134
136
  }), y(this, "getVolume", () => {
135
- const { analyserNode: u, analyserArrayData: n } = this;
136
- u.getByteFrequencyData(n);
137
- let r = 0;
138
- for (let i = 0; i < n.length; i++)
139
- r += n[i];
140
- return Math.ceil(r / n.length);
141
- }), y(this, "mixAudio", (u, n = "bgm") => new Promise(async (r, i) => {
137
+ const { analyserNode: u, analyserArrayData: r } = this;
138
+ u.getByteFrequencyData(r);
139
+ let n = 0;
140
+ for (let i = 0; i < r.length; i++)
141
+ n += r[i];
142
+ return Math.ceil(n / r.length);
143
+ }), y(this, "mixAudio", (u, r = "bgm") => new Promise(async (n, i) => {
142
144
  try {
143
145
  {
144
- const s = this.mixAudioMap.get(n);
146
+ const s = this.mixAudioMap.get(r);
145
147
  s && s.stop();
146
148
  }
147
- const t = n === "bgs" ? this.bgsGainNode : this.bgmGainNode, e = this.audioContext.createBufferSource();
148
- this.mixAudioMap.set(n, e), e.buffer = u, e.connect(t), e.onended = () => {
149
- e.disconnect(t), this.mixAudioMap.delete(n), r(!0);
149
+ const t = r === "bgs" ? this.bgsGainNode : this.bgmGainNode, e = this.audioContext.createBufferSource();
150
+ this.mixAudioMap.set(r, e), e.buffer = u, e.connect(t), e.onended = () => {
151
+ e.disconnect(t), this.mixAudioMap.delete(r), n(!0);
150
152
  }, e.start(0);
151
153
  } catch (t) {
152
154
  i(t);
153
155
  }
154
156
  })), y(this, "mixAudioStop", (u) => {
155
- const n = this.mixAudioMap.get(u);
156
- n == null || n.stop();
157
- }), y(this, "changeMix", (u, n) => {
158
- const r = u === "bgs" ? this.bgsGainNode : this.bgmGainNode;
159
- n ? r.connect(this.destinationNode) : r.disconnect(this.destinationNode);
157
+ const r = this.mixAudioMap.get(u);
158
+ r == null || r.stop();
159
+ }), y(this, "changeMix", (u, r) => {
160
+ const n = u === "bgs" ? this.bgsGainNode : this.bgmGainNode;
161
+ r ? n.connect(this.destinationNode) : n.disconnect(this.destinationNode);
160
162
  }), 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;
161
163
  {
162
- const { sourceNode: u, inputGainNode: n, enhanceGainNode: r, bgsGainNode: i, bgmGainNode: t, analyserNode: e, outputGainNode: s, destinationNode: l } = this;
163
- u.connect(n), n.connect(r), r.connect(e), i.connect(e), t.connect(e), r.connect(l), i.connect(l), t.connect(l), e.connect(s), s.connect(this.audioContext.destination);
164
+ const { sourceNode: u, inputGainNode: r, enhanceGainNode: n, bgsGainNode: i, bgmGainNode: t, analyserNode: e, outputGainNode: s, destinationNode: l } = this;
165
+ 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);
164
166
  }
165
167
  this.setMute(!0), this.audioContext.resume();
166
168
  }
167
169
  }
168
- const W = async (h, o) => {
170
+ const V = async (h, o) => {
169
171
  try {
170
- const { format: a, numberOfChannels: u, numberOfFrames: n, sampleRate: r } = o, i = h.createBuffer(u, n, r);
172
+ const { format: a, numberOfChannels: u, numberOfFrames: r, sampleRate: n } = o, i = h.createBuffer(u, r, n);
171
173
  for (let t = 0; t < u; t++) {
172
174
  const e = o.allocationSize({ planeIndex: t }), s = new Uint8Array(e);
173
175
  o.copyTo(s, { planeIndex: t });
174
176
  const l = new DataView(s.buffer), c = i.getChannelData(t);
175
- for (let d = 0; d < n; d++) {
177
+ for (let d = 0; d < r; d++) {
176
178
  let p;
177
179
  switch (a) {
178
180
  case "s16":
@@ -201,7 +203,7 @@ const W = async (h, o) => {
201
203
  throw console.error("Failed to convert AudioData to AudioBuffer:", a), a;
202
204
  }
203
205
  };
204
- class V {
206
+ class W {
205
207
  constructor() {
206
208
  m(this, "prAudioStream");
207
209
  m(this, "audioContext");
@@ -218,18 +220,19 @@ class V {
218
220
  });
219
221
  }
220
222
  async push(o) {
223
+ const { audioData: a, playbackRate: u = 1 } = o;
221
224
  try {
222
225
  if (!this.audioContext || !this.destination) return;
223
- const a = await W(this.audioContext, o);
224
- if (!a) return;
225
- const u = this.audioContext.createBufferSource();
226
- u.buffer = a, u.connect(this.destination);
227
- const n = Math.max(this.nextStartTime, this.audioContext.currentTime);
228
- this.nextStartTime = n + a.duration, u.start(n), this.pendingSources.push(u), u.onended = () => {
229
- this.pendingSources = this.pendingSources.filter((r) => r !== u);
226
+ const r = await V(this.audioContext, a);
227
+ if (!r) return;
228
+ const n = this.audioContext.createBufferSource();
229
+ n.buffer = r, n.playbackRate.value = u, n.connect(this.destination);
230
+ const i = Math.max(this.nextStartTime, this.audioContext.currentTime), t = r.duration / u;
231
+ this.nextStartTime = i + t, n.start(i), this.pendingSources.push(n), n.onended = () => {
232
+ this.pendingSources = this.pendingSources.filter((e) => e !== n);
230
233
  }, this.audioContext.state === "suspended" && await this.audioContext.resume();
231
234
  } finally {
232
- o.close();
235
+ a.close();
233
236
  }
234
237
  }
235
238
  destroy() {
@@ -237,9 +240,9 @@ class V {
237
240
  (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 = [];
238
241
  }
239
242
  }
240
- const S = `(function(){"use strict";class r{isRendering=!1;pendingFrames=[];offscreenCanvas;writable;writer;ctx;cutOption;baseTime=0;pause=!1;shader=["stream"];constructor(){}init=({offscreenCanvas:e,writable:t})=>{this.destroy(),this.offscreenCanvas=e,this.writable=t,this.writer=this.writable.getWriter(),this.ctx=this.offscreenCanvas.getContext("2d")};setBaseTime=e=>{this.baseTime=e};setShader=e=>{this.shader=e};setSize=({width:e,height:t})=>{this.offscreenCanvas&&(this.offscreenCanvas.width=e,this.offscreenCanvas.height=t)};destroy=()=>{this.isRendering=!1,this.pendingFrames=[],this.offscreenCanvas=void 0,this.ctx=void 0,this.baseTime=0};push=e=>{this.pendingFrames.push(e),this.isRendering===!1&&setTimeout(this.renderFrame,0)};setCut=e=>{this.cutOption=e};setPause=e=>{this.pause=e,this.isRendering===!1&&setTimeout(this.renderFrame,0)};calculateTimeUntilNextFrame=e=>{const t=performance.timeOrigin+performance.now(),i=this.baseTime+e/1e3-t;return Math.max(0,i)};renderFrame=async()=>{for(this.isRendering=!0;;){const e=this.pendingFrames.shift();if(!e)break;let{timestamp:t,bitmap:s}=e;if(this.cutOption){const{sx:a=0,sy:c=0,sw:m=s.width,sh:o=s.height}=this.cutOption;s=await createImageBitmap(s,a,c,m,o)}const i=this.calculateTimeUntilNextFrame(t);await new Promise(a=>setTimeout(()=>a(!0),i)),this.drawImage({timestamp:t,bitmap:s}),this.cutOption&&s.close()}this.isRendering=!1};drawImage=e=>{if(this.pause!==!0){if(this.shader.includes("stream")){const t=new VideoFrame(e.bitmap,{timestamp:e.timestamp});this.writer.write(t),t.close()}this.shader.includes("canvas")&&this.ctx&&this.offscreenCanvas&&this.ctx.drawImage(e.bitmap,0,0,this.offscreenCanvas.width,this.offscreenCanvas.height)}}}const h=new r;onmessage=n=>{const{action:e,data:t}=n.data,s=h[e];s&&s(t)}})();
241
- `, x = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", S], { type: "text/javascript;charset=utf-8" });
242
- function z(h) {
243
+ 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)}})();
244
+ `, x = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", M], { type: "text/javascript;charset=utf-8" });
245
+ function j(h) {
243
246
  let o;
244
247
  try {
245
248
  if (o = x && (self.URL || self.webkitURL).createObjectURL(x), !o) throw "";
@@ -251,20 +254,17 @@ function z(h) {
251
254
  }), a;
252
255
  } catch {
253
256
  return new Worker(
254
- "data:text/javascript;charset=utf-8," + encodeURIComponent(S),
257
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(M),
255
258
  {
256
259
  name: h == null ? void 0 : h.name
257
260
  }
258
261
  );
259
262
  }
260
263
  }
261
- class j {
264
+ class z {
262
265
  constructor() {
263
- m(this, "worker", new z());
264
- m(this, "init", ({ offscreenCanvas: o, writable: a }) => this.worker.postMessage({ action: "init", data: { offscreenCanvas: o, writable: a } }, [o, a]));
265
- m(this, "setShader", (o) => this.worker.postMessage({ action: "setShader", data: o }));
266
- m(this, "setBaseTime", (o) => this.worker.postMessage({ action: "setBaseTime", data: o }));
267
- m(this, "setSize", ({ width: o, height: a }) => this.worker.postMessage({ action: "setSize", data: { width: o, height: a } }));
266
+ m(this, "worker", new j());
267
+ m(this, "init", ({ writable: o }) => this.worker.postMessage({ action: "init", data: { writable: o } }, [o]));
268
268
  m(this, "push", (o) => this.worker.postMessage({ action: "push", data: o }));
269
269
  m(this, "setCut", async (o) => this.worker.postMessage({ action: "setCut", data: o }));
270
270
  m(this, "setPause", (o) => this.worker.postMessage({ action: "setPause", data: o }));
@@ -273,20 +273,20 @@ class j {
273
273
  });
274
274
  }
275
275
  }
276
- const $ = (h) => {
276
+ const q = (h) => {
277
277
  const o = h.toLowerCase();
278
278
  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";
279
279
  }, P = (h) => {
280
280
  const o = (h == null ? void 0 : h.getTracks()) || [];
281
281
  for (const a of o)
282
282
  a.stop();
283
- }, C = () => {
284
- const h = new j(), o = document.createElement("canvas"), a = o.transferControlToOffscreen(), u = new MediaStreamTrackGenerator({ kind: "video" }), n = new MediaStream([u]), r = () => {
285
- h.destroy(), P(n);
286
- };
287
- return h.init({ offscreenCanvas: a, writable: u.writable }), { worker: h, canvas: o, stream: n, destroy: r };
283
+ }, A = () => {
284
+ const h = new MediaStreamTrackGenerator({ kind: "video" }), o = new MediaStream([h]), a = new z();
285
+ return a.init({ writable: h.writable }), { worker: a, stream: o, destroy: () => {
286
+ a.destroy(), P(o);
287
+ } };
288
288
  };
289
- class H {
289
+ class $ {
290
290
  constructor() {
291
291
  m(this, "resolvesMap", /* @__PURE__ */ new Map());
292
292
  m(this, "index", 0);
@@ -297,49 +297,49 @@ class H {
297
297
  * @param timeout 超时时间 ms
298
298
  * @returns
299
299
  */
300
- m(this, "add", (o, a = () => !1, u = 0) => new Promise((n) => {
300
+ m(this, "add", (o, a = () => !1, u = 0) => new Promise((r) => {
301
301
  var t, e;
302
- if (a()) return n(!0);
302
+ if (a()) return r(!0);
303
303
  this.resolvesMap.has(o) || this.resolvesMap.set(o, /* @__PURE__ */ new Map()), this.index++;
304
- const r = `${this.index}`;
304
+ const n = `${this.index}`;
305
305
  if (u = Math.max(0, u), u === 0) {
306
- (t = this.resolvesMap.get(o)) == null || t.set(r, { resolve: n, timer: 0 });
306
+ (t = this.resolvesMap.get(o)) == null || t.set(n, { resolve: r, timer: 0 });
307
307
  return;
308
308
  }
309
309
  const i = window.setTimeout(() => {
310
310
  this.emit(o);
311
311
  }, u);
312
- (e = this.resolvesMap.get(o)) == null || e.set(r, { resolve: n, timer: i });
312
+ (e = this.resolvesMap.get(o)) == null || e.set(n, { resolve: r, timer: i });
313
313
  }));
314
314
  m(this, "emit", async (o) => {
315
315
  const a = this.resolvesMap.get(o);
316
316
  if (!a) return;
317
317
  const u = [...a.keys()];
318
- for (const n of u) {
319
- const r = a.get(n);
320
- r && (clearTimeout(r.timer), r.resolve(), a.delete(n));
318
+ for (const r of u) {
319
+ const n = a.get(r);
320
+ n && (clearTimeout(n.timer), n.resolve(), a.delete(r));
321
321
  }
322
322
  });
323
323
  }
324
324
  }
325
325
  const Y = (h) => {
326
326
  const o = new DataView(h.buffer);
327
- let a = 0, u, n, r;
327
+ let a = 0, u, r, n;
328
328
  u = o.getUint32(a, !1), a += 4;
329
329
  {
330
330
  const i = o.getUint8(a), t = i >> 7 & 1, e = i >> 5 & 3, s = i & 31;
331
- n = { forbidden_zero_bit: t, nal_ref_idc: e, nal_unit_type: s }, a += 1;
331
+ r = { forbidden_zero_bit: t, nal_ref_idc: e, nal_unit_type: s }, a += 1;
332
332
  }
333
333
  {
334
334
  const i = u - 1;
335
- r = new Uint8Array(o.buffer.slice(a, a + i));
335
+ n = new Uint8Array(o.buffer.slice(a, a + i));
336
336
  }
337
- return { size: u, header: n, data: r };
337
+ return { size: u, header: r, data: n };
338
338
  };
339
- var q, U;
340
- class A {
339
+ var R, U;
340
+ class C {
341
341
  constructor(o = {}) {
342
- J(this, q, {
342
+ J(this, R, {
343
343
  timeout: 5 * 1e3,
344
344
  check: !1
345
345
  });
@@ -349,34 +349,34 @@ class A {
349
349
  * @param input string | URL | Request
350
350
  * @param init RequestInit
351
351
  */
352
- m(this, "check", (o, a) => new Promise(async (u, n) => {
352
+ m(this, "check", (o, a) => new Promise(async (u, r) => {
353
353
  var i;
354
- this.stop(), K(this, U, new AbortController());
355
- const r = window.setTimeout(() => {
354
+ this.stop(), H(this, U, new AbortController());
355
+ const n = window.setTimeout(() => {
356
356
  var t;
357
- (t = I(this, U)) == null || t.abort("Timeout."), n({ status: "timeout", reason: "" });
358
- }, I(this, q).timeout);
357
+ (t = I(this, U)) == null || t.abort("Timeout."), r({ status: "timeout", reason: "" });
358
+ }, I(this, R).timeout);
359
359
  try {
360
360
  const t = await fetch(o, { ...a, method: "HEAD", signal: (i = I(this, U)) == null ? void 0 : i.signal });
361
- t.status === 200 ? u({ status: "successed", reason: "" }) : n({ status: "failed", reason: `${t.status}` });
361
+ t.status === 200 ? u({ status: "successed", reason: "" }) : r({ status: "failed", reason: `${t.status}` });
362
362
  } catch (t) {
363
- n({ status: "error", reason: t.message });
363
+ r({ status: "error", reason: t.message });
364
364
  }
365
- clearTimeout(r);
365
+ clearTimeout(n);
366
366
  }));
367
367
  /**
368
368
  *
369
369
  * @param input string | URL | Request
370
370
  * @param init RequestInit
371
371
  */
372
- m(this, "request", async (o, a) => new Promise(async (u, n) => {
373
- var r;
372
+ m(this, "request", async (o, a) => new Promise(async (u, r) => {
373
+ var n;
374
374
  try {
375
- I(this, q).check && await this.check(o, a), K(this, U, new AbortController());
376
- const i = await fetch(o, { ...a, signal: (r = I(this, U)) == null ? void 0 : r.signal });
375
+ I(this, R).check && await this.check(o, a), H(this, U, new AbortController());
376
+ const i = await fetch(o, { ...a, signal: (n = I(this, U)) == null ? void 0 : n.signal });
377
377
  u(i);
378
378
  } catch (i) {
379
- this.stop(), n(i);
379
+ this.stop(), r(i);
380
380
  }
381
381
  }));
382
382
  /**
@@ -386,25 +386,24 @@ class A {
386
386
  var o;
387
387
  ((o = I(this, U)) == null ? void 0 : o.signal.aborted) === !1 && I(this, U).abort("Actively stop.");
388
388
  });
389
- K(this, q, { ...I(this, q), ...o });
389
+ H(this, R, { ...I(this, R), ...o });
390
390
  }
391
391
  }
392
- q = new WeakMap(), U = new WeakMap();
392
+ R = new WeakMap(), U = new WeakMap();
393
393
  class et {
394
394
  constructor(o = {}) {
395
395
  m(this, "option", {
396
- debug: !1
396
+ debug: !1,
397
+ frameTrack: !1
397
398
  });
398
- m(this, "prFetch", new A());
399
- m(this, "prResolves", new H());
399
+ m(this, "prFetch", new C());
400
+ m(this, "prResolves", new $());
400
401
  m(this, "url", "");
401
402
  m(this, "demuxerWorker");
402
403
  m(this, "decoderWorker");
403
404
  m(this, "audioPlayer");
404
405
  m(this, "renderWorker");
405
- m(this, "renderBaseTime");
406
406
  m(this, "stream");
407
- m(this, "canvas");
408
407
  m(this, "on", { demuxer: {}, decoder: {} });
409
408
  m(this, "cutRenders", /* @__PURE__ */ new Map());
410
409
  // @ts-ignore
@@ -413,7 +412,7 @@ class et {
413
412
  * 初始化
414
413
  */
415
414
  m(this, "init", () => {
416
- this.initDecoder(), this.audioPlayer = new V(), this.audioPlayer.init(), this.initRender();
415
+ this.initDecoder(), this.initRender(), this.audioPlayer = new W(), this.audioPlayer.init();
417
416
  });
418
417
  /**
419
418
  * 开始播放
@@ -421,7 +420,7 @@ class et {
421
420
  */
422
421
  m(this, "start", async (o) => {
423
422
  this.stop(), this.url = o, this.init();
424
- const a = $(o);
423
+ const a = q(o);
425
424
  if (a === "unknown") throw new Error("This address cannot be parsed.");
426
425
  switch (this.initDemuxer(a), a) {
427
426
  case "flv":
@@ -436,30 +435,25 @@ class et {
436
435
  * 停止
437
436
  */
438
437
  m(this, "stop", async () => {
439
- var a, u, n, r;
438
+ var o, a, u, r;
440
439
  try {
441
440
  clearInterval(this.hls.getSegmentsTimer), this.prFetch.stop();
442
- } catch (i) {
443
- console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: error", i);
441
+ } catch (n) {
442
+ console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: error", n);
444
443
  }
445
- (a = this.demuxerWorker) == null || a.destroy(), (u = this.decoderWorker) == null || u.destroy(), (n = this.renderWorker) == null || n.destroy(), P(this.stream);
446
- const o = [...this.cutRenders.keys()];
447
- for (const i of o)
448
- this.cut.remove(i);
449
- (r = this.audioPlayer) == null || r.destroy(), this.renderBaseTime = void 0, this.canvas = void 0;
444
+ (o = this.demuxerWorker) == null || o.destroy(), (a = this.decoderWorker) == null || a.destroy(), (u = this.renderWorker) == null || u.destroy(), P(this.stream), (r = this.audioPlayer) == null || r.destroy();
450
445
  });
451
- m(this, "getCanvas", () => this.canvas);
446
+ /**
447
+ * 获取媒体流
448
+ */
452
449
  m(this, "getStream", () => this.stream);
453
- m(this, "setPause", (o) => {
454
- var a;
455
- (a = this.renderWorker) == null || a.setPause(o);
456
- });
457
450
  /**
458
- * 设置渲染模式
451
+ * 设置暂停
452
+ * @param pause: boolean
459
453
  */
460
- m(this, "setShader", (o) => {
454
+ m(this, "setPause", (o) => {
461
455
  var a;
462
- (a = this.renderWorker) == null || a.setShader(o);
456
+ (a = this.renderWorker) == null || a.setPause(o);
463
457
  });
464
458
  /**
465
459
  * 是否静音 默认为true
@@ -469,6 +463,14 @@ class et {
469
463
  var a, u;
470
464
  return (u = (a = this.audioPlayer) == null ? void 0 : a.prAudioStream) == null ? void 0 : u.setMute(o);
471
465
  });
466
+ /**
467
+ * 是否开启追帧
468
+ * @param frameTrack?: boolean
469
+ */
470
+ m(this, "setFrameTrack", (o) => {
471
+ var a;
472
+ (a = this.decoderWorker) == null || a.setFrameTrack(o);
473
+ });
472
474
  /**
473
475
  * 是否已准备好
474
476
  */
@@ -479,91 +481,53 @@ class et {
479
481
  };
480
482
  return this.prResolves.add("isReady", o);
481
483
  });
482
- m(this, "cut", {
483
- /**
484
- * 创建剪切
485
- */
486
- create: (o, a) => {
487
- let u = this.cutRenders.get(o);
488
- return u ? (u.worker.setCut(a), u.worker.setPause(!1), u) : (u = C(), u.worker.setBaseTime(this.renderBaseTime || 0), u.worker.setCut(a), this.cutRenders.set(o, u), u);
489
- },
490
- getCanvas: (o) => {
491
- var a;
492
- return (a = this.cutRenders.get(o)) == null ? void 0 : a.canvas;
493
- },
494
- getStream: (o) => {
495
- var a;
496
- return (a = this.cutRenders.get(o)) == null ? void 0 : a.stream;
497
- },
498
- setPause: (o, a) => {
499
- var u;
500
- (u = this.cutRenders.get(o)) == null || u.worker.setPause(a);
501
- },
502
- /**
503
- * 设置渲染模式
504
- */
505
- setShader: (o, a) => {
506
- var u;
507
- (u = this.cutRenders.get(o)) == null || u.worker.setShader(a);
508
- },
509
- /**
510
- * 移除剪切
511
- */
512
- remove: (o) => {
513
- var a;
514
- (a = this.cutRenders.get(o)) == null || a.destroy(), this.cutRenders.delete(o);
515
- }
516
- });
517
484
  /**
518
485
  * 初始化解复器
519
486
  */
520
487
  m(this, "initDemuxer", (o) => {
521
- this.demuxerWorker = new L(), this.demuxerWorker.init(o), this.demuxerWorker.on.debug = (a) => {
488
+ this.demuxerWorker = new N(), this.demuxerWorker.init(o), this.demuxerWorker.on.debug = (a) => {
522
489
  this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: debug", a);
523
490
  }, this.demuxerWorker.on.info = (a) => {
524
- 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);
491
+ var n;
492
+ this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: info", a);
493
+ const { framerate: u = 25 } = a, r = 1e3 / u;
494
+ (n = this.decoderWorker) == null || n.init({ decodingSpeed: r }), this.on.demuxer.info && this.on.demuxer.info(a);
525
495
  }, this.demuxerWorker.on.config = (a) => {
526
- var n, r;
496
+ var r, n;
527
497
  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);
528
498
  const { kind: u } = a;
529
499
  switch (u) {
530
500
  case "audio":
531
501
  {
532
502
  const { codec: i, sampleRate: t, numberOfChannels: e } = a;
533
- (n = this.decoderWorker) == null || n.audio.init({ codec: i, sampleRate: t, numberOfChannels: e });
503
+ (r = this.decoderWorker) == null || r.audio.init({ codec: i, sampleRate: t, numberOfChannels: e });
534
504
  }
535
505
  break;
536
506
  case "video":
537
507
  {
538
508
  const { codec: i, description: t } = a;
539
- (r = this.decoderWorker) == null || r.video.init({ codec: i, description: t });
509
+ (n = this.decoderWorker) == null || n.video.init({ codec: i, description: t });
540
510
  }
541
511
  break;
542
512
  }
543
513
  }, this.demuxerWorker.on.chunk = (a) => {
544
- var n;
545
514
  if (this.on.demuxer.chunk && this.on.demuxer.chunk(a), !this.decoderWorker) return;
546
515
  const { kind: u } = a;
547
516
  switch (u) {
548
517
  case "audio":
549
518
  {
550
- const { type: r, dts: i, data: t } = a, e = i * 1;
551
- this.decoderWorker.audio.decode({ type: r, timestamp: e, data: t });
519
+ const { type: r, dts: n, data: i } = a, t = n * 1;
520
+ this.decoderWorker.audio.push({ type: r, timestamp: t, data: i });
552
521
  }
553
522
  break;
554
523
  case "video":
555
524
  {
556
- const { type: r, dts: i, data: t, nalus: e = [] } = a;
557
- if (this.renderBaseTime === void 0) {
558
- const l = (/* @__PURE__ */ new Date()).getTime();
559
- this.renderBaseTime = l - i, (n = this.renderWorker) == null || n.setBaseTime(this.renderBaseTime);
560
- }
561
- const s = i * 1e3;
562
- this.decoderWorker.video.decode({ type: r, timestamp: s, data: t });
563
- for (const l of e) {
564
- if (l.byteLength <= 4) continue;
565
- const { header: c, data: d } = Y(l), { nal_unit_type: p } = c;
566
- p === 6 && this.on.demuxer.sei && this.on.demuxer.sei(d);
525
+ const { type: r, dts: n, data: i, nalus: t = [] } = a, e = n * 1e3;
526
+ this.decoderWorker.video.push({ type: r, timestamp: e, data: i });
527
+ for (const s of t) {
528
+ if (s.byteLength <= 4) continue;
529
+ const { header: l, data: c } = Y(s), { nal_unit_type: d } = l;
530
+ d === 6 && this.on.demuxer.sei && this.on.demuxer.sei(c);
567
531
  }
568
532
  }
569
533
  break;
@@ -574,17 +538,17 @@ class et {
574
538
  * 初始化解码器
575
539
  */
576
540
  m(this, "initDecoder", () => {
577
- this.decoderWorker = new N(), this.decoderWorker.on.audio.decode = (o) => {
541
+ this.decoderWorker = new B(), this.decoderWorker.on.audio.decode = (o) => {
578
542
  var a;
579
543
  (a = this.audioPlayer) == null || a.push(o), this.on.decoder.audio && this.on.decoder.audio(o);
580
544
  }, this.decoderWorker.on.audio.error = (o) => {
581
545
  this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: audio.error ", o), this.on.error && this.on.error(o);
582
546
  }, this.decoderWorker.on.video.decode = async (o) => {
583
- var u, n;
547
+ var u, r;
584
548
  (u = this.renderWorker) == null || u.push(o);
585
549
  const a = [...this.cutRenders.keys()];
586
- for (const r of a)
587
- (n = this.cutRenders.get(r)) == null || n.worker.push(o);
550
+ for (const n of a)
551
+ (r = this.cutRenders.get(n)) == null || r.worker.push(o);
588
552
  this.on.decoder.video && this.on.decoder.video(o), o.bitmap.close();
589
553
  }, this.decoderWorker.on.video.error = (o) => {
590
554
  this.stop(), this.on.error && this.on.error(o);
@@ -594,21 +558,55 @@ class et {
594
558
  * 初始化渲染器
595
559
  */
596
560
  m(this, "initRender", () => {
597
- const { worker: o, canvas: a, stream: u } = C();
598
- this.renderWorker = o, this.canvas = a, this.stream = u, this.renderWorker.setPause(!1);
561
+ const { worker: o, stream: a } = A();
562
+ this.renderWorker = o, this.stream = a, this.renderWorker.setPause(!1);
563
+ });
564
+ m(this, "cut", {
565
+ /**
566
+ * 创建剪切
567
+ */
568
+ create: (o, a) => {
569
+ let u = this.cutRenders.get(o);
570
+ return u ? (u.worker.setCut(a), u.worker.setPause(!1), u) : (u = A(), u.worker.setCut(a), this.cutRenders.set(o, u), u);
571
+ },
572
+ /**
573
+ * 获取媒体流
574
+ */
575
+ getStream: (o) => {
576
+ var a;
577
+ return (a = this.cutRenders.get(o)) == null ? void 0 : a.stream;
578
+ },
579
+ /**
580
+ * 设置暂停
581
+ * @param pause: boolean
582
+ */
583
+ setPause: (o, a) => {
584
+ var u;
585
+ (u = this.cutRenders.get(o)) == null || u.worker.setPause(a);
586
+ },
587
+ /**
588
+ * 移除剪切
589
+ */
590
+ remove: (o) => {
591
+ var a;
592
+ (a = this.cutRenders.get(o)) == null || a.destroy(), this.cutRenders.delete(o);
593
+ }
599
594
  });
600
595
  m(this, "flv", {
601
596
  start: async () => {
602
597
  var o, a;
603
598
  try {
604
- const u = (o = (await this.prFetch.request(this.url)).body) == null ? void 0 : o.getReader();
605
- if (!u) throw new Error("reader is error.");
599
+ let u = await this.prFetch.request(this.url);
600
+ 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.");
601
+ const r = (o = u.body) == null ? void 0 : o.getReader();
602
+ if (!r) throw new Error("reader is error.");
606
603
  for (; ; ) {
607
- const { done: n, value: r } = await u.read();
608
- if (r && ((a = this.demuxerWorker) == null || a.push(r)), n) break;
604
+ const { done: n, value: i } = await r.read();
605
+ if (i && ((a = this.demuxerWorker) == null || a.push(i)), n) break;
609
606
  }
610
607
  } catch (u) {
611
608
  if ((u == null ? void 0 : u.name) !== "AbortError") throw Error(u);
609
+ this.on.error && this.on.error(u);
612
610
  }
613
611
  }
614
612
  });
@@ -620,52 +618,57 @@ class et {
620
618
  parse: async (o) => {
621
619
  const a = new TextDecoder("utf-8").decode(o).split(`
622
620
  `).map((e) => e.replace("\r", "")), u = this.url.substring(0, this.url.lastIndexOf("/") + 1);
623
- let n = 4, r = 0, i = !1;
621
+ let r = 4, n = 0, i = !1;
624
622
  const t = [];
625
623
  for (const e of a)
626
- e.startsWith("#EXTINF:") ? n = parseFloat(e.split(":")[1].split(",")[0]) : e.startsWith("#EXT-X-TARGETDURATION:") ? r = 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({
624
+ 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({
627
625
  url: e.startsWith("http") ? e : u + e,
628
- duration: n,
626
+ duration: r,
629
627
  isLive: i
630
628
  });
631
- return { baseUrl: u, targetDuration: r, isLive: i, segments: t };
629
+ return { baseUrl: u, targetDuration: n, isLive: i, segments: t };
632
630
  },
633
631
  getSegments: async () => {
634
- var a;
635
- const o = (a = (await new A().request(this.url)).body) == null ? void 0 : a.getReader();
636
- if (!o) throw new Error("reader is error.");
637
- for (; ; ) {
638
- const { done: u, value: n } = await o.read();
639
- if (n) {
640
- const r = await this.hls.parse(n), { segments: i = [], isLive: t = !1 } = r;
641
- this.hls.isLive = t;
642
- let e = Array.from(i, (l) => l.url);
643
- const s = e.findIndex((l) => l === this.hls.url);
644
- s !== -1 && (e = e.slice(s + 1)), this.hls.urls = e;
632
+ var o;
633
+ try {
634
+ const a = new C();
635
+ let u = await a.request(this.url);
636
+ 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.");
637
+ const r = (o = u.body) == null ? void 0 : o.getReader();
638
+ if (!r) throw new Error("reader is error.");
639
+ for (; ; ) {
640
+ const { done: n, value: i } = await r.read();
641
+ if (i) {
642
+ const t = await this.hls.parse(i), { segments: e = [], isLive: s = !1 } = t;
643
+ this.hls.isLive = s, s === !1 && (this.option.frameTrack = !1);
644
+ let l = Array.from(e, (d) => d.url);
645
+ const c = l.findIndex((d) => d === this.hls.url);
646
+ c !== -1 && (l = l.slice(c + 1)), this.hls.urls = l;
647
+ }
648
+ if (n) break;
645
649
  }
646
- if (u) break;
650
+ } catch (a) {
651
+ this.on.error && this.on.error(a);
647
652
  }
648
653
  },
649
- getData: async () => {
650
- },
651
654
  start: async () => {
652
- var o, a;
655
+ var o, a, u;
653
656
  try {
654
- for (await this.hls.getSegments(), this.hls.getSegmentsTimer = window.setInterval(this.hls.getSegments, 1e3), this.hls.isLive === !1 && clearInterval(this.hls.getSegmentsTimer); ; ) {
655
- const u = this.hls.urls.shift();
656
- if (u) {
657
- this.hls.url = u;
658
- const n = (o = (await this.prFetch.request(u)).body) == null ? void 0 : o.getReader();
657
+ 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)); ; ) {
658
+ const r = this.hls.urls.shift();
659
+ if (r) {
660
+ this.hls.url = r;
661
+ const n = (a = (await this.prFetch.request(r)).body) == null ? void 0 : a.getReader();
659
662
  if (!n) throw new Error("segment reader is error.");
660
663
  for (; ; ) {
661
- const { done: r, value: i } = await n.read();
662
- if (i && ((a = this.demuxerWorker) == null || a.push(i)), r) break;
664
+ const { done: i, value: t } = await n.read();
665
+ if (t && ((u = this.demuxerWorker) == null || u.push(t)), i) break;
663
666
  }
664
- }
665
- await new Promise((n) => setTimeout(() => n(!0), 500));
667
+ } else
668
+ await new Promise((n) => setTimeout(() => n(!0), 300));
666
669
  }
667
- } catch (u) {
668
- if ((u == null ? void 0 : u.name) !== "AbortError") throw Error(u);
670
+ } catch (r) {
671
+ if ((r == null ? void 0 : r.name) !== "AbortError") throw Error(r);
669
672
  }
670
673
  }
671
674
  });
@@ -678,10 +681,10 @@ function requireAspromise() {
678
681
  if (hasRequiredAspromise) return aspromise;
679
682
  hasRequiredAspromise = 1, aspromise = h;
680
683
  function h(o, a) {
681
- for (var u = new Array(arguments.length - 1), n = 0, r = 2, i = !0; r < arguments.length; )
682
- u[n++] = arguments[r++];
684
+ for (var u = new Array(arguments.length - 1), r = 0, n = 2, i = !0; n < arguments.length; )
685
+ u[r++] = arguments[n++];
683
686
  return new Promise(function(e, s) {
684
- u[n] = function(c) {
687
+ u[r] = function(c) {
685
688
  if (i)
686
689
  if (i = !1, c)
687
690
  s(c);
@@ -712,8 +715,8 @@ function requireBase64() {
712
715
  ++s;
713
716
  return Math.ceil(t.length * 3) / 4 - s;
714
717
  };
715
- for (var a = new Array(64), u = new Array(123), n = 0; n < 64; )
716
- u[a[n] = n < 26 ? n + 65 : n < 52 ? n + 71 : n < 62 ? n - 4 : n - 59 | 43] = n++;
718
+ for (var a = new Array(64), u = new Array(123), r = 0; r < 64; )
719
+ u[a[r] = r < 26 ? r + 65 : r < 52 ? r + 71 : r < 62 ? r - 4 : r - 59 | 43] = r++;
717
720
  o.encode = function(t, e, s) {
718
721
  for (var l = null, c = [], d = 0, p = 0, f; e < s; ) {
719
722
  var w = t[e++];
@@ -732,14 +735,14 @@ function requireBase64() {
732
735
  }
733
736
  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));
734
737
  };
735
- var r = "invalid encoding";
738
+ var n = "invalid encoding";
736
739
  o.decode = function(t, e, s) {
737
740
  for (var l = s, c = 0, d, p = 0; p < t.length; ) {
738
741
  var f = t.charCodeAt(p++);
739
742
  if (f === 61 && c > 1)
740
743
  break;
741
744
  if ((f = u[f]) === void 0)
742
- throw Error(r);
745
+ throw Error(n);
743
746
  switch (c) {
744
747
  case 0:
745
748
  d = f, c = 1;
@@ -756,7 +759,7 @@ function requireBase64() {
756
759
  }
757
760
  }
758
761
  if (c === 1)
759
- throw Error(r);
762
+ throw Error(n);
760
763
  return s - l;
761
764
  }, o.test = function(t) {
762
765
  return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t);
@@ -770,10 +773,10 @@ function requireEventemitter() {
770
773
  function h() {
771
774
  this._listeners = {};
772
775
  }
773
- return h.prototype.on = function(a, u, n) {
776
+ return h.prototype.on = function(a, u, r) {
774
777
  return (this._listeners[a] || (this._listeners[a] = [])).push({
775
778
  fn: u,
776
- ctx: n || this
779
+ ctx: r || this
777
780
  }), this;
778
781
  }, h.prototype.off = function(a, u) {
779
782
  if (a === void 0)
@@ -781,16 +784,16 @@ function requireEventemitter() {
781
784
  else if (u === void 0)
782
785
  this._listeners[a] = [];
783
786
  else
784
- for (var n = this._listeners[a], r = 0; r < n.length; )
785
- n[r].fn === u ? n.splice(r, 1) : ++r;
787
+ for (var r = this._listeners[a], n = 0; n < r.length; )
788
+ r[n].fn === u ? r.splice(n, 1) : ++n;
786
789
  return this;
787
790
  }, h.prototype.emit = function(a) {
788
791
  var u = this._listeners[a];
789
792
  if (u) {
790
- for (var n = [], r = 1; r < arguments.length; )
791
- n.push(arguments[r++]);
792
- for (r = 0; r < u.length; )
793
- u[r].fn.apply(u[r++].ctx, n);
793
+ for (var r = [], n = 1; n < arguments.length; )
794
+ r.push(arguments[n++]);
795
+ for (n = 0; n < u.length; )
796
+ u[n].fn.apply(u[n++].ctx, r);
794
797
  }
795
798
  return this;
796
799
  }, eventemitter;
@@ -799,7 +802,7 @@ var float, hasRequiredFloat;
799
802
  function requireFloat() {
800
803
  if (hasRequiredFloat) return float;
801
804
  hasRequiredFloat = 1, float = h(h);
802
- function h(r) {
805
+ function h(n) {
803
806
  return typeof Float32Array < "u" ? function() {
804
807
  var i = new Float32Array([-0]), t = new Uint8Array(i.buffer), e = t[3] === 128;
805
808
  function s(p, f, w) {
@@ -808,14 +811,14 @@ function requireFloat() {
808
811
  function l(p, f, w) {
809
812
  i[0] = p, f[w] = t[3], f[w + 1] = t[2], f[w + 2] = t[1], f[w + 3] = t[0];
810
813
  }
811
- r.writeFloatLE = e ? s : l, r.writeFloatBE = e ? l : s;
814
+ n.writeFloatLE = e ? s : l, n.writeFloatBE = e ? l : s;
812
815
  function c(p, f) {
813
816
  return t[0] = p[f], t[1] = p[f + 1], t[2] = p[f + 2], t[3] = p[f + 3], i[0];
814
817
  }
815
818
  function d(p, f) {
816
819
  return t[3] = p[f], t[2] = p[f + 1], t[1] = p[f + 2], t[0] = p[f + 3], i[0];
817
820
  }
818
- r.readFloatLE = e ? c : d, r.readFloatBE = e ? d : c;
821
+ n.readFloatLE = e ? c : d, n.readFloatBE = e ? d : c;
819
822
  }() : function() {
820
823
  function i(e, s, l, c) {
821
824
  var d = s < 0 ? 1 : 0;
@@ -838,12 +841,12 @@ function requireFloat() {
838
841
  e((d << 31 | p + 127 << 23 | f) >>> 0, l, c);
839
842
  }
840
843
  }
841
- r.writeFloatLE = i.bind(null, o), r.writeFloatBE = i.bind(null, a);
844
+ n.writeFloatLE = i.bind(null, o), n.writeFloatBE = i.bind(null, a);
842
845
  function t(e, s, l) {
843
846
  var c = e(s, l), d = (c >> 31) * 2 + 1, p = c >>> 23 & 255, f = c & 8388607;
844
847
  return p === 255 ? f ? NaN : d * (1 / 0) : p === 0 ? d * 1401298464324817e-60 * f : d * Math.pow(2, p - 150) * (f + 8388608);
845
848
  }
846
- r.readFloatLE = t.bind(null, u), r.readFloatBE = t.bind(null, n);
849
+ n.readFloatLE = t.bind(null, u), n.readFloatBE = t.bind(null, r);
847
850
  }(), typeof Float64Array < "u" ? function() {
848
851
  var i = new Float64Array([-0]), t = new Uint8Array(i.buffer), e = t[7] === 128;
849
852
  function s(p, f, w) {
@@ -852,14 +855,14 @@ function requireFloat() {
852
855
  function l(p, f, w) {
853
856
  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];
854
857
  }
855
- r.writeDoubleLE = e ? s : l, r.writeDoubleBE = e ? l : s;
858
+ n.writeDoubleLE = e ? s : l, n.writeDoubleBE = e ? l : s;
856
859
  function c(p, f) {
857
860
  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];
858
861
  }
859
862
  function d(p, f) {
860
863
  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];
861
864
  }
862
- r.readDoubleLE = e ? c : d, r.readDoubleBE = e ? d : c;
865
+ n.readDoubleLE = e ? c : d, n.readDoubleBE = e ? d : c;
863
866
  }() : function() {
864
867
  function i(e, s, l, c, d, p) {
865
868
  var f = c < 0 ? 1 : 0;
@@ -885,25 +888,25 @@ function requireFloat() {
885
888
  }
886
889
  }
887
890
  }
888
- r.writeDoubleLE = i.bind(null, o, 0, 4), r.writeDoubleBE = i.bind(null, a, 4, 0);
891
+ n.writeDoubleLE = i.bind(null, o, 0, 4), n.writeDoubleBE = i.bind(null, a, 4, 0);
889
892
  function t(e, s, l, c, d) {
890
893
  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;
891
894
  return b === 2047 ? g ? NaN : w * (1 / 0) : b === 0 ? w * 5e-324 * g : w * Math.pow(2, b - 1075) * (g + 4503599627370496);
892
895
  }
893
- r.readDoubleLE = t.bind(null, u, 0, 4), r.readDoubleBE = t.bind(null, n, 4, 0);
894
- }(), r;
896
+ n.readDoubleLE = t.bind(null, u, 0, 4), n.readDoubleBE = t.bind(null, r, 4, 0);
897
+ }(), n;
895
898
  }
896
- function o(r, i, t) {
897
- i[t] = r & 255, i[t + 1] = r >>> 8 & 255, i[t + 2] = r >>> 16 & 255, i[t + 3] = r >>> 24;
899
+ function o(n, i, t) {
900
+ i[t] = n & 255, i[t + 1] = n >>> 8 & 255, i[t + 2] = n >>> 16 & 255, i[t + 3] = n >>> 24;
898
901
  }
899
- function a(r, i, t) {
900
- i[t] = r >>> 24, i[t + 1] = r >>> 16 & 255, i[t + 2] = r >>> 8 & 255, i[t + 3] = r & 255;
902
+ function a(n, i, t) {
903
+ i[t] = n >>> 24, i[t + 1] = n >>> 16 & 255, i[t + 2] = n >>> 8 & 255, i[t + 3] = n & 255;
901
904
  }
902
- function u(r, i) {
903
- return (r[i] | r[i + 1] << 8 | r[i + 2] << 16 | r[i + 3] << 24) >>> 0;
905
+ function u(n, i) {
906
+ return (n[i] | n[i + 1] << 8 | n[i + 2] << 16 | n[i + 3] << 24) >>> 0;
904
907
  }
905
- function n(r, i) {
906
- return (r[i] << 24 | r[i + 1] << 16 | r[i + 2] << 8 | r[i + 3]) >>> 0;
908
+ function r(n, i) {
909
+ return (n[i] << 24 | n[i + 1] << 16 | n[i + 2] << 8 | n[i + 3]) >>> 0;
907
910
  }
908
911
  return float;
909
912
  }
@@ -927,20 +930,20 @@ function requireUtf8() {
927
930
  return hasRequiredUtf8 || (hasRequiredUtf8 = 1, function(h) {
928
931
  var o = h;
929
932
  o.length = function(u) {
930
- for (var n = 0, r = 0, i = 0; i < u.length; ++i)
931
- r = u.charCodeAt(i), r < 128 ? n += 1 : r < 2048 ? n += 2 : (r & 64512) === 55296 && (u.charCodeAt(i + 1) & 64512) === 56320 ? (++i, n += 4) : n += 3;
932
- return n;
933
- }, o.read = function(u, n, r) {
934
- var i = r - n;
933
+ for (var r = 0, n = 0, i = 0; i < u.length; ++i)
934
+ 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;
935
+ return r;
936
+ }, o.read = function(u, r, n) {
937
+ var i = n - r;
935
938
  if (i < 1)
936
939
  return "";
937
- for (var t = null, e = [], s = 0, l; n < r; )
938
- l = u[n++], l < 128 ? e[s++] = l : l > 191 && l < 224 ? e[s++] = (l & 31) << 6 | u[n++] & 63 : l > 239 && l < 365 ? (l = ((l & 7) << 18 | (u[n++] & 63) << 12 | (u[n++] & 63) << 6 | u[n++] & 63) - 65536, e[s++] = 55296 + (l >> 10), e[s++] = 56320 + (l & 1023)) : e[s++] = (l & 15) << 12 | (u[n++] & 63) << 6 | u[n++] & 63, s > 8191 && ((t || (t = [])).push(String.fromCharCode.apply(String, e)), s = 0);
940
+ for (var t = null, e = [], s = 0, l; r < n; )
941
+ 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);
939
942
  return t ? (s && t.push(String.fromCharCode.apply(String, e.slice(0, s))), t.join("")) : String.fromCharCode.apply(String, e.slice(0, s));
940
- }, o.write = function(u, n, r) {
941
- for (var i = r, t, e, s = 0; s < u.length; ++s)
942
- t = u.charCodeAt(s), t < 128 ? n[r++] = t : t < 2048 ? (n[r++] = t >> 6 | 192, n[r++] = t & 63 | 128) : (t & 64512) === 55296 && ((e = u.charCodeAt(s + 1)) & 64512) === 56320 ? (t = 65536 + ((t & 1023) << 10) + (e & 1023), ++s, n[r++] = t >> 18 | 240, n[r++] = t >> 12 & 63 | 128, n[r++] = t >> 6 & 63 | 128, n[r++] = t & 63 | 128) : (n[r++] = t >> 12 | 224, n[r++] = t >> 6 & 63 | 128, n[r++] = t & 63 | 128);
943
- return r - i;
943
+ }, o.write = function(u, r, n) {
944
+ for (var i = n, t, e, s = 0; s < u.length; ++s)
945
+ 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);
946
+ return n - i;
944
947
  };
945
948
  }(utf8)), utf8;
946
949
  }
@@ -949,11 +952,11 @@ function requirePool() {
949
952
  if (hasRequiredPool) return pool_1;
950
953
  hasRequiredPool = 1, pool_1 = h;
951
954
  function h(o, a, u) {
952
- var n = u || 8192, r = n >>> 1, i = null, t = n;
955
+ var r = u || 8192, n = r >>> 1, i = null, t = r;
953
956
  return function(s) {
954
- if (s < 1 || s > r)
957
+ if (s < 1 || s > n)
955
958
  return o(s);
956
- t + s > n && (i = o(n), t = 0);
959
+ t + s > r && (i = o(r), t = 0);
957
960
  var l = a.call(i, t, t += s);
958
961
  return t & 7 && (t = (t | 7) + 1), l;
959
962
  };
@@ -965,8 +968,8 @@ function requireLongbits() {
965
968
  if (hasRequiredLongbits) return longbits;
966
969
  hasRequiredLongbits = 1, longbits = o;
967
970
  var h = requireMinimal$1();
968
- function o(r, i) {
969
- this.lo = r >>> 0, this.hi = i >>> 0;
971
+ function o(n, i) {
972
+ this.lo = n >>> 0, this.hi = i >>> 0;
970
973
  }
971
974
  var a = o.zero = new o(0, 0);
972
975
  a.toNumber = function() {
@@ -1002,11 +1005,11 @@ function requireLongbits() {
1002
1005
  }, o.prototype.toLong = function(i) {
1003
1006
  return h.Long ? new h.Long(this.lo | 0, this.hi | 0, !!i) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!i };
1004
1007
  };
1005
- var n = String.prototype.charCodeAt;
1008
+ var r = String.prototype.charCodeAt;
1006
1009
  return o.fromHash = function(i) {
1007
1010
  return i === u ? a : new o(
1008
- (n.call(i, 0) | n.call(i, 1) << 8 | n.call(i, 2) << 16 | n.call(i, 3) << 24) >>> 0,
1009
- (n.call(i, 4) | n.call(i, 5) << 8 | n.call(i, 6) << 16 | n.call(i, 7) << 24) >>> 0
1011
+ (r.call(i, 0) | r.call(i, 1) << 8 | r.call(i, 2) << 16 | r.call(i, 3) << 24) >>> 0,
1012
+ (r.call(i, 4) | r.call(i, 5) << 8 | r.call(i, 6) << 16 | r.call(i, 7) << 24) >>> 0
1010
1013
  );
1011
1014
  }, o.prototype.toHash = function() {
1012
1015
  return String.fromCharCode(
@@ -1041,68 +1044,68 @@ function requireMinimal$1() {
1041
1044
  /* istanbul ignore next */
1042
1045
  {}
1043
1046
  ), o.isInteger = Number.isInteger || /* istanbul ignore next */
1044
- function(r) {
1045
- return typeof r == "number" && isFinite(r) && Math.floor(r) === r;
1046
- }, o.isString = function(r) {
1047
- return typeof r == "string" || r instanceof String;
1048
- }, o.isObject = function(r) {
1049
- return r && typeof r == "object";
1047
+ function(n) {
1048
+ return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1049
+ }, o.isString = function(n) {
1050
+ return typeof n == "string" || n instanceof String;
1051
+ }, o.isObject = function(n) {
1052
+ return n && typeof n == "object";
1050
1053
  }, o.isset = /**
1051
1054
  * Checks if a property on a message is considered to be present.
1052
1055
  * @param {Object} obj Plain object or message instance
1053
1056
  * @param {string} prop Property name
1054
1057
  * @returns {boolean} `true` if considered to be present, otherwise `false`
1055
1058
  */
1056
- o.isSet = function(r, i) {
1057
- var t = r[i];
1058
- return t != null && r.hasOwnProperty(i) ? typeof t != "object" || (Array.isArray(t) ? t.length : Object.keys(t).length) > 0 : !1;
1059
+ o.isSet = function(n, i) {
1060
+ var t = n[i];
1061
+ return t != null && n.hasOwnProperty(i) ? typeof t != "object" || (Array.isArray(t) ? t.length : Object.keys(t).length) > 0 : !1;
1059
1062
  }, o.Buffer = function() {
1060
1063
  try {
1061
- var n = o.inquire("buffer").Buffer;
1062
- return n.prototype.utf8Write ? n : (
1064
+ var r = o.inquire("buffer").Buffer;
1065
+ return r.prototype.utf8Write ? r : (
1063
1066
  /* istanbul ignore next */
1064
1067
  null
1065
1068
  );
1066
1069
  } catch {
1067
1070
  return null;
1068
1071
  }
1069
- }(), o._Buffer_from = null, o._Buffer_allocUnsafe = null, o.newBuffer = function(r) {
1070
- return typeof r == "number" ? o.Buffer ? o._Buffer_allocUnsafe(r) : new o.Array(r) : o.Buffer ? o._Buffer_from(r) : typeof Uint8Array > "u" ? r : new Uint8Array(r);
1072
+ }(), o._Buffer_from = null, o._Buffer_allocUnsafe = null, o.newBuffer = function(n) {
1073
+ 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);
1071
1074
  }, o.Array = typeof Uint8Array < "u" ? Uint8Array : Array, o.Long = /* istanbul ignore next */
1072
1075
  o.global.dcodeIO && /* istanbul ignore next */
1073
1076
  o.global.dcodeIO.Long || /* istanbul ignore next */
1074
- 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(r) {
1075
- return r ? o.LongBits.from(r).toHash() : o.LongBits.zeroHash;
1076
- }, o.longFromHash = function(r, i) {
1077
- var t = o.LongBits.fromHash(r);
1077
+ 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) {
1078
+ return n ? o.LongBits.from(n).toHash() : o.LongBits.zeroHash;
1079
+ }, o.longFromHash = function(n, i) {
1080
+ var t = o.LongBits.fromHash(n);
1078
1081
  return o.Long ? o.Long.fromBits(t.lo, t.hi, i) : t.toNumber(!!i);
1079
1082
  };
1080
- function a(n, r, i) {
1081
- for (var t = Object.keys(r), e = 0; e < t.length; ++e)
1082
- (n[t[e]] === void 0 || !i) && (n[t[e]] = r[t[e]]);
1083
- return n;
1083
+ function a(r, n, i) {
1084
+ for (var t = Object.keys(n), e = 0; e < t.length; ++e)
1085
+ (r[t[e]] === void 0 || !i) && (r[t[e]] = n[t[e]]);
1086
+ return r;
1084
1087
  }
1085
- o.merge = a, o.lcFirst = function(r) {
1086
- return r.charAt(0).toLowerCase() + r.substring(1);
1088
+ o.merge = a, o.lcFirst = function(n) {
1089
+ return n.charAt(0).toLowerCase() + n.substring(1);
1087
1090
  };
1088
- function u(n) {
1089
- function r(i, t) {
1090
- if (!(this instanceof r))
1091
- return new r(i, t);
1091
+ function u(r) {
1092
+ function n(i, t) {
1093
+ if (!(this instanceof n))
1094
+ return new n(i, t);
1092
1095
  Object.defineProperty(this, "message", { get: function() {
1093
1096
  return i;
1094
- } }), Error.captureStackTrace ? Error.captureStackTrace(this, r) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), t && a(this, t);
1097
+ } }), Error.captureStackTrace ? Error.captureStackTrace(this, n) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), t && a(this, t);
1095
1098
  }
1096
- return r.prototype = Object.create(Error.prototype, {
1099
+ return n.prototype = Object.create(Error.prototype, {
1097
1100
  constructor: {
1098
- value: r,
1101
+ value: n,
1099
1102
  writable: !0,
1100
1103
  enumerable: !1,
1101
1104
  configurable: !0
1102
1105
  },
1103
1106
  name: {
1104
1107
  get: function() {
1105
- return n;
1108
+ return r;
1106
1109
  },
1107
1110
  set: void 0,
1108
1111
  enumerable: !1,
@@ -1120,20 +1123,20 @@ function requireMinimal$1() {
1120
1123
  enumerable: !1,
1121
1124
  configurable: !0
1122
1125
  }
1123
- }), r;
1126
+ }), n;
1124
1127
  }
1125
- o.newError = u, o.ProtocolError = u("ProtocolError"), o.oneOfGetter = function(r) {
1126
- for (var i = {}, t = 0; t < r.length; ++t)
1127
- i[r[t]] = 1;
1128
+ o.newError = u, o.ProtocolError = u("ProtocolError"), o.oneOfGetter = function(n) {
1129
+ for (var i = {}, t = 0; t < n.length; ++t)
1130
+ i[n[t]] = 1;
1128
1131
  return function() {
1129
1132
  for (var e = Object.keys(this), s = e.length - 1; s > -1; --s)
1130
1133
  if (i[e[s]] === 1 && this[e[s]] !== void 0 && this[e[s]] !== null)
1131
1134
  return e[s];
1132
1135
  };
1133
- }, o.oneOfSetter = function(r) {
1136
+ }, o.oneOfSetter = function(n) {
1134
1137
  return function(i) {
1135
- for (var t = 0; t < r.length; ++t)
1136
- r[t] !== i && delete this[r[t]];
1138
+ for (var t = 0; t < n.length; ++t)
1139
+ n[t] !== i && delete this[n[t]];
1137
1140
  };
1138
1141
  }, o.toJSONOptions = {
1139
1142
  longs: String,
@@ -1141,17 +1144,17 @@ function requireMinimal$1() {
1141
1144
  bytes: String,
1142
1145
  json: !0
1143
1146
  }, o._configure = function() {
1144
- var n = o.Buffer;
1145
- if (!n) {
1147
+ var r = o.Buffer;
1148
+ if (!r) {
1146
1149
  o._Buffer_from = o._Buffer_allocUnsafe = null;
1147
1150
  return;
1148
1151
  }
1149
- o._Buffer_from = n.from !== Uint8Array.from && n.from || /* istanbul ignore next */
1152
+ o._Buffer_from = r.from !== Uint8Array.from && r.from || /* istanbul ignore next */
1150
1153
  function(i, t) {
1151
- return new n(i, t);
1152
- }, o._Buffer_allocUnsafe = n.allocUnsafe || /* istanbul ignore next */
1154
+ return new r(i, t);
1155
+ }, o._Buffer_allocUnsafe = r.allocUnsafe || /* istanbul ignore next */
1153
1156
  function(i) {
1154
- return new n(i);
1157
+ return new r(i);
1155
1158
  };
1156
1159
  };
1157
1160
  }(minimal$1)), minimal$1;
@@ -1160,8 +1163,8 @@ var writer, hasRequiredWriter;
1160
1163
  function requireWriter() {
1161
1164
  if (hasRequiredWriter) return writer;
1162
1165
  hasRequiredWriter = 1, writer = e;
1163
- var h = requireMinimal$1(), o, a = h.LongBits, u = h.base64, n = h.utf8;
1164
- function r(b, g, k) {
1166
+ var h = requireMinimal$1(), o, a = h.LongBits, u = h.base64, r = h.utf8;
1167
+ function n(b, g, k) {
1165
1168
  this.fn = b, this.len = g, this.next = void 0, this.val = k;
1166
1169
  }
1167
1170
  function i() {
@@ -1170,7 +1173,7 @@ function requireWriter() {
1170
1173
  this.head = b.head, this.tail = b.tail, this.len = b.len, this.next = b.states;
1171
1174
  }
1172
1175
  function e() {
1173
- this.len = 0, this.head = new r(i, 0, 0), this.tail = this.head, this.states = null;
1176
+ this.len = 0, this.head = new n(i, 0, 0), this.tail = this.head, this.states = null;
1174
1177
  }
1175
1178
  var s = function() {
1176
1179
  return h.Buffer ? function() {
@@ -1184,7 +1187,7 @@ function requireWriter() {
1184
1187
  e.create = s(), e.alloc = function(g) {
1185
1188
  return new h.Array(g);
1186
1189
  }, h.Array !== Array && (e.alloc = h.pool(e.alloc, h.Array.prototype.subarray)), e.prototype._push = function(g, k, _) {
1187
- return this.tail = this.tail.next = new r(g, k, _), this.len += k, this;
1190
+ return this.tail = this.tail.next = new n(g, k, _), this.len += k, this;
1188
1191
  };
1189
1192
  function l(b, g, k) {
1190
1193
  g[k] = b & 255;
@@ -1197,7 +1200,7 @@ function requireWriter() {
1197
1200
  function d(b, g) {
1198
1201
  this.len = b, this.next = void 0, this.val = g;
1199
1202
  }
1200
- d.prototype = Object.create(r.prototype), d.prototype.fn = c, e.prototype.uint32 = function(g) {
1203
+ d.prototype = Object.create(n.prototype), d.prototype.fn = c, e.prototype.uint32 = function(g) {
1201
1204
  return this.len += (this.tail = this.tail.next = new d(
1202
1205
  (g = g >>> 0) < 128 ? 1 : g < 16384 ? 2 : g < 2097152 ? 3 : g < 268435456 ? 4 : 5,
1203
1206
  g
@@ -1239,8 +1242,8 @@ function requireWriter() {
1239
1242
  var w = h.Array.prototype.set ? function(g, k, _) {
1240
1243
  k.set(g, _);
1241
1244
  } : function(g, k, _) {
1242
- for (var R = 0; R < g.length; ++R)
1243
- k[_ + R] = g[R];
1245
+ for (var K = 0; K < g.length; ++K)
1246
+ k[_ + K] = g[K];
1244
1247
  };
1245
1248
  return e.prototype.bytes = function(g) {
1246
1249
  var k = g.length >>> 0;
@@ -1252,12 +1255,12 @@ function requireWriter() {
1252
1255
  }
1253
1256
  return this.uint32(k)._push(w, k, g);
1254
1257
  }, e.prototype.string = function(g) {
1255
- var k = n.length(g);
1256
- return k ? this.uint32(k)._push(n.write, k, g) : this._push(l, 1, 0);
1258
+ var k = r.length(g);
1259
+ return k ? this.uint32(k)._push(r.write, k, g) : this._push(l, 1, 0);
1257
1260
  }, e.prototype.fork = function() {
1258
- return this.states = new t(this), this.head = this.tail = new r(i, 0, 0), this.len = 0, this;
1261
+ return this.states = new t(this), this.head = this.tail = new n(i, 0, 0), this.len = 0, this;
1259
1262
  }, e.prototype.reset = function() {
1260
- 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 r(i, 0, 0), this.len = 0), this;
1263
+ 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;
1261
1264
  }, e.prototype.ldelim = function() {
1262
1265
  var g = this.head, k = this.tail, _ = this.len;
1263
1266
  return this.reset().uint32(_), _ && (this.tail.next = g.next, this.tail = k, this.len += _), this;
@@ -1280,65 +1283,65 @@ function requireWriter_buffer() {
1280
1283
  h.call(this);
1281
1284
  }
1282
1285
  a._configure = function() {
1283
- a.alloc = o._Buffer_allocUnsafe, a.writeBytesBuffer = o.Buffer && o.Buffer.prototype instanceof Uint8Array && o.Buffer.prototype.set.name === "set" ? function(r, i, t) {
1284
- i.set(r, t);
1285
- } : function(r, i, t) {
1286
- if (r.copy)
1287
- r.copy(i, t, 0, r.length);
1288
- else for (var e = 0; e < r.length; )
1289
- i[t++] = r[e++];
1286
+ a.alloc = o._Buffer_allocUnsafe, a.writeBytesBuffer = o.Buffer && o.Buffer.prototype instanceof Uint8Array && o.Buffer.prototype.set.name === "set" ? function(n, i, t) {
1287
+ i.set(n, t);
1288
+ } : function(n, i, t) {
1289
+ if (n.copy)
1290
+ n.copy(i, t, 0, n.length);
1291
+ else for (var e = 0; e < n.length; )
1292
+ i[t++] = n[e++];
1290
1293
  };
1291
- }, a.prototype.bytes = function(r) {
1292
- o.isString(r) && (r = o._Buffer_from(r, "base64"));
1293
- var i = r.length >>> 0;
1294
- return this.uint32(i), i && this._push(a.writeBytesBuffer, i, r), this;
1294
+ }, a.prototype.bytes = function(n) {
1295
+ o.isString(n) && (n = o._Buffer_from(n, "base64"));
1296
+ var i = n.length >>> 0;
1297
+ return this.uint32(i), i && this._push(a.writeBytesBuffer, i, n), this;
1295
1298
  };
1296
- function u(n, r, i) {
1297
- n.length < 40 ? o.utf8.write(n, r, i) : r.utf8Write ? r.utf8Write(n, i) : r.write(n, i);
1299
+ function u(r, n, i) {
1300
+ r.length < 40 ? o.utf8.write(r, n, i) : n.utf8Write ? n.utf8Write(r, i) : n.write(r, i);
1298
1301
  }
1299
- return a.prototype.string = function(r) {
1300
- var i = o.Buffer.byteLength(r);
1301
- return this.uint32(i), i && this._push(u, i, r), this;
1302
+ return a.prototype.string = function(n) {
1303
+ var i = o.Buffer.byteLength(n);
1304
+ return this.uint32(i), i && this._push(u, i, n), this;
1302
1305
  }, a._configure(), writer_buffer;
1303
1306
  }
1304
1307
  var reader, hasRequiredReader;
1305
1308
  function requireReader() {
1306
1309
  if (hasRequiredReader) return reader;
1307
- hasRequiredReader = 1, reader = r;
1310
+ hasRequiredReader = 1, reader = n;
1308
1311
  var h = requireMinimal$1(), o, a = h.LongBits, u = h.utf8;
1309
- function n(c, d) {
1312
+ function r(c, d) {
1310
1313
  return RangeError("index out of range: " + c.pos + " + " + (d || 1) + " > " + c.len);
1311
1314
  }
1312
- function r(c) {
1315
+ function n(c) {
1313
1316
  this.buf = c, this.pos = 0, this.len = c.length;
1314
1317
  }
1315
1318
  var i = typeof Uint8Array < "u" ? function(d) {
1316
1319
  if (d instanceof Uint8Array || Array.isArray(d))
1317
- return new r(d);
1320
+ return new n(d);
1318
1321
  throw Error("illegal buffer");
1319
1322
  } : function(d) {
1320
1323
  if (Array.isArray(d))
1321
- return new r(d);
1324
+ return new n(d);
1322
1325
  throw Error("illegal buffer");
1323
1326
  }, t = function() {
1324
1327
  return h.Buffer ? function(p) {
1325
- return (r.create = function(w) {
1328
+ return (n.create = function(w) {
1326
1329
  return h.Buffer.isBuffer(w) ? new o(w) : i(w);
1327
1330
  })(p);
1328
1331
  } : i;
1329
1332
  };
1330
- r.create = t(), r.prototype._slice = h.Array.prototype.subarray || /* istanbul ignore next */
1331
- h.Array.prototype.slice, r.prototype.uint32 = /* @__PURE__ */ function() {
1333
+ n.create = t(), n.prototype._slice = h.Array.prototype.subarray || /* istanbul ignore next */
1334
+ h.Array.prototype.slice, n.prototype.uint32 = /* @__PURE__ */ function() {
1332
1335
  var d = 4294967295;
1333
1336
  return function() {
1334
1337
  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;
1335
1338
  if ((this.pos += 5) > this.len)
1336
- throw this.pos = this.len, n(this, 10);
1339
+ throw this.pos = this.len, r(this, 10);
1337
1340
  return d;
1338
1341
  };
1339
- }(), r.prototype.int32 = function() {
1342
+ }(), n.prototype.int32 = function() {
1340
1343
  return this.uint32() | 0;
1341
- }, r.prototype.sint32 = function() {
1344
+ }, n.prototype.sint32 = function() {
1342
1345
  var d = this.uint32();
1343
1346
  return d >>> 1 ^ -(d & 1) | 0;
1344
1347
  };
@@ -1354,7 +1357,7 @@ function requireReader() {
1354
1357
  } else {
1355
1358
  for (; d < 3; ++d) {
1356
1359
  if (this.pos >= this.len)
1357
- throw n(this);
1360
+ throw r(this);
1358
1361
  if (c.lo = (c.lo | (this.buf[this.pos] & 127) << d * 7) >>> 0, this.buf[this.pos++] < 128)
1359
1362
  return c;
1360
1363
  }
@@ -1367,46 +1370,46 @@ function requireReader() {
1367
1370
  } else
1368
1371
  for (; d < 5; ++d) {
1369
1372
  if (this.pos >= this.len)
1370
- throw n(this);
1373
+ throw r(this);
1371
1374
  if (c.hi = (c.hi | (this.buf[this.pos] & 127) << d * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
1372
1375
  return c;
1373
1376
  }
1374
1377
  throw Error("invalid varint encoding");
1375
1378
  }
1376
- r.prototype.bool = function() {
1379
+ n.prototype.bool = function() {
1377
1380
  return this.uint32() !== 0;
1378
1381
  };
1379
1382
  function s(c, d) {
1380
1383
  return (c[d - 4] | c[d - 3] << 8 | c[d - 2] << 16 | c[d - 1] << 24) >>> 0;
1381
1384
  }
1382
- r.prototype.fixed32 = function() {
1385
+ n.prototype.fixed32 = function() {
1383
1386
  if (this.pos + 4 > this.len)
1384
- throw n(this, 4);
1387
+ throw r(this, 4);
1385
1388
  return s(this.buf, this.pos += 4);
1386
- }, r.prototype.sfixed32 = function() {
1389
+ }, n.prototype.sfixed32 = function() {
1387
1390
  if (this.pos + 4 > this.len)
1388
- throw n(this, 4);
1391
+ throw r(this, 4);
1389
1392
  return s(this.buf, this.pos += 4) | 0;
1390
1393
  };
1391
1394
  function l() {
1392
1395
  if (this.pos + 8 > this.len)
1393
- throw n(this, 8);
1396
+ throw r(this, 8);
1394
1397
  return new a(s(this.buf, this.pos += 4), s(this.buf, this.pos += 4));
1395
1398
  }
1396
- return r.prototype.float = function() {
1399
+ return n.prototype.float = function() {
1397
1400
  if (this.pos + 4 > this.len)
1398
- throw n(this, 4);
1401
+ throw r(this, 4);
1399
1402
  var d = h.float.readFloatLE(this.buf, this.pos);
1400
1403
  return this.pos += 4, d;
1401
- }, r.prototype.double = function() {
1404
+ }, n.prototype.double = function() {
1402
1405
  if (this.pos + 8 > this.len)
1403
- throw n(this, 4);
1406
+ throw r(this, 4);
1404
1407
  var d = h.float.readDoubleLE(this.buf, this.pos);
1405
1408
  return this.pos += 8, d;
1406
- }, r.prototype.bytes = function() {
1409
+ }, n.prototype.bytes = function() {
1407
1410
  var d = this.uint32(), p = this.pos, f = this.pos + d;
1408
1411
  if (f > this.len)
1409
- throw n(this, d);
1412
+ throw r(this, d);
1410
1413
  if (this.pos += d, Array.isArray(this.buf))
1411
1414
  return this.buf.slice(p, f);
1412
1415
  if (p === f) {
@@ -1414,21 +1417,21 @@ function requireReader() {
1414
1417
  return w ? w.alloc(0) : new this.buf.constructor(0);
1415
1418
  }
1416
1419
  return this._slice.call(this.buf, p, f);
1417
- }, r.prototype.string = function() {
1420
+ }, n.prototype.string = function() {
1418
1421
  var d = this.bytes();
1419
1422
  return u.read(d, 0, d.length);
1420
- }, r.prototype.skip = function(d) {
1423
+ }, n.prototype.skip = function(d) {
1421
1424
  if (typeof d == "number") {
1422
1425
  if (this.pos + d > this.len)
1423
- throw n(this, d);
1426
+ throw r(this, d);
1424
1427
  this.pos += d;
1425
1428
  } else
1426
1429
  do
1427
1430
  if (this.pos >= this.len)
1428
- throw n(this);
1431
+ throw r(this);
1429
1432
  while (this.buf[this.pos++] & 128);
1430
1433
  return this;
1431
- }, r.prototype.skipType = function(c) {
1434
+ }, n.prototype.skipType = function(c) {
1432
1435
  switch (c) {
1433
1436
  case 0:
1434
1437
  this.skip();
@@ -1451,13 +1454,13 @@ function requireReader() {
1451
1454
  throw Error("invalid wire type " + c + " at offset " + this.pos);
1452
1455
  }
1453
1456
  return this;
1454
- }, r._configure = function(c) {
1455
- o = c, r.create = t(), o._configure();
1457
+ }, n._configure = function(c) {
1458
+ o = c, n.create = t(), o._configure();
1456
1459
  var d = h.Long ? "toLong" : (
1457
1460
  /* istanbul ignore next */
1458
1461
  "toNumber"
1459
1462
  );
1460
- h.merge(r.prototype, {
1463
+ h.merge(n.prototype, {
1461
1464
  int64: function() {
1462
1465
  return e.call(this)[d](!1);
1463
1466
  },
@@ -1489,8 +1492,8 @@ function requireReader_buffer() {
1489
1492
  return a._configure = function() {
1490
1493
  o.Buffer && (a.prototype._slice = o.Buffer.prototype.slice);
1491
1494
  }, a.prototype.string = function() {
1492
- var n = this.uint32();
1493
- return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + n, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + n, this.len));
1495
+ var r = this.uint32();
1496
+ 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));
1494
1497
  }, a._configure(), reader_buffer;
1495
1498
  }
1496
1499
  var rpc = {}, service, hasRequiredService;
@@ -1499,17 +1502,17 @@ function requireService() {
1499
1502
  hasRequiredService = 1, service = o;
1500
1503
  var h = requireMinimal$1();
1501
1504
  (o.prototype = Object.create(h.EventEmitter.prototype)).constructor = o;
1502
- function o(a, u, n) {
1505
+ function o(a, u, r) {
1503
1506
  if (typeof a != "function")
1504
1507
  throw TypeError("rpcImpl must be a function");
1505
- h.EventEmitter.call(this), this.rpcImpl = a, this.requestDelimited = !!u, this.responseDelimited = !!n;
1508
+ h.EventEmitter.call(this), this.rpcImpl = a, this.requestDelimited = !!u, this.responseDelimited = !!r;
1506
1509
  }
1507
- return o.prototype.rpcCall = function a(u, n, r, i, t) {
1510
+ return o.prototype.rpcCall = function a(u, r, n, i, t) {
1508
1511
  if (!i)
1509
1512
  throw TypeError("request must be specified");
1510
1513
  var e = this;
1511
1514
  if (!t)
1512
- return h.asPromise(a, e, u, n, r, i);
1515
+ return h.asPromise(a, e, u, r, n, i);
1513
1516
  if (!e.rpcImpl) {
1514
1517
  setTimeout(function() {
1515
1518
  t(Error("already ended"));
@@ -1519,7 +1522,7 @@ function requireService() {
1519
1522
  try {
1520
1523
  return e.rpcImpl(
1521
1524
  u,
1522
- n[e.requestDelimited ? "encodeDelimited" : "encode"](i).finish(),
1525
+ r[e.requestDelimited ? "encodeDelimited" : "encode"](i).finish(),
1523
1526
  function(l, c) {
1524
1527
  if (l)
1525
1528
  return e.emit("error", l, u), t(l);
@@ -1530,9 +1533,9 @@ function requireService() {
1530
1533
  );
1531
1534
  return;
1532
1535
  }
1533
- if (!(c instanceof r))
1536
+ if (!(c instanceof n))
1534
1537
  try {
1535
- c = r[e.responseDelimited ? "decodeDelimited" : "decode"](c);
1538
+ c = n[e.responseDelimited ? "decodeDelimited" : "decode"](c);
1536
1539
  } catch (d) {
1537
1540
  return e.emit("error", d, u), t(d);
1538
1541
  }
@@ -1585,12 +1588,12 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1585
1588
  return a.proto = function() {
1586
1589
  const u = {};
1587
1590
  return u.SeiData = function() {
1588
- function n(r) {
1589
- if (r) for (let i = Object.keys(r), t = 0; t < i.length; ++t) r[i[t]] != null && (this[i[t]] = r[i[t]]);
1591
+ function r(n) {
1592
+ if (n) for (let i = Object.keys(n), t = 0; t < i.length; ++t) n[i[t]] != null && (this[i[t]] = n[i[t]]);
1590
1593
  }
1591
- return n.prototype.event = 0, n.prototype.data = $util.newBuffer([]), n.prototype.compress = !1, n.prototype.version = 0, n.create = function(i) {
1592
- return new n(i);
1593
- }, n.encode = function(i, t) {
1594
+ return r.prototype.event = 0, r.prototype.data = $util.newBuffer([]), r.prototype.compress = !1, r.prototype.version = 0, r.create = function(i) {
1595
+ return new r(i);
1596
+ }, r.encode = function(i, t) {
1594
1597
  return t || (t = $Writer.create()), i.event != null && Object.hasOwnProperty.call(i, "event") && t.uint32(
1595
1598
  /* id 1, wireType 0 =*/
1596
1599
  8
@@ -1604,9 +1607,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1604
1607
  /* id 4, wireType 0 =*/
1605
1608
  32
1606
1609
  ).int32(i.version), t;
1607
- }, n.encodeDelimited = function(i, t) {
1610
+ }, r.encodeDelimited = function(i, t) {
1608
1611
  return this.encode(i, t).ldelim();
1609
- }, n.decode = function(i, t, e) {
1612
+ }, r.decode = function(i, t, e) {
1610
1613
  i instanceof $Reader || (i = $Reader.create(i));
1611
1614
  let s = t === void 0 ? i.len : i.pos + t, l = new $root.com.quick.voice.proto.SeiData();
1612
1615
  for (; i.pos < s; ) {
@@ -1635,9 +1638,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1635
1638
  }
1636
1639
  }
1637
1640
  return l;
1638
- }, n.decodeDelimited = function(i) {
1641
+ }, r.decodeDelimited = function(i) {
1639
1642
  return i instanceof $Reader || (i = new $Reader(i)), this.decode(i, i.uint32());
1640
- }, n.verify = function(i) {
1643
+ }, r.verify = function(i) {
1641
1644
  if (typeof i != "object" || i === null) return "object expected";
1642
1645
  if (i.event != null && i.hasOwnProperty("event"))
1643
1646
  switch (i.event) {
@@ -1648,7 +1651,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1648
1651
  break;
1649
1652
  }
1650
1653
  return i.data != null && i.hasOwnProperty("data") && !(i.data && typeof i.data.length == "number" || $util.isString(i.data)) ? "data: buffer expected" : i.compress != null && i.hasOwnProperty("compress") && typeof i.compress != "boolean" ? "compress: boolean expected" : i.version != null && i.hasOwnProperty("version") && !$util.isInteger(i.version) ? "version: integer expected" : null;
1651
- }, n.fromObject = function(i) {
1654
+ }, r.fromObject = function(i) {
1652
1655
  if (i instanceof $root.com.quick.voice.proto.SeiData) return i;
1653
1656
  let t = new $root.com.quick.voice.proto.SeiData();
1654
1657
  switch (i.event) {
@@ -1668,30 +1671,30 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1668
1671
  break;
1669
1672
  }
1670
1673
  return i.data != null && (typeof i.data == "string" ? $util.base64.decode(i.data, t.data = $util.newBuffer($util.base64.length(i.data)), 0) : i.data.length >= 0 && (t.data = i.data)), i.compress != null && (t.compress = !!i.compress), i.version != null && (t.version = i.version | 0), t;
1671
- }, n.toObject = function(i, t) {
1674
+ }, r.toObject = function(i, t) {
1672
1675
  t || (t = {});
1673
1676
  let e = {};
1674
1677
  return t.defaults && (e.event = t.enums === String ? "Layout" : 0, t.bytes === String ? e.data = "" : (e.data = [], t.bytes !== Array && (e.data = $util.newBuffer(e.data))), e.compress = !1, e.version = 0), i.event != null && i.hasOwnProperty("event") && (e.event = t.enums === String ? $root.com.quick.voice.proto.EventType[i.event] === void 0 ? i.event : $root.com.quick.voice.proto.EventType[i.event] : i.event), i.data != null && i.hasOwnProperty("data") && (e.data = t.bytes === String ? $util.base64.encode(i.data, 0, i.data.length) : t.bytes === Array ? Array.prototype.slice.call(i.data) : i.data), i.compress != null && i.hasOwnProperty("compress") && (e.compress = i.compress), i.version != null && i.hasOwnProperty("version") && (e.version = i.version), e;
1675
- }, n.prototype.toJSON = function() {
1678
+ }, r.prototype.toJSON = function() {
1676
1679
  return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
1677
- }, n.getTypeUrl = function(i) {
1680
+ }, r.getTypeUrl = function(i) {
1678
1681
  return i === void 0 && (i = "type.googleapis.com"), i + "/com.quick.voice.proto.SeiData";
1679
- }, n;
1682
+ }, r;
1680
1683
  }(), u.EventType = function() {
1681
- const n = {}, r = Object.create(n);
1682
- return r[n[0] = "Layout"] = 0, r[n[1] = "Custom"] = 1, r;
1684
+ const r = {}, n = Object.create(r);
1685
+ return n[r[0] = "Layout"] = 0, n[r[1] = "Custom"] = 1, n;
1683
1686
  }(), u.LayoutData = function() {
1684
- function n(i) {
1687
+ function r(i) {
1685
1688
  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]]);
1686
1689
  }
1687
- n.prototype.roomId = "", n.prototype.type = 0, n.prototype.userMap = $util.emptyObject, n.prototype.globalCustom = null;
1688
- let r;
1689
- return Object.defineProperty(n.prototype, "_globalCustom", {
1690
- get: $util.oneOfGetter(r = ["globalCustom"]),
1691
- set: $util.oneOfSetter(r)
1692
- }), n.create = function(t) {
1693
- return new n(t);
1694
- }, n.encode = function(t, e) {
1690
+ r.prototype.roomId = "", r.prototype.type = 0, r.prototype.userMap = $util.emptyObject, r.prototype.globalCustom = null;
1691
+ let n;
1692
+ return Object.defineProperty(r.prototype, "_globalCustom", {
1693
+ get: $util.oneOfGetter(n = ["globalCustom"]),
1694
+ set: $util.oneOfSetter(n)
1695
+ }), r.create = function(t) {
1696
+ return new r(t);
1697
+ }, r.encode = function(t, e) {
1695
1698
  if (e || (e = $Writer.create()), t.roomId != null && Object.hasOwnProperty.call(t, "roomId") && e.uint32(
1696
1699
  /* id 1, wireType 2 =*/
1697
1700
  10
@@ -1714,9 +1717,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1714
1717
  /* id 4, wireType 2 =*/
1715
1718
  34
1716
1719
  ).fork()).ldelim(), e;
1717
- }, n.encodeDelimited = function(t, e) {
1720
+ }, r.encodeDelimited = function(t, e) {
1718
1721
  return this.encode(t, e).ldelim();
1719
- }, n.decode = function(t, e, s) {
1722
+ }, r.decode = function(t, e, s) {
1720
1723
  t instanceof $Reader || (t = $Reader.create(t));
1721
1724
  let l = e === void 0 ? t.len : t.pos + e, c = new $root.com.quick.voice.proto.LayoutData(), d, p;
1722
1725
  for (; t.pos < l; ) {
@@ -1761,9 +1764,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1761
1764
  }
1762
1765
  }
1763
1766
  return c;
1764
- }, n.decodeDelimited = function(t) {
1767
+ }, r.decodeDelimited = function(t) {
1765
1768
  return t instanceof $Reader || (t = new $Reader(t)), this.decode(t, t.uint32());
1766
- }, n.verify = function(t) {
1769
+ }, r.verify = function(t) {
1767
1770
  if (typeof t != "object" || t === null) return "object expected";
1768
1771
  if (t.roomId != null && t.hasOwnProperty("roomId") && !$util.isString(t.roomId)) return "roomId: string expected";
1769
1772
  if (t.type != null && t.hasOwnProperty("type"))
@@ -1788,7 +1791,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1788
1791
  if (e) return "globalCustom." + e;
1789
1792
  }
1790
1793
  return null;
1791
- }, n.fromObject = function(t) {
1794
+ }, r.fromObject = function(t) {
1792
1795
  if (t instanceof $root.com.quick.voice.proto.LayoutData) return t;
1793
1796
  let e = new $root.com.quick.voice.proto.LayoutData();
1794
1797
  switch (t.roomId != null && (e.roomId = String(t.roomId)), t.type) {
@@ -1824,7 +1827,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1824
1827
  e.globalCustom = $root.com.quick.voice.proto.CustomInfo.fromObject(t.globalCustom);
1825
1828
  }
1826
1829
  return e;
1827
- }, n.toObject = function(t, e) {
1830
+ }, r.toObject = function(t, e) {
1828
1831
  e || (e = {});
1829
1832
  let s = {};
1830
1833
  (e.objects || e.defaults) && (s.userMap = {}), e.defaults && (s.roomId = "", s.type = e.enums === String ? "AudioAndVideo" : 0), t.roomId != null && t.hasOwnProperty("roomId") && (s.roomId = t.roomId), t.type != null && t.hasOwnProperty("type") && (s.type = e.enums === String ? $root.com.quick.voice.proto.LayoutType[t.type] === void 0 ? t.type : $root.com.quick.voice.proto.LayoutType[t.type] : t.type);
@@ -1834,23 +1837,23 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1834
1837
  for (let c = 0; c < l.length; ++c) s.userMap[l[c]] = $root.com.quick.voice.proto.UserInfo.toObject(t.userMap[l[c]], e);
1835
1838
  }
1836
1839
  return t.globalCustom != null && t.hasOwnProperty("globalCustom") && (s.globalCustom = $root.com.quick.voice.proto.CustomInfo.toObject(t.globalCustom, e), e.oneofs && (s._globalCustom = "globalCustom")), s;
1837
- }, n.prototype.toJSON = function() {
1840
+ }, r.prototype.toJSON = function() {
1838
1841
  return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
1839
- }, n.getTypeUrl = function(t) {
1842
+ }, r.getTypeUrl = function(t) {
1840
1843
  return t === void 0 && (t = "type.googleapis.com"), t + "/com.quick.voice.proto.LayoutData";
1841
- }, n;
1844
+ }, r;
1842
1845
  }(), u.UserInfo = function() {
1843
- function n(i) {
1846
+ function r(i) {
1844
1847
  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]]);
1845
1848
  }
1846
- n.prototype.id = "", n.prototype.audios = $util.emptyArray, n.prototype.videos = $util.emptyArray, n.prototype.custom = null;
1847
- let r;
1848
- return Object.defineProperty(n.prototype, "_custom", {
1849
- get: $util.oneOfGetter(r = ["custom"]),
1850
- set: $util.oneOfSetter(r)
1851
- }), n.create = function(t) {
1852
- return new n(t);
1853
- }, n.encode = function(t, e) {
1849
+ r.prototype.id = "", r.prototype.audios = $util.emptyArray, r.prototype.videos = $util.emptyArray, r.prototype.custom = null;
1850
+ let n;
1851
+ return Object.defineProperty(r.prototype, "_custom", {
1852
+ get: $util.oneOfGetter(n = ["custom"]),
1853
+ set: $util.oneOfSetter(n)
1854
+ }), r.create = function(t) {
1855
+ return new r(t);
1856
+ }, r.encode = function(t, e) {
1854
1857
  if (e || (e = $Writer.create()), t.id != null && Object.hasOwnProperty.call(t, "id") && e.uint32(
1855
1858
  /* id 1, wireType 2 =*/
1856
1859
  10
@@ -1866,9 +1869,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1866
1869
  /* id 4, wireType 2 =*/
1867
1870
  34
1868
1871
  ).fork()).ldelim(), e;
1869
- }, n.encodeDelimited = function(t, e) {
1872
+ }, r.encodeDelimited = function(t, e) {
1870
1873
  return this.encode(t, e).ldelim();
1871
- }, n.decode = function(t, e, s) {
1874
+ }, r.decode = function(t, e, s) {
1872
1875
  t instanceof $Reader || (t = $Reader.create(t));
1873
1876
  let l = e === void 0 ? t.len : t.pos + e, c = new $root.com.quick.voice.proto.UserInfo();
1874
1877
  for (; t.pos < l; ) {
@@ -1897,9 +1900,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1897
1900
  }
1898
1901
  }
1899
1902
  return c;
1900
- }, n.decodeDelimited = function(t) {
1903
+ }, r.decodeDelimited = function(t) {
1901
1904
  return t instanceof $Reader || (t = new $Reader(t)), this.decode(t, t.uint32());
1902
- }, n.verify = function(t) {
1905
+ }, r.verify = function(t) {
1903
1906
  if (typeof t != "object" || t === null) return "object expected";
1904
1907
  if (t.id != null && t.hasOwnProperty("id") && !$util.isString(t.id)) return "id: string expected";
1905
1908
  if (t.audios != null && t.hasOwnProperty("audios")) {
@@ -1921,7 +1924,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1921
1924
  if (e) return "custom." + e;
1922
1925
  }
1923
1926
  return null;
1924
- }, n.fromObject = function(t) {
1927
+ }, r.fromObject = function(t) {
1925
1928
  if (t instanceof $root.com.quick.voice.proto.UserInfo) return t;
1926
1929
  let e = new $root.com.quick.voice.proto.UserInfo();
1927
1930
  if (t.id != null && (e.id = String(t.id)), t.audios) {
@@ -1945,7 +1948,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1945
1948
  e.custom = $root.com.quick.voice.proto.CustomInfo.fromObject(t.custom);
1946
1949
  }
1947
1950
  return e;
1948
- }, n.toObject = function(t, e) {
1951
+ }, r.toObject = function(t, e) {
1949
1952
  e || (e = {});
1950
1953
  let s = {};
1951
1954
  if ((e.arrays || e.defaults) && (s.audios = [], s.videos = []), e.defaults && (s.id = ""), t.id != null && t.hasOwnProperty("id") && (s.id = t.id), t.audios && t.audios.length) {
@@ -1957,23 +1960,23 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1957
1960
  for (let l = 0; l < t.videos.length; ++l) s.videos[l] = $root.com.quick.voice.proto.VideoInfo.toObject(t.videos[l], e);
1958
1961
  }
1959
1962
  return t.custom != null && t.hasOwnProperty("custom") && (s.custom = $root.com.quick.voice.proto.CustomInfo.toObject(t.custom, e), e.oneofs && (s._custom = "custom")), s;
1960
- }, n.prototype.toJSON = function() {
1963
+ }, r.prototype.toJSON = function() {
1961
1964
  return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
1962
- }, n.getTypeUrl = function(t) {
1965
+ }, r.getTypeUrl = function(t) {
1963
1966
  return t === void 0 && (t = "type.googleapis.com"), t + "/com.quick.voice.proto.UserInfo";
1964
- }, n;
1967
+ }, r;
1965
1968
  }(), u.AudioInfo = function() {
1966
- function n(i) {
1969
+ function r(i) {
1967
1970
  if (i) for (let t = Object.keys(i), e = 0; e < t.length; ++e) i[t[e]] != null && (this[t[e]] = i[t[e]]);
1968
1971
  }
1969
- n.prototype.type = 0, n.prototype.isEnable = !1, n.prototype.isMute = !1, n.prototype.volume = 0, n.prototype.updateTime = null;
1970
- let r;
1971
- return Object.defineProperty(n.prototype, "_updateTime", {
1972
- get: $util.oneOfGetter(r = ["updateTime"]),
1973
- set: $util.oneOfSetter(r)
1974
- }), n.create = function(t) {
1975
- return new n(t);
1976
- }, n.encode = function(t, e) {
1972
+ r.prototype.type = 0, r.prototype.isEnable = !1, r.prototype.isMute = !1, r.prototype.volume = 0, r.prototype.updateTime = null;
1973
+ let n;
1974
+ return Object.defineProperty(r.prototype, "_updateTime", {
1975
+ get: $util.oneOfGetter(n = ["updateTime"]),
1976
+ set: $util.oneOfSetter(n)
1977
+ }), r.create = function(t) {
1978
+ return new r(t);
1979
+ }, r.encode = function(t, e) {
1977
1980
  return e || (e = $Writer.create()), t.type != null && Object.hasOwnProperty.call(t, "type") && e.uint32(
1978
1981
  /* id 1, wireType 0 =*/
1979
1982
  8
@@ -1990,9 +1993,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
1990
1993
  /* id 5, wireType 0 =*/
1991
1994
  40
1992
1995
  ).int64(t.updateTime), e;
1993
- }, n.encodeDelimited = function(t, e) {
1996
+ }, r.encodeDelimited = function(t, e) {
1994
1997
  return this.encode(t, e).ldelim();
1995
- }, n.decode = function(t, e, s) {
1998
+ }, r.decode = function(t, e, s) {
1996
1999
  t instanceof $Reader || (t = $Reader.create(t));
1997
2000
  let l = e === void 0 ? t.len : t.pos + e, c = new $root.com.quick.voice.proto.AudioInfo();
1998
2001
  for (; t.pos < l; ) {
@@ -2025,9 +2028,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2025
2028
  }
2026
2029
  }
2027
2030
  return c;
2028
- }, n.decodeDelimited = function(t) {
2031
+ }, r.decodeDelimited = function(t) {
2029
2032
  return t instanceof $Reader || (t = new $Reader(t)), this.decode(t, t.uint32());
2030
- }, n.verify = function(t) {
2033
+ }, r.verify = function(t) {
2031
2034
  if (typeof t != "object" || t === null) return "object expected";
2032
2035
  if (t.type != null && t.hasOwnProperty("type"))
2033
2036
  switch (t.type) {
@@ -2038,7 +2041,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2038
2041
  break;
2039
2042
  }
2040
2043
  return t.isEnable != null && t.hasOwnProperty("isEnable") && typeof t.isEnable != "boolean" ? "isEnable: boolean expected" : t.isMute != null && t.hasOwnProperty("isMute") && typeof t.isMute != "boolean" ? "isMute: boolean expected" : t.volume != null && t.hasOwnProperty("volume") && typeof t.volume != "number" ? "volume: number expected" : t.updateTime != null && t.hasOwnProperty("updateTime") && !$util.isInteger(t.updateTime) && !(t.updateTime && $util.isInteger(t.updateTime.low) && $util.isInteger(t.updateTime.high)) ? "updateTime: integer|Long expected" : null;
2041
- }, n.fromObject = function(t) {
2044
+ }, r.fromObject = function(t) {
2042
2045
  if (t instanceof $root.com.quick.voice.proto.AudioInfo) return t;
2043
2046
  let e = new $root.com.quick.voice.proto.AudioInfo();
2044
2047
  switch (t.type) {
@@ -2058,27 +2061,27 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2058
2061
  break;
2059
2062
  }
2060
2063
  return t.isEnable != null && (e.isEnable = !!t.isEnable), t.isMute != null && (e.isMute = !!t.isMute), t.volume != null && (e.volume = Number(t.volume)), t.updateTime != null && ($util.Long ? (e.updateTime = $util.Long.fromValue(t.updateTime)).unsigned = !1 : typeof t.updateTime == "string" ? e.updateTime = parseInt(t.updateTime, 10) : typeof t.updateTime == "number" ? e.updateTime = t.updateTime : typeof t.updateTime == "object" && (e.updateTime = new $util.LongBits(t.updateTime.low >>> 0, t.updateTime.high >>> 0).toNumber())), e;
2061
- }, n.toObject = function(t, e) {
2064
+ }, r.toObject = function(t, e) {
2062
2065
  e || (e = {});
2063
2066
  let s = {};
2064
2067
  return e.defaults && (s.type = e.enums === String ? "Microphone" : 0, s.isEnable = !1, s.isMute = !1, s.volume = 0), t.type != null && t.hasOwnProperty("type") && (s.type = e.enums === String ? $root.com.quick.voice.proto.AudioType[t.type] === void 0 ? t.type : $root.com.quick.voice.proto.AudioType[t.type] : t.type), t.isEnable != null && t.hasOwnProperty("isEnable") && (s.isEnable = t.isEnable), t.isMute != null && t.hasOwnProperty("isMute") && (s.isMute = t.isMute), t.volume != null && t.hasOwnProperty("volume") && (s.volume = e.json && !isFinite(t.volume) ? String(t.volume) : t.volume), t.updateTime != null && t.hasOwnProperty("updateTime") && (typeof t.updateTime == "number" ? s.updateTime = e.longs === String ? String(t.updateTime) : t.updateTime : s.updateTime = e.longs === String ? $util.Long.prototype.toString.call(t.updateTime) : e.longs === Number ? new $util.LongBits(t.updateTime.low >>> 0, t.updateTime.high >>> 0).toNumber() : t.updateTime, e.oneofs && (s._updateTime = "updateTime")), s;
2065
- }, n.prototype.toJSON = function() {
2068
+ }, r.prototype.toJSON = function() {
2066
2069
  return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
2067
- }, n.getTypeUrl = function(t) {
2070
+ }, r.getTypeUrl = function(t) {
2068
2071
  return t === void 0 && (t = "type.googleapis.com"), t + "/com.quick.voice.proto.AudioInfo";
2069
- }, n;
2072
+ }, r;
2070
2073
  }(), u.VideoInfo = function() {
2071
- function n(i) {
2074
+ function r(i) {
2072
2075
  if (i) for (let t = Object.keys(i), e = 0; e < t.length; ++e) i[t[e]] != null && (this[t[e]] = i[t[e]]);
2073
2076
  }
2074
- n.prototype.type = 0, n.prototype.isEnable = !1, n.prototype.isMute = !1, n.prototype.width = 0, n.prototype.height = 0, n.prototype.x = 0, n.prototype.y = 0, n.prototype.updateTime = null;
2075
- let r;
2076
- return Object.defineProperty(n.prototype, "_updateTime", {
2077
- get: $util.oneOfGetter(r = ["updateTime"]),
2078
- set: $util.oneOfSetter(r)
2079
- }), n.create = function(t) {
2080
- return new n(t);
2081
- }, n.encode = function(t, e) {
2077
+ 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;
2078
+ let n;
2079
+ return Object.defineProperty(r.prototype, "_updateTime", {
2080
+ get: $util.oneOfGetter(n = ["updateTime"]),
2081
+ set: $util.oneOfSetter(n)
2082
+ }), r.create = function(t) {
2083
+ return new r(t);
2084
+ }, r.encode = function(t, e) {
2082
2085
  return e || (e = $Writer.create()), t.type != null && Object.hasOwnProperty.call(t, "type") && e.uint32(
2083
2086
  /* id 1, wireType 0 =*/
2084
2087
  8
@@ -2104,9 +2107,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2104
2107
  /* id 8, wireType 0 =*/
2105
2108
  64
2106
2109
  ).int64(t.updateTime), e;
2107
- }, n.encodeDelimited = function(t, e) {
2110
+ }, r.encodeDelimited = function(t, e) {
2108
2111
  return this.encode(t, e).ldelim();
2109
- }, n.decode = function(t, e, s) {
2112
+ }, r.decode = function(t, e, s) {
2110
2113
  t instanceof $Reader || (t = $Reader.create(t));
2111
2114
  let l = e === void 0 ? t.len : t.pos + e, c = new $root.com.quick.voice.proto.VideoInfo();
2112
2115
  for (; t.pos < l; ) {
@@ -2151,9 +2154,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2151
2154
  }
2152
2155
  }
2153
2156
  return c;
2154
- }, n.decodeDelimited = function(t) {
2157
+ }, r.decodeDelimited = function(t) {
2155
2158
  return t instanceof $Reader || (t = new $Reader(t)), this.decode(t, t.uint32());
2156
- }, n.verify = function(t) {
2159
+ }, r.verify = function(t) {
2157
2160
  if (typeof t != "object" || t === null) return "object expected";
2158
2161
  if (t.type != null && t.hasOwnProperty("type"))
2159
2162
  switch (t.type) {
@@ -2164,7 +2167,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2164
2167
  break;
2165
2168
  }
2166
2169
  return t.isEnable != null && t.hasOwnProperty("isEnable") && typeof t.isEnable != "boolean" ? "isEnable: boolean expected" : t.isMute != null && t.hasOwnProperty("isMute") && typeof t.isMute != "boolean" ? "isMute: boolean expected" : t.width != null && t.hasOwnProperty("width") && !$util.isInteger(t.width) ? "width: integer expected" : t.height != null && t.hasOwnProperty("height") && !$util.isInteger(t.height) ? "height: integer expected" : t.x != null && t.hasOwnProperty("x") && !$util.isInteger(t.x) ? "x: integer expected" : t.y != null && t.hasOwnProperty("y") && !$util.isInteger(t.y) ? "y: integer expected" : t.updateTime != null && t.hasOwnProperty("updateTime") && !$util.isInteger(t.updateTime) && !(t.updateTime && $util.isInteger(t.updateTime.low) && $util.isInteger(t.updateTime.high)) ? "updateTime: integer|Long expected" : null;
2167
- }, n.fromObject = function(t) {
2170
+ }, r.fromObject = function(t) {
2168
2171
  if (t instanceof $root.com.quick.voice.proto.VideoInfo) return t;
2169
2172
  let e = new $root.com.quick.voice.proto.VideoInfo();
2170
2173
  switch (t.type) {
@@ -2184,27 +2187,27 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2184
2187
  break;
2185
2188
  }
2186
2189
  return t.isEnable != null && (e.isEnable = !!t.isEnable), t.isMute != null && (e.isMute = !!t.isMute), t.width != null && (e.width = t.width | 0), t.height != null && (e.height = t.height | 0), t.x != null && (e.x = t.x | 0), t.y != null && (e.y = t.y | 0), t.updateTime != null && ($util.Long ? (e.updateTime = $util.Long.fromValue(t.updateTime)).unsigned = !1 : typeof t.updateTime == "string" ? e.updateTime = parseInt(t.updateTime, 10) : typeof t.updateTime == "number" ? e.updateTime = t.updateTime : typeof t.updateTime == "object" && (e.updateTime = new $util.LongBits(t.updateTime.low >>> 0, t.updateTime.high >>> 0).toNumber())), e;
2187
- }, n.toObject = function(t, e) {
2190
+ }, r.toObject = function(t, e) {
2188
2191
  e || (e = {});
2189
2192
  let s = {};
2190
2193
  return e.defaults && (s.type = e.enums === String ? "Camera" : 0, s.isEnable = !1, s.isMute = !1, s.width = 0, s.height = 0, s.x = 0, s.y = 0), t.type != null && t.hasOwnProperty("type") && (s.type = e.enums === String ? $root.com.quick.voice.proto.VideoType[t.type] === void 0 ? t.type : $root.com.quick.voice.proto.VideoType[t.type] : t.type), t.isEnable != null && t.hasOwnProperty("isEnable") && (s.isEnable = t.isEnable), t.isMute != null && t.hasOwnProperty("isMute") && (s.isMute = t.isMute), t.width != null && t.hasOwnProperty("width") && (s.width = t.width), t.height != null && t.hasOwnProperty("height") && (s.height = t.height), t.x != null && t.hasOwnProperty("x") && (s.x = t.x), t.y != null && t.hasOwnProperty("y") && (s.y = t.y), t.updateTime != null && t.hasOwnProperty("updateTime") && (typeof t.updateTime == "number" ? s.updateTime = e.longs === String ? String(t.updateTime) : t.updateTime : s.updateTime = e.longs === String ? $util.Long.prototype.toString.call(t.updateTime) : e.longs === Number ? new $util.LongBits(t.updateTime.low >>> 0, t.updateTime.high >>> 0).toNumber() : t.updateTime, e.oneofs && (s._updateTime = "updateTime")), s;
2191
- }, n.prototype.toJSON = function() {
2194
+ }, r.prototype.toJSON = function() {
2192
2195
  return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
2193
- }, n.getTypeUrl = function(t) {
2196
+ }, r.getTypeUrl = function(t) {
2194
2197
  return t === void 0 && (t = "type.googleapis.com"), t + "/com.quick.voice.proto.VideoInfo";
2195
- }, n;
2198
+ }, r;
2196
2199
  }(), u.CustomInfo = function() {
2197
- function n(i) {
2200
+ function r(i) {
2198
2201
  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]]);
2199
2202
  }
2200
- n.prototype.roomId = "", n.prototype.customKeyMap = $util.emptyObject, n.prototype.updateTime = null;
2201
- let r;
2202
- return Object.defineProperty(n.prototype, "_updateTime", {
2203
- get: $util.oneOfGetter(r = ["updateTime"]),
2204
- set: $util.oneOfSetter(r)
2205
- }), n.create = function(t) {
2206
- return new n(t);
2207
- }, n.encode = function(t, e) {
2203
+ r.prototype.roomId = "", r.prototype.customKeyMap = $util.emptyObject, r.prototype.updateTime = null;
2204
+ let n;
2205
+ return Object.defineProperty(r.prototype, "_updateTime", {
2206
+ get: $util.oneOfGetter(n = ["updateTime"]),
2207
+ set: $util.oneOfSetter(n)
2208
+ }), r.create = function(t) {
2209
+ return new r(t);
2210
+ }, r.encode = function(t, e) {
2208
2211
  if (e || (e = $Writer.create()), t.roomId != null && Object.hasOwnProperty.call(t, "roomId") && e.uint32(
2209
2212
  /* id 1, wireType 2 =*/
2210
2213
  10
@@ -2222,9 +2225,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2222
2225
  /* id 3, wireType 0 =*/
2223
2226
  24
2224
2227
  ).int64(t.updateTime), e;
2225
- }, n.encodeDelimited = function(t, e) {
2228
+ }, r.encodeDelimited = function(t, e) {
2226
2229
  return this.encode(t, e).ldelim();
2227
- }, n.decode = function(t, e, s) {
2230
+ }, r.decode = function(t, e, s) {
2228
2231
  t instanceof $Reader || (t = $Reader.create(t));
2229
2232
  let l = e === void 0 ? t.len : t.pos + e, c = new $root.com.quick.voice.proto.CustomInfo(), d, p;
2230
2233
  for (; t.pos < l; ) {
@@ -2265,9 +2268,9 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2265
2268
  }
2266
2269
  }
2267
2270
  return c;
2268
- }, n.decodeDelimited = function(t) {
2271
+ }, r.decodeDelimited = function(t) {
2269
2272
  return t instanceof $Reader || (t = new $Reader(t)), this.decode(t, t.uint32());
2270
- }, n.verify = function(t) {
2273
+ }, r.verify = function(t) {
2271
2274
  if (typeof t != "object" || t === null) return "object expected";
2272
2275
  if (t.roomId != null && t.hasOwnProperty("roomId") && !$util.isString(t.roomId)) return "roomId: string expected";
2273
2276
  if (t.customKeyMap != null && t.hasOwnProperty("customKeyMap")) {
@@ -2276,7 +2279,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2276
2279
  for (let s = 0; s < e.length; ++s) if (!$util.isString(t.customKeyMap[e[s]])) return "customKeyMap: string{k:string} expected";
2277
2280
  }
2278
2281
  return t.updateTime != null && t.hasOwnProperty("updateTime") && !$util.isInteger(t.updateTime) && !(t.updateTime && $util.isInteger(t.updateTime.low) && $util.isInteger(t.updateTime.high)) ? "updateTime: integer|Long expected" : null;
2279
- }, n.fromObject = function(t) {
2282
+ }, r.fromObject = function(t) {
2280
2283
  if (t instanceof $root.com.quick.voice.proto.CustomInfo) return t;
2281
2284
  let e = new $root.com.quick.voice.proto.CustomInfo();
2282
2285
  if (t.roomId != null && (e.roomId = String(t.roomId)), t.customKeyMap) {
@@ -2285,7 +2288,7 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2285
2288
  for (let s = Object.keys(t.customKeyMap), l = 0; l < s.length; ++l) e.customKeyMap[s[l]] = String(t.customKeyMap[s[l]]);
2286
2289
  }
2287
2290
  return t.updateTime != null && ($util.Long ? (e.updateTime = $util.Long.fromValue(t.updateTime)).unsigned = !1 : typeof t.updateTime == "string" ? e.updateTime = parseInt(t.updateTime, 10) : typeof t.updateTime == "number" ? e.updateTime = t.updateTime : typeof t.updateTime == "object" && (e.updateTime = new $util.LongBits(t.updateTime.low >>> 0, t.updateTime.high >>> 0).toNumber())), e;
2288
- }, n.toObject = function(t, e) {
2291
+ }, r.toObject = function(t, e) {
2289
2292
  e || (e = {});
2290
2293
  let s = {};
2291
2294
  (e.objects || e.defaults) && (s.customKeyMap = {}), e.defaults && (s.roomId = ""), t.roomId != null && t.hasOwnProperty("roomId") && (s.roomId = t.roomId);
@@ -2295,20 +2298,20 @@ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util =
2295
2298
  for (let c = 0; c < l.length; ++c) s.customKeyMap[l[c]] = t.customKeyMap[l[c]];
2296
2299
  }
2297
2300
  return t.updateTime != null && t.hasOwnProperty("updateTime") && (typeof t.updateTime == "number" ? s.updateTime = e.longs === String ? String(t.updateTime) : t.updateTime : s.updateTime = e.longs === String ? $util.Long.prototype.toString.call(t.updateTime) : e.longs === Number ? new $util.LongBits(t.updateTime.low >>> 0, t.updateTime.high >>> 0).toNumber() : t.updateTime, e.oneofs && (s._updateTime = "updateTime")), s;
2298
- }, n.prototype.toJSON = function() {
2301
+ }, r.prototype.toJSON = function() {
2299
2302
  return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
2300
- }, n.getTypeUrl = function(t) {
2303
+ }, r.getTypeUrl = function(t) {
2301
2304
  return t === void 0 && (t = "type.googleapis.com"), t + "/com.quick.voice.proto.CustomInfo";
2302
- }, n;
2305
+ }, r;
2303
2306
  }(), u.LayoutType = function() {
2304
- const n = {}, r = Object.create(n);
2305
- return r[n[0] = "AudioAndVideo"] = 0, r[n[1] = "OnlyAudio"] = 1, r[n[2] = "OnlyVideo"] = 2, r;
2307
+ const r = {}, n = Object.create(r);
2308
+ return n[r[0] = "AudioAndVideo"] = 0, n[r[1] = "OnlyAudio"] = 1, n[r[2] = "OnlyVideo"] = 2, n;
2306
2309
  }(), u.AudioType = function() {
2307
- const n = {}, r = Object.create(n);
2308
- return r[n[0] = "Microphone"] = 0, r[n[1] = "SystemVoice"] = 1, r;
2310
+ const r = {}, n = Object.create(r);
2311
+ return n[r[0] = "Microphone"] = 0, n[r[1] = "SystemVoice"] = 1, n;
2309
2312
  }(), u.VideoType = function() {
2310
- const n = {}, r = Object.create(n);
2311
- return r[n[0] = "Camera"] = 0, r[n[1] = "Screen"] = 1, r;
2313
+ const r = {}, n = Object.create(r);
2314
+ return n[r[0] = "Camera"] = 0, n[r[1] = "Screen"] = 1, n;
2312
2315
  }(), u;
2313
2316
  }(), a;
2314
2317
  }(), o;
@@ -2347,9 +2350,9 @@ class RoomUser {
2347
2350
  });
2348
2351
  m(this, "init", (o) => {
2349
2352
  var t, e, s, l;
2350
- const { id: a, audios: u = [], videos: n = [] } = o;
2353
+ const { id: a, audios: u = [], videos: r = [] } = o;
2351
2354
  this.userId = a;
2352
- const r = this.getUpdateTimeKey();
2355
+ const n = this.getUpdateTimeKey();
2353
2356
  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);
2354
2357
  for (const c of u) {
2355
2358
  const { type: d = 0, isEnable: p = !1, isMute: f = !1, updateTime: w, volume: b = 0 } = c;
@@ -2368,7 +2371,7 @@ class RoomUser {
2368
2371
  break;
2369
2372
  }
2370
2373
  }
2371
- for (const c of n) {
2374
+ for (const c of r) {
2372
2375
  const { type: d = 0, isEnable: p, isMute: f, updateTime: w, width: b, height: g, x: k, y: _ } = c;
2373
2376
  switch (d) {
2374
2377
  case 0:
@@ -2387,7 +2390,7 @@ class RoomUser {
2387
2390
  }
2388
2391
  (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);
2389
2392
  const i = this.getUpdateTimeKey();
2390
- r !== i && (this.updateTime = (/* @__PURE__ */ new Date()).getTime());
2393
+ n !== i && (this.updateTime = (/* @__PURE__ */ new Date()).getTime());
2391
2394
  });
2392
2395
  m(this, "destroy", () => {
2393
2396
  var o, a;
@@ -2398,16 +2401,16 @@ class RoomUser {
2398
2401
  const parseSEI = (h) => {
2399
2402
  let o = 0, a = 0;
2400
2403
  for (; ; ) {
2401
- const n = h[o];
2402
- if (a = a + n, o = o + 1, n !== 255) break;
2404
+ const r = h[o];
2405
+ if (a = a + r, o = o + 1, r !== 255) break;
2403
2406
  }
2404
2407
  let u = 0;
2405
2408
  for (; ; ) {
2406
- const n = h[o];
2407
- if (u = u + n, o = o + 1, n !== 255) break;
2409
+ const r = h[o];
2410
+ if (u = u + r, o = o + 1, r !== 255) break;
2408
2411
  }
2409
2412
  if (a === 5) {
2410
- const n = h.slice(o, o + 16), i = Array.from(n, (f) => f.toString(16).padStart(2, "0")).join("");
2413
+ const r = h.slice(o, o + 16), i = Array.from(r, (f) => f.toString(16).padStart(2, "0")).join("");
2411
2414
  o = o + 16;
2412
2415
  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;
2413
2416
  let d;
@@ -2457,30 +2460,30 @@ class QuickVoPlayer {
2457
2460
  return Array.from(o, (u) => u.updateTime).join("_");
2458
2461
  });
2459
2462
  m(this, "checkAndCreateUser", (o, a) => {
2460
- var u, n;
2463
+ var u, r;
2461
2464
  if (this.usersMap.has(o)) {
2462
- const r = this.usersMap.get(o);
2463
- if (r == null || r.init(a), r != null && r.mc_video) {
2464
- const { sx: i, sy: t, sw: e, sh: s } = r.mc_video;
2465
- (u = r == null ? void 0 : r.mc_video.worker) == null || u.setCut({ sx: i, sy: t, sw: e, sh: s });
2465
+ const n = this.usersMap.get(o);
2466
+ if (n == null || n.init(a), n != null && n.mc_video) {
2467
+ const { sx: i, sy: t, sw: e, sh: s } = n.mc_video;
2468
+ (u = n == null ? void 0 : n.mc_video.worker) == null || u.setCut({ sx: i, sy: t, sw: e, sh: s });
2466
2469
  }
2467
- if (r != null && r.ss_video) {
2468
- const { sx: i, sy: t, sw: e, sh: s } = r.ss_video;
2469
- (n = r == null ? void 0 : r.ss_video.worker) == null || n.setCut({ sx: i, sy: t, sw: e, sh: s });
2470
+ if (n != null && n.ss_video) {
2471
+ const { sx: i, sy: t, sw: e, sh: s } = n.ss_video;
2472
+ (r = n == null ? void 0 : n.ss_video.worker) == null || r.setCut({ sx: i, sy: t, sw: e, sh: s });
2470
2473
  }
2471
2474
  } else {
2472
- const r = new RoomUser();
2473
- if (this.usersMap.set(o, r), r.init(a), r) {
2474
- if (r.mc_video) {
2475
- const { sx: i, sy: t, sw: e, sh: s } = r.mc_video, l = `${r.userId}_mc_video`, { worker: c, stream: d, destroy: p } = this.prPlayer.cut.create(l, { sx: i, sy: t, sw: e, sh: s });
2476
- r.mc_video.worker = c, this.displayMode === "original" && c.setPause(!0), r.mc_video.stream = d, r.mc_video.destroy = () => {
2477
- p(), this.prPlayer.cut.remove(l), this.usersMap.delete(r.userId);
2475
+ const n = new RoomUser();
2476
+ if (this.usersMap.set(o, n), n.init(a), n) {
2477
+ if (n.mc_video) {
2478
+ 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 });
2479
+ n.mc_video.worker = c, this.displayMode === "original" && c.setPause(!0), n.mc_video.stream = d, n.mc_video.destroy = () => {
2480
+ p(), this.prPlayer.cut.remove(l), this.usersMap.delete(n.userId);
2478
2481
  };
2479
2482
  }
2480
- if (r.ss_video) {
2481
- const { sx: i, sy: t, sw: e, sh: s } = r.ss_video, l = `${r.userId}_ss_video`, { worker: c, stream: d, destroy: p } = this.prPlayer.cut.create(l, { sx: i, sy: t, sw: e, sh: s });
2482
- r.ss_video.worker = c, this.displayMode === "original" && c.setPause(!0), r.ss_video.stream = d, r.ss_video.destroy = () => {
2483
- p(), this.prPlayer.cut.remove(l), this.usersMap.delete(r.userId);
2483
+ if (n.ss_video) {
2484
+ 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 });
2485
+ n.ss_video.worker = c, this.displayMode === "original" && c.setPause(!0), n.ss_video.stream = d, n.ss_video.destroy = () => {
2486
+ p(), this.prPlayer.cut.remove(l), this.usersMap.delete(n.userId);
2484
2487
  };
2485
2488
  }
2486
2489
  }
@@ -2493,12 +2496,12 @@ class QuickVoPlayer {
2493
2496
  try {
2494
2497
  const a = parseSEI(o);
2495
2498
  if (!a) return;
2496
- const { event: u, data: n } = a;
2499
+ const { event: u, data: r } = a;
2497
2500
  switch (u) {
2498
2501
  case 0:
2499
2502
  {
2500
- const { roomId: r, userMap: i } = n;
2501
- if (r !== this.room.roomId) return;
2503
+ const { roomId: n, userMap: i } = r;
2504
+ if (n !== this.room.roomId) return;
2502
2505
  const t = this.getAllUseUpdateKey(), e = Object.keys(i);
2503
2506
  {
2504
2507
  const l = [...this.usersMap.values()];
@@ -2518,8 +2521,8 @@ class QuickVoPlayer {
2518
2521
  break;
2519
2522
  case 1:
2520
2523
  {
2521
- const { roomId: r, updateTime: i } = n, { author: t, version: e } = n.customKeyMap;
2522
- this.room.roomId = r, this.room.updateTime = i, this.room.author = t, this.room.version = e;
2524
+ const { roomId: n, updateTime: i } = r, { author: t, version: e } = r.customKeyMap;
2525
+ this.room.roomId = n, this.room.updateTime = i, this.room.author = t, this.room.version = e;
2523
2526
  }
2524
2527
  break;
2525
2528
  }
@@ -2528,14 +2531,14 @@ class QuickVoPlayer {
2528
2531
  }
2529
2532
  });
2530
2533
  m(this, "setDisplayMode", (o) => {
2531
- var a, u, n, r, i, t, e, s;
2534
+ var a, u, r, n, i, t, e, s;
2532
2535
  switch (this.displayMode = o, o) {
2533
2536
  case "original":
2534
2537
  {
2535
2538
  this.prPlayer.setPause(!1);
2536
2539
  const l = [...this.usersMap.values()];
2537
2540
  for (const c of l)
2538
- (u = (a = c.mc_video) == null ? void 0 : a.worker) == null || u.setPause(!0), (r = (n = c.ss_video) == null ? void 0 : n.worker) == null || r.setPause(!0);
2541
+ (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);
2539
2542
  }
2540
2543
  break;
2541
2544
  case "cut":