alpha-ai-avatar-sdk-aipi
Version:
Alpha AI Avatar SDK (AIPI)
25 lines (21 loc) • 1.84 MB
JavaScript
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
exports.MessageState = void 0;exports.MessageType = void 0;exports.TranscriberStatus = void 0;exports.AvatarAction = void 0;!function(e){e[e.Idle=0]="Idle",e[e.Loading=1]="Loading",e[e.Speaking=2]="Speaking",e[e.Active=3]="Active";}(exports.MessageState||(exports.MessageState={})),function(e){e[e.Transcript=0]="Transcript",e[e.State=1]="State",e[e.Error=2]="Error",e[e.TranscriberState=3]="TranscriberState",e[e.Landmarks=4]="Landmarks";}(exports.MessageType||(exports.MessageType={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed",e[e.Error=2]="Error";}(exports.TranscriberStatus||(exports.TranscriberStatus={})),function(e){e[e.STOP=1]="STOP",e[e.UPDATE_MESSAGES=2]="UPDATE_MESSAGES",e[e.UPDATE_SYNTHESIZER_OPTIONS=3]="UPDATE_SYNTHESIZER_OPTIONS",e[e.UPDATE_AVATAR_VERSION=4]="UPDATE_AVATAR_VERSION",e[e.SEND_CONVERSATIONAL_MESSAGE=5]="SEND_CONVERSATIONAL_MESSAGE";}(exports.AvatarAction||(exports.AvatarAction={}));var r$3="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype;}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}});})),i}var o,a={exports:{}},c="object"==typeof Reflect?Reflect:null,d=c&&"function"==typeof c.apply?c.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};o=c&&"function"==typeof c.ownKeys?c.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var p=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this);}a.exports=u,a.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,s),n(i);}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments));}b(e,t,s,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&b(e,"error",t,i);}(e,r,{once:!0});}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var l=10;function h(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function v(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function g(e,t,i,n){var r,s,o,a;if(h(i),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),o=s[t]),void 0===o)o=s[t]=i,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[i,o]:[o,i]:n?o.unshift(i):o.push(i),(r=v(e))>0&&o.length>r&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a);}return e}function m(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=m.bind(n);return r.listener=i,n.wrapFn=r,r}function y(e,t,i){var n=e._events;if(void 0===n)return [];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(r):C(r,r.length)}function S(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function C(e,t){for(var i=new Array(t),n=0;n<t;++n)i[n]=e[n];return i}function b(e,t,i,n){if("function"==typeof e.on)n.once?e.once(t,i):e.on(t,i);else {if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(s){n.once&&e.removeEventListener(t,r),i(s);}));}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||p(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");l=e;}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||p(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return v(this)},u.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return !1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=r[e];if(void 0===a)return !1;if("function"==typeof a)d(a,this,t);else {var c=a.length,p=C(a,c);for(i=0;i<c;++i)d(p[i],this,t);}return !0},u.prototype.addListener=function(e,t){return g(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return g(this,e,t,!0)},u.prototype.once=function(e,t){return h(t),this.on(e,f(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){return h(t),this.prependListener(e,f(this,e,t)),this},u.prototype.removeListener=function(e,t){var i,n,r,s,o;if(h(t),void 0===(n=this._events))return this;if(void 0===(i=n[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(r=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){o=i[s].listener,r=s;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop();}(i,r),1===i.length&&(n[e]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t);}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(e){var t,i,n;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var r,s=Object.keys(i);for(n=0;n<s.length;++n)"removeListener"!==(r=s[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},u.prototype.listeners=function(e){return y(this,e,!0)},u.prototype.rawListeners=function(e){return y(this,e,!1)},u.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):S.call(e,t)},u.prototype.listenerCount=S,u.prototype.eventNames=function(){return this._eventsCount>0?o(this._events):[]};var P=a.exports;function T(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}});}}));})),Object.freeze(e)}function R$1(e,t){if(!e)throw new Error(t)}const w=34028234663852886e22,k=-34028234663852886e22,I=4294967295,E=2147483647,O=-2147483648;function A(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>E||e<O)throw new Error("invalid int 32: "+e)}function M(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>I||e<0)throw new Error("invalid uint 32: "+e)}function D(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>w||e<k))throw new Error("invalid float 32: "+e)}const _=Symbol("@bufbuild/protobuf/enum-type");function N(e){const t=e[_];return R$1(t,"missing enum type on enum object"),t}function x(e,t,i,n){e[_]=L(t,i.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))));}function L(e,t,i){const n=Object.create(null),r=Object.create(null),s=[];for(const e of t){const t=j(e);s.push(t),n[e.name]=t,r[e.no]=t;}return {typeName:e,values:s,findName:e=>n[e],findNumber:e=>r[e]}}function z(e,t,i){const n={};for(const e of t){const t=j(e);n[t.localName]=t.no,n[t.no]=t.localName;}return x(n,e,t),n}function j(e){return "localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class F{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const i=this.getType().runtime.bin,n=i.makeReadOptions(t);return i.readMessage(this,n.readerFactory(e),e.byteLength,n),this}fromJson(e,t){const i=this.getType(),n=i.runtime.json,r=n.makeReadOptions(t);return n.readMessage(i,e,r,this),this}fromJsonString(e,t){let i;try{i=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(i,t)}toBinary(e){const t=this.getType().runtime.bin,i=t.makeWriteOptions(e),n=i.writerFactory();return t.writeMessage(this,n,i),n.finish()}toJson(e){const t=this.getType().runtime.json,i=t.makeWriteOptions(e);return t.writeMessage(this,i)}toJsonString(e){var t;const i=this.toJson(e);return JSON.stringify(i,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 U(){let e=0,t=0;for(let i=0;i<28;i+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<i,!(128&n))return this.assertBounds(),[e,t]}let i=this.buf[this.pos++];if(e|=(15&i)<<28,t=(112&i)>>4,!(128&i))return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<i,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function B(e,t,i){for(let n=0;n<28;n+=7){const r=e>>>n,s=!(r>>>7==0&&0==t),o=255&(s?128|r:r);if(i.push(o),!s)return}const n=e>>>28&15|(7&t)<<4,r=!!(t>>3);if(i.push(255&(r?128|n:n)),r){for(let e=3;e<31;e+=7){const n=t>>>e,r=!(n>>>7==0),s=255&(r?128|n:n);if(i.push(s),!r)return}i.push(t>>>31&1);}}const q=4294967296;function V(e){const t="-"===e[0];t&&(e=e.slice(1));const i=1e6;let n=0,r=0;function s(t,s){const o=Number(e.slice(t,s));r*=i,n=n*i+o,n>=q&&(r+=n/q|0,n%=q);}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),t?K(n,r):W(n,r)}function H(e,t){if(({lo:e,hi:t}=function(e,t){return {lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(q*t+e);const i=16777215&(e>>>24|t<<8),n=t>>16&65535;let r=(16777215&e)+6777216*i+6710656*n,s=i+8147497*n,o=2*n;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(o+=Math.floor(s/a),s%=a),o.toString()+J(s)+J(r)}function W(e,t){return {lo:0|e,hi:0|t}}function K(e,t){return t=~t,e?e=1+~e:t+=1,W(e,t)}const J=e=>{const t=String(e);return "0000000".slice(t.length)+t};function G(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e);}else {for(let i=0;i<9;i++)t.push(127&e|128),e>>=7;t.push(1);}}function $(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;128&e&&t<10;t++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const Q=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"),i=BigInt("9223372036854775807"),n=BigInt("0"),r=BigInt("18446744073709551615");return {zero:BigInt(0),supported:!0,parse(e){const n="bigint"==typeof e?e:BigInt(e);if(n>i||n<t)throw new Error("int64 invalid: ".concat(e));return n},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>r||t<n)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,i)=>(e.setInt32(0,t,!0),e.setInt32(4,i,!0),e.getBigInt64(0,!0)),uDec:(t,i)=>(e.setInt32(0,t,!0),e.setInt32(4,i,!0),e.getBigUint64(0,!0))}}const t=e=>R$1(/^-?[0-9]+$/.test(e),"int64 invalid: ".concat(e)),i=e=>R$1(/^[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()),i(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),V(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),i(e),V(e)),dec:(e,t)=>function(e,t){let i=W(e,t);const n=2147483648&i.hi;n&&(i=K(i.lo,i.hi));const r=H(i.lo,i.hi);return n?"-"+r:r}(e,t),uDec:(e,t)=>H(e,t)}}();var X,Y,Z;function ee(e,t,i){if(t===i)return !0;if(e==X.BYTES){if(!(t instanceof Uint8Array&&i instanceof Uint8Array))return !1;if(t.length!==i.length)return !1;for(let e=0;e<t.length;e++)if(t[e]!==i[e])return !1;return !0}switch(e){case X.UINT64:case X.FIXED64:case X.INT64:case X.SFIXED64:case X.SINT64:return t==i}return !1}function te(e,t){switch(e){case X.BOOL:return !1;case X.UINT64:case X.FIXED64:case X.INT64:case X.SFIXED64:case X.SINT64:return 0==t?Q.zero:"0";case X.DOUBLE:case X.FLOAT:return 0;case X.BYTES:return new Uint8Array(0);case X.STRING:return "";default:return 0}}function ie(e,t){switch(e){case X.BOOL:return !1===t;case X.STRING:return ""===t;case X.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";}(X||(X={})),function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING";}(Y||(Y={})),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";}(Z||(Z={}));class ne{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),i=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],i),i+=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(M(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return A(e),G(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){D(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){M(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){A(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return A(e),G(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),n=Q.enc(e);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),n=Q.uEnc(e);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=Q.enc(e);return B(t.lo,t.hi,this.buf),this}sint64(e){let t=Q.enc(e),i=t.hi>>31;return B(t.lo<<1^i,(t.hi<<1|t.lo>>>31)^i,this.buf),this}uint64(e){let t=Q.uEnc(e);return B(t.lo,t.hi,this.buf),this}}class re{constructor(e,t){this.varint64=U,this.uint32=$,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,i=7&e;if(t<=0||i<0||i>5)throw new Error("illegal tag: field no "+t+" wire type "+i);return [t,i]}skip(e,t){let i=this.pos;switch(e){case Z.Varint:for(;128&this.buf[this.pos++];);break;case Z.Bit64:this.pos+=4;case Z.Bit32:this.pos+=4;break;case Z.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Z.StartGroup:for(;;){const[e,i]=this.tag();if(i===Z.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(i,e);}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(i,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 Q.dec(...this.varint64())}uint64(){return Q.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),i=-(1&e);return e=(e>>>1|(1&t)<<31)^i,t=t>>>1^i,Q.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 Q.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Q.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 se(e){const t=e.field.localName,i=Object.create(null);return i[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 te(t.T,t.L);case"message":const e=t.T,i=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(i):i;case"map":throw "map fields are not allowed to be extensions"}}(e),[i,()=>i[t]]}let oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ae=[];for(let e=0;e<oe.length;e++)ae[oe[e].charCodeAt(0)]=e;ae["-".charCodeAt(0)]=oe.indexOf("+"),ae["_".charCodeAt(0)]=oe.indexOf("/");const ce={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let i,n=new Uint8Array(t),r=0,s=0,o=0;for(let t=0;t<e.length;t++){if(i=ae[e.charCodeAt(t)],void 0===i)switch(e[t]){case"=":s=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:o=i,s=1;break;case 1:n[r++]=o<<2|(48&i)>>4,o=i,s=2;break;case 2:n[r++]=(15&o)<<4|(60&i)>>2,o=i,s=3;break;case 3:n[r++]=(3&o)<<6|i,s=0;}}if(1==s)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(e){let t,i="",n=0,r=0;for(let s=0;s<e.length;s++)switch(t=e[s],n){case 0:i+=oe[t>>2],r=(3&t)<<4,n=1;break;case 1:i+=oe[r|t>>4],r=(15&t)<<2,n=2;break;case 2:i+=oe[r|t>>6],i+=oe[63&t],n=0;}return n&&(i+=oe[r],i+="=",1==n&&(i+="=")),i}};function de(e,t,i){le(t,e);const n=t.runtime.bin.makeReadOptions(i),r=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let i=e.length-1;i>=0;--i)if(e[i].no==t.no)return [e[i]];return []}return e.filter((e=>e.no===t.no))}(e.getType().runtime.bin.listUnknownFields(e),t.field),[s,o]=se(t);for(const e of r)t.runtime.bin.readField(s,n.readerFactory(e.data),t.field,e.wireType,n);return o()}function pe(e,t,i,n){le(t,e);const r=t.runtime.bin.makeReadOptions(n),s=t.runtime.bin.makeWriteOptions(n);if(ue(e,t)){const i=e.getType().runtime.bin.listUnknownFields(e).filter((e=>e.no!=t.field.no));e.getType().runtime.bin.discardUnknownFields(e);for(const t of i)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data);}const o=s.writerFactory();let a=t.field;a.opt||a.repeated||"enum"!=a.kind&&"scalar"!=a.kind||(a=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(a,i,o,s);const c=r.readerFactory(o.finish());for(;c.pos<c.len;){const[t,i]=c.tag(),n=c.skip(i,t);e.getType().runtime.bin.onUnknownField(e,t,i,n);}}function ue(e,t){const i=e.getType();return t.extendee.typeName===i.typeName&&!!i.runtime.bin.listUnknownFields(e).find((e=>e.no==t.field.no))}function le(e,t){R$1(e.extendee.typeName==t.getType().typeName,"extension ".concat(e.typeName," can only be applied to message ").concat(e.extendee.typeName));}function he(e,t){const i=e.localName;if(e.repeated)return t[i].length>0;if(e.oneof)return t[e.oneof.localName].case===i;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[i]:"enum"==e.kind?t[i]!==e.T.values[0].no:!ie(e.T,t[i]);case"message":return void 0!==t[i];case"map":return Object.keys(t[i]).length>0}}function ve(e,t){const i=e.localName,n=!e.opt&&!e.req;if(e.repeated)t[i]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[i]={};break;case"enum":t[i]=n?e.T.values[0].no:void 0;break;case"scalar":t[i]=n?te(e.T,e.L):void 0;break;case"message":t[i]=void 0;}}function ge(e,t){if(null===e||"object"!=typeof e)return !1;if(!Object.getOwnPropertyNames(F.prototype).every((t=>t in e&&"function"==typeof e[t])))return !1;const i=e.getType();return null!==i&&"function"==typeof i&&"typeName"in i&&"string"==typeof i.typeName&&(void 0===t||i.typeName==t.typeName)}function me(e,t){return ge(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}X.DOUBLE,X.FLOAT,X.INT64,X.UINT64,X.INT32,X.UINT32,X.BOOL,X.STRING,X.BYTES;const fe={ignoreUnknownFields:!1},ye={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Se(e){return e?Object.assign(Object.assign({},fe),e):fe}function Ce(e){return e?Object.assign(Object.assign({},ye),e):ye}const be=Symbol(),Pe=Symbol();function Te(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,i,n,r){let s=i.localName;if(i.repeated){if(R$1("map"!=i.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(i.name," from JSON: ").concat(Te(t)));const o=e[s];for(const e of t){if(null===e)throw new Error("cannot decode field ".concat(r.typeName,".").concat(i.name," from JSON: ").concat(Te(e)));switch(i.kind){case"message":o.push(i.T.fromJson(e,n));break;case"enum":const t=Ie(i.T,e,n.ignoreUnknownFields,!0);t!==Pe&&o.push(t);break;case"scalar":try{o.push(ke(i.T,e,i.L,!0));}catch(t){let n="cannot decode field ".concat(r.typeName,".").concat(i.name," from JSON: ").concat(Te(e));throw t instanceof Error&&t.message.length>0&&(n+=": ".concat(t.message)),new Error(n)}}}}else if("map"==i.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(i.name," from JSON: ").concat(Te(t)));const o=e[s];for(const[e,s]of Object.entries(t)){if(null===s)throw new Error("cannot decode field ".concat(r.typeName,".").concat(i.name," from JSON: map value null"));let a;try{a=we(i.K,e);}catch(e){let n="cannot decode map key for field ".concat(r.typeName,".").concat(i.name," from JSON: ").concat(Te(t));throw e instanceof Error&&e.message.length>0&&(n+=": ".concat(e.message)),new Error(n)}switch(i.V.kind){case"message":o[a]=i.V.T.fromJson(s,n);break;case"enum":const e=Ie(i.V.T,s,n.ignoreUnknownFields,!0);e!==Pe&&(o[a]=e);break;case"scalar":try{o[a]=ke(i.V.T,s,Y.BIGINT,!0);}catch(e){let n="cannot decode map value for field ".concat(r.typeName,".").concat(i.name," from JSON: ").concat(Te(t));throw e instanceof Error&&e.message.length>0&&(n+=": ".concat(e.message)),new Error(n)}}}}else switch(i.oneof&&(e=e[i.oneof.localName]={case:s},s="value"),i.kind){case"message":const o=i.T;if(null===t&&"google.protobuf.Value"!=o.typeName)return;let a=e[s];ge(a)?a.fromJson(t,n):(e[s]=a=o.fromJson(t,n),o.fieldWrapper&&!i.oneof&&(e[s]=o.fieldWrapper.unwrapField(a)));break;case"enum":const c=Ie(i.T,t,n.ignoreUnknownFields,!1);switch(c){case be:ve(i,e);break;case Pe:break;default:e[s]=c;}break;case"scalar":try{const n=ke(i.T,t,i.L,!1);if(n===be)ve(i,e);else e[s]=n;}catch(e){let n="cannot decode field ".concat(r.typeName,".").concat(i.name," from JSON: ").concat(Te(t));throw e instanceof Error&&e.message.length>0&&(n+=": ".concat(e.message)),new Error(n)}}}function we(e,t){if(e===X.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1;}return ke(e,t,Y.BIGINT,!0).toString()}function ke(e,t,i,n){if(null===t)return n?te(e,i):be;switch(e){case X.DOUBLE:case X.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 n=Number(t);if(Number.isNaN(n))break;if(!Number.isFinite(n))break;return e==X.FLOAT&&D(n),n;case X.INT32:case X.FIXED32:case X.SFIXED32:case X.SINT32:case X.UINT32:let r;if("number"==typeof t?r=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(r=Number(t)),void 0===r)break;return e==X.UINT32||e==X.FIXED32?M(r):A(r),r;case X.INT64:case X.SFIXED64:case X.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const s=Q.parse(t);return i?s.toString():s;case X.FIXED64:case X.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const o=Q.uParse(t);return i?o.toString():o;case X.BOOL:if("boolean"!=typeof t)break;return t;case X.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t);}catch(e){throw new Error("invalid UTF8")}return t;case X.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return ce.dec(t)}throw new Error}function Ie(e,t,i,n){if(null===t)return "google.protobuf.NullValue"==e.typeName?0:n?e.values[0].no:be;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const n=e.findName(t);if(void 0!==n)return n.no;if(i)return Pe}throw new Error("cannot decode enum ".concat(e.typeName," from JSON: ").concat(Te(t)))}function Ee(e){return !(!e.repeated&&"map"!=e.kind)||!e.oneof&&("message"!=e.kind&&(!e.opt&&!e.req))}function Oe(e,t,i){if("map"==e.kind){R$1("object"==typeof t&&null!=t);const n={},r=Object.entries(t);switch(e.V.kind){case"scalar":for(const[t,i]of r)n[t.toString()]=Me(e.V.T,i);break;case"message":for(const[e,t]of r)n[e.toString()]=t.toJson(i);break;case"enum":const t=e.V.T;for(const[e,s]of r)n[e.toString()]=Ae(t,s,i.enumAsInteger);}return i.emitDefaultValues||r.length>0?n:void 0}if(e.repeated){R$1(Array.isArray(t));const n=[];switch(e.kind){case"scalar":for(let i=0;i<t.length;i++)n.push(Me(e.T,t[i]));break;case"enum":for(let r=0;r<t.length;r++)n.push(Ae(e.T,t[r],i.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)n.push(t[e].toJson(i));}return i.emitDefaultValues||n.length>0?n:void 0}switch(e.kind){case"scalar":return Me(e.T,t);case"enum":return Ae(e.T,t,i.enumAsInteger);case"message":return me(e.T,t).toJson(i)}}function Ae(e,t,i){var n;if(R$1("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(i)return t;const r=e.findNumber(t);return null!==(n=null==r?void 0:r.name)&&void 0!==n?n:t}function Me(e,t){switch(e){case X.INT32:case X.SFIXED32:case X.SINT32:case X.FIXED32:case X.UINT32:return R$1("number"==typeof t),t;case X.FLOAT:case X.DOUBLE:return R$1("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case X.STRING:return R$1("string"==typeof t),t;case X.BOOL:return R$1("boolean"==typeof t),t;case X.UINT64:case X.FIXED64:case X.INT64:case X.SFIXED64:case X.SINT64:return R$1("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case X.BYTES:return R$1(t instanceof Uint8Array),ce.enc(t)}}const De=Symbol("@bufbuild/protobuf/unknown-fields"),_e={readUnknownFields:!0,readerFactory:e=>new re(e)},Ne={writeUnknownFields:!0,writerFactory:()=>new ne};function xe(e){return e?Object.assign(Object.assign({},_e),e):_e}function Le(e){return e?Object.assign(Object.assign({},Ne),e):Ne}function ze(e,t,i,n,r){let{repeated:s,localName:o}=i;switch(i.oneof&&((e=e[i.oneof.localName]).case!=o&&delete e.value,e.case=o,o="value"),i.kind){case"scalar":case"enum":const a="enum"==i.kind?X.INT32:i.T;let c=Ue;if("scalar"==i.kind&&i.L>0&&(c=Fe),s){let i=e[o];if(n==Z.LengthDelimited&&a!=X.STRING&&a!=X.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)i.push(c(t,a));}else i.push(c(t,a));}else e[o]=c(t,a);break;case"message":const d=i.T;s?e[o].push(je(t,new d,r,i)):ge(e[o])?je(t,e[o],r,i):(e[o]=je(t,new d,r,i),!d.fieldWrapper||i.oneof||i.repeated||(e[o]=d.fieldWrapper.unwrapField(e[o])));break;case"map":let[p,u]=function(e,t,i){const n=t.uint32(),r=t.pos+n;let s,o;for(;t.pos<r;){const[n]=t.tag();switch(n){case 1:s=Ue(t,e.K);break;case 2:switch(e.V.kind){case"scalar":o=Ue(t,e.V.T);break;case"enum":o=t.int32();break;case"message":o=je(t,new e.V.T,i,void 0);}}}void 0===s&&(s=te(e.K,Y.BIGINT));"string"!=typeof s&&"number"!=typeof s&&(s=s.toString());if(void 0===o)switch(e.V.kind){case"scalar":o=te(e.V.T,Y.BIGINT);break;case"enum":o=e.V.T.values[0].no;break;case"message":o=new e.V.T;}return [s,o]}(i,t,r);e[o][p]=u;}}function je(e,t,i,n){const r=t.getType().runtime.bin,s=null==n?void 0:n.delimited;return r.readMessage(t,e,s?n.no:e.uint32(),i,s),t}function Fe(e,t){const i=Ue(e,t);return "bigint"==typeof i?i.toString():i}function Ue(e,t){switch(t){case X.STRING:return e.string();case X.BOOL:return e.bool();case X.DOUBLE:return e.double();case X.FLOAT:return e.float();case X.INT32:return e.int32();case X.INT64:return e.int64();case X.UINT64:return e.uint64();case X.FIXED64:return e.fixed64();case X.BYTES:return e.bytes();case X.FIXED32:return e.fixed32();case X.SFIXED32:return e.sfixed32();case X.SFIXED64:return e.sfixed64();case X.SINT64:return e.sint64();case X.UINT32:return e.uint32();case X.SINT32:return e.sint32()}}function Be(e,t,i,n){R$1(void 0!==t);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let s="enum"==e.kind?X.INT32:e.T;if(r)if(R$1(Array.isArray(t)),e.packed)!function(e,t,i,n){if(!n.length)return;e.tag(i,Z.LengthDelimited).fork();let[,r]=We(t);for(let t=0;t<n.length;t++)e[r](n[t]);e.join();}(i,s,e.no,t);else for(const n of t)He(i,s,e.no,n);else He(i,s,e.no,t);break;case"message":if(r){R$1(Array.isArray(t));for(const r of t)Ve(i,n,e,r);}else Ve(i,n,e,t);break;case"map":R$1("object"==typeof t&&null!=t);for(const[r,s]of Object.entries(t))qe(i,n,e,r,s);}}function qe(e,t,i,n,r){e.tag(i.no,Z.LengthDelimited),e.fork();let s=n;switch(i.K){case X.INT32:case X.FIXED32:case X.UINT32:case X.SFIXED32:case X.SINT32:s=Number.parseInt(n);break;case X.BOOL:R$1("true"==n||"false"==n),s="true"==n;}switch(He(e,i.K,1,s),i.V.kind){case"scalar":He(e,i.V.T,2,r);break;case"enum":He(e,X.INT32,2,r);break;case"message":R$1(void 0!==r),e.tag(2,Z.LengthDelimited).bytes(r.toBinary(t));}e.join();}function Ve(e,t,i,n){const r=me(i.T,n);i.delimited?e.tag(i.no,Z.StartGroup).raw(r.toBinary(t)).tag(i.no,Z.EndGroup):e.tag(i.no,Z.LengthDelimited).bytes(r.toBinary(t));}function He(e,t,i,n){R$1(void 0!==n);let[r,s]=We(t);e.tag(i,r)[s](n);}function We(e){let t=Z.Varint;switch(e){case X.BYTES:case X.STRING:t=Z.LengthDelimited;break;case X.DOUBLE:case X.FIXED64:case X.SFIXED64:t=Z.Bit64;break;case X.FIXED32:case X.SFIXED32:case X.FLOAT:t=Z.Bit32;}return [t,X[e].toLowerCase()]}function Ke(e){if(void 0===e)return e;if(ge(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function Je(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class Ge{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 i of this.list())i.oneof?i.oneof!==t&&(t=i.oneof,e.push(t)):e.push(i);}return this.members}}function $e(e,t){const i=Xe(e);return t?i:it(tt(i))}const Qe=Xe;function Xe(e){let t=!1;const i=[];for(let n=0;n<e.length;n++){let r=e.charAt(n);switch(r){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":i.push(r),t=!1;break;default:t&&(t=!1,r=r.toUpperCase()),i.push(r);}}return i.join("")}const Ye=new Set(["constructor","toString","toJSON","valueOf"]),Ze=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),et=e=>"".concat(e,"$"),tt=e=>Ze.has(e)?et(e):e,it=e=>Ye.has(e)?et(e):e;class nt{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=$e(e,!1);}addField(e){R$1(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 rt=(st=e=>new Ge(e,(e=>function(e,t){var i,n,r,s,o,a;const c=[];let d;for(const t of "function"==typeof e?e():e){const e=t;if(e.localName=$e(t.name,void 0!==t.oneof),e.jsonName=null!==(i=t.jsonName)&&void 0!==i?i:Qe(t.name),e.repeated=null!==(n=t.repeated)&&void 0!==n&&n,"scalar"==t.kind&&(e.L=null!==(r=t.L)&&void 0!==r?r:Y.BIGINT),e.delimited=null!==(s=t.delimited)&&void 0!==s&&s,e.req=null!==(o=t.req)&&void 0!==o&&o,e.opt=null!==(a=t.opt)&&void 0!==a&&a,void 0===t.packed&&(e.packed="enum"==t.kind||"scalar"==t.kind&&t.T!=X.BYTES&&t.T!=X.STRING),void 0!==t.oneof){const i="string"==typeof t.oneof?t.oneof:t.oneof.name;d&&d.name==i||(d=new nt(i)),e.oneof=d,d.addField(e);}c.push(e);}return c}(e))),ot=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const i=t.localName,n=e;if(t.repeated)n[i]=[];else switch(t.kind){case"oneof":n[i]={case:void 0};break;case"enum":n[i]=0;break;case"map":n[i]={};break;case"scalar":n[i]=te(t.T,t.L);}}},{syntax:"proto3",json:{makeReadOptions:Se,makeWriteOptions:Ce,readMessage(e,t,i,n){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(e.typeName," from JSON: ").concat(Te(t)));n=null!=n?n:new e;const r=new Map,s=i.typeRegistry;for(const[o,a]of Object.entries(t)){const t=e.fields.findJsonName(o);if(t){if(t.oneof){if(null===a&&"scalar"==t.kind)continue;const i=r.get(t.oneof);if(void 0!==i)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(i,'", "').concat(o,'"'));r.set(t.oneof,o);}Re(n,a,t,i,e);}else {let t=!1;if((null==s?void 0:s.findExtension)&&o.startsWith("[")&&o.endsWith("]")){const r=s.findExtension(o.substring(1,o.length-1));if(r&&r.extendee.typeName==e.typeName){t=!0;const[e,s]=se(r);Re(e,a,r.field,i,r),pe(n,r,s(),i);}}if(!t&&!i.ignoreUnknownFields)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: key "').concat(o,'" is unknown'))}}return n},writeMessage(e,t){const i=e.getType(),n={};let r;try{for(r of i.fields.byNumber()){if(!he(r,e)){if(r.req)throw "required field not set";if(!t.emitDefaultValues)continue;if(!Ee(r))continue}const i=Oe(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t);void 0!==i&&(n[t.useProtoFieldName?r.name:r.jsonName]=i);}const s=t.typeRegistry;if(null==s?void 0:s.findExtensionFor)for(const r of i.runtime.bin.listUnknownFields(e)){const o=s.findExtensionFor(i.typeName,r.no);if(o&&ue(e,o)){const i=de(e,o,t),r=Oe(o.field,i,t);void 0!==r&&(n[o.field.jsonName]=r);}}}catch(e){const t=r?"cannot encode field ".concat(i.typeName,".").concat(r.name," to JSON"):"cannot encode message ".concat(i.typeName," to JSON"),n=e instanceof Error?e.message:String(e);throw new Error(t+(n.length>0?": ".concat(n):""))}return n},readScalar:(e,t,i)=>ke(e,t,null!=i?i:Y.BIGINT,!0),writeScalar(e,t,i){if(void 0!==t)return i||ie(e,t)?Me(e,t):void 0},debug:Te},bin:{makeReadOptions:xe,makeWriteOptions:Le,listUnknownFields(e){var t;return null!==(t=e[De])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[De];},writeUnknownFields(e,t){const i=e[De];if(i)for(const e of i)t.tag(e.no,e.wireType).raw(e.data);},onUnknownField(e,t,i,n){const r=e;Array.isArray(r[De])||(r[De]=[]),r[De].push({no:t,wireType:i,data:n});},readMessage(e,t,i,n,r){const s=e.getType(),o=r?t.len:t.pos+i;let a,c;for(;t.pos<o&&([a,c]=t.tag(),!0!==r||c!=Z.EndGroup);){const i=s.fields.find(a);if(i)ze(e,t,i,c,n);else {const i=t.skip(c,a);n.readUnknownFields&&this.onUnknownField(e,a,c,i);}}if(r&&(c!=Z.EndGroup||a!==i))throw new Error("invalid end group tag")},readField:ze,writeMessage(e,t,i){const n=e.getType();for(const r of n.fields.byNumber())if(he(r,e))Be(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t,i);else if(r.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(r.name," to binary: required field not set"));return i.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,i,n){void 0!==t&&Be(e,t,i,n);}},util:Object.assign(Object.assign({},{setEnumType:x,initPartial(e,t){if(void 0===e)return;const i=t.getType();for(const n of i.fields.byMember()){const i=n.localName,r=t,s=e;if(null!=s[i])switch(n.kind){case"oneof":const e=s[i].case;if(void 0===e)continue;const t=n.findField(e);let o=s[i].value;t&&"message"==t.kind&&!ge(o,t.T)?o=new t.T(o):t&&"scalar"===t.kind&&t.T===X.BYTES&&(o=Je(o)),r[i]={case:e,value:o};break;case"scalar":case"enum":let a=s[i];n.T===X.BYTES&&(a=n.repeated?a.map(Je):Je(a)),r[i]=a;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===X.BYTES)for(const[e,t]of Object.entries(s[i]))r[i][e]=Je(t);else Object.assign(r[i],s[i]);break;case"message":const e=n.V.T;for(const t of Object.keys(s[i])){let n=s[i][t];e.fieldWrapper||(n=new e(n)),r[i][t]=n;}}break;case"message":const c=n.T;if(n.repeated)r[i]=s[i].map((e=>ge(e,c)?e:new c(e)));else {const e=s[i];c.fieldWrapper?"google.protobuf.BytesValue"===c.typeName?r[i]=Je(e):r[i]=e:r[i]=ge(e,c)?e:new c(e);}}}},equals:(e,t,i)=>t===i||!(!t||!i)&&e.fields.byMember().every((e=>{const n=t[e.localName],r=i[e.localName];if(e.repeated){if(n.length!==r.length)return !1;switch(e.kind){case"message":return n.every(((t,i)=>e.T.equals(t,r[i])));case"scalar":return n.every(((t,i)=>ee(e.T,t,r[i])));case"enum":return n.every(((e,t)=>ee(X.INT32,e,r[t])))}throw new Error("repeated cannot contain ".concat(e.kind))}switch(e.kind){case"message":return e.T.equals(n,r);case"enum":return ee(X.INT32,n,r);case"scalar":return ee(e.T,n,r);case"oneof":if(n.case!==r.case)return !1;const t=e.findField(n.case);if(void 0===t)return !0;switch(t.kind){case"message":return t.T.equals(n.value,r.value);case"enum":return ee(X.INT32,n.value,r.value);case"scalar":return ee(t.T,n.value,r.value)}throw new Error("oneof cannot contain ".concat(t.kind));case"map":const i=Object.keys(n).concat(Object.keys(r));switch(e.V.kind){case"message":const t=e.V.T;return i.every((e=>t.equals(n[e],r[e])));case"enum":return i.every((e=>ee(X.INT32,n[e],r[e])));case"scalar":const s=e.V.T;return i.every((e=>ee(s,n[e],r[e])))}}})),clone(e){const t=e.getType(),i=new t,n=i;for(const i of t.fields.byMember()){const t=e[i.localName];let r;if(i.repeated)r=t.map(Ke);else if("map"==i.kind){r=n[i.localName];for(const[e,i]of Object.entries(t))r[e]=Ke(i);}else r="oneof"==i.kind?i.findField(t.case)?{case:t.case,value:Ke(t.value)}:{case:void 0}:Ke(t);n[i.localName]=r;}for(const i of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(n,i.no,i.wireType,i.data);return i}}),{newFieldList:st,initFields:ot}),makeMessageType(e,t,i){return function(e,t,i,n){var r;const s=null!==(r=null==n?void 0:n.localName)&&void 0!==r?r:t.substring(t.lastIndexOf(".")+1),o={[s]:function(t){e.util.initFields(this),e.util.initPartial(t,this);}}[s];return Object.setPrototypeOf(o.prototype,new F),Object.assign(o,{runtime:e,typeName:t,fields:e.util.newFieldList(i),fromBinary:(e,t)=>(new o).fromBinary(e,t),fromJson:(e,t)=>(new o).fromJson(e,t),fromJsonString:(e,t)=>(new o).fromJsonString(e,t),equals:(t,i)=>e.util.equals(o,t,i)}),o}(this,e,t,i)},makeEnum:z,makeEnumType:L,getEnumType:N,makeExtension(e,t,i){return function(e,t,i,n){let r;return {typeName:t,extendee:i,get field(){if(!r){const i="function"==typeof n?n():n;i.name=t.split(".").pop(),i.jsonName="[".concat(t,"]"),r=e.util.newFieldList([i]).list()[0];}return r},runtime:e}}(this,e,t,i)}});var st,ot;const at=rt.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),ct=rt.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"}]),dt=rt.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),pt=rt.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),ut=rt.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),lt=rt.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"}]),ht=rt.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"}]),vt=rt.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),gt=rt.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"}]),mt=rt.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:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:ft,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:qt}])),ft=rt.makeMessageType("livekit.Codec",(()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}])),yt=rt.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:rt.getEnumType(ct),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}])),St=rt.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:rt.getEnumType(Ct)},{no:4,name:"tracks",kind:"message",T:Rt,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",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:yt},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:rt.getEnumType(bt)}])),Ct=rt.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),bt=rt.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),Pt=rt.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),Tt=rt.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:wt,repeated:!0}])),Rt=rt.makeMessageType("livekit.TrackInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:rt.getEnumType(at)},{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:rt.getEnumType(ct)},{no:10,name:"layers",kind:"message",T:wt,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:Tt,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:rt.getEnumType(Pt)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:qt},{no:19,name:"audio_features",kind:"enum",T:rt.getEnumType(gt),repeated:!0}])),wt=rt.makeMessageType("livekit.VideoLayer",(()=>[{no:1,name:"quality",kind:"enum",T:rt.getEnumType(dt)},{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}])),kt=rt.makeMessageType("livekit.DataPacket",(()=>[{no:1,name:"kind",kind:"enum",T:rt.getEnumType(It)},{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:At,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Et,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:Mt,oneof:"value"},{no:7,name:"transcription",kind:"message",T:Dt,oneof:"value"}])),It=rt.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),Et=rt.makeMessageType("livekit.ActiveSpeakerUpdate",(()=>[{no:1,name:"speakers",kind:"message",T:Ot,repeated:!0}])),Ot=rt.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}])),At=rt.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}])),Mt=rt.makeMessageType("livekit.SipDTMF",(()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}])),Dt=rt.makeMessageType("livekit.Transcription",(()=>[{no:2,name:"participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:_t,repeated:!0}])),_t=rt.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}])),Nt=rt.makeMessageType("livekit.ParticipantTracks",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}])),xt=rt.makeMessageType("livekit.ServerInfo",(()=>[{no:1,name:"edition",kind:"enum",T:rt.getEnumType(Lt)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{