quickvo-sdk-js 1.7.9 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-CPc9xes4.js +65 -0
- package/dist/index.js +23853 -23828
- package/dist/index.umd.cjs +1 -1
- package/dist/lib-CZDsnwK8.js +11283 -0
- package/package.json +1 -1
- package/dist/chunk-5GA9DZ8T.js +0 -55
- package/dist/lib-r0yD6_Rv.js +0 -11241
package/dist/index.umd.cjs
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
`:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string`)}switch(a){case 0:s=o,a=1;break;case 1:r[i++]=s<<2|(o&48)>>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0;break}}if(a==1)throw Error(`invalid base64 string`);return r.subarray(0,i)}var Bt,Vt,Ht;function Ut(e){return Bt||(Bt=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),Vt=Bt.slice(0,-2).concat(`-`,`_`)),e==`url`?Vt:Bt}function Wt(){if(!Ht){Ht=[];let e=Ut(`std`);for(let t=0;t<e.length;t++)Ht[e[t].charCodeAt(0)]=t;Ht[45]=e.indexOf(`+`),Ht[95]=e.indexOf(`/`)}return Ht}function Gt(e,t){return typeof e==`object`&&e&&`$typeName`in e&&typeof e.$typeName==`string`?t===void 0?!0:t.typeName===e.$typeName:!1}var Kt=class extends Error{constructor(e,t,n=`FieldValueInvalidError`){super(t),this.name=n,this.field=()=>e}};function qt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jt(e,t){if(qt(e)&&Me in e&&`add`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.listKind==r.listKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function Yt(e,t){if(qt(e)&&Me in e&&`has`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.mapKey===r.mapKey&&n.mapKind==r.mapKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function Xt(e,t){return qt(e)&&Me in e&&`desc`in e&&qt(e.desc)&&e.desc.kind===`message`&&(t===void 0||e.desc.typeName==t.typeName)}var Zt=Symbol.for(`@bufbuild/protobuf/text-encoding`);function Qt(){if(globalThis[Zt]==null){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[Zt]={encodeUtf8(t){return e.encode(t)},decodeUtf8(e){return t.decode(e)},checkUtf8(e){try{return!0}catch{return!1}}}}return globalThis[Zt]}var F;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(F||={});var $t=class{constructor(e=Qt().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(nn(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return tn(e),we(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){rn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){nn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){tn(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return tn(e),e=(e<<1^e>>31)>>>0,we(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=N.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=N.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=N.enc(e);return he(t.lo,t.hi,this.buf),this}sint64(e){let t=N.enc(e),n=t.hi>>31;return he(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=N.uEnc(e);return he(t.lo,t.hi,this.buf),this}},en=class{constructor(e,t=Qt().decodeUtf8){this.decodeUtf8=t,this.varint64=me,this.uint32=Te,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case F.Varint:for(;this.buf[this.pos++]&128;);break;case F.Bit64:this.pos+=4;case F.Bit32:this.pos+=4;break;case F.LengthDelimited:let n=this.uint32();this.pos+=n;break;case F.StartGroup:for(;;){let[e,n]=this.tag();if(n===F.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return N.dec(...this.varint64())}uint64(){return N.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,N.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return N.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return N.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.decodeUtf8(this.bytes())}};function tn(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function nn(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function rn(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float32: `+e)}function an(e,t){let n=e.fieldKind==`list`?Jt(t,e):e.fieldKind==`map`?Yt(t,e):cn(e,t);if(n===!0)return;let r;switch(e.fieldKind){case`list`:r=`expected ${pn(e)}, got ${dn(t)}`;break;case`map`:r=`expected ${mn(e)}, got ${dn(t)}`;break;default:r=un(e,t,n)}return new Kt(e,r)}function on(e,t,n){let r=cn(e,n);if(r!==!0)return new Kt(e,`list item #${t+1}: ${un(e,n,r)}`)}function sn(e,t,n){let r=ln(t,e.mapKey);if(r!==!0)return new Kt(e,`invalid map key: ${un({scalar:e.mapKey},t,r)}`);let i=cn(e,n);if(i!==!0)return new Kt(e,`map entry ${dn(t)}: ${un(e,n,i)}`)}function cn(e,t){return e.scalar===void 0?e.enum===void 0?Xt(t,e.message):e.enum.open?Number.isInteger(t):e.enum.values.some(e=>e.number===t):ln(t,e.scalar)}function ln(e,t){switch(t){case P.DOUBLE:return typeof e==`number`;case P.FLOAT:return typeof e==`number`?Number.isNaN(e)||!Number.isFinite(e)?!0:e>34028234663852886e22||e<-34028234663852886e22?`${e.toFixed()} out of range`:!0:!1;case P.INT32:case P.SFIXED32:case P.SINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>2147483647||e<-2147483648?`${e.toFixed()} out of range`:!0;case P.FIXED32:case P.UINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>4294967295||e<0?`${e.toFixed()} out of range`:!0;case P.BOOL:return typeof e==`boolean`;case P.STRING:return typeof e==`string`?Qt().checkUtf8(e)||`invalid UTF8`:!1;case P.BYTES:return e instanceof Uint8Array;case P.INT64:case P.SFIXED64:case P.SINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return N.parse(e),!0}catch{return`${e} out of range`}return!1;case P.FIXED64:case P.UINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return N.uParse(e),!0}catch{return`${e} out of range`}return!1}}function un(e,t,n){return n=typeof n==`string`?`: ${n}`:`, got ${dn(t)}`,e.scalar===void 0?e.enum===void 0?`expected ${fn(e.message)}`+n:`expected ${e.enum.toString()}`+n:`expected ${hn(e.scalar)}`+n}function dn(e){switch(typeof e){case`object`:return e===null?`null`:e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:Jt(e)?pn(e.field()):Yt(e)?mn(e.field()):Xt(e)?fn(e.desc):Gt(e)?`message ${e.$typeName}`:`object`;case`string`:return e.length>30?`string`:`"${e.split(`"`).join(`\\"`)}"`;case`boolean`:return String(e);case`number`:return String(e);case`bigint`:return String(e)+`n`;default:return typeof e}}function fn(e){return`ReflectMessage (${e.typeName})`}function pn(e){switch(e.listKind){case`message`:return`ReflectList (${e.message.toString()})`;case`enum`:return`ReflectList (${e.enum.toString()})`;case`scalar`:return`ReflectList (${P[e.scalar]})`}}function mn(e){switch(e.mapKind){case`message`:return`ReflectMap (${P[e.mapKey]}, ${e.message.toString()})`;case`enum`:return`ReflectMap (${P[e.mapKey]}, ${e.enum.toString()})`;case`scalar`:return`ReflectMap (${P[e.mapKey]}, ${P[e.scalar]})`}}function hn(e){switch(e){case P.STRING:return`string`;case P.BOOL:return`boolean`;case P.INT64:case P.SINT64:case P.SFIXED64:return`bigint (int64)`;case P.UINT64:case P.FIXED64:return`bigint (uint64)`;case P.BYTES:return`Uint8Array`;case P.DOUBLE:return`number (float64)`;case P.FLOAT:return`number (float32)`;case P.FIXED32:case P.UINT32:return`number (uint32)`;case P.INT32:case P.SFIXED32:case P.SINT32:return`number (int32)`}}function gn(e){return vn(e.$typeName)}function _n(e){let t=e.fields[0];return vn(e.typeName)&&t!==void 0&&t.fieldKind==`scalar`&&t.name==`value`&&t.number==1}function vn(e){return e.startsWith(`google.protobuf.`)&&[`DoubleValue`,`FloatValue`,`Int64Value`,`UInt64Value`,`Int32Value`,`UInt32Value`,`BoolValue`,`StringValue`,`BytesValue`].includes(e.substring(16))}var yn=999,bn=998,xn=2;function Sn(e,t){if(Gt(t,e))return t;let n=Mn(e);return t!==void 0&&Cn(e,n,t),n}function Cn(e,t,n){for(let r of e.members){let e=n[r.localName];if(e==null)continue;let i;if(r.kind==`oneof`){let t=Ne(n,r);if(!t)continue;i=t,e=Ie(n,t)}else i=r;switch(i.fieldKind){case`message`:e=Dn(i,e);break;case`scalar`:e=wn(i,e);break;case`list`:e=En(i,e);break;case`map`:e=Tn(i,e);break}Le(t,i,e)}return t}function wn(e,t){return e.scalar==P.BYTES?On(t):t}function Tn(e,t){if(qt(t)){if(e.scalar==P.BYTES)return kn(t,On);if(e.mapKind==`message`)return kn(t,t=>Dn(e,t))}return t}function En(e,t){if(Array.isArray(t)){if(e.scalar==P.BYTES)return t.map(On);if(e.listKind==`message`)return t.map(t=>Dn(e,t))}return t}function Dn(e,t){if(e.fieldKind==`message`&&!e.oneof&&_n(e.message))return wn(e.message.fields[0],t);if(qt(t)){if(e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!==`google.protobuf.Value`)return t;if(!Gt(t,e.message))return Sn(e.message,t)}return t}function On(e){return Array.isArray(e)?new Uint8Array(e):e}function kn(e,t){let n={};for(let r of Object.entries(e))n[r[0]]=t(r[1]);return n}var An=Symbol(),jn=new WeakMap;function Mn(e){let t;if(Nn(e)){let n=jn.get(e),r,i;if(n)({prototype:r,members:i}=n);else{r={},i=new Set;for(let t of e.members)t.kind!=`oneof`&&(t.fieldKind!=`scalar`&&t.fieldKind!=`enum`||t.presence!=xn&&(i.add(t),r[t.localName]=Pn(t)));jn.set(e,{prototype:r,members:i})}t=Object.create(r),t.$typeName=e.typeName;for(let n of e.members)i.has(n)||n.kind==`field`&&(n.fieldKind==`message`||(n.fieldKind==`scalar`||n.fieldKind==`enum`)&&n.presence!=xn)||(t[n.localName]=Pn(n))}else{t={$typeName:e.typeName};for(let n of e.members)(n.kind==`oneof`||n.presence==xn)&&(t[n.localName]=Pn(n))}return t}function Nn(e){switch(e.file.edition){case yn:return!1;case bn:return!0;default:return e.fields.some(e=>e.presence!=xn&&e.fieldKind!=`message`&&!e.oneof)}}function Pn(e){if(e.kind==`oneof`)return{case:void 0};if(e.fieldKind==`list`)return[];if(e.fieldKind==`map`)return{};if(e.fieldKind==`message`)return An;let t=e.getDefaultValue();return t===void 0?e.fieldKind==`scalar`?ke(e.scalar,e.longAsString):e.enum.values[0].number:e.fieldKind==`scalar`&&e.longAsString?t.toString():t}function Fn(e,t,n=!0){return new Ln(e,t,n)}var In=new WeakMap,Ln=class{get sortedFields(){let e=In.get(this.desc);if(e)return e;let t=this.desc.fields.concat().sort((e,t)=>e.number-t.number);return In.set(this.desc,t),t}constructor(e,t,n=!0){this.lists=new Map,this.maps=new Map,this.check=n,this.desc=e,this.message=this[Me]=t??Sn(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||=new Map(this.desc.fields.map(e=>[e.number,e])),this._fieldsByNumber.get(e)}oneofCase(e){return Rn(this.message,e),Ne(this.message,e)}isSet(e){return Rn(this.message,e),Pe(this.message,e)}clear(e){Rn(this.message,e),Re(this.message,e)}get(e){Rn(this.message,e);let t=Ie(this.message,e);switch(e.fieldKind){case`list`:let n=this.lists.get(e);return(!n||n[Me]!==t)&&this.lists.set(e,n=new zn(e,t,this.check)),n;case`map`:let r=this.maps.get(e);return(!r||r[Me]!==t)&&this.maps.set(e,r=new Bn(e,t,this.check)),r;case`message`:return Hn(e,t,this.check);case`scalar`:return t===void 0?ke(e.scalar,!1):Yn(e,t);case`enum`:return t??e.enum.values[0].number}}set(e,t){if(Rn(this.message,e),this.check){let n=an(e,t);if(n)throw n}let n;n=e.fieldKind==`message`?Vn(e,t):Yt(t)||Jt(t)?t[Me]:Xn(e,t),Le(this.message,e,n)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function Rn(e,t){if(t.parent.typeName!==e.$typeName)throw new Kt(t,`cannot use ${t.toString()} with message ${e.$typeName}`,`ForeignFieldError`)}var zn=class{field(){return this._field}get size(){return this._arr.length}constructor(e,t,n){this._field=e,this._arr=this[Me]=t,this.check=n}get(e){let t=this._arr[e];return t===void 0?void 0:Wn(this._field,t,this.check)}set(e,t){if(e<0||e>=this._arr.length)throw new Kt(this._field,`list item #${e+1}: out of range`);if(this.check){let n=on(this._field,e,t);if(n)throw n}this._arr[e]=Un(this._field,t)}add(e){if(this.check){let t=on(this._field,this._arr.length,e);if(t)throw t}this._arr.push(Un(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let e of this._arr)yield Wn(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,Wn(this._field,this._arr[e],this.check)]}},Bn=class{constructor(e,t,n=!0){this.obj=this[Me]=t??{},this.check=n,this._field=e}field(){return this._field}set(e,t){if(this.check){let n=sn(this._field,e,t);if(n)throw n}return this.obj[qn(e)]=Gn(this._field,t),this}delete(e){let t=qn(e),n=Object.prototype.hasOwnProperty.call(this.obj,t);return n&&delete this.obj[t],n}clear(){for(let e of Object.keys(this.obj))delete this.obj[e]}get(e){let t=this.obj[qn(e)];return t!==void 0&&(t=Kn(this._field,t,this.check)),t}has(e){return Object.prototype.hasOwnProperty.call(this.obj,qn(e))}*keys(){for(let e of Object.keys(this.obj))yield Jn(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[Jn(e[0],this._field.mapKey),Kn(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let e of Object.values(this.obj))yield Kn(this._field,e,this.check)}forEach(e,t){for(let n of this.entries())e.call(t,n[1],n[0],this)}};function Vn(e,t){return Xt(t)?gn(t.message)&&!e.oneof&&e.fieldKind==`message`?t.message.value:t.desc.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`?Qn(t.message):t.message:t}function Hn(e,t,n){return t!==void 0&&(_n(e.message)&&!e.oneof&&e.fieldKind==`message`?t={$typeName:e.message.typeName,value:Yn(e.message.fields[0],t)}:e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`&&qt(t)&&(t=Zn(t))),new Ln(e.message,t,n)}function Un(e,t){return e.listKind==`message`?Vn(e,t):Xn(e,t)}function Wn(e,t,n){return e.listKind==`message`?Hn(e,t,n):Yn(e,t)}function Gn(e,t){return e.mapKind==`message`?Vn(e,t):Xn(e,t)}function Kn(e,t,n){return e.mapKind==`message`?Hn(e,t,n):t}function qn(e){return typeof e==`string`||typeof e==`number`?e:String(e)}function Jn(e,t){switch(t){case P.STRING:return e;case P.INT32:case P.FIXED32:case P.UINT32:case P.SFIXED32:case P.SINT32:{let t=Number.parseInt(e);if(Number.isFinite(t))return t;break}case P.BOOL:switch(e){case`true`:return!0;case`false`:return!1}break;case P.UINT64:case P.FIXED64:try{return N.uParse(e)}catch{}break;default:try{return N.parse(e)}catch{}break}return e}function Yn(e,t){switch(e.scalar){case P.INT64:case P.SFIXED64:case P.SINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=N.parse(t));break;case P.FIXED64:case P.UINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=N.uParse(t));break}return t}function Xn(e,t){switch(e.scalar){case P.INT64:case P.SFIXED64:case P.SINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=N.parse(t));break;case P.FIXED64:case P.UINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=N.uParse(t));break}return t}function Zn(e){let t={$typeName:`google.protobuf.Struct`,fields:{}};if(qt(e))for(let[n,r]of Object.entries(e))t.fields[n]=er(r);return t}function Qn(e){let t={};for(let[n,r]of Object.entries(e.fields))t[n]=$n(r);return t}function $n(e){switch(e.kind.case){case`structValue`:return Qn(e.kind.value);case`listValue`:return e.kind.value.values.map($n);case`nullValue`:case void 0:return null;default:return e.kind.value}}function er(e){let t={$typeName:`google.protobuf.Value`,kind:{case:void 0}};switch(typeof e){case`number`:t.kind={case:`numberValue`,value:e};break;case`string`:t.kind={case:`stringValue`,value:e};break;case`boolean`:t.kind={case:`boolValue`,value:e};break;case`object`:if(e===null)t.kind={case:`nullValue`,value:0};else if(Array.isArray(e)){let n={$typeName:`google.protobuf.ListValue`,values:[]};if(Array.isArray(e))for(let t of e)n.values.push(er(t));t.kind={case:`listValue`,value:n}}else t.kind={case:`structValue`,value:Zn(e)};break}return t}var tr=3,nr={writeUnknownFields:!0};function rr(e){return e?Object.assign(Object.assign({},nr),e):nr}function ir(e,t,n){return ar(new $t,rr(n),Fn(e,t)).finish()}function ar(e,t,n){for(let r of n.sortedFields){if(!n.isSet(r)){if(r.presence==tr)throw Error(`cannot encode ${r} to binary: required field not set`);continue}or(e,t,n,r)}if(t.writeUnknownFields)for(let{no:t,wireType:r,data:i}of n.getUnknown()??[])e.tag(t,r).raw(i);return e}function or(e,t,n,r){switch(r.fieldKind){case`scalar`:case`enum`:sr(e,n.desc.typeName,r.name,r.scalar??P.INT32,r.number,n.get(r));break;case`list`:lr(e,t,r,n.get(r));break;case`message`:cr(e,t,r,n.get(r));break;case`map`:for(let[i,a]of n.get(r))ur(e,t,r,i,a);break}}function sr(e,t,n,r,i,a){dr(e.tag(i,fr(r)),t,n,r,a)}function cr(e,t,n,r){n.delimitedEncoding?ar(e.tag(n.number,F.StartGroup),t,r).tag(n.number,F.EndGroup):ar(e.tag(n.number,F.LengthDelimited).fork(),t,r).join()}function lr(e,t,n,r){if(n.listKind==`message`){for(let i of r)cr(e,t,n,i);return}let i=n.scalar??P.INT32;if(n.packed){if(!r.size)return;e.tag(n.number,F.LengthDelimited).fork();for(let t of r)dr(e,n.parent.typeName,n.name,i,t);e.join();return}for(let t of r)sr(e,n.parent.typeName,n.name,i,n.number,t)}function ur(e,t,n,r,i){switch(e.tag(n.number,F.LengthDelimited).fork(),sr(e,n.parent.typeName,n.name,n.mapKey,1,r),n.mapKind){case`scalar`:case`enum`:sr(e,n.parent.typeName,n.name,n.scalar??P.INT32,2,i);break;case`message`:ar(e.tag(2,F.LengthDelimited).fork(),t,i).join();break}e.join()}function dr(e,t,n,r,i){try{switch(r){case P.STRING:e.string(i);break;case P.BOOL:e.bool(i);break;case P.DOUBLE:e.double(i);break;case P.FLOAT:e.float(i);break;case P.INT32:e.int32(i);break;case P.INT64:e.int64(i);break;case P.UINT64:e.uint64(i);break;case P.FIXED64:e.fixed64(i);break;case P.BYTES:e.bytes(i);break;case P.FIXED32:e.fixed32(i);break;case P.SFIXED32:e.sfixed32(i);break;case P.SFIXED64:e.sfixed64(i);break;case P.SINT64:e.sint64(i);break;case P.UINT32:e.uint32(i);break;case P.SINT32:e.sint32(i);break}}catch(e){throw e instanceof Error?Error(`cannot encode field ${t}.${n} to binary: ${e.message}`):e}}function fr(e){switch(e){case P.BYTES:case P.STRING:return F.LengthDelimited;case P.DOUBLE:case P.FIXED64:case P.SFIXED64:return F.Bit64;case P.FIXED32:case P.SFIXED32:case P.FLOAT:return F.Bit32;default:return F.Varint}}function I(e,t,...n){return n.reduce((e,t)=>e.nestedMessages[t],e.messages[t])}var pr=I(Nt({name:`google/protobuf/descriptor.proto`,package:`google.protobuf`,messageType:[{name:`FileDescriptorSet`,field:[{name:`file`,number:1,type:11,label:3,typeName:`.google.protobuf.FileDescriptorProto`}],extensionRange:[{start:536e6,end:536000001}]},{name:`FileDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`package`,number:2,type:9,label:1},{name:`dependency`,number:3,type:9,label:3},{name:`public_dependency`,number:10,type:5,label:3},{name:`weak_dependency`,number:11,type:5,label:3},{name:`option_dependency`,number:15,type:9,label:3},{name:`message_type`,number:4,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:5,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`service`,number:6,type:11,label:3,typeName:`.google.protobuf.ServiceDescriptorProto`},{name:`extension`,number:7,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FileOptions`},{name:`source_code_info`,number:9,type:11,label:1,typeName:`.google.protobuf.SourceCodeInfo`},{name:`syntax`,number:12,type:9,label:1},{name:`edition`,number:14,type:14,label:1,typeName:`.google.protobuf.Edition`}]},{name:`DescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`field`,number:2,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`extension`,number:6,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`nested_type`,number:3,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`extension_range`,number:5,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ExtensionRange`},{name:`oneof_decl`,number:8,type:11,label:3,typeName:`.google.protobuf.OneofDescriptorProto`},{name:`options`,number:7,type:11,label:1,typeName:`.google.protobuf.MessageOptions`},{name:`reserved_range`,number:9,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ReservedRange`},{name:`reserved_name`,number:10,type:9,label:3},{name:`visibility`,number:11,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`ExtensionRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ExtensionRangeOptions`}]},{name:`ReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`ExtensionRangeOptions`,field:[{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`},{name:`declaration`,number:2,type:11,label:3,typeName:`.google.protobuf.ExtensionRangeOptions.Declaration`,options:{retention:2}},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`verification`,number:3,type:14,label:1,typeName:`.google.protobuf.ExtensionRangeOptions.VerificationState`,defaultValue:`UNVERIFIED`,options:{retention:2}}],nestedType:[{name:`Declaration`,field:[{name:`number`,number:1,type:5,label:1},{name:`full_name`,number:2,type:9,label:1},{name:`type`,number:3,type:9,label:1},{name:`reserved`,number:5,type:8,label:1},{name:`repeated`,number:6,type:8,label:1}]}],enumType:[{name:`VerificationState`,value:[{name:`DECLARATION`,number:0},{name:`UNVERIFIED`,number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:3,type:5,label:1},{name:`label`,number:4,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Label`},{name:`type`,number:5,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Type`},{name:`type_name`,number:6,type:9,label:1},{name:`extendee`,number:2,type:9,label:1},{name:`default_value`,number:7,type:9,label:1},{name:`oneof_index`,number:9,type:5,label:1},{name:`json_name`,number:10,type:9,label:1},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FieldOptions`},{name:`proto3_optional`,number:17,type:8,label:1}],enumType:[{name:`Type`,value:[{name:`TYPE_DOUBLE`,number:1},{name:`TYPE_FLOAT`,number:2},{name:`TYPE_INT64`,number:3},{name:`TYPE_UINT64`,number:4},{name:`TYPE_INT32`,number:5},{name:`TYPE_FIXED64`,number:6},{name:`TYPE_FIXED32`,number:7},{name:`TYPE_BOOL`,number:8},{name:`TYPE_STRING`,number:9},{name:`TYPE_GROUP`,number:10},{name:`TYPE_MESSAGE`,number:11},{name:`TYPE_BYTES`,number:12},{name:`TYPE_UINT32`,number:13},{name:`TYPE_ENUM`,number:14},{name:`TYPE_SFIXED32`,number:15},{name:`TYPE_SFIXED64`,number:16},{name:`TYPE_SINT32`,number:17},{name:`TYPE_SINT64`,number:18}]},{name:`Label`,value:[{name:`LABEL_OPTIONAL`,number:1},{name:`LABEL_REPEATED`,number:3},{name:`LABEL_REQUIRED`,number:2}]}]},{name:`OneofDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`options`,number:2,type:11,label:1,typeName:`.google.protobuf.OneofOptions`}]},{name:`EnumDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`value`,number:2,type:11,label:3,typeName:`.google.protobuf.EnumValueDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumOptions`},{name:`reserved_range`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto.EnumReservedRange`},{name:`reserved_name`,number:5,type:9,label:3},{name:`visibility`,number:6,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`EnumReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`EnumValueDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumValueOptions`}]},{name:`ServiceDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`method`,number:2,type:11,label:3,typeName:`.google.protobuf.MethodDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ServiceOptions`}]},{name:`MethodDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`input_type`,number:2,type:9,label:1},{name:`output_type`,number:3,type:9,label:1},{name:`options`,number:4,type:11,label:1,typeName:`.google.protobuf.MethodOptions`},{name:`client_streaming`,number:5,type:8,label:1,defaultValue:`false`},{name:`server_streaming`,number:6,type:8,label:1,defaultValue:`false`}]},{name:`FileOptions`,field:[{name:`java_package`,number:1,type:9,label:1},{name:`java_outer_classname`,number:8,type:9,label:1},{name:`java_multiple_files`,number:10,type:8,label:1,defaultValue:`false`},{name:`java_generate_equals_and_hash`,number:20,type:8,label:1,options:{deprecated:!0}},{name:`java_string_check_utf8`,number:27,type:8,label:1,defaultValue:`false`},{name:`optimize_for`,number:9,type:14,label:1,typeName:`.google.protobuf.FileOptions.OptimizeMode`,defaultValue:`SPEED`},{name:`go_package`,number:11,type:9,label:1},{name:`cc_generic_services`,number:16,type:8,label:1,defaultValue:`false`},{name:`java_generic_services`,number:17,type:8,label:1,defaultValue:`false`},{name:`py_generic_services`,number:18,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:23,type:8,label:1,defaultValue:`false`},{name:`cc_enable_arenas`,number:31,type:8,label:1,defaultValue:`true`},{name:`objc_class_prefix`,number:36,type:9,label:1},{name:`csharp_namespace`,number:37,type:9,label:1},{name:`swift_prefix`,number:39,type:9,label:1},{name:`php_class_prefix`,number:40,type:9,label:1},{name:`php_namespace`,number:41,type:9,label:1},{name:`php_metadata_namespace`,number:44,type:9,label:1},{name:`ruby_package`,number:45,type:9,label:1},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`OptimizeMode`,value:[{name:`SPEED`,number:1},{name:`CODE_SIZE`,number:2},{name:`LITE_RUNTIME`,number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`MessageOptions`,field:[{name:`message_set_wire_format`,number:1,type:8,label:1,defaultValue:`false`},{name:`no_standard_descriptor_accessor`,number:2,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`map_entry`,number:7,type:8,label:1},{name:`deprecated_legacy_json_field_conflicts`,number:11,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:12,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldOptions`,field:[{name:`ctype`,number:1,type:14,label:1,typeName:`.google.protobuf.FieldOptions.CType`,defaultValue:`STRING`},{name:`packed`,number:2,type:8,label:1},{name:`jstype`,number:6,type:14,label:1,typeName:`.google.protobuf.FieldOptions.JSType`,defaultValue:`JS_NORMAL`},{name:`lazy`,number:5,type:8,label:1,defaultValue:`false`},{name:`unverified_lazy`,number:15,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`weak`,number:10,type:8,label:1,defaultValue:`false`,options:{deprecated:!0}},{name:`debug_redact`,number:16,type:8,label:1,defaultValue:`false`},{name:`retention`,number:17,type:14,label:1,typeName:`.google.protobuf.FieldOptions.OptionRetention`},{name:`targets`,number:19,type:14,label:3,typeName:`.google.protobuf.FieldOptions.OptionTargetType`},{name:`edition_defaults`,number:20,type:11,label:3,typeName:`.google.protobuf.FieldOptions.EditionDefault`},{name:`features`,number:21,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`feature_support`,number:22,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],nestedType:[{name:`EditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`value`,number:2,type:9,label:1}]},{name:`FeatureSupport`,field:[{name:`edition_introduced`,number:1,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`edition_deprecated`,number:2,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`deprecation_warning`,number:3,type:9,label:1},{name:`edition_removed`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`}]}],enumType:[{name:`CType`,value:[{name:`STRING`,number:0},{name:`CORD`,number:1},{name:`STRING_PIECE`,number:2}]},{name:`JSType`,value:[{name:`JS_NORMAL`,number:0},{name:`JS_STRING`,number:1},{name:`JS_NUMBER`,number:2}]},{name:`OptionRetention`,value:[{name:`RETENTION_UNKNOWN`,number:0},{name:`RETENTION_RUNTIME`,number:1},{name:`RETENTION_SOURCE`,number:2}]},{name:`OptionTargetType`,value:[{name:`TARGET_TYPE_UNKNOWN`,number:0},{name:`TARGET_TYPE_FILE`,number:1},{name:`TARGET_TYPE_EXTENSION_RANGE`,number:2},{name:`TARGET_TYPE_MESSAGE`,number:3},{name:`TARGET_TYPE_FIELD`,number:4},{name:`TARGET_TYPE_ONEOF`,number:5},{name:`TARGET_TYPE_ENUM`,number:6},{name:`TARGET_TYPE_ENUM_ENTRY`,number:7},{name:`TARGET_TYPE_SERVICE`,number:8},{name:`TARGET_TYPE_METHOD`,number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`OneofOptions`,field:[{name:`features`,number:1,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumOptions`,field:[{name:`allow_alias`,number:2,type:8,label:1},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`deprecated_legacy_json_field_conflicts`,number:6,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:7,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumValueOptions`,field:[{name:`deprecated`,number:1,type:8,label:1,defaultValue:`false`},{name:`features`,number:2,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`debug_redact`,number:3,type:8,label:1,defaultValue:`false`},{name:`feature_support`,number:4,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`ServiceOptions`,field:[{name:`features`,number:34,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`MethodOptions`,field:[{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`idempotency_level`,number:34,type:14,label:1,typeName:`.google.protobuf.MethodOptions.IdempotencyLevel`,defaultValue:`IDEMPOTENCY_UNKNOWN`},{name:`features`,number:35,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`IdempotencyLevel`,value:[{name:`IDEMPOTENCY_UNKNOWN`,number:0},{name:`NO_SIDE_EFFECTS`,number:1},{name:`IDEMPOTENT`,number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`UninterpretedOption`,field:[{name:`name`,number:2,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption.NamePart`},{name:`identifier_value`,number:3,type:9,label:1},{name:`positive_int_value`,number:4,type:4,label:1},{name:`negative_int_value`,number:5,type:3,label:1},{name:`double_value`,number:6,type:1,label:1},{name:`string_value`,number:7,type:12,label:1},{name:`aggregate_value`,number:8,type:9,label:1}],nestedType:[{name:`NamePart`,field:[{name:`name_part`,number:1,type:9,label:2},{name:`is_extension`,number:2,type:8,label:2}]}]},{name:`FeatureSet`,field:[{name:`field_presence`,number:1,type:14,label:1,typeName:`.google.protobuf.FeatureSet.FieldPresence`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPLICIT`,edition:900},{value:`IMPLICIT`,edition:999},{value:`EXPLICIT`,edition:1e3}]}},{name:`enum_type`,number:2,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnumType`,options:{retention:1,targets:[6,1],editionDefaults:[{value:`CLOSED`,edition:900},{value:`OPEN`,edition:999}]}},{name:`repeated_field_encoding`,number:3,type:14,label:1,typeName:`.google.protobuf.FeatureSet.RepeatedFieldEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPANDED`,edition:900},{value:`PACKED`,edition:999}]}},{name:`utf8_validation`,number:4,type:14,label:1,typeName:`.google.protobuf.FeatureSet.Utf8Validation`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`NONE`,edition:900},{value:`VERIFY`,edition:999}]}},{name:`message_encoding`,number:5,type:14,label:1,typeName:`.google.protobuf.FeatureSet.MessageEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`LENGTH_PREFIXED`,edition:900}]}},{name:`json_format`,number:6,type:14,label:1,typeName:`.google.protobuf.FeatureSet.JsonFormat`,options:{retention:1,targets:[3,6,1],editionDefaults:[{value:`LEGACY_BEST_EFFORT`,edition:900},{value:`ALLOW`,edition:999}]}},{name:`enforce_naming_style`,number:7,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnforceNamingStyle`,options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:`STYLE_LEGACY`,edition:900},{value:`STYLE2024`,edition:1001}]}},{name:`default_symbol_visibility`,number:8,type:14,label:1,typeName:`.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility`,options:{retention:2,targets:[1],editionDefaults:[{value:`EXPORT_ALL`,edition:900},{value:`EXPORT_TOP_LEVEL`,edition:1001}]}}],nestedType:[{name:`VisibilityFeature`,enumType:[{name:`DefaultSymbolVisibility`,value:[{name:`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,number:0},{name:`EXPORT_ALL`,number:1},{name:`EXPORT_TOP_LEVEL`,number:2},{name:`LOCAL_ALL`,number:3},{name:`STRICT`,number:4}]}]}],enumType:[{name:`FieldPresence`,value:[{name:`FIELD_PRESENCE_UNKNOWN`,number:0},{name:`EXPLICIT`,number:1},{name:`IMPLICIT`,number:2},{name:`LEGACY_REQUIRED`,number:3}]},{name:`EnumType`,value:[{name:`ENUM_TYPE_UNKNOWN`,number:0},{name:`OPEN`,number:1},{name:`CLOSED`,number:2}]},{name:`RepeatedFieldEncoding`,value:[{name:`REPEATED_FIELD_ENCODING_UNKNOWN`,number:0},{name:`PACKED`,number:1},{name:`EXPANDED`,number:2}]},{name:`Utf8Validation`,value:[{name:`UTF8_VALIDATION_UNKNOWN`,number:0},{name:`VERIFY`,number:2},{name:`NONE`,number:3}]},{name:`MessageEncoding`,value:[{name:`MESSAGE_ENCODING_UNKNOWN`,number:0},{name:`LENGTH_PREFIXED`,number:1},{name:`DELIMITED`,number:2}]},{name:`JsonFormat`,value:[{name:`JSON_FORMAT_UNKNOWN`,number:0},{name:`ALLOW`,number:1},{name:`LEGACY_BEST_EFFORT`,number:2}]},{name:`EnforceNamingStyle`,value:[{name:`ENFORCE_NAMING_STYLE_UNKNOWN`,number:0},{name:`STYLE2024`,number:1},{name:`STYLE_LEGACY`,number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:`FeatureSetDefaults`,field:[{name:`defaults`,number:1,type:11,label:3,typeName:`.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault`},{name:`minimum_edition`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`maximum_edition`,number:5,type:14,label:1,typeName:`.google.protobuf.Edition`}],nestedType:[{name:`FeatureSetEditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`overridable_features`,number:4,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`fixed_features`,number:5,type:11,label:1,typeName:`.google.protobuf.FeatureSet`}]}]},{name:`SourceCodeInfo`,field:[{name:`location`,number:1,type:11,label:3,typeName:`.google.protobuf.SourceCodeInfo.Location`}],nestedType:[{name:`Location`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`span`,number:2,type:5,label:3,options:{packed:!0}},{name:`leading_comments`,number:3,type:9,label:1},{name:`trailing_comments`,number:4,type:9,label:1},{name:`leading_detached_comments`,number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:`GeneratedCodeInfo`,field:[{name:`annotation`,number:1,type:11,label:3,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation`}],nestedType:[{name:`Annotation`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`source_file`,number:2,type:9,label:1},{name:`begin`,number:3,type:5,label:1},{name:`end`,number:4,type:5,label:1},{name:`semantic`,number:5,type:14,label:1,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation.Semantic`}],enumType:[{name:`Semantic`,value:[{name:`NONE`,number:0},{name:`SET`,number:1},{name:`ALIAS`,number:2}]}]}]}],enumType:[{name:`Edition`,value:[{name:`EDITION_UNKNOWN`,number:0},{name:`EDITION_LEGACY`,number:900},{name:`EDITION_PROTO2`,number:998},{name:`EDITION_PROTO3`,number:999},{name:`EDITION_2023`,number:1e3},{name:`EDITION_2024`,number:1001},{name:`EDITION_UNSTABLE`,number:9999},{name:`EDITION_1_TEST_ONLY`,number:1},{name:`EDITION_2_TEST_ONLY`,number:2},{name:`EDITION_99997_TEST_ONLY`,number:99997},{name:`EDITION_99998_TEST_ONLY`,number:99998},{name:`EDITION_99999_TEST_ONLY`,number:99999},{name:`EDITION_MAX`,number:2147483647}]},{name:`SymbolVisibility`,value:[{name:`VISIBILITY_UNSET`,number:0},{name:`VISIBILITY_LOCAL`,number:1},{name:`VISIBILITY_EXPORT`,number:2}]}]}),1),mr;(function(e){e[e.DECLARATION=0]=`DECLARATION`,e[e.UNVERIFIED=1]=`UNVERIFIED`})(mr||={});var hr;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.GROUP=10]=`GROUP`,e[e.MESSAGE=11]=`MESSAGE`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.ENUM=14]=`ENUM`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(hr||={});var gr;(function(e){e[e.OPTIONAL=1]=`OPTIONAL`,e[e.REPEATED=3]=`REPEATED`,e[e.REQUIRED=2]=`REQUIRED`})(gr||={});var _r;(function(e){e[e.SPEED=1]=`SPEED`,e[e.CODE_SIZE=2]=`CODE_SIZE`,e[e.LITE_RUNTIME=3]=`LITE_RUNTIME`})(_r||={});var vr;(function(e){e[e.STRING=0]=`STRING`,e[e.CORD=1]=`CORD`,e[e.STRING_PIECE=2]=`STRING_PIECE`})(vr||={});var yr;(function(e){e[e.JS_NORMAL=0]=`JS_NORMAL`,e[e.JS_STRING=1]=`JS_STRING`,e[e.JS_NUMBER=2]=`JS_NUMBER`})(yr||={});var br;(function(e){e[e.RETENTION_UNKNOWN=0]=`RETENTION_UNKNOWN`,e[e.RETENTION_RUNTIME=1]=`RETENTION_RUNTIME`,e[e.RETENTION_SOURCE=2]=`RETENTION_SOURCE`})(br||={});var xr;(function(e){e[e.TARGET_TYPE_UNKNOWN=0]=`TARGET_TYPE_UNKNOWN`,e[e.TARGET_TYPE_FILE=1]=`TARGET_TYPE_FILE`,e[e.TARGET_TYPE_EXTENSION_RANGE=2]=`TARGET_TYPE_EXTENSION_RANGE`,e[e.TARGET_TYPE_MESSAGE=3]=`TARGET_TYPE_MESSAGE`,e[e.TARGET_TYPE_FIELD=4]=`TARGET_TYPE_FIELD`,e[e.TARGET_TYPE_ONEOF=5]=`TARGET_TYPE_ONEOF`,e[e.TARGET_TYPE_ENUM=6]=`TARGET_TYPE_ENUM`,e[e.TARGET_TYPE_ENUM_ENTRY=7]=`TARGET_TYPE_ENUM_ENTRY`,e[e.TARGET_TYPE_SERVICE=8]=`TARGET_TYPE_SERVICE`,e[e.TARGET_TYPE_METHOD=9]=`TARGET_TYPE_METHOD`})(xr||={});var Sr;(function(e){e[e.IDEMPOTENCY_UNKNOWN=0]=`IDEMPOTENCY_UNKNOWN`,e[e.NO_SIDE_EFFECTS=1]=`NO_SIDE_EFFECTS`,e[e.IDEMPOTENT=2]=`IDEMPOTENT`})(Sr||={});var Cr;(function(e){e[e.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]=`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,e[e.EXPORT_ALL=1]=`EXPORT_ALL`,e[e.EXPORT_TOP_LEVEL=2]=`EXPORT_TOP_LEVEL`,e[e.LOCAL_ALL=3]=`LOCAL_ALL`,e[e.STRICT=4]=`STRICT`})(Cr||={});var wr;(function(e){e[e.FIELD_PRESENCE_UNKNOWN=0]=`FIELD_PRESENCE_UNKNOWN`,e[e.EXPLICIT=1]=`EXPLICIT`,e[e.IMPLICIT=2]=`IMPLICIT`,e[e.LEGACY_REQUIRED=3]=`LEGACY_REQUIRED`})(wr||={});var Tr;(function(e){e[e.ENUM_TYPE_UNKNOWN=0]=`ENUM_TYPE_UNKNOWN`,e[e.OPEN=1]=`OPEN`,e[e.CLOSED=2]=`CLOSED`})(Tr||={});var Er;(function(e){e[e.REPEATED_FIELD_ENCODING_UNKNOWN=0]=`REPEATED_FIELD_ENCODING_UNKNOWN`,e[e.PACKED=1]=`PACKED`,e[e.EXPANDED=2]=`EXPANDED`})(Er||={});var Dr;(function(e){e[e.UTF8_VALIDATION_UNKNOWN=0]=`UTF8_VALIDATION_UNKNOWN`,e[e.VERIFY=2]=`VERIFY`,e[e.NONE=3]=`NONE`})(Dr||={});var Or;(function(e){e[e.MESSAGE_ENCODING_UNKNOWN=0]=`MESSAGE_ENCODING_UNKNOWN`,e[e.LENGTH_PREFIXED=1]=`LENGTH_PREFIXED`,e[e.DELIMITED=2]=`DELIMITED`})(Or||={});var kr;(function(e){e[e.JSON_FORMAT_UNKNOWN=0]=`JSON_FORMAT_UNKNOWN`,e[e.ALLOW=1]=`ALLOW`,e[e.LEGACY_BEST_EFFORT=2]=`LEGACY_BEST_EFFORT`})(kr||={});var Ar;(function(e){e[e.ENFORCE_NAMING_STYLE_UNKNOWN=0]=`ENFORCE_NAMING_STYLE_UNKNOWN`,e[e.STYLE2024=1]=`STYLE2024`,e[e.STYLE_LEGACY=2]=`STYLE_LEGACY`})(Ar||={});var jr;(function(e){e[e.NONE=0]=`NONE`,e[e.SET=1]=`SET`,e[e.ALIAS=2]=`ALIAS`})(jr||={});var Mr;(function(e){e[e.EDITION_UNKNOWN=0]=`EDITION_UNKNOWN`,e[e.EDITION_LEGACY=900]=`EDITION_LEGACY`,e[e.EDITION_PROTO2=998]=`EDITION_PROTO2`,e[e.EDITION_PROTO3=999]=`EDITION_PROTO3`,e[e.EDITION_2023=1e3]=`EDITION_2023`,e[e.EDITION_2024=1001]=`EDITION_2024`,e[e.EDITION_UNSTABLE=9999]=`EDITION_UNSTABLE`,e[e.EDITION_1_TEST_ONLY=1]=`EDITION_1_TEST_ONLY`,e[e.EDITION_2_TEST_ONLY=2]=`EDITION_2_TEST_ONLY`,e[e.EDITION_99997_TEST_ONLY=99997]=`EDITION_99997_TEST_ONLY`,e[e.EDITION_99998_TEST_ONLY=99998]=`EDITION_99998_TEST_ONLY`,e[e.EDITION_99999_TEST_ONLY=99999]=`EDITION_99999_TEST_ONLY`,e[e.EDITION_MAX=2147483647]=`EDITION_MAX`})(Mr||={});var Nr;(function(e){e[e.VISIBILITY_UNSET=0]=`VISIBILITY_UNSET`,e[e.VISIBILITY_LOCAL=1]=`VISIBILITY_LOCAL`,e[e.VISIBILITY_EXPORT=2]=`VISIBILITY_EXPORT`})(Nr||={});var Pr={readUnknownFields:!0};function Fr(e){return e?Object.assign(Object.assign({},Pr),e):Pr}function L(e,t,n){let r=Fn(e,void 0,!1);return Ir(r,new en(t),Fr(n),!1,t.byteLength),r.message}function Ir(e,t,n,r,i){let a=r?t.len:t.pos+i,o,s,c=e.getUnknown()??[];for(;t.pos<a&&([o,s]=t.tag(),!(r&&s==F.EndGroup));){let r=e.findNumber(o);if(!r){let e=t.skip(s,o);n.readUnknownFields&&c.push({no:o,wireType:s,data:e});continue}Lr(e,t,r,s,n)}if(r&&(s!=F.EndGroup||o!==i))throw Error(`invalid end group tag`);c.length>0&&e.setUnknown(c)}function Lr(e,t,n,r,i){switch(n.fieldKind){case`scalar`:e.set(n,Vr(t,n.scalar));break;case`enum`:let a=Vr(t,P.INT32);if(n.enum.open)e.set(n,a);else if(n.enum.values.some(e=>e.number===a))e.set(n,a);else if(i.readUnknownFields){let t=[];we(a,t);let i=e.getUnknown()??[];i.push({no:n.number,wireType:r,data:new Uint8Array(t)}),e.setUnknown(i)}break;case`message`:e.set(n,Br(t,i,n,e.get(n)));break;case`list`:zr(t,r,e.get(n),i);break;case`map`:Rr(t,e.get(n),i);break}}function Rr(e,t,n){let r=t.field(),i,a,o=e.uint32(),s=e.pos+o;for(;e.pos<s;){let[t]=e.tag();switch(t){case 1:i=Vr(e,r.mapKey);break;case 2:switch(r.mapKind){case`scalar`:a=Vr(e,r.scalar);break;case`enum`:a=e.int32();break;case`message`:a=Br(e,n,r);break}break}}if(i===void 0&&(i=ke(r.mapKey,!1)),a===void 0)switch(r.mapKind){case`scalar`:a=ke(r.scalar,!1);break;case`enum`:a=r.enum.values[0].number;break;case`message`:a=Fn(r.message,void 0,!1);break}t.set(i,a)}function zr(e,t,n,r){let i=n.field();if(i.listKind===`message`){n.add(Br(e,r,i));return}let a=i.scalar??P.INT32;if(!(t==F.LengthDelimited&&a!=P.STRING&&a!=P.BYTES)){n.add(Vr(e,a));return}let o=e.uint32()+e.pos;for(;e.pos<o;)n.add(Vr(e,a))}function Br(e,t,n,r){let i=n.delimitedEncoding,a=r??Fn(n.message,void 0,!1);return Ir(a,e,t,i,i?n.number:e.uint32()),a}function Vr(e,t){switch(t){case P.STRING:return e.string();case P.BOOL:return e.bool();case P.DOUBLE:return e.double();case P.FLOAT:return e.float();case P.INT32:return e.int32();case P.INT64:return e.int64();case P.UINT64:return e.uint64();case P.FIXED64:return e.fixed64();case P.BYTES:return e.bytes();case P.FIXED32:return e.fixed32();case P.SFIXED32:return e.sfixed32();case P.SFIXED64:return e.sfixed64();case P.SINT64:return e.sint64();case P.UINT32:return e.uint32();case P.SINT32:return e.sint32()}}function Hr(e,t){let n=L(pr,zt(e));return n.messageType.forEach(ze),n.dependency=t?.map(e=>e.proto.name)??[],We(n,e=>t?.find(t=>t.proto.name===e)).getFile(n.name)}var R=Hr(`CgpSb29tLnByb3RvEhVjb20ucXVpY2sudm9pY2UucHJvdG8igwMKBFVzZXISCgoCaWQYASABKAkSFwoKY2FsbEFjdGlvbhgCIAEoBUgAiAEBEhYKCWNhbGxTdGF0ZRgDIAEoBUgBiAEBEhUKCGpvaW5UaW1lGAQgASgDSAKIAQESLAoGdHJhY2tzGAUgAygLMhwuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrEhgKC3Blcm1pc3Npb25zGAYgASgFSAOIAQESGAoLaXNQdWJsaXNoZWQYByABKAhIBIgBARIVCghiZWhhdmlvchgIIAEoBUgFiAEBEkYKDGNoYW5uZWxDYWNoZRgJIAEoCzIrLmNvbS5xdWljay52b2ljZS5wcm90by5EYXRhQ2hhbm5lbENhY2hlSW5mb0gGiAEBQg0KC19jYWxsQWN0aW9uQgwKCl9jYWxsU3RhdGVCCwoJX2pvaW5UaW1lQg4KDF9wZXJtaXNzaW9uc0IOCgxfaXNQdWJsaXNoZWRCCwoJX2JlaGF2aW9yQg8KDV9jaGFubmVsQ2FjaGUiTAoURGF0YUNoYW5uZWxDYWNoZUluZm8SNAoIY2hhbm5lbHMYASADKAsyIi5jb20ucXVpY2sudm9pY2UucHJvdG8uRGF0YUNoYW5uZWwiPgoLRGF0YUNoYW5uZWwSFwoPZGF0YUNoYW5uZWxOYW1lGAEgASgJEg8KAmlkGAIgASgFSACIAQFCBQoDX2lkIjgKBUxvZ2luEg0KBWFwcGlkGAEgASgJEg4KBnVzZXJJZBgCIAEoCRIQCghzZGtUb2tlbhgDIAEoCSLiAgoFVHJhY2sSCwoDbWlkGAEgASgJEhYKCXRyYWNrTmFtZRgCIAEoCUgAiAEBEhUKCGxvY2F0aW9uGAMgASgJSAGIAQESEwoGdXNlcklkGAQgASgJSAKIAQESEQoEY29kZRgFIAEoBUgDiAEBEhEKBGRlc2MYBiABKAlIBIgBARIzCgR0eXBlGAcgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZUgFiAEBEhQKB2lzVmFsaWQYCCABKAhIBogBARIWCglzaW11bGNhc3QYCSABKAlIB4gBARIWCglsYXN0UmV0cnkYCiABKAhICIgBAUIMCgpfdHJhY2tOYW1lQgsKCV9sb2NhdGlvbkIJCgdfdXNlcklkQgcKBV9jb2RlQgcKBV9kZXNjQgcKBV90eXBlQgoKCF9pc1ZhbGlkQgwKCl9zaW11bGNhc3RCDAoKX2xhc3RSZXRyeSKpAgoHSm9pblJlcRIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEjEKCGNhbGxUeXBlGAMgASgOMh8uY29tLnF1aWNrLnZvaWNlLnByb3RvLkNhbGxUeXBlEhIKBXRva2VuGAQgASgJSACIAQESNwoEbGFuZxgFIAEoCzIkLmNvbS5xdWljay52b2ljZS5wcm90by5BaUxhbmdTZXR0aW5nSAGIAQESEAoDc3R0GAYgASgISAKIAQESEgoFbXNnSWQYByABKAlIA4gBARIQCgNtc2cYCCABKAlIBIgBAUIICgZfdG9rZW5CBwoFX2xhbmdCBgoEX3N0dEIICgZfbXNnSWRCBgoEX21zZyLbAgoHSm9pblJzcBIOCgZyb29tSWQYASABKAkSLgoJcm9vbVVzZXJzGAIgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXISMQoIY2FsbFR5cGUYAyABKA4yHy5jb20ucXVpY2sudm9pY2UucHJvdG8uQ2FsbFR5cGUSEAoId2lmaU9ubHkYBCABKAgSFwoKcm9vbUFjdGlvbhgFIAEoBUgAiAEBEhYKCXRvdGFsU2l6ZRgGIAEoBUgBiAEBEkYKEG1lZXRTcGVjaWFsUm9sZXMYByABKAsyJy5jb20ucXVpY2sudm9pY2UucHJvdG8uTWVldFJvbGVzTGlzdFJzcEgCiAEBEhQKB3NoYXJkSWQYCCABKAlIA4gBAUINCgtfcm9vbUFjdGlvbkIMCgpfdG90YWxTaXplQhMKEV9tZWV0U3BlY2lhbFJvbGVzQgoKCF9zaGFyZElkIkcKCkpvaW5Ob3RpZnkSDgoGcm9vbUlkGAEgASgJEikKBHVzZXIYAiABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciIbCgxDb25uZWN0Q0ZSZXESCwoDc2RwGAEgASgJIngKDENvbm5lY3RDRlJzcBIRCglyZW1vdGVTZHAYASABKAkSMwoOc3Vic2NyaWJlVXNlcnMYAiADKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlchIUCgdzZXNzaW9uGAMgASgJSACIAQFCCgoIX3Nlc3Npb24ioQEKClB1Ymxpc2hSZXESCwoDc2RwGAEgASgJEiwKBnRyYWNrcxgCIAMoCzIcLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFjaxISCgpjYWxsQWN0aW9uGAMgASgFEhUKCHJlY3JlYXRlGAQgASgISACIAQESFAoHc2Vzc2lvbhgFIAEoCUgBiAEBQgsKCV9yZWNyZWF0ZUIKCghfc2Vzc2lvbiJBCgpQdWJsaXNoUnNwEhEKCXJlbW90ZVNkcBgBIAEoCRIUCgdzZXNzaW9uGAIgASgJSACIAQFCCgoIX3Nlc3Npb24ibAoNUHVibGlzaE5vdGlmeRIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEhQKB3Nlc3Npb24YAyABKAlIAIgBAUIKCghfc2Vzc2lvbiKCAQoMU3Vic2NyaWJlUmVxEioKBXVzZXJzGAEgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXISFAoHc2Vzc2lvbhgCIAEoCUgAiAEBEhYKCXNlbGZDaGVjaxgDIAEoCEgBiAEBQgoKCF9zZXNzaW9uQgwKCl9zZWxmQ2hlY2sibwoMU3Vic2NyaWJlUnNwEhEKCXJlbW90ZVNkcBgBIAEoCRIqCgV1c2VycxgCIAMoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEhQKB3Nlc3Npb24YAyABKAlIAIgBAUIKCghfc2Vzc2lvbiItCg5SZW5lZ290aWF0ZVJlcRIOCgZ1c2VySWQYASABKAkSCwoDc2RwGAIgASgJImEKB1F1aXRSZXESDgoGdXNlcklkGAEgASgJEg4KBnJvb21JZBgCIAEoCRISCgVtc2dJZBgDIAEoCUgAiAEBEhAKA21zZxgEIAEoCUgBiAEBQggKBl9tc2dJZEIGCgRfbXNnIn8KClF1aXROb3RpZnkSDgoGcm9vbUlkGAEgASgJEikKBHVzZXIYAiABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlchIRCgRjb2RlGAMgASgFSACIAQESEQoEZGVzYxgEIAEoCUgBiAEBQgcKBV9jb2RlQgcKBV9kZXNjIiMKEVRva2VuRXhwaXJlTm90aWZ5Eg4KBnJvb21JZBgBIAEoCSIyCg5VcGRhdGVUb2tlblJlcRIOCgZyb29tSWQYASABKAkSEAoIc2RrVG9rZW4YAiABKAkiUwoQTmV0UXVhbGl0eUNoYW5nZRIOCgZ1c2VySWQYASABKAkSDgoGcm9vbUlkGAIgASgJEg4KBmVncmVzcxgDIAEoBRIPCgdpbmdyZXNzGAQgASgFIk4KEE5ldFF1YWxpdHlOb3RpZnkSOgoJcXVhbGl0aWVzGAEgAygLMicuY29tLnF1aWNrLnZvaWNlLnByb3RvLk5ldFF1YWxpdHlDaGFuZ2UiRwoKVXBkYXRlQ2FsbBIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyIlIKD1AyUFVzZXJTeW5jSXRlbRIOCgZ1c2VySWQYASABKAkSLwoFdHlwZXMYAiADKA4yIC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2tUeXBlIn0KD1AyUFVzZXJTeW5jTGlzdBI0CgRwdXNoGAEgAygLMiYuY29tLnF1aWNrLnZvaWNlLnByb3RvLlAyUFVzZXJTeW5jSXRlbRI0CgRwdWxsGAIgAygLMiYuY29tLnF1aWNrLnZvaWNlLnByb3RvLlAyUFVzZXJTeW5jSXRlbSKYAQoPU3luY1Jvb21JbmZvUmVxEg4KBnJvb21JZBgBIAEoCRIpCgR1c2VyGAIgASgLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXISPQoIcDJwU3RhdGUYAyABKAsyJi5jb20ucXVpY2sudm9pY2UucHJvdG8uUDJQVXNlclN5bmNMaXN0SACIAQFCCwoJX3AycFN0YXRlIpsCCg9TeW5jUm9vbUluZm9Sc3ASDgoGcm9vbUlkGAEgASgJEg8KB2lzVmFsaWQYAiABKAgSKgoFdXNlcnMYAyADKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlchIQCghpc0FjdGl2ZRgEIAEoCBIXCgpyb29tQWN0aW9uGAUgASgFSACIAQESFgoJdG90YWxTaXplGAYgASgFSAGIAQESRgoQbWVldFNwZWNpYWxSb2xlcxgHIAEoCzInLmNvbS5xdWljay52b2ljZS5wcm90by5NZWV0Um9sZXNMaXN0UnNwSAKIAQFCDQoLX3Jvb21BY3Rpb25CDAoKX3RvdGFsU2l6ZUITChFfbWVldFNwZWNpYWxSb2xlcyIuCgpVcGRhdGVUaW1lEgwKBHRpbWUYASABKAMSEgoKdmVyc2lvblN0chgCIAEoCSJaCg1DbG9zZVRyYWNrUmVxEgsKA3NkcBgBIAEoCRIsCgZ0cmFja3MYAiADKAsyHC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2sSDgoGcm9vbUlkGAMgASgJIlAKDUNsb3NlVHJhY2tSc3ASEQoJcmVtb3RlU2RwGAEgASgJEiwKBnRyYWNrcxgCIAMoCzIcLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFjayI9ChBDbG9zZVRyYWNrTm90aWZ5EikKBHVzZXIYASABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciJOChFVcGRhdGVQZXJtaXNzaW9ucxIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyIlAKDFVzZXJCZWhhdmlvchIuCgR0eXBlGAEgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZRIQCghiZWhhdmlvchgCIAEoCCJRCgtQcmV2ZW50VXNlchIKCgJpZBgBIAEoCRI2CgliZWhhdmlvcnMYAiADKAsyIy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlckJlaGF2aW9yIlwKF1ByZXZlbnRVc2Vyc0JlaGF2aW9yUmVxEg4KBnJvb21JZBgBIAEoCRIxCgV1c2VycxgCIAMoCzIiLmNvbS5xdWljay52b2ljZS5wcm90by5QcmV2ZW50VXNlciJYChpQcmV2ZW50VXNlcnNCZWhhdmlvck5vdGlmeRIOCgZyb29tSWQYASABKAkSKgoFdXNlcnMYAiADKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciLyAQoOQmFzZUNETkFkZHJlc3MSNgoEYXJlYRgBIAEoDjIoLmNvbS5xdWljay52b2ljZS5wcm90by5BY2NlbGVyYXRpb25BcmVhcxI2Cgljb3VudFR5cGUYAiABKA4yIy5jb20ucXVpY2sudm9pY2UucHJvdG8uQ291bnRNZXRob2RzEkEKBnVybE1hcBgDIAMoCzIxLmNvbS5xdWljay52b2ljZS5wcm90by5CYXNlQ0ROQWRkcmVzcy5VcmxNYXBFbnRyeRotCgtVcmxNYXBFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIpwCChRDRE5QbGF5QWRkcmVzc05vdGlmeRIOCgZyb29tSWQYASABKAkSEQoEbTN1OBgCIAEoCUgAiAEBEhEKBHJ0bXAYAyABKAlIAYgBARIQCgNmbHYYBCABKAlIAogBARISCgVydG1wcxgFIAEoCUgDiAEBEjwKCG1haW5MaW5lGAYgASgLMiUuY29tLnF1aWNrLnZvaWNlLnByb3RvLkJhc2VDRE5BZGRyZXNzSASIAQESOQoKc3RhbmRMaW5lcxgHIAMoCzIlLmNvbS5xdWljay52b2ljZS5wcm90by5CYXNlQ0ROQWRkcmVzc0IHCgVfbTN1OEIHCgVfcnRtcEIGCgRfZmx2QggKBl9ydG1wc0ILCglfbWFpbkxpbmUiUwoLVXNlckNoYW5uZWwSDgoGdXNlcklkGAEgASgJEjQKCGNoYW5uZWxzGAIgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLkRhdGFDaGFubmVsImsKEUNoYW5uZWxQdWJsaXNoUmVxEjQKCGNoYW5uZWxzGAEgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLkRhdGFDaGFubmVsEhQKB3Nlc3Npb24YAiABKAlIAIgBAUIKCghfc2Vzc2lvbiJJChFDaGFubmVsUHVibGlzaFJzcRI0CghjaGFubmVscxgBIAMoCzIiLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyQ2hhbm5lbCJqChNDaGFubmVsU3Vic2NyaWJlUmVxEjEKBXVzZXJzGAEgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXJDaGFubmVsEhQKB3Nlc3Npb24YAiABKAlIAIgBAUIKCghfc2Vzc2lvbiJLChNDaGFubmVsU3Vic2NyaWJlUnNxEjQKCGNoYW5uZWxzGAEgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXJDaGFubmVsIhoKCUFja01zZ1JlcRINCgVtc2dJZBgBIAEoAyKoAQoKU2RwQ29uc3VsdBIOCgZyb29tSWQYASABKAkSMAoGc2VuZGVyGAIgASgLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXJIAIgBARISCgpyZWNlaXZlcklkGAMgASgJEgsKA3NkcBgEIAEoCRIsCgZ0cmFja3MYBSADKAsyHC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2tCCQoHX3NlbmRlciI/CglDYW5kaWRhdGUSDgoGc2RwTWlkGAEgASgJEhUKDXNkcE1MaW5lSW5kZXgYAiABKAUSCwoDc2RwGAMgASgJIpUBCgpDYW5kaWRhdGVzEg4KBnJvb21JZBgBIAEoCRIQCghzZW5kZXJJZBgCIAEoCRISCgpyZWNlaXZlcklkGAMgASgJEjQKCmNhbmRpZGF0ZXMYBCADKAsyIC5jb20ucXVpY2sudm9pY2UucHJvdG8uQ2FuZGlkYXRlEhsKE2lzU3Vic2NyaWJlUmVjZWl2ZXIYBSABKAgiegoNUmVwb3J0TmV0SW5mbxIrCgNuYXQYASABKA4yHi5jb20ucXVpY2sudm9pY2UucHJvdG8uTmF0VHlwZRIwCgR0eXBlGAIgASgOMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLk5ldHdvcmtUeXBlEgoKAmlwGAMgASgJIpwBChJSZXBvcnRUcmFmZmljVXNhZ2USFAoHcDJwUHVzaBgBIAEoA0gAiAEBEhQKB3AycFB1bGwYAiABKANIAYgBARIUCgdzZnVQdXNoGAMgASgDSAKIAQESFAoHc2Z1UHVsbBgEIAEoA0gDiAEBQgoKCF9wMnBQdXNoQgoKCF9wMnBQdWxsQgoKCF9zZnVQdXNoQgoKCF9zZnVQdWxsIlAKD0NoZWNrU2Vzc2lvblJlcRIPCgdzZXNzaW9uGAEgASgJEiwKBnRyYWNrcxgCIAMoCzIcLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFjayJoCg9DaGVja1Nlc3Npb25Sc3ESFgoOc2Vzc2lvbklzVmFsaWQYASABKAgSLAoGdHJhY2tzGAIgAygLMhwuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrEg8KB3Nlc3Npb24YAyABKAkiYwoQUm9vbVNwZWVjaE5vdGlmeRIOCgZyb29tSWQYASABKAkSDgoGdXNlcklkGAIgASgJEgwKBHRleHQYAyABKAkSEQoJdGltZXN0YW1wGAQgASgDEg4KBm9yaWdpbhgFIAEoCSLWAQoYTGl2ZVN0cmVhbWVyU3BlZWNoTm90aWZ5Eg4KBnJvb21JZBgBIAEoCRIOCgZ1c2VySWQYAiABKAkSDgoGb3JpZ2luGAMgASgJEkkKBWxhbmdzGAQgAygLMjouY29tLnF1aWNrLnZvaWNlLnByb3RvLkxpdmVTdHJlYW1lclNwZWVjaE5vdGlmeS5MYW5nc0VudHJ5EhEKCXRpbWVzdGFtcBgFIAEoAxosCgpMYW5nc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEiYAoNQWlMYW5nU2V0dGluZxINCgVpbnB1dBgBIAEoCRIOCgZvdXRwdXQYAiABKAkSHAoPdHJhbnNsYXRlRW5hYmxlGAMgASgISACIAQFCEgoQX3RyYW5zbGF0ZUVuYWJsZSJ/ChZQMlBBdmFpbGFibGVQZWVyTm90aWZ5Eg4KBnJvb21JZBgBIAEoCRIOCgZwdXNoSWQYAiABKAkSLwoFdHlwZXMYAyADKA4yIC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2tUeXBlEhQKDGlzUmVtb3RlUHVzaBgEIAEoCCKrAgoOUmVwb3J0UDJQRXhSZXESDgoGcm9vbUlkGAEgASgJEg4KBnB1c2hJZBgCIAEoCRIOCgZwdWxsSWQYAyABKAkSLAoEY29kZRgEIAEoDjIeLmNvbS5xdWljay52b2ljZS5wcm90by5QMlBDb2RlEi8KBXR5cGVzGAUgAygOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZRIRCgRkZXNjGAYgASgJSACIAQESGgoNY29ubmVjdGVkVGltZRgHIAEoCUgBiAEBEjUKBmFjdGlvbhgIIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5QMlBBY3Rpb25IAogBAUIHCgVfZGVzY0IQCg5fY29ubmVjdGVkVGltZUIJCgdfYWN0aW9uIm4KFVAyUERpc2Nvbm5lY3RlZE5vdGlmeRIOCgZyb29tSWQYASABKAkSFAoMcmVtb3RlVXNlcklkGAIgASgJEi8KBXR5cGVzGAMgAygOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZSJnCh1Sb29tR2xvYmFsQWN0aW9uQ2hhbmdlZE5vdGlmeRIOCgZyb29tSWQYASABKAkSEgoKcm9vbUFjdGlvbhgCIAEoBRIMCgRmcm9tGAMgASgJEhQKDHNlcnZlckFjdGlvbhgEIAEoBSJqChlQdWJOb3RpZnlJbnRlcmNlcHRTeW5jUnNwEg4KBnJvb21JZBgBIAEoCRISCgpyb29tQWN0aW9uGAIgASgFEikKBHVzZXIYAyABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciIyChBNZWV0Um9sZXNMaXN0UnNwEg8KB2NyZWF0b3IYASABKAkSDQoFYWRtaW4YAiADKAkilgEKFU1lZXRSb2xlc0NoYW5nZU5vdGlmeRIOCgZyb29tSWQYASABKAkSQQoQbWVldFNwZWNpYWxSb2xlcxgCIAEoCzInLmNvbS5xdWljay52b2ljZS5wcm90by5NZWV0Um9sZXNMaXN0UnNwEioKBXVzZXJzGAMgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXIiYAoPSm9pbkJhdGNoTm90aWZ5Eg4KBnJvb21JZBgBIAEoCRIqCgV1c2VycxgCIAMoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEhEKCXRvdGFsU2l6ZRgDIAEoBSI6CgxRdWl0VXNlckluZm8SDgoGdXNlcklkGAEgASgJEgwKBGNvZGUYAiABKAUSDAoEZGVzYxgDIAEoCSJoCg9RdWl0QmF0Y2hOb3RpZnkSDgoGcm9vbUlkGAEgASgJEjIKBXVzZXJzGAIgAygLMiMuY29tLnF1aWNrLnZvaWNlLnByb3RvLlF1aXRVc2VySW5mbxIRCgl0b3RhbFNpemUYAyABKAUiTwoRUm9vbUluZm9Db21tb25Sc3ASDgoGcm9vbUlkGAEgASgJEioKBXVzZXJzGAIgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXIiggEKCUljZVNlcnZlchIMCgR1cmxzGAEgAygJEhAKCHVzZXJuYW1lGAIgASgJEhIKCmNyZWRlbnRpYWwYAyABKAkSQQoPY3JlZGVudGlhbF90eXBlGAQgASgOMiguY29tLnF1aWNrLnZvaWNlLnByb3RvLkljZUNyZWRlbnRpYWxUeXBlIqEBChBUdXJuVXJsc1Jlc3BvbnNlEjUKC2ljZV9zZXJ2ZXJzGAEgAygLMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLkljZVNlcnZlchILCgN0dGwYAiABKAQSEgoKZXhwaXJlc19hdBgDIAEoBBI1CgZwb2xpY3kYBCABKA4yJS5jb20ucXVpY2sudm9pY2UucHJvdG8uSWNlQ29ubmVjdFR5cGUqRAoJVHJhY2tUeXBlEg4KCk1pY3JvcGhvbmUQABIKCgZDYW1lcmEQARIKCgZTY3JlZW4QAhIPCgtTeXN0ZW1Wb2ljZRADKj0KCENhbGxUeXBlEgoKBk5vcm1hbBAAEgsKB01lZXRpbmcQARIICgRMaXZlEAISDgoKQ29uZmVyZW5jZRADKnoKDlF1aXROb3RpZnlDb2RlEg4KCk5vcm1hbFF1aXQQABIMCgdUaW1lb3V0EOUPEhEKDFRva2VuRXhwaXJlZBDbDxIMCgdLaWNrT3V0EOYPEgoKBUVuZFBrEOcPEgwKB0VuZExpdmUQ6A8SDwoKRm9yY2VDbGVhchDpDypAChFBY2NlbGVyYXRpb25BcmVhcxIRCg1jaGluYU1haW5sYW5kEAASCgoGZ2xvYmFsEAESDAoIb3ZlcnNlYXMQAiolCgxDb3VudE1ldGhvZHMSCAoEZmxvdxAAEgsKB21pbnV0ZXMQASpBCgdOYXRUeXBlEg0KCVN5bW1ldHJpYxAAEggKBENvbmUQARIICgRQb3J0EAISBgoCSVAQAxILCgdVbktub3duEAQqLgoLTmV0d29ya1R5cGUSCAoEV2lmaRAAEgkKBVdpcmVkEAESCgoGTW9iaWxlEAIqUAoHUDJQQ29kZRILCgdTdWNjZXNzEAASCgoGRmFpbGVkEAESCgoGSWdub3JlEAISEAoMRGlzY29ubmVjdGVkEAMSDgoKTG93UXVhbGl0eRAEKmoKD1AyUElnbm9yZVJlYXNvbhIRCg1DSEFOTkVMX0xJTUlUEAASFwoTU1VCU0NSSUJFX05PVF9FWElTVBABEgsKB0J1c3lpbmcQAhITCg9UUkFDS19OT1RfRVhJU1QQAxIJCgVPVEhFUhAEKm8KCVAyUEFjdGlvbhIOCgpSZXZlcnNlVHJ5EAASFAoQUmV2ZXJzZVRyeUZhaWxlZBABEhIKDlJldmVyc2VTdWNjZXNzEAISEgoOQ29ubmVjdFN1Y2Nlc3MQAxIUChBSZXZlcnNlUHVzaERlbGF5EAQqeQoRSWNlQ3JlZGVudGlhbFR5cGUSIwofSUNFX0NSRURFTlRJQUxfVFlQRV9VTlNQRUNJRklFRBAAEiAKHElDRV9DUkVERU5USUFMX1RZUEVfUEFTU1dPUkQQARIdChlJQ0VfQ1JFREVOVElBTF9UWVBFX09BVVRIEAIqJAoOSWNlQ29ubmVjdFR5cGUSBwoDQWxsEAASCQoFUmVsYXkQAUJFChVjb20ucXVpY2sudm9pY2UucHJvdG9CCVJvb21Qcm90b1oVY29tLnF1aWNrLnZvaWNlLnByb3RvugIJUm9vbVByb3RvYgZwcm90bzM`),Ur=I(R,4),Wr=I(R,5),Gr=I(R,6),Kr=I(R,7),qr=I(R,8),Jr=I(R,9),Yr=I(R,10),Xr=I(R,11),Zr=I(R,12),Qr=I(R,13),$r=I(R,14),ei=I(R,15),ti=I(R,16),ni=I(R,17),ri=I(R,19),ii=I(R,20),ai=I(R,21),oi=I(R,22),si=I(R,25),ci=I(R,26),li=I(R,27),ui=I(R,28),di=I(R,29),fi=I(R,30),pi=I(R,31),mi=I(R,34),hi=I(R,35),gi=I(R,37),_i=I(R,38),vi=I(R,39),yi=I(R,40),bi=I(R,41),xi=I(R,42),Si=I(R,43),Ci=I(R,44),wi=I(R,45),Ti=I(R,46),Ei=I(R,47),Di=I(R,48),Oi=I(R,50),ki=I(R,51),Ai=I(R,53),ji=I(R,54),Mi=I(R,55),Ni=I(R,56),Pi=I(R,57),Fi=I(R,60),Ii=I(R,61),Li=I(R,63),Ri=I(R,64),zi=I(R,66),z=function(e){return e[e.Microphone=0]=`Microphone`,e[e.Camera=1]=`Camera`,e[e.Screen=2]=`Screen`,e[e.SystemVoice=3]=`SystemVoice`,e}({}),Bi=function(e){return e[e.All=0]=`All`,e[e.Relay=1]=`Relay`,e}({}),Vi={mc_audio:`麦克风-默认轨道`,mc_video:`摄像头-默认轨道`,ss_video:`屏幕共享-视频轨道`,ss_audio:`屏幕共享-音频轨道`},Hi=O(Vi),B=Object.keys(Vi),Ui=Object.values(Vi);function Wi(e){switch(e){case`mc_audio`:return z.Microphone;case`mc_video`:return z.Camera;case`ss_video`:return z.Screen;case`ss_audio`:return z.SystemVoice}}var Gi=window.AudioContext||window.webkitAudioContext,Ki=class{audioContext=new Gi;_onDocumentClick;_onDeviceChange;_destroyed=!1;phoneyStreamTracks={};enumerateDevices={audioinput:[],videoinput:[],audiooutput:[]};useMediaDevices={};mediaTrackConstraints={mc_audio:{autoGainControl:!0,noiseSuppression:!0,echoCancellation:!0,sampleRate:48e3,channelCount:2},mc_video:{},ss_video:{},ss_audio:{}};localStreamTracks={};on={};constructor(){this._onDocumentClick=()=>{this.audioContext&&this.audioContext.state===`suspended`&&this.audioContext.resume()},document.addEventListener(`click`,this._onDocumentClick);let e=ee(this.audioContext,.001),t=k({width:128,height:128,opacity:0,fps:20,text:``});{let[t]=e.getAudioTracks();this.phoneyStreamTracks.mc_audio=t}{let[e]=t.getVideoTracks();this.phoneyStreamTracks.mc_video=e}{let[t]=e.clone().getAudioTracks();this.phoneyStreamTracks.ss_audio=t}{let[e]=t.clone().getVideoTracks();this.phoneyStreamTracks.ss_video=e}navigator.mediaDevices&&(this._onDeviceChange=()=>{this._getAllEnumerateDevices(),this.on.devicechange&&this.on.devicechange()},navigator.mediaDevices.ondevicechange=this._onDeviceChange),this._getAllEnumerateDevices()}getPhoneyStreamTrack=e=>this.phoneyStreamTracks[e];initLocalStreamTrack=async e=>{switch(e){case`mc_audio`:{let e=this._getSafetyMediaDeviceKind(`audioinput`),t=this.mediaTrackConstraints.mc_audio;this.stopLocalStreamTrack(`mc_audio`);let n=e?{deviceId:{exact:e},...t}:{...t},[r]=(await navigator.mediaDevices.getUserMedia({audio:n,video:!1})).getAudioTracks();this.localStreamTracks.mc_audio=r}break;case`mc_video`:{let e=this._getSafetyMediaDeviceKind(`videoinput`),t=this.mediaTrackConstraints.mc_video;this.stopLocalStreamTrack(`mc_video`);let n=e?{deviceId:{exact:e},...t}:{...t},[r]=(await navigator.mediaDevices.getUserMedia({audio:!1,video:n})).getVideoTracks();this.localStreamTracks.mc_video=r}break;case`mc`:{let e=this._getSafetyMediaDeviceKind(`audioinput`),t=this._getSafetyMediaDeviceKind(`videoinput`),n=this.mediaTrackConstraints.mc_audio,r=this.mediaTrackConstraints.mc_video;this.stopLocalStreamTrack(`mc_audio`),this.stopLocalStreamTrack(`mc_video`);let i=e?{deviceId:{exact:e},...n}:{...n},a=t?{deviceId:{exact:t},...r}:{...r},o=await navigator.mediaDevices.getUserMedia({audio:i,video:a});{let[e]=o.getAudioTracks();this.localStreamTracks.mc_audio=e}{let[e]=o.getVideoTracks();this.localStreamTracks.mc_video=e}}break;case`ss_audio`:{let e=this.mediaTrackConstraints.ss_audio;this.stopLocalStreamTrack(`ss_audio`);let[t]=(await navigator.mediaDevices.getDisplayMedia({audio:{...e},video:!0})).getAudioTracks();this.localStreamTracks.ss_audio=t}break;case`ss_video`:{let e=this.mediaTrackConstraints.ss_video;this.stopLocalStreamTrack(`ss_video`);let[t]=(await navigator.mediaDevices.getDisplayMedia({audio:!1,video:{...e}})).getVideoTracks();this.localStreamTracks.ss_video=t}break;case`ss`:{let e=this.mediaTrackConstraints.ss_audio,t=this.mediaTrackConstraints.ss_video;this.stopLocalStreamTrack(`ss_audio`),this.stopLocalStreamTrack(`ss_video`);let n={audio:{...e},video:{...t}},r=await navigator.mediaDevices.getDisplayMedia(n);{let[e]=r.getAudioTracks();this.localStreamTracks.ss_audio=e}{let[e]=r.getVideoTracks();this.localStreamTracks.ss_video=e}}break}};getLocalStreamTrack=e=>{let t=this.localStreamTracks[e];if(t?.readyState===`live`)return t};checkLocalStreamTracks=e=>{let t=[],n=[];for(let r of e){let e=this.localStreamTracks[r];e&&e.readyState===`live`?n.push(r):t.push(r)}return{valid_mediaTypes:n,invalid_mediaTypes:t}};stopLocalStreamTrack=e=>{this.localStreamTracks[e]?.stop(),this.localStreamTracks[e]=void 0};isOpenMediaDevice=e=>!!this.localStreamTracks[e];setMediaTrackConstraints=async(e,t)=>{let n=this.mediaTrackConstraints[e];this.mediaTrackConstraints[e]={...n,...t}};getMediaDeviceKind=e=>this.useMediaDevices[e];setMediaDeviceKind=async(e,t)=>{this.useMediaDevices[e]=t};changeAudiooutput=async()=>{try{let e=this.useMediaDevices.audiooutput||``;await this.audioContext.setSinkId(e)}catch(e){console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: setSinkId is error.`,e)}};getMediaDevicesErrInfo=async()=>{let e={mc_audio:``,mc_video:``};try{let t=await navigator.mediaDevices.enumerateDevices();t.find(e=>e.kind===`audioinput`)||(e.mc_audio=`audioinput is not available.`),t.find(e=>e.kind===`videoinput`)||(e.mc_video=`videoinput is not available.`)}catch(t){e.mc_audio=t.message||t,e.mc_video=t.message||t}return e};getEnumerateDevices=async e=>(await this._getAllEnumerateDevices(),this.enumerateDevices[e]);getEnumerateAudioinputDevices=()=>this.getEnumerateDevices(`audioinput`);getEnumerateAudioOutputDevices=()=>this.getEnumerateDevices(`audiooutput`);getEnumerateVideoinputDevices=()=>this.getEnumerateDevices(`videoinput`);_getAllEnumerateDevices=async()=>{if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return;let e=navigator.language;await navigator.mediaDevices.enumerateDevices().then(t=>{let n={audioinput:[],videoinput:[],audiooutput:[]},r=[];for(let e of t){let{kind:t,label:i,deviceId:a}=e;a!==`communications`&&(a===`default`?n[t].push({kind:t,label:i,deviceId:a}):r.push({kind:t,label:i,deviceId:a}))}n.audioinput.length===0&&n.audioinput.push({kind:`audioinput`,deviceId:`default-auto`,label:e===`zh-CN`?`默认值-自动`:`Default-Auto`}),n.videoinput.length===0&&n.videoinput.push({kind:`videoinput`,deviceId:`default-auto`,label:e===`zh-CN`?`默认值-自动`:`Default-Auto`}),n.audiooutput.length===0&&n.audiooutput.push({kind:`audiooutput`,deviceId:`default-auto`,label:e===`zh-CN`?`默认值-自动`:`Default-Auto`});for(let e of r){let{kind:t,label:r,deviceId:i}=e;n[t].push({kind:t,label:r,deviceId:i})}this.enumerateDevices=n}).catch(function(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: getAllEnumerateDevices is err`,e)})};_getSafetyMediaDeviceKind=e=>{let t=this.useMediaDevices[e];return t===`default-auto`&&(t=void 0),t};destroy=async()=>{if(!this._destroyed){this._destroyed=!0,this._onDocumentClick&&=(document.removeEventListener(`click`,this._onDocumentClick),void 0),navigator.mediaDevices&&this._onDeviceChange&&navigator.mediaDevices.ondevicechange===this._onDeviceChange&&(navigator.mediaDevices.ondevicechange=null),this._onDeviceChange=void 0;for(let e of Object.keys(this.localStreamTracks))this.stopLocalStreamTrack(e);this.phoneyStreamTracks?.mc_audio&&this.phoneyStreamTracks.mc_audio.stop(),this.phoneyStreamTracks?.mc_video&&this.phoneyStreamTracks.mc_video.stop(),this.phoneyStreamTracks?.ss_audio&&this.phoneyStreamTracks.ss_audio.stop(),this.phoneyStreamTracks?.ss_video&&this.phoneyStreamTracks.ss_video.stop(),this.phoneyStreamTracks={};try{this.audioContext&&this.audioContext.state!==`closed`&&await this.audioContext.close()}catch(e){console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: LocalMedias.audioContext.close is error.`,e)}}}},qi=s(((e,t)=>{var n=t.exports={v:[{name:`version`,reg:/^(\d*)$/}],o:[{name:`origin`,reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:[`username`,`sessionId`,`sessionVersion`,`netType`,`ipVer`,`address`],format:`%s %s %d %s IP%d %s`}],s:[{name:`name`}],i:[{name:`description`}],u:[{name:`uri`}],e:[{name:`email`}],p:[{name:`phone`}],z:[{name:`timezones`}],r:[{name:`repeats`}],t:[{name:`timing`,reg:/^(\d*) (\d*)/,names:[`start`,`stop`],format:`%d %d`}],c:[{name:`connection`,reg:/^IN IP(\d) (\S*)/,names:[`version`,`ip`],format:`IN IP%d %s`}],b:[{push:`bandwidth`,reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:[`type`,`limit`],format:`%s:%s`}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:[`type`,`port`,`protocol`,`payloads`],format:`%s %d %s %s`}],a:[{push:`rtp`,reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:[`payload`,`codec`,`rate`,`encoding`],format:function(e){return e.encoding?`rtpmap:%d %s/%s/%s`:e.rate?`rtpmap:%d %s/%s`:`rtpmap:%d %s`}},{push:`fmtp`,reg:/^fmtp:(\d*) ([\S| ]*)/,names:[`payload`,`config`],format:`fmtp:%d %s`},{name:`control`,reg:/^control:(.*)/,format:`control:%s`},{name:`rtcp`,reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:[`port`,`netType`,`ipVer`,`address`],format:function(e){return e.address==null?`rtcp:%d`:`rtcp:%d %s IP%d %s`}},{push:`rtcpFbTrrInt`,reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:[`payload`,`value`],format:`rtcp-fb:%s trr-int %d`},{push:`rtcpFb`,reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:[`payload`,`type`,`subtype`],format:function(e){return e.subtype==null?`rtcp-fb:%s %s`:`rtcp-fb:%s %s %s`}},{push:`ext`,reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:[`value`,`direction`,`encrypt-uri`,`uri`,`config`],format:function(e){return`extmap:%d`+(e.direction?`/%s`:`%v`)+(e[`encrypt-uri`]?` %s`:`%v`)+` %s`+(e.config?` %s`:``)}},{name:`extmapAllowMixed`,reg:/^(extmap-allow-mixed)/},{push:`crypto`,reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:[`id`,`suite`,`config`,`sessionConfig`],format:function(e){return e.sessionConfig==null?`crypto:%d %s %s`:`crypto:%d %s %s %s`}},{name:`setup`,reg:/^setup:(\w*)/,format:`setup:%s`},{name:`connectionType`,reg:/^connection:(new|existing)/,format:`connection:%s`},{name:`mid`,reg:/^mid:([^\s]*)/,format:`mid:%s`},{push:`msid`,reg:/^msid:([\w-]+)(?: ([\w-]+))?/,names:[`id`,`appdata`],format:`msid:%s %s`},{name:`ptime`,reg:/^ptime:(\d*(?:\.\d*)*)/,format:`ptime:%d`},{name:`maxptime`,reg:/^maxptime:(\d*(?:\.\d*)*)/,format:`maxptime:%d`},{name:`direction`,reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:`icelite`,reg:/^(ice-lite)/},{name:`iceUfrag`,reg:/^ice-ufrag:(\S*)/,format:`ice-ufrag:%s`},{name:`icePwd`,reg:/^ice-pwd:(\S*)/,format:`ice-pwd:%s`},{name:`fingerprint`,reg:/^fingerprint:(\S*) (\S*)/,names:[`type`,`hash`],format:`fingerprint:%s %s`},{push:`candidates`,reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:[`foundation`,`component`,`transport`,`priority`,`ip`,`port`,`type`,`raddr`,`rport`,`tcptype`,`generation`,`network-id`,`network-cost`],format:function(e){var t=`candidate:%s %d %s %d %s %d typ %s`;return t+=e.raddr==null?`%v%v`:` raddr %s rport %d`,t+=e.tcptype==null?`%v`:` tcptype %s`,e.generation!=null&&(t+=` generation %d`),t+=e[`network-id`]==null?`%v`:` network-id %d`,t+=e[`network-cost`]==null?`%v`:` network-cost %d`,t}},{name:`endOfCandidates`,reg:/^(end-of-candidates)/},{name:`remoteCandidates`,reg:/^remote-candidates:(.*)/,format:`remote-candidates:%s`},{name:`iceOptions`,reg:/^ice-options:(\S*)/,format:`ice-options:%s`},{push:`ssrcs`,reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:[`id`,`attribute`,`value`],format:function(e){var t=`ssrc:%d`;return e.attribute!=null&&(t+=` %s`,e.value!=null&&(t+=`:%s`)),t}},{push:`ssrcGroups`,reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:[`semantics`,`ssrcs`],format:`ssrc-group:%s %s`},{name:`msidSemantic`,reg:/^msid-semantic:\s?(\w*) (\S*)/,names:[`semantic`,`token`],format:`msid-semantic: %s %s`},{push:`groups`,reg:/^group:(\w*) (.*)/,names:[`type`,`mids`],format:`group:%s %s`},{name:`rtcpMux`,reg:/^(rtcp-mux)/},{name:`rtcpRsize`,reg:/^(rtcp-rsize)/},{name:`sctpmap`,reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:[`sctpmapNumber`,`app`,`maxMessageSize`],format:function(e){return e.maxMessageSize==null?`sctpmap:%s %s`:`sctpmap:%s %s %s`}},{name:`xGoogleFlag`,reg:/^x-google-flag:([^\s]*)/,format:`x-google-flag:%s`},{push:`rids`,reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:[`id`,`direction`,`params`],format:function(e){return e.params?`rid:%s %s %s`:`rid:%s %s`}},{push:`imageattrs`,reg:RegExp(`^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?`),names:[`pt`,`dir1`,`attrs1`,`dir2`,`attrs2`],format:function(e){return`imageattr:%s %s %s`+(e.dir2?` %s %s`:``)}},{name:`simulcast`,reg:RegExp(`^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$`),names:[`dir1`,`list1`,`dir2`,`list2`],format:function(e){return`simulcast:%s %s`+(e.dir2?` %s %s`:``)}},{name:`simulcast_03`,reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:[`value`],format:`simulcast: %s`},{name:`framerate`,reg:/^framerate:(\d+(?:$|\.\d+))/,format:`framerate:%s`},{name:`sourceFilter`,reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:[`filterMode`,`netType`,`addressTypes`,`destAddress`,`srcList`],format:`source-filter: %s %s %s %s %s`},{name:`bundleOnly`,reg:/^(bundle-only)/},{name:`label`,reg:/^label:(.+)/,format:`label:%s`},{name:`sctpPort`,reg:/^sctp-port:(\d+)$/,format:`sctp-port:%s`},{name:`maxMessageSize`,reg:/^max-message-size:(\d+)$/,format:`max-message-size:%s`},{push:`tsRefClocks`,reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:[`clksrc`,`clksrcExt`],format:function(e){return`ts-refclk:%s`+(e.clksrcExt==null?``:`=%s`)}},{name:`mediaClk`,reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:[`id`,`mediaClockName`,`mediaClockValue`,`rateNumerator`,`rateDenominator`],format:function(e){var t=`mediaclk:`;return t+=e.id==null?`%v%s`:`id=%s %s`,t+=e.mediaClockValue==null?``:`=%s`,t+=e.rateNumerator==null?``:` rate=%s`,t+=e.rateDenominator==null?``:`/%s`,t}},{name:`keywords`,reg:/^keywds:(.+)$/,format:`keywds:%s`},{name:`content`,reg:/^content:(.+)/,format:`content:%s`},{name:`bfcpFloorCtrl`,reg:/^floorctrl:(c-only|s-only|c-s)/,format:`floorctrl:%s`},{name:`bfcpConfId`,reg:/^confid:(\d+)/,format:`confid:%s`},{name:`bfcpUserId`,reg:/^userid:(\d+)/,format:`userid:%s`},{name:`bfcpFloorId`,reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:[`id`,`mStream`],format:`floorid:%s mstrm:%s`},{push:`invalid`,names:[`value`]}]};Object.keys(n).forEach(function(e){n[e].forEach(function(e){e.reg||=/(.*)/,e.format||=`%s`})})})),Ji=s((e=>{var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r,i){if(i&&!r)n[i]=t(e[1]);else for(var a=0;a<r.length;a+=1)e[a+1]!=null&&(n[r[a]]=t(e[a+1]))},r=function(e,t,r){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:i?t[e.name]:t;n(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},i=qi(),a=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},n=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(a).forEach(function(e){var t=e[0],a=e.slice(2);t===`m`&&(n.push({rtp:[],fmtp:[]}),o=n[n.length-1]);for(var s=0;s<(i[t]||[]).length;s+=1){var c=i[t][s];if(c.reg.test(a))return r(c,o,a)}}),t.media=n,t};var o=function(e,n){var r=n.split(/=(.+)/,2);return r.length===2?e[r[0]]=t(r[1]):r.length===1&&n.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(` `).map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],r=e.split(` `).map(t),i=0;i<r.length;i+=3)n.push({component:r[i],ip:r[i+1],port:r[i+2]});return n},e.parseImageAttributes=function(e){return e.split(` `).map(function(e){return e.substring(1,e.length-1).split(`,`).reduce(o,{})})},e.parseSimulcastStreamList=function(e){return e.split(`;`).map(function(e){return e.split(`,`).map(function(e){var n,r=!1;return e[0]===`~`?(n=t(e.substring(1,e.length)),r=!0):n=t(e),{scid:n,paused:r}})})}})),Yi=s(((e,t)=>{var n=qi(),r=/%[sdv%]/g,i=function(e){var t=1,n=arguments,i=n.length;return e.replace(r,function(e){if(t>=i)return e;var r=n[t];switch(t+=1,e){case`%%`:return`%`;case`%s`:return String(r);case`%d`:return Number(r);case`%v`:return``}})},a=function(e,t,n){var r=t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format,a=[e+`=`+r];if(t.names)for(var o=0;o<t.names.length;o+=1){var s=t.names[o];t.name?a.push(n[t.name][s]):a.push(n[t.names[o]])}else a.push(n[t.name]);return i.apply(null,a)},o=[`v`,`o`,`s`,`i`,`u`,`e`,`p`,`c`,`b`,`t`,`r`,`z`,`a`],s=[`i`,`c`,`b`,`a`];t.exports=function(e,t){t||={},e.version??=0,e.name??=` `,e.media.forEach(function(e){e.payloads??=``});var r=t.outerOrder||o,i=t.innerOrder||s,c=[];return r.forEach(function(t){n[t].forEach(function(n){n.name in e&&e[n.name]!=null?c.push(a(t,n,e)):n.push in e&&e[n.push]!=null&&e[n.push].forEach(function(e){c.push(a(t,n,e))})})}),e.media.forEach(function(e){c.push(a(`m`,n.m[0],e)),i.forEach(function(t){n[t].forEach(function(n){n.name in e&&e[n.name]!=null?c.push(a(t,n,e)):n.push in e&&e[n.push]!=null&&e[n.push].forEach(function(e){c.push(a(t,n,e))})})})}),c.join(`\r
|
|
3
3
|
`)+`\r
|
|
4
4
|
`}})),Xi=u(s((e=>{var t=Ji(),n=Yi();qi(),e.write=n,e.parse=t.parse,e.parseParams=t.parseParams,e.parseFmtpConfig=t.parseFmtpConfig,e.parsePayloads=t.parsePayloads,e.parseRemoteCandidates=t.parseRemoteCandidates,e.parseImageAttributes=t.parseImageAttributes,e.parseSimulcastStreamList=t.parseSimulcastStreamList}))(),1),Zi=class{resolvesMap=new Map;index=0;constructor(){}emit=async e=>{let t=this.resolvesMap.get(e);if(t){for(let e of t.values())clearTimeout(e.timer),e.resolve(!0);t.clear()}};add=(e,t=()=>!1,n=1e3*30)=>new Promise((r,i)=>{if(t())return r(!0);this.resolvesMap.has(e)||this.resolvesMap.set(e,new Map),this.index++;let a=`${this.index}`;n=Math.max(0,n);let o=0;n>=0&&(o=window.setTimeout(()=>i(`[PrResolves] ${e} is timeout.`),n)),this.resolvesMap.get(e)?.set(a,{resolve:r,reject:i,timer:o})});clear=()=>{let e=this.resolvesMap.keys();for(let t of e){let e=this.resolvesMap.get(t)?.values()||[];for(let n of e)clearTimeout(n.timer),n.reject(`[PrResolves] ${t} is clear.`)}this.resolvesMap=new Map}},Qi=4,$i=0,ea=1,ta=2;function na(e){let t=e.length;for(;--t>=0;)e[t]=0}var ra=0,ia=1,aa=2,oa=3,sa=258,ca=29,la=256,ua=la+1+ca,da=30,fa=19,pa=2*ua+1,ma=15,ha=16,ga=7,_a=256,va=16,ya=17,ba=18,xa=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Sa=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Ca=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),wa=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ta=512,Ea=Array((ua+2)*2);na(Ea);var Da=Array(da*2);na(Da);var Oa=Array(Ta);na(Oa);var ka=Array(sa-oa+1);na(ka);var Aa=Array(ca);na(Aa);var ja=Array(da);na(ja);function Ma(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var Na,Pa,Fa;function Ia(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var La=e=>e<256?Oa[e]:Oa[256+(e>>>7)],Ra=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},V=(e,t,n)=>{e.bi_valid>ha-n?(e.bi_buf|=t<<e.bi_valid&65535,Ra(e,e.bi_buf),e.bi_buf=t>>ha-e.bi_valid,e.bi_valid+=n-ha):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},za=(e,t,n)=>{V(e,n[t*2],n[t*2+1])},Ba=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},Va=e=>{e.bi_valid===16?(Ra(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Ha=(e,t)=>{let n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=ma;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<pa;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},Ua=(e,t,n)=>{let r=Array(ma+1),i=0,a,o;for(a=1;a<=ma;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=Ba(r[t]++,t))}},Wa=()=>{let e,t,n,r,i,a=Array(ma+1);for(n=0,r=0;r<ca-1;r++)for(Aa[r]=n,e=0;e<1<<xa[r];e++)ka[n++]=r;for(ka[n-1]=r,i=0,r=0;r<16;r++)for(ja[r]=i,e=0;e<1<<Sa[r];e++)Oa[i++]=r;for(i>>=7;r<da;r++)for(ja[r]=i<<7,e=0;e<1<<Sa[r]-7;e++)Oa[256+ i++]=r;for(t=0;t<=ma;t++)a[t]=0;for(e=0;e<=143;)Ea[e*2+1]=8,e++,a[8]++;for(;e<=255;)Ea[e*2+1]=9,e++,a[9]++;for(;e<=279;)Ea[e*2+1]=7,e++,a[7]++;for(;e<=287;)Ea[e*2+1]=8,e++,a[8]++;for(Ua(Ea,ua+1,a),e=0;e<da;e++)Da[e*2+1]=5,Da[e*2]=Ba(e,5);Na=new Ma(Ea,xa,la+1,ua,ma),Pa=new Ma(Da,Sa,0,da,ma),Fa=new Ma([],Ca,0,fa,ga)},Ga=e=>{let t;for(t=0;t<ua;t++)e.dyn_ltree[t*2]=0;for(t=0;t<da;t++)e.dyn_dtree[t*2]=0;for(t=0;t<fa;t++)e.bl_tree[t*2]=0;e.dyn_ltree[_a*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ka=e=>{e.bi_valid>8?Ra(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},qa=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]},Ja=(e,t,n)=>{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&qa(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!qa(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},Ya=(e,t,n)=>{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+ a++]&255,r+=(e.pending_buf[e.sym_buf+ a++]&255)<<8,i=e.pending_buf[e.sym_buf+ a++],r===0?za(e,i,t):(o=ka[i],za(e,o+la+1,t),s=xa[o],s!==0&&(i-=Aa[o],V(e,i,s)),r--,o=La(r),za(e,o,n),s=Sa[o],s!==0&&(r-=ja[o],V(e,r,s)));while(a<e.sym_next);za(e,_a,t)},Xa=(e,t)=>{let n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=pa,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Ja(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ja(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,Ja(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Ha(e,t),Ua(n,c,e.bl_count)},Za=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[ya*2]++:e.bl_tree[ba*2]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[va*2]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},Qa=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do za(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(za(e,ya,e.bl_tree),V(e,s-3,3)):(za(e,ba,e.bl_tree),V(e,s-11,7)):(a!==i&&(za(e,a,e.bl_tree),s--),za(e,va,e.bl_tree),V(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},$a=e=>{let t;for(Za(e,e.dyn_ltree,e.l_desc.max_code),Za(e,e.dyn_dtree,e.d_desc.max_code),Xa(e,e.bl_desc),t=fa-1;t>=3&&e.bl_tree[wa[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},eo=(e,t,n,r)=>{let i;for(V(e,t-257,5),V(e,n-1,5),V(e,r-4,4),i=0;i<r;i++)V(e,e.bl_tree[wa[i]*2+1],3);Qa(e,e.dyn_ltree,t-1),Qa(e,e.dyn_dtree,n-1)},to=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return $i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return ea;for(n=32;n<la;n++)if(e.dyn_ltree[n*2]!==0)return ea;return $i},no=!1,ro=e=>{no||=(Wa(),!0),e.l_desc=new Ia(e.dyn_ltree,Na),e.d_desc=new Ia(e.dyn_dtree,Pa),e.bl_desc=new Ia(e.bl_tree,Fa),e.bi_buf=0,e.bi_valid=0,Ga(e)},io=(e,t,n,r)=>{V(e,(ra<<1)+ +!!r,3),Ka(e),Ra(e,n),Ra(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},ao={_tr_init:ro,_tr_stored_block:io,_tr_flush_block:(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===ta&&(e.strm.data_type=to(e)),Xa(e,e.l_desc),Xa(e,e.d_desc),o=$a(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?io(e,t,n,r):e.strategy===Qi||a===i?(V(e,(ia<<1)+ +!!r,3),Ya(e,Ea,Da)):(V(e,(aa<<1)+ +!!r,3),eo(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Ya(e,e.dyn_ltree,e.dyn_dtree)),Ga(e),r&&Ka(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+ e.sym_next++]=t,e.pending_buf[e.sym_buf+ e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+ e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(ka[n]+la+1)*2]++,e.dyn_dtree[La(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{V(e,ia<<1,3),za(e,_a,Ea),Va(e)}},oo=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},so=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t})()),H=(e,t,n,r)=>{let i=so,a=r+n;e^=-1;for(let n=r;n<a;n++)e=e>>>8^i[(e^t[n])&255];return e^-1},co={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`},lo={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:uo,_tr_stored_block:fo,_tr_flush_block:po,_tr_tally:mo,_tr_align:ho}=ao,{Z_NO_FLUSH:go,Z_PARTIAL_FLUSH:_o,Z_FULL_FLUSH:vo,Z_FINISH:U,Z_BLOCK:yo,Z_OK:W,Z_STREAM_END:bo,Z_STREAM_ERROR:xo,Z_DATA_ERROR:So,Z_BUF_ERROR:Co,Z_DEFAULT_COMPRESSION:wo,Z_FILTERED:To,Z_HUFFMAN_ONLY:Eo,Z_RLE:Do,Z_FIXED:Oo,Z_DEFAULT_STRATEGY:ko,Z_UNKNOWN:Ao,Z_DEFLATED:jo}=lo,Mo=9,No=15,Po=8,Fo=286,Io=30,Lo=19,Ro=2*Fo+1,zo=15,G=3,Bo=258,Vo=Bo+G+1,Ho=32,Uo=42,Wo=57,Go=69,Ko=73,qo=91,Jo=103,Yo=113,Xo=666,K=1,Zo=2,Qo=3,$o=4,es=3,ts=(e,t)=>(e.msg=co[t],t),ns=e=>e*2-(e>4?9:0),rs=e=>{let t=e.length;for(;--t>=0;)e[t]=0},is=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},as=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,q=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},J=(e,t)=>{po(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,q(e.strm)},Y=(e,t)=>{e.pending_buf[e.pending++]=t},os=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},ss=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=oo(e.adler,t,i,n):e.state.wrap===2&&(e.adler=H(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},cs=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-Vo?e.strstart-(e.w_size-Vo):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+Bo,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]!==m||l[i+o-1]!==p||l[i]!==l[r]||l[++i]!==l[r+1])continue;r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=Bo-(f-r),r=f-Bo,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead},ls=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Vo)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),is(e),r+=t),e.strm.avail_in===0)break;if(n=ss(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=G)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=as(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=as(e,e.ins_h,e.window[i+G-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<G)););}while(e.lookahead<Vo&&e.strm.avail_in!==0)},us=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&t!==U||t===go||r!==i+e.strm.avail_in)))break;o=+(t===U&&r===i+e.strm.avail_in),fo(e,0,0,o),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,q(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(ss(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?$o:t!==go&&t!==U&&e.strm.avail_in===0&&e.strstart===e.block_start?Zo:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(ss(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===U)&&t!==go&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=+(t===U&&e.strm.avail_in===0&&r===i),fo(e,e.block_start,r,o),e.block_start+=r,q(e.strm)),o?Qo:K)},ds=(e,t)=>{let n,r;for(;;){if(e.lookahead<Vo){if(ls(e),e.lookahead<Vo&&t===go)return K;if(e.lookahead===0)break}if(n=0,e.lookahead>=G&&(e.ins_h=as(e,e.ins_h,e.window[e.strstart+G-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Vo&&(e.match_length=cs(e,n)),e.match_length>=G)if(r=mo(e,e.strstart-e.match_start,e.match_length-G),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=G){e.match_length--;do e.strstart++,e.ins_h=as(e,e.ins_h,e.window[e.strstart+G-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=as(e,e.ins_h,e.window[e.strstart+1]);else r=mo(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(J(e,!1),e.strm.avail_out===0))return K}return e.insert=e.strstart<G-1?e.strstart:G-1,t===U?(J(e,!0),e.strm.avail_out===0?Qo:$o):e.sym_next&&(J(e,!1),e.strm.avail_out===0)?K:Zo},fs=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<Vo){if(ls(e),e.lookahead<Vo&&t===go)return K;if(e.lookahead===0)break}if(n=0,e.lookahead>=G&&(e.ins_h=as(e,e.ins_h,e.window[e.strstart+G-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=G-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Vo&&(e.match_length=cs(e,n),e.match_length<=5&&(e.strategy===To||e.match_length===G&&e.strstart-e.match_start>4096)&&(e.match_length=G-1)),e.prev_length>=G&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-G,r=mo(e,e.strstart-1-e.prev_match,e.prev_length-G),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=as(e,e.ins_h,e.window[e.strstart+G-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=G-1,e.strstart++,r&&(J(e,!1),e.strm.avail_out===0))return K}else if(e.match_available){if(r=mo(e,0,e.window[e.strstart-1]),r&&J(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return K}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=mo(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<G-1?e.strstart:G-1,t===U?(J(e,!0),e.strm.avail_out===0?Qo:$o):e.sym_next&&(J(e,!1),e.strm.avail_out===0)?K:Zo},ps=(e,t)=>{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=Bo){if(ls(e),e.lookahead<=Bo&&t===go)return K;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=G&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+Bo;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=Bo-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=G?(n=mo(e,1,e.match_length-G),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=mo(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(J(e,!1),e.strm.avail_out===0))return K}return e.insert=0,t===U?(J(e,!0),e.strm.avail_out===0?Qo:$o):e.sym_next&&(J(e,!1),e.strm.avail_out===0)?K:Zo},ms=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(ls(e),e.lookahead===0)){if(t===go)return K;break}if(e.match_length=0,n=mo(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(J(e,!1),e.strm.avail_out===0))return K}return e.insert=0,t===U?(J(e,!0),e.strm.avail_out===0?Qo:$o):e.sym_next&&(J(e,!1),e.strm.avail_out===0)?K:Zo};function hs(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var gs=[new hs(0,0,0,0,us),new hs(4,4,8,4,ds),new hs(4,5,16,8,ds),new hs(4,6,32,32,ds),new hs(4,4,16,16,fs),new hs(8,16,32,32,fs),new hs(8,16,128,128,fs),new hs(8,32,128,256,fs),new hs(32,128,258,1024,fs),new hs(32,258,258,4096,fs)],_s=e=>{e.window_size=2*e.w_size,rs(e.head),e.max_lazy_match=gs[e.level].max_lazy,e.good_match=gs[e.level].good_length,e.nice_match=gs[e.level].nice_length,e.max_chain_length=gs[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=G-1,e.match_available=0,e.ins_h=0};function vs(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=jo,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Ro*2),this.dyn_dtree=new Uint16Array((2*Io+1)*2),this.bl_tree=new Uint16Array((2*Lo+1)*2),rs(this.dyn_ltree),rs(this.dyn_dtree),rs(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(zo+1),this.heap=new Uint16Array(2*Fo+1),rs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Fo+1),rs(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var ys=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.status!==Uo&&t.status!==Wo&&t.status!==Go&&t.status!==Ko&&t.status!==qo&&t.status!==Jo&&t.status!==Yo&&t.status!==Xo)},bs=e=>{if(ys(e))return ts(e,xo);e.total_in=e.total_out=0,e.data_type=Ao;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Wo:t.wrap?Uo:Yo,e.adler=t.wrap===2?0:1,t.last_flush=-2,uo(t),W},xs=e=>{let t=bs(e);return t===W&&_s(e.state),t},Ss=(e,t)=>ys(e)||e.state.wrap!==2?xo:(e.state.gzhead=t,W),Cs=(e,t,n,r,i,a)=>{if(!e)return xo;let o=1;if(t===wo&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Mo||n!==jo||r<8||r>15||t<0||t>9||a<0||a>Oo||r===8&&o!==1)return ts(e,xo);r===8&&(r=9);let s=new vs;return e.state=s,s.strm=e,s.status=Uo,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+G-1)/G),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=t,s.strategy=a,s.method=n,xs(e)},ws={deflateInit:(e,t)=>Cs(e,t,jo,No,Po,ko),deflateInit2:Cs,deflateReset:xs,deflateResetKeep:bs,deflateSetHeader:Ss,deflate:(e,t)=>{if(ys(e)||t>yo||t<0)return e?ts(e,xo):xo;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Xo&&t!==U)return ts(e,e.avail_out===0?Co:xo);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(q(e),e.avail_out===0)return n.last_flush=-1,W}else if(e.avail_in===0&&ns(t)<=ns(r)&&t!==U)return ts(e,Co);if(n.status===Xo&&e.avail_in!==0)return ts(e,Co);if(n.status===Uo&&n.wrap===0&&(n.status=Yo),n.status===Uo){let t=jo+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=Eo||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=Ho),t+=31-t%31,os(n,t),n.strstart!==0&&(os(n,e.adler>>>16),os(n,e.adler&65535)),e.adler=1,n.status=Yo,q(e),n.pending!==0)return n.last_flush=-1,W}if(n.status===Wo){if(e.adler=0,Y(n,31),Y(n,139),Y(n,8),n.gzhead)Y(n,+!!n.gzhead.text+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Y(n,n.gzhead.time&255),Y(n,n.gzhead.time>>8&255),Y(n,n.gzhead.time>>16&255),Y(n,n.gzhead.time>>24&255),Y(n,n.level===9?2:n.strategy>=Eo||n.level<2?4:0),Y(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Y(n,n.gzhead.extra.length&255),Y(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=H(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Go;else if(Y(n,0),Y(n,0),Y(n,0),Y(n,0),Y(n,0),Y(n,n.level===9?2:n.strategy>=Eo||n.level<2?4:0),Y(n,es),n.status=Yo,q(e),n.pending!==0)return n.last_flush=-1,W}if(n.status===Go){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=H(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,q(e),n.pending!==0)return n.last_flush=-1,W;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=H(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=Ko}if(n.status===Ko){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=H(e.adler,n.pending_buf,n.pending-t,t)),q(e),n.pending!==0)return n.last_flush=-1,W;t=0}r=n.gzindex<n.gzhead.name.length?n.gzhead.name.charCodeAt(n.gzindex++)&255:0,Y(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=H(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=qo}if(n.status===qo){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=H(e.adler,n.pending_buf,n.pending-t,t)),q(e),n.pending!==0)return n.last_flush=-1,W;t=0}r=n.gzindex<n.gzhead.comment.length?n.gzhead.comment.charCodeAt(n.gzindex++)&255:0,Y(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=H(e.adler,n.pending_buf,n.pending-t,t))}n.status=Jo}if(n.status===Jo){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(q(e),n.pending!==0))return n.last_flush=-1,W;Y(n,e.adler&255),Y(n,e.adler>>8&255),e.adler=0}if(n.status=Yo,q(e),n.pending!==0)return n.last_flush=-1,W}if(e.avail_in!==0||n.lookahead!==0||t!==go&&n.status!==Xo){let r=n.level===0?us(n,t):n.strategy===Eo?ms(n,t):n.strategy===Do?ps(n,t):gs[n.level].func(n,t);if((r===Qo||r===$o)&&(n.status=Xo),r===K||r===Qo)return e.avail_out===0&&(n.last_flush=-1),W;if(r===Zo&&(t===_o?ho(n):t!==yo&&(fo(n,0,0,!1),t===vo&&(rs(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),q(e),e.avail_out===0))return n.last_flush=-1,W}return t===U?n.wrap<=0?bo:(n.wrap===2?(Y(n,e.adler&255),Y(n,e.adler>>8&255),Y(n,e.adler>>16&255),Y(n,e.adler>>24&255),Y(n,e.total_in&255),Y(n,e.total_in>>8&255),Y(n,e.total_in>>16&255),Y(n,e.total_in>>24&255)):(os(n,e.adler>>>16),os(n,e.adler&65535)),q(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?bo:W):W},deflateEnd:e=>{if(ys(e))return xo;let t=e.state.status;return e.state=null,t===Yo?ts(e,So):W},deflateSetDictionary:(e,t)=>{let n=t.length;if(ys(e))return xo;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Uo||r.lookahead)return xo;if(i===1&&(e.adler=oo(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(rs(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,ls(r);r.lookahead>=G;){let e=r.strstart,t=r.lookahead-(G-1);do r.ins_h=as(r,r.ins_h,r.window[e+G-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++;while(--t);r.strstart=e,r.lookahead=G-1,ls(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=G-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,W},deflateInfo:`pako deflate (from Nodeca project)`},Ts=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Es={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)Ts(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;let n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n}},Ds=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ds=!1}var Os=new Uint8Array(256);for(let e=0;e<256;e++)Os[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Os[254]=Os[254]=1;var ks=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i<o;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),a=0,i=0;a<s;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},As=(e,t)=>{if(t<65534&&e.subarray&&Ds)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n},js={string2buf:ks,buf2string:(e,t)=>{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){a[i++]=t;continue}let o=Os[t];if(o>4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r<n;)t=t<<6|e[r++]&63,o--;if(o>1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return As(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+Os[e[n]]>t?n:t}};function Ms(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}var Ns=Ms,Ps=Object.prototype.toString,{Z_NO_FLUSH:Fs,Z_SYNC_FLUSH:Is,Z_FULL_FLUSH:Ls,Z_FINISH:Rs,Z_OK:zs,Z_STREAM_END:Bs,Z_DEFAULT_COMPRESSION:Vs,Z_DEFAULT_STRATEGY:Hs,Z_DEFLATED:Us}=lo;function Ws(e){this.options=Es.assign({level:Vs,method:Us,chunkSize:16384,windowBits:15,memLevel:8,strategy:Hs},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new Ns,this.strm.avail_out=0;let n=ws.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==zs)throw Error(co[n]);if(t.header&&ws.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?js.string2buf(t.dictionary):Ps.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=ws.deflateSetDictionary(this.strm,e),n!==zs)throw Error(co[n]);this._dict_set=!0}}Ws.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?Rs:Fs,typeof e==`string`?n.input=js.string2buf(e):Ps.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===Is||a===Ls)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=ws.deflate(n,a),i===Bs)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=ws.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===zs;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},Ws.prototype.onData=function(e){this.chunks.push(e)},Ws.prototype.onEnd=function(e){e===zs&&(this.result=Es.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Gs(e,t){let n=new Ws(t);if(n.push(e,!0),n.err)throw n.msg||co[n.err];return n.result}function Ks(e,t){return t||={},t.raw=!0,Gs(e,t)}function qs(e,t){return t||={},t.gzip=!0,Gs(e,t)}var Js={Deflate:Ws,deflate:Gs,deflateRaw:Ks,gzip:qs,constants:lo},Ys=16209,Xs=16191,Zs=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<<E.lenbits)-1,_=(1<<E.distbits)-1;top:do{p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=m[f&g];dolen:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p<y&&(f+=w[n++]<<p,p+=8),b+=f&(1<<y)-1,f>>>=y,p-=y),p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=h[f&_];dodist:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,p<y&&(f+=w[n++]<<p,p+=8,p<y&&(f+=w[n++]<<p,p+=8)),x+=f&(1<<y)-1,x>s){e.msg=`invalid distance too far back`,E.mode=Ys;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=Ys;break top}if(S=0,C=d,u===0){if(S+=c-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}else if(u<y){if(S+=c+u-y,y-=u,y<b){b-=y;do T[i++]=d[S++];while(--y);if(S=0,u<b){y=u,b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}}else if(S+=u-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}for(;b>2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=Ys;break top}else{v=h[(v&65535)+(f&(1<<y)-1)];continue dodist}break}}else if(!(y&64)){v=m[(v&65535)+(f&(1<<y)-1)];continue dolen}else if(y&32){E.mode=Xs;break top}else{e.msg=`invalid literal/length code`,E.mode=Ys;break top}break}}while(n<r&&i<o);b=p>>3,n-=b,p-=b<<3,f&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?5+(r-n):5-(n-r),e.avail_out=i<o?257+(o-i):257-(i-o),E.hold=f,E.bits=p},Qs=15,$s=852,ec=592,tc=0,nc=1,rc=2,ic=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ac=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),oc=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),sc=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),cc=(e,t,n,r,i,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y,b,x,S,C,w=null,T,E=new Uint16Array(Qs+1),D=new Uint16Array(Qs+1),O=null,ee,k,te;for(l=0;l<=Qs;l++)E[l]=0;for(u=0;u<r;u++)E[t[n+u]]++;for(p=c,f=Qs;f>=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d<f&&E[d]===0;d++);for(p<d&&(p=d),g=1,l=1;l<=Qs;l++)if(g<<=1,g-=E[l],g<0)return-1;if(g>0&&(e===tc||f!==1))return-1;for(D[1]=0,l=1;l<Qs;l++)D[l+1]=D[l]+E[l];for(u=0;u<r;u++)t[n+u]!==0&&(o[D[t[n+u]]++]=u);if(e===tc?(w=O=o,T=20):e===nc?(w=ic,O=ac,T=257):(w=oc,O=sc,T=0),v=0,u=0,l=d,C=a,m=p,h=0,x=-1,_=1<<p,S=_-1,e===nc&&_>$s||e===rc&&_>ec)return 1;for(;;){ee=l-h,o[u]+1<T?(k=0,te=o[u]):o[u]>=T?(k=O[o[u]-T],te=w[o[u]-T]):(k=96,te=0),y=1<<l-h,b=1<<m,d=b;do b-=y,i[C+(v>>h)+b]=ee<<24|k<<16|te|0;while(b!==0);for(y=1<<l-1;v&y;)y>>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[l]===0){if(l===f)break;l=t[n+o[u]]}if(l>p&&(v&S)!==x){for(h===0&&(h=p),C+=d,m=l-h,g=1<<m;m+h<f&&(g-=E[m+h],!(g<=0));)m++,g<<=1;if(_+=1<<m,e===nc&&_>$s||e===rc&&_>ec)return 1;x=v&S,i[x]=p<<24|m<<16|C-a|0}}return v!==0&&(i[C+v]=l-h<<24|4194304),s.bits=p,0},lc=0,uc=1,dc=2,{Z_FINISH:fc,Z_BLOCK:pc,Z_TREES:mc,Z_OK:hc,Z_STREAM_END:gc,Z_NEED_DICT:_c,Z_STREAM_ERROR:vc,Z_DATA_ERROR:yc,Z_MEM_ERROR:bc,Z_BUF_ERROR:xc,Z_DEFLATED:Sc}=lo,Cc=16180,wc=16181,Tc=16182,Ec=16183,Dc=16184,Oc=16185,kc=16186,Ac=16187,jc=16188,Mc=16189,Nc=16190,Pc=16191,Fc=16192,Ic=16193,Lc=16194,Rc=16195,zc=16196,Bc=16197,Vc=16198,Hc=16199,Uc=16200,Wc=16201,Gc=16202,Kc=16203,qc=16204,Jc=16205,Yc=16206,Xc=16207,Zc=16208,X=16209,Qc=16210,$c=16211,el=852,tl=592,nl=15,rl=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function il(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var al=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<Cc||t.mode>$c)},ol=e=>{if(al(e))return vc;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=Cc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(el),t.distcode=t.distdyn=new Int32Array(tl),t.sane=1,t.back=-1,hc},sl=e=>{if(al(e))return vc;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,ol(e)},cl=(e,t)=>{let n;if(al(e))return vc;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?vc:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,sl(e))},ll=(e,t)=>{if(!e)return vc;let n=new il;e.state=n,n.strm=e,n.window=null,n.mode=Cc;let r=cl(e,t);return r!==hc&&(e.state=null),r},ul=e=>ll(e,nl),dl=!0,fl,pl,ml=e=>{if(dl){fl=new Int32Array(512),pl=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(cc(uc,e.lens,0,288,fl,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;cc(dc,e.lens,0,32,pl,0,e.work,{bits:5}),dl=!1}e.lencode=fl,e.lenbits=9,e.distcode=pl,e.distbits=5},hl=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},gl={inflateReset:sl,inflateReset2:cl,inflateResetKeep:ol,inflateInit:ul,inflateInit2:ll,inflate:(e,t)=>{let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g=0,_,v,y,b,x,S,C,w,T=new Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(al(e)||!e.output||!e.input&&e.avail_in!==0)return vc;n=e.state,n.mode===Pc&&(n.mode=Fc),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,f=c,w=hc;inf_leave:for(;;)switch(n.mode){case Cc:if(n.wrap===0){n.mode=Fc;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=H(n.check,T,2,0),l=0,u=0,n.mode=wc;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=X;break}if((l&15)!==Sc){e.msg=`unknown compression method`,n.mode=X;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=X;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=l&512?Mc:Pc,l=0,u=0;break;case wc:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==Sc){e.msg=`unknown compression method`,n.mode=X;break}if(n.flags&57344){e.msg=`unknown header flags set`,n.mode=X;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=H(n.check,T,2,0)),l=0,u=0,n.mode=Tc;case Tc:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=H(n.check,T,4,0)),l=0,u=0,n.mode=Ec;case Ec:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=H(n.check,T,2,0)),l=0,u=0,n.mode=Dc;case Dc:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=H(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=Oc;case Oc:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=H(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=kc;case kc:if(n.flags&2048){if(s===0)break inf_leave;p=0;do C=r[a+ p++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=H(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.name=null);n.length=0,n.mode=Ac;case Ac:if(n.flags&4096){if(s===0)break inf_leave;p=0;do C=r[a+ p++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=H(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.comment=null);n.mode=jc;case jc:if(n.flags&512){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){e.msg=`header crc mismatch`,n.mode=X;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Pc;break;case Mc:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}e.adler=n.check=rl(l),l=0,u=0,n.mode=Nc;case Nc:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,_c;e.adler=n.check=1,n.mode=Pc;case Pc:if(t===pc||t===mc)break inf_leave;case Fc:if(n.last){l>>>=u&7,u-=u&7,n.mode=Yc;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,--u,l&3){case 0:n.mode=Ic;break;case 1:if(ml(n),n.mode=Hc,t===mc){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=zc;break;case 3:e.msg=`invalid block type`,n.mode=X}l>>>=2,u-=2;break;case Ic:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if((l&65535)!=(l>>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=X;break}if(n.length=l&65535,l=0,u=0,n.mode=Lc,t===mc)break inf_leave;case Lc:n.mode=Rc;case Rc:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=Pc;break;case zc:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg=`too many length or distance symbols`,n.mode=X;break}n.have=0,n.mode=Bc;case Bc:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.lens[O[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},w=cc(lc,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=X;break}n.have=0,n.mode=Vc;case Vc:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l>>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=X;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=11+(l&127),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=X;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===X)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=X;break}if(n.lenbits=9,E={bits:n.lenbits},w=cc(uc,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=X;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=cc(dc,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=X;break}if(n.mode=Hc,t===mc)break inf_leave;case Hc:n.mode=Uc;case Uc:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,Zs(e,f),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===Pc&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(v&&!(v&240)){for(b=_,x=v,S=y;g=n.lencode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=Jc;break}if(v&32){n.back=-1,n.mode=Pc;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=X;break}n.extra=v&15,n.mode=Wc;case Wc:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Gc;case Gc:for(;g=n.distcode[l&(1<<n.distbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(!(v&240)){for(b=_,x=v,S=y;g=n.distcode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=X;break}n.offset=y,n.extra=v&15,n.mode=Kc;case Kc:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=X;break}n.mode=qc;case qc:if(c===0)break inf_leave;if(p=f-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=X;break}p>n.wnext?(p-=n.wnext,m=n.wsize-p):m=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,m=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=h[m++];while(--p);n.length===0&&(n.mode=Uc);break;case Jc:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=Uc;break;case Yc:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?H(n.check,i,f,o-f):oo(n.check,i,f,o-f)),f=c,n.wrap&4&&(n.flags?l:rl(l))!==n.check){e.msg=`incorrect data check`,n.mode=X;break}l=0,u=0}n.mode=Xc;case Xc:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){e.msg=`incorrect length check`,n.mode=X;break}l=0,u=0}n.mode=Zc;case Zc:w=gc;break inf_leave;case X:w=yc;break inf_leave;case Qc:return bc;case $c:default:return vc}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<X&&(n.mode<Yc||t!==fc))&&hl(e,e.output,e.next_out,f-e.avail_out),d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?H(n.check,i,f,e.next_out-f):oo(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Pc?128:0)+(n.mode===Hc||n.mode===Lc?256:0),(d===0&&f===0||t===fc)&&w===hc&&(w=xc),w},inflateEnd:e=>{if(al(e))return vc;let t=e.state;return t.window&&=null,e.state=null,hc},inflateGetHeader:(e,t)=>{if(al(e))return vc;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,hc):vc},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return al(e)||(r=e.state,r.wrap!==0&&r.mode!==Nc)?vc:r.mode===Nc&&(i=1,i=oo(i,t,n,0),i!==r.check)?yc:(a=hl(e,t,n,n),a?(r.mode=Qc,bc):(r.havedict=1,hc))},inflateInfo:`pako inflate (from Nodeca project)`};function _l(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var vl=_l,yl=Object.prototype.toString,{Z_NO_FLUSH:bl,Z_FINISH:xl,Z_OK:Sl,Z_STREAM_END:Cl,Z_NEED_DICT:wl,Z_STREAM_ERROR:Tl,Z_DATA_ERROR:El,Z_MEM_ERROR:Dl}=lo;function Ol(e){this.options=Es.assign({chunkSize:1024*64,windowBits:15,to:``},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new Ns,this.strm.avail_out=0;let n=gl.inflateInit2(this.strm,t.windowBits);if(n!==Sl||(this.header=new vl,gl.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=js.string2buf(t.dictionary):yl.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=gl.inflateSetDictionary(this.strm,t.dictionary),n!==Sl))))throw Error(co[n])}Ol.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?xl:bl,yl.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=gl.inflate(n,o),a===wl&&i&&(a=gl.inflateSetDictionary(n,i),a===Sl?a=gl.inflate(n,o):a===El&&(a=wl));n.avail_in>0&&a===Cl&&n.state.wrap>0&&e[n.next_in]!==0;)gl.inflateReset(n),a=gl.inflate(n,o);switch(a){case Tl:case El:case wl:case Dl:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===Cl))if(this.options.to===`string`){let e=js.utf8border(n.output,n.next_out),t=n.next_out-e,i=js.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===Sl&&s===0)){if(a===Cl)return a=gl.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Ol.prototype.onData=function(e){this.chunks.push(e)},Ol.prototype.onEnd=function(e){e===Sl&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=Es.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function kl(e,t){let n=new Ol(t);if(n.push(e),n.err)throw n.msg||co[n.err];return n.result}function Al(e,t){return t||={},t.raw=!0,kl(e,t)}var jl={Inflate:Ol,inflate:kl,inflateRaw:Al,ungzip:kl,constants:lo},{Deflate:Ml,deflate:Nl,deflateRaw:Pl,gzip:Fl}=Js,{Inflate:Il,inflate:Ll,inflateRaw:Rl,ungzip:zl}=jl,Bl={Deflate:Ml,deflate:Nl,deflateRaw:Pl,gzip:Fl,Inflate:Il,inflate:Ll,inflateRaw:Rl,ungzip:zl,constants:lo};function Vl(e){let t=Bl.deflate(e,{gzip:!0});return new Uint8Array(t)}function Hl(e){let t=Bl.inflate(e,{gzip:!0});return new Uint8Array(t)}var Ul=Hr(`Cg5CYXNlRGF0YS5wcm90bxIVY29tLnF1aWNrLnZvaWNlLnByb3RvInQKCUNvbW1vblJlcRINCgVldmVudBgBIAEoCRIMCgRkYXRhGAIgASgMEgoKAnNuGAMgASgDEgwKBHRpbWUYBCABKAMSDQoFdmFsaWQYBSABKAMSDwoHdmVyc2lvbhgGIAEoBRIQCghjb21wcmVzcxgHIAEoCCKQAQoJQ29tbW9uUnNwEg0KBWV2ZW50GAEgASgJEgwKBGRhdGEYAiABKAwSCgoCc24YAyABKAMSDAoEdGltZRgEIAEoAxINCgV2YWxpZBgFIAEoAxIMCgRjb2RlGAYgASgFEgwKBGRlc2MYByABKAkSDwoHdmVyc2lvbhgIIAEoBRIQCghjb21wcmVzcxgJIAEoCEJEChVjb20ucXVpY2sudm9pY2UucHJvdG9CCEJhc2VEYXRhWhVjb20ucXVpY2sudm9pY2UucHJvdG+6AglSb29tUHJvdG9iBnByb3RvMw`),Wl=I(Ul,0),Gl=I(Ul,1),Kl=Hr(`CglSdGMucHJvdG8SFWNvbS5xdWljay52b2ljZS5wcm90byJ8CghSdGNUcmFjaxIOCgZ1c2VySWQYASABKAkSCwoDbWlkGAIgASgJEhEKCXRyYWNrTmFtZRgDIAEoCRIuCgR0eXBlGAQgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZRIQCghpc0FjdGl2ZRgFIAEoCCJTChBVcGRhdGVUcmFja1N0YXRlEg4KBnJvb21JZBgBIAEoCRIvCgZ0cmFja3MYAiADKAsyHy5jb20ucXVpY2sudm9pY2UucHJvdG8uUnRjVHJhY2sisAEKDFJ0Y1N0YXRzRGF0YRIOCgZ1c2VySWQYASABKAkSEQoJc3RhdHNUaW1lGAIgASgDEhUKDXJvdW5kVHJpcFRpbWUYAyABKAESFgoOdXBRdWFsaXR5U2NvcmUYBCABKAESGAoQZG93blF1YWxpdHlTY29yZRgFIAEoARI0CgVzdGF0cxgGIAMoCzIlLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFja1N0YXRzRGF0YSKRAQoOVHJhY2tTdGF0c0RhdGESLgoEdHlwZRgBIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFja1R5cGUSEQoJYmFuZHdpZHRoGAIgASgBEg4KBmppdHRlchgDIAEoARITCgtwYWNrZXRzTG9zdBgEIAEoAxIXCg9wYWNrZXRzTG9zdFJhdGUYBSABKAEiVAoOUnRjU3RhdHNOb3RpZnkSDgoGcm9vbUlkGAEgASgJEjIKBXN0YXRzGAIgAygLMiMuY29tLnF1aWNrLnZvaWNlLnByb3RvLlJ0Y1N0YXRzRGF0YSovCghSdGNFdmVudBIVChFVcGRhdGVUcmFja0FjdGl2ZRAAEgwKCFJ0Y1N0YXRzEAFCQwoVY29tLnF1aWNrLnZvaWNlLnByb3RvQghSdGNQcm90b1oVY29tLnF1aWNrLnZvaWNlLnByb3RvugIIUnRjUHJvdG9iBnByb3RvMw`,[R]),ql=I(Kl,0),Jl=I(Kl,1),Yl=I(Kl,2),Xl=I(Kl,4),Z=(e,t)=>ir(e,Sn(e,t)),Zl=e=>{let{sn:t,event:n,time:r,compress:i,data:a,valid:o,version:s}=e,c;switch(n){case`heartbeat`:case`heartbeatEx`:c=Z(Di,a);break;case`ackMsg`:c=Z(Si,a);break;case`reportNetwork`:c=Z(Ei,a);break;case`connectCF`:c=Z(qr,a);break;case`genTurnAddress`:c=new Uint8Array;break;case`publish`:c=Z(Yr,a);break;case`joinRoom`:case`joinRoomEx`:c=Z(Wr,a);break;case`pubNotify`:c=Z(Zr,a);break;case`subscribe`:c=Z(Qr,a);break;case`pubChannel`:c=Z(vi,a);break;case`closeChannel`:case`subChannel`:c=Z(bi,a);break;case`renegotiate`:c=Z(ei,a);break;case`closeTrack`:c=Z(ui,a);break;case`preventUsersBehavior`:c=Z(mi,a);break;case`networkQualityChange`:c=Z(ii,a);break;case`updateCall`:c=Z(oi,a);break;case`toggleRoomSpeechLang`:c=Z(Ai,a);break;case`syncRoomInfo`:c=Z(si,a);break;case`offer`:c=Z(Ci,a);break;case`answer`:c=Z(Ci,a);break;case`candidate`:c=Z(Ti,a);break;case`reportP2PConnectEx`:c=Z(Mi,a);break;case`quitRoom`:case`quitRoomEx`:c=Z(ti,a);break;case`updateSimulcast`:c=Z(Qr,a);break;case`updateRoomToken`:c=Z(ri,a);break;case`UpdateTrackActive`:c=Z(Jl,a);break;case`RtcStats`:case`rtcStats`:c=Z(Yl,a);break;default:c=new Uint8Array;break}let l=c.byteLength,u=c.byteLength;return i===!0&&(c=Vl(c),u=c.byteLength),{res:Z(Wl,{event:n,data:c,sn:BigInt(t),compress:i,time:BigInt(r),valid:BigInt(o),version:s}),req:{...e,encBeforSize:l,encAfterSize:u}}},Ql=e=>{let t=L(Gl,new Uint8Array(e)),{code:n,sn:r,event:i,time:a,compress:o,valid:s,version:c,desc:l}=t,u=t.data,d=u.byteLength,f=u.byteLength,p;if(o)try{u=Hl(u),f=u.byteLength}catch(e){console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: 消息解压错误`,e)}switch(i){case`updateSeverTime`:p=L(li,u);break;case`connectCF`:p=L(Jr,u);break;case`genTurnAddress`:p=L(zi,u);break;case`publish`:p=L(Xr,u);break;case`joinRoom`:case`joinRoomEx`:p=L(Gr,u);break;case`subscribe`:p=L($r,u);break;case`pubChannel`:p=L(yi,u);break;case`closeChannel`:case`subChannel`:p=L(xi,u);break;case`closeTrack`:p=L(di,u);break;case`syncRoomInfo`:p=L(ci,u);break;case`onDataChannelPublish`:p=L(_i,u);break;case`onJoinRoom`:p=L(Kr,u);break;case`onJoinRoomBatch`:p=L(Ii,u);break;case`onPublish`:p=L(Zr,u);break;case`onCloseTrack`:p=L(fi,u);break;case`onTrackInactive`:p=L(Oi,u);break;case`onUpdateCall`:p=L(oi,u);break;case`onRoomActionChange`:p=L(Pi,u);break;case`onMeetSpecialRolesChange`:p=L(Fi,u);break;case`onUpdatePermissions`:p=L(pi,u);break;case`onUpdatePermissionsBatch`:p=L(Ri,u);break;case`onNetQuality`:p=L(ai,u);break;case`onCDNPlayUrlAdd`:p=L(gi,u);break;case`onUpdateBehavior`:p=L(hi,u);break;case`onRoomUserSpeech`:p=L(ki,u);break;case`onAttemptP2PEx`:p=L(ji,u);break;case`onOffer`:p=L(Ci,u);break;case`onAnswer`:p=L(Ci,u);break;case`onCandidate`:p=L(Ti,u);break;case`onDisconnectedP2P`:p=L(Ni,u);break;case`onQuitRoom`:p=L(ni,u);break;case`onQuitRoomBatch`:p=L(Li,u);break;case`onDestroyRoom`:p=L(ni,u);break;case`debugger`:case`ai`:p=JSON.parse(new TextDecoder().decode(u));break;case`UpdateTrackActive`:p=L(Jl,u);break;case`RtcStats`:p=L(Yl,u);break;case`onRtcStats`:p=L(Xl,u);break;default:p={};break}let m=e=>{if(e){if(Array.isArray(e)){for(let t of e)m(t);return}if(typeof e==`object`){delete e.$typeName;let t=Object.keys(e);for(let n of t){let t=e[n];typeof t==`object`&&m(t)}}}};return m(p),{res:{event:i,data:p,sn:Number(r),time:Number(a),decBeforSize:d,decAfterSize:f,code:n,desc:l,compress:o,valid:Number(s),version:c},req:e}},$l=class e{config;users;prResolves=new Zi;pc=new RTCPeerConnection;initTime=0;transceiverMap=new Map;broadcasted={mc_audio:!1,mc_video:!1,ss_video:!1,ss_audio:!1};iceConnectionTimer=0;simulcast=`f`;turnExpiresAtMs;channels=new Map;_channelDebug=!1;on={};waitings={peerConnected:async()=>this.prResolves.add(`peerConnected`,()=>this.pc.connectionState===`connected`)};constructor({config:e,users:t}){this.config=e,this.users=t}static rtcConfigurationFromTurnRsp(e){let t=[{urls:`stun:stun.cloudflare.com:3478`}],n=e?.iceServers;return{iceServers:n&&n.length>0?n.map(e=>{let t=e.urls.length===1?{urls:e.urls[0]}:{urls:[...e.urls]};return e.username&&e.credential&&(t.username=e.username,t.credential=e.credential),t}):t,bundlePolicy:`max-bundle`,...e?.policy===Bi.Relay?{iceTransportPolicy:`relay`}:{}}}setBroadcasted=(e,t)=>{for(let n of e)this.broadcasted[n]=t};getNoBroadcasted=e=>e.filter(e=>this.broadcasted[e]===!1);getBroadcasted=e=>e.filter(e=>this.broadcasted[e]===!0);checkValid=()=>!(new Date().getTime()-this.initTime>=1e3*60*20||this.pc.connectionState!==`connected`);setRTCRtpSenderParameters=async(e,t=[])=>{try{for(let n of t){let t=this.transceiverMap.get(n);if(!t)continue;let{sender:r}=t,i=r.getParameters();await r.setParameters({...i,...e})}}catch(e){console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: setRTCRtpSenderParameters is error.`,e)}};init=async t=>{if(this.setBroadcasted(B,!1),t?.expiresAt!=null){let e=Number(t.expiresAt);this.turnExpiresAtMs=Number.isFinite(e)?e*1e3:void 0}else this.turnExpiresAtMs=void 0;let n=e.rtcConfigurationFromTurnRsp(t);this.pc=new RTCPeerConnection(n),this.pc.addTransceiver(`audio`,{direction:`sendonly`}),this.pc.addTransceiver(`video`,{direction:`sendonly`}),this.pc.createDataChannel(`scapegoat-channel`);let r=await this.pc.createOffer();await this.pc.setLocalDescription(r),this.pc.onconnectionstatechange=()=>{let e=this.pc?.connectionState;switch(e){case`connected`:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#00b60f;`,`------->quickvo: connectionState:${e}`),clearTimeout(this.iceConnectionTimer),this.prResolves.emit(`peerConnected`);break;case`disconnected`:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: connectionState:${e}`),this.iceConnectionTimer=window.setTimeout(this.close,1e3*15);break;case`failed`:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b60000;`,`------->quickvo: connectionState:${e}`);break;case`closed`:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b60000;`,`------->quickvo: connectionState:${e}`);break;default:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: connectionState:${e}`);break}this.on.state&&this.on.state(e)},this.initTime=new Date().getTime(),this.transceiverMap=new Map};setTurnConfiguration=t=>{if(this.pc.signalingState===`closed`)return;if(t?.expiresAt!=null){let e=Number(t.expiresAt);this.turnExpiresAtMs=Number(e)*1e3}else this.turnExpiresAtMs=void 0;let n=e.rtcConfigurationFromTurnRsp(t);this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: setConfiguration (TURN refresh)`,n),this.pc.setConfiguration(n);try{this.pc.restartIce()}catch(e){this.config.debug&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: restartIce after setConfiguration failed`,e)}};localChannelSend=async e=>{this._channelDebug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->localChannelSend: data`,e);let{res:t}=Zl({event:`RtcStats`,time:Date.now(),sn:0,valid:30*1e3,compress:!1,version:1,data:e}),n=this.config.userId;this.channels.get(n)?.send(t)};addLocalUserChannel=e=>{if(e){let t=this.config.userId,n=this.pc.createDataChannel(`dc_${t}`,{negotiated:!0,id:e});this.channels.set(t,n)}};addRemoteUserChannel=(e,t)=>{let n=this.channels.get(e);if(this._channelDebug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: addRemoteUserChannel`,t,n),t){n&&n.close();let r=this.pc.createDataChannel(`dc_${e}`,{negotiated:!0,id:t});r.onmessage=t=>{let{res:n}=Ql(t.data);this._channelDebug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: remoteChannelSend [${n.data.userId}]`,n);let{event:r,data:i}=n;r===`RtcStatsData`&&this.users.getRemoteUserContent(e)?.setPeerRtcStats(i)},this.channels.set(e,r)}};clearChannels=e=>{let t=[],n=this.channels.keys();for(let r of n)if(e===void 0||e.includes(r)){let e=this.channels.get(r);if(!e)continue;let{label:n,id:i}=e;if(!i)continue;try{e.close()}catch{}t.push({userId:r,channels:[{id:i,dataChannelName:n}]}),this.channels.delete(r)}return t};close=()=>{this.setBroadcasted(B,!1),clearTimeout(this.iceConnectionTimer),this.transceiverMap=new Map,this.turnExpiresAtMs=void 0,this.clearChannels(),this.pc.close()};addSenders=async e=>{let t=[];for(let n of e){if(this.transceiverMap.get(n))continue;t.push(n);let e={direction:`sendonly`,sendEncodings:[{priority:n===`mc_audio`||n===`ss_audio`?`high`:`low`}]},[r]=this.users.localUser.getStream(n).getTracks(),i=this.pc.addTransceiver(r,e);[`mc_video`,`ss_video`].includes(n)&&i.setCodecPreferences(this.config.codecPreferences.video),this.transceiverMap.set(n,i)}if(t.length!==0){let e=await this.pc.createOffer();if(this.config.debug){let t=Xi.parse(e.sdp),n=D(t.media,[`mid`,`msid`,`type`]);console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ffffff;`,`------->quickvo: setLocalDescription`,{msidArr:n,sdpJson:t,description:e})}await this.pc.setLocalDescription(e)}let n=[];for(let e of t){let t=this.transceiverMap.get(e);if(!t)continue;let{mid:r,sender:i}=t,{track:a}=i;if(!a||!r)continue;let o=B.findIndex(t=>t===e),s={type:o,trackName:`WEB-${o}-${ne()}`,mid:r};n.push(s)}return this.users.localUser.updateTracks(n,!0),t};syncSenderStreamTrack=async e=>{for(let t of e){if(!this.hasSender(t))continue;let[e]=this.users.localUser.getStream(t).getTracks();await this.replaceSenderTrack(t,e)}};stopSenders=e=>{this.users.localUser.removeTracks(e),this.setBroadcasted(e,!1);for(let t of e){let e=this.transceiverMap.get(t);e&&(e.stop(),this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: stopSenders: ${e.mid} is stop.`,e),this.transceiverMap.delete(t))}this.users.localUser.removeTracks(e)};hasSender=e=>this.transceiverMap.has(e);replaceSenderTrack=async(e,t)=>{let n=this.transceiverMap.get(e);if(!n)throw Error(`ReplaceTrack is error. no have ${e} transceiver.`);let{sender:r}=n;await r.replaceTrack(t)};getTransceiver=e=>this.pc.getTransceivers().find(t=>t.mid===e);getSenderTrack=e=>this.transceiverMap.get(e)?.sender.track;getRecvierTrack=e=>this.pc.getTransceivers().find(t=>t.mid===e)?.receiver.track;stopReceivers=e=>{if(e.length===0)return;let t=Array.from(this.transceiverMap.values(),e=>e.mid),n=this.pc.getTransceivers();for(let r of n){let{mid:n,currentDirection:i}=r;i!==`inactive`&&i!==`stopped`&&(t.includes(n)||n&&e.includes(n)&&(r.receiver.track.stop(),r.stop(),this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: stopReceivers: ${n} is stop.`,r)))}};createOffer=async()=>{let e=await this.pc.createOffer();if(this.config.debug){let t=Xi.parse(e.sdp),n=D(t.media,[`mid`,`msid`,`type`]);console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ffffff;`,`------->quickvo: createOffer`,{msidArr:n,sdpJson:t,description:e})}await this.pc.setLocalDescription(e)};createAnswer=async()=>{let e=await this.pc.createAnswer();if(this.config.debug){let t=Xi.parse(e.sdp),n=D(t.media,[`mid`,`msid`,`type`]);console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ffffff;`,`------->quickvo: createAnswer`,{msidArr:n,sdpJson:t,description:e})}await this.pc.setLocalDescription(e)};getSdp=()=>this.pc.localDescription?.sdp||``;setRemoteDescription=async e=>{if(this.config.debug){let t=Xi.parse(e.sdp),n=D(t.media,[`mid`,`msid`,`type`]);console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ffffff;`,`------->quickvo: setRemoteDescription`,{msidArr:n,sdpJson:t,description:e})}return await this.pc.setRemoteDescription(e),e}},eu=class{types=[`outbound-rtp`,`remote-inbound-rtp`,`media-source`,`codec`];trackReport={bytesSent:0,offsetBytesSent:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,averageOffsetBytesSent:0,mimeType:`unknown`,payloadType:0,sdpFmtpLine:``,frameWidth:0,frameHeight:0,framesPerSecond:0,availableScore:0};transmittedPackets=0;transmittedPacketsLost=0;averageQualitys=[];averageOffsetBytesSents=[];isAvailable=[];availableScore=[];constructor(){}applyFromReports=e=>{try{if(e.length===0)throw Error(`empty reports`);let t={bytesSent:0,offsetBytesSent:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,averageOffsetBytesSent:0,mimeType:`unknown`,payloadType:0,sdpFmtpLine:``,frameWidth:0,frameHeight:0,framesPerSecond:0,availableScore:0},n=0,r=0;for(let i of e){let{type:e}=i;if(this.types.includes(e))switch(e){case`codec`:{let{mimeType:e,payloadType:n,sdpFmtpLine:r}=i;t.mimeType=e,t.payloadType=n,t.sdpFmtpLine=r}break;case`outbound-rtp`:{let{bytesSent:e,packetsSent:r,frameWidth:a=0,frameHeight:o=0,framesPerSecond:s=0}=i;n=r,t.bytesSent=e,t.frameWidth=a,t.frameHeight=o,t.framesPerSecond=s}break;case`remote-inbound-rtp`:{let{packetsLost:e=0,roundTripTime:n=0,jitter:a=0}=i;r=e,t.roundTripTime=Math.round(n*1e3),t.jitter=Math.round(a*1e3)}break}}if(r!==0){let e=n-this.transmittedPackets,i=r-this.transmittedPacketsLost,a=e+i;t.lostRate=a===0?0:Math.round(i/a*1e4)/1e4,this.transmittedPackets=n,this.transmittedPacketsLost=r}{let{lostRate:e,roundTripTime:n,jitter:r}=t;t.quality=p(e,n,r,!0),this.averageQualitys.unshift(t.quality),this.averageQualitys=this.averageQualitys.slice(0,10)}this.averageQualitys.length>=10&&(t.averageQuality=this.averageQualitys.length<10?0:Math.round(this.averageQualitys.reduce((e,t)=>e+t)/this.averageQualitys.length)),t.offsetBytesSent=Math.max(0,t.bytesSent-this.trackReport.bytesSent),this.averageOffsetBytesSents.unshift(t.offsetBytesSent),this.averageOffsetBytesSents=this.averageOffsetBytesSents.slice(0,5),t.averageOffsetBytesSent=this.averageOffsetBytesSents.length===0?0:Math.round(this.averageOffsetBytesSents.reduce((e,t)=>e+t)/this.averageOffsetBytesSents.length);{let{frameWidth:e,frameHeight:n,mimeType:r}=t;if(r){if(r.includes(`audio`))this.isAvailable.unshift(1);else if(e&&n){let r=Math.round(h(e,n)/3),i=+(t.offsetBytesSent>=r);this.isAvailable.unshift(i)}this.isAvailable=this.isAvailable.slice(0,10)}}{let e=this.isAvailable.length,n=0,r=[];for(let t=0;t<e;t++){let e=this.isAvailable[t]*m[t];n+=e,r.push(e)}this.availableScore=r,t.availableScore=Math.round(n*100)/100}this.trackReport=t}catch{this.clear()}return this.trackReport};generate=async(e,t)=>{try{if(t===void 0)throw Error(`Peer track is undefined.`);if(e.connectionState!==`connected`)throw Error(`Peer connectionState is ${e.connectionState}.`);let n=await e.getStats(t);return this.applyFromReports([...n.values()])}catch{return this.clear(),this.trackReport}};clear=()=>{this.trackReport={bytesSent:0,offsetBytesSent:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,averageOffsetBytesSent:0,mimeType:`unknown`,payloadType:0,sdpFmtpLine:``,frameWidth:0,frameHeight:0,framesPerSecond:0,availableScore:0},this.transmittedPackets=0,this.transmittedPacketsLost=0,this.averageQualitys=[],this.averageOffsetBytesSents=[],this.availableScore=[],this.isAvailable=[]}},tu=`data:text/javascript;base64,LyoqDQogKiDpnZnpn7Pml7bvvJrlnKjpopHln5/ku4Xkv53nlZkgYmluIDDvvZ4077yI6ZqP5py677yJ77yM5YW25L2Z5Li6IDDvvIzlho3lkIjmiJDml7bln5/lhpnlhaXovpPlh7og4oCUIOWNs+S/ruaUueecn+WuniBQQ03vvIznu48gQW5hbHlzZXIoZmZ0U2l6ZT01MTIpIOaXtuWJjSA1IOS4qiBiaW4g5pyJ6IO96YeP44CB5YW25L2Z5o6l6L+RIDDjgIINCiAqIFBFUklPRCDpobvkuI4gUHJBdWRpb1N0cmVhbSDkuK0gYW5hbHlzZXJOb2RlLmZmdFNpemUg5LiA6Ie044CCDQogKi8NCmNsYXNzIE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3NvciBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3NvciB7DQogIGlzRGVzdHJveSA9IGZhbHNlDQogIGRlYnVnID0gZmFsc2UNCg0KICBzdGF0aWMgU0lMRU5DRV9FUFMgPSAxZS0xNQ0KDQogIC8qKiDkuI4gc3JjL1ByQXVkaW9TdHJlYW0udHMg6YeMIGFuYWx5c2VyTm9kZS5mZnRTaXplIOS/neaMgeS4gOiHtCAqLw0KICBzdGF0aWMgUEVSSU9EID0gNTEyDQoNCiAgLyoqIGJpbiAw772eNCDpmo/mnLrlpI3mlbDvvIjlrp7pg6gv6Jma6YOo77yJ55qE5aSn6Ie05bmF5bqm5bC65bqm77yM5Y+v5oyJ5ZCs5oSfL+e8lueggeWGjeiwgyAqLw0KICBzdGF0aWMgQklOX1NDQUxFID0gMC4wMg0KDQogIGNvbnN0cnVjdG9yKCkgew0KICAgIHN1cGVyKCkNCiAgICB0aGlzLl9zaWxlbnRQY20gPSBuZXcgRmxvYXQzMkFycmF5KE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5QRVJJT0QpDQogICAgdGhpcy5fc2lsZW50T2ZmID0gTm90RW1wdHlGaWx0ZXJXb3JrbGV0UHJvY2Vzc29yLlBFUklPRA0KICB9DQoNCiAgc3RhdGljIGFsbElucHV0c1NpbGVudChpbnB1dHMpIHsNCiAgICBjb25zdCBlcHMgPSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuU0lMRU5DRV9FUFMNCiAgICBmb3IgKGxldCBuaSA9IDA7IG5pIDwgaW5wdXRzLmxlbmd0aDsgbmkrKykgew0KICAgICAgY29uc3QgaW5wdXQgPSBpbnB1dHNbbmldDQogICAgICBpZiAoIWlucHV0KSBjb250aW51ZQ0KICAgICAgZm9yIChsZXQgY2ggPSAwOyBjaCA8IGlucHV0Lmxlbmd0aDsgY2grKykgew0KICAgICAgICBjb25zdCBjaGFubmVsID0gaW5wdXRbY2hdDQogICAgICAgIGlmICghY2hhbm5lbCkgY29udGludWUNCiAgICAgICAgY29uc3QgbiA9IGNoYW5uZWwubGVuZ3RoDQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbjsgaSsrKSB7DQogICAgICAgICAgaWYgKE1hdGguYWJzKGNoYW5uZWxbaV0pID49IGVwcykgcmV0dXJuIGZhbHNlDQogICAgICAgIH0NCiAgICAgIH0NCiAgICB9DQogICAgcmV0dXJuIHRydWUNCiAgfQ0KDQogIC8qKg0KICAgKiDku4UgYmluIDAuLjQg6Z2e6Zu277yI6ZqP5py677yJ77yM5ruh6Laz5a6e5L+h5Y+3IElERlTvvIzlhpnlhaUgdGhpcy5fc2lsZW50UGNtDQogICAqLw0KICByZWZpbGxTaWxlbnRQY21Gcm9tRml2ZUJpbnMoKSB7DQogICAgY29uc3QgTiA9IE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5QRVJJT0QNCiAgICBjb25zdCBzY2FsZSA9IE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5CSU5fU0NBTEUNCiAgICBjb25zdCByZSA9IG5ldyBGbG9hdDY0QXJyYXkoNSkNCiAgICBjb25zdCBpbSA9IG5ldyBGbG9hdDY0QXJyYXkoNSkNCiAgICByZVswXSA9IChNYXRoLnJhbmRvbSgpICogMiAtIDEpICogc2NhbGUNCiAgICBpbVswXSA9IDANCiAgICBmb3IgKGxldCBrID0gMTsgayA8PSA0OyBrKyspIHsNCiAgICAgIHJlW2tdID0gKE1hdGgucmFuZG9tKCkgKiAyIC0gMSkgKiBzY2FsZQ0KICAgICAgaW1ba10gPSAoTWF0aC5yYW5kb20oKSAqIDIgLSAxKSAqIHNjYWxlDQogICAgfQ0KICAgIGNvbnN0IGludk4gPSAxIC8gTg0KICAgIGNvbnN0IHR3b1BpT3Zlck4gPSAoMiAqIE1hdGguUEkpIC8gTg0KICAgIGZvciAobGV0IG4gPSAwOyBuIDwgTjsgbisrKSB7DQogICAgICBsZXQgcyA9IHJlWzBdDQogICAgICBmb3IgKGxldCBrID0gMTsgayA8PSA0OyBrKyspIHsNCiAgICAgICAgY29uc3QgYW5nID0gdHdvUGlPdmVyTiAqIGsgKiBuDQogICAgICAgIHMgKz0gMiAqIChyZVtrXSAqIE1hdGguY29zKGFuZykgLSBpbVtrXSAqIE1hdGguc2luKGFuZykpDQogICAgICB9DQogICAgICB0aGlzLl9zaWxlbnRQY21bbl0gPSBzICogaW52Tg0KICAgIH0NCiAgICB0aGlzLl9zaWxlbnRPZmYgPSAwDQogIH0NCg0KICBmaWxsT3V0cHV0c1NwYXJzZUZpdmVCaW5zKG91dHB1dHMpIHsNCiAgICBjb25zdCBmaXJzdCA9IG91dHB1dHNbMF0NCiAgICBpZiAoIWZpcnN0IHx8ICFmaXJzdFswXSkgcmV0dXJuDQogICAgY29uc3QgZnJhbWVMZW4gPSBmaXJzdFswXS5sZW5ndGgNCg0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZnJhbWVMZW47IGkrKykgew0KICAgICAgaWYgKHRoaXMuX3NpbGVudE9mZiA+PSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuUEVSSU9EKSB7DQogICAgICAgIHRoaXMucmVmaWxsU2lsZW50UGNtRnJvbUZpdmVCaW5zKCkNCiAgICAgIH0NCiAgICAgIGNvbnN0IHYgPSB0aGlzLl9zaWxlbnRQY21bdGhpcy5fc2lsZW50T2ZmKytdDQogICAgICBmb3IgKGxldCBubyA9IDA7IG5vIDwgb3V0cHV0cy5sZW5ndGg7IG5vKyspIHsNCiAgICAgICAgY29uc3Qgb3V0UG9ydHMgPSBvdXRwdXRzW25vXQ0KICAgICAgICBpZiAoIW91dFBvcnRzKSBjb250aW51ZQ0KICAgICAgICBmb3IgKGxldCBjaCA9IDA7IGNoIDwgb3V0UG9ydHMubGVuZ3RoOyBjaCsrKSB7DQogICAgICAgICAgY29uc3QgY2hhbm5lbCA9IG91dFBvcnRzW2NoXQ0KICAgICAgICAgIGlmIChjaGFubmVsKSBjaGFubmVsW2ldID0gdg0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgc3RhdGljIGNvcHlJbnB1dHNUb091dHB1dHMoaW5wdXRzLCBvdXRwdXRzKSB7DQogICAgZm9yIChsZXQgbm8gPSAwOyBubyA8IG91dHB1dHMubGVuZ3RoOyBubysrKSB7DQogICAgICBjb25zdCBvdXRQb3J0cyA9IG91dHB1dHNbbm9dDQogICAgICBjb25zdCBpblBvcnRzID0gaW5wdXRzW25vXQ0KICAgICAgaWYgKCFvdXRQb3J0cykgY29udGludWUNCiAgICAgIGZvciAobGV0IGNoID0gMDsgY2ggPCBvdXRQb3J0cy5sZW5ndGg7IGNoKyspIHsNCiAgICAgICAgY29uc3Qgb3V0Q2ggPSBvdXRQb3J0c1tjaF0NCiAgICAgICAgaWYgKCFvdXRDaCkgY29udGludWUNCiAgICAgICAgY29uc3QgaW5DaCA9IGluUG9ydHMgJiYgaW5Qb3J0c1tjaF0NCiAgICAgICAgaWYgKGluQ2ggJiYgaW5DaC5sZW5ndGggPT09IG91dENoLmxlbmd0aCkgew0KICAgICAgICAgIG91dENoLnNldChpbkNoKQ0KICAgICAgICB9IGVsc2UgaWYgKGluQ2gpIHsNCiAgICAgICAgICBjb25zdCBuID0gTWF0aC5taW4oaW5DaC5sZW5ndGgsIG91dENoLmxlbmd0aCkNCiAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG47IGkrKykgb3V0Q2hbaV0gPSBpbkNoW2ldDQogICAgICAgICAgZm9yIChsZXQgaSA9IG47IGkgPCBvdXRDaC5sZW5ndGg7IGkrKykgb3V0Q2hbaV0gPSAwDQogICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgb3V0Q2guZmlsbCgwKQ0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMpIHsNCiAgICBpZiAodGhpcy5pc0Rlc3Ryb3kpIHJldHVybiBmYWxzZQ0KDQogICAgaWYgKHRoaXMuZGVidWcpIHsNCiAgICAgIGNvbnNvbGUubG9nKCdceDFiWzM4OzI7MDsxNTE7MjU1bSVjJXNceDFiWzBtJywgJ2NvbG9yOiMwMDk3ZmY7JywgJy0tLS0tLS0+QnJlYXRoZTogaW5wdXRzJywgaW5wdXRzKQ0KICAgIH0NCg0KICAgIGlmIChOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuYWxsSW5wdXRzU2lsZW50KGlucHV0cykpIHsNCiAgICAgIHRoaXMuZmlsbE91dHB1dHNTcGFyc2VGaXZlQmlucyhvdXRwdXRzKQ0KICAgIH0gZWxzZSB7DQogICAgICB0aGlzLl9zaWxlbnRPZmYgPSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuUEVSSU9EDQogICAgICBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuY29weUlucHV0c1RvT3V0cHV0cyhpbnB1dHMsIG91dHB1dHMpDQogICAgfQ0KDQogICAgcmV0dXJuIHRydWUNCiAgfQ0KDQogIGRlc3Ryb3koKSB7DQogICAgdGhpcy5pc0Rlc3Ryb3kgPSB0cnVlDQogIH0NCn0NCg0KcmVnaXN0ZXJQcm9jZXNzb3IoJ25vdC1lbXB0eS1maWx0ZXItcHJvY2Vzc29yJywgTm90RW1wdHlGaWx0ZXJXb3JrbGV0UHJvY2Vzc29yKQ0K`,nu=class{audioContext=new AudioContext;notEmptyFilterWorkletNode;constructor(){}createNotEmptyFilterWorkletNode=async e=>(this.destroy(),this.audioContext=e,await this.audioContext.audioWorklet.addModule(tu),this.notEmptyFilterWorkletNode=new AudioWorkletNode(this.audioContext,`not-empty-filter-processor`),this.notEmptyFilterWorkletNode);destroy=()=>{this.notEmptyFilterWorkletNode?.disconnect(),this.notEmptyFilterWorkletNode?.port.postMessage({type:`destroy`}),this.notEmptyFilterWorkletNode=void 0}},ru=class{inputStream=new MediaStream;outputStream=new MediaStream;inputGain=1;enhanceGain=1;bgsGain=1;bgmGain=1;outputGain=1;mixAudioMap=new Map;audioContext=new AudioContext;isExternalAudioContext=!1;sourceNode;inputGainNode;enhanceGainNode;bgsGainNode;bgmGainNode;rnnoiseNode;analyserNode;analyserArrayData;outputGainNode;destinationNode;denoise=!1;mute=!0;notEmpty=!1;rnnoiseWorklet;rnnoiseWorkletNode;notEmptyFilterWorklet=new nu;notEmptyFilterWorkletNode;filterStream=e=>e;constructor(e,t){this.inputStream=e,t&&(this.audioContext=t,this.isExternalAudioContext=!0),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;{let{sourceNode:e,inputGainNode:t,enhanceGainNode:n,bgsGainNode:r,bgmGainNode:i,analyserNode:a,outputGainNode:o,destinationNode:s}=this;e.connect(t),t.connect(n),n.connect(a),r.connect(a),i.connect(a),n.connect(s),r.connect(s),i.connect(s),o.connect(this.audioContext.destination)}this.audioContext.resume()}use=({rnnoise:e})=>{this.rnnoiseWorklet=new e.RnnoiseWorklet};_changeSource=()=>{this.sourceNode.disconnect(),this.sourceNode=this.audioContext.createMediaStreamSource(this.inputStream),this.sourceNode.connect(this.inputGainNode)};replaceTrack=e=>{let t=this.inputStream.getTracks();for(let e of t)this.inputStream.removeTrack(e);this.inputStream.addTrack(e),this._changeSource()};stop=()=>{{let e=this.inputStream.getTracks();for(let t of e)t.stop(),this.inputStream.removeTrack(t)}};pause=async e=>{let t=this.inputStream.getTracks();for(let n of t)n.enabled=!e};getStream=()=>this.filterStream(this.outputStream);setMute=(e=!0)=>{this.mute=e,this.analyserNode.disconnect(),e===!1&&this.analyserNode.connect(this.outputGainNode)};setDenoise=async(e=!0)=>{this.rnnoiseWorklet&&(this.inputGainNode.disconnect(),e?(this.rnnoiseWorkletNode=await this.rnnoiseWorklet.createRnnoiseWorkletNode(this.audioContext),this.inputGainNode.connect(this.rnnoiseWorkletNode),this.rnnoiseWorkletNode.connect(this.enhanceGainNode)):(this.inputGainNode.connect(this.enhanceGainNode),this.rnnoiseWorklet.destroy()),this.denoise=e)};setNotEmpty=async(e=!0)=>{this.notEmptyFilterWorklet&&(e?(this.notEmptyFilterWorkletNode=await this.notEmptyFilterWorklet.createNotEmptyFilterWorkletNode(this.audioContext),this.notEmptyFilterWorkletNode.connect(this.analyserNode),this.notEmptyFilterWorkletNode.connect(this.destinationNode)):(this.notEmptyFilterWorkletNode?.disconnect(),this.notEmptyFilterWorklet.destroy()),this.notEmpty=e)};setInputGain=e=>{this.inputGain=e,this.inputGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setEnhanceGain=async e=>{this.enhanceGain=e+1,this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain,this.audioContext.currentTime)};setBgsGain=e=>{this.bgsGain=e,this.bgsGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setBgmGain=e=>{this.bgmGain=e,this.bgmGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setOutputGain=e=>{this.outputGain=e,this.outputGainNode.gain.setValueAtTime(this.outputGain,this.audioContext.currentTime)};getVolume=()=>{let{analyserNode:e,analyserArrayData:t}=this;e.getByteFrequencyData(t);let n=0;for(let e=0;e<t.length;e++)n+=t[e];return Math.ceil(n/t.length)};mixAudio=(e,t=`bgm`)=>new Promise(async(n,r)=>{try{{let e=this.mixAudioMap.get(t);e&&e.stop()}let r=t===`bgs`?this.bgsGainNode:this.bgmGainNode,i=this.audioContext.createBufferSource();this.mixAudioMap.set(t,i),i.buffer=e,i.connect(r),i.onended=()=>{i.disconnect(r),this.mixAudioMap.delete(t),n(!0)},i.start(0)}catch(e){r(e)}});mixAudioStop=e=>{this.mixAudioMap.get(e)?.stop()};changeMix=(e,t)=>{let n=e===`bgs`?this.bgsGainNode:this.bgmGainNode;t?n.connect(this.destinationNode):n.disconnect(this.destinationNode)};destroy=async()=>{for(let e of this.mixAudioMap.values())e.stop(),e.disconnect();this.mixAudioMap.clear(),this.notEmptyFilterWorklet.destroy(),this.rnnoiseWorklet?.destroy(),this.notEmptyFilterWorkletNode=void 0,this.rnnoiseWorkletNode=void 0,this.sourceNode.disconnect(),this.inputGainNode.disconnect(),this.enhanceGainNode.disconnect(),this.bgsGainNode.disconnect(),this.bgmGainNode.disconnect(),this.analyserNode.disconnect(),this.outputGainNode.disconnect();for(let e of this.inputStream.getTracks())e.stop(),this.inputStream.removeTrack(e);for(let e of this.outputStream.getTracks())e.stop(),this.outputStream.removeTrack(e);this.notEmpty=!1,this.denoise=!1,this.mute=!0,!this.isExternalAudioContext&&this.audioContext.state!==`closed`&&await this.audioContext.close()}},iu=class{config;localMedias;id=``;isSelf=!1;isOwner=!1;isAdmin=!1;tracks={};channels=[];network={egress:0,ingress:0};callAction=0;permissions=1;behavior=0;streamControls={};streams={mc_audio:new MediaStream,mc_video:new MediaStream,ss_video:new MediaStream,ss_audio:new MediaStream};constructor({config:e,localMedias:t,notEmpty:n}){this.config=e,this.localMedias=t;for(let e of B)switch(e){case`mc_audio`:case`ss_audio`:{let t=new MediaStream,r=this.localMedias.getPhoneyStreamTrack(e);t.addTrack(r);let i=new ru(t,this.localMedias.audioContext);n&&i.setNotEmpty(!0),this.streamControls[e]=i,this.streams[e]=i.getStream()}break;default:{let t=new MediaStream,n=this.localMedias.getPhoneyStreamTrack(e);t.addTrack(n),this.streams[e]=t}break}}setMute=(e,t)=>{for(let n of e){let e=this.streamControls[n];e&&e.setMute(t)}};updateCallAction=e=>{this.callAction=e};updatePermissions=e=>{this.permissions=e};updateBehavior=e=>{this.behavior=e};updateNetwork=e=>{let{egress:t,ingress:n}=this.network,r=e.egress===t&&e.ingress===n;return r===!1&&(this.network=e),r};updateTracks=(e,t=!1)=>{let n=this.isSelf?`local`:`remote`;for(let r of e){let{type:e,trackName:i,mid:a}=r;if(e===void 0||i===void 0||a===void 0)continue;let o=B[e],s=this.tracks[o];t===!0||!s?this.tracks[o]={type:e,trackName:i,mid:a,location:n,mediaType:o,origin:`phoney`,enabled:!1,simulcast:`f`,msid:``}:i!==s.trackName&&(s.trackName=i,s.mid=a,s.origin=`phoney`,s.enabled=!1,s.msid=``)}};updateChannels=e=>{this.channels=e};getTrack=e=>this.tracks[e];getTracks=e=>{let t=[];for(let n of e){let e=this.tracks[n];e&&t.push(e)}return t};removeTracks=e=>{let t=[];for(let n of e){let e=this.tracks[n];e&&(t.push(e),delete this.tracks[n])}return t};getTracksMid=e=>{let t=[];for(let n of e){let e=this.tracks[n];e&&e.origin===`sfu`&&t.push(e.mid)}return t};replaceMediaStreamTrack=(e,t)=>{switch(e){case`mc_audio`:case`ss_audio`:this.streamControls[e]?.replaceTrack(t);break;default:{let n=this.streams[e],r=n.getTracks();for(let e of r)n.removeTrack(e);n.addTrack(t)}break}};getStream=e=>{let t=this.streams[e];if(!t)throw Error(`There is no mediaTrack of type streams[${JSON.stringify(e)}].`);return t};getStreams=()=>this.streams;getUserMediaStreamContext=e=>this.streamControls[e];usePhoneyStream=(e,t=!0)=>{for(let n of e){let e=this.getTrack(n);if(e&&(e.origin=`phoney`,e.msid=``,e.enabled=!1),t===!0){let e=this.localMedias.getPhoneyStreamTrack(n);this.replaceMediaStreamTrack(n,e)}}};getInfo=()=>{let{id:e,isOwner:t,isSelf:n,isAdmin:r,callAction:i,permissions:a,behavior:o,network:s}=this,c=[];for(let e of B){let t=this.tracks[e];t&&c.push({...t})}return{id:e,isOwner:t,isAdmin:r,isSelf:n,callAction:i,permissions:a,behavior:o,network:s,tracks:c}}};function au(e){return Array.from(e.values())}function ou(e){return e}function su(e,t){if(!t)return ou([]);let n=au(e),r=new Map(n.map(e=>[e.id,e])),i,a;for(let e of n)if(e.type===`media-source`&&e.trackIdentifier===t.id){a=e;break}if(a){for(let e of n)if(e.type===`outbound-rtp`&&e.mediaSourceId===a.id){i=e;break}}if(!i){for(let e of n)if(e.type===`outbound-rtp`&&(e.trackId===t.id||e.trackIdentifier===t.id)){i=e;break}}if(!i)return ou([]);let o=new Set([i.id]);a&&o.add(a.id);for(let e of n)e.type===`remote-inbound-rtp`&&e.localId===i.id&&o.add(e.id);let s=i.codecId;return s&&r.has(s)&&o.add(s),ou(n.filter(e=>o.has(e.id)))}function cu(e,t,n){let r=au(e),i=new Map(r.map(e=>[e.id,e])),a;if(t){for(let e of r)if(e.type===`inbound-rtp`&&(e.trackIdentifier===t.id||e.trackId===t.id)){a=e;break}}if(!a&&n!=null&&n!==``){for(let e of r)if(e.type===`inbound-rtp`&&e.mid===n){a=e;break}}if(!a)return ou([]);let o=new Set([a.id]),s=a.transportId;if(s){let e=!1;for(let t of r)if(t.type===`candidate-pair`&&t.transportId===s&&(t.nominated===!0||t.state===`succeeded`)){o.add(t.id),e=!0;break}if(!e){for(let e of r)if(e.type===`candidate-pair`&&e.transportId===s){o.add(e.id);break}}}let c=a.codecId;c&&i.has(c)&&o.add(c);for(let e of r)if(e.type===`remote-outbound-rtp`&&e.localId===a.id){o.add(e.id);break}return ou(r.filter(e=>o.has(e.id)))}var lu=class extends iu{published={mc_audio:!1,mc_video:!1,ss_video:!1,ss_audio:!1};tracksAnalysis={sfu:{sends:{mc_audio:new eu,mc_video:new eu,ss_video:new eu,ss_audio:new eu}}};constructor({config:e,localMedias:t}){super({config:e,localMedias:t,notEmpty:!0}),this.isSelf=!0}getTrackReports=e=>this.tracksAnalysis.sfu.sends[e].trackReport;generateTrackAnalysis=async(e,t)=>{if(e.pc.connectionState===`connected`)for(let n of B){let r=su(t,e.getSenderTrack(n)??null);this.tracksAnalysis.sfu.sends[n].applyFromReports(r)}};setPublished=(e,t)=>{for(let n of e)this.published[n]=t};setActiveNoise=(e,t)=>{this.getUserMediaStreamContext(e)?.setDenoise(t)};updateSelfCallAction=()=>{let e=``,t=e=>{let t=B[e];return this.tracks[t]?.origin===`local`?`1`:`0`};e=`${t(0)}${e}`,e=`${t(1)}${e}`,e=`${t(2)}${e}`,e=`${t(3)}${e}`;let n=parseInt(e,2);return this.updateCallAction(n),n};checkBanBehavior=e=>{let{behavior:t}=this,n=!1,r=y(t);for(let t of e)if(r[t]===!0){n=!0;break}return n};hasPermissions=e=>this.config.callType===1||this.isAdmin===!0?!0:v(this.permissions)[e];useLocalStream=e=>{for(let t of e){let e=this.localMedias.getLocalStreamTrack(t);e&&this.replaceMediaStreamTrack(t,e);let n=this.getTrack(t);n&&(n.origin=`local`,n.msid=``,n.enabled=!0)}};clear=()=>{this.tracks={},this.network={egress:0,ingress:0},this.isOwner=!1,this.isAdmin=!1,this.setPublished(B,!1)};destroy=()=>{for(let e of B)this.streamControls[e]?.destroy()}},uu=class{config;prResolves=new Zi;remoteUserId=``;pc;timer;channelLocal;channelRemote;channelRemoteList=[];icecandidates=[];isCandidateCollected=!1;transceiverSend=new Map;transceiverRecv=new Map;activeSend={};activeRecv={};on={};waitings={candidateCollected:()=>this.prResolves.add(`candidateCollected`,()=>this.isCandidateCollected),remoteChannelConnected:()=>this.prResolves.add(`remoteChannelConnected`,()=>this.channelRemote?.readyState===`open`),connected:()=>this.prResolves.add(`connected`,()=>this.pc?.connectionState===`connected`),setOffered:()=>this.prResolves.add(`setOffered`,()=>this.pc?.remoteDescription)};constructor({config:e,remoteUserId:t}){this.config=e,this.remoteUserId=t}remoteChannelSend=async e=>{if(await this.waitings.remoteChannelConnected(),this.config.debug&&this.channelRemote?.readyState!==`open`){console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [remoteChannelSend] RemoteChannel is error.`,{channelRemote:this.channelRemote});return}let{res:t}=Zl({event:`UpdateTrackActive`,data:{roomId:this.config.roomId,tracks:e},time:Date.now(),sn:0,valid:30*1e3,compress:!1,version:5});this.channelRemote?.send(t)};init=()=>{this._clear(),this.pc=new RTCPeerConnection({iceServers:[{urls:`stun:stun.cloudflare.com:3478`}]}),this.pc.addTransceiver(`audio`,{direction:`inactive`}),this.channelLocal=this.pc.createDataChannel(`Web_P2P_${this.config.userId}`,{}),this.channelLocal.onmessage=e=>{let{res:t}=Ql(e.data),{event:n,data:r}=t;if(n===`UpdateTrackActive`){let{tracks:e=[]}=r;for(let t of e){let{type:e,isActive:n=!1}=t,r=B[e];this.setSendTracksEnabled([r],n,`remote`)}}},this.pc.ondatachannel=e=>{this.channelRemote=e.channel,this.channelRemoteList.push(e.channel),this.channelRemote.onopen=()=>{this.prResolves.emit(`remoteChannelConnected`)},this.config.debug&&this.channelRemoteList.length>1&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: There are multiple channelRemote.`,this.channelRemoteList)},this.pc.onconnectionstatechange=()=>{let e=this.pc?.connectionState;switch(e){case`connected`:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#00b60f;`,`------->quickvo: [p2p.onconnectionstatechange] ${e} `,{remoteUserId:this.remoteUserId}),clearTimeout(this.timer),this.prResolves.emit(`connected`);break;case`failed`:case`disconnected`:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: [p2p.onconnectionstatechange] ${e} `,{remoteUserId:this.remoteUserId}),this.timer=setTimeout(()=>this.close(),20*1e3);break;case`closed`:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b60000;`,`------->quickvo: [p2p.onconnectionstatechange] ${e} `,{remoteUserId:this.remoteUserId}),this.destroy();break;default:this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: [p2p.onconnectionstatechange] ${e} `,{remoteUserId:this.remoteUserId});break}},this.pc.onicecandidate=e=>{e.candidate?this.icecandidates.push(e.candidate):this._markIceGatheringComplete()},this.pc.onicegatheringstatechange=()=>{this.pc?.iceGatheringState===`complete`&&this._markIceGatheringComplete()}};getSenderTrack=e=>this.transceiverSend.get(e)?.sender.track;getRecvierTrack=e=>this.transceiverRecv.get(e)?.receiver.track;syncRecvTracksEnabled=()=>{let e=[],t=[];for(let n of B)n.includes(`audio`)||(this.activeRecv[n]?e.push(n):t.push(n));e.length!==0&&this.setRecvTracksEnabled(e,!0),t.length!==0&&this.setRecvTracksEnabled(t,!1)};initSenders=(e=[],t=`sendrecv`)=>{let n=this.checkPeer(),r=[],i=n?.getTransceivers()||[];for(let e of B){let t=this.transceiverSend.get(e);t&&(i.find(e=>e.direction!==`stopped`&&e.mid===t?.mid)||this.transceiverSend.delete(e))}for(let n of e){let{mid:e,mediaType:a}=n,o=i?.find(t=>t.mid===e);if(!o)continue;o.direction=t;let s=this.transceiverSend.get(a);s&&s.mid===o.mid||(this.transceiverSend.set(a,o),r.push(a),t==`sendrecv`&&this.transceiverRecv.set(a,o))}return r};initRecvs=(e=[],t=`sendrecv`)=>{let n=this.checkPeer(),r=[],i=n?.getTransceivers()||[];for(let e of B){let t=this.transceiverRecv.get(e);t&&(i.find(e=>e.direction!==`stopped`&&e.mid===t?.mid)||this.transceiverRecv.delete(e))}for(let i of e){if(this.transceiverRecv.get(i))continue;let e;switch(i){case`mc_audio`:case`ss_audio`:e=`audio`;break;case`mc_video`:case`ss_video`:e=`video`;break}let a=n.addTransceiver(e,{direction:t});a.direction=t,[`mc_video`,`ss_video`].includes(i)&&a.setCodecPreferences(this.config.codecPreferences.video),this.transceiverRecv.set(i,a),r.push(i)}return r};hasRecvier=e=>this.transceiverRecv.has(e);hasSender=e=>this.transceiverSend.has(e);checkActive=()=>{if(!this.pc||this.pc.connectionState!==`connected`)return!1;let e=!1;for(let t of B)if(this.activeSend[t]){e=!0;break}for(let t of B)if(this.activeRecv[t]){e=!0;break}return e};replaceSenderTrack=async(e,t)=>{let n=this.transceiverSend.get(e);if(!n)return;let{sender:r}=n;await r.replaceTrack(t)};setSendTracksEnabled=(e=[],t,n)=>{this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color: ${t?`#00b60f`:`#b64900`};`,`------->quickvo: [p2p.setSendTracksEnabled] ${t} `,{origin:n,mediaTypes:e,remoteUserId:this.remoteUserId,time:M(new Date().getTime())});let r=[];for(let n of e)this.activeSend[n]=t===!0?new Date().getTime():void 0,r.push(n);return this.on.setSendTracksEnabled&&this.on.setSendTracksEnabled(e),r};setRecvTracksEnabled=(e=[],t)=>{this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color: ${t?`#00b60f`:`#b64900`};`,`------->quickvo: [p2p.setRecvTracksEnabled] ${t} `,{mediaTypes:e,remoteUserId:this.remoteUserId,time:M(new Date().getTime())});let n=[];for(let r of e)this.activeRecv[r]=t===!0?new Date().getTime():void 0,n.push(r);let r=this.getRecvUserTracksAsRtc(n);this.remoteChannelSend(r);let i=this.checkActive();return t===!1&&i===!1&&this.close(),n};setRTCRtpSenderParameters=async(e,t=[])=>{try{for(let n of t){let t=this.transceiverSend.get(n);if(!t)continue;let{sender:r}=t,i=r.getParameters();await r.setParameters({...i,...e})}}catch(e){console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: setRTCRtpSenderParameters is error.`,e)}};createOffer=async()=>{let e=this.checkPeer(),t=await e.createOffer();return t.sdp&&=t.sdp.replace(RegExp(`42e01f`,`g`),`42e034`),await e.setLocalDescription(t),t};setOffer=async e=>{let t=this.checkPeer();this._filterSdp(e),await t.setRemoteDescription(e),await this.prResolves.emit(`setOffered`)};createAnswer=async()=>{let e=this.checkPeer(),t=await e.createAnswer();return t.sdp&&=t.sdp.replace(RegExp(`42e01f`,`g`),`42e034`),await e.setLocalDescription(t),t};setAnswer=async e=>{let t=this.checkPeer();this._filterSdp(e),await t.setRemoteDescription(e)};getIcecandidates=async()=>(await this.waitings.candidateCollected(),this.icecandidates);addCandidates=async e=>{await this.waitings.setOffered();for(let t of e)t.candidate?.includes(`kcp`)||await this.pc?.addIceCandidate(t)};getSenderUserTracks=(e=[])=>{let t=[];for(let n of e){let e=this.transceiverSend.get(n);if(!e)continue;let{mid:r,sender:i}=e,{track:a}=i;if(!a)continue;let{id:o,enabled:s}=a,c=B.findIndex(e=>e===n),l={type:c,enabled:s,trackName:`web-${c}-${o}`,mid:r,mediaType:n};t.push(l)}return t};getRecvUserTracks=(e=[])=>{let t=[];for(let n of e){let e=this.transceiverRecv.get(n);if(!e)continue;let{mid:r,receiver:i}=e,{track:a}=i;if(!a)continue;let{id:o,enabled:s}=a,c=B.findIndex(e=>e===n),l=this.activeRecv[n],u={type:c,enabled:s,trackName:`web-${c}-${o}`,mid:r,mediaType:n,isActive:l};t.push(u)}return t};getRecvUserTracksAsRoomTrack=(e=[])=>{let t=[z.Microphone,z.Camera,z.Screen,z.SystemVoice],n=[];for(let r of e){let e=this.transceiverRecv.get(r);if(!e)continue;let{mid:i,receiver:a}=e,{track:o}=a;if(!o)continue;let{id:s,enabled:c}=o,l=B.findIndex(e=>e===r);l<0||l>=t.length||n.push(Sn(Ur,{mid:i??``,trackName:`web-${l}-${s}`,type:t[l],isValid:c}))}return n};getSenderUserTracksAsRoomTrack=(e=[])=>{let t=[z.Microphone,z.Camera,z.Screen,z.SystemVoice],n=[];for(let r of e){let e=this.transceiverSend.get(r);if(!e)continue;let{mid:i,sender:a}=e,{track:o}=a;if(!o)continue;let{id:s,enabled:c}=o,l=B.findIndex(e=>e===r);l<0||l>=t.length||n.push(Sn(Ur,{mid:i??``,trackName:`web-${l}-${s}`,type:t[l],isValid:c}))}return n};getRecvUserTracksAsRtc=(e=[])=>{let t=[z.Microphone,z.Camera,z.Screen,z.SystemVoice],n=[];for(let r of e){let e=this.transceiverRecv.get(r);if(!e)continue;let{mid:i,receiver:a}=e,{track:o}=a;if(!o)continue;let{id:s}=o,c=B.findIndex(e=>e===r);if(c<0||c>=t.length)continue;let l=this.activeRecv[r]!=null;n.push(Sn(ql,{userId:this.config.userId,mid:i??``,trackName:`web-${c}-${s}`,type:t[c],isActive:l}))}return n};checkReceActive=e=>this.activeRecv[e]||!1;getTrack=e=>this.transceiverRecv.get(e)?.receiver?.track;checkPeer=()=>{if(!this.pc)throw Error(`you need init pc.`);return this.pc};close=()=>{this.pc?.connectionState===`connected`&&this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [p2p.close]`,{remoteUserId:this.remoteUserId}),clearTimeout(this.timer);{let e=[...this.transceiverSend.values()];for(let t of e)t.currentDirection!==`stopped`&&t.stop();this.transceiverSend=new Map}{let e=[...this.transceiverRecv.values()];for(let t of e)t.currentDirection!==`stopped`&&t.stop();this.transceiverRecv=new Map}this.pc?.close(),this.on.close&&this.on.close()};destroy=async()=>{this.close(),this._clear()};_markIceGatheringComplete=()=>{this.isCandidateCollected||(this.isCandidateCollected=!0,this.prResolves.emit(`candidateCollected`))};_clear=()=>{this.icecandidates=[],this.isCandidateCollected=!1,this.channelLocal=void 0,this.channelRemote=void 0,this.channelRemoteList=[],this.activeSend={},this.activeRecv={},this.transceiverSend=new Map,this.transceiverRecv=new Map,this.pc=void 0};_filterSdp=e=>{let t=Xi.parse(e.sdp),{media:n=[]}=t;for(let e of n){let{candidates:t=[]}=e,n=[];for(let e of t)e.transport!==`kcp`&&n.push(e);e.candidates=n}e.sdp=Xi.write(t)}},du=[`remote-outbound-rtp`,`inbound-rtp`,`candidate-pair`,`media-source`,`codec`],fu=class{reports=[];trackReport={bytesSent:0,offsetBytesSent:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,averageOffsetBytesSent:0,mimeType:`unknown`,payloadType:0,sdpFmtpLine:``,frameWidth:0,frameHeight:0,framesPerSecond:0,availableScore:0};transmittedPackets=0;transmittedPacketsLost=0;averageQualitys=[];averageOffsetBytesSents=[];isAvailable=[];availableScore=[];constructor(){}applyFromReports=e=>{try{if(e.length===0)throw Error(`empty reports`);let t={bytesSent:0,offsetBytesSent:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,averageOffsetBytesSent:0,mimeType:`unknown`,payloadType:0,sdpFmtpLine:``,frameWidth:0,frameHeight:0,framesPerSecond:0,availableScore:0},n=0,r=0;for(let i of e){let{type:e}=i;if(du.includes(e))switch(e){case`codec`:{let{mimeType:e,payloadType:n,sdpFmtpLine:r}=i;t.mimeType=e,t.payloadType=n,t.sdpFmtpLine=r}break;case`remote-outbound-rtp`:break;case`inbound-rtp`:{let{bytesReceived:e,packetsReceived:a,packetsLost:o=0,jitter:s=0,frameWidth:c=0,frameHeight:l=0,framesPerSecond:u=0}=i;n=a,r=o,t.bytesSent=e,t.jitter=Math.round(s*1e3),t.frameWidth=c,t.frameHeight=l,t.framesPerSecond=u}break;case`candidate-pair`:{let{currentRoundTripTime:e=0}=i;t.roundTripTime=Math.round(e*1e3)}break}}if(n!==0&&r!==0){let e=n-this.transmittedPackets,i=r-this.transmittedPacketsLost,a=e+i;t.lostRate=a===0?0:Math.round(i/a*1e4)/1e4,this.transmittedPackets=n,this.transmittedPacketsLost=r}{let{lostRate:e,roundTripTime:n,jitter:r}=t;t.quality=p(e,n,r,!1),this.averageQualitys.unshift(t.quality),this.averageQualitys=this.averageQualitys.slice(0,10)}this.averageQualitys.length>=10&&(t.averageQuality=this.averageQualitys.length<10?0:Math.round(this.averageQualitys.reduce((e,t)=>e+t)/this.averageQualitys.length)),t.offsetBytesSent=Math.max(0,t.bytesSent-this.trackReport.bytesSent),this.averageOffsetBytesSents.unshift(t.offsetBytesSent),this.averageOffsetBytesSents=this.averageOffsetBytesSents.slice(0,5),t.averageOffsetBytesSent=this.averageOffsetBytesSents.length===0?0:Math.round(this.averageOffsetBytesSents.reduce((e,t)=>e+t)/this.averageOffsetBytesSents.length);{let{frameWidth:e,frameHeight:n,mimeType:r}=t;if(r){if(r.includes(`audio`))this.isAvailable.unshift(1);else if(e&&n){let r=Math.round(h(e,n)/3),i=+(t.offsetBytesSent>=r);this.isAvailable.unshift(i)}this.isAvailable=this.isAvailable.slice(0,10)}}{let e=this.isAvailable.length,n=0,r=[];for(let t=0;t<e;t++){let e=this.isAvailable[t]*m[t];n+=e,r.push(e)}this.availableScore=r,t.availableScore=Math.round(n*100)/100}this.trackReport=t}catch{this.clear()}return this.trackReport};blendDownlinkLostWithPeerUplink=e=>{if(e===void 0||Number.isNaN(e))return;let t=Math.min(this.trackReport.lostRate,e);this.trackReport.lostRate=t;let{roundTripTime:n,jitter:r}=this.trackReport;this.trackReport.quality=p(t,n,r),this.averageQualitys.unshift(this.trackReport.quality),this.averageQualitys=this.averageQualitys.slice(0,10),this.averageQualitys.length>=10&&(this.trackReport.averageQuality=Math.round(this.averageQualitys.reduce((e,t)=>e+t)/this.averageQualitys.length))};generate=async(e,t)=>{try{if(t===void 0)throw Error(`Peer track is undefined.`);if(e.connectionState!==`connected`)throw Error(`Peer connectionState is ${e.connectionState}.`);let n=await e.getStats(t);return this.applyFromReports([...n.values()])}catch{return this.clear(),this.trackReport}};clear=()=>{this.trackReport={bytesSent:0,offsetBytesSent:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,averageOffsetBytesSent:0,mimeType:`unknown`,payloadType:0,sdpFmtpLine:``,frameWidth:0,frameHeight:0,framesPerSecond:0,availableScore:0},this.transmittedPackets=0,this.transmittedPacketsLost=0,this.averageQualitys=[],this.averageOffsetBytesSents=[],this.availableScore=[],this.isAvailable=[]}},pu=class extends iu{subscribed={mc_audio:!1,mc_video:!1,ss_video:!1,ss_audio:!1};tracksAnalysis={sfu:{recvs:{mc_audio:new fu,mc_video:new fu,ss_video:new fu,ss_audio:new fu}},p2p:{sends:{mc_audio:new eu,mc_video:new eu,ss_video:new eu,ss_audio:new eu},recvs:{mc_audio:new fu,mc_video:new fu,ss_video:new fu,ss_audio:new fu}}};audioReceiver={mc_audio:new Audio,ss_audio:new Audio};p2p;peerRtcStats;constructor({config:e,localMedias:t}){super({config:e,localMedias:t,notEmpty:!1}),this.isSelf=!1}checkSubscribed=e=>{let t=[],n=[];for(let r of e){let e=this.tracks[r];if(e&&e.origin!==`phoney`){n.push(r);continue}t.push(r)}return{prohibited_mediaTypes:t,subscribed_mediaTypes:n}};setSubscribed=(e,t)=>{for(let n of e)this.subscribed[n]=t};setPeerRtcStats=e=>{e.userId===this.id&&(this.peerRtcStats=e)};getPeerUplinkLostRateForMediaType=e=>{let t=this.peerRtcStats?.stats;if(!t?.length)return;let n=Wi(e),r=t.find(e=>e.type===n);return r===void 0?void 0:r.packetsLostRate};getTrackReports=(e,t,n)=>{if(e===`sfu`)return this.tracksAnalysis.sfu.recvs[n].trackReport;if(e===`p2p`)return this.tracksAnalysis[e][t][n].trackReport};generateTrackAnalysis=async(e,t,n)=>{let{pc:r}=e;if(r.connectionState===`connected`)for(let r of B){let i=this.getTrack(r);if(i){let{mid:n}=i,a=cu(t,e.getRecvierTrack(n)??null,n),o=this.tracksAnalysis.sfu.recvs[r];o.applyFromReports(a),o.blendDownlinkLostWithPeerUplink(this.getPeerUplinkLostRateForMediaType(r))}if(!this.p2p?.pc||!n||this.p2p.pc.connectionState!==`connected`)continue;let a=this.p2p.getSenderTrack(r),o=this.p2p.getRecvierTrack(r);this.tracksAnalysis.p2p.sends[r].applyFromReports(su(n,a??null)),this.tracksAnalysis.p2p.recvs[r].applyFromReports(cu(n,o??null,null))}};useRemoteStream=(e,t,n)=>{for(let r of e){let e=this.getTrack(r);if(!e)continue;let i=t.getTransceiver(n);if(!i)continue;let{track:a}=i.receiver;if(e.origin=`sfu`,e.mid=n,e.msid=a.id,e.enabled=!0,this.replaceMediaStreamTrack(r,a),[`mc_audio`,`ss_audio`].includes(r)){let e=this.getUserMediaStreamContext(r);e?.setMute(!1);let t=e?.inputStream;if(!t)continue;let n=this.audioReceiver[r];if(!n)continue;n.srcObject=t}}};useRemoteP2PStream=e=>{for(let t of e){let e=this.p2p?.getTrack(t),n=this.getTrack(t);if(e&&n&&(this.replaceMediaStreamTrack(t,e),n.origin=`p2p`,n.msid=``,n.enabled=!0,[`mc_audio`,`ss_audio`].includes(t))){let e=this.getUserMediaStreamContext(t);e?.setMute(!1);let n=e?.inputStream;if(!n)continue;let r=this.audioReceiver[t];if(!r)continue;r.srcObject=n}}};clear=()=>{this.tracks={},this.network={egress:0,ingress:0},this.peerRtcStats=void 0,this.setSubscribed(B,!1),this.p2p?.destroy(),this.p2p=void 0,this.destroy()};destroy=()=>{for(let e of B)this.streamControls[e]?.destroy()}},mu=class{config;localMedias;notifys;localUser;remoteUsers=new Map;_emitUsersChangeTimer=0;constructor({config:e,localMedias:t,notifys:n}){this.config=e,this.localMedias=t,this.notifys=n,this.localUser=new lu({config:e,localMedias:t})}getLocalUserTrackReports=e=>this.localUser.getTrackReports(e);getRemoteUserTrackReports=(e,t,n,r)=>this.getRemoteUserContent(e)?.getTrackReports(t,n,r);getUserContent=e=>!e||e===this.config.userId?this.localUser:this.getRemoteUserContent(e);getRemoteUserContent=e=>this.remoteUsers.get(e);getUserAudioMediaStreamContext=(e,t)=>this.getUserContent(e)?.getUserMediaStreamContext(t);setInputVolume=(e,t,n)=>{this.getUserAudioMediaStreamContext(e,t)?.setInputGain(n)};setEnhanceGain=async(e,t,n)=>{this.getUserAudioMediaStreamContext(e,t)?.setEnhanceGain(n)};setSpeakerVolume=(e,t,n)=>{let r=this.getUserAudioMediaStreamContext(e,t);r?.setOutputGain(n);let i=n===0;r?.setMute(i)};getVolume=(e,t)=>this.getUserAudioMediaStreamContext(e,t)?.getVolume();playBgs=async(e,t,n)=>{let r=this.getUserContent(e);if(!r)throw Error(`This user is undefined.`);await r.streamControls[t]?.mixAudio(n,`bgs`)};playBgm=async(e,t,n)=>{let r=this.getUserContent(e);if(!r)throw Error(`This user is undefined.`);await r.streamControls[t]?.mixAudio(n,`bgm`)};changBgsMix=async(e,t,n)=>{let r=this.getUserContent(e);if(!r)throw Error(`This user is undefined.`);r.streamControls[t]?.changeMix(`bgs`,n)};changBgmMix=async(e,t,n)=>{let r=this.getUserContent(e);if(!r)throw Error(`This user is undefined.`);r.streamControls[t]?.changeMix(`bgm`,n)};stopBgs=async(e,t)=>{let n=this.getUserContent(e);if(!n)throw Error(`This user is undefined.`);n.streamControls[t]?.mixAudioStop(`bgs`)};stopBgm=async(e,t)=>{let n=this.getUserContent(e);if(!n)throw Error(`This user is undefined.`);n.streamControls[t]?.mixAudioStop(`bgm`)};setBgsGain=async(e,t,n)=>{let r=this.getUserContent(e);if(!r)throw Error(`This user is undefined.`);r.streamControls[t]?.setBgsGain(n)};setBgmGain=async(e,t,n)=>{let r=this.getUserContent(e);if(!r)throw Error(`This user is undefined.`);r.streamControls[t]?.setBgmGain(n)};getrP2PConnectedCount=()=>{let e=0,t=this.remoteUsers.values();for(let n of t)n.p2p&&(e+=n.p2p.transceiverSend.size);return e};addRemoteUsersSubscribed=(e=[])=>{if(e.length===0){let e=this.remoteUsers.values();for(let t of e)t.setSubscribed(B,!0)}else for(let t of e){let{userId:e,mediaTypes:n}=t;this.remoteUsers.get(e)?.setSubscribed(n,!0)}};removeRemoteUsersSubscribed=(e=[])=>{if(e.length===0){let e=this.remoteUsers.values();for(let t of e)t.setSubscribed(B,!1)}else for(let t of e){let{userId:e,mediaTypes:n}=t;this.remoteUsers.get(e)?.setSubscribed(n,!1)}};createRemoteUsersSubscribeData=(e=!1)=>{let t=[],n=this.remoteUsers.values();for(let r of n){let{id:n,tracks:i,subscribed:a}=r,o=[];for(let t of B){let n=i[t];if(!n||a[t]===!1||n.origin!==`phoney`)continue;let{type:r,trackName:s}=n;o.push({type:r,trackName:s,lastRetry:e})}o.length!==0&&t.push({id:n,tracks:o})}return t};createRemoteUsersCloseData=()=>{let e=[],t=this.remoteUsers.values();for(let n of t){let{id:t,tracks:r,subscribed:i}=n,a=[],o=[];for(let e of B){let n=r[e];n&&i[e]!==!0&&n.origin!==`phoney`&&(n.origin===`sfu`&&a.push({...n,userId:t}),n.origin===`p2p`&&o.push(e))}a.length===0&&o.length===0||e.push({userId:t,sfu_tracks:a,p2p_mediaTypes:o})}return e};emitUsersChange=(e=!1)=>{if(e===!0){let e=this.getUsersInfo();this.notifys.emit(`onRoomUsers`,{code:200,desc:`All users info is change.`,data:e})}else{clearTimeout(this._emitUsersChangeTimer);let e=()=>{let e=this.getUsersInfo();this.notifys.emit(`onRoomUsers`,{code:200,desc:`All users info is change.`,data:e})};this._emitUsersChangeTimer=setTimeout(()=>e(),500)}};getMaxVolumeUser=()=>{let e=[...this.remoteUsers.keys()];if(e.push(this.localUser.id),e.length===0)return;let t=[];for(let n of e){let e=this.getVolume(n,`mc_audio`);e&&t.push({id:n,volume:e})}return t=t.sort((e,t)=>e.volume-t.volume>0?-1:1),t[0]};getUserStream=(e,t)=>this.getUserContent(e)?.getStream(t);getUsersInfo=()=>{let e=[this.localUser.getInfo()],t=[...this.remoteUsers.values()];for(let n of t){let t=n.getInfo();e.push(t)}return e};getP2PState=()=>{let e={pull:[],push:[]};{let t=this.remoteUsers.values();for(let n of t){let{id:t,p2p:r}=n;if(!r)continue;let i=[],a=[];for(let e of B){let t=B.findIndex(t=>t===e);(r.activeSend[e]||!1)!==!1&&(i.push(t),(r.activeRecv[e]||!1)!==!1&&a.push(t))}i.length!==0&&e.push.push({userId:t,types:i}),a.length!==0&&e.pull.push({userId:t,types:a})}}return e};createRemoteUser=e=>{let{config:t,localMedias:n}=this,r=new pu({config:t,localMedias:n});return r.id=e,this.remoteUsers.set(e,r),r};checkRemoteUser=e=>this.remoteUsers.has(e);removeRemoteUser=e=>{this.remoteUsers.get(e)?.clear(),this.remoteUsers.delete(e)};detachRemoteUsersForQuit=e=>{let t=[],n=[],r=[];for(let i of e){let e=this.getRemoteUserContent(i);if(!e)continue;t.push(i);let a=e.removeTracks(B);for(let e of a){let{mid:t,msid:i}=e;i&&t&&(n.push(t),r.push(e))}this.removeRemoteUser(i)}return{removeUserIds:t,removeMids:n,removeTracks:r}};pruneRemoteUsersNotInServerList=e=>{let t=new Set(e),n=[];for(let e of[...this.remoteUsers.values()]){if(t.has(e.id))continue;let r=[];for(let t of B){let n=e.tracks[t];n&&n.msid&&r.push(n.mid)}n.push({mids:r}),e.clear(),this.remoteUsers.delete(e.id)}return n};updateUsersIsAdmin=(e=[])=>{this.localUser.isAdmin=e.includes(this.localUser.id);let t=this.remoteUsers.values();for(let n of t)n.isAdmin=e.includes(n.id)};initUsers=(e,t=!1)=>{for(let n of e){let{id:e,callAction:r=0,permissions:i=0,behavior:a=0,tracks:o,channelCache:s}=n;if(this.localUser.id===e)this.localUser.updateCallAction(r),this.localUser.updatePermissions(i),this.localUser.updateBehavior(a);else{let n=this.remoteUsers.get(e);n||=this.createRemoteUser(e),n.updateCallAction(r),n.updatePermissions(i),n.updateBehavior(a),n.updateTracks(o,t),n.updateChannels(s?.channels||[])}}};clearRemoteUsers=()=>{let e=[...this.remoteUsers.keys()];for(let t of e)this.remoteUsers.get(t)?.clear(),this.remoteUsers.delete(t)};createRemoteUserP2P=e=>{let t=this.getRemoteUserContent(e);if(!t)throw Error(`The remote user to be established does not exist.`);let n=new uu({config:this.config,remoteUserId:t.id});return n.on.setSendTracksEnabled=e=>{this.syncRemoteUserP2PSenderStreamTrack(e)},n.on.close=()=>{for(let e of B)t.tracksAnalysis.p2p.sends[e].clear(),t.tracksAnalysis.p2p.recvs[e].clear()},t.p2p=n,n};syncRemoteUserP2PSenderStreamTrack=async e=>{let t=this.remoteUsers.values();for(let n of t)for(let t of e)if(n.p2p&&n.p2p.hasSender(t))if(n.p2p.activeSend[t]){let e=this.localUser.getStream(t);if(!e)continue;let[r]=e.getTracks();await n.p2p.replaceSenderTrack(t,r)}else{let e=this.localMedias.getPhoneyStreamTrack(t);await n.p2p.replaceSenderTrack(t,e)}}},hu=Object.defineProperty,gu=e=>{throw TypeError(e)},_u=(e,t,n)=>t in e?hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vu=(e,t,n)=>_u(e,typeof t==`symbol`?t:t+``,n),yu=(e,t,n)=>t.has(e)||gu(`Cannot `+n),bu=(e,t,n)=>(yu(e,t,`read from private field`),n?n.call(e):t.get(e)),xu=(e,t,n)=>t.has(e)?gu(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Su=(e=0,t=1)=>{let n=Math.max(0,e),r=Math.random()*(Math.max(1,t)-n+1)+n;return parseInt(`${r}`,10)},Cu=(e=16,t=16)=>{let n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``),r=Math.min(n.length,t),i=Date.now().toString(r),a=i.split(``),o=Math.max(4,e-i.length);for(let e=0;e<o;e++){let e=n[Su(0,r-1)];a.push(e)}return a.join(``).toUpperCase()},wu=(e,t)=>{try{let n=Number(e);if(isNaN(n)){let t=new Date(`${e}`);if(`${t}`==`Invalid Date`)return 0;n=t.getTime()}if(t!==void 0){let e=new Date().getTimezoneOffset();n+=(e+t)*60*1e3}return n}catch(n){return console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;padding:16px 0;`,`------->timeStamp:err`,{_val:e,_offset:t,error:n}),0}},Tu={1:`1`,2:`2`,3:`3`,4:`4`,5:`5`,6:`6`,7:`7`,"01":`一`,"02":`二`,"03":`三`,"04":`四`,"05":`五`,"06":`六`,"07":`日`},Eu=e=>wu(e),Du=(e,t=`YYYY-MM-DD hh:mm:ss`,n={})=>{let{empty_str:r,offset:i}={empty_str:`-`,...n},a=wu(e,i);if(Number(e)!==0&&a===0)return r;let o=new Date(a),s=`${o.getFullYear()}`,c=`${o.getMonth()+1}`,l=`${[`1`,`2`,`3`].includes(c)?1:[`4`,`5`,`6`].includes(c)?2:[`7`,`8`,`9`].includes(c)?3:4}`,u=`${o.getDate()}`,d=`${o.getDay()===0?7:o.getDay()}`,f=`${o.getHours()}`,p=`${o.getMinutes()}`,m=`${o.getSeconds()}`,h=`${Math.ceil((a-Eu(`${s}/01/01 00:00:00`)+1)/864e5)}`,g=`${Math.ceil(((a-Eu(`${s}/01/01 00:00:00`))/864e5-Number(d))/7)+1}`,_=[{k:`Y+`,v:s},{k:`M+`,v:c},{k:`Q+`,v:l},{k:`D+`,v:u},{k:`W+`,v:d},{k:`h+`,v:f},{k:`m+`,v:p},{k:`s+`,v:m},{k:`d+`,v:h},{k:`w+`,v:g}],v;for(let{k:e,v:n}of _)if(v=RegExp(`(${e})`).exec(t),v){let e=v[1],r=n.padStart(e.length,`0`);e.includes(`W`)&&(r=Tu[r.slice(0,2)]),t=t.replace(e,r)}return t},Ou,ku=class{constructor(e=1e3,t=!1){vu(this,`_debug`,!1),vu(this,`_queue`,[]),vu(this,`_interval`,1e3),vu(this,`_now`,Date.now()),vu(this,`removeQueueItem`,(e=[])=>{for(let t of e){let e=this._queue.findIndex(e=>e.key===t);e!==-1&&(this._queue.splice(e,1),this._debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;padding:16px 0;`,`------->Breathe:移除事件`,t))}}),vu(this,`addQueueItem`,e=>{let{key:t=Cu(),execution_time:n=this._now,interval:r=1e4,func:i=()=>{}}=e;this.removeQueueItem([t]);let a=n+Number(r),o=this._queue.findIndex(e=>a>=e.execution_time);o=o===-1?this._queue.length:o;let s={key:t,execution_time:a,interval:r,func:i};return this._queue.splice(o,0,s),this._debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;padding:16px 0;`,`------->Breathe:插入事件`,t,`执行时间: ${Du(a)}`,`队列位置: ${o}`),t}),xu(this,Ou,()=>{this._now=Date.now();let e=this._queue.length;for(let t=e;t>0;t--){let e=this._queue[this._queue.length-1],{key:t,interval:n=0,execution_time:r=0,func:i}=e,a=Math.round((r-this._now)/1e3);if(!e){this._debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;padding:16px 0;`,`------->Breathe:`,`当前 无 任务`);break}if(this._debug){let t=Array.from(this._queue,e=>e.execution_time),n=Array.from(this._queue,e=>e.execution_time).sort((e,t)=>t-e),i=Array.from(this._queue,e=>e.key);console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;padding:16px 0;`,`------->Breathe:队列keys`,JSON.stringify(i)),JSON.stringify(t)!==JSON.stringify(n)&&console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;padding:16px 0;`,`------->Breathe:时间线${t.length}`,`异常`,JSON.stringify(t)),console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;padding:16px 0;`,`------->Breathe:`,`当前 有 任务`,`最近任务 ${Du(r)} 剩余${a}s`,`任务详情:${JSON.stringify(e)}`)}if(a>0)break;if(i(),n===0)return this.removeQueueItem([t]);this.addQueueItem(e)}}),vu(this,`startQueue`,()=>setInterval(bu(this,Ou),this._interval)),this._interval=e,this._debug=t}};Ou=new WeakMap;var Au={onNetQuality:`网络质量回调`,onRtcStats:`远端用户网络信息广播`,updateSeverTime:`服务端时间更新`,onDataChannelPublish:`用户房间DataChannel发布或变更`,onJoinRoom:`加入房间回调`,onJoinRoomBatch:`加入房间批量回调`,onQuitRoom:`退出房间回调`,onQuitRoomBatch:`退出房间批量回调`,onPublish:`监听到流发布`,onCloseTrack:`关闭轨道`,onUpdateCall:`更新通讯状态`,onTrackInactive:`通知轨道失效`,onRoomActionChange:`房间内的全体禁言状态发生变化`,onMeetSpecialRolesChange:`房间内的管理员发生变化`,onAttemptP2PEx:`建立P2P连接`,onOffer:`收到P2P-offer`,onAnswer:`收到P2P-answer`,onCandidate:`收到P2P候选信息-candidate`,onDisconnectedP2P:`断开P2P`,onUpdatePermissions:`更新推流权限通知`,onUpdatePermissionsBatch:`批量更新推流权限通知`,onBeforeTokenExpire:`Token即将过期`,onTokenExpired:`Token已过期`,onDestroyRoom:`销毁房间`,onUpdateBehavior:`行为允许权限变更`,onCDNPlayUrlAdd:`cdn播放地址变化`,onRoomUserSpeech:`用户讲话`},ju=O(Au),Mu=Object.keys(Au),Nu=Object.values(Au),Pu=class{binaryType=`blob`;debug=!1;url=``;ws;isReconnecting=!1;timeout=10*1e3;reconnectTimeout=40*1e3;activeTimeStamp=0;on={};getUrl=()=>``;_connectGen=0;constructor(){}connect=()=>{let e=++this._connectGen,t=new Date().getTime();this.url=this.getUrl(),this.debug&&console.log(`------->pr-ws: connecting.`,{url:this.url});let n,r=!1,i=e=>{r||(r=!0,clearTimeout(n),e())};return new Promise((r,a)=>{n=setTimeout(()=>{if(e!==this._connectGen){i(()=>a(`Connection timeout.`));return}this.ws?.close(),i(()=>a(`Connection timeout.`))},this.timeout),this._open().then(()=>i(()=>r(new Date().getTime()-t))).catch(e=>i(()=>{this.close(1e3,e instanceof Error?e.message:String(e)),a(e)}))})};reconnect=()=>this._reconnectAsync();_reconnectAsync=async()=>{let e=new Date().getTime();this.isReconnecting=!0,this.url=this.getUrl(),this.debug&&console.log(`------->pr-ws: reconnecting.`,{url:this.url});let t=!1,n=setTimeout(()=>{this.ws?.close(),t=!0,this.isReconnecting=!1},this.reconnectTimeout);try{for(;!t;)try{return await this._open(),clearTimeout(n),this.isReconnecting=!1,new Date().getTime()-e}catch{if(t)break;this.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-ws: Reconnect again in 5 seconds.`,{url:this.url}),await new Promise(e=>setTimeout(e,1e3*5))}throw`Reconnection timeout.`}finally{clearTimeout(n)}};send=e=>{if(!this.ws||this.ws.readyState!==1)throw Error(`Ws is not ready.`);this.ws.send(e)};close=(e=1e3,t=`Correctly close.`)=>{this._connectGen++,this.ws&&(this.ws.readyState===1&&(this.ws?.close(e,t),this.debug&&console.log(`------->pr-ws: closed.`,{code:e,reason:t,url:this.url})),this._clear())};_open=()=>new Promise((e,t)=>{this._clear(),this.ws=new WebSocket(this.url),this.ws.binaryType=this.binaryType,this.ws.onmessage=e=>{this.activeTimeStamp=new Date().getTime(),this.on.message&&e.data instanceof ArrayBuffer&&this.on.message(e.data)},this.ws.onopen=()=>{this.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-ws: onopen`,this),this.activeTimeStamp=new Date().getTime(),e(!0)},this.ws.onerror=e=>{this.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-ws: onerror`,e),t(e)},this.ws.onclose=e=>{this.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-ws: onclose`,e),this.isReconnecting===!1&&this.on.checkReconnect&&this.on.checkReconnect(e)}});_clear=()=>{this.ws&&=(this.ws.onmessage=()=>{},this.ws.onopen=()=>{},this.ws.onerror=()=>{},this.ws.onclose=()=>{},void 0)}},Fu=class{eventName;prws;message;needRetry=!0;sn=Number(ne(16,10));_resolve=e=>{};_reject=e=>{};sender;options={timeout:30*1e3,onBack:!0};timer=0;constructor(e,t,n={}){this.prws=t,n.timeout!==void 0&&n.timeout<=0&&(n.timeout=60*1e3),this.eventName=e,this.options={...this.options,...n}}resolve=e=>{if(this.options.onBack&&(e.sn!==this.message?.sn&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: Received a timeout response. ${this.message?.sn} !== ${e.sn}`,{current:this.message,response:e}),this.message&&this.message.time&&typeof e.time==`number`)){let t=e.time-this.message.time;t>=10*1e3&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: This request response is too long. ${ce(t)}`,{current:this.message,response:e})}this.needRetry=!1,clearTimeout(this.timer),this._resolve(e)};reject=e=>{this.needRetry=!1,clearTimeout(this.timer),this._reject(e)};retry=()=>{if(!this.message)throw Error(`[${this.eventName}]: Send needs to be called first.`);this.message.time=Date.now(),this.sendMsg()};send=e=>new Promise(async(t,n)=>{this._resolve=t,this._reject=n;let{data:r,compress:i=!1,version:a=5}=e,o=this.eventName,s=Date.now(),c=this.options.timeout;this.message={event:o,data:r,sn:this.sn,time:s,valid:c,compress:i,version:a},this.sendMsg()});sendMsg=()=>{if(this.prws.ws?.readyState===1){if(!this.message||!this.message.sn)return this.reject(`Message is undefined or Message.sn is undefined.`);if(this.sender&&this.sender(this.message),this.options.onBack===!0)this._createTimer();else{this.needRetry=!1;let{event:e,sn:t,compress:n,time:r,valid:i,version:a,data:o}=this.message;this._resolve({event:e,sn:t,code:200,desc:``,compress:n,time:r,valid:i,version:a,data:o})}}};_createTimer=()=>{this.timer=window.setTimeout(()=>{let e=Error(`[${this.eventName}]: Event is timeout.`);e.name=`timeout`,this._reject(e)},this.options.timeout)};destroy=()=>{clearTimeout(this.timer);let e=Error(`[${this.eventName}]: Event is destroy.`);e.name=`destroy`,this._reject(e)}},Iu=[`sdp`,`Sdp`,`remoteSdp`],Lu=[`id`,`userId`];function Ru(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>typeof e==`bigint`?String(e):typeof e==`object`&&e?Ru(e):e);let t={};for(let n of Object.keys(e)){let r=e[n];if(typeof r==`bigint`){t[n]=String(r);continue}if(Iu.includes(n))r=``;else if(Lu.includes(n)){let e=r==null?``:String(r);r=e.length>10?e.slice(0,3)+`****`+e.slice(-3):r}else typeof r==`object`&&r&&(r=Ru(r));t[n]=r}return t}var zu=`quickvo-sdk`,Bu=2,Vu=`call_logs`,Hu=`logs_main`,Uu=`logs_ignore`,Wu=null;function Gu(e){return e===`#quickvo.ignoreEvents`?Uu:Hu}function Ku(){return Wu||=new Promise((e,t)=>{let n=indexedDB.open(zu,Bu);n.onerror=()=>t(n.error??Error(`indexedDB.open failed`)),n.onsuccess=()=>e(n.result),n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Hu)||e.createObjectStore(Hu),e.objectStoreNames.contains(Uu)||e.createObjectStore(Uu)}}),Wu}function qu(e,t){return Ku().then(n=>new Promise((r,i)=>{if(!n.objectStoreNames.contains(e)){r(void 0);return}let a=n.transaction(e,`readonly`).objectStore(e).get(t);a.onsuccess=()=>r(a.result),a.onerror=()=>i(a.error)}))}function Ju(e){return Ku().then(t=>new Promise((n,r)=>{if(!t.objectStoreNames.contains(Vu)){n(void 0);return}let i=t.transaction(Vu,`readonly`).objectStore(Vu).get(e);i.onsuccess=()=>n(i.result),i.onerror=()=>r(i.error)}))}function Yu(e,t,n){return Ku().then(r=>new Promise((i,a)=>{let o=r.transaction(e,`readwrite`);o.objectStore(e).put(n,t),o.oncomplete=()=>i(),o.onerror=()=>a(o.error??Error(`idb put failed`))}))}function Xu(e){try{let t=localStorage.getItem(e);if(t==null)return null;let n=JSON.parse(t);return Array.isArray(n)?n:null}catch{return null}}async function Zu(e){let t=Gu(e);try{let n=await qu(t,e);if(Array.isArray(n))return n}catch{}try{let n=await Ju(e);if(Array.isArray(n)){try{await Yu(t,e,n)}catch{}return n}}catch{}let n=Xu(e);if(n){try{await Yu(t,e,n),localStorage.removeItem(e)}catch{}return n}return[]}async function Qu(e,t){await Yu(Gu(e),e,t)}function $u(e){if(e==null)return e;if(typeof e==`bigint`)return String(e);if(typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>$u(e));if(e instanceof Uint8Array)return e.slice();let t={};for(let n of Object.keys(e))t[n]=$u(e[n]);return t}var ed='(function(){function e(e){let t=e.length;for(;--t>=0;)e[t]=0}let t=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),n=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=Array(288*2);e(a);let o=Array(60);e(o);let s=Array(512);e(s);let c=Array(256);e(c);let l=Array(29);e(l);let u=Array(30);e(u);function d(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let f,p,m;function h(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}let g=e=>e<256?s[e]:s[256+(e>>>7)],_=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},v=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,_(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},y=(e,t,n)=>{v(e,n[t*2],n[t*2+1])},b=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},x=e=>{e.bi_valid===16?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},S=(e,t)=>{let n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=15;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<573;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},C=(e,t,n)=>{let r=Array(16),i=0,a,o;for(a=1;a<=15;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=b(r[t]++,t))}},w=()=>{let e,i,h,g,_,v=Array(16);for(h=0,g=0;g<28;g++)for(l[g]=h,e=0;e<1<<t[g];e++)c[h++]=g;for(c[h-1]=g,_=0,g=0;g<16;g++)for(u[g]=_,e=0;e<1<<n[g];e++)s[_++]=g;for(_>>=7;g<30;g++)for(u[g]=_<<7,e=0;e<1<<n[g]-7;e++)s[256+ _++]=g;for(i=0;i<=15;i++)v[i]=0;for(e=0;e<=143;)a[e*2+1]=8,e++,v[8]++;for(;e<=255;)a[e*2+1]=9,e++,v[9]++;for(;e<=279;)a[e*2+1]=7,e++,v[7]++;for(;e<=287;)a[e*2+1]=8,e++,v[8]++;for(C(a,287,v),e=0;e<30;e++)o[e*2+1]=5,o[e*2]=b(e,5);f=new d(a,t,257,286,15),p=new d(o,n,0,30,15),m=new d([],r,0,19,7)},T=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[t*2]=0;for(t=0;t<30;t++)e.dyn_dtree[t*2]=0;for(t=0;t<19;t++)e.bl_tree[t*2]=0;e.dyn_ltree[256*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},E=e=>{e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},D=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]},O=(e,t,n)=>{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&D(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!D(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},ee=(e,r,i)=>{let a,o,s=0,d,f;if(e.sym_next!==0)do a=e.pending_buf[e.sym_buf+ s++]&255,a+=(e.pending_buf[e.sym_buf+ s++]&255)<<8,o=e.pending_buf[e.sym_buf+ s++],a===0?y(e,o,r):(d=c[o],y(e,d+256+1,r),f=t[d],f!==0&&(o-=l[d],v(e,o,f)),a--,d=g(a),y(e,d,i),f=n[d],f!==0&&(a-=u[d],v(e,a,f)));while(s<e.sym_next);y(e,256,r)},te=(e,t)=>{let n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=573,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)O(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],O(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,O(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],S(e,t),C(n,c,e.bl_count)},ne=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[34]++:e.bl_tree[36]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[32]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},re=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do y(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(y(e,17,e.bl_tree),v(e,s-3,3)):(y(e,18,e.bl_tree),v(e,s-11,7)):(a!==i&&(y(e,a,e.bl_tree),s--),y(e,16,e.bl_tree),v(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},ie=e=>{let t;for(ne(e,e.dyn_ltree,e.l_desc.max_code),ne(e,e.dyn_dtree,e.d_desc.max_code),te(e,e.bl_desc),t=18;t>=3&&e.bl_tree[i[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},ae=(e,t,n,r)=>{let a;for(v(e,t-257,5),v(e,n-1,5),v(e,r-4,4),a=0;a<r;a++)v(e,e.bl_tree[i[a]*2+1],3);re(e,e.dyn_ltree,t-1),re(e,e.dyn_dtree,n-1)},oe=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return 0;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return 1;for(n=32;n<256;n++)if(e.dyn_ltree[n*2]!==0)return 1;return 0},se=!1,ce=e=>{se||=(w(),!0),e.l_desc=new h(e.dyn_ltree,f),e.d_desc=new h(e.dyn_dtree,p),e.bl_desc=new h(e.bl_tree,m),e.bi_buf=0,e.bi_valid=0,T(e)},le=(e,t,n,r)=>{v(e,0+ +!!r,3),E(e),_(e,n),_(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var ue={_tr_init:ce,_tr_stored_block:le,_tr_flush_block:(e,t,n,r)=>{let i,s,c=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=oe(e)),te(e,e.l_desc),te(e,e.d_desc),c=ie(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&t!==-1?le(e,t,n,r):e.strategy===4||s===i?(v(e,2+ +!!r,3),ee(e,a,o)):(v(e,4+ +!!r,3),ae(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),ee(e,e.dyn_ltree,e.dyn_dtree)),T(e),r&&E(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+ e.sym_next++]=t,e.pending_buf[e.sym_buf+ e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+ e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(c[n]+256+1)*2]++,e.dyn_dtree[g(t)*2]++),e.sym_next===e.sym_end),_tr_align:e=>{v(e,2,3),y(e,256,a),x(e)}},de=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0};let fe=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var k=(e,t,n,r)=>{let i=fe,a=r+n;e^=-1;for(let n=r;n<a;n++)e=e>>>8^i[(e^t[n])&255];return e^-1},pe={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`},me={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};let{_tr_init:he,_tr_stored_block:ge,_tr_flush_block:_e,_tr_tally:A,_tr_align:ve}=ue,{Z_NO_FLUSH:ye,Z_PARTIAL_FLUSH:be,Z_FULL_FLUSH:xe,Z_FINISH:j,Z_BLOCK:Se,Z_OK:M,Z_STREAM_END:Ce,Z_STREAM_ERROR:N,Z_DATA_ERROR:we,Z_BUF_ERROR:Te,Z_DEFAULT_COMPRESSION:Ee,Z_FILTERED:De,Z_HUFFMAN_ONLY:Oe,Z_RLE:ke,Z_FIXED:Ae,Z_DEFAULT_STRATEGY:je,Z_UNKNOWN:Me,Z_DEFLATED:Ne}=me,Pe=(e,t)=>(e.msg=pe[t],t),Fe=e=>e*2-(e>4?9:0),P=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ie=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},F=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,I=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},L=(e,t)=>{_e(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,I(e.strm)},R=(e,t)=>{e.pending_buf[e.pending++]=t},Le=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Re=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=de(e.adler,t,i,n):e.state.wrap===2&&(e.adler=k(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},ze=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+258,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]!==m||l[i+o-1]!==p||l[i]!==l[r]||l[++i]!==l[r+1])continue;r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=258-(f-r),r=f-258,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead},Be=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-262)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ie(e),r+=t),e.strm.avail_in===0)break;if(n=Re(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=F(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=F(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&e.strm.avail_in!==0)},Ve=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&t!==j||t===ye||r!==i+e.strm.avail_in)))break;o=+(t===j&&r===i+e.strm.avail_in),ge(e,0,0,o),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,I(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(Re(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==ye&&t!==j&&e.strm.avail_in===0&&e.strstart===e.block_start?2:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Re(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===j)&&t!==ye&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=+(t===j&&e.strm.avail_in===0&&r===i),ge(e,e.block_start,r,o),e.block_start+=r,I(e.strm)),o?3:1)},He=(e,t)=>{let n,r;for(;;){if(e.lookahead<262){if(Be(e),e.lookahead<262&&t===ye)return 1;if(e.lookahead===0)break}if(n=0,e.lookahead>=3&&(e.ins_h=F(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-262&&(e.match_length=ze(e,n)),e.match_length>=3)if(r=A(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=F(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=F(e,e.ins_h,e.window[e.strstart+1]);else r=A(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(L(e,!1),e.strm.avail_out===0))return 1}return e.insert=e.strstart<2?e.strstart:2,t===j?(L(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(L(e,!1),e.strm.avail_out===0)?1:2},Ue=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<262){if(Be(e),e.lookahead<262&&t===ye)return 1;if(e.lookahead===0)break}if(n=0,e.lookahead>=3&&(e.ins_h=F(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-262&&(e.match_length=ze(e,n),e.match_length<=5&&(e.strategy===De||e.match_length===3&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=A(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=F(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(L(e,!1),e.strm.avail_out===0))return 1}else if(e.match_available){if(r=A(e,0,e.window[e.strstart-1]),r&&L(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=A(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<2?e.strstart:2,t===j?(L(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(L(e,!1),e.strm.avail_out===0)?1:2},We=(e,t)=>{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=258){if(Be(e),e.lookahead<=258&&t===ye)return 1;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+258;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=258-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=A(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=A(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(L(e,!1),e.strm.avail_out===0))return 1}return e.insert=0,t===j?(L(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(L(e,!1),e.strm.avail_out===0)?1:2},Ge=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Be(e),e.lookahead===0)){if(t===ye)return 1;break}if(e.match_length=0,n=A(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(L(e,!1),e.strm.avail_out===0))return 1}return e.insert=0,t===j?(L(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(L(e,!1),e.strm.avail_out===0)?1:2};function z(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}let Ke=[new z(0,0,0,0,Ve),new z(4,4,8,4,He),new z(4,5,16,8,He),new z(4,6,32,32,He),new z(4,4,16,16,Ue),new z(8,16,32,32,Ue),new z(8,16,128,128,Ue),new z(8,32,128,256,Ue),new z(32,128,258,1024,Ue),new z(32,258,258,4096,Ue)],qe=e=>{e.window_size=2*e.w_size,P(e.head),e.max_lazy_match=Ke[e.level].max_lazy,e.good_match=Ke[e.level].good_length,e.nice_match=Ke[e.level].nice_length,e.max_chain_length=Ke[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0};function Je(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ne,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(573*2),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),P(this.dyn_ltree),P(this.dyn_dtree),P(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),P(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),P(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let Ye=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.status!==42&&t.status!==57&&t.status!==69&&t.status!==73&&t.status!==91&&t.status!==103&&t.status!==113&&t.status!==666)},Xe=e=>{if(Ye(e))return Pe(e,N);e.total_in=e.total_out=0,e.data_type=Me;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?57:t.wrap?42:113,e.adler=t.wrap===2?0:1,t.last_flush=-2,he(t),M},Ze=e=>{let t=Xe(e);return t===M&&qe(e.state),t},Qe=(e,t)=>Ye(e)||e.state.wrap!==2?N:(e.state.gzhead=t,M),$e=(e,t,n,r,i,a)=>{if(!e)return N;let o=1;if(t===Ee&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>9||n!==Ne||r<8||r>15||t<0||t>9||a<0||a>Ae||r===8&&o!==1)return Pe(e,N);r===8&&(r=9);let s=new Je;return e.state=s,s.strm=e,s.status=42,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=t,s.strategy=a,s.method=n,Ze(e)};var et={deflateInit:(e,t)=>$e(e,t,Ne,15,8,je),deflateInit2:$e,deflateReset:Ze,deflateResetKeep:Xe,deflateSetHeader:Qe,deflate:(e,t)=>{if(Ye(e)||t>Se||t<0)return e?Pe(e,N):N;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===666&&t!==j)return Pe(e,e.avail_out===0?Te:N);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(I(e),e.avail_out===0)return n.last_flush=-1,M}else if(e.avail_in===0&&Fe(t)<=Fe(r)&&t!==j)return Pe(e,Te);if(n.status===666&&e.avail_in!==0)return Pe(e,Te);if(n.status===42&&n.wrap===0&&(n.status=113),n.status===42){let t=Ne+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=Oe||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=32),t+=31-t%31,Le(n,t),n.strstart!==0&&(Le(n,e.adler>>>16),Le(n,e.adler&65535)),e.adler=1,n.status=113,I(e),n.pending!==0)return n.last_flush=-1,M}if(n.status===57){if(e.adler=0,R(n,31),R(n,139),R(n,8),n.gzhead)R(n,+!!n.gzhead.text+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),R(n,n.gzhead.time&255),R(n,n.gzhead.time>>8&255),R(n,n.gzhead.time>>16&255),R(n,n.gzhead.time>>24&255),R(n,n.level===9?2:n.strategy>=Oe||n.level<2?4:0),R(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(R(n,n.gzhead.extra.length&255),R(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=k(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(R(n,0),R(n,0),R(n,0),R(n,0),R(n,0),R(n,n.level===9?2:n.strategy>=Oe||n.level<2?4:0),R(n,3),n.status=113,I(e),n.pending!==0)return n.last_flush=-1,M}if(n.status===69){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=k(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,I(e),n.pending!==0)return n.last_flush=-1,M;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=k(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(n.status===73){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=k(e.adler,n.pending_buf,n.pending-t,t)),I(e),n.pending!==0)return n.last_flush=-1,M;t=0}r=n.gzindex<n.gzhead.name.length?n.gzhead.name.charCodeAt(n.gzindex++)&255:0,R(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=k(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=91}if(n.status===91){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=k(e.adler,n.pending_buf,n.pending-t,t)),I(e),n.pending!==0)return n.last_flush=-1,M;t=0}r=n.gzindex<n.gzhead.comment.length?n.gzhead.comment.charCodeAt(n.gzindex++)&255:0,R(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=k(e.adler,n.pending_buf,n.pending-t,t))}n.status=103}if(n.status===103){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(I(e),n.pending!==0))return n.last_flush=-1,M;R(n,e.adler&255),R(n,e.adler>>8&255),e.adler=0}if(n.status=113,I(e),n.pending!==0)return n.last_flush=-1,M}if(e.avail_in!==0||n.lookahead!==0||t!==ye&&n.status!==666){let r=n.level===0?Ve(n,t):n.strategy===Oe?Ge(n,t):n.strategy===ke?We(n,t):Ke[n.level].func(n,t);if((r===3||r===4)&&(n.status=666),r===1||r===3)return e.avail_out===0&&(n.last_flush=-1),M;if(r===2&&(t===be?ve(n):t!==Se&&(ge(n,0,0,!1),t===xe&&(P(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),I(e),e.avail_out===0))return n.last_flush=-1,M}return t===j?n.wrap<=0?Ce:(n.wrap===2?(R(n,e.adler&255),R(n,e.adler>>8&255),R(n,e.adler>>16&255),R(n,e.adler>>24&255),R(n,e.total_in&255),R(n,e.total_in>>8&255),R(n,e.total_in>>16&255),R(n,e.total_in>>24&255)):(Le(n,e.adler>>>16),Le(n,e.adler&65535)),I(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending===0?Ce:M):M},deflateEnd:e=>{if(Ye(e))return N;let t=e.state.status;return e.state=null,t===113?Pe(e,we):M},deflateSetDictionary:(e,t)=>{let n=t.length;if(Ye(e))return N;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==42||r.lookahead)return N;if(i===1&&(e.adler=de(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(P(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Be(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do r.ins_h=F(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++;while(--t);r.strstart=e,r.lookahead=2,Be(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,M},deflateInfo:`pako deflate (from Nodeca project)`};let tt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var nt={assign:function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!=`object`)throw TypeError(n+`must be non-object`);for(let t in n)tt(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;let n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n}};let rt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{rt=!1}let it=new Uint8Array(256);for(let e=0;e<256;e++)it[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;it[254]=it[254]=1;var at=e=>{if(typeof TextEncoder==`function`&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,a,o=e.length,s=0;for(i=0;i<o;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),a=0,i=0;a<s;i++)n=e.charCodeAt(i),(n&64512)==55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)==56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t};let ot=(e,t)=>{if(t<65534&&e.subarray&&rt)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n=``;for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var st={string2buf:at,buf2string:(e,t)=>{let n=t||e.length;if(typeof TextDecoder==`function`&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i,a=Array(n*2);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){a[i++]=t;continue}let o=it[t];if(o>4){a[i++]=65533,r+=o-1;continue}for(t&=o===2?31:o===3?15:7;o>1&&r<n;)t=t<<6|e[r++]&63,o--;if(o>1){a[i++]=65533;continue}t<65536?a[i++]=t:(t-=65536,a[i++]=55296|t>>10&1023,a[i++]=56320|t&1023)}return ot(a,i)},utf8border:(e,t)=>{t||=e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+it[e[n]]>t?n:t}};function ct(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}var lt=ct;let ut=Object.prototype.toString,{Z_NO_FLUSH:dt,Z_SYNC_FLUSH:ft,Z_FULL_FLUSH:pt,Z_FINISH:mt,Z_OK:ht,Z_STREAM_END:gt,Z_DEFAULT_COMPRESSION:_t,Z_DEFAULT_STRATEGY:vt,Z_DEFLATED:yt}=me;function bt(e){this.options=nt.assign({level:_t,method:yt,chunkSize:16384,windowBits:15,memLevel:8,strategy:vt},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new lt,this.strm.avail_out=0;let n=et.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==ht)throw Error(pe[n]);if(t.header&&et.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e=typeof t.dictionary==`string`?st.string2buf(t.dictionary):ut.call(t.dictionary)===`[object ArrayBuffer]`?new Uint8Array(t.dictionary):t.dictionary,n=et.deflateSetDictionary(this.strm,e),n!==ht)throw Error(pe[n]);this._dict_set=!0}}bt.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=t===~~t?t:t===!0?mt:dt,typeof e==`string`?n.input=st.string2buf(e):ut.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===ft||a===pt)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=et.deflate(n,a),i===gt)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=et.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ht;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},bt.prototype.onData=function(e){this.chunks.push(e)},bt.prototype.onEnd=function(e){e===ht&&(this.result=nt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function xt(e,t){let n=new bt(t);if(n.push(e,!0),n.err)throw n.msg||pe[n.err];return n.result}function St(e,t){return t||={},t.raw=!0,xt(e,t)}function Ct(e,t){return t||={},t.gzip=!0,xt(e,t)}var wt={Deflate:bt,deflate:xt,deflateRaw:St,gzip:Ct,constants:me};let Tt=16209;var Et=function(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<<E.lenbits)-1,_=(1<<E.distbits)-1;top:do{p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=m[f&g];dolen:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p<y&&(f+=w[n++]<<p,p+=8),b+=f&(1<<y)-1,f>>>=y,p-=y),p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=h[f&_];dodist:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,p<y&&(f+=w[n++]<<p,p+=8,p<y&&(f+=w[n++]<<p,p+=8)),x+=f&(1<<y)-1,x>s){e.msg=`invalid distance too far back`,E.mode=Tt;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=Tt;break top}if(S=0,C=d,u===0){if(S+=c-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}else if(u<y){if(S+=c+u-y,y-=u,y<b){b-=y;do T[i++]=d[S++];while(--y);if(S=0,u<b){y=u,b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}}else if(S+=u-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}for(;b>2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=Tt;break top}else{v=h[(v&65535)+(f&(1<<y)-1)];continue dodist}break}}else if(!(y&64)){v=m[(v&65535)+(f&(1<<y)-1)];continue dolen}else if(y&32){E.mode=16191;break top}else{e.msg=`invalid literal/length code`,E.mode=Tt;break top}break}}while(n<r&&i<o);b=p>>3,n-=b,p-=b<<3,f&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?5+(r-n):5-(n-r),e.avail_out=i<o?257+(o-i):257-(i-o),E.hold=f,E.bits=p};let Dt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Ot=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),kt=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),At=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var jt=(e,t,n,r,i,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y,b,x,S,C,w=null,T,E=new Uint16Array(16),D=new Uint16Array(16),O=null,ee,te,ne;for(l=0;l<=15;l++)E[l]=0;for(u=0;u<r;u++)E[t[n+u]]++;for(p=c,f=15;f>=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d<f&&E[d]===0;d++);for(p<d&&(p=d),g=1,l=1;l<=15;l++)if(g<<=1,g-=E[l],g<0)return-1;if(g>0&&(e===0||f!==1))return-1;for(D[1]=0,l=1;l<15;l++)D[l+1]=D[l]+E[l];for(u=0;u<r;u++)t[n+u]!==0&&(o[D[t[n+u]]++]=u);if(e===0?(w=O=o,T=20):e===1?(w=Dt,O=Ot,T=257):(w=kt,O=At,T=0),v=0,u=0,l=d,C=a,m=p,h=0,x=-1,_=1<<p,S=_-1,e===1&&_>852||e===2&&_>592)return 1;for(;;){ee=l-h,o[u]+1<T?(te=0,ne=o[u]):o[u]>=T?(te=O[o[u]-T],ne=w[o[u]-T]):(te=96,ne=0),y=1<<l-h,b=1<<m,d=b;do b-=y,i[C+(v>>h)+b]=ee<<24|te<<16|ne|0;while(b!==0);for(y=1<<l-1;v&y;)y>>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[l]===0){if(l===f)break;l=t[n+o[u]]}if(l>p&&(v&S)!==x){for(h===0&&(h=p),C+=d,m=l-h,g=1<<m;m+h<f&&(g-=E[m+h],!(g<=0));)m++,g<<=1;if(_+=1<<m,e===1&&_>852||e===2&&_>592)return 1;x=v&S,i[x]=p<<24|m<<16|C-a|0}}return v!==0&&(i[C+v]=l-h<<24|4194304),s.bits=p,0};let{Z_FINISH:Mt,Z_BLOCK:Nt,Z_TREES:Pt,Z_OK:Ft,Z_STREAM_END:It,Z_NEED_DICT:Lt,Z_STREAM_ERROR:B,Z_DATA_ERROR:Rt,Z_MEM_ERROR:zt,Z_BUF_ERROR:Bt,Z_DEFLATED:Vt}=me,Ht=16180,Ut=16181,Wt=16182,Gt=16183,Kt=16184,qt=16185,Jt=16186,Yt=16187,Xt=16188,Zt=16189,Qt=16190,V=16191,$t=16192,en=16193,tn=16194,nn=16195,rn=16196,an=16197,on=16198,sn=16199,cn=16200,ln=16201,un=16202,dn=16203,fn=16204,pn=16205,mn=16206,hn=16207,gn=16208,H=16209,_n=16210,vn=16211,yn=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function bn(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let xn=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<Ht||t.mode>vn)},Sn=e=>{if(xn(e))return B;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=Ht,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ft},Cn=e=>{if(xn(e))return B;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Sn(e)},wn=(e,t)=>{let n;if(xn(e))return B;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?B:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Cn(e))},Tn=(e,t)=>{if(!e)return B;let n=new bn;e.state=n,n.strm=e,n.window=null,n.mode=Ht;let r=wn(e,t);return r!==Ft&&(e.state=null),r},En=e=>Tn(e,15),Dn=!0,On,kn,An=e=>{if(Dn){On=new Int32Array(512),kn=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(jt(1,e.lens,0,288,On,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;jt(2,e.lens,0,32,kn,0,e.work,{bits:5}),Dn=!1}e.lencode=On,e.lenbits=9,e.distcode=kn,e.distbits=5},jn=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0};var U={inflateReset:Cn,inflateReset2:wn,inflateResetKeep:Sn,inflateInit:En,inflateInit2:Tn,inflate:(e,t)=>{let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g=0,_,v,y,b,x,S,C,w,T=new Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(xn(e)||!e.output||!e.input&&e.avail_in!==0)return B;n=e.state,n.mode===V&&(n.mode=$t),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,f=c,w=Ft;inf_leave:for(;;)switch(n.mode){case Ht:if(n.wrap===0){n.mode=$t;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=k(n.check,T,2,0),l=0,u=0,n.mode=Ut;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=H;break}if((l&15)!==Vt){e.msg=`unknown compression method`,n.mode=H;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=H;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=l&512?Zt:V,l=0,u=0;break;case Ut:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==Vt){e.msg=`unknown compression method`,n.mode=H;break}if(n.flags&57344){e.msg=`unknown header flags set`,n.mode=H;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=k(n.check,T,2,0)),l=0,u=0,n.mode=Wt;case Wt:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=k(n.check,T,4,0)),l=0,u=0,n.mode=Gt;case Gt:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=k(n.check,T,2,0)),l=0,u=0,n.mode=Kt;case Kt:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=k(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=qt;case qt:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=k(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=Jt;case Jt:if(n.flags&2048){if(s===0)break inf_leave;p=0;do C=r[a+ p++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=k(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.name=null);n.length=0,n.mode=Yt;case Yt:if(n.flags&4096){if(s===0)break inf_leave;p=0;do C=r[a+ p++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=k(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.comment=null);n.mode=Xt;case Xt:if(n.flags&512){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){e.msg=`header crc mismatch`,n.mode=H;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=V;break;case Zt:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}e.adler=n.check=yn(l),l=0,u=0,n.mode=Qt;case Qt:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,Lt;e.adler=n.check=1,n.mode=V;case V:if(t===Nt||t===Pt)break inf_leave;case $t:if(n.last){l>>>=u&7,u-=u&7,n.mode=mn;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,--u,l&3){case 0:n.mode=en;break;case 1:if(An(n),n.mode=sn,t===Pt){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=rn;break;case 3:e.msg=`invalid block type`,n.mode=H}l>>>=2,u-=2;break;case en:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if((l&65535)!=(l>>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=H;break}if(n.length=l&65535,l=0,u=0,n.mode=tn,t===Pt)break inf_leave;case tn:n.mode=nn;case nn:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=V;break;case rn:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg=`too many length or distance symbols`,n.mode=H;break}n.have=0,n.mode=an;case an:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.lens[O[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},w=jt(0,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=H;break}n.have=0,n.mode=on;case on:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l>>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=H;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=11+(l&127),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=H;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===H)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=H;break}if(n.lenbits=9,E={bits:n.lenbits},w=jt(1,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=H;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=jt(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=H;break}if(n.mode=sn,t===Pt)break inf_leave;case sn:n.mode=cn;case cn:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,Et(e,f),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===V&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(v&&!(v&240)){for(b=_,x=v,S=y;g=n.lencode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=pn;break}if(v&32){n.back=-1,n.mode=V;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=H;break}n.extra=v&15,n.mode=ln;case ln:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=un;case un:for(;g=n.distcode[l&(1<<n.distbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(!(v&240)){for(b=_,x=v,S=y;g=n.distcode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=H;break}n.offset=y,n.extra=v&15,n.mode=dn;case dn:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=H;break}n.mode=fn;case fn:if(c===0)break inf_leave;if(p=f-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=H;break}p>n.wnext?(p-=n.wnext,m=n.wsize-p):m=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,m=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=h[m++];while(--p);n.length===0&&(n.mode=cn);break;case pn:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=cn;break;case mn:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?k(n.check,i,f,o-f):de(n.check,i,f,o-f)),f=c,n.wrap&4&&(n.flags?l:yn(l))!==n.check){e.msg=`incorrect data check`,n.mode=H;break}l=0,u=0}n.mode=hn;case hn:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){e.msg=`incorrect length check`,n.mode=H;break}l=0,u=0}n.mode=gn;case gn:w=It;break inf_leave;case H:w=Rt;break inf_leave;case _n:return zt;case vn:default:return B}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<H&&(n.mode<mn||t!==Mt))&&jn(e,e.output,e.next_out,f-e.avail_out),d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?k(n.check,i,f,e.next_out-f):de(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===V?128:0)+(n.mode===sn||n.mode===tn?256:0),(d===0&&f===0||t===Mt)&&w===Ft&&(w=Bt),w},inflateEnd:e=>{if(xn(e))return B;let t=e.state;return t.window&&=null,e.state=null,Ft},inflateGetHeader:(e,t)=>{if(xn(e))return B;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Ft):B},inflateSetDictionary:(e,t)=>{let n=t.length,r,i,a;return xn(e)||(r=e.state,r.wrap!==0&&r.mode!==Qt)?B:r.mode===Qt&&(i=1,i=de(i,t,n,0),i!==r.check)?Rt:(a=jn(e,t,n,n),a?(r.mode=_n,zt):(r.havedict=1,Ft))},inflateInfo:`pako inflate (from Nodeca project)`};function Mn(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}var Nn=Mn;let Pn=Object.prototype.toString,{Z_NO_FLUSH:Fn,Z_FINISH:In,Z_OK:Ln,Z_STREAM_END:Rn,Z_NEED_DICT:zn,Z_STREAM_ERROR:Bn,Z_DATA_ERROR:Vn,Z_MEM_ERROR:Hn}=me;function Un(e){this.options=nt.assign({chunkSize:1024*64,windowBits:15,to:``},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new lt,this.strm.avail_out=0;let n=U.inflateInit2(this.strm,t.windowBits);if(n!==Ln||(this.header=new Nn,U.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary==`string`?t.dictionary=st.string2buf(t.dictionary):Pn.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=U.inflateSetDictionary(this.strm,t.dictionary),n!==Ln))))throw Error(pe[n])}Un.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(o=t===~~t?t:t===!0?In:Fn,Pn.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=U.inflate(n,o),a===zn&&i&&(a=U.inflateSetDictionary(n,i),a===Ln?a=U.inflate(n,o):a===Vn&&(a=zn));n.avail_in>0&&a===Rn&&n.state.wrap>0&&e[n.next_in]!==0;)U.inflateReset(n),a=U.inflate(n,o);switch(a){case Bn:case Vn:case zn:case Hn:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===Rn))if(this.options.to===`string`){let e=st.utf8border(n.output,n.next_out),t=n.next_out-e,i=st.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===Ln&&s===0)){if(a===Rn)return a=U.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Un.prototype.onData=function(e){this.chunks.push(e)},Un.prototype.onEnd=function(e){e===Ln&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=nt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Wn(e,t){let n=new Un(t);if(n.push(e),n.err)throw n.msg||pe[n.err];return n.result}function Gn(e,t){return t||={},t.raw=!0,Wn(e,t)}var Kn={Inflate:Un,inflate:Wn,inflateRaw:Gn,ungzip:Wn,constants:me};let{Deflate:qn,deflate:Jn,deflateRaw:Yn,gzip:Xn}=wt,{Inflate:Zn,inflate:Qn,inflateRaw:$n,ungzip:er}=Kn;var tr={Deflate:qn,deflate:Jn,deflateRaw:Yn,gzip:Xn,Inflate:Zn,inflate:Qn,inflateRaw:$n,ungzip:er,constants:me};function nr(e){let t=tr.deflate(e,{gzip:!0});return new Uint8Array(t)}function rr(e){let t=tr.inflate(e,{gzip:!0});return new Uint8Array(t)}function ir(e,t){return typeof e==`object`&&e&&`$typeName`in e&&typeof e.$typeName==`string`?t===void 0?!0:t.typeName===e.$typeName:!1}var W;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(W||={});function ar(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}function or(e,t,n){for(let r=0;r<28;r+=7){let i=e>>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}let sr=4294967296;function cr(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(t,a){let o=Number(e.slice(t,a));i*=n,r=r*n+o,r>=sr&&(i+=r/sr|0,r%=sr)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?pr(r,i):fr(r,i)}function lr(e,t){let n=fr(e,t),r=n.hi&2147483648;r&&(n=pr(n.lo,n.hi));let i=ur(n.lo,n.hi);return r?`-`+i:i}function ur(e,t){if({lo:e,hi:t}=dr(e,t),t<=2097151)return String(sr*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+mr(o)+mr(a)}function dr(e,t){return{lo:e>>>0,hi:t>>>0}}function fr(e,t){return{lo:e|0,hi:t|0}}function pr(e,t){return t=~t,e?e=~e+1:t+=1,fr(e,t)}let mr=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function hr(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function gr(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}let G=_r();function _r(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||typeof process!=`object`||typeof process.env!=`object`||process.env.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`invalid int64: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),vr(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),yr(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),vr(e),cr(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),yr(e),cr(e)},dec(e,t){return lr(e,t)},uDec(e,t){return ur(e,t)}}}function vr(e){if(!/^-?[0-9]+$/.test(e))throw Error(`invalid int64: `+e)}function yr(e){if(!/^[0-9]+$/.test(e))throw Error(`invalid uint64: `+e)}function br(e,t){switch(e){case W.STRING:return``;case W.BOOL:return!1;case W.DOUBLE:case W.FLOAT:return 0;case W.INT64:case W.UINT64:case W.SFIXED64:case W.FIXED64:case W.SINT64:return t?`0`:G.zero;case W.BYTES:return new Uint8Array;default:return 0}}function xr(e,t){switch(e){case W.BOOL:return t===!1;case W.STRING:return t===``;case W.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}let K=Symbol.for(`reflect unsafe local`);function Sr(e,t){let n=e[t.localName].case;return n===void 0?n:t.fields.find(e=>e.localName===n)}function Cr(e,t){let n=t.localName;if(t.oneof)return e[t.oneof.localName].case===n;if(t.presence!=2)return e[n]!==void 0&&Object.prototype.hasOwnProperty.call(e,n);switch(t.fieldKind){case`list`:return e[n].length>0;case`map`:return Object.keys(e[n]).length>0;case`scalar`:return!xr(t.scalar,e[n]);case`enum`:return e[n]!==t.enum.values[0].number}throw Error(`message field with implicit presence`)}function wr(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0}function Tr(e,t){if(t.oneof){let n=e[t.oneof.localName];return n.case===t.localName?n.value:void 0}return e[t.localName]}function Er(e,t,n){t.oneof?e[t.oneof.localName]={case:t.localName,value:n}:e[t.localName]=n}function Dr(e,t){let n=t.localName;if(t.oneof){let r=t.oneof.localName;e[r].case===n&&(e[r]={case:void 0})}else if(t.presence!=2)delete e[n];else switch(t.fieldKind){case`map`:e[n]={};break;case`list`:e[n]=[];break;case`enum`:e[n]=t.enum.values[0].number;break;case`scalar`:e[n]=br(t.scalar,t.longAsString);break}}function Or(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function kr(e,t){if(Or(e)&&K in e&&`add`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.listKind==r.listKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function Ar(e,t){if(Or(e)&&K in e&&`has`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.mapKey===r.mapKey&&n.mapKind==r.mapKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function jr(e,t){return Or(e)&&K in e&&`desc`in e&&Or(e.desc)&&e.desc.kind===`message`&&(t===void 0||e.desc.typeName==t.typeName)}function Mr(e){return Pr(e.$typeName)}function Nr(e){let t=e.fields[0];return Pr(e.typeName)&&t!==void 0&&t.fieldKind==`scalar`&&t.name==`value`&&t.number==1}function Pr(e){return e.startsWith(`google.protobuf.`)&&[`DoubleValue`,`FloatValue`,`Int64Value`,`UInt64Value`,`Int32Value`,`UInt32Value`,`BoolValue`,`StringValue`,`BytesValue`].includes(e.substring(16))}function Fr(e,t){if(ir(t,e))return t;let n=Gr(e);return t!==void 0&&Ir(e,n,t),n}function Ir(e,t,n){for(let r of e.members){let e=n[r.localName];if(e==null)continue;let i;if(r.kind==`oneof`){let t=Sr(n,r);if(!t)continue;i=t,e=Tr(n,t)}else i=r;switch(i.fieldKind){case`message`:e=Br(i,e);break;case`scalar`:e=Lr(i,e);break;case`list`:e=zr(i,e);break;case`map`:e=Rr(i,e);break}Er(t,i,e)}return t}function Lr(e,t){return e.scalar==W.BYTES?Vr(t):t}function Rr(e,t){if(Or(t)){if(e.scalar==W.BYTES)return Hr(t,Vr);if(e.mapKind==`message`)return Hr(t,t=>Br(e,t))}return t}function zr(e,t){if(Array.isArray(t)){if(e.scalar==W.BYTES)return t.map(Vr);if(e.listKind==`message`)return t.map(t=>Br(e,t))}return t}function Br(e,t){if(e.fieldKind==`message`&&!e.oneof&&Nr(e.message))return Lr(e.message.fields[0],t);if(Or(t)){if(e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!==`google.protobuf.Value`)return t;if(!ir(t,e.message))return Fr(e.message,t)}return t}function Vr(e){return Array.isArray(e)?new Uint8Array(e):e}function Hr(e,t){let n={};for(let r of Object.entries(e))n[r[0]]=t(r[1]);return n}let Ur=Symbol(),Wr=new WeakMap;function Gr(e){let t;if(Kr(e)){let n=Wr.get(e),r,i;if(n)({prototype:r,members:i}=n);else{r={},i=new Set;for(let t of e.members)t.kind!=`oneof`&&(t.fieldKind!=`scalar`&&t.fieldKind!=`enum`||t.presence!=2&&(i.add(t),r[t.localName]=qr(t)));Wr.set(e,{prototype:r,members:i})}t=Object.create(r),t.$typeName=e.typeName;for(let n of e.members)i.has(n)||n.kind==`field`&&(n.fieldKind==`message`||(n.fieldKind==`scalar`||n.fieldKind==`enum`)&&n.presence!=2)||(t[n.localName]=qr(n))}else{t={$typeName:e.typeName};for(let n of e.members)(n.kind==`oneof`||n.presence==2)&&(t[n.localName]=qr(n))}return t}function Kr(e){switch(e.file.edition){case 999:return!1;case 998:return!0;default:return e.fields.some(e=>e.presence!=2&&e.fieldKind!=`message`&&!e.oneof)}}function qr(e){if(e.kind==`oneof`)return{case:void 0};if(e.fieldKind==`list`)return[];if(e.fieldKind==`map`)return{};if(e.fieldKind==`message`)return Ur;let t=e.getDefaultValue();return t===void 0?e.fieldKind==`scalar`?br(e.scalar,e.longAsString):e.enum.values[0].number:e.fieldKind==`scalar`&&e.longAsString?t.toString():t}var Jr=class extends Error{constructor(e,t,n=`FieldValueInvalidError`){super(t),this.name=n,this.field=()=>e}};let Yr=Symbol.for(`@bufbuild/protobuf/text-encoding`);function Xr(){if(globalThis[Yr]==null){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[Yr]={encodeUtf8(t){return e.encode(t)},decodeUtf8(e){return t.decode(e)},checkUtf8(e){try{return!0}catch{return!1}}}}return globalThis[Yr]}var q;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(q||={});var Zr=class{constructor(e=Xr().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(ei(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return $r(e),hr(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){ti(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){ei(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){$r(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return $r(e),e=(e<<1^e>>31)>>>0,hr(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=G.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=G.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=G.enc(e);return or(t.lo,t.hi,this.buf),this}sint64(e){let t=G.enc(e),n=t.hi>>31;return or(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=G.uEnc(e);return or(t.lo,t.hi,this.buf),this}},Qr=class{constructor(e,t=Xr().decodeUtf8){this.decodeUtf8=t,this.varint64=ar,this.uint32=gr,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case q.Varint:for(;this.buf[this.pos++]&128;);break;case q.Bit64:this.pos+=4;case q.Bit32:this.pos+=4;break;case q.LengthDelimited:let n=this.uint32();this.pos+=n;break;case q.StartGroup:for(;;){let[e,n]=this.tag();if(n===q.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return G.dec(...this.varint64())}uint64(){return G.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,G.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return G.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return G.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.decodeUtf8(this.bytes())}};function $r(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function ei(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function ti(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float32: `+e)}function ni(e,t){let n=e.fieldKind==`list`?kr(t,e):e.fieldKind==`map`?Ar(t,e):ai(e,t);if(n===!0)return;let r;switch(e.fieldKind){case`list`:r=`expected ${ui(e)}, got ${ci(t)}`;break;case`map`:r=`expected ${di(e)}, got ${ci(t)}`;break;default:r=si(e,t,n)}return new Jr(e,r)}function ri(e,t,n){let r=ai(e,n);if(r!==!0)return new Jr(e,`list item #${t+1}: ${si(e,n,r)}`)}function ii(e,t,n){let r=oi(t,e.mapKey);if(r!==!0)return new Jr(e,`invalid map key: ${si({scalar:e.mapKey},t,r)}`);let i=ai(e,n);if(i!==!0)return new Jr(e,`map entry ${ci(t)}: ${si(e,n,i)}`)}function ai(e,t){return e.scalar===void 0?e.enum===void 0?jr(t,e.message):e.enum.open?Number.isInteger(t):e.enum.values.some(e=>e.number===t):oi(t,e.scalar)}function oi(e,t){switch(t){case W.DOUBLE:return typeof e==`number`;case W.FLOAT:return typeof e==`number`?Number.isNaN(e)||!Number.isFinite(e)?!0:e>34028234663852886e22||e<-34028234663852886e22?`${e.toFixed()} out of range`:!0:!1;case W.INT32:case W.SFIXED32:case W.SINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>2147483647||e<-2147483648?`${e.toFixed()} out of range`:!0;case W.FIXED32:case W.UINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>4294967295||e<0?`${e.toFixed()} out of range`:!0;case W.BOOL:return typeof e==`boolean`;case W.STRING:return typeof e==`string`?Xr().checkUtf8(e)||`invalid UTF8`:!1;case W.BYTES:return e instanceof Uint8Array;case W.INT64:case W.SFIXED64:case W.SINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return G.parse(e),!0}catch{return`${e} out of range`}return!1;case W.FIXED64:case W.UINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return G.uParse(e),!0}catch{return`${e} out of range`}return!1}}function si(e,t,n){return n=typeof n==`string`?`: ${n}`:`, got ${ci(t)}`,e.scalar===void 0?e.enum===void 0?`expected ${li(e.message)}`+n:`expected ${e.enum.toString()}`+n:`expected ${fi(e.scalar)}`+n}function ci(e){switch(typeof e){case`object`:return e===null?`null`:e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:kr(e)?ui(e.field()):Ar(e)?di(e.field()):jr(e)?li(e.desc):ir(e)?`message ${e.$typeName}`:`object`;case`string`:return e.length>30?`string`:`"${e.split(`"`).join(`\\\\"`)}"`;case`boolean`:return String(e);case`number`:return String(e);case`bigint`:return String(e)+`n`;default:return typeof e}}function li(e){return`ReflectMessage (${e.typeName})`}function ui(e){switch(e.listKind){case`message`:return`ReflectList (${e.message.toString()})`;case`enum`:return`ReflectList (${e.enum.toString()})`;case`scalar`:return`ReflectList (${W[e.scalar]})`}}function di(e){switch(e.mapKind){case`message`:return`ReflectMap (${W[e.mapKey]}, ${e.message.toString()})`;case`enum`:return`ReflectMap (${W[e.mapKey]}, ${e.enum.toString()})`;case`scalar`:return`ReflectMap (${W[e.mapKey]}, ${W[e.scalar]})`}}function fi(e){switch(e){case W.STRING:return`string`;case W.BOOL:return`boolean`;case W.INT64:case W.SINT64:case W.SFIXED64:return`bigint (int64)`;case W.UINT64:case W.FIXED64:return`bigint (uint64)`;case W.BYTES:return`Uint8Array`;case W.DOUBLE:return`number (float64)`;case W.FLOAT:return`number (float32)`;case W.FIXED32:case W.UINT32:return`number (uint32)`;case W.INT32:case W.SFIXED32:case W.SINT32:return`number (int32)`}}function pi(e,t,n=!0){return new hi(e,t,n)}let mi=new WeakMap;var hi=class{get sortedFields(){let e=mi.get(this.desc);if(e)return e;let t=this.desc.fields.concat().sort((e,t)=>e.number-t.number);return mi.set(this.desc,t),t}constructor(e,t,n=!0){this.lists=new Map,this.maps=new Map,this.check=n,this.desc=e,this.message=this[K]=t??Fr(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||=new Map(this.desc.fields.map(e=>[e.number,e])),this._fieldsByNumber.get(e)}oneofCase(e){return gi(this.message,e),Sr(this.message,e)}isSet(e){return gi(this.message,e),Cr(this.message,e)}clear(e){gi(this.message,e),Dr(this.message,e)}get(e){gi(this.message,e);let t=Tr(this.message,e);switch(e.fieldKind){case`list`:let n=this.lists.get(e);return(!n||n[K]!==t)&&this.lists.set(e,n=new _i(e,t,this.check)),n;case`map`:let r=this.maps.get(e);return(!r||r[K]!==t)&&this.maps.set(e,r=new vi(e,t,this.check)),r;case`message`:return bi(e,t,this.check);case`scalar`:return t===void 0?br(e.scalar,!1):Di(e,t);case`enum`:return t??e.enum.values[0].number}}set(e,t){if(gi(this.message,e),this.check){let n=ni(e,t);if(n)throw n}let n;n=e.fieldKind==`message`?yi(e,t):Ar(t)||kr(t)?t[K]:Oi(e,t),Er(this.message,e,n)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function gi(e,t){if(t.parent.typeName!==e.$typeName)throw new Jr(t,`cannot use ${t.toString()} with message ${e.$typeName}`,`ForeignFieldError`)}var _i=class{field(){return this._field}get size(){return this._arr.length}constructor(e,t,n){this._field=e,this._arr=this[K]=t,this.check=n}get(e){let t=this._arr[e];return t===void 0?void 0:Si(this._field,t,this.check)}set(e,t){if(e<0||e>=this._arr.length)throw new Jr(this._field,`list item #${e+1}: out of range`);if(this.check){let n=ri(this._field,e,t);if(n)throw n}this._arr[e]=xi(this._field,t)}add(e){if(this.check){let t=ri(this._field,this._arr.length,e);if(t)throw t}this._arr.push(xi(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let e of this._arr)yield Si(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,Si(this._field,this._arr[e],this.check)]}},vi=class{constructor(e,t,n=!0){this.obj=this[K]=t??{},this.check=n,this._field=e}field(){return this._field}set(e,t){if(this.check){let n=ii(this._field,e,t);if(n)throw n}return this.obj[Ti(e)]=Ci(this._field,t),this}delete(e){let t=Ti(e),n=Object.prototype.hasOwnProperty.call(this.obj,t);return n&&delete this.obj[t],n}clear(){for(let e of Object.keys(this.obj))delete this.obj[e]}get(e){let t=this.obj[Ti(e)];return t!==void 0&&(t=wi(this._field,t,this.check)),t}has(e){return Object.prototype.hasOwnProperty.call(this.obj,Ti(e))}*keys(){for(let e of Object.keys(this.obj))yield Ei(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[Ei(e[0],this._field.mapKey),wi(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let e of Object.values(this.obj))yield wi(this._field,e,this.check)}forEach(e,t){for(let n of this.entries())e.call(t,n[1],n[0],this)}};function yi(e,t){return jr(t)?Mr(t.message)&&!e.oneof&&e.fieldKind==`message`?t.message.value:t.desc.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`?Ai(t.message):t.message:t}function bi(e,t,n){return t!==void 0&&(Nr(e.message)&&!e.oneof&&e.fieldKind==`message`?t={$typeName:e.message.typeName,value:Di(e.message.fields[0],t)}:e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`&&Or(t)&&(t=ki(t))),new hi(e.message,t,n)}function xi(e,t){return e.listKind==`message`?yi(e,t):Oi(e,t)}function Si(e,t,n){return e.listKind==`message`?bi(e,t,n):Di(e,t)}function Ci(e,t){return e.mapKind==`message`?yi(e,t):Oi(e,t)}function wi(e,t,n){return e.mapKind==`message`?bi(e,t,n):t}function Ti(e){return typeof e==`string`||typeof e==`number`?e:String(e)}function Ei(e,t){switch(t){case W.STRING:return e;case W.INT32:case W.FIXED32:case W.UINT32:case W.SFIXED32:case W.SINT32:{let t=Number.parseInt(e);if(Number.isFinite(t))return t;break}case W.BOOL:switch(e){case`true`:return!0;case`false`:return!1}break;case W.UINT64:case W.FIXED64:try{return G.uParse(e)}catch{}break;default:try{return G.parse(e)}catch{}break}return e}function Di(e,t){switch(e.scalar){case W.INT64:case W.SFIXED64:case W.SINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=G.parse(t));break;case W.FIXED64:case W.UINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=G.uParse(t));break}return t}function Oi(e,t){switch(e.scalar){case W.INT64:case W.SFIXED64:case W.SINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=G.parse(t));break;case W.FIXED64:case W.UINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=G.uParse(t));break}return t}function ki(e){let t={$typeName:`google.protobuf.Struct`,fields:{}};if(Or(e))for(let[n,r]of Object.entries(e))t.fields[n]=Mi(r);return t}function Ai(e){let t={};for(let[n,r]of Object.entries(e.fields))t[n]=ji(r);return t}function ji(e){switch(e.kind.case){case`structValue`:return Ai(e.kind.value);case`listValue`:return e.kind.value.values.map(ji);case`nullValue`:case void 0:return null;default:return e.kind.value}}function Mi(e){let t={$typeName:`google.protobuf.Value`,kind:{case:void 0}};switch(typeof e){case`number`:t.kind={case:`numberValue`,value:e};break;case`string`:t.kind={case:`stringValue`,value:e};break;case`boolean`:t.kind={case:`boolValue`,value:e};break;case`object`:if(e===null)t.kind={case:`nullValue`,value:0};else if(Array.isArray(e)){let n={$typeName:`google.protobuf.ListValue`,values:[]};if(Array.isArray(e))for(let t of e)n.values.push(Mi(t));t.kind={case:`listValue`,value:n}}else t.kind={case:`structValue`,value:ki(e)};break}return t}function Ni(e){let t=Ri(),n=e.length*3/4;e[e.length-2]==`=`?n-=2:e[e.length-1]==`=`&&--n;let r=new Uint8Array(n),i=0,a=0,o,s=0;for(let n=0;n<e.length;n++){if(o=t[e.charCodeAt(n)],o===void 0)switch(e[n]){case`=`:a=0;case`\n`:case`\\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string`)}switch(a){case 0:s=o,a=1;break;case 1:r[i++]=s<<2|(o&48)>>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0;break}}if(a==1)throw Error(`invalid base64 string`);return r.subarray(0,i)}let Pi,Fi,Ii;function Li(e){return Pi||(Pi=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),Fi=Pi.slice(0,-2).concat(`-`,`_`)),e==`url`?Fi:Pi}function Ri(){if(!Ii){Ii=[];let e=Li(`std`);for(let t=0;t<e.length;t++)Ii[e[t].charCodeAt(0)]=t;Ii[45]=e.indexOf(`+`),Ii[95]=e.indexOf(`/`)}return Ii}function zi(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i);break}}return n.join(``)}let Bi=new Set([`constructor`,`toString`,`toJSON`,`valueOf`]);function Vi(e){return Bi.has(e)?e+`$`:e}function Hi(e){for(let t of e.field)wr(t,`jsonName`)||(t.jsonName=zi(t.name));e.nestedType.forEach(Hi)}function Ui(e,t){let n=e.values.find(e=>e.name===t);if(!n)throw Error(`cannot parse ${e} default value: ${t}`);return n.number}function Wi(e,t){switch(e){case W.STRING:return t;case W.BYTES:{let n=Gi(t);if(n===!1)throw Error(`cannot parse ${W[e]} default value: ${t}`);return n}case W.INT64:case W.SFIXED64:case W.SINT64:return G.parse(t);case W.UINT64:case W.FIXED64:return G.uParse(t);case W.DOUBLE:case W.FLOAT:switch(t){case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;default:return parseFloat(t)}case W.BOOL:return t===`true`;case W.INT32:case W.UINT32:case W.SINT32:case W.FIXED32:case W.SFIXED32:return parseInt(t,10)}}function Gi(e){let t=[],n={tail:e,c:``,next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(e){if(this.tail.length>=e){let t=this.tail.substring(0,e);return this.tail=this.tail.substring(e),t}return!1}};for(;n.next();)switch(n.c){case`\\\\`:if(n.next())switch(n.c){case`\\\\`:t.push(n.c.charCodeAt(0));break;case`b`:t.push(8);break;case`f`:t.push(12);break;case`n`:t.push(10);break;case`r`:t.push(13);break;case`t`:t.push(9);break;case`v`:t.push(11);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let e=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(e+r,8);if(Number.isNaN(i))return!1;t.push(i);break}case`x`:{let e=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(e+r,16);if(Number.isNaN(i))return!1;t.push(i);break}case`u`:{let e=n.c,r=n.take(4);if(r===!1)return!1;let i=parseInt(e+r,16);if(Number.isNaN(i))return!1;let a=new Uint8Array(4);new DataView(a.buffer).setInt32(0,i,!0),t.push(a[0],a[1],a[2],a[3]);break}case`U`:{let e=n.c,r=n.take(8);if(r===!1)return!1;let i=G.uEnc(e+r),a=new Uint8Array(8),o=new DataView(a.buffer);o.setInt32(0,i.lo,!0),o.setInt32(4,i.hi,!0),t.push(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);break}}break;default:t.push(n.c.charCodeAt(0))}return new Uint8Array(t)}function*Ki(e){switch(e.kind){case`file`:for(let t of e.messages)yield t,yield*Ki(t);yield*e.enums,yield*e.services,yield*e.extensions;break;case`message`:for(let t of e.nestedMessages)yield t,yield*Ki(t);yield*e.nestedEnums,yield*e.nestedExtensions;break}}function qi(...e){let t=Ji();if(!e.length)return t;if(`$typeName`in e[0]&&e[0].$typeName==`google.protobuf.FileDescriptorSet`){for(let n of e[0].file)Xi(n,t);return t}if(`$typeName`in e[0]){let r=e[0],i=e[1],a=new Set;function n(e){let r=[];for(let n of e.dependency){if(t.getFile(n)!=null||a.has(n))continue;let o=i(n);if(!o)throw Error(`Unable to resolve ${n}, imported by ${e.name}`);`kind`in o?t.addFile(o,!1,!0):(a.add(o.name),r.push(o))}return r.concat(...r.map(n))}for(let e of[r,...n(r)].reverse())Xi(e,t)}else for(let n of e)for(let e of n.files)t.addFile(e);return t}function Ji(){let e=new Map,t=new Map,n=new Map;return{kind:`registry`,types:e,extendees:t,[Symbol.iterator](){return e.values()},get files(){return n.values()},addFile(e,t,r){if(n.set(e.proto.name,e),!t)for(let t of Ki(e))this.add(t);if(r)for(let n of e.dependencies)this.addFile(n,t,r)},add(n){if(n.kind==`extension`){let e=t.get(n.extendee.typeName);e||t.set(n.extendee.typeName,e=new Map),e.set(n.number,n)}e.set(n.typeName,n)},get(t){return e.get(t)},getFile(e){return n.get(e)},getMessage(t){let n=e.get(t);return n?.kind==`message`?n:void 0},getEnum(t){let n=e.get(t);return n?.kind==`enum`?n:void 0},getExtension(t){let n=e.get(t);return n?.kind==`extension`?n:void 0},getExtensionFor(e,n){return t.get(e.typeName)?.get(n)},getService(t){let n=e.get(t);return n?.kind==`service`?n:void 0}}}let Yi={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function Xi(e,t){let n={kind:`file`,proto:e,deprecated:e.options?.deprecated??!1,edition:aa(e),name:e.name.replace(/\\.proto$/,``),dependencies:oa(e,t),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${e.name}`}},r=new Map,i={get(e){return r.get(e)},add(e){Y(e.proto.options?.mapEntry===!0),r.set(e.typeName,e)}};for(let r of e.enumType)$i(r,n,void 0,t);for(let r of e.messageType)ea(r,n,void 0,t,i);for(let r of e.service)ta(r,n,t);Zi(n,t);for(let e of r.values())Qi(e,t,i);for(let e of n.messages)Qi(e,t,i),Zi(e,t);t.addFile(n,!0)}function Zi(e,t){switch(e.kind){case`file`:for(let n of e.proto.extension){let r=ia(n,e,t);e.extensions.push(r),t.add(r)}break;case`message`:for(let n of e.proto.extension){let r=ia(n,e,t);e.nestedExtensions.push(r),t.add(r)}for(let n of e.nestedMessages)Zi(n,t);break}}function Qi(e,t,n){let r=e.proto.oneofDecl.map(t=>ra(t,e)),i=new Set;for(let a of e.proto.field){let o=ua(a,r),s=ia(a,e,t,o,n);e.fields.push(s),e.field[s.localName]=s,o===void 0?e.members.push(s):(o.fields.push(s),i.has(o)||(i.add(o),e.members.push(o)))}for(let t of r.filter(e=>i.has(e)))e.oneofs.push(t);for(let r of e.nestedMessages)Qi(r,t,n)}function $i(e,t,n,r){let i=sa(e.name,e.value),a={kind:`enum`,proto:e,deprecated:e.options?.deprecated??!1,file:t,parent:n,open:!0,name:e.name,typeName:la(e,n,t),value:{},values:[],sharedPrefix:i,toString(){return`enum ${this.typeName}`}};a.open=ma(a),r.add(a);for(let t of e.value){let e=t.name;a.values.push(a.value[t.number]={kind:`enum_value`,proto:t,deprecated:t.options?.deprecated??!1,parent:a,name:e,localName:Vi(i==null?e:e.substring(i.length)),number:t.number,toString(){return`enum value ${a.typeName}.${e}`}})}(n?.nestedEnums??t.enums).push(a)}function ea(e,t,n,r,i){let a={kind:`message`,proto:e,deprecated:e.options?.deprecated??!1,file:t,parent:n,name:e.name,typeName:la(e,n,t),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};e.options?.mapEntry===!0?i.add(a):((n?.nestedMessages??t.messages).push(a),r.add(a));for(let n of e.enumType)$i(n,t,a,r);for(let n of e.nestedType)ea(n,t,a,r,i)}function ta(e,t,n){let r={kind:`service`,proto:e,deprecated:e.options?.deprecated??!1,file:t,name:e.name,typeName:la(e,void 0,t),methods:[],method:{},toString(){return`service ${this.typeName}`}};t.services.push(r),n.add(r);for(let t of e.method){let e=na(t,r,n);r.methods.push(e),r.method[e.localName]=e}}function na(e,t,n){let r;r=e.clientStreaming&&e.serverStreaming?`bidi_streaming`:e.clientStreaming?`client_streaming`:e.serverStreaming?`server_streaming`:`unary`;let i=n.getMessage(J(e.inputType)),a=n.getMessage(J(e.outputType));Y(i,`invalid MethodDescriptorProto: input_type ${e.inputType} not found`),Y(a,`invalid MethodDescriptorProto: output_type ${e.inputType} not found`);let o=e.name;return{kind:`rpc`,proto:e,deprecated:e.options?.deprecated??!1,parent:t,name:o,localName:Vi(o.length?Vi(o[0].toLowerCase()+o.substring(1)):o),methodKind:r,input:i,output:a,idempotency:e.options?.idempotencyLevel??0,toString(){return`rpc ${t.typeName}.${o}`}}}function ra(e,t){return{kind:`oneof`,proto:e,deprecated:!1,parent:t,fields:[],name:e.name,localName:Vi(zi(e.name)),toString(){return`oneof ${t.typeName}.${this.name}`}}}function ia(e,t,n,r,i){let a=i===void 0,o={kind:`field`,proto:e,deprecated:e.options?.deprecated??!1,name:e.name,number:e.number,scalar:void 0,message:void 0,enum:void 0,presence:da(e,r,a,t),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(a){let r=t.kind==`file`?t:t.file,i=t.kind==`file`?void 0:t,a=la(e,i,r);o.kind=`extension`,o.file=r,o.parent=i,o.oneof=void 0,o.typeName=a,o.jsonName=`[${a}]`,o.toString=()=>`extension ${a}`;let s=n.getMessage(J(e.extendee));Y(s,`invalid FieldDescriptorProto: extendee ${e.extendee} not found`),o.extendee=s}else{let n=t;Y(n.kind==`message`),o.parent=n,o.oneof=r,o.localName=r?zi(e.name):Vi(zi(e.name)),o.jsonName=e.jsonName,o.toString=()=>`field ${n.typeName}.${e.name}`}let s=e.label,c=e.type,l=e.options?.jstype;if(s===3){let r=c==11?i?.get(J(e.typeName)):void 0;if(r){o.fieldKind=`map`;let{key:e,value:t}=pa(r);return o.mapKey=e.scalar,o.mapKind=t.fieldKind,o.message=t.message,o.delimitedEncoding=!1,o.enum=t.enum,o.scalar=t.scalar,o}switch(o.fieldKind=`list`,c){case 11:case 10:o.listKind=`message`,o.message=n.getMessage(J(e.typeName)),Y(o.message),o.delimitedEncoding=ha(e,t);break;case 14:o.listKind=`enum`,o.enum=n.getEnum(J(e.typeName)),Y(o.enum);break;default:o.listKind=`scalar`,o.scalar=c,o.longAsString=l==1;break}return o.packed=fa(e,t),o}switch(c){case 11:case 10:o.fieldKind=`message`,o.message=n.getMessage(J(e.typeName)),Y(o.message,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),o.delimitedEncoding=ha(e,t),o.getDefaultValue=()=>void 0;break;case 14:{let t=n.getEnum(J(e.typeName));Y(t!==void 0,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),o.fieldKind=`enum`,o.enum=n.getEnum(J(e.typeName)),o.getDefaultValue=()=>wr(e,`defaultValue`)?Ui(t,e.defaultValue):void 0;break}default:o.fieldKind=`scalar`,o.scalar=c,o.longAsString=l==1,o.getDefaultValue=()=>wr(e,`defaultValue`)?Wi(c,e.defaultValue):void 0;break}return o}function aa(e){switch(e.syntax){case``:case`proto2`:return 998;case`proto3`:return 999;case`editions`:if(e.edition in Yi)return e.edition;throw Error(`${e.name}: unsupported edition`);default:throw Error(`${e.name}: unsupported syntax "${e.syntax}"`)}}function oa(e,t){return e.dependency.map(n=>{let r=t.getFile(n);if(!r)throw Error(`Cannot find ${n}, imported by ${e.name}`);return r})}function sa(e,t){let n=ca(e)+`_`;for(let e of t){if(!e.name.toLowerCase().startsWith(n))return;let t=e.name.substring(n.length);if(t.length==0||/^\\d/.test(t))return}return n}function ca(e){return(e.substring(0,1)+e.substring(1).replace(/[A-Z]/g,e=>`_`+e)).toLowerCase()}function la(e,t,n){let r;return r=t?`${t.typeName}.${e.name}`:n.proto.package.length>0?`${n.proto.package}.${e.name}`:`${e.name}`,r}function J(e){return e.startsWith(`.`)?e.substring(1):e}function ua(e,t){if(!wr(e,`oneofIndex`)||e.proto3Optional)return;let n=t[e.oneofIndex];return Y(n,`invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`),n}function da(e,t,n,r){if(e.label==2)return 3;if(e.label==3)return 2;if(t||e.proto3Optional||n)return 1;let i=ga(`fieldPresence`,{proto:e,parent:r});return i==2&&(e.type==11||e.type==10)?1:i}function fa(e,t){if(e.label!=3)return!1;switch(e.type){case 9:case 12:case 10:case 11:return!1}let n=e.options;return n&&wr(n,`packed`)?n.packed:ga(`repeatedFieldEncoding`,{proto:e,parent:t})==1}function pa(e){let t=e.fields.find(e=>e.number===1),n=e.fields.find(e=>e.number===2);return Y(t&&t.fieldKind==`scalar`&&t.scalar!=W.BYTES&&t.scalar!=W.FLOAT&&t.scalar!=W.DOUBLE&&n&&n.fieldKind!=`list`&&n.fieldKind!=`map`),{key:t,value:n}}function ma(e){return ga(`enumType`,{proto:e.proto,parent:e.parent??e.file})==1}function ha(e,t){return e.type==10?!0:ga(`messageEncoding`,{proto:e,parent:t})==2}function ga(e,t){let n=t.proto.options?.features;if(n){let t=n[e];if(t!=0)return t}if(`kind`in t){if(t.kind==`message`)return ga(e,t.parent??t.file);let n=Yi[t.edition];if(!n)throw Error(`feature default for edition ${t.edition} not found`);return n[e]}return ga(e,t.parent)}function Y(e,t){if(!e)throw Error(t)}function _a(e){let t=va(e);return t.messageType.forEach(Hi),qi(t,()=>void 0).getFile(t.name)}function va(e){return Object.assign(Object.create({syntax:``,edition:0}),Object.assign(Object.assign({$typeName:`google.protobuf.FileDescriptorProto`,dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},e),{messageType:e.messageType.map(ya),enumType:e.enumType.map(Sa)}))}function ya(e){return Object.assign(Object.create({visibility:0}),{$typeName:`google.protobuf.DescriptorProto`,name:e.name,field:e.field?.map(ba)??[],extension:[],nestedType:e.nestedType?.map(ya)??[],enumType:e.enumType?.map(Sa)??[],extensionRange:e.extensionRange?.map(e=>Object.assign({$typeName:`google.protobuf.DescriptorProto.ExtensionRange`},e))??[],oneofDecl:[],reservedRange:[],reservedName:[]})}function ba(e){return Object.assign(Object.create({label:1,typeName:``,extendee:``,defaultValue:``,oneofIndex:0,jsonName:``,proto3Optional:!1}),Object.assign(Object.assign({$typeName:`google.protobuf.FieldDescriptorProto`},e),{options:e.options?xa(e.options):void 0}))}function xa(e){return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:`google.protobuf.FieldOptions`},e),{targets:e.targets??[],editionDefaults:e.editionDefaults?.map(e=>Object.assign({$typeName:`google.protobuf.FieldOptions.EditionDefault`},e))??[],uninterpretedOption:[]}))}function Sa(e){return Object.assign(Object.create({visibility:0}),{$typeName:`google.protobuf.EnumDescriptorProto`,name:e.name,reservedName:[],reservedRange:[],value:e.value.map(e=>Object.assign({$typeName:`google.protobuf.EnumValueDescriptorProto`},e))})}function X(e,t,...n){return n.reduce((e,t)=>e.nestedMessages[t],e.messages[t])}let Ca=X(_a({name:`google/protobuf/descriptor.proto`,package:`google.protobuf`,messageType:[{name:`FileDescriptorSet`,field:[{name:`file`,number:1,type:11,label:3,typeName:`.google.protobuf.FileDescriptorProto`}],extensionRange:[{start:536e6,end:536000001}]},{name:`FileDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`package`,number:2,type:9,label:1},{name:`dependency`,number:3,type:9,label:3},{name:`public_dependency`,number:10,type:5,label:3},{name:`weak_dependency`,number:11,type:5,label:3},{name:`option_dependency`,number:15,type:9,label:3},{name:`message_type`,number:4,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:5,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`service`,number:6,type:11,label:3,typeName:`.google.protobuf.ServiceDescriptorProto`},{name:`extension`,number:7,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FileOptions`},{name:`source_code_info`,number:9,type:11,label:1,typeName:`.google.protobuf.SourceCodeInfo`},{name:`syntax`,number:12,type:9,label:1},{name:`edition`,number:14,type:14,label:1,typeName:`.google.protobuf.Edition`}]},{name:`DescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`field`,number:2,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`extension`,number:6,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`nested_type`,number:3,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`extension_range`,number:5,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ExtensionRange`},{name:`oneof_decl`,number:8,type:11,label:3,typeName:`.google.protobuf.OneofDescriptorProto`},{name:`options`,number:7,type:11,label:1,typeName:`.google.protobuf.MessageOptions`},{name:`reserved_range`,number:9,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ReservedRange`},{name:`reserved_name`,number:10,type:9,label:3},{name:`visibility`,number:11,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`ExtensionRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ExtensionRangeOptions`}]},{name:`ReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`ExtensionRangeOptions`,field:[{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`},{name:`declaration`,number:2,type:11,label:3,typeName:`.google.protobuf.ExtensionRangeOptions.Declaration`,options:{retention:2}},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`verification`,number:3,type:14,label:1,typeName:`.google.protobuf.ExtensionRangeOptions.VerificationState`,defaultValue:`UNVERIFIED`,options:{retention:2}}],nestedType:[{name:`Declaration`,field:[{name:`number`,number:1,type:5,label:1},{name:`full_name`,number:2,type:9,label:1},{name:`type`,number:3,type:9,label:1},{name:`reserved`,number:5,type:8,label:1},{name:`repeated`,number:6,type:8,label:1}]}],enumType:[{name:`VerificationState`,value:[{name:`DECLARATION`,number:0},{name:`UNVERIFIED`,number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:3,type:5,label:1},{name:`label`,number:4,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Label`},{name:`type`,number:5,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Type`},{name:`type_name`,number:6,type:9,label:1},{name:`extendee`,number:2,type:9,label:1},{name:`default_value`,number:7,type:9,label:1},{name:`oneof_index`,number:9,type:5,label:1},{name:`json_name`,number:10,type:9,label:1},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FieldOptions`},{name:`proto3_optional`,number:17,type:8,label:1}],enumType:[{name:`Type`,value:[{name:`TYPE_DOUBLE`,number:1},{name:`TYPE_FLOAT`,number:2},{name:`TYPE_INT64`,number:3},{name:`TYPE_UINT64`,number:4},{name:`TYPE_INT32`,number:5},{name:`TYPE_FIXED64`,number:6},{name:`TYPE_FIXED32`,number:7},{name:`TYPE_BOOL`,number:8},{name:`TYPE_STRING`,number:9},{name:`TYPE_GROUP`,number:10},{name:`TYPE_MESSAGE`,number:11},{name:`TYPE_BYTES`,number:12},{name:`TYPE_UINT32`,number:13},{name:`TYPE_ENUM`,number:14},{name:`TYPE_SFIXED32`,number:15},{name:`TYPE_SFIXED64`,number:16},{name:`TYPE_SINT32`,number:17},{name:`TYPE_SINT64`,number:18}]},{name:`Label`,value:[{name:`LABEL_OPTIONAL`,number:1},{name:`LABEL_REPEATED`,number:3},{name:`LABEL_REQUIRED`,number:2}]}]},{name:`OneofDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`options`,number:2,type:11,label:1,typeName:`.google.protobuf.OneofOptions`}]},{name:`EnumDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`value`,number:2,type:11,label:3,typeName:`.google.protobuf.EnumValueDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumOptions`},{name:`reserved_range`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto.EnumReservedRange`},{name:`reserved_name`,number:5,type:9,label:3},{name:`visibility`,number:6,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`EnumReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`EnumValueDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumValueOptions`}]},{name:`ServiceDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`method`,number:2,type:11,label:3,typeName:`.google.protobuf.MethodDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ServiceOptions`}]},{name:`MethodDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`input_type`,number:2,type:9,label:1},{name:`output_type`,number:3,type:9,label:1},{name:`options`,number:4,type:11,label:1,typeName:`.google.protobuf.MethodOptions`},{name:`client_streaming`,number:5,type:8,label:1,defaultValue:`false`},{name:`server_streaming`,number:6,type:8,label:1,defaultValue:`false`}]},{name:`FileOptions`,field:[{name:`java_package`,number:1,type:9,label:1},{name:`java_outer_classname`,number:8,type:9,label:1},{name:`java_multiple_files`,number:10,type:8,label:1,defaultValue:`false`},{name:`java_generate_equals_and_hash`,number:20,type:8,label:1,options:{deprecated:!0}},{name:`java_string_check_utf8`,number:27,type:8,label:1,defaultValue:`false`},{name:`optimize_for`,number:9,type:14,label:1,typeName:`.google.protobuf.FileOptions.OptimizeMode`,defaultValue:`SPEED`},{name:`go_package`,number:11,type:9,label:1},{name:`cc_generic_services`,number:16,type:8,label:1,defaultValue:`false`},{name:`java_generic_services`,number:17,type:8,label:1,defaultValue:`false`},{name:`py_generic_services`,number:18,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:23,type:8,label:1,defaultValue:`false`},{name:`cc_enable_arenas`,number:31,type:8,label:1,defaultValue:`true`},{name:`objc_class_prefix`,number:36,type:9,label:1},{name:`csharp_namespace`,number:37,type:9,label:1},{name:`swift_prefix`,number:39,type:9,label:1},{name:`php_class_prefix`,number:40,type:9,label:1},{name:`php_namespace`,number:41,type:9,label:1},{name:`php_metadata_namespace`,number:44,type:9,label:1},{name:`ruby_package`,number:45,type:9,label:1},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`OptimizeMode`,value:[{name:`SPEED`,number:1},{name:`CODE_SIZE`,number:2},{name:`LITE_RUNTIME`,number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`MessageOptions`,field:[{name:`message_set_wire_format`,number:1,type:8,label:1,defaultValue:`false`},{name:`no_standard_descriptor_accessor`,number:2,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`map_entry`,number:7,type:8,label:1},{name:`deprecated_legacy_json_field_conflicts`,number:11,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:12,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldOptions`,field:[{name:`ctype`,number:1,type:14,label:1,typeName:`.google.protobuf.FieldOptions.CType`,defaultValue:`STRING`},{name:`packed`,number:2,type:8,label:1},{name:`jstype`,number:6,type:14,label:1,typeName:`.google.protobuf.FieldOptions.JSType`,defaultValue:`JS_NORMAL`},{name:`lazy`,number:5,type:8,label:1,defaultValue:`false`},{name:`unverified_lazy`,number:15,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`weak`,number:10,type:8,label:1,defaultValue:`false`,options:{deprecated:!0}},{name:`debug_redact`,number:16,type:8,label:1,defaultValue:`false`},{name:`retention`,number:17,type:14,label:1,typeName:`.google.protobuf.FieldOptions.OptionRetention`},{name:`targets`,number:19,type:14,label:3,typeName:`.google.protobuf.FieldOptions.OptionTargetType`},{name:`edition_defaults`,number:20,type:11,label:3,typeName:`.google.protobuf.FieldOptions.EditionDefault`},{name:`features`,number:21,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`feature_support`,number:22,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],nestedType:[{name:`EditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`value`,number:2,type:9,label:1}]},{name:`FeatureSupport`,field:[{name:`edition_introduced`,number:1,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`edition_deprecated`,number:2,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`deprecation_warning`,number:3,type:9,label:1},{name:`edition_removed`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`}]}],enumType:[{name:`CType`,value:[{name:`STRING`,number:0},{name:`CORD`,number:1},{name:`STRING_PIECE`,number:2}]},{name:`JSType`,value:[{name:`JS_NORMAL`,number:0},{name:`JS_STRING`,number:1},{name:`JS_NUMBER`,number:2}]},{name:`OptionRetention`,value:[{name:`RETENTION_UNKNOWN`,number:0},{name:`RETENTION_RUNTIME`,number:1},{name:`RETENTION_SOURCE`,number:2}]},{name:`OptionTargetType`,value:[{name:`TARGET_TYPE_UNKNOWN`,number:0},{name:`TARGET_TYPE_FILE`,number:1},{name:`TARGET_TYPE_EXTENSION_RANGE`,number:2},{name:`TARGET_TYPE_MESSAGE`,number:3},{name:`TARGET_TYPE_FIELD`,number:4},{name:`TARGET_TYPE_ONEOF`,number:5},{name:`TARGET_TYPE_ENUM`,number:6},{name:`TARGET_TYPE_ENUM_ENTRY`,number:7},{name:`TARGET_TYPE_SERVICE`,number:8},{name:`TARGET_TYPE_METHOD`,number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`OneofOptions`,field:[{name:`features`,number:1,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumOptions`,field:[{name:`allow_alias`,number:2,type:8,label:1},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`deprecated_legacy_json_field_conflicts`,number:6,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:7,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumValueOptions`,field:[{name:`deprecated`,number:1,type:8,label:1,defaultValue:`false`},{name:`features`,number:2,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`debug_redact`,number:3,type:8,label:1,defaultValue:`false`},{name:`feature_support`,number:4,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`ServiceOptions`,field:[{name:`features`,number:34,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`MethodOptions`,field:[{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`idempotency_level`,number:34,type:14,label:1,typeName:`.google.protobuf.MethodOptions.IdempotencyLevel`,defaultValue:`IDEMPOTENCY_UNKNOWN`},{name:`features`,number:35,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`IdempotencyLevel`,value:[{name:`IDEMPOTENCY_UNKNOWN`,number:0},{name:`NO_SIDE_EFFECTS`,number:1},{name:`IDEMPOTENT`,number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`UninterpretedOption`,field:[{name:`name`,number:2,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption.NamePart`},{name:`identifier_value`,number:3,type:9,label:1},{name:`positive_int_value`,number:4,type:4,label:1},{name:`negative_int_value`,number:5,type:3,label:1},{name:`double_value`,number:6,type:1,label:1},{name:`string_value`,number:7,type:12,label:1},{name:`aggregate_value`,number:8,type:9,label:1}],nestedType:[{name:`NamePart`,field:[{name:`name_part`,number:1,type:9,label:2},{name:`is_extension`,number:2,type:8,label:2}]}]},{name:`FeatureSet`,field:[{name:`field_presence`,number:1,type:14,label:1,typeName:`.google.protobuf.FeatureSet.FieldPresence`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPLICIT`,edition:900},{value:`IMPLICIT`,edition:999},{value:`EXPLICIT`,edition:1e3}]}},{name:`enum_type`,number:2,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnumType`,options:{retention:1,targets:[6,1],editionDefaults:[{value:`CLOSED`,edition:900},{value:`OPEN`,edition:999}]}},{name:`repeated_field_encoding`,number:3,type:14,label:1,typeName:`.google.protobuf.FeatureSet.RepeatedFieldEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPANDED`,edition:900},{value:`PACKED`,edition:999}]}},{name:`utf8_validation`,number:4,type:14,label:1,typeName:`.google.protobuf.FeatureSet.Utf8Validation`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`NONE`,edition:900},{value:`VERIFY`,edition:999}]}},{name:`message_encoding`,number:5,type:14,label:1,typeName:`.google.protobuf.FeatureSet.MessageEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`LENGTH_PREFIXED`,edition:900}]}},{name:`json_format`,number:6,type:14,label:1,typeName:`.google.protobuf.FeatureSet.JsonFormat`,options:{retention:1,targets:[3,6,1],editionDefaults:[{value:`LEGACY_BEST_EFFORT`,edition:900},{value:`ALLOW`,edition:999}]}},{name:`enforce_naming_style`,number:7,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnforceNamingStyle`,options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:`STYLE_LEGACY`,edition:900},{value:`STYLE2024`,edition:1001}]}},{name:`default_symbol_visibility`,number:8,type:14,label:1,typeName:`.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility`,options:{retention:2,targets:[1],editionDefaults:[{value:`EXPORT_ALL`,edition:900},{value:`EXPORT_TOP_LEVEL`,edition:1001}]}}],nestedType:[{name:`VisibilityFeature`,enumType:[{name:`DefaultSymbolVisibility`,value:[{name:`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,number:0},{name:`EXPORT_ALL`,number:1},{name:`EXPORT_TOP_LEVEL`,number:2},{name:`LOCAL_ALL`,number:3},{name:`STRICT`,number:4}]}]}],enumType:[{name:`FieldPresence`,value:[{name:`FIELD_PRESENCE_UNKNOWN`,number:0},{name:`EXPLICIT`,number:1},{name:`IMPLICIT`,number:2},{name:`LEGACY_REQUIRED`,number:3}]},{name:`EnumType`,value:[{name:`ENUM_TYPE_UNKNOWN`,number:0},{name:`OPEN`,number:1},{name:`CLOSED`,number:2}]},{name:`RepeatedFieldEncoding`,value:[{name:`REPEATED_FIELD_ENCODING_UNKNOWN`,number:0},{name:`PACKED`,number:1},{name:`EXPANDED`,number:2}]},{name:`Utf8Validation`,value:[{name:`UTF8_VALIDATION_UNKNOWN`,number:0},{name:`VERIFY`,number:2},{name:`NONE`,number:3}]},{name:`MessageEncoding`,value:[{name:`MESSAGE_ENCODING_UNKNOWN`,number:0},{name:`LENGTH_PREFIXED`,number:1},{name:`DELIMITED`,number:2}]},{name:`JsonFormat`,value:[{name:`JSON_FORMAT_UNKNOWN`,number:0},{name:`ALLOW`,number:1},{name:`LEGACY_BEST_EFFORT`,number:2}]},{name:`EnforceNamingStyle`,value:[{name:`ENFORCE_NAMING_STYLE_UNKNOWN`,number:0},{name:`STYLE2024`,number:1},{name:`STYLE_LEGACY`,number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:`FeatureSetDefaults`,field:[{name:`defaults`,number:1,type:11,label:3,typeName:`.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault`},{name:`minimum_edition`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`maximum_edition`,number:5,type:14,label:1,typeName:`.google.protobuf.Edition`}],nestedType:[{name:`FeatureSetEditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`overridable_features`,number:4,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`fixed_features`,number:5,type:11,label:1,typeName:`.google.protobuf.FeatureSet`}]}]},{name:`SourceCodeInfo`,field:[{name:`location`,number:1,type:11,label:3,typeName:`.google.protobuf.SourceCodeInfo.Location`}],nestedType:[{name:`Location`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`span`,number:2,type:5,label:3,options:{packed:!0}},{name:`leading_comments`,number:3,type:9,label:1},{name:`trailing_comments`,number:4,type:9,label:1},{name:`leading_detached_comments`,number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:`GeneratedCodeInfo`,field:[{name:`annotation`,number:1,type:11,label:3,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation`}],nestedType:[{name:`Annotation`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`source_file`,number:2,type:9,label:1},{name:`begin`,number:3,type:5,label:1},{name:`end`,number:4,type:5,label:1},{name:`semantic`,number:5,type:14,label:1,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation.Semantic`}],enumType:[{name:`Semantic`,value:[{name:`NONE`,number:0},{name:`SET`,number:1},{name:`ALIAS`,number:2}]}]}]}],enumType:[{name:`Edition`,value:[{name:`EDITION_UNKNOWN`,number:0},{name:`EDITION_LEGACY`,number:900},{name:`EDITION_PROTO2`,number:998},{name:`EDITION_PROTO3`,number:999},{name:`EDITION_2023`,number:1e3},{name:`EDITION_2024`,number:1001},{name:`EDITION_UNSTABLE`,number:9999},{name:`EDITION_1_TEST_ONLY`,number:1},{name:`EDITION_2_TEST_ONLY`,number:2},{name:`EDITION_99997_TEST_ONLY`,number:99997},{name:`EDITION_99998_TEST_ONLY`,number:99998},{name:`EDITION_99999_TEST_ONLY`,number:99999},{name:`EDITION_MAX`,number:2147483647}]},{name:`SymbolVisibility`,value:[{name:`VISIBILITY_UNSET`,number:0},{name:`VISIBILITY_LOCAL`,number:1},{name:`VISIBILITY_EXPORT`,number:2}]}]}),1);var wa;(function(e){e[e.DECLARATION=0]=`DECLARATION`,e[e.UNVERIFIED=1]=`UNVERIFIED`})(wa||={});var Ta;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.GROUP=10]=`GROUP`,e[e.MESSAGE=11]=`MESSAGE`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.ENUM=14]=`ENUM`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(Ta||={});var Ea;(function(e){e[e.OPTIONAL=1]=`OPTIONAL`,e[e.REPEATED=3]=`REPEATED`,e[e.REQUIRED=2]=`REQUIRED`})(Ea||={});var Da;(function(e){e[e.SPEED=1]=`SPEED`,e[e.CODE_SIZE=2]=`CODE_SIZE`,e[e.LITE_RUNTIME=3]=`LITE_RUNTIME`})(Da||={});var Oa;(function(e){e[e.STRING=0]=`STRING`,e[e.CORD=1]=`CORD`,e[e.STRING_PIECE=2]=`STRING_PIECE`})(Oa||={});var ka;(function(e){e[e.JS_NORMAL=0]=`JS_NORMAL`,e[e.JS_STRING=1]=`JS_STRING`,e[e.JS_NUMBER=2]=`JS_NUMBER`})(ka||={});var Aa;(function(e){e[e.RETENTION_UNKNOWN=0]=`RETENTION_UNKNOWN`,e[e.RETENTION_RUNTIME=1]=`RETENTION_RUNTIME`,e[e.RETENTION_SOURCE=2]=`RETENTION_SOURCE`})(Aa||={});var ja;(function(e){e[e.TARGET_TYPE_UNKNOWN=0]=`TARGET_TYPE_UNKNOWN`,e[e.TARGET_TYPE_FILE=1]=`TARGET_TYPE_FILE`,e[e.TARGET_TYPE_EXTENSION_RANGE=2]=`TARGET_TYPE_EXTENSION_RANGE`,e[e.TARGET_TYPE_MESSAGE=3]=`TARGET_TYPE_MESSAGE`,e[e.TARGET_TYPE_FIELD=4]=`TARGET_TYPE_FIELD`,e[e.TARGET_TYPE_ONEOF=5]=`TARGET_TYPE_ONEOF`,e[e.TARGET_TYPE_ENUM=6]=`TARGET_TYPE_ENUM`,e[e.TARGET_TYPE_ENUM_ENTRY=7]=`TARGET_TYPE_ENUM_ENTRY`,e[e.TARGET_TYPE_SERVICE=8]=`TARGET_TYPE_SERVICE`,e[e.TARGET_TYPE_METHOD=9]=`TARGET_TYPE_METHOD`})(ja||={});var Ma;(function(e){e[e.IDEMPOTENCY_UNKNOWN=0]=`IDEMPOTENCY_UNKNOWN`,e[e.NO_SIDE_EFFECTS=1]=`NO_SIDE_EFFECTS`,e[e.IDEMPOTENT=2]=`IDEMPOTENT`})(Ma||={});var Na;(function(e){e[e.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]=`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,e[e.EXPORT_ALL=1]=`EXPORT_ALL`,e[e.EXPORT_TOP_LEVEL=2]=`EXPORT_TOP_LEVEL`,e[e.LOCAL_ALL=3]=`LOCAL_ALL`,e[e.STRICT=4]=`STRICT`})(Na||={});var Pa;(function(e){e[e.FIELD_PRESENCE_UNKNOWN=0]=`FIELD_PRESENCE_UNKNOWN`,e[e.EXPLICIT=1]=`EXPLICIT`,e[e.IMPLICIT=2]=`IMPLICIT`,e[e.LEGACY_REQUIRED=3]=`LEGACY_REQUIRED`})(Pa||={});var Fa;(function(e){e[e.ENUM_TYPE_UNKNOWN=0]=`ENUM_TYPE_UNKNOWN`,e[e.OPEN=1]=`OPEN`,e[e.CLOSED=2]=`CLOSED`})(Fa||={});var Ia;(function(e){e[e.REPEATED_FIELD_ENCODING_UNKNOWN=0]=`REPEATED_FIELD_ENCODING_UNKNOWN`,e[e.PACKED=1]=`PACKED`,e[e.EXPANDED=2]=`EXPANDED`})(Ia||={});var La;(function(e){e[e.UTF8_VALIDATION_UNKNOWN=0]=`UTF8_VALIDATION_UNKNOWN`,e[e.VERIFY=2]=`VERIFY`,e[e.NONE=3]=`NONE`})(La||={});var Ra;(function(e){e[e.MESSAGE_ENCODING_UNKNOWN=0]=`MESSAGE_ENCODING_UNKNOWN`,e[e.LENGTH_PREFIXED=1]=`LENGTH_PREFIXED`,e[e.DELIMITED=2]=`DELIMITED`})(Ra||={});var za;(function(e){e[e.JSON_FORMAT_UNKNOWN=0]=`JSON_FORMAT_UNKNOWN`,e[e.ALLOW=1]=`ALLOW`,e[e.LEGACY_BEST_EFFORT=2]=`LEGACY_BEST_EFFORT`})(za||={});var Ba;(function(e){e[e.ENFORCE_NAMING_STYLE_UNKNOWN=0]=`ENFORCE_NAMING_STYLE_UNKNOWN`,e[e.STYLE2024=1]=`STYLE2024`,e[e.STYLE_LEGACY=2]=`STYLE_LEGACY`})(Ba||={});var Va;(function(e){e[e.NONE=0]=`NONE`,e[e.SET=1]=`SET`,e[e.ALIAS=2]=`ALIAS`})(Va||={});var Ha;(function(e){e[e.EDITION_UNKNOWN=0]=`EDITION_UNKNOWN`,e[e.EDITION_LEGACY=900]=`EDITION_LEGACY`,e[e.EDITION_PROTO2=998]=`EDITION_PROTO2`,e[e.EDITION_PROTO3=999]=`EDITION_PROTO3`,e[e.EDITION_2023=1e3]=`EDITION_2023`,e[e.EDITION_2024=1001]=`EDITION_2024`,e[e.EDITION_UNSTABLE=9999]=`EDITION_UNSTABLE`,e[e.EDITION_1_TEST_ONLY=1]=`EDITION_1_TEST_ONLY`,e[e.EDITION_2_TEST_ONLY=2]=`EDITION_2_TEST_ONLY`,e[e.EDITION_99997_TEST_ONLY=99997]=`EDITION_99997_TEST_ONLY`,e[e.EDITION_99998_TEST_ONLY=99998]=`EDITION_99998_TEST_ONLY`,e[e.EDITION_99999_TEST_ONLY=99999]=`EDITION_99999_TEST_ONLY`,e[e.EDITION_MAX=2147483647]=`EDITION_MAX`})(Ha||={});var Ua;(function(e){e[e.VISIBILITY_UNSET=0]=`VISIBILITY_UNSET`,e[e.VISIBILITY_LOCAL=1]=`VISIBILITY_LOCAL`,e[e.VISIBILITY_EXPORT=2]=`VISIBILITY_EXPORT`})(Ua||={});let Wa={readUnknownFields:!0};function Ga(e){return e?Object.assign(Object.assign({},Wa),e):Wa}function Z(e,t,n){let r=pi(e,void 0,!1);return Ka(r,new Qr(t),Ga(n),!1,t.byteLength),r.message}function Ka(e,t,n,r,i){let a=r?t.len:t.pos+i,o,s,c=e.getUnknown()??[];for(;t.pos<a&&([o,s]=t.tag(),!(r&&s==q.EndGroup));){let r=e.findNumber(o);if(!r){let e=t.skip(s,o);n.readUnknownFields&&c.push({no:o,wireType:s,data:e});continue}qa(e,t,r,s,n)}if(r&&(s!=q.EndGroup||o!==i))throw Error(`invalid end group tag`);c.length>0&&e.setUnknown(c)}function qa(e,t,n,r,i){switch(n.fieldKind){case`scalar`:e.set(n,Za(t,n.scalar));break;case`enum`:let a=Za(t,W.INT32);if(n.enum.open)e.set(n,a);else if(n.enum.values.some(e=>e.number===a))e.set(n,a);else if(i.readUnknownFields){let t=[];hr(a,t);let i=e.getUnknown()??[];i.push({no:n.number,wireType:r,data:new Uint8Array(t)}),e.setUnknown(i)}break;case`message`:e.set(n,Xa(t,i,n,e.get(n)));break;case`list`:Ya(t,r,e.get(n),i);break;case`map`:Ja(t,e.get(n),i);break}}function Ja(e,t,n){let r=t.field(),i,a,o=e.uint32(),s=e.pos+o;for(;e.pos<s;){let[t]=e.tag();switch(t){case 1:i=Za(e,r.mapKey);break;case 2:switch(r.mapKind){case`scalar`:a=Za(e,r.scalar);break;case`enum`:a=e.int32();break;case`message`:a=Xa(e,n,r);break}break}}if(i===void 0&&(i=br(r.mapKey,!1)),a===void 0)switch(r.mapKind){case`scalar`:a=br(r.scalar,!1);break;case`enum`:a=r.enum.values[0].number;break;case`message`:a=pi(r.message,void 0,!1);break}t.set(i,a)}function Ya(e,t,n,r){let i=n.field();if(i.listKind===`message`){n.add(Xa(e,r,i));return}let a=i.scalar??W.INT32;if(!(t==q.LengthDelimited&&a!=W.STRING&&a!=W.BYTES)){n.add(Za(e,a));return}let o=e.uint32()+e.pos;for(;e.pos<o;)n.add(Za(e,a))}function Xa(e,t,n,r){let i=n.delimitedEncoding,a=r??pi(n.message,void 0,!1);return Ka(a,e,t,i,i?n.number:e.uint32()),a}function Za(e,t){switch(t){case W.STRING:return e.string();case W.BOOL:return e.bool();case W.DOUBLE:return e.double();case W.FLOAT:return e.float();case W.INT32:return e.int32();case W.INT64:return e.int64();case W.UINT64:return e.uint64();case W.FIXED64:return e.fixed64();case W.BYTES:return e.bytes();case W.FIXED32:return e.fixed32();case W.SFIXED32:return e.sfixed32();case W.SFIXED64:return e.sfixed64();case W.SINT64:return e.sint64();case W.UINT32:return e.uint32();case W.SINT32:return e.sint32()}}function Qa(e,t){let n=Z(Ca,Ni(e));return n.messageType.forEach(Hi),n.dependency=t?.map(e=>e.proto.name)??[],qi(n,e=>t?.find(t=>t.proto.name===e)).getFile(n.name)}let $a={writeUnknownFields:!0};function eo(e){return e?Object.assign(Object.assign({},$a),e):$a}function to(e,t,n){return no(new Zr,eo(n),pi(e,t)).finish()}function no(e,t,n){for(let r of n.sortedFields){if(!n.isSet(r)){if(r.presence==3)throw Error(`cannot encode ${r} to binary: required field not set`);continue}ro(e,t,n,r)}if(t.writeUnknownFields)for(let{no:t,wireType:r,data:i}of n.getUnknown()??[])e.tag(t,r).raw(i);return e}function ro(e,t,n,r){switch(r.fieldKind){case`scalar`:case`enum`:io(e,n.desc.typeName,r.name,r.scalar??W.INT32,r.number,n.get(r));break;case`list`:oo(e,t,r,n.get(r));break;case`message`:ao(e,t,r,n.get(r));break;case`map`:for(let[i,a]of n.get(r))so(e,t,r,i,a);break}}function io(e,t,n,r,i,a){co(e.tag(i,lo(r)),t,n,r,a)}function ao(e,t,n,r){n.delimitedEncoding?no(e.tag(n.number,q.StartGroup),t,r).tag(n.number,q.EndGroup):no(e.tag(n.number,q.LengthDelimited).fork(),t,r).join()}function oo(e,t,n,r){if(n.listKind==`message`){for(let i of r)ao(e,t,n,i);return}let i=n.scalar??W.INT32;if(n.packed){if(!r.size)return;e.tag(n.number,q.LengthDelimited).fork();for(let t of r)co(e,n.parent.typeName,n.name,i,t);e.join();return}for(let t of r)io(e,n.parent.typeName,n.name,i,n.number,t)}function so(e,t,n,r,i){switch(e.tag(n.number,q.LengthDelimited).fork(),io(e,n.parent.typeName,n.name,n.mapKey,1,r),n.mapKind){case`scalar`:case`enum`:io(e,n.parent.typeName,n.name,n.scalar??W.INT32,2,i);break;case`message`:no(e.tag(2,q.LengthDelimited).fork(),t,i).join();break}e.join()}function co(e,t,n,r,i){try{switch(r){case W.STRING:e.string(i);break;case W.BOOL:e.bool(i);break;case W.DOUBLE:e.double(i);break;case W.FLOAT:e.float(i);break;case W.INT32:e.int32(i);break;case W.INT64:e.int64(i);break;case W.UINT64:e.uint64(i);break;case W.FIXED64:e.fixed64(i);break;case W.BYTES:e.bytes(i);break;case W.FIXED32:e.fixed32(i);break;case W.SFIXED32:e.sfixed32(i);break;case W.SFIXED64:e.sfixed64(i);break;case W.SINT64:e.sint64(i);break;case W.UINT32:e.uint32(i);break;case W.SINT32:e.sint32(i);break}}catch(e){throw e instanceof Error?Error(`cannot encode field ${t}.${n} to binary: ${e.message}`):e}}function lo(e){switch(e){case W.BYTES:case W.STRING:return q.LengthDelimited;case W.DOUBLE:case W.FIXED64:case W.SFIXED64:return q.Bit64;case W.FIXED32:case W.SFIXED32:case W.FLOAT:return q.Bit32;default:return q.Varint}}let uo=Qa(`Cg5CYXNlRGF0YS5wcm90bxIVY29tLnF1aWNrLnZvaWNlLnByb3RvInQKCUNvbW1vblJlcRINCgVldmVudBgBIAEoCRIMCgRkYXRhGAIgASgMEgoKAnNuGAMgASgDEgwKBHRpbWUYBCABKAMSDQoFdmFsaWQYBSABKAMSDwoHdmVyc2lvbhgGIAEoBRIQCghjb21wcmVzcxgHIAEoCCKQAQoJQ29tbW9uUnNwEg0KBWV2ZW50GAEgASgJEgwKBGRhdGEYAiABKAwSCgoCc24YAyABKAMSDAoEdGltZRgEIAEoAxINCgV2YWxpZBgFIAEoAxIMCgRjb2RlGAYgASgFEgwKBGRlc2MYByABKAkSDwoHdmVyc2lvbhgIIAEoBRIQCghjb21wcmVzcxgJIAEoCEJEChVjb20ucXVpY2sudm9pY2UucHJvdG9CCEJhc2VEYXRhWhVjb20ucXVpY2sudm9pY2UucHJvdG+6AglSb29tUHJvdG9iBnByb3RvMw`),fo=X(uo,0),po=X(uo,1),Q=Qa(`CgpSb29tLnByb3RvEhVjb20ucXVpY2sudm9pY2UucHJvdG8igwMKBFVzZXISCgoCaWQYASABKAkSFwoKY2FsbEFjdGlvbhgCIAEoBUgAiAEBEhYKCWNhbGxTdGF0ZRgDIAEoBUgBiAEBEhUKCGpvaW5UaW1lGAQgASgDSAKIAQESLAoGdHJhY2tzGAUgAygLMhwuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrEhgKC3Blcm1pc3Npb25zGAYgASgFSAOIAQESGAoLaXNQdWJsaXNoZWQYByABKAhIBIgBARIVCghiZWhhdmlvchgIIAEoBUgFiAEBEkYKDGNoYW5uZWxDYWNoZRgJIAEoCzIrLmNvbS5xdWljay52b2ljZS5wcm90by5EYXRhQ2hhbm5lbENhY2hlSW5mb0gGiAEBQg0KC19jYWxsQWN0aW9uQgwKCl9jYWxsU3RhdGVCCwoJX2pvaW5UaW1lQg4KDF9wZXJtaXNzaW9uc0IOCgxfaXNQdWJsaXNoZWRCCwoJX2JlaGF2aW9yQg8KDV9jaGFubmVsQ2FjaGUiTAoURGF0YUNoYW5uZWxDYWNoZUluZm8SNAoIY2hhbm5lbHMYASADKAsyIi5jb20ucXVpY2sudm9pY2UucHJvdG8uRGF0YUNoYW5uZWwiPgoLRGF0YUNoYW5uZWwSFwoPZGF0YUNoYW5uZWxOYW1lGAEgASgJEg8KAmlkGAIgASgFSACIAQFCBQoDX2lkIjgKBUxvZ2luEg0KBWFwcGlkGAEgASgJEg4KBnVzZXJJZBgCIAEoCRIQCghzZGtUb2tlbhgDIAEoCSLiAgoFVHJhY2sSCwoDbWlkGAEgASgJEhYKCXRyYWNrTmFtZRgCIAEoCUgAiAEBEhUKCGxvY2F0aW9uGAMgASgJSAGIAQESEwoGdXNlcklkGAQgASgJSAKIAQESEQoEY29kZRgFIAEoBUgDiAEBEhEKBGRlc2MYBiABKAlIBIgBARIzCgR0eXBlGAcgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZUgFiAEBEhQKB2lzVmFsaWQYCCABKAhIBogBARIWCglzaW11bGNhc3QYCSABKAlIB4gBARIWCglsYXN0UmV0cnkYCiABKAhICIgBAUIMCgpfdHJhY2tOYW1lQgsKCV9sb2NhdGlvbkIJCgdfdXNlcklkQgcKBV9jb2RlQgcKBV9kZXNjQgcKBV90eXBlQgoKCF9pc1ZhbGlkQgwKCl9zaW11bGNhc3RCDAoKX2xhc3RSZXRyeSKpAgoHSm9pblJlcRIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEjEKCGNhbGxUeXBlGAMgASgOMh8uY29tLnF1aWNrLnZvaWNlLnByb3RvLkNhbGxUeXBlEhIKBXRva2VuGAQgASgJSACIAQESNwoEbGFuZxgFIAEoCzIkLmNvbS5xdWljay52b2ljZS5wcm90by5BaUxhbmdTZXR0aW5nSAGIAQESEAoDc3R0GAYgASgISAKIAQESEgoFbXNnSWQYByABKAlIA4gBARIQCgNtc2cYCCABKAlIBIgBAUIICgZfdG9rZW5CBwoFX2xhbmdCBgoEX3N0dEIICgZfbXNnSWRCBgoEX21zZyLbAgoHSm9pblJzcBIOCgZyb29tSWQYASABKAkSLgoJcm9vbVVzZXJzGAIgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXISMQoIY2FsbFR5cGUYAyABKA4yHy5jb20ucXVpY2sudm9pY2UucHJvdG8uQ2FsbFR5cGUSEAoId2lmaU9ubHkYBCABKAgSFwoKcm9vbUFjdGlvbhgFIAEoBUgAiAEBEhYKCXRvdGFsU2l6ZRgGIAEoBUgBiAEBEkYKEG1lZXRTcGVjaWFsUm9sZXMYByABKAsyJy5jb20ucXVpY2sudm9pY2UucHJvdG8uTWVldFJvbGVzTGlzdFJzcEgCiAEBEhQKB3NoYXJkSWQYCCABKAlIA4gBAUINCgtfcm9vbUFjdGlvbkIMCgpfdG90YWxTaXplQhMKEV9tZWV0U3BlY2lhbFJvbGVzQgoKCF9zaGFyZElkIkcKCkpvaW5Ob3RpZnkSDgoGcm9vbUlkGAEgASgJEikKBHVzZXIYAiABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciIbCgxDb25uZWN0Q0ZSZXESCwoDc2RwGAEgASgJIngKDENvbm5lY3RDRlJzcBIRCglyZW1vdGVTZHAYASABKAkSMwoOc3Vic2NyaWJlVXNlcnMYAiADKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlchIUCgdzZXNzaW9uGAMgASgJSACIAQFCCgoIX3Nlc3Npb24ioQEKClB1Ymxpc2hSZXESCwoDc2RwGAEgASgJEiwKBnRyYWNrcxgCIAMoCzIcLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFjaxISCgpjYWxsQWN0aW9uGAMgASgFEhUKCHJlY3JlYXRlGAQgASgISACIAQESFAoHc2Vzc2lvbhgFIAEoCUgBiAEBQgsKCV9yZWNyZWF0ZUIKCghfc2Vzc2lvbiJBCgpQdWJsaXNoUnNwEhEKCXJlbW90ZVNkcBgBIAEoCRIUCgdzZXNzaW9uGAIgASgJSACIAQFCCgoIX3Nlc3Npb24ibAoNUHVibGlzaE5vdGlmeRIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEhQKB3Nlc3Npb24YAyABKAlIAIgBAUIKCghfc2Vzc2lvbiKCAQoMU3Vic2NyaWJlUmVxEioKBXVzZXJzGAEgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXISFAoHc2Vzc2lvbhgCIAEoCUgAiAEBEhYKCXNlbGZDaGVjaxgDIAEoCEgBiAEBQgoKCF9zZXNzaW9uQgwKCl9zZWxmQ2hlY2sibwoMU3Vic2NyaWJlUnNwEhEKCXJlbW90ZVNkcBgBIAEoCRIqCgV1c2VycxgCIAMoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEhQKB3Nlc3Npb24YAyABKAlIAIgBAUIKCghfc2Vzc2lvbiItCg5SZW5lZ290aWF0ZVJlcRIOCgZ1c2VySWQYASABKAkSCwoDc2RwGAIgASgJImEKB1F1aXRSZXESDgoGdXNlcklkGAEgASgJEg4KBnJvb21JZBgCIAEoCRISCgVtc2dJZBgDIAEoCUgAiAEBEhAKA21zZxgEIAEoCUgBiAEBQggKBl9tc2dJZEIGCgRfbXNnIn8KClF1aXROb3RpZnkSDgoGcm9vbUlkGAEgASgJEikKBHVzZXIYAiABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlchIRCgRjb2RlGAMgASgFSACIAQESEQoEZGVzYxgEIAEoCUgBiAEBQgcKBV9jb2RlQgcKBV9kZXNjIiMKEVRva2VuRXhwaXJlTm90aWZ5Eg4KBnJvb21JZBgBIAEoCSIyCg5VcGRhdGVUb2tlblJlcRIOCgZyb29tSWQYASABKAkSEAoIc2RrVG9rZW4YAiABKAkiUwoQTmV0UXVhbGl0eUNoYW5nZRIOCgZ1c2VySWQYASABKAkSDgoGcm9vbUlkGAIgASgJEg4KBmVncmVzcxgDIAEoBRIPCgdpbmdyZXNzGAQgASgFIk4KEE5ldFF1YWxpdHlOb3RpZnkSOgoJcXVhbGl0aWVzGAEgAygLMicuY29tLnF1aWNrLnZvaWNlLnByb3RvLk5ldFF1YWxpdHlDaGFuZ2UiRwoKVXBkYXRlQ2FsbBIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyIlIKD1AyUFVzZXJTeW5jSXRlbRIOCgZ1c2VySWQYASABKAkSLwoFdHlwZXMYAiADKA4yIC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2tUeXBlIn0KD1AyUFVzZXJTeW5jTGlzdBI0CgRwdXNoGAEgAygLMiYuY29tLnF1aWNrLnZvaWNlLnByb3RvLlAyUFVzZXJTeW5jSXRlbRI0CgRwdWxsGAIgAygLMiYuY29tLnF1aWNrLnZvaWNlLnByb3RvLlAyUFVzZXJTeW5jSXRlbSKYAQoPU3luY1Jvb21JbmZvUmVxEg4KBnJvb21JZBgBIAEoCRIpCgR1c2VyGAIgASgLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXISPQoIcDJwU3RhdGUYAyABKAsyJi5jb20ucXVpY2sudm9pY2UucHJvdG8uUDJQVXNlclN5bmNMaXN0SACIAQFCCwoJX3AycFN0YXRlIpsCCg9TeW5jUm9vbUluZm9Sc3ASDgoGcm9vbUlkGAEgASgJEg8KB2lzVmFsaWQYAiABKAgSKgoFdXNlcnMYAyADKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlchIQCghpc0FjdGl2ZRgEIAEoCBIXCgpyb29tQWN0aW9uGAUgASgFSACIAQESFgoJdG90YWxTaXplGAYgASgFSAGIAQESRgoQbWVldFNwZWNpYWxSb2xlcxgHIAEoCzInLmNvbS5xdWljay52b2ljZS5wcm90by5NZWV0Um9sZXNMaXN0UnNwSAKIAQFCDQoLX3Jvb21BY3Rpb25CDAoKX3RvdGFsU2l6ZUITChFfbWVldFNwZWNpYWxSb2xlcyIuCgpVcGRhdGVUaW1lEgwKBHRpbWUYASABKAMSEgoKdmVyc2lvblN0chgCIAEoCSJaCg1DbG9zZVRyYWNrUmVxEgsKA3NkcBgBIAEoCRIsCgZ0cmFja3MYAiADKAsyHC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2sSDgoGcm9vbUlkGAMgASgJIlAKDUNsb3NlVHJhY2tSc3ASEQoJcmVtb3RlU2RwGAEgASgJEiwKBnRyYWNrcxgCIAMoCzIcLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFjayI9ChBDbG9zZVRyYWNrTm90aWZ5EikKBHVzZXIYASABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciJOChFVcGRhdGVQZXJtaXNzaW9ucxIOCgZyb29tSWQYASABKAkSKQoEdXNlchgCIAEoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyIlAKDFVzZXJCZWhhdmlvchIuCgR0eXBlGAEgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZRIQCghiZWhhdmlvchgCIAEoCCJRCgtQcmV2ZW50VXNlchIKCgJpZBgBIAEoCRI2CgliZWhhdmlvcnMYAiADKAsyIy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlckJlaGF2aW9yIlwKF1ByZXZlbnRVc2Vyc0JlaGF2aW9yUmVxEg4KBnJvb21JZBgBIAEoCRIxCgV1c2VycxgCIAMoCzIiLmNvbS5xdWljay52b2ljZS5wcm90by5QcmV2ZW50VXNlciJYChpQcmV2ZW50VXNlcnNCZWhhdmlvck5vdGlmeRIOCgZyb29tSWQYASABKAkSKgoFdXNlcnMYAiADKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciLyAQoOQmFzZUNETkFkZHJlc3MSNgoEYXJlYRgBIAEoDjIoLmNvbS5xdWljay52b2ljZS5wcm90by5BY2NlbGVyYXRpb25BcmVhcxI2Cgljb3VudFR5cGUYAiABKA4yIy5jb20ucXVpY2sudm9pY2UucHJvdG8uQ291bnRNZXRob2RzEkEKBnVybE1hcBgDIAMoCzIxLmNvbS5xdWljay52b2ljZS5wcm90by5CYXNlQ0ROQWRkcmVzcy5VcmxNYXBFbnRyeRotCgtVcmxNYXBFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIpwCChRDRE5QbGF5QWRkcmVzc05vdGlmeRIOCgZyb29tSWQYASABKAkSEQoEbTN1OBgCIAEoCUgAiAEBEhEKBHJ0bXAYAyABKAlIAYgBARIQCgNmbHYYBCABKAlIAogBARISCgVydG1wcxgFIAEoCUgDiAEBEjwKCG1haW5MaW5lGAYgASgLMiUuY29tLnF1aWNrLnZvaWNlLnByb3RvLkJhc2VDRE5BZGRyZXNzSASIAQESOQoKc3RhbmRMaW5lcxgHIAMoCzIlLmNvbS5xdWljay52b2ljZS5wcm90by5CYXNlQ0ROQWRkcmVzc0IHCgVfbTN1OEIHCgVfcnRtcEIGCgRfZmx2QggKBl9ydG1wc0ILCglfbWFpbkxpbmUiUwoLVXNlckNoYW5uZWwSDgoGdXNlcklkGAEgASgJEjQKCGNoYW5uZWxzGAIgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLkRhdGFDaGFubmVsImsKEUNoYW5uZWxQdWJsaXNoUmVxEjQKCGNoYW5uZWxzGAEgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLkRhdGFDaGFubmVsEhQKB3Nlc3Npb24YAiABKAlIAIgBAUIKCghfc2Vzc2lvbiJJChFDaGFubmVsUHVibGlzaFJzcRI0CghjaGFubmVscxgBIAMoCzIiLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyQ2hhbm5lbCJqChNDaGFubmVsU3Vic2NyaWJlUmVxEjEKBXVzZXJzGAEgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXJDaGFubmVsEhQKB3Nlc3Npb24YAiABKAlIAIgBAUIKCghfc2Vzc2lvbiJLChNDaGFubmVsU3Vic2NyaWJlUnNxEjQKCGNoYW5uZWxzGAEgAygLMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXJDaGFubmVsIhoKCUFja01zZ1JlcRINCgVtc2dJZBgBIAEoAyKoAQoKU2RwQ29uc3VsdBIOCgZyb29tSWQYASABKAkSMAoGc2VuZGVyGAIgASgLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXJIAIgBARISCgpyZWNlaXZlcklkGAMgASgJEgsKA3NkcBgEIAEoCRIsCgZ0cmFja3MYBSADKAsyHC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2tCCQoHX3NlbmRlciI/CglDYW5kaWRhdGUSDgoGc2RwTWlkGAEgASgJEhUKDXNkcE1MaW5lSW5kZXgYAiABKAUSCwoDc2RwGAMgASgJIpUBCgpDYW5kaWRhdGVzEg4KBnJvb21JZBgBIAEoCRIQCghzZW5kZXJJZBgCIAEoCRISCgpyZWNlaXZlcklkGAMgASgJEjQKCmNhbmRpZGF0ZXMYBCADKAsyIC5jb20ucXVpY2sudm9pY2UucHJvdG8uQ2FuZGlkYXRlEhsKE2lzU3Vic2NyaWJlUmVjZWl2ZXIYBSABKAgiegoNUmVwb3J0TmV0SW5mbxIrCgNuYXQYASABKA4yHi5jb20ucXVpY2sudm9pY2UucHJvdG8uTmF0VHlwZRIwCgR0eXBlGAIgASgOMiIuY29tLnF1aWNrLnZvaWNlLnByb3RvLk5ldHdvcmtUeXBlEgoKAmlwGAMgASgJIpwBChJSZXBvcnRUcmFmZmljVXNhZ2USFAoHcDJwUHVzaBgBIAEoA0gAiAEBEhQKB3AycFB1bGwYAiABKANIAYgBARIUCgdzZnVQdXNoGAMgASgDSAKIAQESFAoHc2Z1UHVsbBgEIAEoA0gDiAEBQgoKCF9wMnBQdXNoQgoKCF9wMnBQdWxsQgoKCF9zZnVQdXNoQgoKCF9zZnVQdWxsIlAKD0NoZWNrU2Vzc2lvblJlcRIPCgdzZXNzaW9uGAEgASgJEiwKBnRyYWNrcxgCIAMoCzIcLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFjayJoCg9DaGVja1Nlc3Npb25Sc3ESFgoOc2Vzc2lvbklzVmFsaWQYASABKAgSLAoGdHJhY2tzGAIgAygLMhwuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrEg8KB3Nlc3Npb24YAyABKAkiYwoQUm9vbVNwZWVjaE5vdGlmeRIOCgZyb29tSWQYASABKAkSDgoGdXNlcklkGAIgASgJEgwKBHRleHQYAyABKAkSEQoJdGltZXN0YW1wGAQgASgDEg4KBm9yaWdpbhgFIAEoCSLWAQoYTGl2ZVN0cmVhbWVyU3BlZWNoTm90aWZ5Eg4KBnJvb21JZBgBIAEoCRIOCgZ1c2VySWQYAiABKAkSDgoGb3JpZ2luGAMgASgJEkkKBWxhbmdzGAQgAygLMjouY29tLnF1aWNrLnZvaWNlLnByb3RvLkxpdmVTdHJlYW1lclNwZWVjaE5vdGlmeS5MYW5nc0VudHJ5EhEKCXRpbWVzdGFtcBgFIAEoAxosCgpMYW5nc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEiYAoNQWlMYW5nU2V0dGluZxINCgVpbnB1dBgBIAEoCRIOCgZvdXRwdXQYAiABKAkSHAoPdHJhbnNsYXRlRW5hYmxlGAMgASgISACIAQFCEgoQX3RyYW5zbGF0ZUVuYWJsZSJ/ChZQMlBBdmFpbGFibGVQZWVyTm90aWZ5Eg4KBnJvb21JZBgBIAEoCRIOCgZwdXNoSWQYAiABKAkSLwoFdHlwZXMYAyADKA4yIC5jb20ucXVpY2sudm9pY2UucHJvdG8uVHJhY2tUeXBlEhQKDGlzUmVtb3RlUHVzaBgEIAEoCCKrAgoOUmVwb3J0UDJQRXhSZXESDgoGcm9vbUlkGAEgASgJEg4KBnB1c2hJZBgCIAEoCRIOCgZwdWxsSWQYAyABKAkSLAoEY29kZRgEIAEoDjIeLmNvbS5xdWljay52b2ljZS5wcm90by5QMlBDb2RlEi8KBXR5cGVzGAUgAygOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZRIRCgRkZXNjGAYgASgJSACIAQESGgoNY29ubmVjdGVkVGltZRgHIAEoCUgBiAEBEjUKBmFjdGlvbhgIIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5QMlBBY3Rpb25IAogBAUIHCgVfZGVzY0IQCg5fY29ubmVjdGVkVGltZUIJCgdfYWN0aW9uIm4KFVAyUERpc2Nvbm5lY3RlZE5vdGlmeRIOCgZyb29tSWQYASABKAkSFAoMcmVtb3RlVXNlcklkGAIgASgJEi8KBXR5cGVzGAMgAygOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZSJnCh1Sb29tR2xvYmFsQWN0aW9uQ2hhbmdlZE5vdGlmeRIOCgZyb29tSWQYASABKAkSEgoKcm9vbUFjdGlvbhgCIAEoBRIMCgRmcm9tGAMgASgJEhQKDHNlcnZlckFjdGlvbhgEIAEoBSJqChlQdWJOb3RpZnlJbnRlcmNlcHRTeW5jUnNwEg4KBnJvb21JZBgBIAEoCRISCgpyb29tQWN0aW9uGAIgASgFEikKBHVzZXIYAyABKAsyGy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlciIyChBNZWV0Um9sZXNMaXN0UnNwEg8KB2NyZWF0b3IYASABKAkSDQoFYWRtaW4YAiADKAkilgEKFU1lZXRSb2xlc0NoYW5nZU5vdGlmeRIOCgZyb29tSWQYASABKAkSQQoQbWVldFNwZWNpYWxSb2xlcxgCIAEoCzInLmNvbS5xdWljay52b2ljZS5wcm90by5NZWV0Um9sZXNMaXN0UnNwEioKBXVzZXJzGAMgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXIiYAoPSm9pbkJhdGNoTm90aWZ5Eg4KBnJvb21JZBgBIAEoCRIqCgV1c2VycxgCIAMoCzIbLmNvbS5xdWljay52b2ljZS5wcm90by5Vc2VyEhEKCXRvdGFsU2l6ZRgDIAEoBSI6CgxRdWl0VXNlckluZm8SDgoGdXNlcklkGAEgASgJEgwKBGNvZGUYAiABKAUSDAoEZGVzYxgDIAEoCSJoCg9RdWl0QmF0Y2hOb3RpZnkSDgoGcm9vbUlkGAEgASgJEjIKBXVzZXJzGAIgAygLMiMuY29tLnF1aWNrLnZvaWNlLnByb3RvLlF1aXRVc2VySW5mbxIRCgl0b3RhbFNpemUYAyABKAUiTwoRUm9vbUluZm9Db21tb25Sc3ASDgoGcm9vbUlkGAEgASgJEioKBXVzZXJzGAIgAygLMhsuY29tLnF1aWNrLnZvaWNlLnByb3RvLlVzZXIiggEKCUljZVNlcnZlchIMCgR1cmxzGAEgAygJEhAKCHVzZXJuYW1lGAIgASgJEhIKCmNyZWRlbnRpYWwYAyABKAkSQQoPY3JlZGVudGlhbF90eXBlGAQgASgOMiguY29tLnF1aWNrLnZvaWNlLnByb3RvLkljZUNyZWRlbnRpYWxUeXBlIqEBChBUdXJuVXJsc1Jlc3BvbnNlEjUKC2ljZV9zZXJ2ZXJzGAEgAygLMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLkljZVNlcnZlchILCgN0dGwYAiABKAQSEgoKZXhwaXJlc19hdBgDIAEoBBI1CgZwb2xpY3kYBCABKA4yJS5jb20ucXVpY2sudm9pY2UucHJvdG8uSWNlQ29ubmVjdFR5cGUqRAoJVHJhY2tUeXBlEg4KCk1pY3JvcGhvbmUQABIKCgZDYW1lcmEQARIKCgZTY3JlZW4QAhIPCgtTeXN0ZW1Wb2ljZRADKj0KCENhbGxUeXBlEgoKBk5vcm1hbBAAEgsKB01lZXRpbmcQARIICgRMaXZlEAISDgoKQ29uZmVyZW5jZRADKnoKDlF1aXROb3RpZnlDb2RlEg4KCk5vcm1hbFF1aXQQABIMCgdUaW1lb3V0EOUPEhEKDFRva2VuRXhwaXJlZBDbDxIMCgdLaWNrT3V0EOYPEgoKBUVuZFBrEOcPEgwKB0VuZExpdmUQ6A8SDwoKRm9yY2VDbGVhchDpDypAChFBY2NlbGVyYXRpb25BcmVhcxIRCg1jaGluYU1haW5sYW5kEAASCgoGZ2xvYmFsEAESDAoIb3ZlcnNlYXMQAiolCgxDb3VudE1ldGhvZHMSCAoEZmxvdxAAEgsKB21pbnV0ZXMQASpBCgdOYXRUeXBlEg0KCVN5bW1ldHJpYxAAEggKBENvbmUQARIICgRQb3J0EAISBgoCSVAQAxILCgdVbktub3duEAQqLgoLTmV0d29ya1R5cGUSCAoEV2lmaRAAEgkKBVdpcmVkEAESCgoGTW9iaWxlEAIqUAoHUDJQQ29kZRILCgdTdWNjZXNzEAASCgoGRmFpbGVkEAESCgoGSWdub3JlEAISEAoMRGlzY29ubmVjdGVkEAMSDgoKTG93UXVhbGl0eRAEKmoKD1AyUElnbm9yZVJlYXNvbhIRCg1DSEFOTkVMX0xJTUlUEAASFwoTU1VCU0NSSUJFX05PVF9FWElTVBABEgsKB0J1c3lpbmcQAhITCg9UUkFDS19OT1RfRVhJU1QQAxIJCgVPVEhFUhAEKm8KCVAyUEFjdGlvbhIOCgpSZXZlcnNlVHJ5EAASFAoQUmV2ZXJzZVRyeUZhaWxlZBABEhIKDlJldmVyc2VTdWNjZXNzEAISEgoOQ29ubmVjdFN1Y2Nlc3MQAxIUChBSZXZlcnNlUHVzaERlbGF5EAQqeQoRSWNlQ3JlZGVudGlhbFR5cGUSIwofSUNFX0NSRURFTlRJQUxfVFlQRV9VTlNQRUNJRklFRBAAEiAKHElDRV9DUkVERU5USUFMX1RZUEVfUEFTU1dPUkQQARIdChlJQ0VfQ1JFREVOVElBTF9UWVBFX09BVVRIEAIqJAoOSWNlQ29ubmVjdFR5cGUSBwoDQWxsEAASCQoFUmVsYXkQAUJFChVjb20ucXVpY2sudm9pY2UucHJvdG9CCVJvb21Qcm90b1oVY29tLnF1aWNrLnZvaWNlLnByb3RvugIJUm9vbVByb3RvYgZwcm90bzM`),mo=X(Q,5),ho=X(Q,6),go=X(Q,7),_o=X(Q,8),vo=X(Q,9),yo=X(Q,10),bo=X(Q,11),xo=X(Q,12),So=X(Q,13),Co=X(Q,14),wo=X(Q,15),To=X(Q,16),Eo=X(Q,17),Do=X(Q,19),Oo=X(Q,20),ko=X(Q,21),Ao=X(Q,22),jo=X(Q,25),Mo=X(Q,26),No=X(Q,27),Po=X(Q,28),Fo=X(Q,29),Io=X(Q,30),Lo=X(Q,31),Ro=X(Q,34),zo=X(Q,35),Bo=X(Q,37),Vo=X(Q,38),Ho=X(Q,39),Uo=X(Q,40),Wo=X(Q,41),Go=X(Q,42),Ko=X(Q,43),qo=X(Q,44),Jo=X(Q,46),Yo=X(Q,47),Xo=X(Q,48),Zo=X(Q,50),Qo=X(Q,51),$o=X(Q,53),es=X(Q,54),ts=X(Q,55),ns=X(Q,56),rs=X(Q,57),is=X(Q,60),as=X(Q,61),os=X(Q,63),ss=X(Q,64),cs=X(Q,66),ls=Qa(`CglSdGMucHJvdG8SFWNvbS5xdWljay52b2ljZS5wcm90byJ8CghSdGNUcmFjaxIOCgZ1c2VySWQYASABKAkSCwoDbWlkGAIgASgJEhEKCXRyYWNrTmFtZRgDIAEoCRIuCgR0eXBlGAQgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlRyYWNrVHlwZRIQCghpc0FjdGl2ZRgFIAEoCCJTChBVcGRhdGVUcmFja1N0YXRlEg4KBnJvb21JZBgBIAEoCRIvCgZ0cmFja3MYAiADKAsyHy5jb20ucXVpY2sudm9pY2UucHJvdG8uUnRjVHJhY2sisAEKDFJ0Y1N0YXRzRGF0YRIOCgZ1c2VySWQYASABKAkSEQoJc3RhdHNUaW1lGAIgASgDEhUKDXJvdW5kVHJpcFRpbWUYAyABKAESFgoOdXBRdWFsaXR5U2NvcmUYBCABKAESGAoQZG93blF1YWxpdHlTY29yZRgFIAEoARI0CgVzdGF0cxgGIAMoCzIlLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFja1N0YXRzRGF0YSKRAQoOVHJhY2tTdGF0c0RhdGESLgoEdHlwZRgBIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5UcmFja1R5cGUSEQoJYmFuZHdpZHRoGAIgASgBEg4KBmppdHRlchgDIAEoARITCgtwYWNrZXRzTG9zdBgEIAEoAxIXCg9wYWNrZXRzTG9zdFJhdGUYBSABKAEiVAoOUnRjU3RhdHNOb3RpZnkSDgoGcm9vbUlkGAEgASgJEjIKBXN0YXRzGAIgAygLMiMuY29tLnF1aWNrLnZvaWNlLnByb3RvLlJ0Y1N0YXRzRGF0YSovCghSdGNFdmVudBIVChFVcGRhdGVUcmFja0FjdGl2ZRAAEgwKCFJ0Y1N0YXRzEAFCQwoVY29tLnF1aWNrLnZvaWNlLnByb3RvQghSdGNQcm90b1oVY29tLnF1aWNrLnZvaWNlLnByb3RvugIIUnRjUHJvdG9iBnByb3RvMw`,[Q]),us=X(ls,1),ds=X(ls,2),fs=X(ls,4),$=(e,t)=>to(e,Fr(e,t)),ps=e=>{let{sn:t,event:n,time:r,compress:i,data:a,valid:o,version:s}=e,c;switch(n){case`heartbeat`:case`heartbeatEx`:c=$(Xo,a);break;case`ackMsg`:c=$(Ko,a);break;case`reportNetwork`:c=$(Yo,a);break;case`connectCF`:c=$(_o,a);break;case`genTurnAddress`:c=new Uint8Array;break;case`publish`:c=$(yo,a);break;case`joinRoom`:case`joinRoomEx`:c=$(mo,a);break;case`pubNotify`:c=$(xo,a);break;case`subscribe`:c=$(So,a);break;case`pubChannel`:c=$(Ho,a);break;case`closeChannel`:case`subChannel`:c=$(Wo,a);break;case`renegotiate`:c=$(wo,a);break;case`closeTrack`:c=$(Po,a);break;case`preventUsersBehavior`:c=$(Ro,a);break;case`networkQualityChange`:c=$(Oo,a);break;case`updateCall`:c=$(Ao,a);break;case`toggleRoomSpeechLang`:c=$($o,a);break;case`syncRoomInfo`:c=$(jo,a);break;case`offer`:c=$(qo,a);break;case`answer`:c=$(qo,a);break;case`candidate`:c=$(Jo,a);break;case`reportP2PConnectEx`:c=$(ts,a);break;case`quitRoom`:case`quitRoomEx`:c=$(To,a);break;case`updateSimulcast`:c=$(So,a);break;case`updateRoomToken`:c=$(Do,a);break;case`UpdateTrackActive`:c=$(us,a);break;case`RtcStats`:case`rtcStats`:c=$(ds,a);break;default:c=new Uint8Array;break}let l=c.byteLength,u=c.byteLength;return i===!0&&(c=nr(c),u=c.byteLength),{res:$(fo,{event:n,data:c,sn:BigInt(t),compress:i,time:BigInt(r),valid:BigInt(o),version:s}),req:{...e,encBeforSize:l,encAfterSize:u}}},ms=e=>{let t=Z(po,new Uint8Array(e)),{code:n,sn:r,event:i,time:a,compress:o,valid:s,version:c,desc:l}=t,u=t.data,d=u.byteLength,f=u.byteLength,p;if(o)try{u=rr(u),f=u.byteLength}catch(e){console.error(`\\x1B[38;2;0;151;255m%c%s\\x1B[0m`,`color:#0097ff;`,`------->quickvo: 消息解压错误`,e)}switch(i){case`updateSeverTime`:p=Z(No,u);break;case`connectCF`:p=Z(vo,u);break;case`genTurnAddress`:p=Z(cs,u);break;case`publish`:p=Z(bo,u);break;case`joinRoom`:case`joinRoomEx`:p=Z(ho,u);break;case`subscribe`:p=Z(Co,u);break;case`pubChannel`:p=Z(Uo,u);break;case`closeChannel`:case`subChannel`:p=Z(Go,u);break;case`closeTrack`:p=Z(Fo,u);break;case`syncRoomInfo`:p=Z(Mo,u);break;case`onDataChannelPublish`:p=Z(Vo,u);break;case`onJoinRoom`:p=Z(go,u);break;case`onJoinRoomBatch`:p=Z(as,u);break;case`onPublish`:p=Z(xo,u);break;case`onCloseTrack`:p=Z(Io,u);break;case`onTrackInactive`:p=Z(Zo,u);break;case`onUpdateCall`:p=Z(Ao,u);break;case`onRoomActionChange`:p=Z(rs,u);break;case`onMeetSpecialRolesChange`:p=Z(is,u);break;case`onUpdatePermissions`:p=Z(Lo,u);break;case`onUpdatePermissionsBatch`:p=Z(ss,u);break;case`onNetQuality`:p=Z(ko,u);break;case`onCDNPlayUrlAdd`:p=Z(Bo,u);break;case`onUpdateBehavior`:p=Z(zo,u);break;case`onRoomUserSpeech`:p=Z(Qo,u);break;case`onAttemptP2PEx`:p=Z(es,u);break;case`onOffer`:p=Z(qo,u);break;case`onAnswer`:p=Z(qo,u);break;case`onCandidate`:p=Z(Jo,u);break;case`onDisconnectedP2P`:p=Z(ns,u);break;case`onQuitRoom`:p=Z(Eo,u);break;case`onQuitRoomBatch`:p=Z(os,u);break;case`onDestroyRoom`:p=Z(Eo,u);break;case`debugger`:case`ai`:p=JSON.parse(new TextDecoder().decode(u));break;case`UpdateTrackActive`:p=Z(us,u);break;case`RtcStats`:p=Z(ds,u);break;case`onRtcStats`:p=Z(fs,u);break;default:p={};break}let m=e=>{if(e){if(Array.isArray(e)){for(let t of e)m(t);return}if(typeof e==`object`){delete e.$typeName;let t=Object.keys(e);for(let n of t){let t=e[n];typeof t==`object`&&m(t)}}}};return m(p),{res:{event:i,data:p,sn:Number(r),time:Number(a),decBeforSize:d,decAfterSize:f,code:n,desc:l,compress:o,valid:Number(s),version:c},req:e}},hs=new class{on={};encodePaddings=[];decodePaddings=[];encodeFlushScheduled=!1;decodeFlushScheduled=!1;destroyed=!1;init=()=>{this.destroyed=!1,this.encodePaddings.length=0,this.decodePaddings.length=0,this.encodeFlushScheduled=!1,this.decodeFlushScheduled=!1};encode=e=>{this.destroyed||(this.encodePaddings.push(e),this.scheduleEncodeFlush())};decode=e=>{this.destroyed||(this.decodePaddings.push(e),this.scheduleDecodeFlush())};scheduleEncodeFlush=()=>{this.encodeFlushScheduled||(this.encodeFlushScheduled=!0,queueMicrotask(()=>{this.encodeFlushScheduled=!1,this.drainEncode()}))};scheduleDecodeFlush=()=>{this.decodeFlushScheduled||(this.decodeFlushScheduled=!0,queueMicrotask(()=>{this.decodeFlushScheduled=!1,this.drainDecode()}))};drainEncode=()=>{for(;this.encodePaddings.length>0&&!this.destroyed;){let e=this.encodePaddings.shift();try{let t=ps(e);this.on.encode?.(t)}catch(e){console.error(`quickvo WorkerCore: encode failed`,e)}}};drainDecode=()=>{for(;this.decodePaddings.length>0&&!this.destroyed;){let e=this.decodePaddings.shift();try{let t=ms(e);this.on.decode?.(t)}catch(e){console.error(`quickvo WorkerCore: decode failed`,e)}}};destroy=()=>{this.destroyed=!0,this.encodePaddings.length=0,this.decodePaddings.length=0}};hs.on.encode=e=>postMessage({action:`on.encode`,data:e}),hs.on.decode=e=>postMessage({action:`on.decode`,data:e}),onmessage=e=>{let{action:t,data:n}=e.data,r=hs[t];r&&r(n)}})();',td=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,ed],{type:`text/javascript;charset=utf-8`});function nd(e){let t;try{if(t=td&&(self.URL||self.webkitURL).createObjectURL(td),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(ed),{name:e?.name})}}var rd=`quickvo-protobuf`,id=class{worker=new nd({name:rd});on={};constructor(){this.worker.onmessage=e=>{let{action:t,data:n}=e.data;switch(t){case`on.encode`:this.on.encode&&this.on.encode(n);break;case`on.decode`:this.on.decode&&this.on.decode(n);break}}}init=()=>{this.worker.postMessage({action:`init`})};encode=e=>{this.worker.postMessage({action:`encode`,data:e})};decode=e=>{this.worker.postMessage({action:`decode`,data:e})};destroy=()=>{try{this.worker.postMessage({action:`destroy`})}catch{}this.worker.terminate()}},Q=[];Q.push(`heartbeat`),Q.push(`heartbeatEx`),Q.push(`networkQualityChange`),Q.push(`genTurnAddress`),Q.push(`reportNetwork`),Q.push(`rtcStats`),Q.push(`pubChannel`),Q.push(`closeChannel`),Q.push(`subChannel`),Q.push(`ackMsg`);var $=[];$.push(`heartbeat`),$.push(`heartbeatEx`),$.push(`networkQualityChange`),$.push(`genTurnAddress`),$.push(`updateCall`),$.push(`reportNetwork`),$.push(`rtcStats`),$.push(`pubChannel`),$.push(`subChannel`),$.push(`closeChannel`),$.push(`onDataChannelPublish`),$.push(`offer`),$.push(`candidate`),$.push(`answer`),$.push(`reportP2PConnectEx`),$.push(`onRoomUserSpeech`),$.push(`onNetQuality`),$.push(`onRtcStats`);var ad=[];ad.push(`heartbeat`),ad.push(`heartbeatEx`),ad.push(`rtcStats`),ad.push(`onRtcStats`),ad.push(`networkQualityChange`),ad.push(`onNetQuality`);var od=class e{config;timeout=30*1e3;prws=new Pu;workerProtos=new id;events=new Map;on={};_logBuffer=new Map;_logFlushTimer=0;static _LOG_FLUSH_DELAY=1e3;prResolves=new Zi;waitings={cwsConnected:async()=>this.prResolves.add(`cwsConnected`,()=>this.prws.ws?.readyState===1)};constructor({config:e}){this.config=e,this.prws.binaryType=`arraybuffer`,this.prws.getUrl=()=>this.config.createWsUrl(),this.workerProtos.on.encode=({res:e,req:t})=>{let{sn:n,event:r}=t;try{this.prws.send(e),this._updateLogs(`req`,t),this.config.debug&&!Q.includes(r)&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ff9700;padding:16px 0;`,`------->quickvo: 发送消息↑`,t);let i=this.events.get(r)?.get(n);i&&(i.needRetry=!1)}catch{}},this.workerProtos.on.decode=({res:e})=>{let{event:t,sn:n,time:r}=e;if(e.remoteTime=r,e.remoteTimeStr=M(r),e.time=new Date().getTime(),e.timeStr=M(e.time),this._updateLogs(`res`,e),this.config.debug&&!$.includes(t)&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ff0097;padding:16px 0;`,`------->quickvo: 响应消息↓`,e),Mu.includes(t)){let n=this.on[t],r=T(e,[`code`,`data`,`desc`]);n&&n(r);return}let i=this.events.get(t)?.get(n);if(i){let r=T(e,[`code`,`data`,`desc`,`sn`]);i.resolve(r),this.events.get(t)?.delete(n),this.events.get(t)?.size===0&&this.events.delete(t)}},this.prws.on.message=e=>{this.workerProtos.decode(e)},this.prws.on.checkReconnect=async e=>{switch(this.config.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: checkReconnect`,e),e.code){case 1e3:case 4001:case 4002:case 4003:this.on.state&&this.on.state(`closed`);break;case 4010:this.reconnect();break;default:if(this.config.isInRoom===!1)return;this.reconnect();break}}}needRestoreRoom=()=>{let e=new Date().getTime()-this.prws.activeTimeStamp,t=e>30*1e3;return t===!0&&this.config.debug&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: NeedRestoreRoom.`,{offsetTime:e}),t};isValid=()=>this.prws.ws?.readyState===1;connect=async()=>{this.on.state&&this.on.state(`connecting`);try{let e=await this.prws.connect();this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: 连接耗时-${e}ms`),await this.retryEvents(),this.prResolves.emit(`cwsConnected`),this.on.state&&this.on.state(`connected`)}catch(e){throw this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: 连接失败`,e),this.on.state&&this.on.state(`closed`),e}};reconnect=async()=>{this.on.state&&this.on.state(`reconnecting`),await this.prws.reconnect().then(async e=>{this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: 重连耗时-${e}ms`),await this.retryEvents(),this.prResolves.emit(`cwsConnected`),this.on.state&&this.on.state(`connected`)}).catch(e=>{this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: 重连失败`,e),this.on.state&&this.on.state(`closed`)})};close=()=>{this.prws.ws&&this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: cws is closed.`),this.prws.close(),this.clearEvents(),this._logFlushTimer&&=(clearTimeout(this._logFlushTimer),0),this._flushLogs()};createRequest=(e,t={})=>{let n=new Fu(e,this.prws,{timeout:this.timeout,...t});return n.sender=e=>{e.time=e.time||new Date().getTime(),e.timeStr=M(e.time),this.workerProtos.encode(e)},n.options.onBack===!0&&(this.events.has(e)||this.events.set(e,new Map),n.sn?this.events.get(e)?.set(n.sn,n):console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ff9700;padding:16px 0;`,`------->quickvo: This message is invalid. There is no valid SN.`,e,n.message)),n};hasEvent=e=>this.events.has(e);clearEvents=()=>{let e=this.events.values();for(let t of e){let e=t.values();for(let t of e)t.destroy()}this.events=new Map};retryEvents=async()=>{let e=this.events.values();for(let t of e){let e=t.values();for(let t of e)t.needRetry===!0&&t.retry()}};_updateLogs=(t,n={})=>{try{let{time:r,event:i,data:a={},data_remote:o,...s}=n,c=M(r,`YYYY-MM-DD hh:mm:ss`,{offset:480}),l={},u=`res ↓`;switch(t){case`res`:u=`res ↓`,l=Ru(a);break;case`req`:u=`req ↑`,l=Ru(a);break}let d=`#quickvo.logs`;(Q.includes(i)||$.includes(i))&&(d=`#quickvo.ignoreEvents`);let f={"#action":u,timeStr:c,event:i,data:l,time:r,...s};this.on.log&&this.on.log(f),this._logBuffer.has(d)||this._logBuffer.set(d,[]),this._logBuffer.get(d).push(f),this._logFlushTimer===0&&(this._logFlushTimer=window.setTimeout(()=>{this._flushLogs()},e._LOG_FLUSH_DELAY))}catch(e){this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: updateLogs is error`,e)}};_flushLogs=async()=>{this._logFlushTimer&&=(clearTimeout(this._logFlushTimer),0);let e=this._logBuffer.keys();for(let t of e){let e=this._logBuffer.get(t);if(e.length===0)continue;this._logBuffer.set(t,[]);let n=[];try{n=await Zu(t)}catch{n=[]}let r=e.slice().reverse(),i=new Map,a=[],o=e=>{let{event:t}=e;if(!ad.includes(t)){a.push(e);return}let n=i.get(t);if(n||(n={req:!1,res:!1},i.set(t,n)),e[`#action`]?.includes(`req`)){if(n.req)return;n.req=!0}else if(e[`#action`]?.includes(`res`)){if(n.res)return;n.res=!0}a.push(e)};for(let e of r)if(o(e),a.length>=200)break;if(a.length<200){for(let e of n)if(o(e),a.length>=200)break}try{await Qu(t,a)}catch(e){this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: saveCallLogs failed`,e)}}}},sd=`#quickvo.logs`;async function cd(){let e=$u(await Zu(sd)),t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json;charset=utf-8`}),r=URL.createObjectURL(n);try{let e=document.createElement(`a`);e.href=r,e.download=`quickvo-logs-${new Date().toISOString().replace(/[:.]/g,`-`)}.json`,e.rel=`noopener`,document.body.appendChild(e),e.click(),e.remove()}finally{URL.revokeObjectURL(r)}}if(typeof window<`u`&&typeof Window<`u`){let e=Window.prototype;e.getQVLogs||=function(){return cd()}}function ld(e){if(typeof e==`function`)return e;if(typeof e==`object`&&e&&`default`in e){let t=e.default;if(typeof t==`function`)return t;if(typeof t==`object`&&t&&`default`in t&&typeof t.default==`function`)return t.default}throw TypeError(`fixWebmDuration is not a function`)}var ud='(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),u=o((e=>{(function(e){var t=`undefined`,n=t!==typeof Buffer&&Buffer,r=t!==typeof Uint8Array&&Uint8Array,i=t!==typeof ArrayBuffer&&ArrayBuffer,a=[0,0,0,0,0,0,0,0],o=Array.isArray||x,s=4294967296,c=16777216,l;u(`Uint64BE`,!0,!0),u(`Int64BE`,!0,!1),u(`Uint64LE`,!1,!0),u(`Int64LE`,!1,!1);function u(o,u,x){var S=u?0:4,C=u?4:0,w=u?0:3,T=u?1:2,E=u?2:1,D=u?3:0,O=u?_:y,k=u?v:b,A=N.prototype,j=`is`+o,M=`_`+j;return A.buffer=void 0,A.offset=0,A[M]=!0,A.toNumber=F,A.toString=I,A.toJSON=F,A.toArray=d,n&&(A.toBuffer=f),r&&(A.toArrayBuffer=p),N[j]=ee,e[o]=N,N;function N(e,t,n,r){return this instanceof N?te(this,e,t,n,r):new N(e,t,n,r)}function ee(e){return!!(e&&e[M])}function te(e,o,s,c,u){if(r&&i&&(o instanceof i&&(o=new r(o)),c instanceof i&&(c=new r(c))),!o&&!s&&!c&&!l){e.buffer=g(a,0);return}if(!m(o,s)){var d=l||Array;u=s,c=o,s=0,o=l===n?n.alloc(8):new d(8)}e.buffer=o,e.offset=s|=0,t!==typeof c&&(typeof c==`string`?P(o,s,c,u||10):m(c,u)?h(o,s,c,u):typeof u==`number`?(L(o,s+S,c),L(o,s+C,u)):c>0?O(o,s,c):c<0?k(o,s,c):h(o,s,a,0))}function P(e,t,n,r){var i=0,a=n.length,o=0,c=0;n[0]===`-`&&i++;for(var l=i;i<a;){var u=parseInt(n[i++],r);if(!(u>=0))break;c=c*r+u,o=o*r+Math.floor(c/s),c%=s}l&&(o=~o,c?c=s-c:o++),L(e,t+S,o),L(e,t+C,c)}function F(){var e=this.buffer,t=this.offset,n=R(e,t+S),r=R(e,t+C);return x||(n|=0),n?n*s+r:r}function I(e){var t=this.buffer,n=this.offset,r=R(t,n+S),i=R(t,n+C),a=``,o=!x&&r&2147483648;for(o&&(r=~r,i=s-i),e||=10;;){var c=r%e*s+i;if(r=Math.floor(r/e),i=Math.floor(c/e),a=(c%e).toString(e)+a,!r&&!i)break}return o&&(a=`-`+a),a}function L(e,t,n){e[t+D]=n&255,n>>=8,e[t+E]=n&255,n>>=8,e[t+T]=n&255,n>>=8,e[t+w]=n&255}function R(e,t){return e[t+w]*c+(e[t+T]<<16)+(e[t+E]<<8)+e[t+D]}}function d(e){var t=this.buffer,n=this.offset;return l=null,e!==!1&&o(t)?t.length===8?t:t.slice(n,n+8):g(t,n)}function f(e){var t=this.buffer,r=this.offset;return l=n,e!==!1&&n.isBuffer(t)?t.length===8?t:t.slice(r,r+8):n.from(p.call(this,e))}function p(e){var t=this.buffer,n=this.offset,a=t.buffer;if(l=r,e!==!1&&!t.offset&&a instanceof i)return a.byteLength===8?a:a.slice(n,n+8);var o=new r(8);return h(o,0,t,n),o.buffer}function m(e,t){var n=e&&e.length;return t|=0,n&&t+8<=n&&typeof e[t]!=`string`}function h(e,t,n,r){t|=0,r|=0;for(var i=0;i<8;i++)e[t++]=n[r++]&255}function g(e,t){return Array.prototype.slice.call(e,t,t+8)}function _(e,t,n){for(var r=t+8;r>t;)e[--r]=n&255,n/=256}function v(e,t,n){var r=t+8;for(n++;r>t;)e[--r]=-n&255^255,n/=256}function y(e,t,n){for(var r=t+8;t<r;)e[t++]=n&255,n/=256}function b(e,t,n){var r=t+8;for(n++;t<r;)e[t++]=-n&255^255,n/=256}function x(e){return!!e&&Object.prototype.toString.call(e)==`[object Array]`}})(typeof e==`object`&&typeof e.nodeName!=`string`?e:e||{})})),d=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.byEbmlID=void 0,e.byEbmlID={128:{name:`ChapterDisplay`,level:4,type:`m`,multiple:!0,minver:1,webm:!0,description:`Contains all possible strings to use for the chapter display.`},131:{name:`TrackType`,level:3,type:`u`,mandatory:!0,minver:1,range:`1-254`,description:`A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).`},133:{name:`ChapString`,cppname:`ChapterString`,level:5,type:`8`,mandatory:!0,minver:1,webm:!0,description:`Contains the string to use as the chapter atom.`},134:{name:`CodecID`,level:3,type:`s`,mandatory:!0,minver:1,description:`An ID corresponding to the codec, see the codec page for more info.`},136:{name:`FlagDefault`,cppname:`TrackFlagDefault`,level:3,type:`u`,mandatory:!0,minver:1,default:1,range:`0-1`,description:`Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)`},137:{name:`ChapterTrackNumber`,level:5,type:`u`,mandatory:!0,multiple:!0,minver:1,webm:!1,range:`not 0`,description:`UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks.`},145:{name:`ChapterTimeStart`,level:4,type:`u`,mandatory:!0,minver:1,webm:!0,description:`Timestamp of the start of Chapter (not scaled).`},146:{name:`ChapterTimeEnd`,level:4,type:`u`,minver:1,webm:!1,description:`Timestamp of the end of Chapter (timestamp excluded, not scaled).`},150:{name:`CueRefTime`,level:5,type:`u`,mandatory:!0,minver:2,webm:!1,description:`Timestamp of the referenced Block.`},151:{name:`CueRefCluster`,level:5,type:`u`,mandatory:!0,webm:!1,description:`The Position of the Cluster containing the referenced Block.`},152:{name:`ChapterFlagHidden`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,range:`0-1`,description:`If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)`},16980:{name:`ContentCompAlgo`,level:6,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`The compression algorithm used. Algorithms that have been specified so far are: 0 - zlib, 3 - Header Stripping`},16981:{name:`ContentCompSettings`,level:6,type:`b`,minver:1,webm:!1,description:`Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track.`},17026:{name:`DocType`,level:1,type:`s`,mandatory:!0,default:`matroska`,minver:1,description:`A string that describes the type of document that follows this EBML header. \'matroska\' in our case or \'webm\' for webm files.`},17029:{name:`DocTypeReadVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The minimum DocType version an interpreter has to support to read this file.`},17030:{name:`EBMLVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The version of EBML parser used to create the file.`},17031:{name:`DocTypeVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The version of DocType interpreter used to create the file.`},17476:{name:`SegmentFamily`,level:2,type:`b`,multiple:!0,minver:1,webm:!1,bytesize:16,description:`A randomly generated unique ID that all segments related to each other must use (128 bits).`},17505:{name:`DateUTC`,level:2,type:`d`,minver:1,description:`Date of the origin of timestamp (value 0), i.e. production date.`},17540:{name:`TagDefault`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`0-1`,description:`Indication to know if this is the default/original language to use for the given tag. (1 bit)`},17541:{name:`TagBinary`,level:4,type:`b`,minver:1,webm:!1,description:`The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.`},17543:{name:`TagString`,level:4,type:`8`,minver:1,webm:!1,description:`The value of the Element.`},17545:{name:`Duration`,level:2,type:`f`,minver:1,range:`> 0`,description:`Duration of the segment (based on TimecodeScale).`},17816:{name:`ChapterFlagEnabled`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`0-1`,description:`Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)`},18016:{name:`FileMimeType`,level:3,type:`s`,mandatory:!0,minver:1,webm:!1,description:`MIME type of the file.`},18017:{name:`FileUsedStartTime`,level:3,type:`u`,divx:!0,description:`DivX font extension`},18018:{name:`FileUsedEndTime`,level:3,type:`u`,divx:!0,description:`DivX font extension`},18037:{name:`FileReferral`,level:3,type:`b`,webm:!1,description:`A binary value that a track/codec can refer to when the attachment is needed.`},20529:{name:`ContentEncodingOrder`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment.`},20530:{name:`ContentEncodingScope`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`not 0`,description:`A bit field that describes which elements have been modified in this way. Values (big endian) can be OR\'ed. Possible values: 1 - all frame contents, 2 - the track\'s private data, 4 - the next ContentEncoding (next ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)`},20531:{name:`ContentEncodingType`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`A value describing what kind of transformation has been done. Possible values: 0 - compression, 1 - encryption`},20532:{name:`ContentCompression`,level:5,type:`m`,minver:1,webm:!1,description:`Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking.`},20533:{name:`ContentEncryption`,level:5,type:`m`,minver:1,webm:!1,description:`Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise.`},21368:{name:`CueBlockNumber`,level:4,type:`u`,minver:1,default:1,range:`not 0`,description:`Number of the Block in the specified Cluster.`},22100:{name:`ChapterStringUID`,level:4,type:`8`,mandatory:!1,minver:3,webm:!0,description:`A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage.`},22337:{name:`WritingApp`,level:2,type:`8`,mandatory:!0,minver:1,description:`Writing application ("mkvmerge-0.3.3").`},22612:{name:`SilentTracks`,cppname:`ClusterSilentTracks`,level:2,type:`m`,minver:1,webm:!1,description:`The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use.`},25152:{name:`ContentEncoding`,level:4,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Settings for one content encoding like compression or encryption.`},25188:{name:`BitDepth`,cppname:`AudioBitDepth`,level:4,type:`u`,minver:1,range:`not 0`,description:`Bits per sample, mostly used for PCM.`},25906:{name:`SignedElement`,level:3,type:`b`,multiple:!0,webm:!1,description:`An element ID whose data will be used to compute the signature.`},26148:{name:`TrackTranslate`,level:3,type:`m`,multiple:!0,minver:1,webm:!1,description:`The track identification for the given Chapter Codec.`},26897:{name:`ChapProcessCommand`,cppname:`ChapterProcessCommand`,level:5,type:`m`,multiple:!0,minver:1,webm:!1,description:`Contains all the commands associated to the Atom.`},26914:{name:`ChapProcessTime`,cppname:`ChapterProcessTime`,level:6,type:`u`,mandatory:!0,minver:1,webm:!1,description:`Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter).`},26916:{name:`ChapterTranslate`,level:2,type:`m`,multiple:!0,minver:1,webm:!1,description:`A tuple of corresponding ID used by chapter codecs to represent this segment.`},26931:{name:`ChapProcessData`,cppname:`ChapterProcessData`,level:6,type:`b`,mandatory:!0,minver:1,webm:!1,description:`Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands.`},26948:{name:`ChapProcess`,cppname:`ChapterProcess`,level:4,type:`m`,multiple:!0,minver:1,webm:!1,description:`Contains all the commands associated to the Atom.`},26965:{name:`ChapProcessCodecID`,cppname:`ChapterProcessCodecID`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later.`},29555:{name:`Tag`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Element containing elements specific to Tracks/Chapters.`},29572:{name:`SegmentFilename`,level:2,type:`8`,minver:1,webm:!1,description:`A filename corresponding to this segment.`},29766:{name:`AttachmentLink`,cppname:`TrackAttachmentLink`,level:3,type:`u`,minver:1,webm:!1,range:`not 0`,description:`The UID of an attachment that is used by this codec.`},2459272:{name:`CodecName`,level:3,type:`8`,minver:1,description:`A human-readable string specifying the codec.`},408125543:{name:`Segment`,level:`0`,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment.`},17530:{name:`TagLanguage`,level:4,type:`s`,mandatory:!0,minver:1,webm:!1,default:`und`,description:`Specifies the language of the tag specified, in the Matroska languages form.`},17827:{name:`TagName`,level:4,type:`8`,mandatory:!0,minver:1,webm:!1,description:`The name of the Tag that is going to be stored.`},26568:{name:`SimpleTag`,cppname:`TagSimple`,level:3,recursive:`1`,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Contains general information about the target.`},25542:{name:`TagAttachmentUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment.`},25540:{name:`TagChapterUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment.`},25545:{name:`TagEditionUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment.`},25541:{name:`TagTrackUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment.`},25546:{name:`TargetType`,cppname:`TagTargetType`,level:4,type:`s`,minver:1,webm:!1,strong:`informational`,description:`An string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).`},26826:{name:`TargetTypeValue`,cppname:`TagTargetTypeValue`,level:4,type:`u`,minver:1,webm:!1,default:50,description:`A number to indicate the logical level of the target (see TargetType).`},25536:{name:`Targets`,cppname:`TagTargets`,level:3,type:`m`,mandatory:!0,minver:1,webm:!1,description:`Contain all UIDs where the specified meta data apply. It is empty to describe everything in the segment.`},307544935:{name:`Tags`,level:1,type:`m`,multiple:!0,minver:1,webm:!1,description:`Element containing elements specific to Tracks/Chapters. A list of valid tags can be found here.`},17677:{name:`ChapProcessPrivate`,cppname:`ChapterProcessPrivate`,level:5,type:`b`,minver:1,webm:!1,description:`Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.`},17278:{name:`ChapCountry`,cppname:`ChapterCountry`,level:5,type:`s`,multiple:!0,minver:1,webm:!1,description:`The countries corresponding to the string, same 2 octets as in Internet domains.`},17276:{name:`ChapLanguage`,cppname:`ChapterLanguage`,level:5,type:`s`,mandatory:!0,multiple:!0,minver:1,webm:!0,default:`eng`,description:`The languages corresponding to the string, in the bibliographic ISO-639-2 form.`},143:{name:`ChapterTrack`,level:4,type:`m`,minver:1,webm:!1,description:`List of tracks on which the chapter applies. If this element is not present, all tracks apply`},25539:{name:`ChapterPhysicalEquiv`,level:4,type:`u`,minver:1,webm:!1,description:`Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.`},28348:{name:`ChapterSegmentEditionUID`,level:4,type:`u`,minver:1,webm:!1,range:`not 0`,description:`The EditionUID to play from the segment linked in ChapterSegmentUID.`},28263:{name:`ChapterSegmentUID`,level:4,type:`b`,minver:1,webm:!1,range:`>0`,bytesize:16,description:`A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used.`},29636:{name:`ChapterUID`,level:4,type:`u`,mandatory:!0,minver:1,webm:!0,range:`not 0`,description:`A unique ID to identify the Chapter.`},182:{name:`ChapterAtom`,level:3,recursive:`1`,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!0,description:`Contains the atom information to use as the chapter atom (apply to all tracks).`},17885:{name:`EditionFlagOrdered`,level:3,type:`u`,minver:1,webm:!1,default:0,range:`0-1`,description:`Specify if the chapters can be defined multiple times and the order to play them is enforced. (1 bit)`},17883:{name:`EditionFlagDefault`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,range:`0-1`,description:`If a flag is set (1) the edition should be used as the default one. (1 bit)`},17853:{name:`EditionFlagHidden`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,range:`0-1`,description:`If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)`},17852:{name:`EditionUID`,level:3,type:`u`,minver:1,webm:!1,range:`not 0`,description:`A unique ID to identify the edition. It\'s useful for tagging an edition.`},17849:{name:`EditionEntry`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!0,description:`Contains all information about a segment edition.`},272869232:{name:`Chapters`,level:1,type:`m`,minver:1,webm:!0,description:`A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.`},18094:{name:`FileUID`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,range:`not 0`,description:`Unique ID representing the file, as random as possible.`},18012:{name:`FileData`,level:3,type:`b`,mandatory:!0,minver:1,webm:!1,description:`The data of the file.`},18030:{name:`FileName`,level:3,type:`8`,mandatory:!0,minver:1,webm:!1,description:`Filename of the attached file.`},18046:{name:`FileDescription`,level:3,type:`8`,minver:1,webm:!1,description:`A human-friendly name for the attached file.`},24999:{name:`AttachedFile`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`An attached file.`},423732329:{name:`Attachments`,level:1,type:`m`,minver:1,webm:!1,description:`Contain attached files.`},235:{name:`CueRefCodecState`,level:5,type:`u`,webm:!1,default:0,description:`The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry.`},21343:{name:`CueRefNumber`,level:5,type:`u`,webm:!1,default:1,range:`not 0`,description:`Number of the referenced Block of Track X in the specified Cluster.`},219:{name:`CueReference`,level:4,type:`m`,multiple:!0,minver:2,webm:!1,description:`The Clusters containing the required referenced Blocks.`},234:{name:`CueCodecState`,level:4,type:`u`,minver:2,webm:!1,default:0,description:`The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry.`},178:{name:`CueDuration`,level:4,type:`u`,mandatory:!1,minver:4,webm:!1,description:`The duration of the block according to the segment time base. If missing the track\'s DefaultDuration does not apply and no duration information is available in terms of the cues.`},240:{name:`CueRelativePosition`,level:4,type:`u`,mandatory:!1,minver:4,webm:!1,description:`The relative position of the referenced block inside the cluster with 0 being the first possible position for an element inside that cluster.`,position:`clusterRelative`},241:{name:`CueClusterPosition`,level:4,type:`u`,mandatory:!0,minver:1,description:`The position of the Cluster containing the required Block.`,position:`segment`},247:{name:`CueTrack`,level:4,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`The track for which a position is given.`},183:{name:`CueTrackPositions`,level:3,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contain positions for different tracks corresponding to the timestamp.`},179:{name:`CueTime`,level:3,type:`u`,mandatory:!0,minver:1,description:`Absolute timestamp according to the segment time base.`},187:{name:`CuePoint`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains all information relative to a seek point in the segment.`},475249515:{name:`Cues`,level:1,type:`m`,minver:1,description:`A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.`},18406:{name:`ContentSigHashAlgo`,level:6,type:`u`,minver:1,webm:!1,default:0,description:`The hash algorithm used for the signature. A value of \'0\' means that the contents have not been signed but only encrypted. Predefined values: 1 - SHA1-160 2 - MD5`},18405:{name:`ContentSigAlgo`,level:6,type:`u`,minver:1,webm:!1,default:0,description:`The algorithm used for the signature. A value of \'0\' means that the contents have not been signed but only encrypted. Predefined values: 1 - RSA`},18404:{name:`ContentSigKeyID`,level:6,type:`b`,minver:1,webm:!1,description:`This is the ID of the private key the data was signed with.`},18403:{name:`ContentSignature`,level:6,type:`b`,minver:1,webm:!1,description:`A cryptographic signature of the contents.`},18402:{name:`ContentEncKeyID`,level:6,type:`b`,minver:1,webm:!1,description:`For public key algorithms this is the ID of the public key the the data was encrypted with.`},18401:{name:`ContentEncAlgo`,level:6,type:`u`,minver:1,webm:!1,default:0,description:`The encryption algorithm used. The value \'0\' means that the contents have not been encrypted but only signed. Predefined values: 1 - DES, 2 - 3DES, 3 - Twofish, 4 - Blowfish, 5 - AES`},28032:{name:`ContentEncodings`,level:3,type:`m`,minver:1,webm:!1,description:`Settings for several content encoding mechanisms like compression or encryption.`},196:{name:`TrickMasterTrackSegmentUID`,level:3,type:`b`,divx:!0,bytesize:16,description:`DivX trick track extenstions`},199:{name:`TrickMasterTrackUID`,level:3,type:`u`,divx:!0,description:`DivX trick track extenstions`},198:{name:`TrickTrackFlag`,level:3,type:`u`,divx:!0,default:0,description:`DivX trick track extenstions`},193:{name:`TrickTrackSegmentUID`,level:3,type:`b`,divx:!0,bytesize:16,description:`DivX trick track extenstions`},192:{name:`TrickTrackUID`,level:3,type:`u`,divx:!0,description:`DivX trick track extenstions`},237:{name:`TrackJoinUID`,level:5,type:`u`,mandatory:!0,multiple:!0,minver:3,webm:!1,range:`not 0`,description:`The trackUID number of a track whose blocks are used to create this virtual track.`},233:{name:`TrackJoinBlocks`,level:4,type:`m`,minver:3,webm:!1,description:`Contains the list of all tracks whose Blocks need to be combined to create this virtual track`},230:{name:`TrackPlaneType`,level:6,type:`u`,mandatory:!0,minver:3,webm:!1,description:`The kind of plane this track corresponds to (0: left eye, 1: right eye, 2: background).`},229:{name:`TrackPlaneUID`,level:6,type:`u`,mandatory:!0,minver:3,webm:!1,range:`not 0`,description:`The trackUID number of the track representing the plane.`},228:{name:`TrackPlane`,level:5,type:`m`,mandatory:!0,multiple:!0,minver:3,webm:!1,description:`Contains a video plane track that need to be combined to create this 3D track`},227:{name:`TrackCombinePlanes`,level:4,type:`m`,minver:3,webm:!1,description:`Contains the list of all video plane tracks that need to be combined to create this 3D track`},226:{name:`TrackOperation`,level:3,type:`m`,minver:3,webm:!1,description:`Operation that needs to be applied on tracks to create this virtual track. For more details look at the Specification Notes on the subject.`},32123:{name:`ChannelPositions`,cppname:`AudioPosition`,level:4,type:`b`,webm:!1,description:`Table of horizontal angles for each successive channel, see appendix.`},159:{name:`Channels`,cppname:`AudioChannels`,level:4,type:`u`,mandatory:!0,minver:1,default:1,range:`not 0`,description:`Numbers of channels in the track.`},30901:{name:`OutputSamplingFrequency`,cppname:`AudioOutputSamplingFreq`,level:4,type:`f`,minver:1,default:`Sampling Frequency`,range:`> 0`,description:`Real output sampling frequency in Hz (used for SBR techniques).`},181:{name:`SamplingFrequency`,cppname:`AudioSamplingFreq`,level:4,type:`f`,mandatory:!0,minver:1,default:8e3,range:`> 0`,description:`Sampling frequency in Hz.`},225:{name:`Audio`,cppname:`TrackAudio`,level:3,type:`m`,minver:1,description:`Audio settings.`},2327523:{name:`FrameRate`,cppname:`VideoFrameRate`,level:4,type:`f`,range:`> 0`,strong:`Informational`,description:`Number of frames per second. only.`},3126563:{name:`GammaValue`,cppname:`VideoGamma`,level:4,type:`f`,webm:!1,range:`> 0`,description:`Gamma Value.`},3061028:{name:`ColourSpace`,cppname:`VideoColourSpace`,level:4,type:`b`,minver:1,webm:!1,bytesize:4,description:`Same value as in AVI (32 bits).`},21683:{name:`AspectRatioType`,cppname:`VideoAspectRatio`,level:4,type:`u`,minver:1,default:0,description:`Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).`},21682:{name:`DisplayUnit`,cppname:`VideoDisplayUnit`,level:4,type:`u`,minver:1,default:0,description:`How DisplayWidth & DisplayHeight should be interpreted (0: pixels, 1: centimeters, 2: inches, 3: Display Aspect Ratio).`},21690:{name:`DisplayHeight`,cppname:`VideoDisplayHeight`,level:4,type:`u`,minver:1,default:`PixelHeight`,range:`not 0`,description:`Height of the video frames to display. The default value is only valid when DisplayUnit is 0.`},21680:{name:`DisplayWidth`,cppname:`VideoDisplayWidth`,level:4,type:`u`,minver:1,default:`PixelWidth`,range:`not 0`,description:`Width of the video frames to display. The default value is only valid when DisplayUnit is 0.`},21725:{name:`PixelCropRight`,cppname:`VideoPixelCropRight`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove on the right of the image.`},21708:{name:`PixelCropLeft`,cppname:`VideoPixelCropLeft`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove on the left of the image.`},21691:{name:`PixelCropTop`,cppname:`VideoPixelCropTop`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove at the top of the image.`},21674:{name:`PixelCropBottom`,cppname:`VideoPixelCropBottom`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove at the bottom of the image (for HDTV content).`},186:{name:`PixelHeight`,cppname:`VideoPixelHeight`,level:4,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`Height of the encoded video frames in pixels.`},176:{name:`PixelWidth`,cppname:`VideoPixelWidth`,level:4,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`Width of the encoded video frames in pixels.`},21433:{name:`OldStereoMode`,level:4,type:`u`,maxver:`0`,webm:!1,divx:!1,description:`DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska. (0: mono, 1: right eye, 2: left eye, 3: both eyes).`},21440:{name:`AlphaMode`,cppname:`VideoAlphaMode`,level:4,type:`u`,minver:3,webm:!0,default:0,description:`Alpha Video Mode. Presence of this element indicates that the BlockAdditional element could contain Alpha data.`},21432:{name:`StereoMode`,cppname:`VideoStereoMode`,level:4,type:`u`,minver:3,webm:!0,default:0,description:`Stereo-3D video mode (0: mono, 1: side by side (left eye is first), 2: top-bottom (right eye is first), 3: top-bottom (left eye is first), 4: checkboard (right is first), 5: checkboard (left is first), 6: row interleaved (right is first), 7: row interleaved (left is first), 8: column interleaved (right is first), 9: column interleaved (left is first), 10: anaglyph (cyan/red), 11: side by side (right eye is first), 12: anaglyph (green/magenta), 13 both eyes laced in one Block (left eye is first), 14 both eyes laced in one Block (right eye is first)) . There are some more details on 3D support in the Specification Notes.`},154:{name:`FlagInterlaced`,cppname:`VideoFlagInterlaced`,level:4,type:`u`,mandatory:!0,minver:2,webm:!0,default:0,range:`0-1`,description:`Set if the video is interlaced. (1 bit)`},224:{name:`Video`,cppname:`TrackVideo`,level:3,type:`m`,minver:1,description:`Video settings.`},26277:{name:`TrackTranslateTrackID`,level:4,type:`b`,mandatory:!0,minver:1,webm:!1,description:`The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used.`},26303:{name:`TrackTranslateCodec`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,description:`The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).`},26364:{name:`TrackTranslateEditionUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,description:`Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment.`},22203:{name:`SeekPreRoll`,level:3,type:`u`,mandatory:!0,multiple:!1,default:0,minver:4,webm:!0,description:`After a discontinuity, SeekPreRoll is the duration in nanoseconds of the data the decoder must decode before the decoded data is valid.`},22186:{name:`CodecDelay`,level:3,type:`u`,multiple:!1,default:0,minver:4,webm:!0,description:`CodecDelay is The codec-built-in delay in nanoseconds. This value must be subtracted from each block timestamp in order to get the actual timestamp. The value should be small so the muxing of tracks with the same actual timestamp are in the same Cluster.`},28587:{name:`TrackOverlay`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc.`},170:{name:`CodecDecodeAll`,level:3,type:`u`,mandatory:!0,minver:2,webm:!1,default:1,range:`0-1`,description:`The codec can decode potentially damaged data (1 bit).`},2536e3:{name:`CodecDownloadURL`,level:3,type:`s`,multiple:!0,webm:!1,description:`A URL to download about the codec used.`},3883072:{name:`CodecInfoURL`,level:3,type:`s`,multiple:!0,webm:!1,description:`A URL to find information about the codec used.`},3839639:{name:`CodecSettings`,level:3,type:`8`,webm:!1,description:`A string describing the encoding setting used.`},25506:{name:`CodecPrivate`,level:3,type:`b`,minver:1,description:`Private data only known to the codec.`},2274716:{name:`Language`,cppname:`TrackLanguage`,level:3,type:`s`,minver:1,default:`eng`,description:`Specifies the language of the track in the Matroska languages form.`},21358:{name:`Name`,cppname:`TrackName`,level:3,type:`8`,minver:1,description:`A human-readable track name.`},21998:{name:`MaxBlockAdditionID`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`The maximum value of BlockAdditions for this track.`},21375:{name:`TrackOffset`,level:3,type:`i`,webm:!1,default:0,description:`A value to add to the Block\'s Timestamp. This can be used to adjust the playback offset of a track.`},2306383:{name:`TrackTimecodeScale`,level:3,type:`f`,mandatory:!0,minver:1,maxver:`3`,webm:!1,default:1,range:`> 0`,description:`DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs).`},2313850:{name:`DefaultDecodedFieldDuration`,cppname:`TrackDefaultDecodedFieldDuration`,level:3,type:`u`,minver:4,range:`not 0`,description:`The period in nanoseconds (not scaled by TimcodeScale)\nbetween two successive fields at the output of the decoding process (see the notes)`},2352003:{name:`DefaultDuration`,cppname:`TrackDefaultDuration`,level:3,type:`u`,minver:1,range:`not 0`,description:`Number of nanoseconds (not scaled via TimecodeScale) per frame (\'frame\' in the Matroska sense -- one element put into a (Simple)Block).`},28152:{name:`MaxCache`,cppname:`TrackMaxCache`,level:3,type:`u`,minver:1,webm:!1,description:`The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.`},28135:{name:`MinCache`,cppname:`TrackMinCache`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used.`},156:{name:`FlagLacing`,cppname:`TrackFlagLacing`,level:3,type:`u`,mandatory:!0,minver:1,default:1,range:`0-1`,description:`Set if the track may contain blocks using lacing. (1 bit)`},21930:{name:`FlagForced`,cppname:`TrackFlagForced`,level:3,type:`u`,mandatory:!0,minver:1,default:0,range:`0-1`,description:`Set if that track MUST be active during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit)`},185:{name:`FlagEnabled`,cppname:`TrackFlagEnabled`,level:3,type:`u`,mandatory:!0,minver:2,webm:!0,default:1,range:`0-1`,description:`Set if the track is usable. (1 bit)`},29637:{name:`TrackUID`,level:3,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file.`},215:{name:`TrackNumber`,level:3,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).`},174:{name:`TrackEntry`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Describes a track with all elements.`},374648427:{name:`Tracks`,level:1,type:`m`,multiple:!0,minver:1,description:`A top-level block of information with many tracks described.`},175:{name:`EncryptedBlock`,level:2,type:`b`,multiple:!0,webm:!1,description:`Similar to EncryptedBlock Structure)`},202:{name:`ReferenceTimeCode`,level:4,type:`u`,multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},201:{name:`ReferenceOffset`,level:4,type:`u`,multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},200:{name:`ReferenceFrame`,level:3,type:`m`,multiple:!1,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},207:{name:`SliceDuration`,level:5,type:`u`,default:0,description:`The (scaled) duration to apply to the element.`},206:{name:`Delay`,cppname:`SliceDelay`,level:5,type:`u`,default:0,description:`The (scaled) delay to apply to the element.`},203:{name:`BlockAdditionID`,cppname:`SliceBlockAddID`,level:5,type:`u`,default:0,description:`The ID of the BlockAdditional element (0 is the main Block).`},205:{name:`FrameNumber`,cppname:`SliceFrameNumber`,level:5,type:`u`,default:0,description:`The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).`},204:{name:`LaceNumber`,cppname:`SliceLaceNumber`,level:5,type:`u`,minver:1,default:0,divx:!1,description:`The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.`},232:{name:`TimeSlice`,level:4,type:`m`,multiple:!0,minver:1,divx:!1,description:`Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.`},142:{name:`Slices`,level:3,type:`m`,minver:1,divx:!1,description:`Contains slices description.`},30114:{name:`DiscardPadding`,level:3,type:`i`,minver:4,webm:!0,description:`Duration in nanoseconds of the silent data added to the Block (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and should be discarded during playback.`},164:{name:`CodecState`,level:3,type:`b`,minver:2,webm:!1,description:`The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry.`},253:{name:`ReferenceVirtual`,level:3,type:`i`,webm:!1,description:`Relative position of the data that should be in position of the virtual block.`},251:{name:`ReferenceBlock`,level:3,type:`i`,multiple:!0,minver:1,description:`Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it\'s attached to.`},250:{name:`ReferencePriority`,cppname:`FlagReferenced`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced.`},155:{name:`BlockDuration`,level:3,type:`u`,minver:1,default:`TrackDuration`,description:`The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track (but can be omitted as other default values). When not written and with no DefaultDuration, the value is assumed to be the difference between the timestamp of this Block and the timestamp of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. When set to 0 that means the frame is not a keyframe.`},165:{name:`BlockAdditional`,level:5,type:`b`,mandatory:!0,minver:1,webm:!1,description:`Interpreted by the codec as it wishes (using the BlockAddID).`},238:{name:`BlockAddID`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`not 0`,description:`An ID to identify the BlockAdditional level.`},166:{name:`BlockMore`,level:4,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Contain the BlockAdditional and some parameters.`},30113:{name:`BlockAdditions`,level:3,type:`m`,minver:1,webm:!1,description:`Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data.`},162:{name:`BlockVirtual`,level:3,type:`b`,webm:!1,description:`A Block with no data. It must be stored in the stream at the place the real Block should be in display order. (see Block Virtual)`},161:{name:`Block`,level:3,type:`b`,mandatory:!0,minver:1,description:`Block containing the actual data to be rendered and a timestamp relative to the Cluster Timecode. (see Block Structure)`},160:{name:`BlockGroup`,level:2,type:`m`,multiple:!0,minver:1,description:`Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock.`},163:{name:`SimpleBlock`,level:2,type:`b`,multiple:!0,minver:2,webm:!0,divx:!0,description:`Similar to SimpleBlock Structure`},171:{name:`PrevSize`,cppname:`ClusterPrevSize`,level:2,type:`u`,minver:1,description:`Size of the previous Cluster, in octets. Can be useful for backward playing.`,position:`prevCluster`},167:{name:`Position`,cppname:`ClusterPosition`,level:2,type:`u`,minver:1,webm:!1,description:`The Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.`,position:`segment`},22743:{name:`SilentTrackNumber`,cppname:`ClusterSilentTrackNumber`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster.`},231:{name:`Timecode`,cppname:`ClusterTimecode`,level:2,type:`u`,mandatory:!0,minver:1,description:`Absolute timestamp of the cluster (based on TimecodeScale).`},524531317:{name:`Cluster`,level:1,type:`m`,multiple:!0,minver:1,description:`The lower level element containing the (monolithic) Block structure.`},19840:{name:`MuxingApp`,level:2,type:`8`,mandatory:!0,minver:1,description:`Muxing application or library ("libmatroska-0.4.3").`},31657:{name:`Title`,level:2,type:`8`,minver:1,webm:!1,description:`General name of the segment.`},2807730:{name:`TimecodeScaleDenominator`,level:2,type:`u`,mandatory:!0,minver:4,default:`1000000000`,description:`Timestamp scale numerator, see TimecodeScale.`},2807729:{name:`TimecodeScale`,level:2,type:`u`,mandatory:!0,minver:1,default:`1000000`,description:`Timestamp scale in nanoseconds (1.000.000 means all timestamps in the segment are expressed in milliseconds).`},27045:{name:`ChapterTranslateID`,level:3,type:`b`,mandatory:!0,minver:1,webm:!1,description:`The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used.`},27071:{name:`ChapterTranslateCodec`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,description:`The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).`},27132:{name:`ChapterTranslateEditionUID`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment.`},4096955:{name:`NextFilename`,level:2,type:`8`,minver:1,webm:!1,description:`An escaped filename corresponding to the next segment.`},4110627:{name:`NextUID`,level:2,type:`b`,minver:1,webm:!1,bytesize:16,description:`A unique ID to identify the next chained segment (128 bits).`},3965867:{name:`PrevFilename`,level:2,type:`8`,minver:1,webm:!1,description:`An escaped filename corresponding to the previous segment.`},3979555:{name:`PrevUID`,level:2,type:`b`,minver:1,webm:!1,bytesize:16,description:`A unique ID to identify the previous chained segment (128 bits).`},29604:{name:`SegmentUID`,level:2,type:`b`,minver:1,webm:!1,range:`not 0`,bytesize:16,description:`A randomly generated unique ID to identify the current segment between many others (128 bits).`},357149030:{name:`Info`,level:1,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains miscellaneous general information and statistics on the file.`},21420:{name:`SeekPosition`,level:3,type:`u`,mandatory:!0,minver:1,description:`The position of the element in the segment in octets (0 = first level 1 element).`,position:`segment`},21419:{name:`SeekID`,level:3,type:`b`,mandatory:!0,minver:1,description:`The binary ID corresponding to the element name.`,type2:`ebmlID`},19899:{name:`Seek`,cppname:`SeekPoint`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains a single seek entry to an EBML element.`},290298740:{name:`SeekHead`,cppname:`SeekHeader`,level:1,type:`m`,multiple:!0,minver:1,description:`Contains the position of other level 1 elements.`},32379:{name:`SignatureElementList`,level:2,type:`m`,multiple:!0,webm:!1,i:`Cluster|Block|BlockAdditional`,description:`A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption.`},32347:{name:`SignatureElements`,level:1,type:`m`,webm:!1,description:`Contains elements that will be used to compute the signature.`},32437:{name:`Signature`,level:1,type:`b`,webm:!1,description:`The signature of the data (until a new.`},32421:{name:`SignaturePublicKey`,level:1,type:`b`,webm:!1,description:`The public key to use with the algorithm (in the case of a PKI-based signature).`},32410:{name:`SignatureHash`,level:1,type:`u`,webm:!1,description:`Hash algorithm used (1=SHA1-160, 2=MD5).`},32394:{name:`SignatureAlgo`,level:1,type:`u`,webm:!1,description:`Signature algorithm used (1=RSA, 2=elliptic).`},458458727:{name:`SignatureSlot`,level:-1,type:`m`,multiple:!0,webm:!1,description:`Contain signature of some (coming) elements in the stream.`},191:{name:`CRC-32`,level:-1,type:`b`,minver:1,webm:!1,description:`The CRC is computed on all the data of the Master element it\'s in. The CRC element should be the first in it\'s parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian`,crc:!0},236:{name:`Void`,level:-1,type:`b`,minver:1,description:`Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use.`},17139:{name:`EBMLMaxSizeLength`,level:1,type:`u`,mandatory:!0,default:8,minver:1,description:`The maximum length of the sizes you\'ll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid.`},17138:{name:`EBMLMaxIDLength`,level:1,type:`u`,mandatory:!0,default:4,minver:1,description:`The maximum length of the IDs you\'ll find in this file (4 or less in Matroska).`},17143:{name:`EBMLReadVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The minimum EBML version a parser has to support to read this file.`},440786851:{name:`EBML`,level:`0`,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Set the EBML characteristics of the data to follow. Each EBML document has to start with this.`},21936:{name:`Colour`,level:`4`,type:`m`,mandatory:!0,multiple:!0,description:`Settings describing the colour format.`},21937:{name:`MatrixCoefficients`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273.`},21945:{name:`Range`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`Clipping of the color ranges.`},21946:{name:`TransferCharacteristics`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The transfer characteristics of the video.`},21947:{name:`Primaries`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273.`}}})),f=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=b(),n=b(),r=d();e.default=function(){function e(){this._schema=r.byEbmlID,this._buffers=[],this._stack=[]}return e.prototype.encode=function(e){var n=this;return t.concat(e.reduce(function(e,t){return e.concat(n.encodeChunk(t))},[])).buffer},e.prototype.encodeChunk=function(e){return e.type===`m`?e.isEnd?this.endTag(e):this.startTag(e):(e.data=n.Buffer.from(e.data),this.writeTag(e)),this.flush()},e.prototype.flush=function(){var e=this._buffers;return this._buffers=[],e},e.prototype.getSchemaInfo=function(e){for(var t=Object.keys(this._schema).map(Number),r=0;r<t.length;r++){var i=t[r];if(this._schema[i].name===e)return new n.Buffer(i.toString(16),`hex`)}return null},e.prototype.writeTag=function(e){var n=e.name,r=this.getSchemaInfo(n),i=e.data;if(r==null)throw Error(`No schema entry found for `+n);var a=t.encodeTag(r,i);if(this._stack.length>0){this._stack[this._stack.length-1].children.push({tagId:r,elm:e,children:[],data:a});return}this._buffers=this._buffers.concat(a)},e.prototype.startTag=function(e){var r=e.name,i=this.getSchemaInfo(r);if(i==null)throw Error(`No schema entry found for `+r);if(e.unknownSize){var a=t.encodeTag(i,new n.Buffer(0),e.unknownSize);this._buffers=this._buffers.concat(a);return}var o={tagId:i,elm:e,children:[],data:null};this._stack.length>0&&this._stack[this._stack.length-1].children.push(o),this._stack.push(o)},e.prototype.endTag=function(e){e.name;var n=this._stack.pop();if(n==null||n.elm.name!==e.name)throw Error(`EBML structure is broken`);var r=n.children.reduce(function(e,t){if(t.data===null)throw Error(`EBML structure is broken`);return e.concat(t.data)},[]),i=t.concat(r);n.elm.type===`m`?n.data=t.encodeTag(n.tagId,i,n.elm.unknownSize):n.data=t.encodeTag(n.tagId,i),this._stack.length<1&&(this._buffers=this._buffers.concat(n.data))},e}()})),p=o((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),m=o((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),h=o((e=>{let t=p(),n=m(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:y(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(Z(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function v(e){if(s.isBuffer(e)){let t=y(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||Q(e.length)?o(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function x(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return Y(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ce(e).length;default:if(i)return r?-1:Y(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=x;function S(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return te(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return I(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function C(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)C(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)C(this,t,t+3),C(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)C(this,t,t+7),C(this,t+1,t+6),C(this,t+2,t+5),C(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):S.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function w(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Q(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(Q(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return X(Y(t,e.length-n),e,n,r)}function O(e,t,n,r){return X(oe(t),e,n,r)}function k(e,t,n,r){return X(ce(t),e,n,r)}function A(e,t,n,r){return X(se(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return ee(r)}let N=4096;function ee(e){let t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}function te(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=le[e[r]];return i}function I(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function L(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)};function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ne(e,t,n,r,i){K(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function z(e,t,n,r,i){K(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=$(function(e,t=0){return ne(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=$(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=$(function(e,t=0){return ne(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=$(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function B(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let U={};function W(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,`message`,{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,`code`,{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}W(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),W(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),W(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=G(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=G(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function G(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function re(e,t,n){q(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&J(t,e.length-(n+1))}function K(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}re(r,i,a)}function q(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function J(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(q(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ie=/[^+/0-9A-Za-z-_]/g;function ae(e){if(e=e.split(`=`)[0],e=e.trim().replace(ie,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function Y(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function oe(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function se(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function ce(e){return t.toByteArray(ae(e))}function X(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Z(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Q(e){return e!==e}let le=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?ue:e}function ue(){throw Error(`BigInt not supported`)}})),g=o((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(e,`__esModule`,{value:!0});var r=b();e.default=function(){function e(){}return e.readVint=function(t,n){n===void 0&&(n=0);var r=8-Math.floor(Math.log2(t[n]));if(r>8){var i=e.readHexString(t,n,n+r);throw Error(`Unrepresentable length: ${r} ${i}`)}if(n+r>t.length)return null;for(var a=t[n]&(1<<8-r)-1,o=1;o<r;o+=1){if(o===7&&a>=2**8&&t[n+7]>0)return{length:r,value:-1};a*=2**8,a+=t[n+o]}return{length:r,value:a}},e.writeVint=function(e){if(e<0||e>2**53)throw Error(`Unrepresentable value: ${e}`);var t=1;for(t=1;t<=8&&!(e<2**(7*t)-1);t+=1);for(var n=r.Buffer.alloc(t),i=e,a=1;a<=t;a+=1){var o=i&255;n[t-a]=o,i-=o,i/=2**8}return n[0]|=1<<8-t,n},e.concatenate=function(e,t){return!e&&!t?r.Buffer.from([]):!e||e.byteLength===0?t:!t||t.byteLength===0?e:r.Buffer.from(n(n([],e,!0),t,!0))},e.readHexString=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),Array.from(e.slice(t,n)).map(function(e){return Number(e).toString(16)}).reduce(function(e,t){return`${e}${t.padStart(2,`0`)}`},``)},e.readUtf8=function(e){try{return r.Buffer.from(e).toString(`utf8`)}catch{return null}},e.readUnsigned=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return n.getUint8(0);case 2:return n.getUint16(0);case 4:return n.getUint32(0);default:break}return t.byteLength<=6?t.reduce(function(e,t){return e*256+t},0):e.readHexString(t,0,t.byteLength)},e.readSigned=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:return NaN}},e.readFloat=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return t.getFloat32(0);case 8:return t.getFloat64(0);default:return NaN}},e.readDate=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return new Date(n.getUint8(0));case 2:return new Date(n.getUint16(0));case 4:return new Date(n.getUint32(0));case 8:return new Date(Number.parseInt(e.readHexString(t),16));default:return new Date(0)}},e.readDataFromTag=function(n,r){var i=n.type,a=n.name,o=n.track,s=n.discardable||!1,c=n.keyframe||!1,l=null,u;switch(i){case`u`:u=e.readUnsigned(r);break;case`f`:u=e.readFloat(r);break;case`i`:u=e.readSigned(r);break;case`s`:u=String.fromCharCode.apply(String,r);break;case`8`:u=e.readUtf8(r);break;case`d`:u=e.readDate(r);break;default:break}if(a===`SimpleBlock`||a===`Block`){var d=0,f=e.readVint(r,d),p=f.length,m=f.value;d+=p,o=m,u=e.readSigned(r.subarray(d,d+2)),d+=2,a===`SimpleBlock`&&(c=!!(r[p+2]&128),s=!!(r[p+2]&1)),d+=1,l=r.subarray(d)}return t(t({},n),{data:r,discardable:s,keyframe:c,payload:l,track:o,value:u})},e}()})),_=o(((e,t)=>{t.exports=function(e,t,n){t||=0;for(var r=1;r<=8&&!(e[t]>=2**(8-r));r++);if(r>8)throw Error(`Unrepresentable length: `+r+` `+e.toString(`hex`,t,t+r));if(t+r>e.length)return null;var i,a=e[t]&(1<<8-r)-1;for(i=1;i<r;i++){if(i===7&&a>=2**45&&e[t+7]>0)return{length:r,value:-1};a*=2**8,a+=e[t+i]}return n&&(a-=2**(r*7-1)-1),{length:r,value:a}}})),v=o(((e,t)=>{var n=_();function r(e){this.buffer=e,this.offset=0}r.prototype.nextInt16BE=function(){var e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e},r.prototype.nextUInt8=function(){var e=this.buffer.readUInt8(this.offset);return this.offset+=1,e},r.prototype.nextUIntV=function(){var e=n(this.buffer,this.offset);return this.offset+=e.length,e.value},r.prototype.nextIntV=function(){var e=n(this.buffer,this.offset,!0);return this.offset+=e.length,e.value},r.prototype.nextBuffer=function(e){var t=e?this.buffer.slice(this.offset,this.offset+e):this.buffer.slice(this.offset);return this.offset+=e||this.length,t},Object.defineProperty(r.prototype,`length`,{get:function(){return this.buffer.length-this.offset}}),t.exports=r})),y=o(((e,t)=>{var n=v(),r=1,i=3,a=2;t.exports=function(e){var t={},r=new n(e);t.trackNumber=r.nextUIntV(),t.timecode=r.nextInt16BE();var i=r.nextUInt8();return t.invisible=!!(i&8),t.keyframe=!!(i&128),t.discardable=!!(i&1),t.frames=o(r,(i&6)>>1),t};function o(e,t){if(!t)return[e.nextBuffer()];var n,o,s=[],c=e.nextUInt8()+1;if(t===a){if(e.length%c!==0)throw Error(`Fixed-Size Lacing Error`);for(o=e.length/c,n=0;n<c;n++)s.push(e.nextBuffer(o));return s}var l=[];if(t===r)for(n=0;n<c-1;n++){var u;o=0;do u=e.nextUInt8(),o+=u;while(u===255);l.push(o)}else if(t===i)for(o=e.nextUIntV(),l.push(o),n=1;n<c-1;n++)o+=e.nextIntV(),l.push(o);for(n=0;n<c-1;n++)s.push(e.nextBuffer(l[n]));return s.push(e.nextBuffer()),s}})),b=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.convertEBMLDateToJSDate=e.createFloatBuffer=e.createIntBuffer=e.createUIntBuffer=e.encodeValueToBuffer=e.concat=e.putRefinedMetaData=e.extractElement=e.removeElement=e.makeMetadataSeekable=e.createRIFFChunk=e.VP8BitStreamToRiffWebPBuffer=e.WebPBlockFilter=e.encodeTag=e.readBlock=e.ebmlBlock=e.writeVint=e.readVint=e.Buffer=void 0;var t=u(),n=f(),r=h(),i=g(),a=y();e.Buffer=r.Buffer,e.readVint=i.default.readVint,e.writeVint=i.default.writeVint,e.ebmlBlock=a;function o(t){return(0,e.ebmlBlock)(new e.Buffer(t))}e.readBlock=o;function s(t,n,r){return r===void 0&&(r=!1),T([t,r?new e.Buffer(`01ffffffffffffff`,`hex`):(0,e.writeVint)(n.length),n])}e.encodeTag=s;function c(t){return t.reduce(function(t,n){return n.type!==`b`||n.name!==`SimpleBlock`||!(0,e.ebmlBlock)(n.data).frames.some(function(e){return e.slice(3,6).toString(`hex`)===`9d012a`})?t:t.concat(n)},[])}e.WebPBlockFilter=c;function l(t){var n=d(`VP8 `,t);return d(`RIFF`,T([new e.Buffer(`WEBP`,`ascii`),n]))}e.VP8BitStreamToRiffWebPBuffer=l;function d(t,n){var r=new e.Buffer(4);return r.writeUInt32LE(n.byteLength,0),T([new e.Buffer(t.substr(0,4),`ascii`),r,n,new e.Buffer(n.byteLength%2==0?0:1)])}e.createRIFFChunk=d;function p(t,r,i){var a=_(`EBML`,t),o=b(a)+12,s=t[t.length-1].dataEnd-o,c=_(`Info`,t);m(`Duration`,c),c.splice(1,0,{name:`Duration`,type:`f`,data:k(r,8)});for(var l=b(c),u=_(`Tracks`,t),d=b(u),f=47,p=[],h=5+i.length*15,g=[],v=-1,y=10,x=function(t){var n=f,r=n+l,a=r+d,c=a+h-s;if(p=[],p.push({name:`SeekHead`,type:`m`,isEnd:!1}),p.push({name:`Seek`,type:`m`,isEnd:!1}),p.push({name:`SeekID`,type:`b`,data:new e.Buffer([21,73,169,102])}),p.push({name:`SeekPosition`,type:`u`,data:D(n)}),p.push({name:`Seek`,type:`m`,isEnd:!0}),p.push({name:`Seek`,type:`m`,isEnd:!1}),p.push({name:`SeekID`,type:`b`,data:new e.Buffer([22,84,174,107])}),p.push({name:`SeekPosition`,type:`u`,data:D(r)}),p.push({name:`Seek`,type:`m`,isEnd:!0}),p.push({name:`Seek`,type:`m`,isEnd:!1}),p.push({name:`SeekID`,type:`b`,data:new e.Buffer([28,83,187,107])}),p.push({name:`SeekPosition`,type:`u`,data:D(a)}),p.push({name:`Seek`,type:`m`,isEnd:!0}),p.push({name:`SeekHead`,type:`m`,isEnd:!0}),f=b(p),g=[],g.push({name:`Cues`,type:`m`,isEnd:!1}),i.forEach(function(e){var t=e.CueTrack,n=e.CueClusterPosition,r=e.CueTime;g.push({name:`CuePoint`,type:`m`,isEnd:!1}),g.push({name:`CueTime`,type:`u`,data:D(r)}),g.push({name:`CueTrackPositions`,type:`m`,isEnd:!1}),g.push({name:`CueTrack`,type:`u`,data:D(t)}),n-=o,n+=c,g.push({name:`CueClusterPosition`,type:`u`,data:D(n)}),g.push({name:`CueTrackPositions`,type:`m`,isEnd:!0}),g.push({name:`CuePoint`,type:`m`,isEnd:!0})}),g.push({name:`Cues`,type:`m`,isEnd:!0}),h=b(g),v!==c){if(v=c,t===y-1)throw Error(`Failed to converge to a stable metadata size`)}else return`break`},S=0;S<y&&x(S)!==`break`;S++);var C=[].concat.apply([],[a,{name:`Segment`,type:`m`,isEnd:!1,unknownSize:!0},p,c,u,g]);return new n.default().encode(C)}e.makeMetadataSeekable=p;function m(e,t){for(var n=-1,r=0;r<t.length;r++){var i=t[r];if(i.name===e)if(i.type===`m`)if(!i.isEnd)n=r;else{if(n==-1)throw Error(`Detected ${e} closing element before finding the start`);t.splice(n,r-n+1);return}else{t.splice(r,1);return}}}e.removeElement=m;function _(e,t){for(var n=[],r=-1,i=0;i<t.length;i++){var a=t[i];if(a.name===e)if(a.type===`m`)if(!a.isEnd)r=i;else{if(r==-1)throw Error(`Detected ${e} closing element before finding the start`);n=t.slice(r,i+1);break}else{n.push(t[i]);break}}return n}e.extractElement=_;function v(t,r){Array.isArray(r.cueInfos)&&!Array.isArray(r.cues)&&(console.warn(`putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues`),r.cues=r.cueInfos);for(var i=[],a=[],o=0;o<t.length;o++){var s=t[o];if(s.type===`m`&&s.name===`Segment`){if(i=t.slice(0,o),a=t.slice(o),s.unknownSize){a.shift();break}throw Error(`this metadata is not streaming webm file`)}}if(!(a[a.length-1].dataEnd>0))throw Error(`metadata dataEnd has wrong number`);var c=a[a.length-1].dataEnd,l=i[i.length-1].dataEnd,u=new n.default().encode(i).byteLength-l,d=c-a[0].tagStart;a[0].tagStart-l,a[0].tagStart;var f=new e.Buffer([24,83,128,103]),p=new e.Buffer(`01ffffffffffffff`,`hex`),m=f.byteLength+p.byteLength,h=d,g;for(g=1;g<20;g++){var _=u+(l+m+h-c),v=x(a,_,r),y=new n.default().encode(v).byteLength;if(y===h)return new n.default().encode([].concat(i,[{type:`m`,name:`Segment`,isEnd:!1,unknownSize:!0}],v));h=y}throw Error(`unable to refine metadata, stable size could not be found in `+g+` iterations!`)}e.putRefinedMetaData=v;function b(e){var t=new n.default;return e.reduce(function(e,n){return e.concat(t.encode([n]))},[]).reduce(function(e,t){return e+t.byteLength},0)}function x(e,t,n){var r=n.duration,i=n.clusterPtrs,a=n.cues,o=e.slice(0);if(typeof r==`number`){var s=!1;o.forEach(function(e){e.type===`f`&&e.name===`Duration`&&(s=!0,e.data=k(r,8))}),s||w(o,`Info`,[{name:`Duration`,type:`f`,data:k(r,8)}])}Array.isArray(a)&&w(o,`Cues`,C(a,t));var c=[];return Array.isArray(i)&&(console.warn(`append cluster pointers to seekhead is deprecated. please use cues`),c=S(i,t)),w(o,`SeekHead`,c,!0),o}function S(t,n){var r=[];return t.forEach(function(t){r.push({name:`Seek`,type:`m`,isEnd:!1}),r.push({name:`SeekID`,type:`b`,data:new e.Buffer([31,67,182,117])}),r.push({name:`SeekPosition`,type:`u`,data:D(t+n)}),r.push({name:`Seek`,type:`m`,isEnd:!0})}),r}function C(e,t){var n=[];return e.forEach(function(e){var r=e.CueTrack,i=e.CueClusterPosition,a=e.CueTime;n.push({name:`CuePoint`,type:`m`,isEnd:!1}),n.push({name:`CueTime`,type:`u`,data:D(a)}),n.push({name:`CueTrackPositions`,type:`m`,isEnd:!1}),n.push({name:`CueTrack`,type:`u`,data:D(r)}),n.push({name:`CueClusterPosition`,type:`u`,data:D(i+t)}),n.push({name:`CueTrackPositions`,type:`m`,isEnd:!0}),n.push({name:`CuePoint`,type:`m`,isEnd:!0})}),n}function w(e,t,n,r){r===void 0&&(r=!1);for(var i=-1,a=0;a<e.length;a++){var o=e[a];if(o.type===`m`&&o.name===t&&o.isEnd===!1){i=a;break}}i>=0?Array.prototype.splice.apply(e,[i+1,0].concat(n)):r?[{name:t,type:`m`,isEnd:!1}].concat(n,[{name:t,type:`m`,isEnd:!0}]).reverse().forEach(function(t){e.unshift(t)}):(e.push({name:t,type:`m`,isEnd:!1}),n.forEach(function(t){e.push(t)}),e.push({name:t,type:`m`,isEnd:!0}))}function T(t){return e.Buffer.concat(t)}e.concat=T;function E(n){var r=new e.Buffer(0);if(n.type===`m`)return n;switch(n.type){case`u`:r=D(n.value);break;case`i`:r=O(n.value);break;case`f`:r=k(n.value);break;case`s`:r=new e.Buffer(n.value,`ascii`);break;case`8`:r=new e.Buffer(n.value,`utf8`);break;case`b`:r=n.value;break;case`d`:r=new t.Int64BE(n.value.getTime().toString()).toBuffer();break}return Object.assign({},n,{data:r})}e.encodeValueToBuffer=E;function D(n){for(var r=1;n>=2**(8*r);r++);if(r>=7)return console.warn(`7bit or more bigger uint not supported.`),new t.Uint64BE(n).toBuffer();var i=new e.Buffer(r);return i.writeUIntBE(n,0,r),i}e.createUIntBuffer=D;function O(n){for(var r=1;n>=2**(8*r);r++);if(r>=7)return console.warn(`7bit or more bigger uint not supported.`),new t.Int64BE(n).toBuffer();var i=new e.Buffer(r);return i.writeIntBE(n,0,r),i}e.createIntBuffer=O;function k(t,n){if(n===void 0&&(n=8),n===8){var r=new e.Buffer(8);return r.writeDoubleBE(t,0),r}else if(n===4){var r=new e.Buffer(4);return r.writeFloatBE(t,0),r}else throw Error(`float type bits must 4bytes or 8bytes`)}e.createFloatBuffer=k;function A(e){return e instanceof Date?e:new Date(new Date(`2001-01-01T00:00:00.000Z`).getTime()+Number(e)/1e3/1e3)}e.convertEBMLDateToJSDate=A})),x=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=u(),n=b(),r=b(),i=d(),a;(function(e){e[e.STATE_TAG=1]=`STATE_TAG`,e[e.STATE_SIZE=2]=`STATE_SIZE`,e[e.STATE_CONTENT=3]=`STATE_CONTENT`})(a||={}),e.default=function(){function e(){this._buffer=new n.Buffer(0),this._tag_stack=[],this._state=a.STATE_TAG,this._cursor=0,this._total=0,this._schema=i.byEbmlID,this._result=[]}return e.prototype.decode=function(e){this.readChunk(e);var t=this._result;return this._result=[],t},e.prototype.readChunk=function(e){for(this._buffer=r.concat([this._buffer,new n.Buffer(e)]);this._cursor<this._buffer.length&&!(this._state===a.STATE_TAG&&!this.readTag()||this._state===a.STATE_SIZE&&!this.readSize()||this._state===a.STATE_CONTENT&&!this.readContent()););},e.prototype.getSchemaInfo=function(e){return this._schema[e]||{name:`unknown`,level:-1,type:`unknown`,description:`unknown`}},e.prototype.readTag=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,n.readVint)(this._buffer,this._cursor);if(e==null)return!1;var t=this._buffer.slice(this._cursor,this._cursor+e.length).reduce(function(e,t,n,r){return e+t*16**(2*(r.length-1-n))},0),r=this.getSchemaInfo(t),i={EBML_ID:t.toString(16),schema:r,type:r.type,name:r.name,level:r.level,tagStart:this._total,tagEnd:this._total+e.length,sizeStart:this._total+e.length,sizeEnd:null,dataStart:null,dataEnd:null,dataSize:null,data:null};return this._tag_stack.push(i),this._cursor+=e.length,this._total+=e.length,this._state=a.STATE_SIZE,!0},e.prototype.readSize=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,n.readVint)(this._buffer,this._cursor);if(e==null)return!1;var t=this._tag_stack[this._tag_stack.length-1];return t.sizeEnd=t.sizeStart+e.length,t.dataStart=t.sizeEnd,t.dataSize=e.value,e.value===-1?(t.dataEnd=-1,t.type===`m`&&(t.unknownSize=!0)):t.dataEnd=t.sizeEnd+e.value,this._cursor+=e.length,this._total+=e.length,this._state=a.STATE_CONTENT,!0},e.prototype.readContent=function(){var e=this._tag_stack[this._tag_stack.length-1];if(e.type===`m`){if(e.isEnd=!1,this._result.push(e),this._state=a.STATE_TAG,e.dataSize===0){var r=Object.assign({},e,{isEnd:!0});this._result.push(r),this._tag_stack.pop()}return!0}if(this._buffer.length<this._cursor+e.dataSize)return!1;var i=this._buffer.slice(this._cursor,this._cursor+e.dataSize);switch(this._buffer=this._buffer.slice(this._cursor+e.dataSize),e.data=i,e.type){case`u`:e.value=i.readUIntBE(0,i.length);break;case`i`:e.value=i.readIntBE(0,i.length);break;case`f`:e.value=e.dataSize===4?i.readFloatBE(0):e.dataSize===8?i.readDoubleBE(0):(console.warn(`cannot read ${e.dataSize} octets float. failback to 0`),0);break;case`s`:e.value=i.toString(`ascii`);break;case`8`:e.value=i.toString(`utf8`);break;case`b`:e.value=i;break;case`d`:e.value=(0,n.convertEBMLDateToJSDate)(new t.Int64BE(i).toNumber());break}if(e.value===null)throw Error(`unknown tag type:`+e.type);for(this._result.push(e),this._total+=e.dataSize,this._state=a.STATE_TAG,this._cursor=0,this._tag_stack.pop();this._tag_stack.length>0;){var o=this._tag_stack[this._tag_stack.length-1];if(o.dataEnd<0)return this._tag_stack.pop(),!0;if(this._total<o.dataEnd)break;if(o.type!==`m`)throw Error(`parent element is not master element`);var r=Object.assign({},o,{isEnd:!0});this._result.push(r),this._tag_stack.pop()}return!0},e}()})),S=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),C=o((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0});var n=S(),r=b();e.default=function(e){t(n,e);function n(){var t=e.call(this)||this;return t.logGroup=``,t.hasLoggingStarted=!1,t.metadataloaded=!1,t.chunks=[],t.stack=[],t.segmentOffset=0,t.last2SimpleBlockVideoTrackTimecode=[0,0],t.last2SimpleBlockAudioTrackTimecode=[0,0],t.lastClusterTimecode=0,t.lastClusterPosition=0,t.timecodeScale=1e6,t.metadataSize=0,t.metadatas=[],t.cues=[],t.firstVideoBlockRead=!1,t.firstAudioBlockRead=!1,t.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null},t.trackTypes=[],t.trackDefaultDuration=[],t.trackCodecDelay=[],t.trackInfo={type:`nothing`},t.ended=!1,t.logging=!1,t.use_duration_every_simpleblock=!1,t.use_webp=!1,t.use_segment_info=!0,t.drop_default_duration=!0,t}return n.prototype.stop=function(){for(this.ended=!0,this.emit_segment_info();this.stack.length;)this.stack.pop(),this.logging&&console.groupEnd();this.logging&&this.hasLoggingStarted&&this.logGroup&&console.groupEnd()},n.prototype.emit_segment_info=function(){var e=this.chunks;if(this.chunks=[],this.metadataloaded){if(!this.use_segment_info)return;var t=this.lastClusterTimecode,n=this.duration,r=this.timecodeScale;this.emit(`cluster`,{timecode:t,data:e}),this.emit(`duration`,{timecodeScale:r,duration:n})}else{this.metadataloaded=!0,this.metadatas=e;var i=this.trackTypes.indexOf(1),a=this.trackTypes.indexOf(2);if(this.trackInfo=i>=0&&a>=0?{type:`both`,trackNumber:i}:i>=0?{type:`video`,trackNumber:i}:a>=0?{type:`audio`,trackNumber:a}:{type:`nothing`},!this.use_segment_info)return;this.emit(`metadata`,{data:e,metadataSize:this.metadataSize})}},n.prototype.read=function(e){var t=this,n=!1;if(!this.ended){if(e.type===`m`)if(e.isEnd)this.stack.pop();else{var i=this.stack[this.stack.length-1];if(i!=null&&i.level>=e.level){this.stack.pop(),this.logging&&console.groupEnd(),i.dataEnd=e.dataEnd,i.dataSize=e.dataEnd-i.dataStart,i.unknownSize=!1;var a=Object.assign({},i,{name:i.name,type:i.type,isEnd:!0});this.chunks.push(a)}this.stack.push(e)}if(e.type===`m`&&e.name==`Segment`)this.segmentOffset!=0&&console.warn(`Multiple segments detected!`),this.segmentOffset=e.dataStart,this.emit(`segment_offset`,this.segmentOffset);else if(e.type===`b`&&e.name===`SimpleBlock`){var o=r.ebmlBlock(e.data),s=o.timecode,c=o.trackNumber,l=o.frames;if(this.trackTypes[c]===1){if(!this.firstVideoBlockRead&&(this.firstVideoBlockRead=!0,this.trackInfo.type===`both`||this.trackInfo.type===`video`)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit(`cue_info`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit(`cue`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockVideoTrackTimecode=[this.last2SimpleBlockVideoTrackTimecode[1],s]}else if(this.trackTypes[c]===2){if(!this.firstAudioBlockRead&&(this.firstAudioBlockRead=!0,this.trackInfo.type===`audio`)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit(`cue_info`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit(`cue`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockAudioTrackTimecode=[this.last2SimpleBlockAudioTrackTimecode[1],s]}this.use_duration_every_simpleblock&&this.emit(`duration`,{timecodeScale:this.timecodeScale,duration:this.duration}),this.use_webp&&l.forEach(function(e){if(e.slice(3,6).toString(`hex`)===`9d012a`){var n=r.VP8BitStreamToRiffWebPBuffer(e),i=new Blob([n],{type:`image/webp`}),a=t.duration;t.emit(`webp`,{currentTime:a,webp:i})}})}else e.type===`m`&&e.name===`Cluster`&&e.isEnd===!1?(this.firstVideoBlockRead=!1,this.firstAudioBlockRead=!1,this.emit_segment_info(),this.emit(`cluster_ptr`,e.tagStart),this.lastClusterPosition=e.tagStart):e.type===`u`&&e.name===`Timecode`?this.lastClusterTimecode=e.value:e.type===`u`&&e.name===`TimecodeScale`?this.timecodeScale=e.value:e.type===`m`&&e.name===`TrackEntry`?e.isEnd?(this.trackTypes[this.currentTrack.TrackNumber]=this.currentTrack.TrackType,this.trackDefaultDuration[this.currentTrack.TrackNumber]=this.currentTrack.DefaultDuration,this.trackCodecDelay[this.currentTrack.TrackNumber]=this.currentTrack.CodecDelay):this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null}:e.type===`u`&&e.name===`TrackType`?this.currentTrack.TrackType=e.value:e.type===`u`&&e.name===`TrackNumber`?this.currentTrack.TrackNumber=e.value:e.type===`u`&&e.name===`CodecDelay`?this.currentTrack.CodecDelay=e.value:e.type===`u`&&e.name===`DefaultDuration`?this.drop_default_duration?(console.warn(`DefaultDuration detected!, remove it`),n=!0):this.currentTrack.DefaultDuration=e.value:e.name===`unknown`&&console.warn(e);!this.metadataloaded&&e.dataEnd>0&&(this.metadataSize=e.dataEnd),n||this.chunks.push(e),this.logging&&this.put(e)}},Object.defineProperty(n.prototype,`duration`,{get:function(){if(this.trackInfo.type===`nothing`)return console.warn(`no video, no audio track`),0;var e=0,t=0,n=0,r=this.trackDefaultDuration[this.trackInfo.trackNumber];if(typeof r==`number`)e=r;else if(this.trackInfo.type===`both`)if(this.last2SimpleBlockAudioTrackTimecode[1]>this.last2SimpleBlockVideoTrackTimecode[1]){e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackTypes.indexOf(2)];typeof i==`number`&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}else{e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackTypes.indexOf(1)];typeof i==`number`&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if(this.trackInfo.type===`video`){e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackInfo.trackNumber];typeof i==`number`&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if(this.trackInfo.type===`audio`){e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackInfo.trackNumber];typeof i==`number`&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}var a=((this.lastClusterTimecode+n)*this.timecodeScale+e-t)/this.timecodeScale;return Math.floor(a)},enumerable:!1,configurable:!0}),n.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},n.prototype.put=function(e){this.hasLoggingStarted||(this.hasLoggingStarted=!0,this.logging&&this.logGroup&&console.groupCollapsed(this.logGroup)),e.type===`m`?e.isEnd?console.groupEnd():console.group(e.name+`:`+e.tagStart):e.type===`b`?console.log(e.name,e.type):console.log(e.name,e.tagStart,e.type,e.value)},n}(n.EventEmitter)})),w=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.tools=e.Reader=e.Encoder=e.Decoder=void 0,n(l(),e),e.Decoder=x().default,e.Encoder=f().default,e.Reader=C().default,e.tools=b()})),T=c(o((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0});var r=w();function i(e){return t(this,void 0,void 0,function(){var t,i,a,o,s,c,l,u,d,f,p,m;return n(this,function(n){switch(n.label){case 0:if(!e)throw Error(`call to fixWebmDuration requires a blob`);t=new r.Decoder,i=new r.Reader,a=e.stream(),o=a.getReader(),n.label=1;case 1:return[4,o.read()];case 2:return s=n.sent(),c=s.done,l=s.value,c?(i.stop(),[3,3]):(u=t.decode(l),u=u?.filter(function(e){return e.type!==`unknown`}),u.forEach(function(e){i.read(e)}),l=null,[3,1]);case 3:return d=r.tools.makeMetadataSeekable(i.metadatas,i.duration,i.cues),f=new Blob([d],{type:e.type}),p=e.slice(i.metadataSize),m=new Blob([f,p],{type:e.type}),[2,m]}})})}e.default=i}))(),1);function E(e){if(typeof e==`function`)return e;if(typeof e==`object`&&e&&`default`in e){let t=e.default;if(typeof t==`function`)return t;if(typeof t==`object`&&t&&`default`in t&&typeof t.default==`function`)return t.default}throw TypeError(`fixWebmDuration is not a function`)}let D=E(T),O=new class{async fix(e,t){return D(new Blob([e],{type:t||`video/webm`}))}};onmessage=e=>{let{id:t,action:n,data:r}=e.data;n!==`destroy`&&n===`fix`&&(async()=>{try{let e=await O.fix(r.buffer,r.mimeType),n=await e.arrayBuffer(),i={id:t,ok:!0,buffer:n,mimeType:e.type||r.mimeType||`video/webm`};postMessage(i,[n])}catch(e){let n={id:t,ok:!1,error:e instanceof Error?e.message:String(e)};postMessage(n)}})()}})();',dd=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,ud],{type:`text/javascript;charset=utf-8`});function fd(e){let t;try{if(t=dd&&(self.URL||self.webkitURL).createObjectURL(dd),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(ud),{name:e?.name})}}function pd(e,t){let n=e;if(n?.message){let e=n.filename?` ${n.filename}:${n.lineno??0}`:``;return`${t}: ${n.message}${e}`}return t}var md=class{worker;nextId=1;pending=new Map;options;constructor(e={}){this.options=e,this.worker=new fd({name:`quickvo-webm-duration-fix`}),this.worker.onmessage=e=>{let t=e.data,n=this.pending.get(t.id);if(n){if(this.pending.delete(t.id),!t.ok){n.reject(Error(t.error??`webm fix worker failed`));return}if(t.buffer==null){n.reject(Error(`webm fix worker failed`));return}n.resolve(new Blob([t.buffer],{type:t.mimeType??`video/webm`}))}},this.worker.addEventListener(`messageerror`,()=>{this.failAll(Error(`webm fix worker messageerror`))}),this.worker.addEventListener(`error`,e=>{this.failAll(Error(pd(e,`webm fix worker error`)))})}failAll(e){for(let[,t]of this.pending)t.reject(e);this.pending.clear(),this.worker.terminate(),this.options.onFatal?.()}fix(e,t){let n=this.nextId++,r=e.slice(0);return new Promise((e,i)=>{this.pending.set(n,{resolve:e,reject:i}),this.worker.postMessage({id:n,action:`fix`,data:{buffer:r,mimeType:t}},[r])})}destroy=()=>{let e=Error(`webm fix worker destroyed`);for(let[,t]of this.pending)t.reject(e);this.pending.clear();try{this.worker.postMessage({id:0,action:`destroy`,data:{}})}catch{}this.worker.terminate()}},hd=!1,gd=!1,_d=null;function vd(){if(hd||gd)return null;if(typeof Worker>`u`)return hd=!0,null;if(!_d)try{_d=new md({onFatal:()=>{hd=!0,_d=null}})}catch{return hd=!0,null}return _d}function yd(e,t){let n=vd();return n?n.fix(e,t):Promise.reject(Error(`webm fix worker unavailable`))}function bd(){gd=!0,_d?.destroy(),_d=null}function xd(){gd=!1,hd=!1}var Sd=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),Cd=s((e=>{(function(e){var t=`undefined`,n=t!==typeof Buffer&&Buffer,r=t!==typeof Uint8Array&&Uint8Array,i=t!==typeof ArrayBuffer&&ArrayBuffer,a=[0,0,0,0,0,0,0,0],o=Array.isArray||x,s=4294967296,c=16777216,l;u(`Uint64BE`,!0,!0),u(`Int64BE`,!0,!1),u(`Uint64LE`,!1,!0),u(`Int64LE`,!1,!1);function u(o,u,x){var S=u?0:4,C=u?4:0,w=u?0:3,T=u?1:2,E=u?2:1,D=u?3:0,O=u?_:y,ee=u?v:b,k=re.prototype,te=`is`+o,ne=`_`+te;return k.buffer=void 0,k.offset=0,k[ne]=!0,k.toNumber=A,k.toString=j,k.toJSON=A,k.toArray=d,n&&(k.toBuffer=f),r&&(k.toArrayBuffer=p),re[te]=ie,e[o]=re,re;function re(e,t,n,r){return this instanceof re?ae(this,e,t,n,r):new re(e,t,n,r)}function ie(e){return!!(e&&e[ne])}function ae(e,o,s,c,u){if(r&&i&&(o instanceof i&&(o=new r(o)),c instanceof i&&(c=new r(c))),!o&&!s&&!c&&!l){e.buffer=g(a,0);return}if(!m(o,s)){var d=l||Array;u=s,c=o,s=0,o=l===n?n.alloc(8):new d(8)}e.buffer=o,e.offset=s|=0,t!==typeof c&&(typeof c==`string`?oe(o,s,c,u||10):m(c,u)?h(o,s,c,u):typeof u==`number`?(se(o,s+S,c),se(o,s+C,u)):c>0?O(o,s,c):c<0?ee(o,s,c):h(o,s,a,0))}function oe(e,t,n,r){var i=0,a=n.length,o=0,c=0;n[0]===`-`&&i++;for(var l=i;i<a;){var u=parseInt(n[i++],r);if(!(u>=0))break;c=c*r+u,o=o*r+Math.floor(c/s),c%=s}l&&(o=~o,c?c=s-c:o++),se(e,t+S,o),se(e,t+C,c)}function A(){var e=this.buffer,t=this.offset,n=M(e,t+S),r=M(e,t+C);return x||(n|=0),n?n*s+r:r}function j(e){var t=this.buffer,n=this.offset,r=M(t,n+S),i=M(t,n+C),a=``,o=!x&&r&2147483648;for(o&&(r=~r,i=s-i),e||=10;;){var c=r%e*s+i;if(r=Math.floor(r/e),i=Math.floor(c/e),a=(c%e).toString(e)+a,!r&&!i)break}return o&&(a=`-`+a),a}function se(e,t,n){e[t+D]=n&255,n>>=8,e[t+E]=n&255,n>>=8,e[t+T]=n&255,n>>=8,e[t+w]=n&255}function M(e,t){return e[t+w]*c+(e[t+T]<<16)+(e[t+E]<<8)+e[t+D]}}function d(e){var t=this.buffer,n=this.offset;return l=null,e!==!1&&o(t)?t.length===8?t:t.slice(n,n+8):g(t,n)}function f(e){var t=this.buffer,r=this.offset;return l=n,e!==!1&&n.isBuffer(t)?t.length===8?t:t.slice(r,r+8):n.from(p.call(this,e))}function p(e){var t=this.buffer,n=this.offset,a=t.buffer;if(l=r,e!==!1&&!t.offset&&a instanceof i)return a.byteLength===8?a:a.slice(n,n+8);var o=new r(8);return h(o,0,t,n),o.buffer}function m(e,t){var n=e&&e.length;return t|=0,n&&t+8<=n&&typeof e[t]!=`string`}function h(e,t,n,r){t|=0,r|=0;for(var i=0;i<8;i++)e[t++]=n[r++]&255}function g(e,t){return Array.prototype.slice.call(e,t,t+8)}function _(e,t,n){for(var r=t+8;r>t;)e[--r]=n&255,n/=256}function v(e,t,n){var r=t+8;for(n++;r>t;)e[--r]=-n&255^255,n/=256}function y(e,t,n){for(var r=t+8;t<r;)e[t++]=n&255,n/=256}function b(e,t,n){var r=t+8;for(n++;t<r;)e[t++]=-n&255^255,n/=256}function x(e){return!!e&&Object.prototype.toString.call(e)==`[object Array]`}})(typeof e==`object`&&typeof e.nodeName!=`string`?e:e||{})})),wd=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.byEbmlID=void 0,e.byEbmlID={128:{name:`ChapterDisplay`,level:4,type:`m`,multiple:!0,minver:1,webm:!0,description:`Contains all possible strings to use for the chapter display.`},131:{name:`TrackType`,level:3,type:`u`,mandatory:!0,minver:1,range:`1-254`,description:`A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).`},133:{name:`ChapString`,cppname:`ChapterString`,level:5,type:`8`,mandatory:!0,minver:1,webm:!0,description:`Contains the string to use as the chapter atom.`},134:{name:`CodecID`,level:3,type:`s`,mandatory:!0,minver:1,description:`An ID corresponding to the codec, see the codec page for more info.`},136:{name:`FlagDefault`,cppname:`TrackFlagDefault`,level:3,type:`u`,mandatory:!0,minver:1,default:1,range:`0-1`,description:`Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)`},137:{name:`ChapterTrackNumber`,level:5,type:`u`,mandatory:!0,multiple:!0,minver:1,webm:!1,range:`not 0`,description:`UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks.`},145:{name:`ChapterTimeStart`,level:4,type:`u`,mandatory:!0,minver:1,webm:!0,description:`Timestamp of the start of Chapter (not scaled).`},146:{name:`ChapterTimeEnd`,level:4,type:`u`,minver:1,webm:!1,description:`Timestamp of the end of Chapter (timestamp excluded, not scaled).`},150:{name:`CueRefTime`,level:5,type:`u`,mandatory:!0,minver:2,webm:!1,description:`Timestamp of the referenced Block.`},151:{name:`CueRefCluster`,level:5,type:`u`,mandatory:!0,webm:!1,description:`The Position of the Cluster containing the referenced Block.`},152:{name:`ChapterFlagHidden`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,range:`0-1`,description:`If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)`},16980:{name:`ContentCompAlgo`,level:6,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`The compression algorithm used. Algorithms that have been specified so far are: 0 - zlib, 3 - Header Stripping`},16981:{name:`ContentCompSettings`,level:6,type:`b`,minver:1,webm:!1,description:`Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track.`},17026:{name:`DocType`,level:1,type:`s`,mandatory:!0,default:`matroska`,minver:1,description:`A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files.`},17029:{name:`DocTypeReadVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The minimum DocType version an interpreter has to support to read this file.`},17030:{name:`EBMLVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The version of EBML parser used to create the file.`},17031:{name:`DocTypeVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The version of DocType interpreter used to create the file.`},17476:{name:`SegmentFamily`,level:2,type:`b`,multiple:!0,minver:1,webm:!1,bytesize:16,description:`A randomly generated unique ID that all segments related to each other must use (128 bits).`},17505:{name:`DateUTC`,level:2,type:`d`,minver:1,description:`Date of the origin of timestamp (value 0), i.e. production date.`},17540:{name:`TagDefault`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`0-1`,description:`Indication to know if this is the default/original language to use for the given tag. (1 bit)`},17541:{name:`TagBinary`,level:4,type:`b`,minver:1,webm:!1,description:`The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.`},17543:{name:`TagString`,level:4,type:`8`,minver:1,webm:!1,description:`The value of the Element.`},17545:{name:`Duration`,level:2,type:`f`,minver:1,range:`> 0`,description:`Duration of the segment (based on TimecodeScale).`},17816:{name:`ChapterFlagEnabled`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`0-1`,description:`Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)`},18016:{name:`FileMimeType`,level:3,type:`s`,mandatory:!0,minver:1,webm:!1,description:`MIME type of the file.`},18017:{name:`FileUsedStartTime`,level:3,type:`u`,divx:!0,description:`DivX font extension`},18018:{name:`FileUsedEndTime`,level:3,type:`u`,divx:!0,description:`DivX font extension`},18037:{name:`FileReferral`,level:3,type:`b`,webm:!1,description:`A binary value that a track/codec can refer to when the attachment is needed.`},20529:{name:`ContentEncodingOrder`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment.`},20530:{name:`ContentEncodingScope`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`not 0`,description:`A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: 1 - all frame contents, 2 - the track's private data, 4 - the next ContentEncoding (next ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)`},20531:{name:`ContentEncodingType`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`A value describing what kind of transformation has been done. Possible values: 0 - compression, 1 - encryption`},20532:{name:`ContentCompression`,level:5,type:`m`,minver:1,webm:!1,description:`Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking.`},20533:{name:`ContentEncryption`,level:5,type:`m`,minver:1,webm:!1,description:`Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise.`},21368:{name:`CueBlockNumber`,level:4,type:`u`,minver:1,default:1,range:`not 0`,description:`Number of the Block in the specified Cluster.`},22100:{name:`ChapterStringUID`,level:4,type:`8`,mandatory:!1,minver:3,webm:!0,description:`A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage.`},22337:{name:`WritingApp`,level:2,type:`8`,mandatory:!0,minver:1,description:`Writing application ("mkvmerge-0.3.3").`},22612:{name:`SilentTracks`,cppname:`ClusterSilentTracks`,level:2,type:`m`,minver:1,webm:!1,description:`The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use.`},25152:{name:`ContentEncoding`,level:4,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Settings for one content encoding like compression or encryption.`},25188:{name:`BitDepth`,cppname:`AudioBitDepth`,level:4,type:`u`,minver:1,range:`not 0`,description:`Bits per sample, mostly used for PCM.`},25906:{name:`SignedElement`,level:3,type:`b`,multiple:!0,webm:!1,description:`An element ID whose data will be used to compute the signature.`},26148:{name:`TrackTranslate`,level:3,type:`m`,multiple:!0,minver:1,webm:!1,description:`The track identification for the given Chapter Codec.`},26897:{name:`ChapProcessCommand`,cppname:`ChapterProcessCommand`,level:5,type:`m`,multiple:!0,minver:1,webm:!1,description:`Contains all the commands associated to the Atom.`},26914:{name:`ChapProcessTime`,cppname:`ChapterProcessTime`,level:6,type:`u`,mandatory:!0,minver:1,webm:!1,description:`Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter).`},26916:{name:`ChapterTranslate`,level:2,type:`m`,multiple:!0,minver:1,webm:!1,description:`A tuple of corresponding ID used by chapter codecs to represent this segment.`},26931:{name:`ChapProcessData`,cppname:`ChapterProcessData`,level:6,type:`b`,mandatory:!0,minver:1,webm:!1,description:`Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands.`},26948:{name:`ChapProcess`,cppname:`ChapterProcess`,level:4,type:`m`,multiple:!0,minver:1,webm:!1,description:`Contains all the commands associated to the Atom.`},26965:{name:`ChapProcessCodecID`,cppname:`ChapterProcessCodecID`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later.`},29555:{name:`Tag`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Element containing elements specific to Tracks/Chapters.`},29572:{name:`SegmentFilename`,level:2,type:`8`,minver:1,webm:!1,description:`A filename corresponding to this segment.`},29766:{name:`AttachmentLink`,cppname:`TrackAttachmentLink`,level:3,type:`u`,minver:1,webm:!1,range:`not 0`,description:`The UID of an attachment that is used by this codec.`},2459272:{name:`CodecName`,level:3,type:`8`,minver:1,description:`A human-readable string specifying the codec.`},408125543:{name:`Segment`,level:`0`,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment.`},17530:{name:`TagLanguage`,level:4,type:`s`,mandatory:!0,minver:1,webm:!1,default:`und`,description:`Specifies the language of the tag specified, in the Matroska languages form.`},17827:{name:`TagName`,level:4,type:`8`,mandatory:!0,minver:1,webm:!1,description:`The name of the Tag that is going to be stored.`},26568:{name:`SimpleTag`,cppname:`TagSimple`,level:3,recursive:`1`,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Contains general information about the target.`},25542:{name:`TagAttachmentUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment.`},25540:{name:`TagChapterUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment.`},25545:{name:`TagEditionUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment.`},25541:{name:`TagTrackUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,default:0,description:`A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment.`},25546:{name:`TargetType`,cppname:`TagTargetType`,level:4,type:`s`,minver:1,webm:!1,strong:`informational`,description:`An string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).`},26826:{name:`TargetTypeValue`,cppname:`TagTargetTypeValue`,level:4,type:`u`,minver:1,webm:!1,default:50,description:`A number to indicate the logical level of the target (see TargetType).`},25536:{name:`Targets`,cppname:`TagTargets`,level:3,type:`m`,mandatory:!0,minver:1,webm:!1,description:`Contain all UIDs where the specified meta data apply. It is empty to describe everything in the segment.`},307544935:{name:`Tags`,level:1,type:`m`,multiple:!0,minver:1,webm:!1,description:`Element containing elements specific to Tracks/Chapters. A list of valid tags can be found here.`},17677:{name:`ChapProcessPrivate`,cppname:`ChapterProcessPrivate`,level:5,type:`b`,minver:1,webm:!1,description:`Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.`},17278:{name:`ChapCountry`,cppname:`ChapterCountry`,level:5,type:`s`,multiple:!0,minver:1,webm:!1,description:`The countries corresponding to the string, same 2 octets as in Internet domains.`},17276:{name:`ChapLanguage`,cppname:`ChapterLanguage`,level:5,type:`s`,mandatory:!0,multiple:!0,minver:1,webm:!0,default:`eng`,description:`The languages corresponding to the string, in the bibliographic ISO-639-2 form.`},143:{name:`ChapterTrack`,level:4,type:`m`,minver:1,webm:!1,description:`List of tracks on which the chapter applies. If this element is not present, all tracks apply`},25539:{name:`ChapterPhysicalEquiv`,level:4,type:`u`,minver:1,webm:!1,description:`Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.`},28348:{name:`ChapterSegmentEditionUID`,level:4,type:`u`,minver:1,webm:!1,range:`not 0`,description:`The EditionUID to play from the segment linked in ChapterSegmentUID.`},28263:{name:`ChapterSegmentUID`,level:4,type:`b`,minver:1,webm:!1,range:`>0`,bytesize:16,description:`A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used.`},29636:{name:`ChapterUID`,level:4,type:`u`,mandatory:!0,minver:1,webm:!0,range:`not 0`,description:`A unique ID to identify the Chapter.`},182:{name:`ChapterAtom`,level:3,recursive:`1`,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!0,description:`Contains the atom information to use as the chapter atom (apply to all tracks).`},17885:{name:`EditionFlagOrdered`,level:3,type:`u`,minver:1,webm:!1,default:0,range:`0-1`,description:`Specify if the chapters can be defined multiple times and the order to play them is enforced. (1 bit)`},17883:{name:`EditionFlagDefault`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,range:`0-1`,description:`If a flag is set (1) the edition should be used as the default one. (1 bit)`},17853:{name:`EditionFlagHidden`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,range:`0-1`,description:`If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)`},17852:{name:`EditionUID`,level:3,type:`u`,minver:1,webm:!1,range:`not 0`,description:`A unique ID to identify the edition. It's useful for tagging an edition.`},17849:{name:`EditionEntry`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!0,description:`Contains all information about a segment edition.`},272869232:{name:`Chapters`,level:1,type:`m`,minver:1,webm:!0,description:`A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.`},18094:{name:`FileUID`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,range:`not 0`,description:`Unique ID representing the file, as random as possible.`},18012:{name:`FileData`,level:3,type:`b`,mandatory:!0,minver:1,webm:!1,description:`The data of the file.`},18030:{name:`FileName`,level:3,type:`8`,mandatory:!0,minver:1,webm:!1,description:`Filename of the attached file.`},18046:{name:`FileDescription`,level:3,type:`8`,minver:1,webm:!1,description:`A human-friendly name for the attached file.`},24999:{name:`AttachedFile`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`An attached file.`},423732329:{name:`Attachments`,level:1,type:`m`,minver:1,webm:!1,description:`Contain attached files.`},235:{name:`CueRefCodecState`,level:5,type:`u`,webm:!1,default:0,description:`The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry.`},21343:{name:`CueRefNumber`,level:5,type:`u`,webm:!1,default:1,range:`not 0`,description:`Number of the referenced Block of Track X in the specified Cluster.`},219:{name:`CueReference`,level:4,type:`m`,multiple:!0,minver:2,webm:!1,description:`The Clusters containing the required referenced Blocks.`},234:{name:`CueCodecState`,level:4,type:`u`,minver:2,webm:!1,default:0,description:`The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry.`},178:{name:`CueDuration`,level:4,type:`u`,mandatory:!1,minver:4,webm:!1,description:`The duration of the block according to the segment time base. If missing the track's DefaultDuration does not apply and no duration information is available in terms of the cues.`},240:{name:`CueRelativePosition`,level:4,type:`u`,mandatory:!1,minver:4,webm:!1,description:`The relative position of the referenced block inside the cluster with 0 being the first possible position for an element inside that cluster.`,position:`clusterRelative`},241:{name:`CueClusterPosition`,level:4,type:`u`,mandatory:!0,minver:1,description:`The position of the Cluster containing the required Block.`,position:`segment`},247:{name:`CueTrack`,level:4,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`The track for which a position is given.`},183:{name:`CueTrackPositions`,level:3,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contain positions for different tracks corresponding to the timestamp.`},179:{name:`CueTime`,level:3,type:`u`,mandatory:!0,minver:1,description:`Absolute timestamp according to the segment time base.`},187:{name:`CuePoint`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains all information relative to a seek point in the segment.`},475249515:{name:`Cues`,level:1,type:`m`,minver:1,description:`A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.`},18406:{name:`ContentSigHashAlgo`,level:6,type:`u`,minver:1,webm:!1,default:0,description:`The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - SHA1-160 2 - MD5`},18405:{name:`ContentSigAlgo`,level:6,type:`u`,minver:1,webm:!1,default:0,description:`The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - RSA`},18404:{name:`ContentSigKeyID`,level:6,type:`b`,minver:1,webm:!1,description:`This is the ID of the private key the data was signed with.`},18403:{name:`ContentSignature`,level:6,type:`b`,minver:1,webm:!1,description:`A cryptographic signature of the contents.`},18402:{name:`ContentEncKeyID`,level:6,type:`b`,minver:1,webm:!1,description:`For public key algorithms this is the ID of the public key the the data was encrypted with.`},18401:{name:`ContentEncAlgo`,level:6,type:`u`,minver:1,webm:!1,default:0,description:`The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: 1 - DES, 2 - 3DES, 3 - Twofish, 4 - Blowfish, 5 - AES`},28032:{name:`ContentEncodings`,level:3,type:`m`,minver:1,webm:!1,description:`Settings for several content encoding mechanisms like compression or encryption.`},196:{name:`TrickMasterTrackSegmentUID`,level:3,type:`b`,divx:!0,bytesize:16,description:`DivX trick track extenstions`},199:{name:`TrickMasterTrackUID`,level:3,type:`u`,divx:!0,description:`DivX trick track extenstions`},198:{name:`TrickTrackFlag`,level:3,type:`u`,divx:!0,default:0,description:`DivX trick track extenstions`},193:{name:`TrickTrackSegmentUID`,level:3,type:`b`,divx:!0,bytesize:16,description:`DivX trick track extenstions`},192:{name:`TrickTrackUID`,level:3,type:`u`,divx:!0,description:`DivX trick track extenstions`},237:{name:`TrackJoinUID`,level:5,type:`u`,mandatory:!0,multiple:!0,minver:3,webm:!1,range:`not 0`,description:`The trackUID number of a track whose blocks are used to create this virtual track.`},233:{name:`TrackJoinBlocks`,level:4,type:`m`,minver:3,webm:!1,description:`Contains the list of all tracks whose Blocks need to be combined to create this virtual track`},230:{name:`TrackPlaneType`,level:6,type:`u`,mandatory:!0,minver:3,webm:!1,description:`The kind of plane this track corresponds to (0: left eye, 1: right eye, 2: background).`},229:{name:`TrackPlaneUID`,level:6,type:`u`,mandatory:!0,minver:3,webm:!1,range:`not 0`,description:`The trackUID number of the track representing the plane.`},228:{name:`TrackPlane`,level:5,type:`m`,mandatory:!0,multiple:!0,minver:3,webm:!1,description:`Contains a video plane track that need to be combined to create this 3D track`},227:{name:`TrackCombinePlanes`,level:4,type:`m`,minver:3,webm:!1,description:`Contains the list of all video plane tracks that need to be combined to create this 3D track`},226:{name:`TrackOperation`,level:3,type:`m`,minver:3,webm:!1,description:`Operation that needs to be applied on tracks to create this virtual track. For more details look at the Specification Notes on the subject.`},32123:{name:`ChannelPositions`,cppname:`AudioPosition`,level:4,type:`b`,webm:!1,description:`Table of horizontal angles for each successive channel, see appendix.`},159:{name:`Channels`,cppname:`AudioChannels`,level:4,type:`u`,mandatory:!0,minver:1,default:1,range:`not 0`,description:`Numbers of channels in the track.`},30901:{name:`OutputSamplingFrequency`,cppname:`AudioOutputSamplingFreq`,level:4,type:`f`,minver:1,default:`Sampling Frequency`,range:`> 0`,description:`Real output sampling frequency in Hz (used for SBR techniques).`},181:{name:`SamplingFrequency`,cppname:`AudioSamplingFreq`,level:4,type:`f`,mandatory:!0,minver:1,default:8e3,range:`> 0`,description:`Sampling frequency in Hz.`},225:{name:`Audio`,cppname:`TrackAudio`,level:3,type:`m`,minver:1,description:`Audio settings.`},2327523:{name:`FrameRate`,cppname:`VideoFrameRate`,level:4,type:`f`,range:`> 0`,strong:`Informational`,description:`Number of frames per second. only.`},3126563:{name:`GammaValue`,cppname:`VideoGamma`,level:4,type:`f`,webm:!1,range:`> 0`,description:`Gamma Value.`},3061028:{name:`ColourSpace`,cppname:`VideoColourSpace`,level:4,type:`b`,minver:1,webm:!1,bytesize:4,description:`Same value as in AVI (32 bits).`},21683:{name:`AspectRatioType`,cppname:`VideoAspectRatio`,level:4,type:`u`,minver:1,default:0,description:`Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).`},21682:{name:`DisplayUnit`,cppname:`VideoDisplayUnit`,level:4,type:`u`,minver:1,default:0,description:`How DisplayWidth & DisplayHeight should be interpreted (0: pixels, 1: centimeters, 2: inches, 3: Display Aspect Ratio).`},21690:{name:`DisplayHeight`,cppname:`VideoDisplayHeight`,level:4,type:`u`,minver:1,default:`PixelHeight`,range:`not 0`,description:`Height of the video frames to display. The default value is only valid when DisplayUnit is 0.`},21680:{name:`DisplayWidth`,cppname:`VideoDisplayWidth`,level:4,type:`u`,minver:1,default:`PixelWidth`,range:`not 0`,description:`Width of the video frames to display. The default value is only valid when DisplayUnit is 0.`},21725:{name:`PixelCropRight`,cppname:`VideoPixelCropRight`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove on the right of the image.`},21708:{name:`PixelCropLeft`,cppname:`VideoPixelCropLeft`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove on the left of the image.`},21691:{name:`PixelCropTop`,cppname:`VideoPixelCropTop`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove at the top of the image.`},21674:{name:`PixelCropBottom`,cppname:`VideoPixelCropBottom`,level:4,type:`u`,minver:1,default:0,description:`The number of video pixels to remove at the bottom of the image (for HDTV content).`},186:{name:`PixelHeight`,cppname:`VideoPixelHeight`,level:4,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`Height of the encoded video frames in pixels.`},176:{name:`PixelWidth`,cppname:`VideoPixelWidth`,level:4,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`Width of the encoded video frames in pixels.`},21433:{name:`OldStereoMode`,level:4,type:`u`,maxver:`0`,webm:!1,divx:!1,description:`DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska. (0: mono, 1: right eye, 2: left eye, 3: both eyes).`},21440:{name:`AlphaMode`,cppname:`VideoAlphaMode`,level:4,type:`u`,minver:3,webm:!0,default:0,description:`Alpha Video Mode. Presence of this element indicates that the BlockAdditional element could contain Alpha data.`},21432:{name:`StereoMode`,cppname:`VideoStereoMode`,level:4,type:`u`,minver:3,webm:!0,default:0,description:`Stereo-3D video mode (0: mono, 1: side by side (left eye is first), 2: top-bottom (right eye is first), 3: top-bottom (left eye is first), 4: checkboard (right is first), 5: checkboard (left is first), 6: row interleaved (right is first), 7: row interleaved (left is first), 8: column interleaved (right is first), 9: column interleaved (left is first), 10: anaglyph (cyan/red), 11: side by side (right eye is first), 12: anaglyph (green/magenta), 13 both eyes laced in one Block (left eye is first), 14 both eyes laced in one Block (right eye is first)) . There are some more details on 3D support in the Specification Notes.`},154:{name:`FlagInterlaced`,cppname:`VideoFlagInterlaced`,level:4,type:`u`,mandatory:!0,minver:2,webm:!0,default:0,range:`0-1`,description:`Set if the video is interlaced. (1 bit)`},224:{name:`Video`,cppname:`TrackVideo`,level:3,type:`m`,minver:1,description:`Video settings.`},26277:{name:`TrackTranslateTrackID`,level:4,type:`b`,mandatory:!0,minver:1,webm:!1,description:`The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used.`},26303:{name:`TrackTranslateCodec`,level:4,type:`u`,mandatory:!0,minver:1,webm:!1,description:`The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).`},26364:{name:`TrackTranslateEditionUID`,level:4,type:`u`,multiple:!0,minver:1,webm:!1,description:`Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment.`},22203:{name:`SeekPreRoll`,level:3,type:`u`,mandatory:!0,multiple:!1,default:0,minver:4,webm:!0,description:`After a discontinuity, SeekPreRoll is the duration in nanoseconds of the data the decoder must decode before the decoded data is valid.`},22186:{name:`CodecDelay`,level:3,type:`u`,multiple:!1,default:0,minver:4,webm:!0,description:`CodecDelay is The codec-built-in delay in nanoseconds. This value must be subtracted from each block timestamp in order to get the actual timestamp. The value should be small so the muxing of tracks with the same actual timestamp are in the same Cluster.`},28587:{name:`TrackOverlay`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc.`},170:{name:`CodecDecodeAll`,level:3,type:`u`,mandatory:!0,minver:2,webm:!1,default:1,range:`0-1`,description:`The codec can decode potentially damaged data (1 bit).`},2536e3:{name:`CodecDownloadURL`,level:3,type:`s`,multiple:!0,webm:!1,description:`A URL to download about the codec used.`},3883072:{name:`CodecInfoURL`,level:3,type:`s`,multiple:!0,webm:!1,description:`A URL to find information about the codec used.`},3839639:{name:`CodecSettings`,level:3,type:`8`,webm:!1,description:`A string describing the encoding setting used.`},25506:{name:`CodecPrivate`,level:3,type:`b`,minver:1,description:`Private data only known to the codec.`},2274716:{name:`Language`,cppname:`TrackLanguage`,level:3,type:`s`,minver:1,default:`eng`,description:`Specifies the language of the track in the Matroska languages form.`},21358:{name:`Name`,cppname:`TrackName`,level:3,type:`8`,minver:1,description:`A human-readable track name.`},21998:{name:`MaxBlockAdditionID`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`The maximum value of BlockAdditions for this track.`},21375:{name:`TrackOffset`,level:3,type:`i`,webm:!1,default:0,description:`A value to add to the Block's Timestamp. This can be used to adjust the playback offset of a track.`},2306383:{name:`TrackTimecodeScale`,level:3,type:`f`,mandatory:!0,minver:1,maxver:`3`,webm:!1,default:1,range:`> 0`,description:`DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs).`},2313850:{name:`DefaultDecodedFieldDuration`,cppname:`TrackDefaultDecodedFieldDuration`,level:3,type:`u`,minver:4,range:`not 0`,description:`The period in nanoseconds (not scaled by TimcodeScale)
|
|
5
|
-
between two successive fields at the output of the decoding process (see the notes)`},2352003:{name:`DefaultDuration`,cppname:`TrackDefaultDuration`,level:3,type:`u`,minver:1,range:`not 0`,description:`Number of nanoseconds (not scaled via TimecodeScale) per frame ('frame' in the Matroska sense -- one element put into a (Simple)Block).`},28152:{name:`MaxCache`,cppname:`TrackMaxCache`,level:3,type:`u`,minver:1,webm:!1,description:`The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.`},28135:{name:`MinCache`,cppname:`TrackMinCache`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used.`},156:{name:`FlagLacing`,cppname:`TrackFlagLacing`,level:3,type:`u`,mandatory:!0,minver:1,default:1,range:`0-1`,description:`Set if the track may contain blocks using lacing. (1 bit)`},21930:{name:`FlagForced`,cppname:`TrackFlagForced`,level:3,type:`u`,mandatory:!0,minver:1,default:0,range:`0-1`,description:`Set if that track MUST be active during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit)`},185:{name:`FlagEnabled`,cppname:`TrackFlagEnabled`,level:3,type:`u`,mandatory:!0,minver:2,webm:!0,default:1,range:`0-1`,description:`Set if the track is usable. (1 bit)`},29637:{name:`TrackUID`,level:3,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file.`},215:{name:`TrackNumber`,level:3,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).`},174:{name:`TrackEntry`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Describes a track with all elements.`},374648427:{name:`Tracks`,level:1,type:`m`,multiple:!0,minver:1,description:`A top-level block of information with many tracks described.`},175:{name:`EncryptedBlock`,level:2,type:`b`,multiple:!0,webm:!1,description:`Similar to EncryptedBlock Structure)`},202:{name:`ReferenceTimeCode`,level:4,type:`u`,multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},201:{name:`ReferenceOffset`,level:4,type:`u`,multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},200:{name:`ReferenceFrame`,level:3,type:`m`,multiple:!1,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},207:{name:`SliceDuration`,level:5,type:`u`,default:0,description:`The (scaled) duration to apply to the element.`},206:{name:`Delay`,cppname:`SliceDelay`,level:5,type:`u`,default:0,description:`The (scaled) delay to apply to the element.`},203:{name:`BlockAdditionID`,cppname:`SliceBlockAddID`,level:5,type:`u`,default:0,description:`The ID of the BlockAdditional element (0 is the main Block).`},205:{name:`FrameNumber`,cppname:`SliceFrameNumber`,level:5,type:`u`,default:0,description:`The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).`},204:{name:`LaceNumber`,cppname:`SliceLaceNumber`,level:5,type:`u`,minver:1,default:0,divx:!1,description:`The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.`},232:{name:`TimeSlice`,level:4,type:`m`,multiple:!0,minver:1,divx:!1,description:`Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.`},142:{name:`Slices`,level:3,type:`m`,minver:1,divx:!1,description:`Contains slices description.`},30114:{name:`DiscardPadding`,level:3,type:`i`,minver:4,webm:!0,description:`Duration in nanoseconds of the silent data added to the Block (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and should be discarded during playback.`},164:{name:`CodecState`,level:3,type:`b`,minver:2,webm:!1,description:`The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry.`},253:{name:`ReferenceVirtual`,level:3,type:`i`,webm:!1,description:`Relative position of the data that should be in position of the virtual block.`},251:{name:`ReferenceBlock`,level:3,type:`i`,multiple:!0,minver:1,description:`Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it's attached to.`},250:{name:`ReferencePriority`,cppname:`FlagReferenced`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced.`},155:{name:`BlockDuration`,level:3,type:`u`,minver:1,default:`TrackDuration`,description:`The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track (but can be omitted as other default values). When not written and with no DefaultDuration, the value is assumed to be the difference between the timestamp of this Block and the timestamp of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. When set to 0 that means the frame is not a keyframe.`},165:{name:`BlockAdditional`,level:5,type:`b`,mandatory:!0,minver:1,webm:!1,description:`Interpreted by the codec as it wishes (using the BlockAddID).`},238:{name:`BlockAddID`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`not 0`,description:`An ID to identify the BlockAdditional level.`},166:{name:`BlockMore`,level:4,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Contain the BlockAdditional and some parameters.`},30113:{name:`BlockAdditions`,level:3,type:`m`,minver:1,webm:!1,description:`Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data.`},162:{name:`BlockVirtual`,level:3,type:`b`,webm:!1,description:`A Block with no data. It must be stored in the stream at the place the real Block should be in display order. (see Block Virtual)`},161:{name:`Block`,level:3,type:`b`,mandatory:!0,minver:1,description:`Block containing the actual data to be rendered and a timestamp relative to the Cluster Timecode. (see Block Structure)`},160:{name:`BlockGroup`,level:2,type:`m`,multiple:!0,minver:1,description:`Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock.`},163:{name:`SimpleBlock`,level:2,type:`b`,multiple:!0,minver:2,webm:!0,divx:!0,description:`Similar to SimpleBlock Structure`},171:{name:`PrevSize`,cppname:`ClusterPrevSize`,level:2,type:`u`,minver:1,description:`Size of the previous Cluster, in octets. Can be useful for backward playing.`,position:`prevCluster`},167:{name:`Position`,cppname:`ClusterPosition`,level:2,type:`u`,minver:1,webm:!1,description:`The Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.`,position:`segment`},22743:{name:`SilentTrackNumber`,cppname:`ClusterSilentTrackNumber`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster.`},231:{name:`Timecode`,cppname:`ClusterTimecode`,level:2,type:`u`,mandatory:!0,minver:1,description:`Absolute timestamp of the cluster (based on TimecodeScale).`},524531317:{name:`Cluster`,level:1,type:`m`,multiple:!0,minver:1,description:`The lower level element containing the (monolithic) Block structure.`},19840:{name:`MuxingApp`,level:2,type:`8`,mandatory:!0,minver:1,description:`Muxing application or library ("libmatroska-0.4.3").`},31657:{name:`Title`,level:2,type:`8`,minver:1,webm:!1,description:`General name of the segment.`},2807730:{name:`TimecodeScaleDenominator`,level:2,type:`u`,mandatory:!0,minver:4,default:`1000000000`,description:`Timestamp scale numerator, see TimecodeScale.`},2807729:{name:`TimecodeScale`,level:2,type:`u`,mandatory:!0,minver:1,default:`1000000`,description:`Timestamp scale in nanoseconds (1.000.000 means all timestamps in the segment are expressed in milliseconds).`},27045:{name:`ChapterTranslateID`,level:3,type:`b`,mandatory:!0,minver:1,webm:!1,description:`The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used.`},27071:{name:`ChapterTranslateCodec`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,description:`The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).`},27132:{name:`ChapterTranslateEditionUID`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment.`},4096955:{name:`NextFilename`,level:2,type:`8`,minver:1,webm:!1,description:`An escaped filename corresponding to the next segment.`},4110627:{name:`NextUID`,level:2,type:`b`,minver:1,webm:!1,bytesize:16,description:`A unique ID to identify the next chained segment (128 bits).`},3965867:{name:`PrevFilename`,level:2,type:`8`,minver:1,webm:!1,description:`An escaped filename corresponding to the previous segment.`},3979555:{name:`PrevUID`,level:2,type:`b`,minver:1,webm:!1,bytesize:16,description:`A unique ID to identify the previous chained segment (128 bits).`},29604:{name:`SegmentUID`,level:2,type:`b`,minver:1,webm:!1,range:`not 0`,bytesize:16,description:`A randomly generated unique ID to identify the current segment between many others (128 bits).`},357149030:{name:`Info`,level:1,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains miscellaneous general information and statistics on the file.`},21420:{name:`SeekPosition`,level:3,type:`u`,mandatory:!0,minver:1,description:`The position of the element in the segment in octets (0 = first level 1 element).`,position:`segment`},21419:{name:`SeekID`,level:3,type:`b`,mandatory:!0,minver:1,description:`The binary ID corresponding to the element name.`,type2:`ebmlID`},19899:{name:`Seek`,cppname:`SeekPoint`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains a single seek entry to an EBML element.`},290298740:{name:`SeekHead`,cppname:`SeekHeader`,level:1,type:`m`,multiple:!0,minver:1,description:`Contains the position of other level 1 elements.`},32379:{name:`SignatureElementList`,level:2,type:`m`,multiple:!0,webm:!1,i:`Cluster|Block|BlockAdditional`,description:`A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption.`},32347:{name:`SignatureElements`,level:1,type:`m`,webm:!1,description:`Contains elements that will be used to compute the signature.`},32437:{name:`Signature`,level:1,type:`b`,webm:!1,description:`The signature of the data (until a new.`},32421:{name:`SignaturePublicKey`,level:1,type:`b`,webm:!1,description:`The public key to use with the algorithm (in the case of a PKI-based signature).`},32410:{name:`SignatureHash`,level:1,type:`u`,webm:!1,description:`Hash algorithm used (1=SHA1-160, 2=MD5).`},32394:{name:`SignatureAlgo`,level:1,type:`u`,webm:!1,description:`Signature algorithm used (1=RSA, 2=elliptic).`},458458727:{name:`SignatureSlot`,level:-1,type:`m`,multiple:!0,webm:!1,description:`Contain signature of some (coming) elements in the stream.`},191:{name:`CRC-32`,level:-1,type:`b`,minver:1,webm:!1,description:`The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian`,crc:!0},236:{name:`Void`,level:-1,type:`b`,minver:1,description:`Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use.`},17139:{name:`EBMLMaxSizeLength`,level:1,type:`u`,mandatory:!0,default:8,minver:1,description:`The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid.`},17138:{name:`EBMLMaxIDLength`,level:1,type:`u`,mandatory:!0,default:4,minver:1,description:`The maximum length of the IDs you'll find in this file (4 or less in Matroska).`},17143:{name:`EBMLReadVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The minimum EBML version a parser has to support to read this file.`},440786851:{name:`EBML`,level:`0`,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Set the EBML characteristics of the data to follow. Each EBML document has to start with this.`},21936:{name:`Colour`,level:`4`,type:`m`,mandatory:!0,multiple:!0,description:`Settings describing the colour format.`},21937:{name:`MatrixCoefficients`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273.`},21945:{name:`Range`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`Clipping of the color ranges.`},21946:{name:`TransferCharacteristics`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The transfer characteristics of the video.`},21947:{name:`Primaries`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273.`}}})),Td=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Nd(),n=Nd(),r=wd();e.default=function(){function e(){this._schema=r.byEbmlID,this._buffers=[],this._stack=[]}return e.prototype.encode=function(e){var n=this;return t.concat(e.reduce(function(e,t){return e.concat(n.encodeChunk(t))},[])).buffer},e.prototype.encodeChunk=function(e){return e.type===`m`?e.isEnd?this.endTag(e):this.startTag(e):(e.data=n.Buffer.from(e.data),this.writeTag(e)),this.flush()},e.prototype.flush=function(){var e=this._buffers;return this._buffers=[],e},e.prototype.getSchemaInfo=function(e){for(var t=Object.keys(this._schema).map(Number),r=0;r<t.length;r++){var i=t[r];if(this._schema[i].name===e)return new n.Buffer(i.toString(16),`hex`)}return null},e.prototype.writeTag=function(e){var n=e.name,r=this.getSchemaInfo(n),i=e.data;if(r==null)throw Error(`No schema entry found for `+n);var a=t.encodeTag(r,i);if(this._stack.length>0){this._stack[this._stack.length-1].children.push({tagId:r,elm:e,children:[],data:a});return}this._buffers=this._buffers.concat(a)},e.prototype.startTag=function(e){var r=e.name,i=this.getSchemaInfo(r);if(i==null)throw Error(`No schema entry found for `+r);if(e.unknownSize){var a=t.encodeTag(i,new n.Buffer(0),e.unknownSize);this._buffers=this._buffers.concat(a);return}var o={tagId:i,elm:e,children:[],data:null};this._stack.length>0&&this._stack[this._stack.length-1].children.push(o),this._stack.push(o)},e.prototype.endTag=function(e){e.name;var n=this._stack.pop();if(n==null||n.elm.name!==e.name)throw Error(`EBML structure is broken`);var r=n.children.reduce(function(e,t){if(t.data===null)throw Error(`EBML structure is broken`);return e.concat(t.data)},[]),i=t.concat(r);n.elm.type===`m`?n.data=t.encodeTag(n.tagId,i,n.elm.unknownSize):n.data=t.encodeTag(n.tagId,i),this._stack.length<1&&(this._buffers=this._buffers.concat(n.data))},e}()})),Ed=s((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),Dd=s((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),Od=s((e=>{var t=Ed(),n=Dd(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Te(e,ArrayBuffer)||e&&Te(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Te(e,SharedArrayBuffer)||e&&Te(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(Te(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||N(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Te(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Te(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Te(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Te(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return be(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Ce(e).length;default:if(i)return r?-1:be(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return ae(this,t,n);case`utf8`:case`utf-8`:return k(this,t,n);case`ascii`:return re(this,t,n);case`latin1`:case`binary`:return ie(this,t,n);case`base64`:return ee(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return oe(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?k(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Te(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,N(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(N(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return we(be(t,e.length-n),e,n,r)}function E(e,t,n,r){return we(xe(t),e,n,r)}function D(e,t,n,r){return we(Ce(t),e,n,r)}function O(e,t,n,r){return we(Se(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function ee(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return ne(r)}var te=4096;function ne(e){let t=e.length;if(t<=te)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=te));return n}function re(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function ie(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function ae(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=Ee[e[r]];return i}function oe(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function A(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),n.read(this,e,!1,52,8)};function j(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function se(e,t,n,r,i){he(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function M(e,t,n,r,i){he(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=De(function(e,t=0){return se(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=De(function(e,t=0){return M(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=De(function(e,t=0){return se(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=De(function(e,t=0){return M(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ce(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function le(e,t,r,i,a){return t=+t,r>>>=0,a||ce(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return le(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return le(this,e,t,!1,n)};function ue(e,t,r,i,a){return t=+t,r>>>=0,a||ce(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return ue(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return ue(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var de={};function fe(e,t,n){de[e]=class extends n{constructor(){super(),Object.defineProperty(this,`message`,{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,`code`,{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}fe(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),fe(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),fe(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=pe(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=pe(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function pe(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function me(e,t,n){ge(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&_e(t,e.length-(n+1))}function he(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new de.ERR_OUT_OF_RANGE(`value`,i,e)}me(r,i,a)}function ge(e,t){if(typeof e!=`number`)throw new de.ERR_INVALID_ARG_TYPE(t,`number`,e)}function _e(e,t,n){throw Math.floor(e)===e?t<0?new de.ERR_BUFFER_OUT_OF_BOUNDS:new de.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ge(e,n),new de.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var ve=/[^+/0-9A-Za-z-_]/g;function ye(e){if(e=e.split(`=`)[0],e=e.trim().replace(ve,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function be(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function xe(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Se(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Ce(e){return t.toByteArray(ye(e))}function we(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Te(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function N(e){return e!==e}var Ee=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function De(e){return typeof BigInt>`u`?Oe:e}function Oe(){throw Error(`BigInt not supported`)}})),kd=s((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(e,`__esModule`,{value:!0});var r=Nd();e.default=function(){function e(){}return e.readVint=function(t,n){n===void 0&&(n=0);var r=8-Math.floor(Math.log2(t[n]));if(r>8){var i=e.readHexString(t,n,n+r);throw Error(`Unrepresentable length: ${r} ${i}`)}if(n+r>t.length)return null;for(var a=t[n]&(1<<8-r)-1,o=1;o<r;o+=1){if(o===7&&a>=2**8&&t[n+7]>0)return{length:r,value:-1};a*=2**8,a+=t[n+o]}return{length:r,value:a}},e.writeVint=function(e){if(e<0||e>2**53)throw Error(`Unrepresentable value: ${e}`);var t=1;for(t=1;t<=8&&!(e<2**(7*t)-1);t+=1);for(var n=r.Buffer.alloc(t),i=e,a=1;a<=t;a+=1){var o=i&255;n[t-a]=o,i-=o,i/=2**8}return n[0]|=1<<8-t,n},e.concatenate=function(e,t){return!e&&!t?r.Buffer.from([]):!e||e.byteLength===0?t:!t||t.byteLength===0?e:r.Buffer.from(n(n([],e,!0),t,!0))},e.readHexString=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),Array.from(e.slice(t,n)).map(function(e){return Number(e).toString(16)}).reduce(function(e,t){return`${e}${t.padStart(2,`0`)}`},``)},e.readUtf8=function(e){try{return r.Buffer.from(e).toString(`utf8`)}catch{return null}},e.readUnsigned=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return n.getUint8(0);case 2:return n.getUint16(0);case 4:return n.getUint32(0);default:break}return t.byteLength<=6?t.reduce(function(e,t){return e*256+t},0):e.readHexString(t,0,t.byteLength)},e.readSigned=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:return NaN}},e.readFloat=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return t.getFloat32(0);case 8:return t.getFloat64(0);default:return NaN}},e.readDate=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return new Date(n.getUint8(0));case 2:return new Date(n.getUint16(0));case 4:return new Date(n.getUint32(0));case 8:return new Date(Number.parseInt(e.readHexString(t),16));default:return new Date(0)}},e.readDataFromTag=function(n,r){var i=n.type,a=n.name,o=n.track,s=n.discardable||!1,c=n.keyframe||!1,l=null,u;switch(i){case`u`:u=e.readUnsigned(r);break;case`f`:u=e.readFloat(r);break;case`i`:u=e.readSigned(r);break;case`s`:u=String.fromCharCode.apply(String,r);break;case`8`:u=e.readUtf8(r);break;case`d`:u=e.readDate(r);break;default:break}if(a===`SimpleBlock`||a===`Block`){var d=0,f=e.readVint(r,d),p=f.length,m=f.value;d+=p,o=m,u=e.readSigned(r.subarray(d,d+2)),d+=2,a===`SimpleBlock`&&(c=!!(r[p+2]&128),s=!!(r[p+2]&1)),d+=1,l=r.subarray(d)}return t(t({},n),{data:r,discardable:s,keyframe:c,payload:l,track:o,value:u})},e}()})),Ad=s(((e,t)=>{t.exports=function(e,t,n){t||=0;for(var r=1;r<=8&&!(e[t]>=2**(8-r));r++);if(r>8)throw Error(`Unrepresentable length: `+r+` `+e.toString(`hex`,t,t+r));if(t+r>e.length)return null;var i,a=e[t]&(1<<8-r)-1;for(i=1;i<r;i++){if(i===7&&a>=2**45&&e[t+7]>0)return{length:r,value:-1};a*=2**8,a+=e[t+i]}return n&&(a-=2**(r*7-1)-1),{length:r,value:a}}})),jd=s(((e,t)=>{var n=Ad();function r(e){this.buffer=e,this.offset=0}r.prototype.nextInt16BE=function(){var e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e},r.prototype.nextUInt8=function(){var e=this.buffer.readUInt8(this.offset);return this.offset+=1,e},r.prototype.nextUIntV=function(){var e=n(this.buffer,this.offset);return this.offset+=e.length,e.value},r.prototype.nextIntV=function(){var e=n(this.buffer,this.offset,!0);return this.offset+=e.length,e.value},r.prototype.nextBuffer=function(e){var t=e?this.buffer.slice(this.offset,this.offset+e):this.buffer.slice(this.offset);return this.offset+=e||this.length,t},Object.defineProperty(r.prototype,`length`,{get:function(){return this.buffer.length-this.offset}}),t.exports=r})),Md=s(((e,t)=>{var n=jd(),r=1,i=3,a=2;t.exports=function(e){var t={},r=new n(e);t.trackNumber=r.nextUIntV(),t.timecode=r.nextInt16BE();var i=r.nextUInt8();return t.invisible=!!(i&8),t.keyframe=!!(i&128),t.discardable=!!(i&1),t.frames=o(r,(i&6)>>1),t};function o(e,t){if(!t)return[e.nextBuffer()];var n,o,s=[],c=e.nextUInt8()+1;if(t===a){if(e.length%c!==0)throw Error(`Fixed-Size Lacing Error`);for(o=e.length/c,n=0;n<c;n++)s.push(e.nextBuffer(o));return s}var l=[];if(t===r)for(n=0;n<c-1;n++){var u;o=0;do u=e.nextUInt8(),o+=u;while(u===255);l.push(o)}else if(t===i)for(o=e.nextUIntV(),l.push(o),n=1;n<c-1;n++)o+=e.nextIntV(),l.push(o);for(n=0;n<c-1;n++)s.push(e.nextBuffer(l[n]));return s.push(e.nextBuffer()),s}})),Nd=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.convertEBMLDateToJSDate=e.createFloatBuffer=e.createIntBuffer=e.createUIntBuffer=e.encodeValueToBuffer=e.concat=e.putRefinedMetaData=e.extractElement=e.removeElement=e.makeMetadataSeekable=e.createRIFFChunk=e.VP8BitStreamToRiffWebPBuffer=e.WebPBlockFilter=e.encodeTag=e.readBlock=e.ebmlBlock=e.writeVint=e.readVint=e.Buffer=void 0;var t=Cd(),n=Td(),r=Od(),i=kd(),a=Md();e.Buffer=r.Buffer,e.readVint=i.default.readVint,e.writeVint=i.default.writeVint,e.ebmlBlock=a;function o(t){return(0,e.ebmlBlock)(new e.Buffer(t))}e.readBlock=o;function s(t,n,r){return r===void 0&&(r=!1),b([t,r?new e.Buffer(`01ffffffffffffff`,`hex`):(0,e.writeVint)(n.length),n])}e.encodeTag=s;function c(t){return t.reduce(function(t,n){return n.type!==`b`||n.name!==`SimpleBlock`||!(0,e.ebmlBlock)(n.data).frames.some(function(e){return e.slice(3,6).toString(`hex`)===`9d012a`})?t:t.concat(n)},[])}e.WebPBlockFilter=c;function l(t){var n=u(`VP8 `,t);return u(`RIFF`,b([new e.Buffer(`WEBP`,`ascii`),n]))}e.VP8BitStreamToRiffWebPBuffer=l;function u(t,n){var r=new e.Buffer(4);return r.writeUInt32LE(n.byteLength,0),b([new e.Buffer(t.substr(0,4),`ascii`),r,n,new e.Buffer(n.byteLength%2==0?0:1)])}e.createRIFFChunk=u;function d(t,r,i){var a=p(`EBML`,t),o=h(a)+12,s=t[t.length-1].dataEnd-o,c=p(`Info`,t);f(`Duration`,c),c.splice(1,0,{name:`Duration`,type:`f`,data:w(r,8)});for(var l=h(c),u=p(`Tracks`,t),d=h(u),m=47,g=[],_=5+i.length*15,v=[],y=-1,b=10,x=function(t){var n=m,r=n+l,a=r+d,c=a+_-s;if(g=[],g.push({name:`SeekHead`,type:`m`,isEnd:!1}),g.push({name:`Seek`,type:`m`,isEnd:!1}),g.push({name:`SeekID`,type:`b`,data:new e.Buffer([21,73,169,102])}),g.push({name:`SeekPosition`,type:`u`,data:S(n)}),g.push({name:`Seek`,type:`m`,isEnd:!0}),g.push({name:`Seek`,type:`m`,isEnd:!1}),g.push({name:`SeekID`,type:`b`,data:new e.Buffer([22,84,174,107])}),g.push({name:`SeekPosition`,type:`u`,data:S(r)}),g.push({name:`Seek`,type:`m`,isEnd:!0}),g.push({name:`Seek`,type:`m`,isEnd:!1}),g.push({name:`SeekID`,type:`b`,data:new e.Buffer([28,83,187,107])}),g.push({name:`SeekPosition`,type:`u`,data:S(a)}),g.push({name:`Seek`,type:`m`,isEnd:!0}),g.push({name:`SeekHead`,type:`m`,isEnd:!0}),m=h(g),v=[],v.push({name:`Cues`,type:`m`,isEnd:!1}),i.forEach(function(e){var t=e.CueTrack,n=e.CueClusterPosition,r=e.CueTime;v.push({name:`CuePoint`,type:`m`,isEnd:!1}),v.push({name:`CueTime`,type:`u`,data:S(r)}),v.push({name:`CueTrackPositions`,type:`m`,isEnd:!1}),v.push({name:`CueTrack`,type:`u`,data:S(t)}),n-=o,n+=c,v.push({name:`CueClusterPosition`,type:`u`,data:S(n)}),v.push({name:`CueTrackPositions`,type:`m`,isEnd:!0}),v.push({name:`CuePoint`,type:`m`,isEnd:!0})}),v.push({name:`Cues`,type:`m`,isEnd:!0}),_=h(v),y!==c){if(y=c,t===b-1)throw Error(`Failed to converge to a stable metadata size`)}else return`break`},C=0;C<b&&x(C)!==`break`;C++);var T=[].concat.apply([],[a,{name:`Segment`,type:`m`,isEnd:!1,unknownSize:!0},g,c,u,v]);return new n.default().encode(T)}e.makeMetadataSeekable=d;function f(e,t){for(var n=-1,r=0;r<t.length;r++){var i=t[r];if(i.name===e)if(i.type===`m`)if(!i.isEnd)n=r;else{if(n==-1)throw Error(`Detected ${e} closing element before finding the start`);t.splice(n,r-n+1);return}else{t.splice(r,1);return}}}e.removeElement=f;function p(e,t){for(var n=[],r=-1,i=0;i<t.length;i++){var a=t[i];if(a.name===e)if(a.type===`m`)if(!a.isEnd)r=i;else{if(r==-1)throw Error(`Detected ${e} closing element before finding the start`);n=t.slice(r,i+1);break}else{n.push(t[i]);break}}return n}e.extractElement=p;function m(t,r){Array.isArray(r.cueInfos)&&!Array.isArray(r.cues)&&(console.warn(`putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues`),r.cues=r.cueInfos);for(var i=[],a=[],o=0;o<t.length;o++){var s=t[o];if(s.type===`m`&&s.name===`Segment`){if(i=t.slice(0,o),a=t.slice(o),s.unknownSize){a.shift();break}throw Error(`this metadata is not streaming webm file`)}}if(!(a[a.length-1].dataEnd>0))throw Error(`metadata dataEnd has wrong number`);var c=a[a.length-1].dataEnd,l=i[i.length-1].dataEnd,u=new n.default().encode(i).byteLength-l,d=c-a[0].tagStart;a[0].tagStart-l,a[0].tagStart;var f=new e.Buffer([24,83,128,103]),p=new e.Buffer(`01ffffffffffffff`,`hex`),m=f.byteLength+p.byteLength,h=d,_;for(_=1;_<20;_++){var v=u+(l+m+h-c),y=g(a,v,r),b=new n.default().encode(y).byteLength;if(b===h)return new n.default().encode([].concat(i,[{type:`m`,name:`Segment`,isEnd:!1,unknownSize:!0}],y));h=b}throw Error(`unable to refine metadata, stable size could not be found in `+_+` iterations!`)}e.putRefinedMetaData=m;function h(e){var t=new n.default;return e.reduce(function(e,n){return e.concat(t.encode([n]))},[]).reduce(function(e,t){return e+t.byteLength},0)}function g(e,t,n){var r=n.duration,i=n.clusterPtrs,a=n.cues,o=e.slice(0);if(typeof r==`number`){var s=!1;o.forEach(function(e){e.type===`f`&&e.name===`Duration`&&(s=!0,e.data=w(r,8))}),s||y(o,`Info`,[{name:`Duration`,type:`f`,data:w(r,8)}])}Array.isArray(a)&&y(o,`Cues`,v(a,t));var c=[];return Array.isArray(i)&&(console.warn(`append cluster pointers to seekhead is deprecated. please use cues`),c=_(i,t)),y(o,`SeekHead`,c,!0),o}function _(t,n){var r=[];return t.forEach(function(t){r.push({name:`Seek`,type:`m`,isEnd:!1}),r.push({name:`SeekID`,type:`b`,data:new e.Buffer([31,67,182,117])}),r.push({name:`SeekPosition`,type:`u`,data:S(t+n)}),r.push({name:`Seek`,type:`m`,isEnd:!0})}),r}function v(e,t){var n=[];return e.forEach(function(e){var r=e.CueTrack,i=e.CueClusterPosition,a=e.CueTime;n.push({name:`CuePoint`,type:`m`,isEnd:!1}),n.push({name:`CueTime`,type:`u`,data:S(a)}),n.push({name:`CueTrackPositions`,type:`m`,isEnd:!1}),n.push({name:`CueTrack`,type:`u`,data:S(r)}),n.push({name:`CueClusterPosition`,type:`u`,data:S(i+t)}),n.push({name:`CueTrackPositions`,type:`m`,isEnd:!0}),n.push({name:`CuePoint`,type:`m`,isEnd:!0})}),n}function y(e,t,n,r){r===void 0&&(r=!1);for(var i=-1,a=0;a<e.length;a++){var o=e[a];if(o.type===`m`&&o.name===t&&o.isEnd===!1){i=a;break}}i>=0?Array.prototype.splice.apply(e,[i+1,0].concat(n)):r?[{name:t,type:`m`,isEnd:!1}].concat(n,[{name:t,type:`m`,isEnd:!0}]).reverse().forEach(function(t){e.unshift(t)}):(e.push({name:t,type:`m`,isEnd:!1}),n.forEach(function(t){e.push(t)}),e.push({name:t,type:`m`,isEnd:!0}))}function b(t){return e.Buffer.concat(t)}e.concat=b;function x(n){var r=new e.Buffer(0);if(n.type===`m`)return n;switch(n.type){case`u`:r=S(n.value);break;case`i`:r=C(n.value);break;case`f`:r=w(n.value);break;case`s`:r=new e.Buffer(n.value,`ascii`);break;case`8`:r=new e.Buffer(n.value,`utf8`);break;case`b`:r=n.value;break;case`d`:r=new t.Int64BE(n.value.getTime().toString()).toBuffer();break}return Object.assign({},n,{data:r})}e.encodeValueToBuffer=x;function S(n){for(var r=1;n>=2**(8*r);r++);if(r>=7)return console.warn(`7bit or more bigger uint not supported.`),new t.Uint64BE(n).toBuffer();var i=new e.Buffer(r);return i.writeUIntBE(n,0,r),i}e.createUIntBuffer=S;function C(n){for(var r=1;n>=2**(8*r);r++);if(r>=7)return console.warn(`7bit or more bigger uint not supported.`),new t.Int64BE(n).toBuffer();var i=new e.Buffer(r);return i.writeIntBE(n,0,r),i}e.createIntBuffer=C;function w(t,n){if(n===void 0&&(n=8),n===8){var r=new e.Buffer(8);return r.writeDoubleBE(t,0),r}else if(n===4){var r=new e.Buffer(4);return r.writeFloatBE(t,0),r}else throw Error(`float type bits must 4bytes or 8bytes`)}e.createFloatBuffer=w;function T(e){return e instanceof Date?e:new Date(new Date(`2001-01-01T00:00:00.000Z`).getTime()+Number(e)/1e3/1e3)}e.convertEBMLDateToJSDate=T})),Pd=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Cd(),n=Nd(),r=Nd(),i=wd(),a;(function(e){e[e.STATE_TAG=1]=`STATE_TAG`,e[e.STATE_SIZE=2]=`STATE_SIZE`,e[e.STATE_CONTENT=3]=`STATE_CONTENT`})(a||={}),e.default=function(){function e(){this._buffer=new n.Buffer(0),this._tag_stack=[],this._state=a.STATE_TAG,this._cursor=0,this._total=0,this._schema=i.byEbmlID,this._result=[]}return e.prototype.decode=function(e){this.readChunk(e);var t=this._result;return this._result=[],t},e.prototype.readChunk=function(e){for(this._buffer=r.concat([this._buffer,new n.Buffer(e)]);this._cursor<this._buffer.length&&!(this._state===a.STATE_TAG&&!this.readTag()||this._state===a.STATE_SIZE&&!this.readSize()||this._state===a.STATE_CONTENT&&!this.readContent()););},e.prototype.getSchemaInfo=function(e){return this._schema[e]||{name:`unknown`,level:-1,type:`unknown`,description:`unknown`}},e.prototype.readTag=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,n.readVint)(this._buffer,this._cursor);if(e==null)return!1;var t=this._buffer.slice(this._cursor,this._cursor+e.length).reduce(function(e,t,n,r){return e+t*16**(2*(r.length-1-n))},0),r=this.getSchemaInfo(t),i={EBML_ID:t.toString(16),schema:r,type:r.type,name:r.name,level:r.level,tagStart:this._total,tagEnd:this._total+e.length,sizeStart:this._total+e.length,sizeEnd:null,dataStart:null,dataEnd:null,dataSize:null,data:null};return this._tag_stack.push(i),this._cursor+=e.length,this._total+=e.length,this._state=a.STATE_SIZE,!0},e.prototype.readSize=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,n.readVint)(this._buffer,this._cursor);if(e==null)return!1;var t=this._tag_stack[this._tag_stack.length-1];return t.sizeEnd=t.sizeStart+e.length,t.dataStart=t.sizeEnd,t.dataSize=e.value,e.value===-1?(t.dataEnd=-1,t.type===`m`&&(t.unknownSize=!0)):t.dataEnd=t.sizeEnd+e.value,this._cursor+=e.length,this._total+=e.length,this._state=a.STATE_CONTENT,!0},e.prototype.readContent=function(){var e=this._tag_stack[this._tag_stack.length-1];if(e.type===`m`){if(e.isEnd=!1,this._result.push(e),this._state=a.STATE_TAG,e.dataSize===0){var r=Object.assign({},e,{isEnd:!0});this._result.push(r),this._tag_stack.pop()}return!0}if(this._buffer.length<this._cursor+e.dataSize)return!1;var i=this._buffer.slice(this._cursor,this._cursor+e.dataSize);switch(this._buffer=this._buffer.slice(this._cursor+e.dataSize),e.data=i,e.type){case`u`:e.value=i.readUIntBE(0,i.length);break;case`i`:e.value=i.readIntBE(0,i.length);break;case`f`:e.value=e.dataSize===4?i.readFloatBE(0):e.dataSize===8?i.readDoubleBE(0):(console.warn(`cannot read ${e.dataSize} octets float. failback to 0`),0);break;case`s`:e.value=i.toString(`ascii`);break;case`8`:e.value=i.toString(`utf8`);break;case`b`:e.value=i;break;case`d`:e.value=(0,n.convertEBMLDateToJSDate)(new t.Int64BE(i).toNumber());break}if(e.value===null)throw Error(`unknown tag type:`+e.type);for(this._result.push(e),this._total+=e.dataSize,this._state=a.STATE_TAG,this._cursor=0,this._tag_stack.pop();this._tag_stack.length>0;){var o=this._tag_stack[this._tag_stack.length-1];if(o.dataEnd<0)return this._tag_stack.pop(),!0;if(this._total<o.dataEnd)break;if(o.type!==`m`)throw Error(`parent element is not master element`);var r=Object.assign({},o,{isEnd:!0});this._result.push(r),this._tag_stack.pop()}return!0},e}()})),Fd=s(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),Id=s((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0});var n=Fd(),r=Nd();e.default=function(e){t(n,e);function n(){var t=e.call(this)||this;return t.logGroup=``,t.hasLoggingStarted=!1,t.metadataloaded=!1,t.chunks=[],t.stack=[],t.segmentOffset=0,t.last2SimpleBlockVideoTrackTimecode=[0,0],t.last2SimpleBlockAudioTrackTimecode=[0,0],t.lastClusterTimecode=0,t.lastClusterPosition=0,t.timecodeScale=1e6,t.metadataSize=0,t.metadatas=[],t.cues=[],t.firstVideoBlockRead=!1,t.firstAudioBlockRead=!1,t.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null},t.trackTypes=[],t.trackDefaultDuration=[],t.trackCodecDelay=[],t.trackInfo={type:`nothing`},t.ended=!1,t.logging=!1,t.use_duration_every_simpleblock=!1,t.use_webp=!1,t.use_segment_info=!0,t.drop_default_duration=!0,t}return n.prototype.stop=function(){for(this.ended=!0,this.emit_segment_info();this.stack.length;)this.stack.pop(),this.logging&&console.groupEnd();this.logging&&this.hasLoggingStarted&&this.logGroup&&console.groupEnd()},n.prototype.emit_segment_info=function(){var e=this.chunks;if(this.chunks=[],this.metadataloaded){if(!this.use_segment_info)return;var t=this.lastClusterTimecode,n=this.duration,r=this.timecodeScale;this.emit(`cluster`,{timecode:t,data:e}),this.emit(`duration`,{timecodeScale:r,duration:n})}else{this.metadataloaded=!0,this.metadatas=e;var i=this.trackTypes.indexOf(1),a=this.trackTypes.indexOf(2);if(this.trackInfo=i>=0&&a>=0?{type:`both`,trackNumber:i}:i>=0?{type:`video`,trackNumber:i}:a>=0?{type:`audio`,trackNumber:a}:{type:`nothing`},!this.use_segment_info)return;this.emit(`metadata`,{data:e,metadataSize:this.metadataSize})}},n.prototype.read=function(e){var t=this,n=!1;if(!this.ended){if(e.type===`m`)if(e.isEnd)this.stack.pop();else{var i=this.stack[this.stack.length-1];if(i!=null&&i.level>=e.level){this.stack.pop(),this.logging&&console.groupEnd(),i.dataEnd=e.dataEnd,i.dataSize=e.dataEnd-i.dataStart,i.unknownSize=!1;var a=Object.assign({},i,{name:i.name,type:i.type,isEnd:!0});this.chunks.push(a)}this.stack.push(e)}if(e.type===`m`&&e.name==`Segment`)this.segmentOffset!=0&&console.warn(`Multiple segments detected!`),this.segmentOffset=e.dataStart,this.emit(`segment_offset`,this.segmentOffset);else if(e.type===`b`&&e.name===`SimpleBlock`){var o=r.ebmlBlock(e.data),s=o.timecode,c=o.trackNumber,l=o.frames;if(this.trackTypes[c]===1){if(!this.firstVideoBlockRead&&(this.firstVideoBlockRead=!0,this.trackInfo.type===`both`||this.trackInfo.type===`video`)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit(`cue_info`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit(`cue`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockVideoTrackTimecode=[this.last2SimpleBlockVideoTrackTimecode[1],s]}else if(this.trackTypes[c]===2){if(!this.firstAudioBlockRead&&(this.firstAudioBlockRead=!0,this.trackInfo.type===`audio`)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit(`cue_info`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit(`cue`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockAudioTrackTimecode=[this.last2SimpleBlockAudioTrackTimecode[1],s]}this.use_duration_every_simpleblock&&this.emit(`duration`,{timecodeScale:this.timecodeScale,duration:this.duration}),this.use_webp&&l.forEach(function(e){if(e.slice(3,6).toString(`hex`)===`9d012a`){var n=r.VP8BitStreamToRiffWebPBuffer(e),i=new Blob([n],{type:`image/webp`}),a=t.duration;t.emit(`webp`,{currentTime:a,webp:i})}})}else e.type===`m`&&e.name===`Cluster`&&e.isEnd===!1?(this.firstVideoBlockRead=!1,this.firstAudioBlockRead=!1,this.emit_segment_info(),this.emit(`cluster_ptr`,e.tagStart),this.lastClusterPosition=e.tagStart):e.type===`u`&&e.name===`Timecode`?this.lastClusterTimecode=e.value:e.type===`u`&&e.name===`TimecodeScale`?this.timecodeScale=e.value:e.type===`m`&&e.name===`TrackEntry`?e.isEnd?(this.trackTypes[this.currentTrack.TrackNumber]=this.currentTrack.TrackType,this.trackDefaultDuration[this.currentTrack.TrackNumber]=this.currentTrack.DefaultDuration,this.trackCodecDelay[this.currentTrack.TrackNumber]=this.currentTrack.CodecDelay):this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null}:e.type===`u`&&e.name===`TrackType`?this.currentTrack.TrackType=e.value:e.type===`u`&&e.name===`TrackNumber`?this.currentTrack.TrackNumber=e.value:e.type===`u`&&e.name===`CodecDelay`?this.currentTrack.CodecDelay=e.value:e.type===`u`&&e.name===`DefaultDuration`?this.drop_default_duration?(console.warn(`DefaultDuration detected!, remove it`),n=!0):this.currentTrack.DefaultDuration=e.value:e.name===`unknown`&&console.warn(e);!this.metadataloaded&&e.dataEnd>0&&(this.metadataSize=e.dataEnd),n||this.chunks.push(e),this.logging&&this.put(e)}},Object.defineProperty(n.prototype,`duration`,{get:function(){if(this.trackInfo.type===`nothing`)return console.warn(`no video, no audio track`),0;var e=0,t=0,n=0,r=this.trackDefaultDuration[this.trackInfo.trackNumber];if(typeof r==`number`)e=r;else if(this.trackInfo.type===`both`)if(this.last2SimpleBlockAudioTrackTimecode[1]>this.last2SimpleBlockVideoTrackTimecode[1]){e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackTypes.indexOf(2)];typeof i==`number`&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}else{e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackTypes.indexOf(1)];typeof i==`number`&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if(this.trackInfo.type===`video`){e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackInfo.trackNumber];typeof i==`number`&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if(this.trackInfo.type===`audio`){e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackInfo.trackNumber];typeof i==`number`&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}var a=((this.lastClusterTimecode+n)*this.timecodeScale+e-t)/this.timecodeScale;return Math.floor(a)},enumerable:!1,configurable:!0}),n.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},n.prototype.put=function(e){this.hasLoggingStarted||(this.hasLoggingStarted=!0,this.logging&&this.logGroup&&console.groupCollapsed(this.logGroup)),e.type===`m`?e.isEnd?console.groupEnd():console.group(e.name+`:`+e.tagStart):e.type===`b`?console.log(e.name,e.type):console.log(e.name,e.tagStart,e.type,e.value)},n}(n.EventEmitter)})),Ld=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.tools=e.Reader=e.Encoder=e.Decoder=void 0,n(Sd(),e),e.Decoder=Pd().default,e.Encoder=Td().default,e.Reader=Id().default,e.tools=Nd()})),Rd=s((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0});var r=Ld();function i(e){return t(this,void 0,void 0,function(){var t,i,a,o,s,c,l,u,d,f,p,m;return n(this,function(n){switch(n.label){case 0:if(!e)throw Error(`call to fixWebmDuration requires a blob`);t=new r.Decoder,i=new r.Reader,a=e.stream(),o=a.getReader(),n.label=1;case 1:return[4,o.read()];case 2:return s=n.sent(),c=s.done,l=s.value,c?(i.stop(),[3,3]):(u=t.decode(l),u=u?.filter(function(e){return e.type!==`unknown`}),u.forEach(function(e){i.read(e)}),l=null,[3,1]);case 3:return d=r.tools.makeMetadataSeekable(i.metadatas,i.duration,i.cues),f=new Blob([d],{type:e.type}),p=e.slice(i.metadataSize),m=new Blob([f,p],{type:e.type}),[2,m]}})})}e.default=i})),zd=1e3,Bd=class{#e;#t=!1;#n=!1;#r=0;#i=0;#a=0;#o=0;#s=0;onchange=e=>{};onDurationChange=e=>{};constructor(){}start=async(e=``)=>{e||=`video_Record_${M(Date.now())}`;let t=[];return navigator.mediaDevices.getDisplayMedia({audio:!0,video:!0}).then(n=>{let r=n.getTracks();for(let e of r)e.onended=()=>this.stop();this.#t=!0,this.#n=!1,this.#e=new MediaRecorder(n),this.#e.start(zd);let i=new Date().getTime();this.#r=i,this.#a=i,this.#c(),this.#l(),this.#e.addEventListener(`dataavailable`,e=>{t.push(e.data)}),this.#e.addEventListener(`stop`,async()=>{this.#t=!1;let r=new Date().getTime();this.#i=r,this.#o+=r-this.#a,this.#c(),clearInterval(this.#s);let i=n.getTracks();for(let e of i)e.stop();if(this.#e===null)return;let a=this.#e.mimeType,o=new Blob(t,{type:a}),s;try{s=await yd(await o.arrayBuffer(),a)}catch{s=await ld(await Promise.resolve().then(()=>u(Rd(),1)))(new Blob(t,{type:a}))}let c=URL.createObjectURL(s),l=document.createElement(`a`);l.href=c,l.download=`${e}.mp4`,l.click(),URL.revokeObjectURL(c),t=[],this.#e=null})})};pause=async()=>{await new Promise(e=>setTimeout(()=>e(!0),300)),this.#e?.pause(),this.#n=!0;let e=new Date().getTime();this.#o+=e-this.#a,this.#c(),clearInterval(this.#s)};resume=async()=>{this.#e?.resume(),this.#n=!1,this.#a=new Date().getTime(),this.#c(),this.#l()};stop=async()=>{this.#e?.stop()};destroy=()=>{clearInterval(this.#s),this.#s=0,this.#t&&this.#e&&this.#e.stop()};getDuration=()=>{if(this.#a===0)return 0;let e=this.#o,t=new Date().getTime();if(this.#t&&this.#n===!1){let n=t-this.#a;this.#a=t,e+=n}return e};getInfo=()=>({active:this.#t,pause:this.#n,startTime:this.#r,endTime:this.#i,duration:this.#o});#c=()=>{let e=this.getInfo();this.onchange(e)};#l=()=>{clearInterval(this.#s),this.#s=window.setInterval(()=>{this.#o=this.getDuration(),this.onDurationChange(this.#o)},500)}},Vd=Object.defineProperty,Hd=e=>{throw TypeError(e)},Ud=(e,t,n)=>t in e?Vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wd=(e,t,n)=>Ud(e,typeof t==`symbol`?t:t+``,n),Gd=(e,t,n)=>t.has(e)||Hd(`Cannot `+n),Kd=(e,t,n)=>(Gd(e,t,`read from private field`),n?n.call(e):t.get(e)),qd=(e,t,n)=>t.has(e)?Hd(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Jd,Yd,Xd,Zd=class{constructor(e={}){Wd(this,`queue`,[]),Wd(this,`timer`,0),Wd(this,`activeIndex`,0),Wd(this,`activePromise`),Wd(this,`options`,{timeout:0}),Wd(this,`add`,(e,t={})=>new Promise(async(n,r)=>{let i=t.timeout||this.options.timeout,a=t.key||Kd(this,Jd).call(this),o=t.describe||``;if(this.queue.findIndex(e=>e.key===a)!==-1)return r(`${a} is exist.`);let s={key:a,func:e,describe:o,timeout:i,resolve:n,reject:r};this.queue.unshift(s),this.activePromise||Kd(this,Xd).call(this)})),Wd(this,`clear`,()=>{this.queue=[],this.activePromise=void 0,clearTimeout(this.timer)}),Wd(this,`retry`,()=>{Kd(this,Xd).call(this)}),qd(this,Jd,()=>(this.activeIndex+=1,`${this.activeIndex}`)),qd(this,Yd,e=>{let t=this.queue.findIndex(t=>t.key===e);this.queue.splice(t,1)}),qd(this,Xd,async()=>{let e=this.queue.length;if(e===0)return;let t=e-1;this.activePromise=this.queue[t];let{key:n,func:r,resolve:i,reject:a,timeout:o}=this.activePromise;o&&(this.timer=window.setTimeout(()=>{a(`pr-async-queue: ${n} is timeout.`),Kd(this,Xd).call(this)},o)),await r().then(i).catch(a).finally(()=>{clearTimeout(this.timer),this.activePromise=void 0,Kd(this,Yd).call(this,n),Kd(this,Xd).call(this)})}),this.options={timeout:0,...e}}};Jd=new WeakMap,Yd=new WeakMap,Xd=new WeakMap;var Qd=class{_requestAnimationFrameId;_requestAnimationFrameItems=new Map;_lastInvokeTime=new Map;addRequestAnimationFrame=(e,t,n)=>{this._requestAnimationFrameId||this.init();let r=1e3/Math.max(1,Math.min(120,n?.fps??20));this._requestAnimationFrameItems.set(e,n=>{let i=n??performance.now();i-(this._lastInvokeTime.get(e)??0)>=r&&(this._lastInvokeTime.set(e,i),t(n))})};clearRequestAnimationFrame=(e=[])=>{e.length===0&&(e=[...this._requestAnimationFrameItems.keys()]);for(let t of e)this._requestAnimationFrameItems.delete(t),this._lastInvokeTime.delete(t)};init=()=>{let e=t=>{let n=this._requestAnimationFrameItems.values();for(let e of n)e(t);if(this._requestAnimationFrameItems.size===0){this._requestAnimationFrameId=void 0;return}this._requestAnimationFrameId=requestAnimationFrame(e)};this._requestAnimationFrameId=requestAnimationFrame(e)};stop=()=>{this._requestAnimationFrameId!==void 0&&(cancelAnimationFrame(this._requestAnimationFrameId),this._requestAnimationFrameId=void 0)}},$d=class{config=new S;notifys=new ue;localMedias=new Ki;intervalQueue=new ku;asyncQueue=new Zd;traffic=new C;recorder=new Bd;animationFrame=new Qd;users=new mu({config:this.config,localMedias:this.localMedias,notifys:this.notifys});cws=new od({config:this.config});peer=new $l({config:this.config,users:this.users});constructor(){this.cws.on.log=e=>this.notifys.emit(`onLog`,{code:200,desc:`Message log.`,data:{message:e}}),this.intervalQueue.startQueue(),this.localMedias.on.devicechange=()=>this.notifys.emit(`onDevicechange`,{code:200,data:{},desc:`MediaDevice is change.`})}use=({rnnoise:e})=>{e!==void 0&&this.users.localUser.streamControls.mc_audio?.use({rnnoise:e})};setRoomState=e=>{this.config.roomState!==e&&(this.config.roomState=e,e===`closed`&&(this.config.isInRoom=!1),this.notifys.emit(`onRoomState`,{code:200,desc:`RoomState is change.`,data:{state:e}}))};setPeerState=e=>{this.config.peerState=e,this.notifys.emit(`onPeerState`,{code:200,desc:`PeerState is change.`,data:{state:e}})};guardNotifyRoomId=(e,t)=>e===this.config.roomId?!0:(e!==void 0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ff0097;padding:16px 0;`,`------->quickvo: The received message does not belong to the current room.(${this.config.roomId})`,t),!1);hasAsyncTask=e=>{let t=!1;return this.asyncQueue.activePromise?.describe===e&&(t=!0),t===!1&&this.asyncQueue.queue.find(t=>t.describe===e)&&(t=!0),t};setCallStrategy=async(e,t=[])=>{t.length===0&&(t=B);let n=`balanced`;switch(e){case`qualityPriority`:n=`maintain-resolution`;break;case`fluencyPriority`:n=`maintain-framerate`;break;case`balancedDowngrade`:n=`balanced`;break}await this.peer.setRTCRtpSenderParameters({degradationPreference:n},t);let r=this.users.remoteUsers.values();for(let e of r)e.p2p?.setRTCRtpSenderParameters({degradationPreference:n},t)};_checkUserStreamOrigin=({p2pAverageQuality:e,sfuAverageQuality:t})=>e-(t+this.config.sfuPriority)>=0?`p2p`:`sfu`;_reportP2PConnect=(e,t)=>{if(this.cws.hasEvent(`reportP2PConnectEx`))return;let n;switch(e){case`success`:n=0;break;case`fail`:n=1;break;case`ignore`:n=2;break;case`disconnect`:n=3;break;case`poor_network`:n=4;break}let{mediaTypes:r,...i}=t,a=[];for(let e of r){let t=B.findIndex(t=>t===e);a.push(t)}return this.cws.createRequest(`reportP2PConnectEx`).send({data:{...i,code:n,types:a},compress:!1,version:3})};_reportLog=(e,t=`未知错误`)=>{if(t===`clear`)return;let{appid:n,userId:r,logUrl:i,reportErr:a}=this.config;if(this.notifys.emit(`onLog`,{code:0,desc:t,data:{type:e}}),!a||!this.config.logUrl)return;let o=(e=>({ws_c_timeout:0,webrtc_c_timeout:1,join_room_error:2,publish_error:3,subscribe_error:4,close_track_error:5,heartbeat_e_timeout:6,heartbeat_i_timeout:7,quit_room_error:8})[e].toString())(e);{let e={origin:`web`,type:o,app_id:n,user_id:r,desc:t},a=`${i}/upload/log?log_key=${btoa(encodeURI(JSON.stringify(e)))}`;(async()=>{let t;try{let e=await Zu(`#quickvo.logs`);t=JSON.stringify($u(e))}catch{t=JSON.stringify([])}let n=new TextEncoder().encode(t);this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: reportLog`,{obj:e,url:a,size:w(n.byteLength)});let r=new Uint8Array(n);fetch(a,{headers:{"Content-Type":`application/octet-stream`},method:`POST`,body:r}).catch(()=>{this.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: reportLog is error.`,{obj:e,url:a,size:w(n.byteLength)})})})()}}},ef=class{base;constructor({base:e}){this.base=e,this.base.cws.on.onUpdateCall=e=>{let t=e.data?.user;if(!t)return;let{id:n,callAction:r=0}=t,i=this.base.users.getRemoteUserContent(n);i&&(i.updateCallAction(r),this.base.users.emitUsersChange())},this.base.cws.on.onRoomUserSpeech=e=>{this.base.notifys.emit(`onRoomUserSpeech`,e)},this.base.cws.on.onBeforeTokenExpire=e=>{this.base.notifys.emit(`onBeforeTokenExpire`,e)},this.base.cws.on.onTokenExpired=e=>{this.base.notifys.emit(`onTokenExpired`,e)},this.base.cws.on.onCDNPlayUrlAdd=e=>{this.base.notifys.emit(`onCDNPlayUrlAdd`,e)},this.base.cws.on.onNetQuality=e=>{let{qualities:t=[]}=e.data,n=!1;for(let e of t){let{userId:t,egress:r,ingress:i}=e,a=this.base.users.getRemoteUserContent(t);a&&a.updateNetwork({egress:r,ingress:i})===!1&&(n=!0)}n&&this.base.users.emitUsersChange()},this.base.cws.on.onRtcStats=e=>{let{stats:t}=e.data;for(let e of t){let{userId:t}=e;this.base.users.getRemoteUserContent(t)?.setPeerRtcStats(e)}}}_debugger=async()=>{await this.base.cws.createRequest(`debugger`,{onBack:!1}).send({data:{}})};_ai=async()=>{await this.base.cws.createRequest(`ai`,{onBack:!1}).send({data:{}})}},tf=(e,t)=>{if(!(e!=null&&e.ip)||!(e!=null&&e.port)||!(e!=null&&e.serve_ip)||!(e!=null&&e.serve_port)||!(t!=null&&t.ip)||!(t!=null&&t.port)||!(t!=null&&t.serve_ip)||!(t!=null&&t.serve_port))return`Unknown`;let[n,r]=[e.ip,e.port],[i,a]=[e.serve_ip,e.serve_port],[o,s]=[t.ip,t.port],[c,l]=[t.serve_ip,t.serve_port];return n===o&&r===s?`Full Cone`:n===i&&(o!==i||s!==r)||o===c&&(n!==c||r!==s)?`Restricted Cone`:n===i&&r===a&&(o!==i||s!==a)||o===c&&s===l&&(n!==c||r!==l)?`Port Restricted Cone`:`Symmetric`},nf=async()=>{let e=async e=>new Promise(t=>{let n=new RTCPeerConnection({iceServers:[{urls:`stun:${e}`}]});n.createDataChannel(`ice-channel`);let r=null;n.onicecandidate=i=>{if(i.candidate?.type===`srflx`){let[a,o]=e.split(`:`).map(e=>e.trim());r={ip:i.candidate.address||``,port:i.candidate.port?.toString(),serve_ip:a,serve_port:o},n.close(),t(r)}},setTimeout(()=>{n.close(),t(null)},5e3),n.createOffer().then(e=>n.setLocalDescription(e)).catch(()=>t(null))});try{let t=await e(`stun.cloudflare.com:3478`),n=await e(`stun.l.google.com:19302`);if(!t||!n)return{address:``,natType:`Unknown`};let r=tf(t,n);return{address:t.ip||``,natType:r}}catch(e){return console.error(`获取NAT类型失败:`,e),{address:``,natType:`Unknown`}}},rf=class{debounceMs;timer;state=`ready`;promise;_resolve;_reject;pendingFn;constructor(e=0){this.debounceMs=e}begin=()=>{this.state===`ready`&&(this.state=`waiting`,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t}))};exe=e=>{this.begin(),this.pendingFn=e,this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0);let t=()=>{this.timer=void 0,this._runFlush()};return this.debounceMs>0?this.timer=setTimeout(t,this.debounceMs):queueMicrotask(t),this.promise};_runFlush=async()=>{let e=this.pendingFn;if(this.pendingFn=void 0,!(!e||this.state!==`waiting`))try{let t=await e();this.resolve(t)}catch(e){this.reject(e)}};resolve=e=>{this.state===`waiting`&&(this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0),this.pendingFn=void 0,this.state=`ready`,this._resolve?.(e))};reject=e=>{this.state===`waiting`&&(this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0),this.pendingFn=void 0,this.state=`ready`,this._reject?.(e))};clear=()=>{this.reject(`clear`)}},af=class{#e={timeout:5*1e3,check:!1};#t=null;constructor(e={}){this.#e={...this.#e,...e}}#n=(e,t)=>new Promise(async n=>{this.#t=new AbortController;let{signal:r}=this.#t,i=this.#e.timeout,a=setTimeout(()=>{this.#t?.abort(`Timeout (${i}ms)`)},i);await fetch(e,{cache:`no-store`,...t,method:`HEAD`,signal:r}).then(e=>{clearTimeout(a),n({status:e.status===200?`successed`:`failed`,reason:e.status===200?``:`HTTP ${e.status}`})}).catch(e=>{if(clearTimeout(a),e.name===`AbortError`){let e=r.reason||`Actively stopped`;n({status:e.includes(`Timeout`)?`timeout`:`stopped`,reason:e})}else n({status:`error`,reason:e.message})})});request=(e,t)=>new Promise(async(n,r)=>{try{this.stop(),this.#e.check&&await this.#n(e),this.#t=new AbortController;let{signal:r}=this.#t;n(await fetch(e,{cache:`no-store`,...t,signal:r}))}catch(e){r(e)}});stop=()=>{if(this.#t?.signal.aborted===!1){let e=Error(`Actively stopped.`);e.name=`AbortError`,this.#t.abort(e)}}},of=class e{base;_onOnline;_reconnectTimerId;_networkCalculating=!1;_lastTrackAnalysisWarnTime=0;_turnRefreshTimerId;static _maxInNumberArray(e){if(e.length===0)return 0;let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];r>t&&(t=r)}return t}static _minInNumberArray(e){if(e.length===0)return 0;let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];r<t&&(t=r)}return t}_cwsConnectTask=new rf;_connectCFTask=new rf;_publishTask=new rf(300);_publishNotifyTask=new rf(300);_stopPublishTask=new rf(300);_subscribeTask=new rf(300);_stopSubscribeTask=new rf(300);_syncRoomInfoTask=new rf;_restorePeerTask=new rf;_quitRoomTask=new rf;_lastUpdateNetworkTime=0;constructor({base:e}){this.base=e,this.base.cws.on.state=e=>{switch(e){case`connecting`:case`reconnecting`:this.base.setRoomState(`connecting`);break;case`connected`:this.base.setRoomState(`connected`),this.base.config.isInRoom===!0&&this._syncRoomInfo().catch(()=>this.quitRoom());break;case`closed`:this.quitRoom();break}},this.base.peer.on.state=e=>{switch(e){case`failed`:case`closed`:this._restorePeer().catch(()=>this.quitRoom());break;default:this.base.setPeerState(e);break}},this.base.cws.on.updateSeverTime=e=>{let{versionStr:t}=e.data;this.base.config.serviceEventVersion&&t!==this.base.config.serviceEventVersion&&(async()=>{this._publishTask.state===`waiting`&&await this._publishTask.promise,this._stopPublishTask.state===`waiting`&&await this._subscribeTask.promise,this._subscribeTask.state===`waiting`&&await this._subscribeTask.promise,this._stopSubscribeTask.state===`waiting`&&await this._subscribeTask.promise,this.base.peer.pc.signalingState!==`stable`&&(console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: signalingState is not stable.`,this.base.peer.pc.signalingState),this._restorePeer())})(),this.base.config.serviceEventVersion=t},this.base.cws.on.onJoinRoom=e=>{if(!this.base.guardNotifyRoomId(e.data.roomId,e))return;let t=e.data.user;t&&(this.base.users.initUsers([t],!0),this.base.users.emitUsersChange(),this._autoCheckSubscribe(),this.base.notifys.emit(`onJoinRoom`,e))},this.base.cws.on.onJoinRoomBatch=e=>{this.base.guardNotifyRoomId(e.data.roomId,e)&&(this.base.users.initUsers(e.data.users,!0),this._autoCheckSubscribe(),this.base.users.emitUsersChange())},this.base.cws.on.onQuitRoom=e=>{let{data:t}=e,n=t.user;if(!n)return;let{id:r}=n;if(r===this.base.config.userId)return this.base.notifys.emit(`onQuitRoom`,e),this.quitRoom();this._onRemoteUsersQuitRoom([r]).length!==0&&this.base.notifys.emit(`onQuitRoom`,e)},this.base.cws.on.onQuitRoomBatch=e=>{let t=e.data?.users??[],n=Array.from(t,e=>e.userId);this._onRemoteUsersQuitRoom(n)},this.base.cws.on.onPublish=e=>{let{roomId:t,user:n}=e.data;if(!this.base.guardNotifyRoomId(t,e)||!n)return;let r=this.base.users.getRemoteUserContent(n.id);if(!r)return;let{callAction:i=0,tracks:a=[]}=n,o=Array.from(a,({type:e})=>B[e]);r.p2p?.setRecvTracksEnabled(o,!1);let s=r.getTracksMid(o);this.base.peer.stopReceivers(s),r.updateTracks(a,!0),r.updateCallAction(i),this._autoCheckSubscribe(),this.base.users.emitUsersChange()},this.base.cws.on.onDataChannelPublish=e=>{let{userId:t,channels:n}=e.data;this.base.users.getRemoteUserContent(t)?.updateChannels(n),this._checkAndSubChannel().catch(()=>{})},this.base.cws.on.onCloseTrack=e=>{let t=e.data?.user;if(!t)return;let{id:n,callAction:r,tracks:i}=t,a=this.base.users.getRemoteUserContent(n);if(!a)return;a.updateCallAction(r??0);let o=Array.from(i,({type:e})=>B[e]),s=a.getTracksMid(o);this.base.peer.stopReceivers(s),a.removeTracks(o)},this.base.cws.on.onTrackInactive=async e=>{let{session:t,tracks:n=[]}=e.data;if(t!==this.base.config.callSession)return this._restorePeer().catch(()=>this.quitRoom());let r=[];for(let e of n){let{type:t,trackName:n}=e;if(t===void 0)continue;let i=B[t],a=this.base.users.localUser.getTrack(i);a&&a.trackName===n&&r.push(i)}r.length!==0&&(this.base.peer.stopSenders(r),this._restorePublish(r))},this.base.cws.on.onUpdatePermissions=e=>{let t=e.data?.user;if(!t)return;let{id:n,permissions:r=1}=t,i=this.base.users.getUserContent(n);i&&i.updatePermissions(r),this.base.users.emitUsersChange()},this.base.cws.on.onUpdatePermissionsBatch=e=>{let{users:t}=e.data;for(let e of t){let{id:t,permissions:n}=e,r=this.base.users.getUserContent(t);r&&r.updatePermissions(n??1)}this.base.users.emitUsersChange()},this.base.cws.on.onUpdateBehavior=e=>{let{users:t}=e.data;for(let e of t){let{id:t,behavior:n=0}=e,r=this.base.users.getUserContent(t);r&&r.updateBehavior(n)}let n=[],{behavior:r,isAdmin:i}=this.base.users.localUser,a=y(r);if(i===!1)for(let e of B)a[e]!==!0&&n.push(e);n.length===0?this.base.users.emitUsersChange():this.stopPublish(n)},this.base.cws.on.onRoomActionChange=e=>{let{roomAction:t,serverAction:n}=e.data;if(this.base.config.updateRoomAction(t||0),this.base.users.localUser.isAdmin===!1){let e=b(t),r=x(n),i=[];for(let t of B)e[t]!==!0&&r[t]!==!1&&i.push(t);i.length!==0&&this.stopPublish([`mc_audio`])}this.base.notifys.emit(`onRoomActionChange`,e)},this.base.cws.on.onMeetSpecialRolesChange=e=>{let{meetSpecialRoles:t,users:n}=e.data;this.base.users.updateUsersIsAdmin(t?.admin||[]);for(let e of n){let{id:t,permissions:n}=e;this.base.users.remoteUsers.get(t)?.updatePermissions(n??1)}this.base.users.emitUsersChange()},this.base.cws.on.onDestroyRoom=()=>this.quitRoom(),this._onOnline=()=>this._reportNetwork(),window.addEventListener(`online`,this._onOnline)}setLocalStream=async(e,t)=>{if(this.base.users.localUser.usePhoneyStream(e),t){if(e.includes(`mc_audio`)&&e.includes(`mc_video`)?await this.base.localMedias.initLocalStreamTrack(`mc`):e.includes(`mc_audio`)?await this.base.localMedias.initLocalStreamTrack(`mc_audio`):e.includes(`mc_video`)&&await this.base.localMedias.initLocalStreamTrack(`mc_video`),e.includes(`ss_audio`)&&e.includes(`ss_video`)?await this.base.localMedias.initLocalStreamTrack(`ss`):e.includes(`ss_audio`)&&!e.includes(`ss_video`)?await this.base.localMedias.initLocalStreamTrack(`ss_audio`):e.includes(`ss_video`)&&!e.includes(`ss_audio`)&&await this.base.localMedias.initLocalStreamTrack(`ss_video`),e.includes(`ss_audio`)){let e=this.base.users.localMedias.getLocalStreamTrack(`ss_audio`);e&&(e.onended=()=>this.stopPublish([`ss_audio`,`ss_video`]))}if(e.includes(`ss_video`)){let e=this.base.users.localMedias.getLocalStreamTrack(`ss_video`);e&&(e.onended=()=>this.stopPublish([`ss_audio`,`ss_video`]))}this.base.users.localUser.useLocalStream(e)}else for(let t of e)this.base.localMedias.stopLocalStreamTrack(t)};setMediaDeviceKind=async(e,t)=>{await this.base.users.localMedias.setMediaDeviceKind(e,t);let n=this.base.users.localUser;switch(e){case`audioinput`:n.usePhoneyStream([`mc_audio`]),this.base.localMedias.getLocalStreamTrack(`mc_audio`)&&(await this.base.localMedias.initLocalStreamTrack(`mc_audio`),n.useLocalStream([`mc_audio`])),this.base.peer.syncSenderStreamTrack([`mc_audio`]),this.base.users.syncRemoteUserP2PSenderStreamTrack([`mc_audio`]);break;case`videoinput`:n.usePhoneyStream([`mc_video`]),this.base.localMedias.getLocalStreamTrack(`mc_video`)&&(await this.base.localMedias.initLocalStreamTrack(`mc_video`),n.useLocalStream([`mc_video`])),this.base.peer.syncSenderStreamTrack([`mc_video`]),this.base.users.syncRemoteUserP2PSenderStreamTrack([`mc_video`]);break;case`audiooutput`:await this.base.users.localMedias.changeAudiooutput();break}};setMediaTrackConstraints=async(e,t)=>{this.base.localMedias.setMediaTrackConstraints(e,t),this.base.users.localMedias.isOpenMediaDevice(e)&&[`mc_video`].includes(e)&&await this.setLocalStream([e],!0)};joinRoom=async e=>{let t=new Date().getTime();this._quitRoomTask.state===`waiting`&&await this._quitRoomTask.promise,this.base.config.setOptions(e),this.base.users.localUser.id=e.userId,this.base.traffic.clear(),this.base.config.shardId=``,this.base.peer.setBroadcasted(B,!1),this.base.users.remoteUsers.clear();let{userId:n,callType:r,sdkToken:i,roomId:a,stt:o=!1,lang:s}=this.base.config,{input:c=`zh`,output:l=`zh`,translateEnable:u=!1}=s||{};this._connectCFByHttp(0).catch(()=>{}),await this._connectCws().catch(()=>{}),await this._connectCws().catch(()=>{}),await this._connectCws();let d=this.base.cws.createRequest(`joinRoom`),f=ne(32,10),{code:p=0,desc:m=`服务器繁忙`,data:h}=await(async()=>{let e=await d.send({data:{msg:f,msgId:f,callType:r,roomId:a,user:{id:n,tracks:[],callAction:0},token:i,stt:o,lang:{input:c,output:l,translateEnable:u}}}),{code:t=0}=e;return t===200?e:await d.send({data:{msg:f,msgId:f,callType:r,roomId:a,user:{id:n,tracks:[],callAction:0},token:i,stt:o,lang:{input:c,output:l,translateEnable:u}}})})();if(p!==200)throw Error(m);if(h.roomId!==a)throw`加入的房间不匹配`;this.base.config.isInRoom=!0,this.base.config.shardId=h.shardId||``,this._initHeartbeat(),this.base.users.initUsers(h.roomUsers,!0),this.base.config.updateRoomAction(h.roomAction||0);{let{meetSpecialRoles:e}=h,{creator:t=``,admin:n=[]}=e||{};if(t){let e=this.base.users.getUserContent(t);e&&(e.isOwner=!0)}this.base.users.updateUsersIsAdmin(n||[])}try{await this._connectCF(0).catch(()=>{}),await this._connectCF(3e3).catch(()=>{}),await this._connectCF(3e3)}catch(e){throw this.quitRoom(),e}this._autoCheckSubscribe(),this.base.users.emitUsersChange(),this._checkAndSubChannel().catch(()=>{});let g=new Date().getTime();if(this.base.config.debug===!0){let e=g-t;console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: joinRoom elapsed time is ${e}ms.`)}return f};publish=async e=>{if(e.length===0)throw Error(`Publish is error: The "mediaTypes" field cannot be left blank.`);let t=[...e],n=this.base.users.localUser;if(n.hasPermissions(`publish`)===!1)throw Error(`No permission.`);if(n.checkBanBehavior(t)===!1)throw Error(`Not permitted.`);return n.setPublished(t,!0),this._publishTask.exe(async()=>{let e=B.filter(e=>n.published[e]===!0);if(e.length===0)return!0;{let{invalid_mediaTypes:t}=this.base.localMedias.checkLocalStreamTracks(e);t.length!==0&&await this.setLocalStream(t,!0)}try{await this._createTracks(e)}catch{await this._restorePeer()}let{valid_mediaTypes:t,invalid_mediaTypes:r}=this.base.localMedias.checkLocalStreamTracks(e);if(n.setPublished(r,!1),t.length!==0)n.useLocalStream(t),await this.base.peer.syncSenderStreamTrack(t),await this.base.users.syncRemoteUserP2PSenderStreamTrack(t),n.updateSelfCallAction();else throw Error(`No effective track.`);return(await this._pubNotify(e)).length===0&&await this._notifySelfCallAction().catch(()=>{}),this.base.peer.channels.has(this.base.config.userId)===!1&&await this._pubChannel().catch(()=>{}),this.base.users.emitUsersChange(),!0})};stopPublish=async e=>{let t=[...e],n=this.base.users.localUser;return n.setPublished(t,!1),this._stopPublishTask.exe(async()=>{let e=B.filter(e=>n.published[e]===!1);n.usePhoneyStream(e),n.updateSelfCallAction(),await this.base.peer.syncSenderStreamTrack(e),await this.base.users.syncRemoteUserP2PSenderStreamTrack(e),await this.setLocalStream(e,!1),await this._notifySelfCallAction().catch(()=>{}),this.base.users.emitUsersChange()})};subscribe=async(e=[])=>{this.base.users.addRemoteUsersSubscribed(e),this._subscribeTask.state===`waiting`&&await this._subscribeTask.promise;let t=e=>this.base.asyncQueue.add(async()=>{try{await this.base.peer.waitings.peerConnected();let t=this.base.users.createRemoteUsersSubscribeData(e);if(t.length===0)return this._subscribeTask?.resolve(!0);e===!0&&await new Promise(e=>setTimeout(()=>e(!0),3e3));let{code:n=0,sn:r,data:i,desc:a}=await this.base.cws.createRequest(`subscribe`).send({data:{session:this.base.config.callSession,users:t}});if(await this._ackMsg(r),n!==200)throw Error(a);if(a.includes(`session_error-Session is not ready yet`))return!1;let{remoteSdp:o,users:s}=i;if(!o)throw Error(a||`The sdp was not correctly swapped.`);if(!s)throw Error(`No available users.`);{let e=new RTCSessionDescription({type:`offer`,sdp:o});await this.base.peer.setRemoteDescription(e),await this._renegotiate()}for(let e of s){let{id:t,tracks:n}=e;if(!t||!n)continue;let r=this.base.users.getRemoteUserContent(t);for(let e of n){if(e.code!==200)continue;let t=e.type||0,n=e.mid||``,i=e.trackName||``,a=B[t];r?.getTrack(a)?.trackName===i&&r?.useRemoteStream([a],this.base.peer,n)}}this.base.users.emitUsersChange()}catch{}return!0},{describe:`getRemoteUserTracks`});return this._subscribeTask.exe(async()=>{await t(!1)===!0&&await t(!0).catch(e=>{this.base._reportLog(`subscribe_error`,e.message||e)})})};stopSubscribe=async e=>{if(this.base.users.removeRemoteUsersSubscribed(e),this._stopSubscribeTask.state===`waiting`)return this._stopSubscribeTask.promise;let t=async()=>{try{let e=this.base.users.createRemoteUsersCloseData(),t=[],n=[];for(let r of e){let{userId:e,sfu_tracks:i,p2p_mediaTypes:a}=r;for(let e of i)n.push(e.mid);if(a.length!==0){let t=this.base.users.remoteUsers.get(e);if(!t)continue;t.usePhoneyStream(a),t.p2p?.setRecvTracksEnabled(a,!1),await this.base._reportP2PConnect(`disconnect`,{desc:`Take the initiative to disconnect.`,pushId:t.id,pullId:this.base.config.userId,mediaTypes:a})}if(i.length!==0){let n=this.base.users.remoteUsers.get(e);if(!n)continue;let r=Array.from(i,e=>e.mediaType);n.usePhoneyStream(r),t.push(...i)}}n.length!==0&&this.base.peer.stopReceivers(n),t.length!==0&&await this._closeTrack(t),this.base.users.emitUsersChange(),this._stopSubscribeTask?.resolve(!0)}catch{this._stopSubscribeTask?.reject(!0)}};return this._stopSubscribeTask.exe(()=>t())};quitRoom=()=>{let e=ne(32,10);return this._quitRoomTask.state===`ready`&&this._quitRoomTask.exe(async()=>{try{this._publishTask.state===`waiting`&&await this._publishTask.promise,this._stopPublishTask.state===`waiting`&&await this._stopPublishTask.promise,this._subscribeTask.state===`waiting`&&await this._subscribeTask.promise,this._stopSubscribeTask.state===`waiting`&&await this._stopSubscribeTask.promise;let{roomId:t,userId:n,isInRoom:r}=this.base.config;if(r===!1)return!0;this.base.config.isInRoom=!1,await this.base.cws.createRequest(`quitRoom`,{onBack:!1}).send({data:{roomId:t,userId:n,msgId:e,msg:e}}),await new Promise(e=>setTimeout(()=>e(!0),2e3))}catch(e){if(e!==`clear`)throw this.base._reportLog(`quit_room_error`,e.message||e),e}this._clear(),this.base.setRoomState(`ready`)}),Promise.resolve(e)};setBehaviors=async e=>{let{roomId:t}=this.base.config,n=[];for(let t of e){let{id:e,behaviors:r}=t,i=Object.keys(r);if(i.length===0)continue;let a=[];for(let e of i){let t={type:B.findIndex(t=>t===e),behavior:!r[e]};a.push(t)}let o={id:e,behaviors:a};n.push(o)}let r=await this.base.cws.createRequest(`preventUsersBehavior`).send({data:{roomId:t,users:n}}),{code:i=0,desc:a}=r;if(i!==200)throw Error(String(a));return r};toggleRoomSpeechLang=e=>{this.base.config.isInRoom===!0&&this.base.cws.createRequest(`toggleRoomSpeechLang`).send({data:e})};updateSimulcast=async e=>{let t=this.base.users.remoteUsers.values(),n=[];for(let r of t){let{id:t,tracks:i}=r,a=[];for(let t of B){if(![`mc_video`,`ss_video`].includes(t))continue;let n=i[t];if(!n)continue;let r={...n,simulcast:e};a.push(r)}a.length!==0&&n.push({id:t,tracks:a})}n.length!==0&&this.base.cws.createRequest(`updateSimulcast`).send({data:{session:this.base.config.callSession,users:n}})};updateToken=e=>{this.base.config.isInRoom===!0&&this.base.cws.createRequest(`updateRoomToken`).send({data:{roomId:this.base.config.roomId,sdkToken:e}})};destroy=async()=>{this.base.config.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [Destroy]`),this.base.config.isInRoom===!0&&await this.quitRoom(),this._quitRoomTask.state===`waiting`&&await this._quitRoomTask.promise;try{this._clear()}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: error`,e)}this._reconnectTimerId&&=(clearTimeout(this._reconnectTimerId),void 0),this._onOnline&&=(window.removeEventListener(`online`,this._onOnline),void 0),this._quitRoomTask.clear(),this.base.localMedias.destroy(),this.base.recorder.destroy(),this.base.notifys.emit(`onDestroyRoom`,{code:200,desc:`Is destroy.`,data:Sn(ni,{roomId:this.base.config.roomId})})};_clearTask=()=>{this._cwsConnectTask.clear(),this._connectCFTask.clear(),this._publishTask.clear(),this._stopPublishTask.clear(),this._subscribeTask.clear(),this._stopSubscribeTask.clear(),this._syncRoomInfoTask.clear(),this._restorePeerTask.clear()};_clear=()=>{clearTimeout(this._turnRefreshTimerId),this.setLocalStream(B,!1),this._clearTask(),this.base.setRoomState(`closed`),this.base.animationFrame.stop(),this.base.config.shardId=``,this.base.cws.clearEvents(),this.base.cws.close(),this.base.peer.close(),this.base.intervalQueue.removeQueueItem([`heartbeat-interval`,`peerAnalysis`]),this.base.asyncQueue.clear(),this.base.users.localUser.clear(),this.base.users.clearRemoteUsers()};_connectCws=async()=>this._cwsConnectTask.state===`waiting`?this._cwsConnectTask.promise:this._cwsConnectTask.exe(async()=>{this.base.cws.isValid()!==!0&&(this.base.setRoomState(`connecting`),await this.base.cws.connect())});_initHeartbeat=()=>{this.base.intervalQueue.removeQueueItem([`heartbeat-interval`]),this.base.intervalQueue.addQueueItem({key:`heartbeat-interval`,func:()=>{if(this.base.cws.prws.ws?.readyState!==1)return;if(this.base.cws.needRestoreRoom()===!0)return this._restoreRoom();let e=this.base.cws.createRequest(`heartbeat`,{onBack:!1}),t=this.base.traffic.getUse(`kb`),{outboundBytes:n,inboundBytes:r}=t.sfu,{outboundBytes:i,inboundBytes:a}=t.p2p,o={sfuPush:BigInt(Math.round(n)),sfuPull:BigInt(Math.round(r)),p2pPush:BigInt(Math.round(i)),p2pPull:BigInt(Math.round(a))};e.send({data:o}),this.base.cws.prws.send(`ping`)},interval:1e3*10})};_fetchGenTurnAddress=async()=>{try{clearTimeout(this._turnRefreshTimerId);let{code:e=0,desc:t,data:n,sn:r}=await this.base.cws.createRequest(`genTurnAddress`).send({data:{}});if(await this._ackMsg(r),e!==200)throw Error(t);let{expiresAt:i}=n,a=Number(i)*1e3-new Date().getTime()-3e4;return this._turnRefreshTimerId=setTimeout(()=>this._refreshTurnViaSetConfiguration(),a),n}catch(e){this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: genTurnAddress failed, use default STUN.`,e)}};_refreshTurnViaSetConfiguration=async()=>{if(this.base.config.isInRoom!==!0||this.base.cws.prws.ws?.readyState!==1||this.base.peer.pc.signalingState===`closed`)return;let e=await this._fetchGenTurnAddress();if(e!=null&&Array.isArray(e.iceServers)&&e.iceServers.length>0){this.base.peer.setTurnConfiguration(e);{await this.base.peer.createOffer();let e=this.base.users.localUser,t=e.getTracks([`mc_audio`,`mc_video`]),{code:n=0,desc:r,data:i,sn:a}=await this.base.cws.createRequest(`publish`).send({compress:!0,data:{sdp:this.base.peer.getSdp(),tracks:t,callAction:e.callAction,session:this.base.config.callSession}});if(await this._ackMsg(a),n!==200)throw Error(r);if(!i)throw Error(`No publish response data.`);let{remoteSdp:o}=i,s=o||``;await this.base.peer.setRemoteDescription({type:`answer`,sdp:s})}}else this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: [turnRefreshBeforeExpiry] genTurnAddress returned no iceServers, no follow-up timer`)};_connectCFByHttp=async e=>this._connectCFTask.state===`waiting`?this._connectCFTask.promise:this._connectCFTask.exe(async()=>{if(this.base.peer.checkValid()===!0)return!0;await new Promise(t=>setTimeout(()=>t(!0),e)),await this.base.peer.init();let t=[`mc_audio`,`mc_video`];await this.base.peer.addSenders(t);let n=this.base.users.localUser.getTracks(t),{url:r,appid:i,sdkToken:a}=this.base.config,o={sdp:this.base.peer.getSdp(),tracks:n,callAction:0},s=new af,c=setTimeout(()=>s.stop(),5e3),l=await s.request(`https://${r}/${i}/pre_publish`,{method:`POST`,headers:{Authorization:`Bearer ${a}`},body:JSON.stringify(o)});clearTimeout(c);let{code:u=0,desc:d,data:f}=await l.json();if(u!==200)throw Error(d);let{sessionDescription:p,sessionId:m}=f;return this.base.config.callSession=m||``,await this.base.peer.setRemoteDescription(p),await le(this.base.peer.waitings.peerConnected,{message:`ice connect is timeout.`,timeout:10*1e3}),this._reportNetwork(),this.base.intervalQueue.addQueueItem({key:`peerAnalysis`,func:this._calculateNetwork,interval:1e3}),!0});_connectCF=async e=>this._connectCFTask.state===`waiting`?this._connectCFTask.promise:this._connectCFTask.exe(async()=>{if(this.base.peer.checkValid()===!0)return!0;await new Promise(t=>setTimeout(()=>t(!0),e));let t=await this._fetchGenTurnAddress();await this.base.peer.init(t);let n=[`mc_audio`,`mc_video`];await this.base.peer.addSenders(n);let r=this.base.users.localUser.getTracks(n),{code:i=0,desc:a,data:o,sn:s}=await this.base.cws.createRequest(`publish`).send({compress:!0,data:{sdp:this.base.peer.getSdp(),tracks:r,callAction:0}});if(await this._ackMsg(s),i!==200)throw Error(a);if(!o)throw Error(`No publish response data.`);let{remoteSdp:c,session:l}=o;this.base.config.callSession=l||``;let u=c||``;return await this.base.peer.setRemoteDescription({type:`answer`,sdp:u}),await le(this.base.peer.waitings.peerConnected,{message:`ice connect is timeout.`,timeout:10*1e3}),this._reportNetwork(),this.base.intervalQueue.addQueueItem({key:`peerAnalysis`,func:this._calculateNetwork,interval:1e3}),!0});_reportNetwork=async()=>{try{let e=0,{address:t,natType:n}=await nf();switch(n){case`Symmetric`:e=0;break;case`Full Cone`:e=1;break;case`Port Restricted Cone`:e=2;break;case`Restricted Cone`:e=3;break}let r=0;{let e=f(),t=(navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType;e||(r=[`wifi`,`4g`].includes(t)?0:2),e&&(r=[`wifi`].includes(t)?0:2)}await this.base.cws.createRequest(`reportNetwork`).send({data:{nat:e,type:r,ip:t}})}catch(e){this.base.config.debug&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [reportNetwork]`,e)}};_createTracks=e=>this.base.asyncQueue.add(async()=>{try{await this.base.peer.waitings.peerConnected();let t=await this.base.peer.addSenders(e);if(t.length===0)return!0;let n=D(this.base.users.localUser.getTracks(t),[`type`,`trackName`,`mid`]),r=this.base.peer.getSdp(),{code:i=0,sn:a,desc:o,data:s}=await this.base.cws.createRequest(`publish`).send({compress:!0,data:{session:this.base.config.callSession,sdp:r,tracks:n,callAction:0}});if(await this._ackMsg(a),i!==200)throw Error(o);if(!s)throw Error(`No publish response data.`);let{remoteSdp:c}=s;return await this.base.peer.setRemoteDescription({type:`answer`,sdp:c||``}),!0}catch(e){throw this.base._reportLog(`publish_error`,e.message||e),e}},{describe:`createTrack`});_closeTrack=(e=[])=>this.base.asyncQueue.add(async()=>{if(e.length===0)return!0;try{await this.base.peer.createOffer();let t=D(e,[`type`,`trackName`,`mid`]),{code:n=0,desc:r,data:i}=await this.base.cws.createRequest(`closeTrack`).send({compress:!0,data:{roomId:this.base.config.roomId,sdp:this.base.peer.getSdp(),tracks:t}});if(n!==200)throw Error(r);return await this.base.peer.setRemoteDescription({type:`answer`,sdp:i?.remoteSdp||``}),!0}catch(e){throw this.base._reportLog(`close_track_error`,e.message||e),e}},{describe:`closeTrack`});_restorePublish=async e=>{if(e.length===0)return;await this._createTracks(e),await this._pubNotify(e);let{valid_mediaTypes:t}=this.base.localMedias.checkLocalStreamTracks(e);this.publish(t)};_pubNotify=async e=>(this._publishNotifyTask.state===`waiting`&&await this._publishNotifyTask.promise,this._publishNotifyTask.exe(async()=>{let t=this.base.peer.getNoBroadcasted(e);if(t.length===0)return[];let n=this.base.users.localUser.getTracks(t);if(n.length===0)throw Error(`The media track for the broadcast does not exist.`);let r=D(n,[`type`,`trackName`,`mid`]),{callSession:i,roomId:a,userId:o}=this.base.config,{callAction:s}=this.base.users.localUser,{code:c=0,desc:l}=await this.base.cws.createRequest(`pubNotify`).send({data:{session:i,roomId:a,user:{id:o,callAction:s,tracks:r}}});if(c!==200)throw Error(l);return this.base.peer.setBroadcasted(t,!0),t}));_submitRtcStats=async e=>new Promise(async(t,n)=>{try{let{code:n=0,desc:r}=await this.base.cws.createRequest(`rtcStats`).send({data:e});if(n!==200)throw Error(r);t(!0)}catch(e){n(e)}});_renegotiate=async()=>{await this.base.peer.createAnswer();let e=this.base.peer.getSdp(),{code:t=0,desc:n,sn:r}=await this.base.cws.createRequest(`renegotiate`).send({data:{sdp:e},compress:!0});if(await this._ackMsg(r),t!==200)throw Error(n);await new Promise(e=>setTimeout(()=>e(!0),1e3))};_ackMsg=async e=>{await this.base.cws.createRequest(`ackMsg`,{onBack:!1}).send({data:{msgId:BigInt(e)}})};_autoCheckSubscribe=()=>{let e=this.base.users.remoteUsers.values(),t=[],n=B.filter(e=>this.base.config.autoSubscribe[e]===!0);for(let r of e){let e=[],{id:i,tracks:a}=r;for(let t of n){let n=a[t];n&&n.origin===`phoney`&&e.push(t)}e.length!==0&&t.push({userId:i,mediaTypes:e})}this.subscribe(t)};_onRemoteUsersQuitRoom=e=>{let{removeUserIds:t,removeMids:n}=this.base.users.detachRemoteUsersForQuit(e);return t.length!==0&&(this.base.peer.stopReceivers(n),this._closeChannel(t).catch(()=>{}),this.base.users.emitUsersChange(!0)),t};_notifySelfCallAction=async()=>{let{roomId:e}=this.base.config,{id:t,callAction:n}=this.base.users.localUser,{code:r=0}=await this.base.cws.createRequest(`updateCall`).send({data:{roomId:e,user:{id:t,callAction:n}}});if(r!==200)throw Error(`NotifySelfCallAction is error.`)};_calculateNetwork=async()=>{if(this.base.cws.prws.ws?.readyState===1&&this.base.peer.pc.connectionState===`connected`&&!this._networkCalculating){this._networkCalculating=!0;try{let t={elapsed:0,memory:{jsHeapSizeLimit:0,totalJSHeapSize:0,usedJSHeapSize:0},sfu:{inboundBytes:0,outboundBytes:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,velocityPush:0,velocityPull:0},p2p:{inboundBytes:0,outboundBytes:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,velocityPush:0,velocityPull:0}};if(performance)try{t.memory=performance.memory}catch{}let n=[],r=[],i=[];{let a=[0],o=[0],s=[0],c=[],l=[],u=new Date().getTime(),d=this.base.users.localUser,f=Array.from(this.base.users.remoteUsers.values()),p=await this.base.peer.pc.getStats(),m=await Promise.all(f.map(e=>e.p2p?.pc&&e.p2p.pc.connectionState===`connected`?e.p2p.pc.getStats():Promise.resolve(null)));await Promise.all([d.generateTrackAnalysis(this.base.peer,p),...f.map((e,t)=>e.generateTrackAnalysis(this.base.peer,p,m[t]))]);for(let e of B)if(d.published[e]&&d.getTrack(e)){let{trackReport:i}=d.tracksAnalysis.sfu.sends[e],{offsetBytesSent:u,lostRate:f,roundTripTime:p,jitter:m,quality:h,averageQuality:g,averageOffsetBytesSent:_}=i;if(this.base.traffic.sfu.outboundBytes+=u,t.sfu.velocityPush+=_,a.push(f),o.push(p),s.push(m),h!==0)switch(c.push(h),e){case`mc_audio`:case`ss_audio`:n.push(h);break;case`mc_video`:case`ss_video`:r.push(h);break}g!==0&&l.push(g)}for(let e of f)for(let n of B)if(e.getTrack(n)){let{trackReport:r}=e.tracksAnalysis.sfu.recvs[n],{offsetBytesSent:u,lostRate:d,roundTripTime:f,jitter:p,quality:m,averageQuality:h,averageOffsetBytesSent:g}=r;this.base.traffic.sfu.inboundBytes+=u,t.sfu.velocityPull+=g,a.push(d),o.push(f),s.push(p),m!==0&&(c.push(m),i.push(m)),h!==0&&l.push(h)}t.elapsed=new Date().getTime()-u,t.elapsed>1e3&&Date.now()-this._lastTrackAnalysisWarnTime>30*1e3&&(this._lastTrackAnalysisWarnTime=Date.now(),console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: generateTrackAnalysis taking too much time.`,{elapsed:t.elapsed})),t.sfu.lostRate=e._maxInNumberArray(a),t.sfu.roundTripTime=e._maxInNumberArray(o),t.sfu.jitter=e._maxInNumberArray(s),t.sfu.quality=c.length===0?0:e._minInNumberArray(c),t.sfu.averageQuality=l.length===0?0:e._minInNumberArray(l)}{let a=[0],o=[0],s=[0],c=[],l=[],u=this.base.users.remoteUsers.values();for(let e of u)for(let u of B)if(e.p2p){{let{trackReport:i}=e.tracksAnalysis.p2p.sends[u],{offsetBytesSent:d,lostRate:f,roundTripTime:p,jitter:m,quality:h,averageQuality:g,averageOffsetBytesSent:_}=i;if(this.base.traffic.p2p.outboundBytes+=d,t.p2p.velocityPush+=_,a.push(f),o.push(p),s.push(m),h!==0)switch(c.push(h),u){case`mc_audio`:case`ss_audio`:n.push(h);break;case`mc_video`:case`ss_video`:r.push(h);break}g!==0&&l.push(g)}{let{trackReport:n}=e.tracksAnalysis.p2p.recvs[u],{offsetBytesSent:r,lostRate:d,roundTripTime:f,jitter:p,quality:m,averageQuality:h,averageOffsetBytesSent:g}=n;this.base.traffic.p2p.inboundBytes+=r,t.p2p.velocityPull+=g,a.push(d),o.push(f),s.push(p),m!==0&&(c.push(m),i.push(m)),h!==0&&l.push(h)}}t.p2p.lostRate=e._maxInNumberArray(a),t.p2p.roundTripTime=e._maxInNumberArray(o),t.p2p.jitter=e._maxInNumberArray(s),t.p2p.quality=c.length===0?0:e._minInNumberArray(c),t.p2p.averageQuality=l.length===0?0:e._minInNumberArray(l)}{let e=this.base.traffic.getUse();t.sfu.outboundBytes=e.sfu.outboundBytes,t.sfu.inboundBytes=e.sfu.inboundBytes,t.p2p.outboundBytes=e.p2p.outboundBytes,t.p2p.inboundBytes=e.p2p.inboundBytes}this.base.config.network=t,this.base.notifys.emit(`onRoomNetwork`,{code:200,data:t,desc:`RoomNetwork is change.`});{let e=this.base.users.localUser,t=n.length===0?0:Math.round(n.reduce((e,t)=>e+t)/n.length),a=r.length===0?0:Math.round(r.reduce((e,t)=>e+t)/r.length),o=t!==0&&a!==0?Math.round((t*6+a*4)/10):t||a,s=i.length===0?0:Math.round(i.reduce((e,t)=>e+t)/i.length);if(e.updateNetwork({egress:o,ingress:s})===!1){let t=new Date().getTime();t-this._lastUpdateNetworkTime>=3e3&&(this._lastUpdateNetworkTime=t,await this.base.cws.createRequest(`networkQualityChange`,{onBack:!1}).send({data:{egress:o,ingress:s,userId:e.id,roomId:this.base.config.roomId}})),this.base.users.emitUsersChange()}}this._emitSelfNetworkQualityChange().catch(e=>{this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [_emitSelfNetworkQualityChange]`,e)});try{await this._checkAndSelectUserStreamOrigin()}catch(e){this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [_checkAndSelectUserStreamOrigin]`,e)}}finally{this._networkCalculating=!1}}};_checkAndSelectUserStreamOrigin=async()=>{if(this.base.hasAsyncTask(`subscribe`)||this.base.hasAsyncTask(`publish`)||this.base.hasAsyncTask(`closeTrack`))return;let e=this.base.config.network.sfu.averageQuality,t=this.base.users.remoteUsers.values(),n=[],r=[],i=new Date().getTime();for(let a of t){let t=a.p2p;if(!t)continue;let o=[];for(let n of B){if(!t.hasRecvier(n))continue;let s=t.checkReceActive(n);if(!s)continue;let c=a.getTrack(n);if(!c){t.activeRecv[n]&&t.setRecvTracksEnabled([n],!1);continue}let{averageQuality:l,availableScore:u}=a.tracksAnalysis.p2p.recvs[n]?.trackReport,d=this.base._checkUserStreamOrigin({p2pAverageQuality:l,sfuAverageQuality:e});c.origin===`p2p`&&[`mc_video`,`ss_video`].includes(n)&&i-s>=1e4&&u<.6&&(d=`sfu`,this.base.config.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: Switching to SFU. availableScore: ${u}`,{remoteUserId:a.id,mediaType:n,availableScore:u})),d!==c.origin&&(d===`p2p`?(c.origin===`sfu`&&r.push(c),a.useRemoteP2PStream([n])):(a.usePhoneyStream([n],!1),o.push(n)))}o.length!==0&&(this.base._reportP2PConnect(`disconnect`,{desc:`Poor quality of P2P. `,pushId:a.id,pullId:this.base.config.userId,mediaTypes:o}),n.push({userId:a.id,mediaTypes:o}))}if(r.length!==0&&await this._closeTrack(r).catch(()=>{}),n.length!==0){await this.subscribe(n);for(let e of n){let{userId:t,mediaTypes:n}=e;try{this.base.users.getRemoteUserContent(t)?.p2p?.setRecvTracksEnabled(n,!1)}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [_checkAndSelectUserStreamOrigin]`,e)}}}r.length!==0&&n.length===0&&this.base.users.emitUsersChange()};_syncRoomInfo=async()=>(await this.base.peer.waitings.peerConnected(),this._syncRoomInfoTask.state===`waiting`?this._syncRoomInfoTask.promise:this._syncRoomInfoTask.exe(async()=>{let e=this.base.users.localUser,{id:t,callAction:n}=e,r=this.base.users.getP2PState(),{code:i=0,desc:a,data:o}=await this.base.cws.createRequest(`syncRoomInfo`).send({data:{user:{id:t,callAction:n},p2pState:r}});if(i!==200)throw Error(a);if(!o)throw Error(`No sync room data.`);if(o.isActive===!1)throw Error(`Do not stay in this room.`);let s=o.users||[];if((s.find(t=>t.id===e.id)||!1)===!1)throw Error(`Need to rejoin the room.`);return this.base.users.initUsers(s,!1),this._autoCheckSubscribe(),!0}));_restorePeer=async()=>{if(this.base.config.isInRoom!==!1)return this._restorePeerTask.state===`waiting`?this._restorePeerTask.promise:this._restorePeerTask.exe(async()=>{this.base.config.debug&&console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [restorePeer]`);let e=this.base.peer.getBroadcasted(B);this.base.peer.close(),this.base.cws.isValid()===!0&&await this._connectCF(0).catch(()=>{}),await this._connectCFByHttp(0).catch(()=>{}),this.base.cws.waitings.cwsConnected(),await this._connectCF(0);let t=this.base.users.remoteUsers.values();for(let e of t)e.p2p?.setSendTracksEnabled(B,!1,`local`),e.p2p?.setRecvTracksEnabled(B,!1),e.usePhoneyStream(B);return await this._restorePublish(e),this._autoCheckSubscribe(),!0})};_pubChannel=async()=>new Promise(async(e,t)=>{try{let t=this.base.cws.createRequest(`pubChannel`),n=this.base.peer.channels.get(this.base.config.userId)?.id||-1,{code:r=0,desc:i,data:a}=await t.send({data:{session:this.base.config.callSession,channels:[{dataChannelName:`dc_${this.base.users.localUser.id}`,id:n}]}});if(r!==200)throw Error(i);{let{channels:e}=a.channels[0],[t]=e,{id:r}=t;this.base.users.localUser.updateChannels(e),n===-1&&this.base.peer.addLocalUserChannel(r)}e(!0)}catch(e){console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: _pubChannel`,e),t(e)}});_closeChannel=e=>new Promise(async(t,n)=>{try{let n=this.base.peer.clearChannels(e);if(n.length===0)return;let{code:r=0,desc:i}=await this.base.cws.createRequest(`closeChannel`).send({data:{session:this.base.config.callSession,users:n}});if(r!==200)throw Error(i);t(!0)}catch(e){console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: error`,e),n(e)}});_checkAndSubChannel=async()=>new Promise(async(e,t)=>{try{let t=this.base.users.remoteUsers.values(),n=[];for(let e of t){let{id:t,channels:r}=e,[i]=r;if(!i)continue;let a=this.base.peer.channels.get(t);a&&a.readyState===`open`||n.push({userId:t,channels:r})}if(n.length===0)return;let{code:r=0,desc:i,data:a}=await this.base.cws.createRequest(`subChannel`).send({data:{session:this.base.config.callSession,users:n}});if(r!==200)throw Error(i);let{channels:o}=a;for(let e of o){let{userId:t,channels:n}=e,[r]=n,{id:i}=r;this.base.peer.addRemoteUserChannel(t,i)}e(!0)}catch(e){console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: error`,e),t(e)}});_emitSelfNetworkQualityChange=async()=>{if(this.base.config.isInRoom!==!0||this.base.peer.pc.connectionState!==`connected`)return;let e=this.base.users.localUser,t=[],n=[],r=[];for(let i of B){if(!e.published[i]||!e.getTrack(i))continue;let{trackReport:a}=e.tracksAnalysis.sfu.sends[i],{averageOffsetBytesSent:o,jitter:s,lostRate:c,quality:l,roundTripTime:u}=a,d=Math.ceil(o*100/1024)/100;t.push({type:Wi(i),bandwidth:d,jitter:s,packetsLost:BigInt(0),packetsLostRate:c}),l>0&&n.push(l),u>0&&r.push(u)}if(t.length===0)return;let i=n.length>0?n.reduce((e,t)=>e+t,0)/n.length:e.network.egress,a=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0,o={userId:e.id,statsTime:BigInt(Date.now()),roundTripTime:a,upQualityScore:i,downQualityScore:e.network.ingress,stats:t};try{await this.base.peer.localChannelSend(o)}catch{this._submitRtcStats(o).catch(()=>{})}return o};_restoreRoom=async()=>{try{this.base.cws.close(),this._restorePeer().catch(()=>{}),await this._connectCws(),await this._syncRoomInfo()}catch(e){console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [RestoreRoom is error.]`,e)}}};function sf(e){return e.map(e=>Sn(wi,{sdpMid:e.sdpMid??``,sdpMLineIndex:e.sdpMLineIndex??0,sdp:e.candidate??``}))}var cf=class{base;_p2pCheckTimeoutMap=new Map;constructor({base:e}){this.base=e,this.base.cws.on.onOffer=e=>{this.base.hasAsyncTask(`subscribe`)||this._onOffer(e)},this.base.cws.on.onCandidate=e=>{this.base.hasAsyncTask(`subscribe`)||this._onCandidate(e)},this.base.cws.on.onAttemptP2PEx=e=>{if(this.base.hasAsyncTask(`subscribe`))return;let{roomId:t,pushId:n,types:r=[],isRemotePush:i=!1}=e.data;if(r.length===0){this.base.config.debug&&console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [onAttemptP2PEx] There is an error. types.length === 0`,e);return}if(this.base.config.roomId!==t){this.base.config.debug&&console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [onAttemptP2PEx] There is an error. roomId is inequality.`,e);return}let a=Array.from(r,e=>B[e]);a.length!==0&&this._openP2P(n,a,i)},this.base.cws.on.onDisconnectedP2P=e=>{let{roomId:t,remoteUserId:n}=e.data;if(t!==this.base.config.roomId)return;let r=this.base.users.getRemoteUserContent(n);!r||!r.p2p||r.p2p.checkActive()===!1&&r.p2p.close()}}_openP2P=async(e,t,n)=>{if(this.base.hasAsyncTask(`subscribe`)||t.length===0)return;let{useP2P:r,roomId:i,userId:a}=this.base.config;if(r===!1)throw Error(`You have disabled the p2p function on the client side.`);try{let r=this.base.users.localUser,o=new Date().getTime(),s=this.base.users.getRemoteUserContent(e);if(!s)throw Error(`The remote user to be established does not exist.`);let c=this._getRemoteUserP2PContent(e,!0),{prohibited_mediaTypes:l=[],subscribed_mediaTypes:u=[]}=s.checkSubscribed(t);if(n===!0&&l.length!==0&&(this.base._reportP2PConnect(`ignore`,{desc:`P2P connections without a subscription relationship are not allowed.`,pullId:a,pushId:e,mediaTypes:l}),u.length===0))return;this.base.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [${e}]: start connect p2p.`,{isRemotePush:n}),n===!1?(c.close(),c.init()):c.pc?.connectionState!==`connected`&&c.init();let d=c.initRecvs(u);if(d.length!==0){let t=()=>{let t=async()=>{let t=await c.createOffer(),n=c.getRecvUserTracksAsRoomTrack(u),{code:o=0,desc:s}=await this.base.cws.createRequest(`offer`).send({data:{roomId:i,tracks:n,sender:{id:a,callAction:r.callAction},receiverId:e,sdp:t.sdp??``}});if(o!==200)throw Error(s)};return le(()=>new Promise(n=>{this.base.cws.on.onAnswer=t=>{let{code:r,data:i}=t;if(r!==200||!i)return;let{sender:a,sdp:o,tracks:s=[]}=i,c=a?.id;c!==void 0&&e===c&&n({answer:{type:`answer`,sdp:o},tracks:s})},t()}),{message:`await_answer is timeout.`,timeout:20*1e3})},n=async()=>{let t=sf(await le(c.getIcecandidates,{message:`get recv candidates is timeout.`,timeout:10*1e3})),{code:n=0,desc:r}=await this.base.cws.createRequest(`candidate`,{timeout:1e3*10}).send({data:{roomId:i,senderId:a,receiverId:e,candidates:t,isSubscribeReceiver:!0}});if(n!==200)throw Error(r)};{let{answer:e,tracks:r=[]}=await t();await c.setAnswer(e),await n();let i=[],a=[];for(let e of r){let{type:t,mid:n}=e;if(t===void 0)continue;let r=B[t];a.push(r),i.push({mediaType:r,mid:n,enabled:!1})}c.initSenders(i),c.setSendTracksEnabled(d,!1,`local`)}}await le(c.waitings.connected,{message:`ice connect is timeout.`,timeout:10*1e3}),await le(c.waitings.remoteChannelConnected,{message:`remote_channel connect is timeout.`,timeout:10*1e3}),n===!0&&c.setRecvTracksEnabled(u,!0);let f=`${new Date().getTime()-o}`;n===!0?await this.base._reportP2PConnect(`success`,{action:3,desc:`P2P connection successful.`,pullId:a,pushId:e,mediaTypes:u,connectedTime:f}):await this.base._reportP2PConnect(`success`,{action:2,desc:`P2P connection successful.`,pullId:e,pushId:a,mediaTypes:t,connectedTime:f}),this.base.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [${e}]: switch to P2P will be attempted within 10 seconds.`);{let t=this._p2pCheckTimeoutMap.get(e);t&&clearTimeout(t);let n=window.setTimeout(()=>{this._p2pCheckTimeoutMap.delete(e);let t=[],n=this.base.users.getRemoteUserContent(e);if(!(!n||!n.p2p)){for(let e of u){let r=n.p2p.activeRecv[e]||!1,i=n.getTrack(e);r&&i?.origin!==`p2p`&&t.push(e)}t.length!==0&&(n.p2p.setRecvTracksEnabled(t,!1),this.base._reportP2PConnect(`disconnect`,{desc:`Poor quality of P2P.`,pushId:n.id,pullId:this.base.config.userId,mediaTypes:t}))}},1e3*10);this._p2pCheckTimeoutMap.set(e,n)}}catch(r){this.base.users.getRemoteUserContent(e)?.p2p?.destroy(),this.base.config.debug&&console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [p2p]: onOpen p2p with ${e} is error.`,r),n===!0?await this.base._reportP2PConnect(`fail`,{action:0,desc:r.message||r,pullId:a,pushId:e,mediaTypes:t}):await this.base._reportP2PConnect(`fail`,{action:1,desc:r.message||r,pullId:e,pushId:a,mediaTypes:t})}};_onOffer=async e=>{let{code:t,data:n}=e;if(t!==200||!n)return;let{sdp:r,sender:i,tracks:a=[]}=n,o=i?.id;if(!o)return;let{userId:s,roomId:c}=this.base.config,l=this.base.users.localUser;try{let e=this.base.users.getrP2PConnectedCount(),t=[],n=[];for(let e of a){let{type:r,mid:i}=e;if(r===void 0)continue;let a=B[r];t.push(a),n.push({mediaType:a,mid:i,enabled:!1})}if(e+t.length>3){if(t.length===2){let e=t.findIndex(e=>e===`ss_video`);t.splice(e,1),await this.base._reportP2PConnect(`ignore`,{desc:`P2P connections have reached the maximum limit.`,pushId:s,pullId:o,mediaTypes:[`ss_video`]})}if(t.length===1){await this.base._reportP2PConnect(`ignore`,{desc:`P2P connections have reached the maximum limit.`,pushId:s,pullId:o,mediaTypes:t});return}}let i=this._getRemoteUserP2PContent(o,!0);this.base.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [${o}]: start connect p2p.`),i.pc?.connectionState!==`connected`&&i.init(),await i.setOffer({type:`offer`,sdp:r});{let e=i.initSenders(n);i.setSendTracksEnabled(e,!1,`local`)}let u=await i.createAnswer(),d=i.getSenderUserTracksAsRoomTrack(t);await(async()=>{let{code:e=0,desc:t}=await this.base.cws.createRequest(`answer`).send({data:{roomId:c,tracks:d,sender:{id:l.id,callAction:l.callAction},receiverId:o,sdp:u.sdp??``}});if(e!==200)throw Error(t)})(),await new Promise(e=>setTimeout(()=>e(!0),1e3)),await(async()=>{let e=sf(await le(i.getIcecandidates,{message:`get send candidates is timeout.`,timeout:10*1e3})),{code:t=0,desc:n}=await this.base.cws.createRequest(`candidate`).send({data:{roomId:c,senderId:l.id,receiverId:o,candidates:e,isSubscribeReceiver:!1}});if(t!==200)throw Error(n)})(),await le(i.waitings.connected,{message:`ice connect is timeout.`,timeout:20*1e3})}catch(e){this.base.config.debug&&console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [p2p]: onReply p2p with ${o} is error.`,e)}};_onCandidate=async e=>{let{code:t,data:n}=e;if(t!==200)return;let{senderId:r,candidates:i=[],receiverId:a,isSubscribeReceiver:o=!1}=n,{userId:s}=this.base.config;if(o===!1||a!==s)return;let c=this.base.users.getRemoteUserContent(r);if(!c||!c.p2p){console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: An error occurred in onCandidate.`,c);return}let l=Array.from(i,({sdpMid:e,sdpMLineIndex:t,sdp:n})=>({sdpMid:e,sdpMLineIndex:t,candidate:n}));await c.p2p.addCandidates(l)};_getRemoteUserP2PContent=(e,t)=>{let n=this.base.users.getRemoteUserContent(e);if(!n)throw Error(`The remote user to be established does not exist.`);if(t===!0&&(n.p2p||this.base.users.createRemoteUserP2P(e)),!n.p2p)throw Error(`The remote user p2p to be established does not exist.`);return n.p2p};destroy=()=>{for(let e of this._p2pCheckTimeoutMap.values())clearTimeout(e);this._p2pCheckTimeoutMap.clear()}},lf=`1.7.9`,uf=class{static version=lf;_base=new $d;_ACTION_BASE=new ef({base:this._base});_ACTION_SFU=new of({base:this._base});_ACTION_P2P=new cf({base:this._base});constructor(e){xd(),console.info(`[QuickVO] version is ${lf}`),this._base.config.setOptions(e)}recorder=this._base.recorder;use=this._base.use;setCallStrategy=this._base.setCallStrategy;addNotify=this._base.notifys.add;setOptions=this._base.config.setOptions;getLocalStream=this._base.users.localUser.getStream;getLocalStreams=this._base.users.localUser.getStreams;setActiveNoise=this._base.users.localUser.setActiveNoise;hasPermissions=this._base.users.localUser.hasPermissions;getUserContent=this._base.users.getUserContent;getUserStream=this._base.users.getUserStream;getVolume=this._base.users.getVolume;getMaxVolumeUser=this._base.users.getMaxVolumeUser;setInputVolume=this._base.users.setInputVolume;setEnhanceGain=this._base.users.setEnhanceGain;setSpeakerVolume=this._base.users.setSpeakerVolume;getUserAudioMediaStreamContext=this._base.users.getUserAudioMediaStreamContext;playBgs=this._base.users.playBgs;changBgsMix=this._base.users.changBgsMix;stopBgs=this._base.users.stopBgs;setBgsGain=this._base.users.setBgsGain;playBgm=this._base.users.playBgm;changBgmMix=this._base.users.changBgmMix;stopBgm=this._base.users.stopBgm;setBgmGain=this._base.users.setBgmGain;getEnumerateDevices=this._base.localMedias.getEnumerateDevices;getMediaDeviceKind=this._base.localMedias.getMediaDeviceKind;getMediaDevicesErrInfo=this._base.localMedias.getMediaDevicesErrInfo;setLocalStream=this._ACTION_SFU.setLocalStream;setMediaDeviceKind=this._ACTION_SFU.setMediaDeviceKind;setMediaTrackConstraints=this._ACTION_SFU.setMediaTrackConstraints;joinRoom=this._ACTION_SFU.joinRoom;publish=this._ACTION_SFU.publish;stopPublish=this._ACTION_SFU.stopPublish;subscribe=this._ACTION_SFU.subscribe;stopSubscribe=this._ACTION_SFU.stopSubscribe;setBehaviors=this._ACTION_SFU.setBehaviors;updateSimulcast=this._ACTION_SFU.updateSimulcast;toggleRoomSpeechLang=this._ACTION_SFU.toggleRoomSpeechLang;updateToken=this._ACTION_SFU.updateToken;quitRoom=this._ACTION_SFU.quitRoom;destroy=async()=>{this._base.users.localUser.clear(),this._base.users.localUser.destroy(),this._ACTION_P2P.destroy(),await this._ACTION_SFU.destroy(),this._base.cws.workerProtos.destroy(),bd()};addRequestAnimationFrame=this._base.animationFrame.addRequestAnimationFrame;clearRequestAnimationFrame=this._base.animationFrame.clearRequestAnimationFrame;getLocalUserTrackReports=this._base.users.getLocalUserTrackReports;getRemoteUserTrackReports=this._base.users.getRemoteUserTrackReports;getRoomAction=this._base.config.getRoomAction;_openP2P=this._ACTION_P2P._openP2P;_restoreRoom=this._ACTION_SFU._restoreRoom;_debugger=this._ACTION_BASE._debugger;_ai=this._ACTION_BASE._ai},df={qualityPriority:`画质优先`,fluencyPriority:`流畅度优先`,balancedDowngrade:`均衡降级`},ff=O(df),pf=Object.keys(df),mf=Object.values(df),hf={heartbeat:`心跳`,heartbeatEx:`慢心跳`,ackMsg:`确认收到消息`,reportNetwork:`上报网络类型`,connectCF:`连接CF`,genTurnAddress:`获取TURN地址`,publish:`发布流`,joinRoom:`加入房间`,joinRoomEx:`加入房间(提前建连)`,pubNotify:`广播已发布的轨道`,subscribe:`订阅流`,pubChannel:`发布DataChannel`,subChannel:`订阅DataChannel`,closeChannel:`关闭DataChannel`,renegotiate:`协商流`,closeTrack:`关闭轨道`,preventUsersBehavior:`阻止用户行为`,networkQualityChange:`更新网络状态`,updateCall:`更新通话状态`,updateSimulcast:`切换大小流`,toggleRoomSpeechLang:`切换房间语音识别`,syncRoomInfo:`同步房间`,updateRoomToken:`更新房间SDKTOKEN`,offer:`发送P2P-offer`,answer:`回应P2P-answer`,candidate:`发送P2P候选信息-candidate`,reportP2PConnectEx:`上报P2P连接结果`,quitRoom:`退出房间`,quitRoomEx:`退出房间不断开连接`,debugger:`调试`,ai:`WorkerAi调试`,UpdateTrackActive:`p2p轨道状态`,rtcStats:`客户端rtc网络质量`,RtcStats:`客户端rtc网络质量`},gf=O(hf),_f=Object.keys(hf),vf=Object.values(hf),yf={0:`未知`,1:`极差`,2:`较差`,3:`一般`,4:`很好`,5:`极好`},bf=O(yf),xf=Object.keys(yf),Sf=Object.values(yf),Cf={ready:`已就绪`,connecting:`连接中`,connected:`已连接`,reconnect:`正在重新连接`,disconnected:`已断开`,closed:`已关闭`},wf=O(Cf),Tf=Object.keys(Cf),Ef=Object.values(Cf),Df={0:`麦克风-默认轨道`,1:`摄像头-默认轨道`,2:`屏幕共享-视频轨道`,3:`屏幕共享-音频轨道`},Of=O(Df),kf=Object.keys(Df),Af=Object.values(Df);e.QuickVO=uf,e.callStrategy_keys=pf,e.callStrategy_options=ff,e.callStrategy_vals=mf,e.enum_callStrategy=df,e.enum_eventName=hf,e.enum_mediaType=Vi,e.enum_notifyName=Au,e.enum_quality=yf,e.enum_roomState=Cf,e.enum_trackType=Df,e.eventName_keys=_f,e.eventName_options=gf,e.eventName_vals=vf,e.mediaTypeToProtoTrackType=Wi,e.mediaType_keys=B,e.mediaType_options=Hi,e.mediaType_vals=Ui,e.notifyName_keys=Mu,e.notifyName_options=ju,e.notifyName_vals=Nu,e.quality_keys=xf,e.quality_options=bf,e.quality_vals=Sf,e.roomState_keys=Tf,e.roomState_options=wf,e.roomState_vals=Ef,Object.defineProperty(e,`tools`,{enumerable:!0,get:function(){return d}}),e.trackType_keys=kf,e.trackType_options=Of,e.trackType_vals=Af});
|
|
5
|
+
between two successive fields at the output of the decoding process (see the notes)`},2352003:{name:`DefaultDuration`,cppname:`TrackDefaultDuration`,level:3,type:`u`,minver:1,range:`not 0`,description:`Number of nanoseconds (not scaled via TimecodeScale) per frame ('frame' in the Matroska sense -- one element put into a (Simple)Block).`},28152:{name:`MaxCache`,cppname:`TrackMaxCache`,level:3,type:`u`,minver:1,webm:!1,description:`The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.`},28135:{name:`MinCache`,cppname:`TrackMinCache`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used.`},156:{name:`FlagLacing`,cppname:`TrackFlagLacing`,level:3,type:`u`,mandatory:!0,minver:1,default:1,range:`0-1`,description:`Set if the track may contain blocks using lacing. (1 bit)`},21930:{name:`FlagForced`,cppname:`TrackFlagForced`,level:3,type:`u`,mandatory:!0,minver:1,default:0,range:`0-1`,description:`Set if that track MUST be active during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit)`},185:{name:`FlagEnabled`,cppname:`TrackFlagEnabled`,level:3,type:`u`,mandatory:!0,minver:2,webm:!0,default:1,range:`0-1`,description:`Set if the track is usable. (1 bit)`},29637:{name:`TrackUID`,level:3,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file.`},215:{name:`TrackNumber`,level:3,type:`u`,mandatory:!0,minver:1,range:`not 0`,description:`The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).`},174:{name:`TrackEntry`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Describes a track with all elements.`},374648427:{name:`Tracks`,level:1,type:`m`,multiple:!0,minver:1,description:`A top-level block of information with many tracks described.`},175:{name:`EncryptedBlock`,level:2,type:`b`,multiple:!0,webm:!1,description:`Similar to EncryptedBlock Structure)`},202:{name:`ReferenceTimeCode`,level:4,type:`u`,multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},201:{name:`ReferenceOffset`,level:4,type:`u`,multiple:!1,mandatory:!0,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},200:{name:`ReferenceFrame`,level:3,type:`m`,multiple:!1,minver:0,webm:!1,divx:!0,description:`DivX trick track extenstions`},207:{name:`SliceDuration`,level:5,type:`u`,default:0,description:`The (scaled) duration to apply to the element.`},206:{name:`Delay`,cppname:`SliceDelay`,level:5,type:`u`,default:0,description:`The (scaled) delay to apply to the element.`},203:{name:`BlockAdditionID`,cppname:`SliceBlockAddID`,level:5,type:`u`,default:0,description:`The ID of the BlockAdditional element (0 is the main Block).`},205:{name:`FrameNumber`,cppname:`SliceFrameNumber`,level:5,type:`u`,default:0,description:`The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).`},204:{name:`LaceNumber`,cppname:`SliceLaceNumber`,level:5,type:`u`,minver:1,default:0,divx:!1,description:`The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.`},232:{name:`TimeSlice`,level:4,type:`m`,multiple:!0,minver:1,divx:!1,description:`Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.`},142:{name:`Slices`,level:3,type:`m`,minver:1,divx:!1,description:`Contains slices description.`},30114:{name:`DiscardPadding`,level:3,type:`i`,minver:4,webm:!0,description:`Duration in nanoseconds of the silent data added to the Block (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and should be discarded during playback.`},164:{name:`CodecState`,level:3,type:`b`,minver:2,webm:!1,description:`The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry.`},253:{name:`ReferenceVirtual`,level:3,type:`i`,webm:!1,description:`Relative position of the data that should be in position of the virtual block.`},251:{name:`ReferenceBlock`,level:3,type:`i`,multiple:!0,minver:1,description:`Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it's attached to.`},250:{name:`ReferencePriority`,cppname:`FlagReferenced`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,default:0,description:`This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced.`},155:{name:`BlockDuration`,level:3,type:`u`,minver:1,default:`TrackDuration`,description:`The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track (but can be omitted as other default values). When not written and with no DefaultDuration, the value is assumed to be the difference between the timestamp of this Block and the timestamp of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. When set to 0 that means the frame is not a keyframe.`},165:{name:`BlockAdditional`,level:5,type:`b`,mandatory:!0,minver:1,webm:!1,description:`Interpreted by the codec as it wishes (using the BlockAddID).`},238:{name:`BlockAddID`,level:5,type:`u`,mandatory:!0,minver:1,webm:!1,default:1,range:`not 0`,description:`An ID to identify the BlockAdditional level.`},166:{name:`BlockMore`,level:4,type:`m`,mandatory:!0,multiple:!0,minver:1,webm:!1,description:`Contain the BlockAdditional and some parameters.`},30113:{name:`BlockAdditions`,level:3,type:`m`,minver:1,webm:!1,description:`Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data.`},162:{name:`BlockVirtual`,level:3,type:`b`,webm:!1,description:`A Block with no data. It must be stored in the stream at the place the real Block should be in display order. (see Block Virtual)`},161:{name:`Block`,level:3,type:`b`,mandatory:!0,minver:1,description:`Block containing the actual data to be rendered and a timestamp relative to the Cluster Timecode. (see Block Structure)`},160:{name:`BlockGroup`,level:2,type:`m`,multiple:!0,minver:1,description:`Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock.`},163:{name:`SimpleBlock`,level:2,type:`b`,multiple:!0,minver:2,webm:!0,divx:!0,description:`Similar to SimpleBlock Structure`},171:{name:`PrevSize`,cppname:`ClusterPrevSize`,level:2,type:`u`,minver:1,description:`Size of the previous Cluster, in octets. Can be useful for backward playing.`,position:`prevCluster`},167:{name:`Position`,cppname:`ClusterPosition`,level:2,type:`u`,minver:1,webm:!1,description:`The Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.`,position:`segment`},22743:{name:`SilentTrackNumber`,cppname:`ClusterSilentTrackNumber`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster.`},231:{name:`Timecode`,cppname:`ClusterTimecode`,level:2,type:`u`,mandatory:!0,minver:1,description:`Absolute timestamp of the cluster (based on TimecodeScale).`},524531317:{name:`Cluster`,level:1,type:`m`,multiple:!0,minver:1,description:`The lower level element containing the (monolithic) Block structure.`},19840:{name:`MuxingApp`,level:2,type:`8`,mandatory:!0,minver:1,description:`Muxing application or library ("libmatroska-0.4.3").`},31657:{name:`Title`,level:2,type:`8`,minver:1,webm:!1,description:`General name of the segment.`},2807730:{name:`TimecodeScaleDenominator`,level:2,type:`u`,mandatory:!0,minver:4,default:`1000000000`,description:`Timestamp scale numerator, see TimecodeScale.`},2807729:{name:`TimecodeScale`,level:2,type:`u`,mandatory:!0,minver:1,default:`1000000`,description:`Timestamp scale in nanoseconds (1.000.000 means all timestamps in the segment are expressed in milliseconds).`},27045:{name:`ChapterTranslateID`,level:3,type:`b`,mandatory:!0,minver:1,webm:!1,description:`The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used.`},27071:{name:`ChapterTranslateCodec`,level:3,type:`u`,mandatory:!0,minver:1,webm:!1,description:`The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).`},27132:{name:`ChapterTranslateEditionUID`,level:3,type:`u`,multiple:!0,minver:1,webm:!1,description:`Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment.`},4096955:{name:`NextFilename`,level:2,type:`8`,minver:1,webm:!1,description:`An escaped filename corresponding to the next segment.`},4110627:{name:`NextUID`,level:2,type:`b`,minver:1,webm:!1,bytesize:16,description:`A unique ID to identify the next chained segment (128 bits).`},3965867:{name:`PrevFilename`,level:2,type:`8`,minver:1,webm:!1,description:`An escaped filename corresponding to the previous segment.`},3979555:{name:`PrevUID`,level:2,type:`b`,minver:1,webm:!1,bytesize:16,description:`A unique ID to identify the previous chained segment (128 bits).`},29604:{name:`SegmentUID`,level:2,type:`b`,minver:1,webm:!1,range:`not 0`,bytesize:16,description:`A randomly generated unique ID to identify the current segment between many others (128 bits).`},357149030:{name:`Info`,level:1,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains miscellaneous general information and statistics on the file.`},21420:{name:`SeekPosition`,level:3,type:`u`,mandatory:!0,minver:1,description:`The position of the element in the segment in octets (0 = first level 1 element).`,position:`segment`},21419:{name:`SeekID`,level:3,type:`b`,mandatory:!0,minver:1,description:`The binary ID corresponding to the element name.`,type2:`ebmlID`},19899:{name:`Seek`,cppname:`SeekPoint`,level:2,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Contains a single seek entry to an EBML element.`},290298740:{name:`SeekHead`,cppname:`SeekHeader`,level:1,type:`m`,multiple:!0,minver:1,description:`Contains the position of other level 1 elements.`},32379:{name:`SignatureElementList`,level:2,type:`m`,multiple:!0,webm:!1,i:`Cluster|Block|BlockAdditional`,description:`A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption.`},32347:{name:`SignatureElements`,level:1,type:`m`,webm:!1,description:`Contains elements that will be used to compute the signature.`},32437:{name:`Signature`,level:1,type:`b`,webm:!1,description:`The signature of the data (until a new.`},32421:{name:`SignaturePublicKey`,level:1,type:`b`,webm:!1,description:`The public key to use with the algorithm (in the case of a PKI-based signature).`},32410:{name:`SignatureHash`,level:1,type:`u`,webm:!1,description:`Hash algorithm used (1=SHA1-160, 2=MD5).`},32394:{name:`SignatureAlgo`,level:1,type:`u`,webm:!1,description:`Signature algorithm used (1=RSA, 2=elliptic).`},458458727:{name:`SignatureSlot`,level:-1,type:`m`,multiple:!0,webm:!1,description:`Contain signature of some (coming) elements in the stream.`},191:{name:`CRC-32`,level:-1,type:`b`,minver:1,webm:!1,description:`The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian`,crc:!0},236:{name:`Void`,level:-1,type:`b`,minver:1,description:`Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use.`},17139:{name:`EBMLMaxSizeLength`,level:1,type:`u`,mandatory:!0,default:8,minver:1,description:`The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid.`},17138:{name:`EBMLMaxIDLength`,level:1,type:`u`,mandatory:!0,default:4,minver:1,description:`The maximum length of the IDs you'll find in this file (4 or less in Matroska).`},17143:{name:`EBMLReadVersion`,level:1,type:`u`,mandatory:!0,default:1,minver:1,description:`The minimum EBML version a parser has to support to read this file.`},440786851:{name:`EBML`,level:`0`,type:`m`,mandatory:!0,multiple:!0,minver:1,description:`Set the EBML characteristics of the data to follow. Each EBML document has to start with this.`},21936:{name:`Colour`,level:`4`,type:`m`,mandatory:!0,multiple:!0,description:`Settings describing the colour format.`},21937:{name:`MatrixCoefficients`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273.`},21945:{name:`Range`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`Clipping of the color ranges.`},21946:{name:`TransferCharacteristics`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The transfer characteristics of the video.`},21947:{name:`Primaries`,level:`5`,type:`u`,mandatory:!0,multiple:!0,description:`The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273.`}}})),Td=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Nd(),n=Nd(),r=wd();e.default=function(){function e(){this._schema=r.byEbmlID,this._buffers=[],this._stack=[]}return e.prototype.encode=function(e){var n=this;return t.concat(e.reduce(function(e,t){return e.concat(n.encodeChunk(t))},[])).buffer},e.prototype.encodeChunk=function(e){return e.type===`m`?e.isEnd?this.endTag(e):this.startTag(e):(e.data=n.Buffer.from(e.data),this.writeTag(e)),this.flush()},e.prototype.flush=function(){var e=this._buffers;return this._buffers=[],e},e.prototype.getSchemaInfo=function(e){for(var t=Object.keys(this._schema).map(Number),r=0;r<t.length;r++){var i=t[r];if(this._schema[i].name===e)return new n.Buffer(i.toString(16),`hex`)}return null},e.prototype.writeTag=function(e){var n=e.name,r=this.getSchemaInfo(n),i=e.data;if(r==null)throw Error(`No schema entry found for `+n);var a=t.encodeTag(r,i);if(this._stack.length>0){this._stack[this._stack.length-1].children.push({tagId:r,elm:e,children:[],data:a});return}this._buffers=this._buffers.concat(a)},e.prototype.startTag=function(e){var r=e.name,i=this.getSchemaInfo(r);if(i==null)throw Error(`No schema entry found for `+r);if(e.unknownSize){var a=t.encodeTag(i,new n.Buffer(0),e.unknownSize);this._buffers=this._buffers.concat(a);return}var o={tagId:i,elm:e,children:[],data:null};this._stack.length>0&&this._stack[this._stack.length-1].children.push(o),this._stack.push(o)},e.prototype.endTag=function(e){e.name;var n=this._stack.pop();if(n==null||n.elm.name!==e.name)throw Error(`EBML structure is broken`);var r=n.children.reduce(function(e,t){if(t.data===null)throw Error(`EBML structure is broken`);return e.concat(t.data)},[]),i=t.concat(r);n.elm.type===`m`?n.data=t.encodeTag(n.tagId,i,n.elm.unknownSize):n.data=t.encodeTag(n.tagId,i),this._stack.length<1&&(this._buffers=this._buffers.concat(n.data))},e}()})),Ed=s((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),Dd=s((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),Od=s((e=>{var t=Ed(),n=Dd(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Te(e,ArrayBuffer)||e&&Te(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Te(e,SharedArrayBuffer)||e&&Te(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(Te(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||N(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Te(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Te(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Te(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Te(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return be(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Ce(e).length;default:if(i)return r?-1:be(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return ae(this,t,n);case`utf8`:case`utf-8`:return k(this,t,n);case`ascii`:return re(this,t,n);case`latin1`:case`binary`:return ie(this,t,n);case`base64`:return ee(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return oe(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?k(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Te(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,N(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(N(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return we(be(t,e.length-n),e,n,r)}function E(e,t,n,r){return we(xe(t),e,n,r)}function D(e,t,n,r){return we(Ce(t),e,n,r)}function O(e,t,n,r){return we(Se(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function ee(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return ne(r)}var te=4096;function ne(e){let t=e.length;if(t<=te)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=te));return n}function re(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function ie(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function ae(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=Ee[e[r]];return i}function oe(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function A(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=De(function(e){e>>>=0,ge(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&_e(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),n.read(this,e,!1,52,8)};function j(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function se(e,t,n,r,i){he(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function M(e,t,n,r,i){he(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=De(function(e,t=0){return se(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=De(function(e,t=0){return M(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=De(function(e,t=0){return se(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=De(function(e,t=0){return M(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ce(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function le(e,t,r,i,a){return t=+t,r>>>=0,a||ce(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return le(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return le(this,e,t,!1,n)};function ue(e,t,r,i,a){return t=+t,r>>>=0,a||ce(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return ue(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return ue(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var de={};function fe(e,t,n){de[e]=class extends n{constructor(){super(),Object.defineProperty(this,`message`,{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,`code`,{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}fe(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),fe(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),fe(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=pe(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=pe(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function pe(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function me(e,t,n){ge(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&_e(t,e.length-(n+1))}function he(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new de.ERR_OUT_OF_RANGE(`value`,i,e)}me(r,i,a)}function ge(e,t){if(typeof e!=`number`)throw new de.ERR_INVALID_ARG_TYPE(t,`number`,e)}function _e(e,t,n){throw Math.floor(e)===e?t<0?new de.ERR_BUFFER_OUT_OF_BOUNDS:new de.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ge(e,n),new de.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var ve=/[^+/0-9A-Za-z-_]/g;function ye(e){if(e=e.split(`=`)[0],e=e.trim().replace(ve,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function be(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function xe(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Se(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Ce(e){return t.toByteArray(ye(e))}function we(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Te(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function N(e){return e!==e}var Ee=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function De(e){return typeof BigInt>`u`?Oe:e}function Oe(){throw Error(`BigInt not supported`)}})),kd=s((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(e,`__esModule`,{value:!0});var r=Nd();e.default=function(){function e(){}return e.readVint=function(t,n){n===void 0&&(n=0);var r=8-Math.floor(Math.log2(t[n]));if(r>8){var i=e.readHexString(t,n,n+r);throw Error(`Unrepresentable length: ${r} ${i}`)}if(n+r>t.length)return null;for(var a=t[n]&(1<<8-r)-1,o=1;o<r;o+=1){if(o===7&&a>=2**8&&t[n+7]>0)return{length:r,value:-1};a*=2**8,a+=t[n+o]}return{length:r,value:a}},e.writeVint=function(e){if(e<0||e>2**53)throw Error(`Unrepresentable value: ${e}`);var t=1;for(t=1;t<=8&&!(e<2**(7*t)-1);t+=1);for(var n=r.Buffer.alloc(t),i=e,a=1;a<=t;a+=1){var o=i&255;n[t-a]=o,i-=o,i/=2**8}return n[0]|=1<<8-t,n},e.concatenate=function(e,t){return!e&&!t?r.Buffer.from([]):!e||e.byteLength===0?t:!t||t.byteLength===0?e:r.Buffer.from(n(n([],e,!0),t,!0))},e.readHexString=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),Array.from(e.slice(t,n)).map(function(e){return Number(e).toString(16)}).reduce(function(e,t){return`${e}${t.padStart(2,`0`)}`},``)},e.readUtf8=function(e){try{return r.Buffer.from(e).toString(`utf8`)}catch{return null}},e.readUnsigned=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return n.getUint8(0);case 2:return n.getUint16(0);case 4:return n.getUint32(0);default:break}return t.byteLength<=6?t.reduce(function(e,t){return e*256+t},0):e.readHexString(t,0,t.byteLength)},e.readSigned=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:return NaN}},e.readFloat=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return t.getFloat32(0);case 8:return t.getFloat64(0);default:return NaN}},e.readDate=function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return new Date(n.getUint8(0));case 2:return new Date(n.getUint16(0));case 4:return new Date(n.getUint32(0));case 8:return new Date(Number.parseInt(e.readHexString(t),16));default:return new Date(0)}},e.readDataFromTag=function(n,r){var i=n.type,a=n.name,o=n.track,s=n.discardable||!1,c=n.keyframe||!1,l=null,u;switch(i){case`u`:u=e.readUnsigned(r);break;case`f`:u=e.readFloat(r);break;case`i`:u=e.readSigned(r);break;case`s`:u=String.fromCharCode.apply(String,r);break;case`8`:u=e.readUtf8(r);break;case`d`:u=e.readDate(r);break;default:break}if(a===`SimpleBlock`||a===`Block`){var d=0,f=e.readVint(r,d),p=f.length,m=f.value;d+=p,o=m,u=e.readSigned(r.subarray(d,d+2)),d+=2,a===`SimpleBlock`&&(c=!!(r[p+2]&128),s=!!(r[p+2]&1)),d+=1,l=r.subarray(d)}return t(t({},n),{data:r,discardable:s,keyframe:c,payload:l,track:o,value:u})},e}()})),Ad=s(((e,t)=>{t.exports=function(e,t,n){t||=0;for(var r=1;r<=8&&!(e[t]>=2**(8-r));r++);if(r>8)throw Error(`Unrepresentable length: `+r+` `+e.toString(`hex`,t,t+r));if(t+r>e.length)return null;var i,a=e[t]&(1<<8-r)-1;for(i=1;i<r;i++){if(i===7&&a>=2**45&&e[t+7]>0)return{length:r,value:-1};a*=2**8,a+=e[t+i]}return n&&(a-=2**(r*7-1)-1),{length:r,value:a}}})),jd=s(((e,t)=>{var n=Ad();function r(e){this.buffer=e,this.offset=0}r.prototype.nextInt16BE=function(){var e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e},r.prototype.nextUInt8=function(){var e=this.buffer.readUInt8(this.offset);return this.offset+=1,e},r.prototype.nextUIntV=function(){var e=n(this.buffer,this.offset);return this.offset+=e.length,e.value},r.prototype.nextIntV=function(){var e=n(this.buffer,this.offset,!0);return this.offset+=e.length,e.value},r.prototype.nextBuffer=function(e){var t=e?this.buffer.slice(this.offset,this.offset+e):this.buffer.slice(this.offset);return this.offset+=e||this.length,t},Object.defineProperty(r.prototype,`length`,{get:function(){return this.buffer.length-this.offset}}),t.exports=r})),Md=s(((e,t)=>{var n=jd(),r=1,i=3,a=2;t.exports=function(e){var t={},r=new n(e);t.trackNumber=r.nextUIntV(),t.timecode=r.nextInt16BE();var i=r.nextUInt8();return t.invisible=!!(i&8),t.keyframe=!!(i&128),t.discardable=!!(i&1),t.frames=o(r,(i&6)>>1),t};function o(e,t){if(!t)return[e.nextBuffer()];var n,o,s=[],c=e.nextUInt8()+1;if(t===a){if(e.length%c!==0)throw Error(`Fixed-Size Lacing Error`);for(o=e.length/c,n=0;n<c;n++)s.push(e.nextBuffer(o));return s}var l=[];if(t===r)for(n=0;n<c-1;n++){var u;o=0;do u=e.nextUInt8(),o+=u;while(u===255);l.push(o)}else if(t===i)for(o=e.nextUIntV(),l.push(o),n=1;n<c-1;n++)o+=e.nextIntV(),l.push(o);for(n=0;n<c-1;n++)s.push(e.nextBuffer(l[n]));return s.push(e.nextBuffer()),s}})),Nd=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.convertEBMLDateToJSDate=e.createFloatBuffer=e.createIntBuffer=e.createUIntBuffer=e.encodeValueToBuffer=e.concat=e.putRefinedMetaData=e.extractElement=e.removeElement=e.makeMetadataSeekable=e.createRIFFChunk=e.VP8BitStreamToRiffWebPBuffer=e.WebPBlockFilter=e.encodeTag=e.readBlock=e.ebmlBlock=e.writeVint=e.readVint=e.Buffer=void 0;var t=Cd(),n=Td(),r=Od(),i=kd(),a=Md();e.Buffer=r.Buffer,e.readVint=i.default.readVint,e.writeVint=i.default.writeVint,e.ebmlBlock=a;function o(t){return(0,e.ebmlBlock)(new e.Buffer(t))}e.readBlock=o;function s(t,n,r){return r===void 0&&(r=!1),b([t,r?new e.Buffer(`01ffffffffffffff`,`hex`):(0,e.writeVint)(n.length),n])}e.encodeTag=s;function c(t){return t.reduce(function(t,n){return n.type!==`b`||n.name!==`SimpleBlock`||!(0,e.ebmlBlock)(n.data).frames.some(function(e){return e.slice(3,6).toString(`hex`)===`9d012a`})?t:t.concat(n)},[])}e.WebPBlockFilter=c;function l(t){var n=u(`VP8 `,t);return u(`RIFF`,b([new e.Buffer(`WEBP`,`ascii`),n]))}e.VP8BitStreamToRiffWebPBuffer=l;function u(t,n){var r=new e.Buffer(4);return r.writeUInt32LE(n.byteLength,0),b([new e.Buffer(t.substr(0,4),`ascii`),r,n,new e.Buffer(n.byteLength%2==0?0:1)])}e.createRIFFChunk=u;function d(t,r,i){var a=p(`EBML`,t),o=h(a)+12,s=t[t.length-1].dataEnd-o,c=p(`Info`,t);f(`Duration`,c),c.splice(1,0,{name:`Duration`,type:`f`,data:w(r,8)});for(var l=h(c),u=p(`Tracks`,t),d=h(u),m=47,g=[],_=5+i.length*15,v=[],y=-1,b=10,x=function(t){var n=m,r=n+l,a=r+d,c=a+_-s;if(g=[],g.push({name:`SeekHead`,type:`m`,isEnd:!1}),g.push({name:`Seek`,type:`m`,isEnd:!1}),g.push({name:`SeekID`,type:`b`,data:new e.Buffer([21,73,169,102])}),g.push({name:`SeekPosition`,type:`u`,data:S(n)}),g.push({name:`Seek`,type:`m`,isEnd:!0}),g.push({name:`Seek`,type:`m`,isEnd:!1}),g.push({name:`SeekID`,type:`b`,data:new e.Buffer([22,84,174,107])}),g.push({name:`SeekPosition`,type:`u`,data:S(r)}),g.push({name:`Seek`,type:`m`,isEnd:!0}),g.push({name:`Seek`,type:`m`,isEnd:!1}),g.push({name:`SeekID`,type:`b`,data:new e.Buffer([28,83,187,107])}),g.push({name:`SeekPosition`,type:`u`,data:S(a)}),g.push({name:`Seek`,type:`m`,isEnd:!0}),g.push({name:`SeekHead`,type:`m`,isEnd:!0}),m=h(g),v=[],v.push({name:`Cues`,type:`m`,isEnd:!1}),i.forEach(function(e){var t=e.CueTrack,n=e.CueClusterPosition,r=e.CueTime;v.push({name:`CuePoint`,type:`m`,isEnd:!1}),v.push({name:`CueTime`,type:`u`,data:S(r)}),v.push({name:`CueTrackPositions`,type:`m`,isEnd:!1}),v.push({name:`CueTrack`,type:`u`,data:S(t)}),n-=o,n+=c,v.push({name:`CueClusterPosition`,type:`u`,data:S(n)}),v.push({name:`CueTrackPositions`,type:`m`,isEnd:!0}),v.push({name:`CuePoint`,type:`m`,isEnd:!0})}),v.push({name:`Cues`,type:`m`,isEnd:!0}),_=h(v),y!==c){if(y=c,t===b-1)throw Error(`Failed to converge to a stable metadata size`)}else return`break`},C=0;C<b&&x(C)!==`break`;C++);var T=[].concat.apply([],[a,{name:`Segment`,type:`m`,isEnd:!1,unknownSize:!0},g,c,u,v]);return new n.default().encode(T)}e.makeMetadataSeekable=d;function f(e,t){for(var n=-1,r=0;r<t.length;r++){var i=t[r];if(i.name===e)if(i.type===`m`)if(!i.isEnd)n=r;else{if(n==-1)throw Error(`Detected ${e} closing element before finding the start`);t.splice(n,r-n+1);return}else{t.splice(r,1);return}}}e.removeElement=f;function p(e,t){for(var n=[],r=-1,i=0;i<t.length;i++){var a=t[i];if(a.name===e)if(a.type===`m`)if(!a.isEnd)r=i;else{if(r==-1)throw Error(`Detected ${e} closing element before finding the start`);n=t.slice(r,i+1);break}else{n.push(t[i]);break}}return n}e.extractElement=p;function m(t,r){Array.isArray(r.cueInfos)&&!Array.isArray(r.cues)&&(console.warn(`putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues`),r.cues=r.cueInfos);for(var i=[],a=[],o=0;o<t.length;o++){var s=t[o];if(s.type===`m`&&s.name===`Segment`){if(i=t.slice(0,o),a=t.slice(o),s.unknownSize){a.shift();break}throw Error(`this metadata is not streaming webm file`)}}if(!(a[a.length-1].dataEnd>0))throw Error(`metadata dataEnd has wrong number`);var c=a[a.length-1].dataEnd,l=i[i.length-1].dataEnd,u=new n.default().encode(i).byteLength-l,d=c-a[0].tagStart;a[0].tagStart-l,a[0].tagStart;var f=new e.Buffer([24,83,128,103]),p=new e.Buffer(`01ffffffffffffff`,`hex`),m=f.byteLength+p.byteLength,h=d,_;for(_=1;_<20;_++){var v=u+(l+m+h-c),y=g(a,v,r),b=new n.default().encode(y).byteLength;if(b===h)return new n.default().encode([].concat(i,[{type:`m`,name:`Segment`,isEnd:!1,unknownSize:!0}],y));h=b}throw Error(`unable to refine metadata, stable size could not be found in `+_+` iterations!`)}e.putRefinedMetaData=m;function h(e){var t=new n.default;return e.reduce(function(e,n){return e.concat(t.encode([n]))},[]).reduce(function(e,t){return e+t.byteLength},0)}function g(e,t,n){var r=n.duration,i=n.clusterPtrs,a=n.cues,o=e.slice(0);if(typeof r==`number`){var s=!1;o.forEach(function(e){e.type===`f`&&e.name===`Duration`&&(s=!0,e.data=w(r,8))}),s||y(o,`Info`,[{name:`Duration`,type:`f`,data:w(r,8)}])}Array.isArray(a)&&y(o,`Cues`,v(a,t));var c=[];return Array.isArray(i)&&(console.warn(`append cluster pointers to seekhead is deprecated. please use cues`),c=_(i,t)),y(o,`SeekHead`,c,!0),o}function _(t,n){var r=[];return t.forEach(function(t){r.push({name:`Seek`,type:`m`,isEnd:!1}),r.push({name:`SeekID`,type:`b`,data:new e.Buffer([31,67,182,117])}),r.push({name:`SeekPosition`,type:`u`,data:S(t+n)}),r.push({name:`Seek`,type:`m`,isEnd:!0})}),r}function v(e,t){var n=[];return e.forEach(function(e){var r=e.CueTrack,i=e.CueClusterPosition,a=e.CueTime;n.push({name:`CuePoint`,type:`m`,isEnd:!1}),n.push({name:`CueTime`,type:`u`,data:S(a)}),n.push({name:`CueTrackPositions`,type:`m`,isEnd:!1}),n.push({name:`CueTrack`,type:`u`,data:S(r)}),n.push({name:`CueClusterPosition`,type:`u`,data:S(i+t)}),n.push({name:`CueTrackPositions`,type:`m`,isEnd:!0}),n.push({name:`CuePoint`,type:`m`,isEnd:!0})}),n}function y(e,t,n,r){r===void 0&&(r=!1);for(var i=-1,a=0;a<e.length;a++){var o=e[a];if(o.type===`m`&&o.name===t&&o.isEnd===!1){i=a;break}}i>=0?Array.prototype.splice.apply(e,[i+1,0].concat(n)):r?[{name:t,type:`m`,isEnd:!1}].concat(n,[{name:t,type:`m`,isEnd:!0}]).reverse().forEach(function(t){e.unshift(t)}):(e.push({name:t,type:`m`,isEnd:!1}),n.forEach(function(t){e.push(t)}),e.push({name:t,type:`m`,isEnd:!0}))}function b(t){return e.Buffer.concat(t)}e.concat=b;function x(n){var r=new e.Buffer(0);if(n.type===`m`)return n;switch(n.type){case`u`:r=S(n.value);break;case`i`:r=C(n.value);break;case`f`:r=w(n.value);break;case`s`:r=new e.Buffer(n.value,`ascii`);break;case`8`:r=new e.Buffer(n.value,`utf8`);break;case`b`:r=n.value;break;case`d`:r=new t.Int64BE(n.value.getTime().toString()).toBuffer();break}return Object.assign({},n,{data:r})}e.encodeValueToBuffer=x;function S(n){for(var r=1;n>=2**(8*r);r++);if(r>=7)return console.warn(`7bit or more bigger uint not supported.`),new t.Uint64BE(n).toBuffer();var i=new e.Buffer(r);return i.writeUIntBE(n,0,r),i}e.createUIntBuffer=S;function C(n){for(var r=1;n>=2**(8*r);r++);if(r>=7)return console.warn(`7bit or more bigger uint not supported.`),new t.Int64BE(n).toBuffer();var i=new e.Buffer(r);return i.writeIntBE(n,0,r),i}e.createIntBuffer=C;function w(t,n){if(n===void 0&&(n=8),n===8){var r=new e.Buffer(8);return r.writeDoubleBE(t,0),r}else if(n===4){var r=new e.Buffer(4);return r.writeFloatBE(t,0),r}else throw Error(`float type bits must 4bytes or 8bytes`)}e.createFloatBuffer=w;function T(e){return e instanceof Date?e:new Date(new Date(`2001-01-01T00:00:00.000Z`).getTime()+Number(e)/1e3/1e3)}e.convertEBMLDateToJSDate=T})),Pd=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Cd(),n=Nd(),r=Nd(),i=wd(),a;(function(e){e[e.STATE_TAG=1]=`STATE_TAG`,e[e.STATE_SIZE=2]=`STATE_SIZE`,e[e.STATE_CONTENT=3]=`STATE_CONTENT`})(a||={}),e.default=function(){function e(){this._buffer=new n.Buffer(0),this._tag_stack=[],this._state=a.STATE_TAG,this._cursor=0,this._total=0,this._schema=i.byEbmlID,this._result=[]}return e.prototype.decode=function(e){this.readChunk(e);var t=this._result;return this._result=[],t},e.prototype.readChunk=function(e){for(this._buffer=r.concat([this._buffer,new n.Buffer(e)]);this._cursor<this._buffer.length&&!(this._state===a.STATE_TAG&&!this.readTag()||this._state===a.STATE_SIZE&&!this.readSize()||this._state===a.STATE_CONTENT&&!this.readContent()););},e.prototype.getSchemaInfo=function(e){return this._schema[e]||{name:`unknown`,level:-1,type:`unknown`,description:`unknown`}},e.prototype.readTag=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,n.readVint)(this._buffer,this._cursor);if(e==null)return!1;var t=this._buffer.slice(this._cursor,this._cursor+e.length).reduce(function(e,t,n,r){return e+t*16**(2*(r.length-1-n))},0),r=this.getSchemaInfo(t),i={EBML_ID:t.toString(16),schema:r,type:r.type,name:r.name,level:r.level,tagStart:this._total,tagEnd:this._total+e.length,sizeStart:this._total+e.length,sizeEnd:null,dataStart:null,dataEnd:null,dataSize:null,data:null};return this._tag_stack.push(i),this._cursor+=e.length,this._total+=e.length,this._state=a.STATE_SIZE,!0},e.prototype.readSize=function(){if(this._cursor>=this._buffer.length)return!1;var e=(0,n.readVint)(this._buffer,this._cursor);if(e==null)return!1;var t=this._tag_stack[this._tag_stack.length-1];return t.sizeEnd=t.sizeStart+e.length,t.dataStart=t.sizeEnd,t.dataSize=e.value,e.value===-1?(t.dataEnd=-1,t.type===`m`&&(t.unknownSize=!0)):t.dataEnd=t.sizeEnd+e.value,this._cursor+=e.length,this._total+=e.length,this._state=a.STATE_CONTENT,!0},e.prototype.readContent=function(){var e=this._tag_stack[this._tag_stack.length-1];if(e.type===`m`){if(e.isEnd=!1,this._result.push(e),this._state=a.STATE_TAG,e.dataSize===0){var r=Object.assign({},e,{isEnd:!0});this._result.push(r),this._tag_stack.pop()}return!0}if(this._buffer.length<this._cursor+e.dataSize)return!1;var i=this._buffer.slice(this._cursor,this._cursor+e.dataSize);switch(this._buffer=this._buffer.slice(this._cursor+e.dataSize),e.data=i,e.type){case`u`:e.value=i.readUIntBE(0,i.length);break;case`i`:e.value=i.readIntBE(0,i.length);break;case`f`:e.value=e.dataSize===4?i.readFloatBE(0):e.dataSize===8?i.readDoubleBE(0):(console.warn(`cannot read ${e.dataSize} octets float. failback to 0`),0);break;case`s`:e.value=i.toString(`ascii`);break;case`8`:e.value=i.toString(`utf8`);break;case`b`:e.value=i;break;case`d`:e.value=(0,n.convertEBMLDateToJSDate)(new t.Int64BE(i).toNumber());break}if(e.value===null)throw Error(`unknown tag type:`+e.type);for(this._result.push(e),this._total+=e.dataSize,this._state=a.STATE_TAG,this._cursor=0,this._tag_stack.pop();this._tag_stack.length>0;){var o=this._tag_stack[this._tag_stack.length-1];if(o.dataEnd<0)return this._tag_stack.pop(),!0;if(this._total<o.dataEnd)break;if(o.type!==`m`)throw Error(`parent element is not master element`);var r=Object.assign({},o,{isEnd:!0});this._result.push(r),this._tag_stack.pop()}return!0},e}()})),Fd=s(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),Id=s((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0});var n=Fd(),r=Nd();e.default=function(e){t(n,e);function n(){var t=e.call(this)||this;return t.logGroup=``,t.hasLoggingStarted=!1,t.metadataloaded=!1,t.chunks=[],t.stack=[],t.segmentOffset=0,t.last2SimpleBlockVideoTrackTimecode=[0,0],t.last2SimpleBlockAudioTrackTimecode=[0,0],t.lastClusterTimecode=0,t.lastClusterPosition=0,t.timecodeScale=1e6,t.metadataSize=0,t.metadatas=[],t.cues=[],t.firstVideoBlockRead=!1,t.firstAudioBlockRead=!1,t.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null},t.trackTypes=[],t.trackDefaultDuration=[],t.trackCodecDelay=[],t.trackInfo={type:`nothing`},t.ended=!1,t.logging=!1,t.use_duration_every_simpleblock=!1,t.use_webp=!1,t.use_segment_info=!0,t.drop_default_duration=!0,t}return n.prototype.stop=function(){for(this.ended=!0,this.emit_segment_info();this.stack.length;)this.stack.pop(),this.logging&&console.groupEnd();this.logging&&this.hasLoggingStarted&&this.logGroup&&console.groupEnd()},n.prototype.emit_segment_info=function(){var e=this.chunks;if(this.chunks=[],this.metadataloaded){if(!this.use_segment_info)return;var t=this.lastClusterTimecode,n=this.duration,r=this.timecodeScale;this.emit(`cluster`,{timecode:t,data:e}),this.emit(`duration`,{timecodeScale:r,duration:n})}else{this.metadataloaded=!0,this.metadatas=e;var i=this.trackTypes.indexOf(1),a=this.trackTypes.indexOf(2);if(this.trackInfo=i>=0&&a>=0?{type:`both`,trackNumber:i}:i>=0?{type:`video`,trackNumber:i}:a>=0?{type:`audio`,trackNumber:a}:{type:`nothing`},!this.use_segment_info)return;this.emit(`metadata`,{data:e,metadataSize:this.metadataSize})}},n.prototype.read=function(e){var t=this,n=!1;if(!this.ended){if(e.type===`m`)if(e.isEnd)this.stack.pop();else{var i=this.stack[this.stack.length-1];if(i!=null&&i.level>=e.level){this.stack.pop(),this.logging&&console.groupEnd(),i.dataEnd=e.dataEnd,i.dataSize=e.dataEnd-i.dataStart,i.unknownSize=!1;var a=Object.assign({},i,{name:i.name,type:i.type,isEnd:!0});this.chunks.push(a)}this.stack.push(e)}if(e.type===`m`&&e.name==`Segment`)this.segmentOffset!=0&&console.warn(`Multiple segments detected!`),this.segmentOffset=e.dataStart,this.emit(`segment_offset`,this.segmentOffset);else if(e.type===`b`&&e.name===`SimpleBlock`){var o=r.ebmlBlock(e.data),s=o.timecode,c=o.trackNumber,l=o.frames;if(this.trackTypes[c]===1){if(!this.firstVideoBlockRead&&(this.firstVideoBlockRead=!0,this.trackInfo.type===`both`||this.trackInfo.type===`video`)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit(`cue_info`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit(`cue`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockVideoTrackTimecode=[this.last2SimpleBlockVideoTrackTimecode[1],s]}else if(this.trackTypes[c]===2){if(!this.firstAudioBlockRead&&(this.firstAudioBlockRead=!0,this.trackInfo.type===`audio`)){var u=this.lastClusterTimecode+s;this.cues.push({CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u}),this.emit(`cue_info`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit(`cue`,{CueTrack:c,CueClusterPosition:this.lastClusterPosition,CueTime:u})}this.last2SimpleBlockAudioTrackTimecode=[this.last2SimpleBlockAudioTrackTimecode[1],s]}this.use_duration_every_simpleblock&&this.emit(`duration`,{timecodeScale:this.timecodeScale,duration:this.duration}),this.use_webp&&l.forEach(function(e){if(e.slice(3,6).toString(`hex`)===`9d012a`){var n=r.VP8BitStreamToRiffWebPBuffer(e),i=new Blob([n],{type:`image/webp`}),a=t.duration;t.emit(`webp`,{currentTime:a,webp:i})}})}else e.type===`m`&&e.name===`Cluster`&&e.isEnd===!1?(this.firstVideoBlockRead=!1,this.firstAudioBlockRead=!1,this.emit_segment_info(),this.emit(`cluster_ptr`,e.tagStart),this.lastClusterPosition=e.tagStart):e.type===`u`&&e.name===`Timecode`?this.lastClusterTimecode=e.value:e.type===`u`&&e.name===`TimecodeScale`?this.timecodeScale=e.value:e.type===`m`&&e.name===`TrackEntry`?e.isEnd?(this.trackTypes[this.currentTrack.TrackNumber]=this.currentTrack.TrackType,this.trackDefaultDuration[this.currentTrack.TrackNumber]=this.currentTrack.DefaultDuration,this.trackCodecDelay[this.currentTrack.TrackNumber]=this.currentTrack.CodecDelay):this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null}:e.type===`u`&&e.name===`TrackType`?this.currentTrack.TrackType=e.value:e.type===`u`&&e.name===`TrackNumber`?this.currentTrack.TrackNumber=e.value:e.type===`u`&&e.name===`CodecDelay`?this.currentTrack.CodecDelay=e.value:e.type===`u`&&e.name===`DefaultDuration`?this.drop_default_duration?(console.warn(`DefaultDuration detected!, remove it`),n=!0):this.currentTrack.DefaultDuration=e.value:e.name===`unknown`&&console.warn(e);!this.metadataloaded&&e.dataEnd>0&&(this.metadataSize=e.dataEnd),n||this.chunks.push(e),this.logging&&this.put(e)}},Object.defineProperty(n.prototype,`duration`,{get:function(){if(this.trackInfo.type===`nothing`)return console.warn(`no video, no audio track`),0;var e=0,t=0,n=0,r=this.trackDefaultDuration[this.trackInfo.trackNumber];if(typeof r==`number`)e=r;else if(this.trackInfo.type===`both`)if(this.last2SimpleBlockAudioTrackTimecode[1]>this.last2SimpleBlockVideoTrackTimecode[1]){e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackTypes.indexOf(2)];typeof i==`number`&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}else{e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackTypes.indexOf(1)];typeof i==`number`&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if(this.trackInfo.type===`video`){e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackInfo.trackNumber];typeof i==`number`&&(t=i),n=this.last2SimpleBlockVideoTrackTimecode[1]}else if(this.trackInfo.type===`audio`){e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale;var i=this.trackCodecDelay[this.trackInfo.trackNumber];typeof i==`number`&&(t=i),n=this.last2SimpleBlockAudioTrackTimecode[1]}var a=((this.lastClusterTimecode+n)*this.timecodeScale+e-t)/this.timecodeScale;return Math.floor(a)},enumerable:!1,configurable:!0}),n.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},n.prototype.put=function(e){this.hasLoggingStarted||(this.hasLoggingStarted=!0,this.logging&&this.logGroup&&console.groupCollapsed(this.logGroup)),e.type===`m`?e.isEnd?console.groupEnd():console.group(e.name+`:`+e.tagStart):e.type===`b`?console.log(e.name,e.type):console.log(e.name,e.tagStart,e.type,e.value)},n}(n.EventEmitter)})),Ld=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.tools=e.Reader=e.Encoder=e.Decoder=void 0,n(Sd(),e),e.Decoder=Pd().default,e.Encoder=Td().default,e.Reader=Id().default,e.tools=Nd()})),Rd=s((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0});var r=Ld();function i(e){return t(this,void 0,void 0,function(){var t,i,a,o,s,c,l,u,d,f,p,m;return n(this,function(n){switch(n.label){case 0:if(!e)throw Error(`call to fixWebmDuration requires a blob`);t=new r.Decoder,i=new r.Reader,a=e.stream(),o=a.getReader(),n.label=1;case 1:return[4,o.read()];case 2:return s=n.sent(),c=s.done,l=s.value,c?(i.stop(),[3,3]):(u=t.decode(l),u=u?.filter(function(e){return e.type!==`unknown`}),u.forEach(function(e){i.read(e)}),l=null,[3,1]);case 3:return d=r.tools.makeMetadataSeekable(i.metadatas,i.duration,i.cues),f=new Blob([d],{type:e.type}),p=e.slice(i.metadataSize),m=new Blob([f,p],{type:e.type}),[2,m]}})})}e.default=i})),zd=1e3,Bd=class{#e;#t=!1;#n=!1;#r=0;#i=0;#a=0;#o=0;#s=0;onchange=e=>{};onDurationChange=e=>{};constructor(){}start=async(e=``)=>{e||=`video_Record_${M(Date.now())}`;let t=[];return navigator.mediaDevices.getDisplayMedia({audio:!0,video:!0}).then(n=>{let r=n.getTracks();for(let e of r)e.onended=()=>this.stop();this.#t=!0,this.#n=!1,this.#e=new MediaRecorder(n),this.#e.start(zd);let i=new Date().getTime();this.#r=i,this.#a=i,this.#c(),this.#l(),this.#e.addEventListener(`dataavailable`,e=>{t.push(e.data)}),this.#e.addEventListener(`stop`,async()=>{this.#t=!1;let r=new Date().getTime();this.#i=r,this.#o+=r-this.#a,this.#c(),clearInterval(this.#s);let i=n.getTracks();for(let e of i)e.stop();if(this.#e===null)return;let a=this.#e.mimeType,o=new Blob(t,{type:a}),s;try{s=await yd(await o.arrayBuffer(),a)}catch{s=await ld(await Promise.resolve().then(()=>u(Rd(),1)))(new Blob(t,{type:a}))}let c=URL.createObjectURL(s),l=document.createElement(`a`);l.href=c,l.download=`${e}.mp4`,l.click(),URL.revokeObjectURL(c),t=[],this.#e=null})})};pause=async()=>{await new Promise(e=>setTimeout(()=>e(!0),300)),this.#e?.pause(),this.#n=!0;let e=new Date().getTime();this.#o+=e-this.#a,this.#c(),clearInterval(this.#s)};resume=async()=>{this.#e?.resume(),this.#n=!1,this.#a=new Date().getTime(),this.#c(),this.#l()};stop=async()=>{this.#e?.stop()};destroy=()=>{clearInterval(this.#s),this.#s=0,this.#t&&this.#e&&this.#e.stop()};getDuration=()=>{if(this.#a===0)return 0;let e=this.#o,t=new Date().getTime();if(this.#t&&this.#n===!1){let n=t-this.#a;this.#a=t,e+=n}return e};getInfo=()=>({active:this.#t,pause:this.#n,startTime:this.#r,endTime:this.#i,duration:this.#o});#c=()=>{let e=this.getInfo();this.onchange(e)};#l=()=>{clearInterval(this.#s),this.#s=window.setInterval(()=>{this.#o=this.getDuration(),this.onDurationChange(this.#o)},500)}},Vd=Object.defineProperty,Hd=e=>{throw TypeError(e)},Ud=(e,t,n)=>t in e?Vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wd=(e,t,n)=>Ud(e,typeof t==`symbol`?t:t+``,n),Gd=(e,t,n)=>t.has(e)||Hd(`Cannot `+n),Kd=(e,t,n)=>(Gd(e,t,`read from private field`),n?n.call(e):t.get(e)),qd=(e,t,n)=>t.has(e)?Hd(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Jd,Yd,Xd,Zd=class{constructor(e={}){Wd(this,`queue`,[]),Wd(this,`timer`,0),Wd(this,`activeIndex`,0),Wd(this,`activePromise`),Wd(this,`options`,{timeout:0}),Wd(this,`add`,(e,t={})=>new Promise(async(n,r)=>{let i=t.timeout||this.options.timeout,a=t.key||Kd(this,Jd).call(this),o=t.describe||``;if(this.queue.findIndex(e=>e.key===a)!==-1)return r(`${a} is exist.`);let s={key:a,func:e,describe:o,timeout:i,resolve:n,reject:r};this.queue.unshift(s),this.activePromise||Kd(this,Xd).call(this)})),Wd(this,`clear`,()=>{this.queue=[],this.activePromise=void 0,clearTimeout(this.timer)}),Wd(this,`retry`,()=>{Kd(this,Xd).call(this)}),qd(this,Jd,()=>(this.activeIndex+=1,`${this.activeIndex}`)),qd(this,Yd,e=>{let t=this.queue.findIndex(t=>t.key===e);this.queue.splice(t,1)}),qd(this,Xd,async()=>{let e=this.queue.length;if(e===0)return;let t=e-1;this.activePromise=this.queue[t];let{key:n,func:r,resolve:i,reject:a,timeout:o}=this.activePromise;o&&(this.timer=window.setTimeout(()=>{a(`pr-async-queue: ${n} is timeout.`),Kd(this,Xd).call(this)},o)),await r().then(i).catch(a).finally(()=>{clearTimeout(this.timer),this.activePromise=void 0,Kd(this,Yd).call(this,n),Kd(this,Xd).call(this)})}),this.options={timeout:0,...e}}};Jd=new WeakMap,Yd=new WeakMap,Xd=new WeakMap;var Qd=class{_requestAnimationFrameId;_requestAnimationFrameItems=new Map;_lastInvokeTime=new Map;addRequestAnimationFrame=(e,t,n)=>{this._requestAnimationFrameId||this.init();let r=1e3/Math.max(1,Math.min(120,n?.fps??20));this._requestAnimationFrameItems.set(e,n=>{let i=n??performance.now();i-(this._lastInvokeTime.get(e)??0)>=r&&(this._lastInvokeTime.set(e,i),t(n))})};clearRequestAnimationFrame=(e=[])=>{e.length===0&&(e=[...this._requestAnimationFrameItems.keys()]);for(let t of e)this._requestAnimationFrameItems.delete(t),this._lastInvokeTime.delete(t)};init=()=>{let e=t=>{let n=this._requestAnimationFrameItems.values();for(let e of n)e(t);if(this._requestAnimationFrameItems.size===0){this._requestAnimationFrameId=void 0;return}this._requestAnimationFrameId=requestAnimationFrame(e)};this._requestAnimationFrameId=requestAnimationFrame(e)};stop=()=>{this._requestAnimationFrameId!==void 0&&(cancelAnimationFrame(this._requestAnimationFrameId),this._requestAnimationFrameId=void 0)}},$d=class{config=new S;notifys=new ue;localMedias=new Ki;intervalQueue=new ku;asyncQueue=new Zd;traffic=new C;recorder=new Bd;animationFrame=new Qd;users=new mu({config:this.config,localMedias:this.localMedias,notifys:this.notifys});cws=new od({config:this.config});peer=new $l({config:this.config,users:this.users});constructor(){this.cws.on.log=e=>this.notifys.emit(`onLog`,{code:200,desc:`Message log.`,data:{message:e}}),this.intervalQueue.startQueue(),this.localMedias.on.devicechange=()=>this.notifys.emit(`onDevicechange`,{code:200,data:{},desc:`MediaDevice is change.`})}use=({rnnoise:e})=>{e!==void 0&&this.users.localUser.streamControls.mc_audio?.use({rnnoise:e})};setRoomState=e=>{this.config.roomState!==e&&(this.config.roomState=e,e===`closed`&&(this.config.isInRoom=!1),this.notifys.emit(`onRoomState`,{code:200,desc:`RoomState is change.`,data:{state:e}}))};setPeerState=e=>{this.config.peerState=e,this.notifys.emit(`onPeerState`,{code:200,desc:`PeerState is change.`,data:{state:e}})};guardNotifyRoomId=(e,t)=>e===this.config.roomId?!0:(e!==void 0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#ff0097;padding:16px 0;`,`------->quickvo: The received message does not belong to the current room.(${this.config.roomId})`,t),!1);hasAsyncTask=e=>{let t=!1;return this.asyncQueue.activePromise?.describe===e&&(t=!0),t===!1&&this.asyncQueue.queue.find(t=>t.describe===e)&&(t=!0),t};setCallStrategy=async(e,t=[])=>{t.length===0&&(t=B);let n=`balanced`;switch(e){case`qualityPriority`:n=`maintain-resolution`;break;case`fluencyPriority`:n=`maintain-framerate`;break;case`balancedDowngrade`:n=`balanced`;break}await this.peer.setRTCRtpSenderParameters({degradationPreference:n},t);let r=this.users.remoteUsers.values();for(let e of r)e.p2p?.setRTCRtpSenderParameters({degradationPreference:n},t)};_checkUserStreamOrigin=({p2pAverageQuality:e,sfuAverageQuality:t})=>e-(t+this.config.sfuPriority)>=0?`p2p`:`sfu`;_reportP2PConnect=(e,t)=>{if(this.cws.hasEvent(`reportP2PConnectEx`))return;let n;switch(e){case`success`:n=0;break;case`fail`:n=1;break;case`ignore`:n=2;break;case`disconnect`:n=3;break;case`poor_network`:n=4;break}let{mediaTypes:r,...i}=t,a=[];for(let e of r){let t=B.findIndex(t=>t===e);a.push(t)}return this.cws.createRequest(`reportP2PConnectEx`).send({data:{...i,code:n,types:a},compress:!1,version:3})};_reportLog=(e,t=`未知错误`)=>{if(t===`clear`)return;let{appid:n,userId:r,logUrl:i,reportErr:a}=this.config;if(this.notifys.emit(`onLog`,{code:0,desc:t,data:{type:e}}),!a||!this.config.logUrl)return;let o=(e=>({ws_c_timeout:0,webrtc_c_timeout:1,join_room_error:2,publish_error:3,subscribe_error:4,close_track_error:5,heartbeat_e_timeout:6,heartbeat_i_timeout:7,quit_room_error:8})[e].toString())(e);{let e={origin:`web`,type:o,app_id:n,user_id:r,desc:t},a=`${i}/upload/log?log_key=${btoa(encodeURI(JSON.stringify(e)))}`;(async()=>{let t;try{let e=await Zu(`#quickvo.logs`);t=JSON.stringify($u(e))}catch{t=JSON.stringify([])}let n=new TextEncoder().encode(t);this.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: reportLog`,{obj:e,url:a,size:w(n.byteLength)});let r=new Uint8Array(n);fetch(a,{headers:{"Content-Type":`application/octet-stream`},method:`POST`,body:r}).catch(()=>{this.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: reportLog is error.`,{obj:e,url:a,size:w(n.byteLength)})})})()}}},ef=class{base;constructor({base:e}){this.base=e,this.base.cws.on.onUpdateCall=e=>{let t=e.data?.user;if(!t)return;let{id:n,callAction:r=0}=t,i=this.base.users.getRemoteUserContent(n);i&&(i.updateCallAction(r),this.base.users.emitUsersChange())},this.base.cws.on.onRoomUserSpeech=e=>{this.base.notifys.emit(`onRoomUserSpeech`,e)},this.base.cws.on.onBeforeTokenExpire=e=>{this.base.notifys.emit(`onBeforeTokenExpire`,e)},this.base.cws.on.onTokenExpired=e=>{this.base.notifys.emit(`onTokenExpired`,e)},this.base.cws.on.onCDNPlayUrlAdd=e=>{this.base.notifys.emit(`onCDNPlayUrlAdd`,e)},this.base.cws.on.onNetQuality=e=>{let{qualities:t=[]}=e.data,n=!1;for(let e of t){let{userId:t,egress:r,ingress:i}=e,a=this.base.users.getRemoteUserContent(t);a&&a.updateNetwork({egress:r,ingress:i})===!1&&(n=!0)}n&&this.base.users.emitUsersChange()},this.base.cws.on.onRtcStats=e=>{let{stats:t}=e.data;for(let e of t){let{userId:t}=e;this.base.users.getRemoteUserContent(t)?.setPeerRtcStats(e)}}}_debugger=async()=>{await this.base.cws.createRequest(`debugger`,{onBack:!1}).send({data:{}})};_ai=async()=>{await this.base.cws.createRequest(`ai`,{onBack:!1}).send({data:{}})}},tf=(e,t)=>{if(!(e!=null&&e.ip)||!(e!=null&&e.port)||!(e!=null&&e.serve_ip)||!(e!=null&&e.serve_port)||!(t!=null&&t.ip)||!(t!=null&&t.port)||!(t!=null&&t.serve_ip)||!(t!=null&&t.serve_port))return`Unknown`;let[n,r]=[e.ip,e.port],[i,a]=[e.serve_ip,e.serve_port],[o,s]=[t.ip,t.port],[c,l]=[t.serve_ip,t.serve_port];return n===o&&r===s?`Full Cone`:n===i&&(o!==i||s!==r)||o===c&&(n!==c||r!==s)?`Restricted Cone`:n===i&&r===a&&(o!==i||s!==a)||o===c&&s===l&&(n!==c||r!==l)?`Port Restricted Cone`:`Symmetric`},nf=async()=>{let e=async e=>new Promise(t=>{let n=new RTCPeerConnection({iceServers:[{urls:`stun:${e}`}]});n.createDataChannel(`ice-channel`);let r=null;n.onicecandidate=i=>{if(i.candidate?.type===`srflx`){let[a,o]=e.split(`:`).map(e=>e.trim());r={ip:i.candidate.address||``,port:i.candidate.port?.toString(),serve_ip:a,serve_port:o},n.close(),t(r)}},setTimeout(()=>{n.close(),t(null)},5e3),n.createOffer().then(e=>n.setLocalDescription(e)).catch(()=>t(null))});try{let t=await e(`stun.cloudflare.com:3478`),n=await e(`stun.l.google.com:19302`);if(!t||!n)return{address:``,natType:`Unknown`};let r=tf(t,n);return{address:t.ip||``,natType:r}}catch(e){return console.error(`获取NAT类型失败:`,e),{address:``,natType:`Unknown`}}},rf=class{debounceMs;timer;state=`ready`;promise;_resolve;_reject;pendingFn;constructor(e=0){this.debounceMs=e}begin=()=>{this.state===`ready`&&(this.state=`waiting`,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t}))};exe=e=>{this.begin(),this.pendingFn=e,this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0);let t=()=>{this.timer=void 0,this._runFlush()};return this.debounceMs>0?this.timer=setTimeout(t,this.debounceMs):queueMicrotask(t),this.promise};_runFlush=async()=>{let e=this.pendingFn;if(this.pendingFn=void 0,!(!e||this.state!==`waiting`))try{let t=await e();this.resolve(t)}catch(e){this.reject(e)}};resolve=e=>{this.state===`waiting`&&(this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0),this.pendingFn=void 0,this.state=`ready`,this._resolve?.(e))};reject=e=>{this.state===`waiting`&&(this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0),this.pendingFn=void 0,this.state=`ready`,this._reject?.(e))};clear=()=>{this.reject(`clear`)}},af=class{#e={timeout:5*1e3,check:!1};#t=null;constructor(e={}){this.#e={...this.#e,...e}}#n=(e,t)=>new Promise(async n=>{this.#t=new AbortController;let{signal:r}=this.#t,i=this.#e.timeout,a=setTimeout(()=>{this.#t?.abort(`Timeout (${i}ms)`)},i);await fetch(e,{cache:`no-store`,...t,method:`HEAD`,signal:r}).then(e=>{clearTimeout(a),n({status:e.status===200?`successed`:`failed`,reason:e.status===200?``:`HTTP ${e.status}`})}).catch(e=>{if(clearTimeout(a),e.name===`AbortError`){let e=r.reason||`Actively stopped`;n({status:e.includes(`Timeout`)?`timeout`:`stopped`,reason:e})}else n({status:`error`,reason:e.message})})});request=(e,t)=>new Promise(async(n,r)=>{try{this.stop(),this.#e.check&&await this.#n(e),this.#t=new AbortController;let{signal:r}=this.#t;n(await fetch(e,{cache:`no-store`,...t,signal:r}))}catch(e){r(e)}});stop=()=>{if(this.#t?.signal.aborted===!1){let e=Error(`Actively stopped.`);e.name=`AbortError`,this.#t.abort(e)}}},of=class e{base;_onOnline;_reconnectTimerId;_networkCalculating=!1;_lastTrackAnalysisWarnTime=0;_turnRefreshTimerId;static _maxInNumberArray(e){if(e.length===0)return 0;let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];r>t&&(t=r)}return t}static _minInNumberArray(e){if(e.length===0)return 0;let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];r<t&&(t=r)}return t}_cwsConnectTask=new rf;_connectCFTask=new rf;_publishTask=new rf(300);_publishNotifyTask=new rf(300);_stopPublishTask=new rf(300);_subscribeTask=new rf(300);_stopSubscribeTask=new rf(300);_syncRoomInfoTask=new rf;_restorePeerTask=new rf;_quitRoomTask=new rf;_lastUpdateNetworkTime=0;constructor({base:e}){this.base=e,this.base.cws.on.state=e=>{switch(e){case`connecting`:case`reconnecting`:this.base.setRoomState(`connecting`);break;case`connected`:this.base.setRoomState(`connected`),this.base.config.isInRoom===!0&&this._syncRoomInfo().catch(()=>this.quitRoom());break;case`closed`:this._clear();break}},this.base.peer.on.state=e=>{switch(e){case`failed`:case`closed`:this._restorePeer().catch(()=>this.quitRoom());break;default:this.base.setPeerState(e);break}},this.base.cws.on.updateSeverTime=e=>{let{versionStr:t}=e.data;this.base.config.serviceEventVersion&&t!==this.base.config.serviceEventVersion&&(async()=>{this._publishTask.state===`waiting`&&await this._publishTask.promise,this._stopPublishTask.state===`waiting`&&await this._subscribeTask.promise,this._subscribeTask.state===`waiting`&&await this._subscribeTask.promise,this._stopSubscribeTask.state===`waiting`&&await this._subscribeTask.promise,this.base.peer.pc.signalingState!==`stable`&&(console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: signalingState is not stable.`,this.base.peer.pc.signalingState),this._restorePeer())})(),this.base.config.serviceEventVersion=t},this.base.cws.on.onJoinRoom=e=>{if(!this.base.guardNotifyRoomId(e.data.roomId,e))return;let t=e.data.user;t&&(this.base.users.initUsers([t],!0),this.base.users.emitUsersChange(),this._autoCheckSubscribe(),this.base.notifys.emit(`onJoinRoom`,e))},this.base.cws.on.onJoinRoomBatch=e=>{this.base.guardNotifyRoomId(e.data.roomId,e)&&(this.base.users.initUsers(e.data.users,!0),this._autoCheckSubscribe(),this.base.users.emitUsersChange())},this.base.cws.on.onQuitRoom=e=>{let{data:t}=e,n=t.user;if(!n)return;let{id:r}=n;if(r===this.base.config.userId)return this.base.notifys.emit(`onQuitRoom`,e),this.quitRoom();this._onRemoteUsersQuitRoom([r]).length!==0&&this.base.notifys.emit(`onQuitRoom`,e)},this.base.cws.on.onQuitRoomBatch=e=>{let t=e.data?.users??[],n=Array.from(t,e=>e.userId);this._onRemoteUsersQuitRoom(n)},this.base.cws.on.onPublish=e=>{let{roomId:t,user:n}=e.data;if(!this.base.guardNotifyRoomId(t,e)||!n)return;let r=this.base.users.getRemoteUserContent(n.id);if(!r)return;let{callAction:i=0,tracks:a=[]}=n,o=Array.from(a,({type:e})=>B[e]);r.p2p?.setRecvTracksEnabled(o,!1);let s=r.getTracksMid(o);this.base.peer.stopReceivers(s),r.updateTracks(a,!0),r.updateCallAction(i),this._autoCheckSubscribe(),this.base.users.emitUsersChange()},this.base.cws.on.onDataChannelPublish=e=>{let{userId:t,channels:n}=e.data;this.base.users.getRemoteUserContent(t)?.updateChannels(n),this._checkAndSubChannel().catch(()=>{})},this.base.cws.on.onCloseTrack=e=>{let t=e.data?.user;if(!t)return;let{id:n,callAction:r,tracks:i}=t,a=this.base.users.getRemoteUserContent(n);if(!a)return;a.updateCallAction(r??0);let o=Array.from(i,({type:e})=>B[e]),s=a.getTracksMid(o);this.base.peer.stopReceivers(s),a.removeTracks(o)},this.base.cws.on.onTrackInactive=async e=>{let{session:t,tracks:n=[]}=e.data;if(t!==this.base.config.callSession)return this._restorePeer().catch(()=>this.quitRoom());let r=[];for(let e of n){let{type:t,trackName:n}=e;if(t===void 0)continue;let i=B[t],a=this.base.users.localUser.getTrack(i);a&&a.trackName===n&&r.push(i)}r.length!==0&&(this.base.peer.stopSenders(r),this._restorePublish(r))},this.base.cws.on.onUpdatePermissions=e=>{let t=e.data?.user;if(!t)return;let{id:n,permissions:r=1}=t,i=this.base.users.getUserContent(n);i&&i.updatePermissions(r),this.base.users.emitUsersChange()},this.base.cws.on.onUpdatePermissionsBatch=e=>{let{users:t}=e.data;for(let e of t){let{id:t,permissions:n}=e,r=this.base.users.getUserContent(t);r&&r.updatePermissions(n??1)}this.base.users.emitUsersChange()},this.base.cws.on.onUpdateBehavior=e=>{let{users:t}=e.data;for(let e of t){let{id:t,behavior:n=0}=e,r=this.base.users.getUserContent(t);r&&r.updateBehavior(n)}let n=[],{behavior:r,isAdmin:i}=this.base.users.localUser,a=y(r);if(i===!1)for(let e of B)a[e]!==!0&&n.push(e);n.length===0?this.base.users.emitUsersChange():this.stopPublish(n)},this.base.cws.on.onRoomActionChange=e=>{let{roomAction:t,serverAction:n}=e.data;if(this.base.config.updateRoomAction(t||0),this.base.users.localUser.isAdmin===!1){let e=b(t),r=x(n),i=[];for(let t of B)e[t]!==!0&&r[t]!==!1&&i.push(t);i.length!==0&&this.stopPublish([`mc_audio`])}this.base.notifys.emit(`onRoomActionChange`,e)},this.base.cws.on.onMeetSpecialRolesChange=e=>{let{meetSpecialRoles:t,users:n}=e.data;this.base.users.updateUsersIsAdmin(t?.admin||[]);for(let e of n){let{id:t,permissions:n}=e;this.base.users.remoteUsers.get(t)?.updatePermissions(n??1)}this.base.users.emitUsersChange()},this.base.cws.on.onDestroyRoom=()=>this.quitRoom(),this._onOnline=()=>this._reportNetwork(),window.addEventListener(`online`,this._onOnline)}setLocalStream=async(e,t)=>{if(this.base.users.localUser.usePhoneyStream(e),t){if(e.includes(`mc_audio`)&&e.includes(`mc_video`)?await this.base.localMedias.initLocalStreamTrack(`mc`):e.includes(`mc_audio`)?await this.base.localMedias.initLocalStreamTrack(`mc_audio`):e.includes(`mc_video`)&&await this.base.localMedias.initLocalStreamTrack(`mc_video`),e.includes(`ss_audio`)&&e.includes(`ss_video`)?await this.base.localMedias.initLocalStreamTrack(`ss`):e.includes(`ss_audio`)&&!e.includes(`ss_video`)?await this.base.localMedias.initLocalStreamTrack(`ss_audio`):e.includes(`ss_video`)&&!e.includes(`ss_audio`)&&await this.base.localMedias.initLocalStreamTrack(`ss_video`),e.includes(`ss_audio`)){let e=this.base.users.localMedias.getLocalStreamTrack(`ss_audio`);e&&(e.onended=()=>this.stopPublish([`ss_audio`,`ss_video`]))}if(e.includes(`ss_video`)){let e=this.base.users.localMedias.getLocalStreamTrack(`ss_video`);e&&(e.onended=()=>this.stopPublish([`ss_audio`,`ss_video`]))}this.base.users.localUser.useLocalStream(e)}else for(let t of e)this.base.localMedias.stopLocalStreamTrack(t)};setMediaDeviceKind=async(e,t)=>{await this.base.users.localMedias.setMediaDeviceKind(e,t);let n=this.base.users.localUser;switch(e){case`audioinput`:n.usePhoneyStream([`mc_audio`]),this.base.localMedias.getLocalStreamTrack(`mc_audio`)&&(await this.base.localMedias.initLocalStreamTrack(`mc_audio`),n.useLocalStream([`mc_audio`])),this.base.peer.syncSenderStreamTrack([`mc_audio`]),this.base.users.syncRemoteUserP2PSenderStreamTrack([`mc_audio`]);break;case`videoinput`:n.usePhoneyStream([`mc_video`]),this.base.localMedias.getLocalStreamTrack(`mc_video`)&&(await this.base.localMedias.initLocalStreamTrack(`mc_video`),n.useLocalStream([`mc_video`])),this.base.peer.syncSenderStreamTrack([`mc_video`]),this.base.users.syncRemoteUserP2PSenderStreamTrack([`mc_video`]);break;case`audiooutput`:await this.base.users.localMedias.changeAudiooutput();break}};setMediaTrackConstraints=async(e,t)=>{this.base.localMedias.setMediaTrackConstraints(e,t),this.base.users.localMedias.isOpenMediaDevice(e)&&[`mc_video`].includes(e)&&await this.setLocalStream([e],!0)};joinRoom=async e=>{let t=new Date().getTime();this._quitRoomTask.state===`waiting`&&await this._quitRoomTask.promise,this.base.config.setOptions(e),this.base.users.localUser.id=e.userId,this.base.traffic.clear(),this.base.config.shardId=``,this.base.peer.setBroadcasted(B,!1),this.base.users.remoteUsers.clear();let{userId:n,callType:r,sdkToken:i,roomId:a,stt:o=!1,lang:s}=this.base.config,{input:c=`zh`,output:l=`zh`,translateEnable:u=!1}=s||{};this._connectCFByHttp(0).catch(()=>{}),await this._connectCws().catch(()=>{}),await this._connectCws().catch(()=>{}),await this._connectCws();let d=this.base.cws.createRequest(`joinRoom`),f=ne(32,10),{code:p=0,desc:m=`服务器繁忙`,data:h}=await(async()=>{let e=await d.send({data:{msg:f,msgId:f,callType:r,roomId:a,user:{id:n,tracks:[],callAction:0},token:i,stt:o,lang:{input:c,output:l,translateEnable:u}}}),{code:t=0}=e;return t===200?e:await d.send({data:{msg:f,msgId:f,callType:r,roomId:a,user:{id:n,tracks:[],callAction:0},token:i,stt:o,lang:{input:c,output:l,translateEnable:u}}})})();if(p!==200)throw Error(m);if(h.roomId!==a)throw`加入的房间不匹配`;this.base.config.isInRoom=!0,this.base.config.shardId=h.shardId||``,this._initHeartbeat(),this.base.users.initUsers(h.roomUsers,!0),this.base.config.updateRoomAction(h.roomAction||0);{let{meetSpecialRoles:e}=h,{creator:t=``,admin:n=[]}=e||{};if(t){let e=this.base.users.getUserContent(t);e&&(e.isOwner=!0)}this.base.users.updateUsersIsAdmin(n||[])}try{await this._connectCF(0).catch(()=>{}),await this._connectCF(3e3).catch(()=>{}),await this._connectCF(3e3)}catch(e){throw this.quitRoom(),e}this._autoCheckSubscribe(),this.base.users.emitUsersChange(),this._checkAndSubChannel().catch(()=>{});let g=new Date().getTime();if(this.base.config.debug===!0){let e=g-t;console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: joinRoom elapsed time is ${e}ms.`)}return f};publish=async e=>{if(e.length===0)throw Error(`Publish is error: The "mediaTypes" field cannot be left blank.`);let t=[...e],n=this.base.users.localUser;if(n.hasPermissions(`publish`)===!1)throw Error(`No permission.`);if(n.checkBanBehavior(t)===!1)throw Error(`Not permitted.`);return n.setPublished(t,!0),this._publishTask.exe(async()=>{let e=B.filter(e=>n.published[e]===!0);if(e.length===0)return!0;{let{invalid_mediaTypes:t}=this.base.localMedias.checkLocalStreamTracks(e);t.length!==0&&await this.setLocalStream(t,!0)}try{await this._createTracks(e)}catch{await this._restorePeer()}let{valid_mediaTypes:t,invalid_mediaTypes:r}=this.base.localMedias.checkLocalStreamTracks(e);if(n.setPublished(r,!1),t.length!==0)n.useLocalStream(t),await this.base.peer.syncSenderStreamTrack(t),await this.base.users.syncRemoteUserP2PSenderStreamTrack(t),n.updateSelfCallAction();else throw Error(`No effective track.`);return(await this._pubNotify(e)).length===0&&await this._notifySelfCallAction().catch(()=>{}),this.base.peer.channels.has(this.base.config.userId)===!1&&await this._pubChannel().catch(()=>{}),this.base.users.emitUsersChange(),!0})};stopPublish=async e=>{let t=[...e],n=this.base.users.localUser;return n.setPublished(t,!1),this._stopPublishTask.exe(async()=>{let e=B.filter(e=>n.published[e]===!1);n.usePhoneyStream(e),n.updateSelfCallAction(),await this.base.peer.syncSenderStreamTrack(e),await this.base.users.syncRemoteUserP2PSenderStreamTrack(e),await this.setLocalStream(e,!1),await this._notifySelfCallAction().catch(()=>{}),this.base.users.emitUsersChange()})};subscribe=async(e=[])=>{this.base.users.addRemoteUsersSubscribed(e),this._subscribeTask.state===`waiting`&&await this._subscribeTask.promise;let t=e=>this.base.asyncQueue.add(async()=>{try{await this.base.peer.waitings.peerConnected();let t=this.base.users.createRemoteUsersSubscribeData(e);if(t.length===0)return this._subscribeTask?.resolve(!0);e===!0&&await new Promise(e=>setTimeout(()=>e(!0),3e3));let{code:n=0,sn:r,data:i,desc:a}=await this.base.cws.createRequest(`subscribe`).send({data:{session:this.base.config.callSession,users:t}});if(await this._ackMsg(r),n!==200)throw Error(a);if(a.includes(`session_error-Session is not ready yet`))return!1;let{remoteSdp:o,users:s}=i;if(!o)throw Error(a||`The sdp was not correctly swapped.`);if(!s)throw Error(`No available users.`);{let e=new RTCSessionDescription({type:`offer`,sdp:o});await this.base.peer.setRemoteDescription(e),await this._renegotiate()}for(let e of s){let{id:t,tracks:n}=e;if(!t||!n)continue;let r=this.base.users.getRemoteUserContent(t);for(let e of n){if(e.code!==200)continue;let t=e.type||0,n=e.mid||``,i=e.trackName||``,a=B[t];r?.getTrack(a)?.trackName===i&&r?.useRemoteStream([a],this.base.peer,n)}}this.base.users.emitUsersChange()}catch{}return!0},{describe:`getRemoteUserTracks`});return this._subscribeTask.exe(async()=>{await t(!1)===!0&&await t(!0).catch(e=>{this.base._reportLog(`subscribe_error`,e.message||e)})})};stopSubscribe=async e=>{if(this.base.users.removeRemoteUsersSubscribed(e),this._stopSubscribeTask.state===`waiting`)return this._stopSubscribeTask.promise;let t=async()=>{try{let e=this.base.users.createRemoteUsersCloseData(),t=[],n=[];for(let r of e){let{userId:e,sfu_tracks:i,p2p_mediaTypes:a}=r;for(let e of i)n.push(e.mid);if(a.length!==0){let t=this.base.users.remoteUsers.get(e);if(!t)continue;t.usePhoneyStream(a),t.p2p?.setRecvTracksEnabled(a,!1),await this.base._reportP2PConnect(`disconnect`,{desc:`Take the initiative to disconnect.`,pushId:t.id,pullId:this.base.config.userId,mediaTypes:a})}if(i.length!==0){let n=this.base.users.remoteUsers.get(e);if(!n)continue;let r=Array.from(i,e=>e.mediaType);n.usePhoneyStream(r),t.push(...i)}}n.length!==0&&this.base.peer.stopReceivers(n),t.length!==0&&await this._closeTrack(t),this.base.users.emitUsersChange(),this._stopSubscribeTask?.resolve(!0)}catch{this._stopSubscribeTask?.reject(!0)}};return this._stopSubscribeTask.exe(()=>t())};quitRoom=()=>{let e=ne(32,10);return this._quitRoomTask.state===`ready`&&this._quitRoomTask.exe(async()=>{try{this._publishTask.state===`waiting`&&await this._publishTask.promise,this._stopPublishTask.state===`waiting`&&await this._stopPublishTask.promise,this._subscribeTask.state===`waiting`&&await this._subscribeTask.promise,this._stopSubscribeTask.state===`waiting`&&await this._stopSubscribeTask.promise;let{roomId:t,userId:n,isInRoom:r}=this.base.config;if(r===!1)return!0;this.base.config.isInRoom=!1,await this.base.cws.createRequest(`quitRoom`,{onBack:!1}).send({data:{roomId:t,userId:n,msgId:e,msg:e}}),await new Promise(e=>setTimeout(()=>e(!0),2e3))}catch(e){if(e!==`clear`)throw this.base._reportLog(`quit_room_error`,e.message||e),e}this._clear(),this.base.setRoomState(`ready`)}),Promise.resolve(e)};setBehaviors=async e=>{let{roomId:t}=this.base.config,n=[];for(let t of e){let{id:e,behaviors:r}=t,i=Object.keys(r);if(i.length===0)continue;let a=[];for(let e of i){let t={type:B.findIndex(t=>t===e),behavior:!r[e]};a.push(t)}let o={id:e,behaviors:a};n.push(o)}let r=await this.base.cws.createRequest(`preventUsersBehavior`).send({data:{roomId:t,users:n}}),{code:i=0,desc:a}=r;if(i!==200)throw Error(String(a));return r};toggleRoomSpeechLang=e=>{this.base.config.isInRoom===!0&&this.base.cws.createRequest(`toggleRoomSpeechLang`).send({data:e})};updateSimulcast=async e=>{let t=this.base.users.remoteUsers.values(),n=[];for(let r of t){let{id:t,tracks:i}=r,a=[];for(let t of B){if(![`mc_video`,`ss_video`].includes(t))continue;let n=i[t];if(!n)continue;let r={...n,simulcast:e};a.push(r)}a.length!==0&&n.push({id:t,tracks:a})}n.length!==0&&this.base.cws.createRequest(`updateSimulcast`).send({data:{session:this.base.config.callSession,users:n}})};updateToken=e=>{this.base.config.isInRoom===!0&&this.base.cws.createRequest(`updateRoomToken`).send({data:{roomId:this.base.config.roomId,sdkToken:e}})};destroy=async()=>{this.base.config.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [Destroy]`),this.base.config.isInRoom===!0&&await this.quitRoom(),this._quitRoomTask.state===`waiting`&&await this._quitRoomTask.promise;try{this._clear()}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: error`,e)}this._reconnectTimerId&&=(clearTimeout(this._reconnectTimerId),void 0),this._onOnline&&=(window.removeEventListener(`online`,this._onOnline),void 0),this._quitRoomTask.clear(),this.base.localMedias.destroy(),this.base.recorder.destroy(),this.base.notifys.emit(`onDestroyRoom`,{code:200,desc:`Is destroy.`,data:Sn(ni,{roomId:this.base.config.roomId})})};_clearTask=()=>{this._cwsConnectTask.clear(),this._connectCFTask.clear(),this._publishTask.clear(),this._stopPublishTask.clear(),this._subscribeTask.clear(),this._stopSubscribeTask.clear(),this._syncRoomInfoTask.clear(),this._restorePeerTask.clear()};_clear=()=>{clearTimeout(this._turnRefreshTimerId),this.setLocalStream(B,!1),this._clearTask(),this.base.setRoomState(`closed`),this.base.animationFrame.stop(),this.base.config.shardId=``,this.base.cws.clearEvents(),this.base.cws.close(),this.base.peer.close(),this.base.intervalQueue.removeQueueItem([`heartbeat-interval`,`peerAnalysis`]),this.base.asyncQueue.clear(),this.base.users.localUser.clear(),this.base.users.clearRemoteUsers()};_connectCws=async()=>this._cwsConnectTask.state===`waiting`?this._cwsConnectTask.promise:this._cwsConnectTask.exe(async()=>{this.base.cws.isValid()!==!0&&(this.base.setRoomState(`connecting`),await this.base.cws.connect())});_initHeartbeat=()=>{this.base.intervalQueue.removeQueueItem([`heartbeat-interval`]),this.base.intervalQueue.addQueueItem({key:`heartbeat-interval`,func:()=>{if(this.base.cws.prws.ws?.readyState!==1)return;if(this.base.cws.needRestoreRoom()===!0)return this._restoreRoom();let e=this.base.cws.createRequest(`heartbeat`,{onBack:!1}),t=this.base.traffic.getUse(`kb`),{outboundBytes:n,inboundBytes:r}=t.sfu,{outboundBytes:i,inboundBytes:a}=t.p2p,o={sfuPush:BigInt(Math.round(n)),sfuPull:BigInt(Math.round(r)),p2pPush:BigInt(Math.round(i)),p2pPull:BigInt(Math.round(a))};e.send({data:o}),this.base.cws.prws.send(`ping`)},interval:1e3*10})};_fetchGenTurnAddress=async()=>{try{clearTimeout(this._turnRefreshTimerId);let{code:e=0,desc:t,data:n,sn:r}=await this.base.cws.createRequest(`genTurnAddress`).send({data:{}});if(await this._ackMsg(r),e!==200)throw Error(t);let{expiresAt:i}=n,a=Number(i)*1e3-new Date().getTime()-3e4;return this._turnRefreshTimerId=setTimeout(()=>this._refreshTurnViaSetConfiguration(),a),n}catch(e){this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: genTurnAddress failed, use default STUN.`,e)}};_refreshTurnViaSetConfiguration=async()=>{if(this.base.config.isInRoom!==!0||this.base.cws.prws.ws?.readyState!==1||this.base.peer.pc.signalingState===`closed`)return;let e=await this._fetchGenTurnAddress();if(e!=null&&Array.isArray(e.iceServers)&&e.iceServers.length>0){this.base.peer.setTurnConfiguration(e);{await this.base.peer.createOffer();let e=this.base.users.localUser,t=e.getTracks([`mc_audio`,`mc_video`]),{code:n=0,desc:r,data:i,sn:a}=await this.base.cws.createRequest(`publish`).send({compress:!0,data:{sdp:this.base.peer.getSdp(),tracks:t,callAction:e.callAction,session:this.base.config.callSession}});if(await this._ackMsg(a),n!==200)throw Error(r);if(!i)throw Error(`No publish response data.`);let{remoteSdp:o}=i,s=o||``;await this.base.peer.setRemoteDescription({type:`answer`,sdp:s})}}else this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#b64900;`,`------->quickvo: [turnRefreshBeforeExpiry] genTurnAddress returned no iceServers, no follow-up timer`)};_connectCFByHttp=async e=>this._connectCFTask.state===`waiting`?this._connectCFTask.promise:this._connectCFTask.exe(async()=>{if(this.base.peer.checkValid()===!0)return!0;await new Promise(t=>setTimeout(()=>t(!0),e)),await this.base.peer.init();let t=[`mc_audio`,`mc_video`];await this.base.peer.addSenders(t);let n=this.base.users.localUser.getTracks(t),{url:r,appid:i,sdkToken:a}=this.base.config,o={sdp:this.base.peer.getSdp(),tracks:n,callAction:0},s=new af,c=setTimeout(()=>s.stop(),5e3),l=await s.request(`https://${r}/${i}/pre_publish`,{method:`POST`,headers:{Authorization:`Bearer ${a}`},body:JSON.stringify(o)});clearTimeout(c);let{code:u=0,desc:d,data:f}=await l.json();if(u!==200)throw Error(d);let{sessionDescription:p,sessionId:m}=f;return this.base.config.callSession=m||``,await this.base.peer.setRemoteDescription(p),await le(this.base.peer.waitings.peerConnected,{message:`ice connect is timeout.`,timeout:10*1e3}),this._reportNetwork(),this.base.intervalQueue.addQueueItem({key:`peerAnalysis`,func:this._calculateNetwork,interval:1e3}),!0});_connectCF=async e=>this._connectCFTask.state===`waiting`?this._connectCFTask.promise:this._connectCFTask.exe(async()=>{if(this.base.peer.checkValid()===!0)return!0;await new Promise(t=>setTimeout(()=>t(!0),e));let t=await this._fetchGenTurnAddress();await this.base.peer.init(t);let n=[`mc_audio`,`mc_video`];await this.base.peer.addSenders(n);let r=this.base.users.localUser.getTracks(n),{code:i=0,desc:a,data:o,sn:s}=await this.base.cws.createRequest(`publish`).send({compress:!0,data:{sdp:this.base.peer.getSdp(),tracks:r,callAction:0}});if(await this._ackMsg(s),i!==200)throw Error(a);if(!o)throw Error(`No publish response data.`);let{remoteSdp:c,session:l}=o;this.base.config.callSession=l||``;let u=c||``;return await this.base.peer.setRemoteDescription({type:`answer`,sdp:u}),await le(this.base.peer.waitings.peerConnected,{message:`ice connect is timeout.`,timeout:10*1e3}),this._reportNetwork(),this.base.intervalQueue.addQueueItem({key:`peerAnalysis`,func:this._calculateNetwork,interval:1e3}),!0});_reportNetwork=async()=>{try{let e=0,{address:t,natType:n}=await nf();switch(n){case`Symmetric`:e=0;break;case`Full Cone`:e=1;break;case`Port Restricted Cone`:e=2;break;case`Restricted Cone`:e=3;break}let r=0;{let e=f(),t=(navigator.connection||navigator.mozConnection||navigator.webkitConnection).effectiveType;e||(r=[`wifi`,`4g`].includes(t)?0:2),e&&(r=[`wifi`].includes(t)?0:2)}await this.base.cws.createRequest(`reportNetwork`).send({data:{nat:e,type:r,ip:t}})}catch(e){this.base.config.debug&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [reportNetwork]`,e)}};_createTracks=e=>this.base.asyncQueue.add(async()=>{try{await this.base.peer.waitings.peerConnected();let t=await this.base.peer.addSenders(e);if(t.length===0)return!0;let n=D(this.base.users.localUser.getTracks(t),[`type`,`trackName`,`mid`]),r=this.base.peer.getSdp(),{code:i=0,sn:a,desc:o,data:s}=await this.base.cws.createRequest(`publish`).send({compress:!0,data:{session:this.base.config.callSession,sdp:r,tracks:n,callAction:0}});if(await this._ackMsg(a),i!==200)throw Error(o);if(!s)throw Error(`No publish response data.`);let{remoteSdp:c}=s;return await this.base.peer.setRemoteDescription({type:`answer`,sdp:c||``}),!0}catch(e){throw this.base._reportLog(`publish_error`,e.message||e),e}},{describe:`createTrack`});_closeTrack=(e=[])=>this.base.asyncQueue.add(async()=>{if(e.length===0)return!0;try{await this.base.peer.createOffer();let t=D(e,[`type`,`trackName`,`mid`]),{code:n=0,desc:r,data:i}=await this.base.cws.createRequest(`closeTrack`).send({compress:!0,data:{roomId:this.base.config.roomId,sdp:this.base.peer.getSdp(),tracks:t}});if(n!==200)throw Error(r);return await this.base.peer.setRemoteDescription({type:`answer`,sdp:i?.remoteSdp||``}),!0}catch(e){throw this.base._reportLog(`close_track_error`,e.message||e),e}},{describe:`closeTrack`});_restorePublish=async e=>{if(e.length===0)return;await this._createTracks(e),await this._pubNotify(e);let{valid_mediaTypes:t}=this.base.localMedias.checkLocalStreamTracks(e);this.publish(t)};_pubNotify=async e=>(this._publishNotifyTask.state===`waiting`&&await this._publishNotifyTask.promise,this._publishNotifyTask.exe(async()=>{let t=this.base.peer.getNoBroadcasted(e);if(t.length===0)return[];let n=this.base.users.localUser.getTracks(t);if(n.length===0)throw Error(`The media track for the broadcast does not exist.`);let r=D(n,[`type`,`trackName`,`mid`]),{callSession:i,roomId:a,userId:o}=this.base.config,{callAction:s}=this.base.users.localUser,{code:c=0,desc:l}=await this.base.cws.createRequest(`pubNotify`).send({data:{session:i,roomId:a,user:{id:o,callAction:s,tracks:r}}});if(c!==200)throw Error(l);return this.base.peer.setBroadcasted(t,!0),t}));_submitRtcStats=async e=>new Promise(async(t,n)=>{try{let{code:n=0,desc:r}=await this.base.cws.createRequest(`rtcStats`).send({data:e});if(n!==200)throw Error(r);t(!0)}catch(e){n(e)}});_renegotiate=async()=>{await this.base.peer.createAnswer();let e=this.base.peer.getSdp(),{code:t=0,desc:n,sn:r}=await this.base.cws.createRequest(`renegotiate`).send({data:{sdp:e},compress:!0});if(await this._ackMsg(r),t!==200)throw Error(n);await new Promise(e=>setTimeout(()=>e(!0),1e3))};_ackMsg=async e=>{await this.base.cws.createRequest(`ackMsg`,{onBack:!1}).send({data:{msgId:BigInt(e)}})};_autoCheckSubscribe=()=>{let e=this.base.users.remoteUsers.values(),t=[],n=B.filter(e=>this.base.config.autoSubscribe[e]===!0);for(let r of e){let e=[],{id:i,tracks:a}=r;for(let t of n){let n=a[t];n&&n.origin===`phoney`&&e.push(t)}e.length!==0&&t.push({userId:i,mediaTypes:e})}this.subscribe(t)};_onRemoteUsersQuitRoom=e=>{let{removeUserIds:t,removeMids:n}=this.base.users.detachRemoteUsersForQuit(e);return t.length!==0&&(this.base.peer.stopReceivers(n),this._closeChannel(t).catch(()=>{}),this.base.users.emitUsersChange(!0)),t};_notifySelfCallAction=async()=>{let{roomId:e}=this.base.config,{id:t,callAction:n}=this.base.users.localUser,{code:r=0}=await this.base.cws.createRequest(`updateCall`).send({data:{roomId:e,user:{id:t,callAction:n}}});if(r!==200)throw Error(`NotifySelfCallAction is error.`)};_calculateNetwork=async()=>{if(this.base.cws.prws.ws?.readyState===1&&this.base.peer.pc.connectionState===`connected`&&!this._networkCalculating){this._networkCalculating=!0;try{let t={elapsed:0,memory:{jsHeapSizeLimit:0,totalJSHeapSize:0,usedJSHeapSize:0},sfu:{inboundBytes:0,outboundBytes:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,velocityPush:0,velocityPull:0},p2p:{inboundBytes:0,outboundBytes:0,lostRate:0,roundTripTime:0,jitter:0,quality:0,averageQuality:0,velocityPush:0,velocityPull:0}};if(performance)try{t.memory=performance.memory}catch{}let n=[],r=[],i=[];{let a=[0],o=[0],s=[0],c=[],l=[],u=new Date().getTime(),d=this.base.users.localUser,f=Array.from(this.base.users.remoteUsers.values()),p=await this.base.peer.pc.getStats(),m=await Promise.all(f.map(e=>e.p2p?.pc&&e.p2p.pc.connectionState===`connected`?e.p2p.pc.getStats():Promise.resolve(null)));await Promise.all([d.generateTrackAnalysis(this.base.peer,p),...f.map((e,t)=>e.generateTrackAnalysis(this.base.peer,p,m[t]))]);for(let e of B)if(d.published[e]&&d.getTrack(e)){let{trackReport:i}=d.tracksAnalysis.sfu.sends[e],{offsetBytesSent:u,lostRate:f,roundTripTime:p,jitter:m,quality:h,averageQuality:g,averageOffsetBytesSent:_}=i;if(this.base.traffic.sfu.outboundBytes+=u,t.sfu.velocityPush+=_,a.push(f),o.push(p),s.push(m),h!==0)switch(c.push(h),e){case`mc_audio`:case`ss_audio`:n.push(h);break;case`mc_video`:case`ss_video`:r.push(h);break}g!==0&&l.push(g)}for(let e of f)for(let n of B)if(e.getTrack(n)){let{trackReport:r}=e.tracksAnalysis.sfu.recvs[n],{offsetBytesSent:u,lostRate:d,roundTripTime:f,jitter:p,quality:m,averageQuality:h,averageOffsetBytesSent:g}=r;this.base.traffic.sfu.inboundBytes+=u,t.sfu.velocityPull+=g,a.push(d),o.push(f),s.push(p),m!==0&&(c.push(m),i.push(m)),h!==0&&l.push(h)}t.elapsed=new Date().getTime()-u,t.elapsed>1e3&&Date.now()-this._lastTrackAnalysisWarnTime>30*1e3&&(this._lastTrackAnalysisWarnTime=Date.now(),console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: generateTrackAnalysis taking too much time.`,{elapsed:t.elapsed})),t.sfu.lostRate=e._maxInNumberArray(a),t.sfu.roundTripTime=e._maxInNumberArray(o),t.sfu.jitter=e._maxInNumberArray(s),t.sfu.quality=c.length===0?0:e._minInNumberArray(c),t.sfu.averageQuality=l.length===0?0:e._minInNumberArray(l)}{let a=[0],o=[0],s=[0],c=[],l=[],u=this.base.users.remoteUsers.values();for(let e of u)for(let u of B)if(e.p2p){{let{trackReport:i}=e.tracksAnalysis.p2p.sends[u],{offsetBytesSent:d,lostRate:f,roundTripTime:p,jitter:m,quality:h,averageQuality:g,averageOffsetBytesSent:_}=i;if(this.base.traffic.p2p.outboundBytes+=d,t.p2p.velocityPush+=_,a.push(f),o.push(p),s.push(m),h!==0)switch(c.push(h),u){case`mc_audio`:case`ss_audio`:n.push(h);break;case`mc_video`:case`ss_video`:r.push(h);break}g!==0&&l.push(g)}{let{trackReport:n}=e.tracksAnalysis.p2p.recvs[u],{offsetBytesSent:r,lostRate:d,roundTripTime:f,jitter:p,quality:m,averageQuality:h,averageOffsetBytesSent:g}=n;this.base.traffic.p2p.inboundBytes+=r,t.p2p.velocityPull+=g,a.push(d),o.push(f),s.push(p),m!==0&&(c.push(m),i.push(m)),h!==0&&l.push(h)}}t.p2p.lostRate=e._maxInNumberArray(a),t.p2p.roundTripTime=e._maxInNumberArray(o),t.p2p.jitter=e._maxInNumberArray(s),t.p2p.quality=c.length===0?0:e._minInNumberArray(c),t.p2p.averageQuality=l.length===0?0:e._minInNumberArray(l)}{let e=this.base.traffic.getUse();t.sfu.outboundBytes=e.sfu.outboundBytes,t.sfu.inboundBytes=e.sfu.inboundBytes,t.p2p.outboundBytes=e.p2p.outboundBytes,t.p2p.inboundBytes=e.p2p.inboundBytes}this.base.config.network=t,this.base.notifys.emit(`onRoomNetwork`,{code:200,data:t,desc:`RoomNetwork is change.`});{let e=this.base.users.localUser,t=n.length===0?0:Math.round(n.reduce((e,t)=>e+t)/n.length),a=r.length===0?0:Math.round(r.reduce((e,t)=>e+t)/r.length),o=t!==0&&a!==0?Math.round((t*6+a*4)/10):t||a,s=i.length===0?0:Math.round(i.reduce((e,t)=>e+t)/i.length);if(e.updateNetwork({egress:o,ingress:s})===!1){let t=new Date().getTime();t-this._lastUpdateNetworkTime>=3e3&&(this._lastUpdateNetworkTime=t,await this.base.cws.createRequest(`networkQualityChange`,{onBack:!1}).send({data:{egress:o,ingress:s,userId:e.id,roomId:this.base.config.roomId}})),this.base.users.emitUsersChange()}}this._emitSelfNetworkQualityChange().catch(e=>{this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [_emitSelfNetworkQualityChange]`,e)});try{await this._checkAndSelectUserStreamOrigin()}catch(e){this.base.config.debug===!0&&console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [_checkAndSelectUserStreamOrigin]`,e)}}finally{this._networkCalculating=!1}}};_checkAndSelectUserStreamOrigin=async()=>{if(this.base.hasAsyncTask(`subscribe`)||this.base.hasAsyncTask(`publish`)||this.base.hasAsyncTask(`closeTrack`))return;let e=this.base.config.network.sfu.averageQuality,t=this.base.users.remoteUsers.values(),n=[],r=[],i=new Date().getTime();for(let a of t){let t=a.p2p;if(!t)continue;let o=[];for(let n of B){if(!t.hasRecvier(n))continue;let s=t.checkReceActive(n);if(!s)continue;let c=a.getTrack(n);if(!c){t.activeRecv[n]&&t.setRecvTracksEnabled([n],!1);continue}let{averageQuality:l,availableScore:u}=a.tracksAnalysis.p2p.recvs[n]?.trackReport,d=this.base._checkUserStreamOrigin({p2pAverageQuality:l,sfuAverageQuality:e});c.origin===`p2p`&&[`mc_video`,`ss_video`].includes(n)&&i-s>=1e4&&u<.6&&(d=`sfu`,this.base.config.debug===!0&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: Switching to SFU. availableScore: ${u}`,{remoteUserId:a.id,mediaType:n,availableScore:u})),d!==c.origin&&(d===`p2p`?(c.origin===`sfu`&&r.push(c),a.useRemoteP2PStream([n])):(a.usePhoneyStream([n],!1),o.push(n)))}o.length!==0&&(this.base._reportP2PConnect(`disconnect`,{desc:`Poor quality of P2P. `,pushId:a.id,pullId:this.base.config.userId,mediaTypes:o}),n.push({userId:a.id,mediaTypes:o}))}if(r.length!==0&&await this._closeTrack(r).catch(()=>{}),n.length!==0){await this.subscribe(n);for(let e of n){let{userId:t,mediaTypes:n}=e;try{this.base.users.getRemoteUserContent(t)?.p2p?.setRecvTracksEnabled(n,!1)}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [_checkAndSelectUserStreamOrigin]`,e)}}}r.length!==0&&n.length===0&&this.base.users.emitUsersChange()};_syncRoomInfo=async()=>(await this.base.peer.waitings.peerConnected(),this._syncRoomInfoTask.state===`waiting`?this._syncRoomInfoTask.promise:this._syncRoomInfoTask.exe(async()=>{let e=this.base.users.localUser,{id:t,callAction:n}=e,r=this.base.users.getP2PState(),{code:i=0,desc:a,data:o}=await this.base.cws.createRequest(`syncRoomInfo`).send({data:{user:{id:t,callAction:n},p2pState:r}});if(i!==200)throw Error(a);if(!o)throw Error(`No sync room data.`);if(o.isActive===!1)throw Error(`Do not stay in this room.`);let s=o.users||[];if((s.find(t=>t.id===e.id)||!1)===!1)throw Error(`Need to rejoin the room.`);return this.base.users.initUsers(s,!1),this._autoCheckSubscribe(),!0}));_restorePeer=async()=>{if(this.base.config.isInRoom!==!1)return this._restorePeerTask.state===`waiting`?this._restorePeerTask.promise:this._restorePeerTask.exe(async()=>{this.base.config.debug&&console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [restorePeer]`);let e=this.base.peer.getBroadcasted(B);this.base.peer.close(),this.base.cws.isValid()===!0&&await this._connectCF(0).catch(()=>{}),await this._connectCFByHttp(0).catch(()=>{}),this.base.cws.waitings.cwsConnected(),await this._connectCF(0);let t=this.base.users.remoteUsers.values();for(let e of t)e.p2p?.setSendTracksEnabled(B,!1,`local`),e.p2p?.setRecvTracksEnabled(B,!1),e.usePhoneyStream(B);return await this._restorePublish(e),this._autoCheckSubscribe(),!0})};_pubChannel=async()=>new Promise(async(e,t)=>{try{let t=this.base.cws.createRequest(`pubChannel`),n=this.base.peer.channels.get(this.base.config.userId)?.id||-1,{code:r=0,desc:i,data:a}=await t.send({data:{session:this.base.config.callSession,channels:[{dataChannelName:`dc_${this.base.users.localUser.id}`,id:n}]}});if(r!==200)throw Error(i);{let{channels:e}=a.channels[0],[t]=e,{id:r}=t;this.base.users.localUser.updateChannels(e),n===-1&&this.base.peer.addLocalUserChannel(r)}e(!0)}catch(e){console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: _pubChannel`,e),t(e)}});_closeChannel=e=>new Promise(async(t,n)=>{try{let n=this.base.peer.clearChannels(e);if(n.length===0)return;let{code:r=0,desc:i}=await this.base.cws.createRequest(`closeChannel`).send({data:{session:this.base.config.callSession,users:n}});if(r!==200)throw Error(i);t(!0)}catch(e){console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: error`,e),n(e)}});_checkAndSubChannel=async()=>new Promise(async(e,t)=>{try{let t=this.base.users.remoteUsers.values(),n=[];for(let e of t){let{id:t,channels:r}=e,[i]=r;if(!i)continue;let a=this.base.peer.channels.get(t);a&&a.readyState===`open`||n.push({userId:t,channels:r})}if(n.length===0)return;let{code:r=0,desc:i,data:a}=await this.base.cws.createRequest(`subChannel`).send({data:{session:this.base.config.callSession,users:n}});if(r!==200)throw Error(i);let{channels:o}=a;for(let e of o){let{userId:t,channels:n}=e,[r]=n,{id:i}=r;this.base.peer.addRemoteUserChannel(t,i)}e(!0)}catch(e){console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: error`,e),t(e)}});_emitSelfNetworkQualityChange=async()=>{if(this.base.config.isInRoom!==!0||this.base.peer.pc.connectionState!==`connected`)return;let e=this.base.users.localUser,t=[],n=[],r=[];for(let i of B){if(!e.published[i]||!e.getTrack(i))continue;let{trackReport:a}=e.tracksAnalysis.sfu.sends[i],{averageOffsetBytesSent:o,jitter:s,lostRate:c,quality:l,roundTripTime:u}=a,d=Math.ceil(o*100/1024)/100;t.push({type:Wi(i),bandwidth:d,jitter:s,packetsLost:BigInt(0),packetsLostRate:c}),l>0&&n.push(l),u>0&&r.push(u)}if(t.length===0)return;let i=n.length>0?n.reduce((e,t)=>e+t,0)/n.length:e.network.egress,a=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0,o={userId:e.id,statsTime:BigInt(Date.now()),roundTripTime:a,upQualityScore:i,downQualityScore:e.network.ingress,stats:t};try{await this.base.peer.localChannelSend(o)}catch{this._submitRtcStats(o).catch(()=>{})}return o};_restoreRoom=async()=>{try{this.base.cws.close(),this._restorePeer().catch(()=>{}),await this._connectCws(),await this._syncRoomInfo()}catch(e){console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [RestoreRoom is error.]`,e)}}};function sf(e){return e.map(e=>Sn(wi,{sdpMid:e.sdpMid??``,sdpMLineIndex:e.sdpMLineIndex??0,sdp:e.candidate??``}))}var cf=class{base;_p2pCheckTimeoutMap=new Map;constructor({base:e}){this.base=e,this.base.cws.on.onOffer=e=>{this.base.hasAsyncTask(`subscribe`)||this._onOffer(e)},this.base.cws.on.onCandidate=e=>{this.base.hasAsyncTask(`subscribe`)||this._onCandidate(e)},this.base.cws.on.onAttemptP2PEx=e=>{if(this.base.hasAsyncTask(`subscribe`))return;let{roomId:t,pushId:n,types:r=[],isRemotePush:i=!1}=e.data;if(r.length===0){this.base.config.debug&&console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [onAttemptP2PEx] There is an error. types.length === 0`,e);return}if(this.base.config.roomId!==t){this.base.config.debug&&console.error(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [onAttemptP2PEx] There is an error. roomId is inequality.`,e);return}let a=Array.from(r,e=>B[e]);a.length!==0&&this._openP2P(n,a,i)},this.base.cws.on.onDisconnectedP2P=e=>{let{roomId:t,remoteUserId:n}=e.data;if(t!==this.base.config.roomId)return;let r=this.base.users.getRemoteUserContent(n);!r||!r.p2p||r.p2p.checkActive()===!1&&r.p2p.close()}}_openP2P=async(e,t,n)=>{if(this.base.hasAsyncTask(`subscribe`)||t.length===0)return;let{useP2P:r,roomId:i,userId:a}=this.base.config;if(r===!1)throw Error(`You have disabled the p2p function on the client side.`);try{let r=this.base.users.localUser,o=new Date().getTime(),s=this.base.users.getRemoteUserContent(e);if(!s)throw Error(`The remote user to be established does not exist.`);let c=this._getRemoteUserP2PContent(e,!0),{prohibited_mediaTypes:l=[],subscribed_mediaTypes:u=[]}=s.checkSubscribed(t);if(n===!0&&l.length!==0&&(this.base._reportP2PConnect(`ignore`,{desc:`P2P connections without a subscription relationship are not allowed.`,pullId:a,pushId:e,mediaTypes:l}),u.length===0))return;this.base.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [${e}]: start connect p2p.`,{isRemotePush:n}),n===!1?(c.close(),c.init()):c.pc?.connectionState!==`connected`&&c.init();let d=c.initRecvs(u);if(d.length!==0){let t=()=>{let t=async()=>{let t=await c.createOffer(),n=c.getRecvUserTracksAsRoomTrack(u),{code:o=0,desc:s}=await this.base.cws.createRequest(`offer`).send({data:{roomId:i,tracks:n,sender:{id:a,callAction:r.callAction},receiverId:e,sdp:t.sdp??``}});if(o!==200)throw Error(s)};return le(()=>new Promise(n=>{this.base.cws.on.onAnswer=t=>{let{code:r,data:i}=t;if(r!==200||!i)return;let{sender:a,sdp:o,tracks:s=[]}=i,c=a?.id;c!==void 0&&e===c&&n({answer:{type:`answer`,sdp:o},tracks:s})},t()}),{message:`await_answer is timeout.`,timeout:20*1e3})},n=async()=>{let t=sf(await le(c.getIcecandidates,{message:`get recv candidates is timeout.`,timeout:10*1e3})),{code:n=0,desc:r}=await this.base.cws.createRequest(`candidate`,{timeout:1e3*10}).send({data:{roomId:i,senderId:a,receiverId:e,candidates:t,isSubscribeReceiver:!0}});if(n!==200)throw Error(r)};{let{answer:e,tracks:r=[]}=await t();await c.setAnswer(e),await n();let i=[],a=[];for(let e of r){let{type:t,mid:n}=e;if(t===void 0)continue;let r=B[t];a.push(r),i.push({mediaType:r,mid:n,enabled:!1})}c.initSenders(i),c.setSendTracksEnabled(d,!1,`local`)}}await le(c.waitings.connected,{message:`ice connect is timeout.`,timeout:10*1e3}),await le(c.waitings.remoteChannelConnected,{message:`remote_channel connect is timeout.`,timeout:10*1e3}),n===!0&&c.setRecvTracksEnabled(u,!0);let f=`${new Date().getTime()-o}`;n===!0?await this.base._reportP2PConnect(`success`,{action:3,desc:`P2P connection successful.`,pullId:a,pushId:e,mediaTypes:u,connectedTime:f}):await this.base._reportP2PConnect(`success`,{action:2,desc:`P2P connection successful.`,pullId:e,pushId:a,mediaTypes:t,connectedTime:f}),this.base.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [${e}]: switch to P2P will be attempted within 10 seconds.`);{let t=this._p2pCheckTimeoutMap.get(e);t&&clearTimeout(t);let n=window.setTimeout(()=>{this._p2pCheckTimeoutMap.delete(e);let t=[],n=this.base.users.getRemoteUserContent(e);if(!(!n||!n.p2p)){for(let e of u){let r=n.p2p.activeRecv[e]||!1,i=n.getTrack(e);r&&i?.origin!==`p2p`&&t.push(e)}t.length!==0&&(n.p2p.setRecvTracksEnabled(t,!1),this.base._reportP2PConnect(`disconnect`,{desc:`Poor quality of P2P.`,pushId:n.id,pullId:this.base.config.userId,mediaTypes:t}))}},1e3*10);this._p2pCheckTimeoutMap.set(e,n)}}catch(r){this.base.users.getRemoteUserContent(e)?.p2p?.destroy(),this.base.config.debug&&console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [p2p]: onOpen p2p with ${e} is error.`,r),n===!0?await this.base._reportP2PConnect(`fail`,{action:0,desc:r.message||r,pullId:a,pushId:e,mediaTypes:t}):await this.base._reportP2PConnect(`fail`,{action:1,desc:r.message||r,pullId:e,pushId:a,mediaTypes:t})}};_onOffer=async e=>{let{code:t,data:n}=e;if(t!==200||!n)return;let{sdp:r,sender:i,tracks:a=[]}=n,o=i?.id;if(!o)return;let{userId:s,roomId:c}=this.base.config,l=this.base.users.localUser;try{let e=this.base.users.getrP2PConnectedCount(),t=[],n=[];for(let e of a){let{type:r,mid:i}=e;if(r===void 0)continue;let a=B[r];t.push(a),n.push({mediaType:a,mid:i,enabled:!1})}if(e+t.length>3){if(t.length===2){let e=t.findIndex(e=>e===`ss_video`);t.splice(e,1),await this.base._reportP2PConnect(`ignore`,{desc:`P2P connections have reached the maximum limit.`,pushId:s,pullId:o,mediaTypes:[`ss_video`]})}if(t.length===1){await this.base._reportP2PConnect(`ignore`,{desc:`P2P connections have reached the maximum limit.`,pushId:s,pullId:o,mediaTypes:t});return}}let i=this._getRemoteUserP2PContent(o,!0);this.base.config.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [${o}]: start connect p2p.`),i.pc?.connectionState!==`connected`&&i.init(),await i.setOffer({type:`offer`,sdp:r});{let e=i.initSenders(n);i.setSendTracksEnabled(e,!1,`local`)}let u=await i.createAnswer(),d=i.getSenderUserTracksAsRoomTrack(t);await(async()=>{let{code:e=0,desc:t}=await this.base.cws.createRequest(`answer`).send({data:{roomId:c,tracks:d,sender:{id:l.id,callAction:l.callAction},receiverId:o,sdp:u.sdp??``}});if(e!==200)throw Error(t)})(),await new Promise(e=>setTimeout(()=>e(!0),1e3)),await(async()=>{let e=sf(await le(i.getIcecandidates,{message:`get send candidates is timeout.`,timeout:10*1e3})),{code:t=0,desc:n}=await this.base.cws.createRequest(`candidate`).send({data:{roomId:c,senderId:l.id,receiverId:o,candidates:e,isSubscribeReceiver:!1}});if(t!==200)throw Error(n)})(),await le(i.waitings.connected,{message:`ice connect is timeout.`,timeout:20*1e3})}catch(e){this.base.config.debug&&console.info(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: [p2p]: onReply p2p with ${o} is error.`,e)}};_onCandidate=async e=>{let{code:t,data:n}=e;if(t!==200)return;let{senderId:r,candidates:i=[],receiverId:a,isSubscribeReceiver:o=!1}=n,{userId:s}=this.base.config;if(o===!1||a!==s)return;let c=this.base.users.getRemoteUserContent(r);if(!c||!c.p2p){console.warn(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->quickvo: An error occurred in onCandidate.`,c);return}let l=Array.from(i,({sdpMid:e,sdpMLineIndex:t,sdp:n})=>({sdpMid:e,sdpMLineIndex:t,candidate:n}));await c.p2p.addCandidates(l)};_getRemoteUserP2PContent=(e,t)=>{let n=this.base.users.getRemoteUserContent(e);if(!n)throw Error(`The remote user to be established does not exist.`);if(t===!0&&(n.p2p||this.base.users.createRemoteUserP2P(e)),!n.p2p)throw Error(`The remote user p2p to be established does not exist.`);return n.p2p};destroy=()=>{for(let e of this._p2pCheckTimeoutMap.values())clearTimeout(e);this._p2pCheckTimeoutMap.clear()}},lf=`1.7.10`,uf=class{static version=lf;_base=new $d;_ACTION_BASE=new ef({base:this._base});_ACTION_SFU=new of({base:this._base});_ACTION_P2P=new cf({base:this._base});constructor(e){xd(),console.info(`[QuickVO] version is ${lf}`),this._base.config.setOptions(e)}recorder=this._base.recorder;use=this._base.use;setCallStrategy=this._base.setCallStrategy;addNotify=this._base.notifys.add;setOptions=this._base.config.setOptions;getLocalStream=this._base.users.localUser.getStream;getLocalStreams=this._base.users.localUser.getStreams;setActiveNoise=this._base.users.localUser.setActiveNoise;hasPermissions=this._base.users.localUser.hasPermissions;getUserContent=this._base.users.getUserContent;getUserStream=this._base.users.getUserStream;getVolume=this._base.users.getVolume;getMaxVolumeUser=this._base.users.getMaxVolumeUser;setInputVolume=this._base.users.setInputVolume;setEnhanceGain=this._base.users.setEnhanceGain;setSpeakerVolume=this._base.users.setSpeakerVolume;getUserAudioMediaStreamContext=this._base.users.getUserAudioMediaStreamContext;playBgs=this._base.users.playBgs;changBgsMix=this._base.users.changBgsMix;stopBgs=this._base.users.stopBgs;setBgsGain=this._base.users.setBgsGain;playBgm=this._base.users.playBgm;changBgmMix=this._base.users.changBgmMix;stopBgm=this._base.users.stopBgm;setBgmGain=this._base.users.setBgmGain;getEnumerateDevices=this._base.localMedias.getEnumerateDevices;getMediaDeviceKind=this._base.localMedias.getMediaDeviceKind;getMediaDevicesErrInfo=this._base.localMedias.getMediaDevicesErrInfo;setLocalStream=this._ACTION_SFU.setLocalStream;setMediaDeviceKind=this._ACTION_SFU.setMediaDeviceKind;setMediaTrackConstraints=this._ACTION_SFU.setMediaTrackConstraints;joinRoom=this._ACTION_SFU.joinRoom;publish=this._ACTION_SFU.publish;stopPublish=this._ACTION_SFU.stopPublish;subscribe=this._ACTION_SFU.subscribe;stopSubscribe=this._ACTION_SFU.stopSubscribe;setBehaviors=this._ACTION_SFU.setBehaviors;updateSimulcast=this._ACTION_SFU.updateSimulcast;toggleRoomSpeechLang=this._ACTION_SFU.toggleRoomSpeechLang;updateToken=this._ACTION_SFU.updateToken;quitRoom=this._ACTION_SFU.quitRoom;destroy=async()=>{this._base.users.localUser.clear(),this._base.users.localUser.destroy(),this._ACTION_P2P.destroy(),await this._ACTION_SFU.destroy(),this._base.cws.workerProtos.destroy(),bd()};addRequestAnimationFrame=this._base.animationFrame.addRequestAnimationFrame;clearRequestAnimationFrame=this._base.animationFrame.clearRequestAnimationFrame;getLocalUserTrackReports=this._base.users.getLocalUserTrackReports;getRemoteUserTrackReports=this._base.users.getRemoteUserTrackReports;getRoomAction=this._base.config.getRoomAction;_openP2P=this._ACTION_P2P._openP2P;_restoreRoom=this._ACTION_SFU._restoreRoom;_debugger=this._ACTION_BASE._debugger;_ai=this._ACTION_BASE._ai},df={qualityPriority:`画质优先`,fluencyPriority:`流畅度优先`,balancedDowngrade:`均衡降级`},ff=O(df),pf=Object.keys(df),mf=Object.values(df),hf={heartbeat:`心跳`,heartbeatEx:`慢心跳`,ackMsg:`确认收到消息`,reportNetwork:`上报网络类型`,connectCF:`连接CF`,genTurnAddress:`获取TURN地址`,publish:`发布流`,joinRoom:`加入房间`,joinRoomEx:`加入房间(提前建连)`,pubNotify:`广播已发布的轨道`,subscribe:`订阅流`,pubChannel:`发布DataChannel`,subChannel:`订阅DataChannel`,closeChannel:`关闭DataChannel`,renegotiate:`协商流`,closeTrack:`关闭轨道`,preventUsersBehavior:`阻止用户行为`,networkQualityChange:`更新网络状态`,updateCall:`更新通话状态`,updateSimulcast:`切换大小流`,toggleRoomSpeechLang:`切换房间语音识别`,syncRoomInfo:`同步房间`,updateRoomToken:`更新房间SDKTOKEN`,offer:`发送P2P-offer`,answer:`回应P2P-answer`,candidate:`发送P2P候选信息-candidate`,reportP2PConnectEx:`上报P2P连接结果`,quitRoom:`退出房间`,quitRoomEx:`退出房间不断开连接`,debugger:`调试`,ai:`WorkerAi调试`,UpdateTrackActive:`p2p轨道状态`,rtcStats:`客户端rtc网络质量`,RtcStats:`客户端rtc网络质量`},gf=O(hf),_f=Object.keys(hf),vf=Object.values(hf),yf={0:`未知`,1:`极差`,2:`较差`,3:`一般`,4:`很好`,5:`极好`},bf=O(yf),xf=Object.keys(yf),Sf=Object.values(yf),Cf={ready:`已就绪`,connecting:`连接中`,connected:`已连接`,reconnect:`正在重新连接`,disconnected:`已断开`,closed:`已关闭`},wf=O(Cf),Tf=Object.keys(Cf),Ef=Object.values(Cf),Df={0:`麦克风-默认轨道`,1:`摄像头-默认轨道`,2:`屏幕共享-视频轨道`,3:`屏幕共享-音频轨道`},Of=O(Df),kf=Object.keys(Df),Af=Object.values(Df);e.QuickVO=uf,e.callStrategy_keys=pf,e.callStrategy_options=ff,e.callStrategy_vals=mf,e.enum_callStrategy=df,e.enum_eventName=hf,e.enum_mediaType=Vi,e.enum_notifyName=Au,e.enum_quality=yf,e.enum_roomState=Cf,e.enum_trackType=Df,e.eventName_keys=_f,e.eventName_options=gf,e.eventName_vals=vf,e.mediaTypeToProtoTrackType=Wi,e.mediaType_keys=B,e.mediaType_options=Hi,e.mediaType_vals=Ui,e.notifyName_keys=Mu,e.notifyName_options=ju,e.notifyName_vals=Nu,e.quality_keys=xf,e.quality_options=bf,e.quality_vals=Sf,e.roomState_keys=Tf,e.roomState_options=wf,e.roomState_vals=Ef,Object.defineProperty(e,`tools`,{enumerable:!0,get:function(){return d}}),e.trackType_keys=kf,e.trackType_options=Of,e.trackType_vals=Af});
|