UNPKG

livekit-client

Version:

JavaScript/TypeScript client SDK for LiveKit

1 lines 515 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LivekitClient={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var n=Object.defineProperty,i=(e,t,i)=>((e,t,i)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i);class s{constructor(){i(this,"_locking"),i(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){let e;this._locks+=1;const t=new Promise((t=>e=()=>{this._locks-=1,t()})),n=this._locking.then((()=>e));return this._locking=this._locking.then((()=>t)),n}}function r(e,t){if(!e)throw new Error(t)}const a=34028234663852886e22,o=-34028234663852886e22,c=4294967295,d=2147483647,l=-2147483648;function u(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>d||e<l)throw new Error("invalid int 32: "+e)}function h(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>c||e<0)throw new Error("invalid uint 32: "+e)}function p(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>a||e<o))throw new Error("invalid float 32: "+e)}const m=Symbol("@bufbuild/protobuf/enum-type");function g(e){const t=e[m];return r(t,"missing enum type on enum object"),t}function v(e,t,n,i){e[m]=f(t,n.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))))}function f(e,t,n){const i=Object.create(null),s=Object.create(null),r=[];for(const e of t){const t=b(e);r.push(t),i[e.name]=t,s[e.no]=t}return{typeName:e,values:r,findName:e=>i[e],findNumber:e=>s[e]}}function k(e,t,n){const i={};for(const e of t){const t=b(e);i[t.localName]=t.no,i[t.no]=t.localName}return v(i,e,t),i}function b(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class y{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType().runtime.bin,i=n.makeReadOptions(t);return n.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,t){const n=this.getType(),i=n.runtime.json,s=i.makeReadOptions(t);return i.readMessage(n,e,s,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(e instanceof Error?e.message:String(e)))}return this.fromJson(n,t)}toBinary(e){const t=this.getType().runtime.bin,n=t.makeWriteOptions(e),i=n.writerFactory();return t.writeMessage(this,i,n),i.finish()}toJson(e){const t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function T(){let e=0,t=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(e|=(127&i)<<n,0==(128&i))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,0==(128&n))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(t|=(127&i)<<n,0==(128&i))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function S(e,t,n){for(let i=0;i<28;i+=7){const s=e>>>i,r=!(s>>>7==0&&0==t),a=255&(r?128|s:s);if(n.push(a),!r)return}const i=e>>>28&15|(7&t)<<4,s=!(t>>3==0);if(n.push(255&(s?128|i:i)),s){for(let e=3;e<31;e+=7){const i=t>>>e,s=!(i>>>7==0),r=255&(s?128|i:i);if(n.push(r),!s)return}n.push(t>>>31&1)}}const C=4294967296;function E(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let i=0,s=0;function r(t,r){const a=Number(e.slice(t,r));s*=n,i=i*n+a,i>=C&&(s+=i/C|0,i%=C)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),t?P(i,s):R(i,s)}function w(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(C*t+e);const n=16777215&(e>>>24|t<<8),i=t>>16&65535;let s=(16777215&e)+6777216*n+6710656*i,r=n+8147497*i,a=2*i;const o=1e7;return s>=o&&(r+=Math.floor(s/o),s%=o),r>=o&&(a+=Math.floor(r/o),r%=o),a.toString()+I(r)+I(s)}function R(e,t){return{lo:0|e,hi:0|t}}function P(e,t){return t=~t,e?e=1+~e:t+=1,R(e,t)}const I=e=>{const t=String(e);return"0000000".slice(t.length)+t};function D(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function O(){let e=this.buf[this.pos++],t=127&e;if(0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,0==(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;0!=(128&e)&&t<10;t++)e=this.buf[this.pos++];if(0!=(128&e))throw new Error("invalid varint");return this.assertBounds(),t>>>0}const _=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const i="bigint"==typeof e?e:BigInt(e);if(i>n||i<t)throw new Error("int64 invalid: ".concat(e));return i},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>s||t<i)throw new Error("uint64 invalid: ".concat(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)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}const t=e=>r(/^-?[0-9]+$/.test(e),"int64 invalid: ".concat(e)),n=e=>r(/^[0-9]+$/.test(e),"uint64 invalid: ".concat(e));return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),n(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),E(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),E(e)),dec:(e,t)=>function(e,t){let n=R(e,t);const i=2147483648&n.hi;i&&(n=P(n.lo,n.hi));const s=w(n.lo,n.hi);return i?"-"+s:s}(e,t),uDec:(e,t)=>w(e,t)}}();var M,x,A;function N(e,t,n){if(t===n)return!0;if(e==M.BYTES){if(!(t instanceof Uint8Array&&n instanceof Uint8Array))return!1;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case M.UINT64:case M.FIXED64:case M.INT64:case M.SFIXED64:case M.SINT64:return t==n}return!1}function L(e,t){switch(e){case M.BOOL:return!1;case M.UINT64:case M.FIXED64:case M.INT64:case M.SFIXED64:case M.SINT64:return 0==t?_.zero:"0";case M.DOUBLE:case M.FLOAT:return 0;case M.BYTES:return new Uint8Array(0);case M.STRING:return"";default:return 0}}function U(e,t){switch(e){case M.BOOL:return!1===t;case M.STRING:return""===t;case M.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}!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"}(M||(M={})),function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"}(x||(x={})),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"}(A||(A={}));class F{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(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 new 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(h(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return u(e),D(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){p(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){h(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){u(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return u(e),D(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=_.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=_.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=_.enc(e);return S(t.lo,t.hi,this.buf),this}sint64(e){let t=_.enc(e),n=t.hi>>31;return S(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=_.uEnc(e);return S(t.lo,t.hi,this.buf),this}}class j{constructor(e,t){this.varint64=T,this.uint32=O,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case A.Varint:for(;128&this.buf[this.pos++];);break;case A.Bit64:this.pos+=4;case A.Bit32:this.pos+=4;break;case A.LengthDelimited:let n=this.uint32();this.pos+=n;break;case A.StartGroup:for(;;){const[e,n]=this.tag();if(n===A.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return _.dec(...this.varint64())}uint64(){return _.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,_.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return _.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return _.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.textDecoder.decode(this.bytes())}}function B(e){const t=e.field.localName,n=Object.create(null);return n[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return L(t.T,t.L);case"message":const e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}(e),[n,()=>n[t]]}let q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),V=[];for(let e=0;e<q.length;e++)V[q[e].charCodeAt(0)]=e;V["-".charCodeAt(0)]=q.indexOf("+"),V["_".charCodeAt(0)]=q.indexOf("/");const H={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let n,i=new Uint8Array(t),s=0,r=0,a=0;for(let t=0;t<e.length;t++){if(n=V[e.charCodeAt(t)],void 0===n)switch(e[t]){case"=":r=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:a=n,r=1;break;case 1:i[s++]=a<<2|(48&n)>>4,a=n,r=2;break;case 2:i[s++]=(15&a)<<4|(60&n)>>2,a=n,r=3;break;case 3:i[s++]=(3&a)<<6|n,r=0}}if(1==r)throw Error("invalid base64 string.");return i.subarray(0,s)},enc(e){let t,n="",i=0,s=0;for(let r=0;r<e.length;r++)switch(t=e[r],i){case 0:n+=q[t>>2],s=(3&t)<<4,i=1;break;case 1:n+=q[s|t>>4],s=(15&t)<<2,i=2;break;case 2:n+=q[s|t>>6],n+=q[63&t],i=0}return i&&(n+=q[s],n+="=",1==i&&(n+="=")),n}};function W(e,t,n){G(t,e);const i=t.runtime.bin.makeReadOptions(n),s=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter((e=>e.no===t.no))}(e.getType().runtime.bin.listUnknownFields(e),t.field),[r,a]=B(t);for(const e of s)t.runtime.bin.readField(r,i.readerFactory(e.data),t.field,e.wireType,i);return a()}function K(e,t,n,i){G(t,e);const s=t.runtime.bin.makeReadOptions(i),r=t.runtime.bin.makeWriteOptions(i);if(z(e,t)){const n=e.getType().runtime.bin.listUnknownFields(e).filter((e=>e.no!=t.field.no));e.getType().runtime.bin.discardUnknownFields(e);for(const t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const a=r.writerFactory();let o=t.field;o.opt||o.repeated||"enum"!=o.kind&&"scalar"!=o.kind||(o=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(o,n,a,r);const c=s.readerFactory(a.finish());for(;c.pos<c.len;){const[t,n]=c.tag(),i=c.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,i)}}function z(e,t){const n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find((e=>e.no==t.field.no))}function G(e,t){r(e.extendee.typeName==t.getType().typeName,"extension ".concat(e.typeName," can only be applied to message ").concat(e.extendee.typeName))}function J(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[n]:"enum"==e.kind?t[n]!==e.T.values[0].no:!U(e.T,t[n]);case"message":return void 0!==t[n];case"map":return Object.keys(t[n]).length>0}}function Q(e,t){const n=e.localName,i=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=i?e.T.values[0].no:void 0;break;case"scalar":t[n]=i?L(e.T,e.L):void 0;break;case"message":t[n]=void 0}}function Y(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(y.prototype).every((t=>t in e&&"function"==typeof e[t])))return!1;const n=e.getType();return null!==n&&"function"==typeof n&&"typeName"in n&&"string"==typeof n.typeName&&(void 0===t||n.typeName==t.typeName)}function X(e,t){return Y(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}M.DOUBLE,M.FLOAT,M.INT64,M.UINT64,M.INT32,M.UINT32,M.BOOL,M.STRING,M.BYTES;const Z={ignoreUnknownFields:!1},$={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function ee(e){return e?Object.assign(Object.assign({},Z),e):Z}function te(e){return e?Object.assign(Object.assign({},$),e):$}const ne=Symbol(),ie=Symbol();function se(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":'"'.concat(e.split('"').join('\\"'),'"');default:return String(e)}}function re(e,t,n,i,s){let a=n.localName;if(n.repeated){if(r("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(s.typeName,".").concat(n.name," from JSON: ").concat(se(t)));const o=e[a];for(const e of t){if(null===e)throw new Error("cannot decode field ".concat(s.typeName,".").concat(n.name," from JSON: ").concat(se(e)));switch(n.kind){case"message":o.push(n.T.fromJson(e,i));break;case"enum":const t=ce(n.T,e,i.ignoreUnknownFields,!0);t!==ie&&o.push(t);break;case"scalar":try{o.push(oe(n.T,e,n.L,!0))}catch(t){let i="cannot decode field ".concat(s.typeName,".").concat(n.name," from JSON: ").concat(se(e));throw t instanceof Error&&t.message.length>0&&(i+=": ".concat(t.message)),new Error(i)}}}}else if("map"==n.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(s.typeName,".").concat(n.name," from JSON: ").concat(se(t)));const r=e[a];for(const[e,a]of Object.entries(t)){if(null===a)throw new Error("cannot decode field ".concat(s.typeName,".").concat(n.name," from JSON: map value null"));let o;try{o=ae(n.K,e)}catch(e){let i="cannot decode map key for field ".concat(s.typeName,".").concat(n.name," from JSON: ").concat(se(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}switch(n.V.kind){case"message":r[o]=n.V.T.fromJson(a,i);break;case"enum":const e=ce(n.V.T,a,i.ignoreUnknownFields,!0);e!==ie&&(r[o]=e);break;case"scalar":try{r[o]=oe(n.V.T,a,x.BIGINT,!0)}catch(e){let i="cannot decode map value for field ".concat(s.typeName,".").concat(n.name," from JSON: ").concat(se(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":const r=n.T;if(null===t&&"google.protobuf.Value"!=r.typeName)return;let o=e[a];Y(o)?o.fromJson(t,i):(e[a]=o=r.fromJson(t,i),r.fieldWrapper&&!n.oneof&&(e[a]=r.fieldWrapper.unwrapField(o)));break;case"enum":const c=ce(n.T,t,i.ignoreUnknownFields,!1);switch(c){case ne:Q(n,e);break;case ie:break;default:e[a]=c}break;case"scalar":try{const i=oe(n.T,t,n.L,!1);if(i===ne)Q(n,e);else e[a]=i}catch(e){let i="cannot decode field ".concat(s.typeName,".").concat(n.name," from JSON: ").concat(se(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}}}function ae(e,t){if(e===M.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return oe(e,t,x.BIGINT,!0).toString()}function oe(e,t,n,i){if(null===t)return i?L(e,n):ne;switch(e){case M.DOUBLE:case M.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const i=Number(t);if(Number.isNaN(i))break;if(!Number.isFinite(i))break;return e==M.FLOAT&&p(i),i;case M.INT32:case M.FIXED32:case M.SFIXED32:case M.SINT32:case M.UINT32:let s;if("number"==typeof t?s=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(s=Number(t)),void 0===s)break;return e==M.UINT32||e==M.FIXED32?h(s):u(s),s;case M.INT64:case M.SFIXED64:case M.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const r=_.parse(t);return n?r.toString():r;case M.FIXED64:case M.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const a=_.uParse(t);return n?a.toString():a;case M.BOOL:if("boolean"!=typeof t)break;return t;case M.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(e){throw new Error("invalid UTF8")}return t;case M.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return H.dec(t)}throw new Error}function ce(e,t,n,i){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:i?e.values[0].no:ne;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const i=e.findName(t);if(void 0!==i)return i.no;if(n)return ie}throw new Error("cannot decode enum ".concat(e.typeName," from JSON: ").concat(se(t)))}function de(e){return!(!e.repeated&&"map"!=e.kind)||!e.oneof&&("message"!=e.kind&&(!e.opt&&!e.req))}function le(e,t,n){if("map"==e.kind){r("object"==typeof t&&null!=t);const i={},s=Object.entries(t);switch(e.V.kind){case"scalar":for(const[t,n]of s)i[t.toString()]=he(e.V.T,n);break;case"message":for(const[e,t]of s)i[e.toString()]=t.toJson(n);break;case"enum":const t=e.V.T;for(const[e,r]of s)i[e.toString()]=ue(t,r,n.enumAsInteger)}return n.emitDefaultValues||s.length>0?i:void 0}if(e.repeated){r(Array.isArray(t));const i=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++)i.push(he(e.T,t[n]));break;case"enum":for(let s=0;s<t.length;s++)i.push(ue(e.T,t[s],n.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)i.push(t[e].toJson(n))}return n.emitDefaultValues||i.length>0?i:void 0}switch(e.kind){case"scalar":return he(e.T,t);case"enum":return ue(e.T,t,n.enumAsInteger);case"message":return X(e.T,t).toJson(n)}}function ue(e,t,n){var i;if(r("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const s=e.findNumber(t);return null!==(i=null==s?void 0:s.name)&&void 0!==i?i:t}function he(e,t){switch(e){case M.INT32:case M.SFIXED32:case M.SINT32:case M.FIXED32:case M.UINT32:return r("number"==typeof t),t;case M.FLOAT:case M.DOUBLE:return r("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case M.STRING:return r("string"==typeof t),t;case M.BOOL:return r("boolean"==typeof t),t;case M.UINT64:case M.FIXED64:case M.INT64:case M.SFIXED64:case M.SINT64:return r("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case M.BYTES:return r(t instanceof Uint8Array),H.enc(t)}}const pe=Symbol("@bufbuild/protobuf/unknown-fields"),me={readUnknownFields:!0,readerFactory:e=>new j(e)},ge={writeUnknownFields:!0,writerFactory:()=>new F};function ve(e){return e?Object.assign(Object.assign({},me),e):me}function fe(e){return e?Object.assign(Object.assign({},ge),e):ge}function ke(e,t,n,i,s){let{repeated:r,localName:a}=n;switch(n.oneof&&((e=e[n.oneof.localName]).case!=a&&delete e.value,e.case=a,a="value"),n.kind){case"scalar":case"enum":const o="enum"==n.kind?M.INT32:n.T;let c=Te;if("scalar"==n.kind&&n.L>0&&(c=ye),r){let n=e[a];if(i==A.LengthDelimited&&o!=M.STRING&&o!=M.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,o))}else n.push(c(t,o))}else e[a]=c(t,o);break;case"message":const d=n.T;r?e[a].push(be(t,new d,s,n)):Y(e[a])?be(t,e[a],s,n):(e[a]=be(t,new d,s,n),!d.fieldWrapper||n.oneof||n.repeated||(e[a]=d.fieldWrapper.unwrapField(e[a])));break;case"map":let[l,u]=function(e,t,n){const i=t.uint32(),s=t.pos+i;let r,a;for(;t.pos<s;){const[i]=t.tag();switch(i){case 1:r=Te(t,e.K);break;case 2:switch(e.V.kind){case"scalar":a=Te(t,e.V.T);break;case"enum":a=t.int32();break;case"message":a=be(t,new e.V.T,n,void 0)}}}void 0===r&&(r=L(e.K,x.BIGINT));"string"!=typeof r&&"number"!=typeof r&&(r=r.toString());if(void 0===a)switch(e.V.kind){case"scalar":a=L(e.V.T,x.BIGINT);break;case"enum":a=e.V.T.values[0].no;break;case"message":a=new e.V.T}return[r,a]}(n,t,s);e[a][l]=u}}function be(e,t,n,i){const s=t.getType().runtime.bin,r=null==i?void 0:i.delimited;return s.readMessage(t,e,r?i.no:e.uint32(),n,r),t}function ye(e,t){const n=Te(e,t);return"bigint"==typeof n?n.toString():n}function Te(e,t){switch(t){case M.STRING:return e.string();case M.BOOL:return e.bool();case M.DOUBLE:return e.double();case M.FLOAT:return e.float();case M.INT32:return e.int32();case M.INT64:return e.int64();case M.UINT64:return e.uint64();case M.FIXED64:return e.fixed64();case M.BYTES:return e.bytes();case M.FIXED32:return e.fixed32();case M.SFIXED32:return e.sfixed32();case M.SFIXED64:return e.sfixed64();case M.SINT64:return e.sint64();case M.UINT32:return e.uint32();case M.SINT32:return e.sint32()}}function Se(e,t,n,i){r(void 0!==t);const s=e.repeated;switch(e.kind){case"scalar":case"enum":let a="enum"==e.kind?M.INT32:e.T;if(s)if(r(Array.isArray(t)),e.packed)!function(e,t,n,i){if(!i.length)return;e.tag(n,A.LengthDelimited).fork();let[,s]=Re(t);for(let t=0;t<i.length;t++)e[s](i[t]);e.join()}(n,a,e.no,t);else for(const i of t)we(n,a,e.no,i);else we(n,a,e.no,t);break;case"message":if(s){r(Array.isArray(t));for(const s of t)Ee(n,i,e,s)}else Ee(n,i,e,t);break;case"map":r("object"==typeof t&&null!=t);for(const[s,r]of Object.entries(t))Ce(n,i,e,s,r)}}function Ce(e,t,n,i,s){e.tag(n.no,A.LengthDelimited),e.fork();let a=i;switch(n.K){case M.INT32:case M.FIXED32:case M.UINT32:case M.SFIXED32:case M.SINT32:a=Number.parseInt(i);break;case M.BOOL:r("true"==i||"false"==i),a="true"==i}switch(we(e,n.K,1,a),n.V.kind){case"scalar":we(e,n.V.T,2,s);break;case"enum":we(e,M.INT32,2,s);break;case"message":r(void 0!==s),e.tag(2,A.LengthDelimited).bytes(s.toBinary(t))}e.join()}function Ee(e,t,n,i){const s=X(n.T,i);n.delimited?e.tag(n.no,A.StartGroup).raw(s.toBinary(t)).tag(n.no,A.EndGroup):e.tag(n.no,A.LengthDelimited).bytes(s.toBinary(t))}function we(e,t,n,i){r(void 0!==i);let[s,a]=Re(t);e.tag(n,s)[a](i)}function Re(e){let t=A.Varint;switch(e){case M.BYTES:case M.STRING:t=A.LengthDelimited;break;case M.DOUBLE:case M.FIXED64:case M.SFIXED64:t=A.Bit64;break;case M.FIXED32:case M.SFIXED32:case M.FLOAT:t=A.Bit32}return[t,M[e].toLowerCase()]}function Pe(e){if(void 0===e)return e;if(Y(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function Ie(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class De{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort(((e,t)=>e.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function Oe(e,t){const n=Me(e);return t?n:Ue(Le(n))}const _e=Me;function Me(e){let t=!1;const n=[];for(let i=0;i<e.length;i++){let s=e.charAt(i);switch(s){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(s),t=!1;break;default:t&&(t=!1,s=s.toUpperCase()),n.push(s)}}return n.join("")}const xe=new Set(["constructor","toString","toJSON","valueOf"]),Ae=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Ne=e=>"".concat(e,"$"),Le=e=>Ae.has(e)?Ne(e):e,Ue=e=>xe.has(e)?Ne(e):e;class Fe{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Oe(e,!1)}addField(e){r(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const je=(Be=e=>new De(e,(e=>function(e,t){var n,i,s,r,a,o;const c=[];let d;for(const t of"function"==typeof e?e():e){const e=t;if(e.localName=Oe(t.name,void 0!==t.oneof),e.jsonName=null!==(n=t.jsonName)&&void 0!==n?n:_e(t.name),e.repeated=null!==(i=t.repeated)&&void 0!==i&&i,"scalar"==t.kind&&(e.L=null!==(s=t.L)&&void 0!==s?s:x.BIGINT),e.delimited=null!==(r=t.delimited)&&void 0!==r&&r,e.req=null!==(a=t.req)&&void 0!==a&&a,e.opt=null!==(o=t.opt)&&void 0!==o&&o,void 0===t.packed&&(e.packed="enum"==t.kind||"scalar"==t.kind&&t.T!=M.BYTES&&t.T!=M.STRING),void 0!==t.oneof){const n="string"==typeof t.oneof?t.oneof:t.oneof.name;d&&d.name==n||(d=new Fe(n)),e.oneof=d,d.addField(e)}c.push(e)}return c}(e))),qe=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,i=e;if(t.repeated)i[n]=[];else switch(t.kind){case"oneof":i[n]={case:void 0};break;case"enum":i[n]=0;break;case"map":i[n]={};break;case"scalar":i[n]=L(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:ee,makeWriteOptions:te,readMessage(e,t,n,i){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(e.typeName," from JSON: ").concat(se(t)));i=null!=i?i:new e;const s=new Map,r=n.typeRegistry;for(const[a,o]of Object.entries(t)){const t=e.fields.findJsonName(a);if(t){if(t.oneof){if(null===o&&"scalar"==t.kind)continue;const n=s.get(t.oneof);if(void 0!==n)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(n,'", "').concat(a,'"'));s.set(t.oneof,a)}re(i,o,t,n,e)}else{let t=!1;if((null==r?void 0:r.findExtension)&&a.startsWith("[")&&a.endsWith("]")){const s=r.findExtension(a.substring(1,a.length-1));if(s&&s.extendee.typeName==e.typeName){t=!0;const[e,r]=B(s);re(e,o,s.field,n,s),K(i,s,r(),n)}}if(!t&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: key "').concat(a,'" is unknown'))}}return i},writeMessage(e,t){const n=e.getType(),i={};let s;try{for(s of n.fields.byNumber()){if(!J(s,e)){if(s.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!de(s))continue}const n=le(s,s.oneof?e[s.oneof.localName].value:e[s.localName],t);void 0!==n&&(i[t.useProtoFieldName?s.name:s.jsonName]=n)}const r=t.typeRegistry;if(null==r?void 0:r.findExtensionFor)for(const s of n.runtime.bin.listUnknownFields(e)){const a=r.findExtensionFor(n.typeName,s.no);if(a&&z(e,a)){const n=W(e,a,t),s=le(a.field,n,t);void 0!==s&&(i[a.field.jsonName]=s)}}}catch(e){const t=s?"cannot encode field ".concat(n.typeName,".").concat(s.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),i=e instanceof Error?e.message:String(e);throw new Error(t+(i.length>0?": ".concat(i):""))}return i},readScalar:(e,t,n)=>oe(e,t,null!=n?n:x.BIGINT,!0),writeScalar(e,t,n){if(void 0!==t)return n||U(e,t)?he(e,t):void 0},debug:se},bin:{makeReadOptions:ve,makeWriteOptions:fe,listUnknownFields(e){var t;return null!==(t=e[pe])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[pe]},writeUnknownFields(e,t){const n=e[pe];if(n)for(const e of n)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,n,i){const s=e;Array.isArray(s[pe])||(s[pe]=[]),s[pe].push({no:t,wireType:n,data:i})},readMessage(e,t,n,i,s){const r=e.getType(),a=s?t.len:t.pos+n;let o,c;for(;t.pos<a&&([o,c]=t.tag(),!0!==s||c!=A.EndGroup);){const n=r.fields.find(o);if(n)ke(e,t,n,c,i);else{const n=t.skip(c,o);i.readUnknownFields&&this.onUnknownField(e,o,c,n)}}if(s&&(c!=A.EndGroup||o!==n))throw new Error("invalid end group tag")},readField:ke,writeMessage(e,t,n){const i=e.getType();for(const s of i.fields.byNumber())if(J(s,e))Se(s,s.oneof?e[s.oneof.localName].value:e[s.localName],t,n);else if(s.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(s.name," to binary: required field not set"));return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,i){void 0!==t&&Se(e,t,n,i)}},util:Object.assign(Object.assign({},{setEnumType:v,initPartial(e,t){if(void 0===e)return;const n=t.getType();for(const i of n.fields.byMember()){const n=i.localName,s=t,r=e;if(null!=r[n])switch(i.kind){case"oneof":const e=r[n].case;if(void 0===e)continue;const t=i.findField(e);let a=r[n].value;t&&"message"==t.kind&&!Y(a,t.T)?a=new t.T(a):t&&"scalar"===t.kind&&t.T===M.BYTES&&(a=Ie(a)),s[n]={case:e,value:a};break;case"scalar":case"enum":let o=r[n];i.T===M.BYTES&&(o=i.repeated?o.map(Ie):Ie(o)),s[n]=o;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===M.BYTES)for(const[e,t]of Object.entries(r[n]))s[n][e]=Ie(t);else Object.assign(s[n],r[n]);break;case"message":const e=i.V.T;for(const t of Object.keys(r[n])){let i=r[n][t];e.fieldWrapper||(i=new e(i)),s[n][t]=i}}break;case"message":const c=i.T;if(i.repeated)s[n]=r[n].map((e=>Y(e,c)?e:new c(e)));else{const e=r[n];c.fieldWrapper?"google.protobuf.BytesValue"===c.typeName?s[n]=Ie(e):s[n]=e:s[n]=Y(e,c)?e:new c(e)}}}},equals:(e,t,n)=>t===n||!(!t||!n)&&e.fields.byMember().every((e=>{const i=t[e.localName],s=n[e.localName];if(e.repeated){if(i.length!==s.length)return!1;switch(e.kind){case"message":return i.every(((t,n)=>e.T.equals(t,s[n])));case"scalar":return i.every(((t,n)=>N(e.T,t,s[n])));case"enum":return i.every(((e,t)=>N(M.INT32,e,s[t])))}throw new Error("repeated cannot contain ".concat(e.kind))}switch(e.kind){case"message":let t=i,n=s;return e.T.fieldWrapper&&(void 0===t||Y(t)||(t=e.T.fieldWrapper.wrapField(t)),void 0===n||Y(n)||(n=e.T.fieldWrapper.wrapField(n))),e.T.equals(t,n);case"enum":return N(M.INT32,i,s);case"scalar":return N(e.T,i,s);case"oneof":if(i.case!==s.case)return!1;const r=e.findField(i.case);if(void 0===r)return!0;switch(r.kind){case"message":return r.T.equals(i.value,s.value);case"enum":return N(M.INT32,i.value,s.value);case"scalar":return N(r.T,i.value,s.value)}throw new Error("oneof cannot contain ".concat(r.kind));case"map":const a=Object.keys(i).concat(Object.keys(s));switch(e.V.kind){case"message":const t=e.V.T;return a.every((e=>t.equals(i[e],s[e])));case"enum":return a.every((e=>N(M.INT32,i[e],s[e])));case"scalar":const n=e.V.T;return a.every((e=>N(n,i[e],s[e])))}}})),clone(e){const t=e.getType(),n=new t,i=n;for(const n of t.fields.byMember()){const t=e[n.localName];let s;if(n.repeated)s=t.map(Pe);else if("map"==n.kind){s=i[n.localName];for(const[e,n]of Object.entries(t))s[e]=Pe(n)}else s="oneof"==n.kind?n.findField(t.case)?{case:t.case,value:Pe(t.value)}:{case:void 0}:Pe(t);i[n.localName]=s}for(const n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(i,n.no,n.wireType,n.data);return n}}),{newFieldList:Be,initFields:qe}),makeMessageType(e,t,n){return function(e,t,n,i){var s;const r=null!==(s=null==i?void 0:i.localName)&&void 0!==s?s:t.substring(t.lastIndexOf(".")+1),a={[r]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[r];return Object.setPrototypeOf(a.prototype,new y),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary:(e,t)=>(new a).fromBinary(e,t),fromJson:(e,t)=>(new a).fromJson(e,t),fromJsonString:(e,t)=>(new a).fromJsonString(e,t),equals:(t,n)=>e.util.equals(a,t,n)}),a}(this,e,t,n)},makeEnum:k,makeEnumType:f,getEnumType:g,makeExtension(e,t,n){return function(e,t,n,i){let s;return{typeName:t,extendee:n,get field(){if(!s){const n="function"==typeof i?i():i;n.name=t.split(".").pop(),n.jsonName="[".concat(t,"]"),s=e.util.newFieldList([n]).list()[0]}return s},runtime:e}}(this,e,t,n)}});var Be,qe;class Ve extends y{constructor(e){super(),this.seconds=_.zero,this.nanos=0,je.util.initPartial(e,this)}fromJson(e,t){if("string"!=typeof e)throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(je.json.debug(e)));const n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=_.parse(i/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),this}toJson(e){const t=1e3*Number(this.seconds);if(t<Date.parse("0001-01-01T00:00:00Z")||t>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let n="Z";if(this.nanos>0){const e=(this.nanos+1e9).toString().substring(1);n="000000"===e.substring(3)?"."+e.substring(0,3)+"Z":"000"===e.substring(6)?"."+e.substring(0,6)+"Z":"."+e+"Z"}return new Date(t).toISOString().replace(".000Z",n)}toDate(){return new Date(1e3*Number(this.seconds)+Math.ceil(this.nanos/1e6))}static now(){return Ve.fromDate(new Date)}static fromDate(e){const t=e.getTime();return new Ve({seconds:_.parse(Math.floor(t/1e3)),nanos:t%1e3*1e6})}static fromBinary(e,t){return(new Ve).fromBinary(e,t)}static fromJson(e,t){return(new Ve).fromJson(e,t)}static fromJsonString(e,t){return(new Ve).fromJsonString(e,t)}static equals(e,t){return je.util.equals(Ve,e,t)}}Ve.runtime=je,Ve.typeName="google.protobuf.Timestamp",Ve.fields=je.util.newFieldList((()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]));const He=je.makeMessageType("livekit.MetricsBatch",(()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Ve},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:We,repeated:!0},{no:5,name:"events",kind:"message",T:ze,repeated:!0}])),We=je.makeMessageType("livekit.TimeSeriesMetric",(()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:Ke,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}])),Ke=je.makeMessageType("livekit.MetricSample",(()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Ve},{no:3,name:"value",kind:"scalar",T:2}])),ze=je.makeMessageType("livekit.EventMetric",(()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:Ve},{no:7,name:"normalized_end_timestamp",kind:"message",T:Ve,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}])),Ge=je.makeEnum("livekit.AudioCodec",[{no:0,name:"DEFAULT_AC"},{no:1,name:"OPUS"},{no:2,name:"AAC"},{no:3,name:"AC_MP3"}]),Je=je.makeEnum("livekit.VideoCodec",[{no:0,name:"DEFAULT_VC"},{no:1,name:"H264_BASELINE"},{no:2,name:"H264_MAIN"},{no:3,name:"H264_HIGH"},{no:4,name:"VP8"}]),Qe=je.makeEnum("livekit.ImageCodec",[{no:0,name:"IC_DEFAULT"},{no:1,name:"IC_JPEG"}]),Ye=je.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Xe=je.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Ze=je.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),$e=je.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),et=je.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),tt=je.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),nt=je.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"}]),it=je.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),st=je.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),rt=je.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),at=je.makeMessageType("livekit.Room",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:ot,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:Ht}])),ot=je.makeMessageType("livekit.Codec",(()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}])),ct=je.makeMessageType("livekit.ParticipantPermission",(()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:je.getEnumType(Ze),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}])),dt=je.makeMessageType("livekit.ParticipantInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:je.getEnumType(lt)},{no:4,name:"tracks",kind:"message",T:gt,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:ct},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:je.getEnumType(ut)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:je.getEnumType(nt)},{no:18,name:"kind_details",kind:"enum",T:je.getEnumType(ht),repeated:!0},{no:19,name:"data_tracks",kind:"message",T:vt,repeated:!0}])),lt=je.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),ut=je.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"},{no:7,name:"CONNECTOR"},{no:8,name:"BRIDGE"}]),ht=je.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"},{no:2,name:"CONNECTOR_WHATSAPP"},{no:3,name:"CONNECTOR_TWILIO"},{no:4,name:"BRIDGE_RTSP"}]),pt=je.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),mt=je.makeMessageType("livekit.SimulcastCodecInfo",(()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:kt,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:je.getEnumType(bt)},{no:6,name:"sdp_cid",kind:"scalar",T:9}])),gt=je.makeMessageType("livekit.TrackInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:je.getEnumType(Xe)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:je.getEnumType(Ze)},{no:10,name:"layers",kind:"message",T:kt,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:mt,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:je.getEnumType(pt)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:Ht},{no:19,name:"audio_features",kind:"enum",T:je.getEnumType(rt),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:je.getEnumType(Ye)}])),vt=je.makeMessageType("livekit.DataTrackInfo",(()=>[{no:1,name:"pub_handle",kind:"scalar",T:13},{no:2,name:"sid",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"encryption",kind:"enum",T:je.getEnumType(pt)}])),ft=je.makeMessageType("livekit.DataTrackSubscriptionOptions",(()=>[{no:1,name:"target_fps",kind:"scalar",T:13,opt:!0}])),kt=je.makeMessageType("livekit.VideoLayer",(()=>[{no:1,name:"quality",kind:"enum",T:je.getEnumType($e)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9},{no:8,name:"repair_ssrc",kind:"scalar",T:13}])),bt=je.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),yt=je.makeMessageType("livekit.DataPacket",(()=>[{no:1,name:"kind",kind:"enum",T:je.getEnumType(Tt)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:Rt,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Et,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:Pt,oneof:"value"},{no:7,name:"transcription",kind:"message",T:It,oneof:"value"},{no:8,name:"metrics",kind:"message",T:He,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:Ot,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:_t,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:Mt,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:xt,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:Gt,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Jt,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Qt,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:St,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}])),Tt=je.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),St=je.makeMessageType("livekit.EncryptedPacket",(()=>[{no:1,name:"encryption_type",kind:"enum",T:je.getEnumType(pt)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}])),Ct=je.makeMessageType("livekit.EncryptedPacketPayload",(()=>[{no:1,name:"user",kind:"message",T:Rt,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:Ot,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:_t,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:Mt,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:xt,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:Gt,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:Jt,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:Qt,oneof:"value"}])),Et=je.makeMessageType("livekit.ActiveSpeakerUpdate",(()=>[{no:1,name:"speakers",kind:"message",T:wt,repeated:!0}])),wt=je.makeMessageType("livekit.SpeakerInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}])),Rt=je.makeMessageType("livekit.UserPacket",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}])),Pt=je.makeMessageType("livekit.SipDTMF",(()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}])),It=je.makeMessageType("livekit.Transcription",(()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:Dt,repeated:!0}])),Dt=je.makeMessageType("livekit.TranscriptionSegment",(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}])),Ot=je.makeMessageType("livekit.ChatMessage",(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}])),_t=je.makeMessageType("livekit.RpcRequest",(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}])),Mt=je.makeMessageType("livekit.RpcAck",(()=>[{no:1,n