@mochabug/adapt-web
Version:
Browser client library for Adapt automation platform
3 lines • 229 kB
JavaScript
var __MbAdapt_prev = typeof MbAdapt !== 'undefined' ? MbAdapt : undefined;
"use strict";var MbAdapt=(()=>{var Jt=Object.defineProperty;var Cs=Object.getOwnPropertyDescriptor;var Xs=Object.getOwnPropertyNames;var Ss=Object.prototype.hasOwnProperty;var Bs=(e,n)=>{for(var t in n)Jt(e,t,{get:n[t],enumerable:!0})},Ws=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Xs(n))!Ss.call(e,o)&&o!==t&&Jt(e,o,{get:()=>n[o],enumerable:!(r=Cs(n,o))||r.enumerable});return e};var xs=e=>Ws(Jt({},"__esModule",{value:!0}),e);var Gl={};Bs(Gl,{AutomationService:()=>Wt,Code:()=>g,ConnectError:()=>h,configure:()=>hs,createAdaptClient:()=>dl,createConnectClient:()=>Vs,getConfig:()=>Et,resetConfig:()=>Is,signalDataToJson:()=>ul});function tn(e,n){return e!==null&&typeof e=="object"&&"$typeName"in e&&typeof e.$typeName=="string"?n===void 0?!0:n.typeName===e.$typeName:!1}var i;(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"})(i||(i={}));function oo(){let e=0,n=0;for(let r=0;r<28;r+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<r,(o&128)==0)return this.assertBounds(),[e,n]}let t=this.buf[this.pos++];if(e|=(t&15)<<28,n=(t&112)>>4,(t&128)==0)return this.assertBounds(),[e,n];for(let r=3;r<=31;r+=7){let o=this.buf[this.pos++];if(n|=(o&127)<<r,(o&128)==0)return this.assertBounds(),[e,n]}throw new Error("invalid varint")}function wn(e,n,t){for(let a=0;a<28;a=a+7){let s=e>>>a,c=!(!(s>>>7)&&n==0),d=(c?s|128:s)&255;if(t.push(d),!c)return}let r=e>>>28&15|(n&7)<<4,o=n>>3!=0;if(t.push((o?r|128:r)&255),!!o){for(let a=3;a<31;a=a+7){let s=n>>>a,c=!!(s>>>7),d=(c?s|128:s)&255;if(t.push(d),!c)return}t.push(n>>>31&1)}}var Fn=4294967296;function Yt(e){let n=e[0]==="-";n&&(e=e.slice(1));let t=1e6,r=0,o=0;function a(s,c){let d=Number(e.slice(s,c));o*=t,r=r*t+d,r>=Fn&&(o=o+(r/Fn|0),r=r%Fn)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),n?so(r,o):wt(r,o)}function ao(e,n){let t=wt(e,n),r=t.hi&2147483648;r&&(t=so(t.lo,t.hi));let o=Ft(t.lo,t.hi);return r?"-"+o:o}function Ft(e,n){if({lo:e,hi:n}=Es(e,n),n<=2097151)return String(Fn*n+e);let t=e&16777215,r=(e>>>24|n<<8)&16777215,o=n>>16&65535,a=t+r*6777216+o*6710656,s=r+o*8147497,c=o*2,d=1e7;return a>=d&&(s+=Math.floor(a/d),a%=d),s>=d&&(c+=Math.floor(s/d),s%=d),c.toString()+ro(s)+ro(a)}function Es(e,n){return{lo:e>>>0,hi:n>>>0}}function wt(e,n){return{lo:e|0,hi:n|0}}function so(e,n){return n=~n,e?e=~e+1:n+=1,wt(e,n)}var ro=e=>{let n=String(e);return"0000000".slice(n.length)+n};function rn(e,n){if(e>=0){for(;e>127;)n.push(e&127|128),e=e>>>7;n.push(e)}else{for(let t=0;t<9;t++)n.push(e&127|128),e=e>>7;n.push(1)}}function co(){let e=this.buf[this.pos++],n=e&127;if((e&128)==0)return this.assertBounds(),n;if(e=this.buf[this.pos++],n|=(e&127)<<7,(e&128)==0)return this.assertBounds(),n;if(e=this.buf[this.pos++],n|=(e&127)<<14,(e&128)==0)return this.assertBounds(),n;if(e=this.buf[this.pos++],n|=(e&127)<<21,(e&128)==0)return this.assertBounds(),n;e=this.buf[this.pos++],n|=(e&15)<<28;for(let t=5;(e&128)!==0&&t<10;t++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),n>>>0}var J=Rs();function Rs(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!globalThis.Deno||!!globalThis.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let t=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let c=typeof s=="bigint"?s:BigInt(s);if(c>r||c<t)throw new Error(`invalid int64: ${s}`);return c},uParse(s){let c=typeof s=="bigint"?s:BigInt(s);if(c>a||c<o)throw new Error(`invalid uint64: ${s}`);return c},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,c){return e.setInt32(0,s,!0),e.setInt32(4,c,!0),e.getBigInt64(0,!0)},uDec(s,c){return e.setInt32(0,s,!0),e.setInt32(4,c,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(t){return typeof t!="string"&&(t=t.toString()),io(t),t},uParse(t){return typeof t!="string"&&(t=t.toString()),lo(t),t},enc(t){return typeof t!="string"&&(t=t.toString()),io(t),Yt(t)},uEnc(t){return typeof t!="string"&&(t=t.toString()),lo(t),Yt(t)},dec(t,r){return ao(t,r)},uDec(t,r){return Ft(t,r)}}}function io(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function lo(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}function O(e,n){switch(e){case i.STRING:return"";case i.BOOL:return!1;case i.DOUBLE:case i.FLOAT:return 0;case i.INT64:case i.UINT64:case i.SFIXED64:case i.FIXED64:case i.SINT64:return n?"0":J.zero;case i.BYTES:return new Uint8Array(0);default:return 0}}function uo(e,n){switch(e){case i.BOOL:return n===!1;case i.STRING:return n==="";case i.BYTES:return n instanceof Uint8Array&&!n.byteLength;case i.DOUBLE:case i.FLOAT:return Object.is(n,0);default:return n==0}}var mo=2,P=Symbol.for("reflect unsafe local");function Nn(e,n){let t=e[n.localName].case;return t===void 0?t:n.fields.find(r=>r.localName===t)}function Nt(e,n){let t=n.localName;if(n.oneof)return e[n.oneof.localName].case===t;if(n.presence!=mo)return e[t]!==void 0&&Object.prototype.hasOwnProperty.call(e,t);switch(n.fieldKind){case"list":return e[t].length>0;case"map":return Object.keys(e[t]).length>0;case"scalar":return!uo(n.scalar,e[t]);case"enum":return e[t]!==n.enum.values[0].number}throw new Error("message field with implicit presence")}function Ge(e,n){return Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==void 0}function vn(e,n){if(n.oneof){let t=e[n.oneof.localName];return t.case===n.localName?t.value:void 0}return e[n.localName]}function Hn(e,n,t){n.oneof?e[n.oneof.localName]={case:n.localName,value:t}:e[n.localName]=t}function vt(e,n){let t=n.localName;if(n.oneof){let r=n.oneof.localName;e[r].case===t&&(e[r]={case:void 0})}else if(n.presence!=mo)delete e[t];else switch(n.fieldKind){case"map":e[t]={};break;case"list":e[t]=[];break;case"enum":e[t]=n.enum.values[0].number;break;case"scalar":e[t]=O(n.scalar,n.longAsString);break}}function ne(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function on(e,n){var t,r,o,a;if(ne(e)&&P in e&&"add"in e&&"field"in e&&typeof e.field=="function"){if(n!==void 0){let s=n,c=e.field();return s.listKind==c.listKind&&s.scalar===c.scalar&&((t=s.message)===null||t===void 0?void 0:t.typeName)===((r=c.message)===null||r===void 0?void 0:r.typeName)&&((o=s.enum)===null||o===void 0?void 0:o.typeName)===((a=c.enum)===null||a===void 0?void 0:a.typeName)}return!0}return!1}function an(e,n){var t,r,o,a;if(ne(e)&&P in e&&"has"in e&&"field"in e&&typeof e.field=="function"){if(n!==void 0){let s=n,c=e.field();return s.mapKey===c.mapKey&&s.mapKind==c.mapKind&&s.scalar===c.scalar&&((t=s.message)===null||t===void 0?void 0:t.typeName)===((r=c.message)===null||r===void 0?void 0:r.typeName)&&((o=s.enum)===null||o===void 0?void 0:o.typeName)===((a=c.enum)===null||a===void 0?void 0:a.typeName)}return!0}return!1}function Ye(e,n){return ne(e)&&P in e&&"desc"in e&&ne(e.desc)&&e.desc.kind==="message"&&(n===void 0||e.desc.typeName==n.typeName)}function go(e){return bo(e.$typeName)}function _(e){let n=e.fields[0];return bo(e.typeName)&&n!==void 0&&n.fieldKind=="scalar"&&n.name=="value"&&n.number==1}function Mn(e){switch(e.typeName){case"google.protobuf.Any":case"google.protobuf.Timestamp":case"google.protobuf.Duration":case"google.protobuf.FieldMask":case"google.protobuf.Struct":case"google.protobuf.Value":case"google.protobuf.ListValue":return!0;default:return _(e)}}function bo(e){return e.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(e.substring(16))}var Js=999,Ys=998,zn=2;function Y(e,n){if(tn(n,e))return n;let t=Hs(e);return n!==void 0&&Fs(e,t,n),t}function Fs(e,n,t){for(let r of e.members){let o=t[r.localName];if(o==null)continue;let a;if(r.kind=="oneof"){let s=Nn(t,r);if(!s)continue;a=s,o=vn(t,s)}else a=r;switch(a.fieldKind){case"message":o=Mt(a,o);break;case"scalar":o=yo(a,o);break;case"list":o=Ns(a,o);break;case"map":o=ws(a,o);break}Hn(n,a,o)}return n}function yo(e,n){return e.scalar==i.BYTES?zt(n):n}function ws(e,n){if(ne(n)){if(e.scalar==i.BYTES)return po(n,zt);if(e.mapKind=="message")return po(n,t=>Mt(e,t))}return n}function Ns(e,n){if(Array.isArray(n)){if(e.scalar==i.BYTES)return n.map(zt);if(e.listKind=="message")return n.map(t=>Mt(e,t))}return n}function Mt(e,n){if(e.fieldKind=="message"&&!e.oneof&&_(e.message))return yo(e.message.fields[0],n);if(ne(n)){if(e.message.typeName=="google.protobuf.Struct"&&e.parent.typeName!=="google.protobuf.Value")return n;if(!tn(n,e.message))return Y(e.message,n)}return n}function zt(e){return Array.isArray(e)?new Uint8Array(e):e}function po(e,n){let t={};for(let r of Object.entries(e))t[r[0]]=n(r[1]);return t}var vs=Symbol(),fo=new WeakMap;function Hs(e){let n;if(Ms(e)){let t=fo.get(e),r,o;if(t)({prototype:r,members:o}=t);else{r={},o=new Set;for(let a of e.members)a.kind!="oneof"&&(a.fieldKind!="scalar"&&a.fieldKind!="enum"||a.presence!=zn&&(o.add(a),r[a.localName]=Ht(a)));fo.set(e,{prototype:r,members:o})}n=Object.create(r),n.$typeName=e.typeName;for(let a of e.members)o.has(a)||a.kind=="field"&&(a.fieldKind=="message"||(a.fieldKind=="scalar"||a.fieldKind=="enum")&&a.presence!=zn)||(n[a.localName]=Ht(a))}else{n={$typeName:e.typeName};for(let t of e.members)(t.kind=="oneof"||t.presence==zn)&&(n[t.localName]=Ht(t))}return n}function Ms(e){switch(e.file.edition){case Js:return!1;case Ys:return!0;default:return e.fields.some(n=>n.presence!=zn&&n.fieldKind!="message"&&!n.oneof)}}function Ht(e){if(e.kind=="oneof")return{case:void 0};if(e.fieldKind=="list")return[];if(e.fieldKind=="map")return{};if(e.fieldKind=="message")return vs;let n=e.getDefaultValue();return n!==void 0?e.fieldKind=="scalar"&&e.longAsString?n.toString():n:e.fieldKind=="scalar"?O(e.scalar,e.longAsString):e.enum.values[0].number}var zs=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"],v=class extends Error{constructor(n,t,r="FieldValueInvalidError"){super(t),this.name=r,this.field=()=>n}};function ho(e){return e instanceof Error&&zs.includes(e.name)&&"field"in e&&typeof e.field=="function"}var Lt=Symbol.for("@bufbuild/protobuf/text-encoding");function sn(){if(globalThis[Lt]==null){let e=new globalThis.TextEncoder,n=new globalThis.TextDecoder,t;globalThis[Lt]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r,o){return o?(t===void 0&&(t=new globalThis.TextDecoder("utf-8",{fatal:!0})),t.decode(r)):n.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return globalThis[Lt]}var w;(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"})(w||(w={}));var Ut=34028234663852886e22,Kt=-34028234663852886e22,Tt=4294967295,Qt=2147483647,Dt=-2147483648,Ae=class{constructor(n=sn().encodeUtf8){this.encodeUtf8=n,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let n=0;for(let o=0;o<this.chunks.length;o++)n+=this.chunks[o].length;let t=new Uint8Array(n),r=0;for(let o=0;o<this.chunks.length;o++)t.set(this.chunks[o],r),r+=this.chunks[o].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let n=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(n.byteLength),this.raw(n)}tag(n,t){return this.uint32((n<<3|t)>>>0)}raw(n){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(n),this}uint32(n){for(Io(n);n>127;)this.buf.push(n&127|128),n=n>>>7;return this.buf.push(n),this}int32(n){return kt(n),rn(n,this.buf),this}bool(n){return this.buf.push(n?1:0),this}bytes(n){return this.uint32(n.byteLength),this.raw(n)}string(n){let t=this.encodeUtf8(n);return this.uint32(t.byteLength),this.raw(t)}float(n){Ls(n);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,n,!0),this.raw(t)}double(n){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,n,!0),this.raw(t)}fixed32(n){Io(n);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,n,!0),this.raw(t)}sfixed32(n){kt(n);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,n,!0),this.raw(t)}sint32(n){return kt(n),n=(n<<1^n>>31)>>>0,rn(n,this.buf),this}sfixed64(n){let t=new Uint8Array(8),r=new DataView(t.buffer),o=J.enc(n);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(t)}fixed64(n){let t=new Uint8Array(8),r=new DataView(t.buffer),o=J.uEnc(n);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(t)}int64(n){let t=J.enc(n);return wn(t.lo,t.hi,this.buf),this}sint64(n){let t=J.enc(n),r=t.hi>>31,o=t.lo<<1^r,a=(t.hi<<1|t.lo>>>31)^r;return wn(o,a,this.buf),this}uint64(n){let t=J.uEnc(n);return wn(t.lo,t.hi,this.buf),this}},be=class{constructor(n,t=sn().decodeUtf8){this.decodeUtf8=t,this.varint64=oo,this.uint32=co,this.buf=n,this.len=n.length,this.pos=0,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength)}tag(){let n=this.pos,t=this.uint32(),r=this.pos-n;if(r>5||r==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=t>>>3,a=t&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(n,t,r=100){let o=this.pos;switch(n){case w.Varint:for(;this.buf[this.pos++]&128;);break;case w.Bit64:this.pos+=4;case w.Bit32:this.pos+=4;break;case w.LengthDelimited:let a=this.uint32();this.pos+=a;break;case w.StartGroup:if(r<=0)throw new Error("maximum recursion depth reached");for(;;){let[s,c]=this.tag();if(c===w.EndGroup){if(t!==void 0&&s!==t)throw new Error("invalid end group tag");break}this.skip(c,s,r-1)}break;default:throw new Error("cant skip wire type "+n)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let n=this.uint32();return n>>>1^-(n&1)}int64(){return J.dec(...this.varint64())}uint64(){return J.uDec(...this.varint64())}sint64(){let[n,t]=this.varint64(),r=-(n&1);return n=(n>>>1|(t&1)<<31)^r,t=t>>>1^r,J.dec(n,t)}bool(){let[n,t]=this.varint64();return n!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return J.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return J.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 n=this.uint32(),t=this.pos;return this.pos+=n,this.assertBounds(),this.buf.subarray(t,t+n)}string(n){return this.decodeUtf8(this.bytes(),n)}};function kt(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>Qt||e<Dt)throw new Error("invalid int32: "+e)}function Io(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>Tt||e<0)throw new Error("invalid uint32: "+e)}function Ls(e){if(typeof e=="string"){let n=e;if(e=Number(e),Number.isNaN(e)&&n!=="NaN")throw new Error("invalid float32: "+n)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>Ut||e<Kt))throw new Error("invalid float32: "+e)}function ie(e,n){let t=e.fieldKind=="list"?on(n,e):e.fieldKind=="map"?an(n,e):_t(e,n);if(t===!0)return;let r;switch(e.fieldKind){case"list":r=`expected ${Zo(e)}, got ${H(n)}`;break;case"map":r=`expected ${Vo(e)}, got ${H(n)}`;break;default:r=Ln(e,n,t)}return new v(e,r)}function Pt(e,n,t){let r=_t(e,t);if(r!==!0)return new v(e,`list item #${n+1}: ${Ln(e,t,r)}`)}function Go(e,n,t){let r=Ot(n,e.mapKey);if(r!==!0)return new v(e,`invalid map key: ${Ln({scalar:e.mapKey},n,r)}`);let o=_t(e,t);if(o!==!0)return new v(e,`map entry ${H(n)}: ${Ln(e,t,o)}`)}function _t(e,n){return e.scalar!==void 0?Ot(n,e.scalar):e.enum!==void 0?e.enum.open?Ot(n,i.INT32):e.enum.values.some(t=>t.number===n):Ye(n,e.message)}function Ot(e,n){switch(n){case i.DOUBLE:return typeof e=="number";case i.FLOAT:return typeof e!="number"?!1:Number.isNaN(e)||!Number.isFinite(e)?!0:e>Ut||e<Kt?`${e.toFixed()} out of range`:!0;case i.INT32:case i.SFIXED32:case i.SINT32:return typeof e!="number"||!Number.isInteger(e)?!1:e>Qt||e<Dt?`${e.toFixed()} out of range`:!0;case i.FIXED32:case i.UINT32:return typeof e!="number"||!Number.isInteger(e)?!1:e>Tt||e<0?`${e.toFixed()} out of range`:!0;case i.BOOL:return typeof e=="boolean";case i.STRING:return typeof e!="string"?!1:sn().checkUtf8(e)||"invalid UTF8";case i.BYTES:return e instanceof Uint8Array;case i.INT64:case i.SFIXED64:case i.SINT64:if(typeof e=="bigint"||typeof e=="number"||typeof e=="string"&&e.length>0)try{return J.parse(e),!0}catch{return`${e} out of range`}return!1;case i.FIXED64:case i.UINT64:if(typeof e=="bigint"||typeof e=="number"||typeof e=="string"&&e.length>0)try{return J.uParse(e),!0}catch{return`${e} out of range`}return!1}}function Ln(e,n,t){return t=typeof t=="string"?`: ${t}`:`, got ${H(n)}`,e.scalar!==void 0?`expected ${ks(e.scalar)}`+t:e.enum!==void 0?`expected ${e.enum.toString()}`+t:`expected ${Ao(e.message)}`+t}function H(e){switch(typeof e){case"object":return e===null?"null":e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:on(e)?Zo(e.field()):an(e)?Vo(e.field()):Ye(e)?Ao(e.desc):tn(e)?`message ${e.$typeName}`:"object";case"string":return e.length>30?"string":`"${e.split('"').join('\\"')}"`;case"boolean":return String(e);case"number":return String(e);case"bigint":return String(e)+"n";default:return typeof e}}function Ao(e){return`ReflectMessage (${e.typeName})`}function Zo(e){switch(e.listKind){case"message":return`ReflectList (${e.message.toString()})`;case"enum":return`ReflectList (${e.enum.toString()})`;case"scalar":return`ReflectList (${i[e.scalar]})`}}function Vo(e){switch(e.mapKind){case"message":return`ReflectMap (${i[e.mapKey]}, ${e.message.toString()})`;case"enum":return`ReflectMap (${i[e.mapKey]}, ${e.enum.toString()})`;case"scalar":return`ReflectMap (${i[e.mapKey]}, ${i[e.scalar]})`}}function ks(e){switch(e){case i.STRING:return"string";case i.BOOL:return"boolean";case i.INT64:case i.SINT64:case i.SFIXED64:return"bigint (int64)";case i.UINT64:case i.FIXED64:return"bigint (uint64)";case i.BYTES:return"Uint8Array";case i.DOUBLE:return"number (float64)";case i.FLOAT:return"number (float32)";case i.FIXED32:case i.UINT32:return"number (uint32)";case i.INT32:case i.SFIXED32:case i.SINT32:return"number (int32)"}}function L(e,n,t=!0){return new Un(e,n,t)}var Co=new WeakMap,Un=class{get sortedFields(){let n=Co.get(this.desc);if(n)return n;let t=this.desc.fields.concat().sort((r,o)=>r.number-o.number);return Co.set(this.desc,t),t}constructor(n,t,r=!0){this.lists=new Map,this.maps=new Map,this.check=r,this.desc=n,this.message=this[P]=t??Y(n),this.fields=n.fields,this.oneofs=n.oneofs,this.members=n.members}findNumber(n){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(t=>[t.number,t]))),this._fieldsByNumber.get(n)}oneofCase(n){return cn(this.message,n),Nn(this.message,n)}isSet(n){return cn(this.message,n),Nt(this.message,n)}clear(n){cn(this.message,n),vt(this.message,n)}get(n){cn(this.message,n);let t=vn(this.message,n);switch(n.fieldKind){case"list":let r=this.lists.get(n);return(!r||r[P]!==t)&&this.lists.set(n,r=new qt(n,t,this.check)),r;case"map":let o=this.maps.get(n);return(!o||o[P]!==t)&&this.maps.set(n,o=new er(n,t,this.check)),o;case"message":return tr(n,t,this.check);case"scalar":return t===void 0?O(n.scalar,!1):rr(n,t);case"enum":return t??n.enum.values[0].number}}set(n,t){if(cn(this.message,n),this.check){let o=ie(n,t);if(o)throw o}let r;n.fieldKind=="message"?r=nr(n,t):an(t)||on(t)?r=t[P]:r=or(n,t),Hn(this.message,n,r)}getUnknown(){return this.message.$unknown}setUnknown(n){this.message.$unknown=n}};function cn(e,n){if(n.parent.typeName!==e.$typeName)throw new v(n,`cannot use ${n.toString()} with message ${e.$typeName}`,"ForeignFieldError")}var qt=class{field(){return this._field}get size(){return this._arr.length}constructor(n,t,r){this._field=n,this._arr=this[P]=t,this.check=r}get(n){let t=this._arr[n];return t===void 0?void 0:jt(this._field,t,this.check)}set(n,t){if(n<0||n>=this._arr.length)throw new v(this._field,`list item #${n+1}: out of range`);if(this.check){let r=Pt(this._field,n,t);if(r)throw r}this._arr[n]=Xo(this._field,t)}add(n){if(this.check){let t=Pt(this._field,this._arr.length,n);if(t)throw t}this._arr.push(Xo(this._field,n))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let n of this._arr)yield jt(this._field,n,this.check)}*entries(){for(let n=0;n<this._arr.length;n++)yield[n,jt(this._field,this._arr[n],this.check)]}};var er=class{constructor(n,t,r=!0){this.obj=this[P]=t??{},this.check=r,this._field=n}field(){return this._field}set(n,t){if(this.check){let r=Go(this._field,n,t);if(r)throw r}return this.obj[kn(n)]=Us(this._field,t),this}delete(n){let t=kn(n),r=Object.prototype.hasOwnProperty.call(this.obj,t);return r&&delete this.obj[t],r}clear(){for(let n of Object.keys(this.obj))delete this.obj[n]}get(n){let t=this.obj[kn(n)];return t!==void 0&&(t=$t(this._field,t,this.check)),t}has(n){return Object.prototype.hasOwnProperty.call(this.obj,kn(n))}*keys(){for(let n of Object.keys(this.obj))yield So(n,this._field.mapKey)}*entries(){for(let n of Object.entries(this.obj))yield[So(n[0],this._field.mapKey),$t(this._field,n[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let n of Object.values(this.obj))yield $t(this._field,n,this.check)}forEach(n,t){for(let r of this.entries())n.call(t,r[1],r[0],this)}};function nr(e,n){return Ye(n)?go(n.message)&&!e.oneof&&e.fieldKind=="message"?n.message.value:n.desc.typeName=="google.protobuf.Struct"&&e.parent.typeName!="google.protobuf.Value"?Wo(n.message):n.message:n}function tr(e,n,t){return n!==void 0&&(_(e.message)&&!e.oneof&&e.fieldKind=="message"?n={$typeName:e.message.typeName,value:rr(e.message.fields[0],n)}:e.message.typeName=="google.protobuf.Struct"&&e.parent.typeName!="google.protobuf.Value"&&ne(n)&&(n=Bo(n))),new Un(e.message,n,t)}function Xo(e,n){return e.listKind=="message"?nr(e,n):or(e,n)}function jt(e,n,t){return e.listKind=="message"?tr(e,n,t):rr(e,n)}function Us(e,n){return e.mapKind=="message"?nr(e,n):or(e,n)}function $t(e,n,t){return e.mapKind=="message"?tr(e,n,t):n}function kn(e){return typeof e=="string"||typeof e=="number"?e:String(e)}function So(e,n){switch(n){case i.STRING:return e;case i.INT32:case i.FIXED32:case i.UINT32:case i.SFIXED32:case i.SINT32:{let t=Number.parseInt(e);if(Number.isFinite(t))return t;break}case i.BOOL:switch(e){case"true":return!0;case"false":return!1}break;case i.UINT64:case i.FIXED64:try{return J.uParse(e)}catch{}break;default:try{return J.parse(e)}catch{}break}return e}function rr(e,n){switch(e.scalar){case i.INT64:case i.SFIXED64:case i.SINT64:"longAsString"in e&&e.longAsString&&typeof n=="string"&&(n=J.parse(n));break;case i.FIXED64:case i.UINT64:"longAsString"in e&&e.longAsString&&typeof n=="string"&&(n=J.uParse(n));break}return n}function or(e,n){switch(e.scalar){case i.INT64:case i.SFIXED64:case i.SINT64:"longAsString"in e&&e.longAsString?n=String(n):(typeof n=="string"||typeof n=="number")&&(n=J.parse(n));break;case i.FIXED64:case i.UINT64:"longAsString"in e&&e.longAsString?n=String(n):(typeof n=="string"||typeof n=="number")&&(n=J.uParse(n));break}return n}function Bo(e){let n={$typeName:"google.protobuf.Struct",fields:{}};if(ne(e))for(let[t,r]of Object.entries(e))n.fields[t]=Eo(r);return n}function Wo(e){let n={};for(let[t,r]of Object.entries(e.fields))n[t]=xo(r);return n}function xo(e){switch(e.kind.case){case"structValue":return Wo(e.kind.value);case"listValue":return e.kind.value.values.map(xo);case"nullValue":case void 0:return null;default:return e.kind.value}}function Eo(e){let n={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof e){case"number":n.kind={case:"numberValue",value:e};break;case"string":n.kind={case:"stringValue",value:e};break;case"boolean":n.kind={case:"boolValue",value:e};break;case"object":if(e===null)n.kind={case:"nullValue",value:0};else if(Array.isArray(e)){let t={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(e))for(let r of e)t.values.push(Eo(r));n.kind={case:"listValue",value:t}}else n.kind={case:"structValue",value:Bo(e)};break}return n}function pe(e){let n=Ks(),t=e.length*3/4;e[e.length-2]=="="?t-=2:e[e.length-1]=="="&&(t-=1);let r=new Uint8Array(t),o=0,a=0,s,c=0;for(let d=0;d<e.length;d++){if(s=n[e.charCodeAt(d)],s===void 0)switch(e[d]){case"=":a=0;case`
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string")}switch(a){case 0:c=s,a=1;break;case 1:r[o++]=c<<2|(s&48)>>4,c=s,a=2;break;case 2:r[o++]=(c&15)<<4|(s&60)>>2,c=s,a=3;break;case 3:r[o++]=(c&3)<<6|s,a=0;break}}if(a==1)throw Error("invalid base64 string");return r.subarray(0,o)}function Ze(e,n="std"){let t=Jo(n),r=n=="std",o="",a=0,s,c=0;for(let d=0;d<e.length;d++)switch(s=e[d],a){case 0:o+=t[s>>2],c=(s&3)<<4,a=1;break;case 1:o+=t[c|s>>4],c=(s&15)<<2,a=2;break;case 2:o+=t[c|s>>6],o+=t[s&63],a=0;break}return a&&(o+=t[c],r&&(o+="=",a==1&&(o+="="))),o}var Kn,Ro,Fe;function Jo(e){return Kn||(Kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ro=Kn.slice(0,-2).concat("-","_")),e=="url"?Ro:Kn}function Ks(){if(!Fe){Fe=[];let e=Jo("std");for(let n=0;n<e.length;n++)Fe[e[n].charCodeAt(0)]=n;Fe[45]=e.indexOf("+"),Fe[95]=e.indexOf("/")}return Fe}function te(e){let n=!1,t=[];for(let r=0;r<e.length;r++){let o=e.charAt(r);switch(o){case"_":n=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":t.push(o),n=!1;break;default:n&&(n=!1,o=o.toUpperCase()),t.push(o);break}}return t.join("")}function Tn(e){return e.replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}var Ts=new Set(["constructor","toString","toJSON","valueOf"]);function we(e){return Ts.has(e)?e+"$":e}function ln(e){for(let n of e.field)Ge(n,"jsonName")||(n.jsonName=te(n.name));e.nestedType.forEach(ln)}function Yo(e,n){let t=e.values.find(r=>r.name===n);if(!t)throw new Error(`cannot parse ${e} default value: ${n}`);return t.number}function Fo(e,n){switch(e){case i.STRING:return n;case i.BYTES:{let t=Qs(n);if(t===!1)throw new Error(`cannot parse ${i[e]} default value: ${n}`);return t}case i.INT64:case i.SFIXED64:case i.SINT64:return J.parse(n);case i.UINT64:case i.FIXED64:return J.uParse(n);case i.DOUBLE:case i.FLOAT:switch(n){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(n)}case i.BOOL:return n==="true";case i.INT32:case i.UINT32:case i.SINT32:case i.FIXED32:case i.SFIXED32:return parseInt(n,10)}}function Qs(e){let n=[],t={tail:e,c:"",next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(r){if(this.tail.length>=r){let o=this.tail.substring(0,r);return this.tail=this.tail.substring(r),o}return!1}};for(;t.next();)switch(t.c){case"\\":if(t.next())switch(t.c){case"\\":n.push(t.c.charCodeAt(0));break;case"b":n.push(8);break;case"f":n.push(12);break;case"n":n.push(10);break;case"r":n.push(13);break;case"t":n.push(9);break;case"v":n.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let r=t.c,o=t.take(2);if(o===!1)return!1;let a=parseInt(r+o,8);if(Number.isNaN(a))return!1;n.push(a);break}case"x":{let r=t.c,o=t.take(2);if(o===!1)return!1;let a=parseInt(r+o,16);if(Number.isNaN(a))return!1;n.push(a);break}case"u":{let r=t.c,o=t.take(4);if(o===!1)return!1;let a=parseInt(r+o,16);if(Number.isNaN(a))return!1;let s=new Uint8Array(4);new DataView(s.buffer).setInt32(0,a,!0),n.push(s[0],s[1],s[2],s[3]);break}case"U":{let r=t.c,o=t.take(8);if(o===!1)return!1;let a=J.uEnc(r+o),s=new Uint8Array(8),c=new DataView(s.buffer);c.setInt32(0,a.lo,!0),c.setInt32(4,a.hi,!0),n.push(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7]);break}}break;default:n.push(t.c.charCodeAt(0))}return new Uint8Array(n)}function*Qn(e){switch(e.kind){case"file":for(let n of e.messages)yield n,yield*Qn(n);yield*e.enums,yield*e.services,yield*e.extensions;break;case"message":for(let n of e.nestedMessages)yield n,yield*Qn(n);yield*e.nestedEnums,yield*e.nestedExtensions;break}}function Dn(...e){let n=Ds();if(!e.length)return n;if("$typeName"in e[0]&&e[0].$typeName=="google.protobuf.FileDescriptorSet"){for(let t of e[0].file)Ho(t,n);return n}if("$typeName"in e[0]){let a=function(s){let c=[];for(let d of s.dependency){if(n.getFile(d)!=null||o.has(d))continue;let u=r(d);if(!u)throw new Error(`Unable to resolve ${d}, imported by ${s.name}`);"kind"in u?n.addFile(u,!1,!0):(o.add(u.name),c.push(u))}return c.concat(...c.map(a))},t=e[0],r=e[1],o=new Set;for(let s of[t,...a(t)].reverse())Ho(s,n)}else for(let t of e)for(let r of t.files)n.addFile(r);return n}function Ds(){let e=new Map,n=new Map,t=new Map;return{kind:"registry",types:e,extendees:n,[Symbol.iterator](){return e.values()},get files(){return t.values()},addFile(r,o,a){if(t.set(r.proto.name,r),!o)for(let s of Qn(r))this.add(s);if(a)for(let s of r.dependencies)this.addFile(s,o,a)},add(r){if(r.kind=="extension"){let o=n.get(r.extendee.typeName);o||n.set(r.extendee.typeName,o=new Map),o.set(r.number,r)}e.set(r.typeName,r)},get(r){return e.get(r)},getFile(r){return t.get(r)},getMessage(r){let o=e.get(r);return o?.kind=="message"?o:void 0},getEnum(r){let o=e.get(r);return o?.kind=="enum"?o:void 0},getExtension(r){let o=e.get(r);return o?.kind=="extension"?o:void 0},getExtensionFor(r,o){var a;return(a=n.get(r.typeName))===null||a===void 0?void 0:a.get(o)},getService(r){let o=e.get(r);return o?.kind=="service"?o:void 0}}}var Os=998,Ps=999,_s=9999,js=9,un=10,dn=11,$s=12,wo=14,lr=3,qs=2,No=1,ec=0,ar=1,vo=2,nc=3,tc=1,rc=2,oc=1,ac=2;var sc=1001,zo={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function Ho(e,n){var t,r;let o={kind:"file",proto:e,deprecated:(r=(t=e.options)===null||t===void 0?void 0:t.deprecated)!==null&&r!==void 0?r:!1,edition:dc(e),name:e.name.replace(/\.proto$/,""),dependencies:uc(e,n),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${e.name}`}},a=new Map,s={get(c){return a.get(c)},add(c){var d;j(((d=c.proto.options)===null||d===void 0?void 0:d.mapEntry)===!0),a.set(c.typeName,c)}};for(let c of e.enumType)Lo(c,o,void 0,n);for(let c of e.messageType)ko(c,o,void 0,n,s);for(let c of e.service)cc(c,o,n);sr(o,n);for(let c of a.values())cr(c,n,s);for(let c of o.messages)cr(c,n,s),sr(c,n);n.addFile(o,!0)}function sr(e,n){switch(e.kind){case"file":for(let t of e.proto.extension){let r=ir(t,e,n);e.extensions.push(r),n.add(r)}break;case"message":for(let t of e.proto.extension){let r=ir(t,e,n);e.nestedExtensions.push(r),n.add(r)}for(let t of e.nestedMessages)sr(t,n);break}}function cr(e,n,t){let r=e.proto.oneofDecl.map(a=>lc(a,e)),o=new Set;for(let a of e.proto.field){let s=bc(a,r),c=ir(a,e,n,s,t);e.fields.push(c),e.field[c.localName]=c,s===void 0?e.members.push(c):(s.fields.push(c),o.has(s)||(o.add(s),e.members.push(s)))}for(let a of r.filter(s=>o.has(s)))e.oneofs.push(a);for(let a of e.nestedMessages)cr(a,n,t)}function Lo(e,n,t,r){var o,a,s,c,d;let u=mc(e.name,e.value),y={kind:"enum",proto:e,deprecated:(a=(o=e.options)===null||o===void 0?void 0:o.deprecated)!==null&&a!==void 0?a:!1,file:n,parent:t,open:!0,name:e.name,typeName:On(e,t,n),value:{},values:[],sharedPrefix:u,toString(){return`enum ${this.typeName}`}};y.open=hc(y),r.add(y);for(let G of e.value){let E=G.name;y.values.push(y.value[G.number]={kind:"enum_value",proto:G,deprecated:(c=(s=G.options)===null||s===void 0?void 0:s.deprecated)!==null&&c!==void 0?c:!1,parent:y,name:E,localName:we(u==null?E:E.substring(u.length)),number:G.number,toString(){return`enum value ${y.typeName}.${E}`}})}((d=t?.nestedEnums)!==null&&d!==void 0?d:n.enums).push(y)}function ko(e,n,t,r,o){var a,s,c,d;let u={kind:"message",proto:e,deprecated:(s=(a=e.options)===null||a===void 0?void 0:a.deprecated)!==null&&s!==void 0?s:!1,file:n,parent:t,name:e.name,typeName:On(e,t,n),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};((c=e.options)===null||c===void 0?void 0:c.mapEntry)===!0?o.add(u):(((d=t?.nestedMessages)!==null&&d!==void 0?d:n.messages).push(u),r.add(u));for(let y of e.enumType)Lo(y,n,u,r);for(let y of e.nestedType)ko(y,n,u,r,o)}function cc(e,n,t){var r,o;let a={kind:"service",proto:e,deprecated:(o=(r=e.options)===null||r===void 0?void 0:r.deprecated)!==null&&o!==void 0?o:!1,file:n,name:e.name,typeName:On(e,void 0,n),methods:[],method:{},toString(){return`service ${this.typeName}`}};n.services.push(a),t.add(a);for(let s of e.method){let c=ic(s,a,t);a.methods.push(c),a.method[c.localName]=c}}function ic(e,n,t){var r,o,a,s;let c;e.clientStreaming&&e.serverStreaming?c="bidi_streaming":e.clientStreaming?c="client_streaming":e.serverStreaming?c="server_streaming":c="unary";let d=t.getMessage(le(e.inputType)),u=t.getMessage(le(e.outputType));j(d,`invalid MethodDescriptorProto: input_type ${e.inputType} not found`),j(u,`invalid MethodDescriptorProto: output_type ${e.inputType} not found`);let y=e.name;return{kind:"rpc",proto:e,deprecated:(o=(r=e.options)===null||r===void 0?void 0:r.deprecated)!==null&&o!==void 0?o:!1,parent:n,name:y,localName:we(y.length?we(y[0].toLowerCase()+y.substring(1)):y),methodKind:c,input:d,output:u,idempotency:(s=(a=e.options)===null||a===void 0?void 0:a.idempotencyLevel)!==null&&s!==void 0?s:ec,toString(){return`rpc ${n.typeName}.${y}`}}}function lc(e,n){return{kind:"oneof",proto:e,deprecated:!1,parent:n,fields:[],name:e.name,localName:we(te(e.name)),toString(){return`oneof ${n.typeName}.${this.name}`}}}function ir(e,n,t,r,o){var a,s,c;let d=o===void 0,u={kind:"field",proto:e,deprecated:(s=(a=e.options)===null||a===void 0?void 0:a.deprecated)!==null&&s!==void 0?s:!1,name:e.name,number:e.number,scalar:void 0,message:void 0,enum:void 0,presence:pc(e,r,d,n),utf8Validation:Ic(e,n),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(d){let m=n.kind=="file"?n:n.file,A=n.kind=="file"?void 0:n,R=On(e,A,m);u.kind="extension",u.file=m,u.parent=A,u.oneof=void 0,u.typeName=R,u.jsonName=`[${R}]`,u.toString=()=>`extension ${R}`;let W=t.getMessage(le(e.extendee));j(W,`invalid FieldDescriptorProto: extendee ${e.extendee} not found`),u.extendee=W}else{let m=n;j(m.kind=="message"),u.parent=m,u.oneof=r,u.localName=r?te(e.name):we(te(e.name)),u.jsonName=e.jsonName,u.toString=()=>`field ${m.typeName}.${e.name}`}let y=e.label,G=e.type,E=(c=e.options)===null||c===void 0?void 0:c.jstype;if(y===lr){let m=G==dn?o?.get(le(e.typeName)):void 0;if(m){u.fieldKind="map";let{key:A,value:R}=yc(m);return u.mapKey=A.scalar,u.mapKind=R.fieldKind,u.message=R.message,u.delimitedEncoding=!1,u.enum=R.enum,u.scalar=R.scalar,u}switch(u.fieldKind="list",G){case dn:case un:u.listKind="message",u.message=t.getMessage(le(e.typeName)),j(u.message),u.delimitedEncoding=Mo(e,n);break;case wo:u.listKind="enum",u.enum=t.getEnum(le(e.typeName)),j(u.enum);break;default:u.listKind="scalar",u.scalar=G,u.longAsString=E==No;break}return u.packed=fc(e,n),u}switch(G){case dn:case un:u.fieldKind="message",u.message=t.getMessage(le(e.typeName)),j(u.message,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),u.delimitedEncoding=Mo(e,n),u.getDefaultValue=()=>{};break;case wo:{let m=t.getEnum(le(e.typeName));j(m!==void 0,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),u.fieldKind="enum",u.enum=t.getEnum(le(e.typeName)),u.getDefaultValue=()=>Ge(e,"defaultValue")?Yo(m,e.defaultValue):void 0;break}default:{u.fieldKind="scalar",u.scalar=G,u.longAsString=E==No,u.getDefaultValue=()=>Ge(e,"defaultValue")?Fo(G,e.defaultValue):void 0;break}}return u}function dc(e){switch(e.syntax){case"":case"proto2":return Os;case"proto3":return Ps;case"editions":if(e.edition===_s)return sc;if(e.edition in zo)return e.edition;throw new Error(`${e.name}: unsupported edition`);default:throw new Error(`${e.name}: unsupported syntax "${e.syntax}"`)}}function uc(e,n){return e.dependency.map(t=>{let r=n.getFile(t);if(!r)throw new Error(`Cannot find ${t}, imported by ${e.name}`);return r})}function mc(e,n){let t=gc(e)+"_";for(let r of n){if(!r.name.toLowerCase().startsWith(t))return;let o=r.name.substring(t.length);if(o.length==0||/^\d/.test(o))return}return t}function gc(e){return(e.substring(0,1)+e.substring(1).replace(/[A-Z]/g,n=>"_"+n)).toLowerCase()}function On(e,n,t){let r;return n?r=`${n.typeName}.${e.name}`:t.proto.package.length>0?r=`${t.proto.package}.${e.name}`:r=`${e.name}`,r}function le(e){return e.startsWith(".")?e.substring(1):e}function bc(e,n){if(!Ge(e,"oneofIndex")||e.proto3Optional)return;let t=n[e.oneofIndex];return j(t,`invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`),t}function pc(e,n,t,r){if(e.label==qs)return nc;if(e.label==lr)return vo;if(n||e.proto3Optional||t)return ar;let o=Ve("fieldPresence",{proto:e,parent:r});return o==vo&&(e.type==dn||e.type==un)?ar:o}function fc(e,n){if(e.label!=lr)return!1;switch(e.type){case js:case $s:case un:case dn:return!1}let t=e.options;return t&&Ge(t,"packed")?t.packed:tc==Ve("repeatedFieldEncoding",{proto:e,parent:n})}function yc(e){let n=e.fields.find(r=>r.number===1),t=e.fields.find(r=>r.number===2);return j(n&&n.fieldKind=="scalar"&&n.scalar!=i.BYTES&&n.scalar!=i.FLOAT&&n.scalar!=i.DOUBLE&&t&&t.fieldKind!="list"&&t.fieldKind!="map"),{key:n,value:t}}function hc(e){var n;return oc==Ve("enumType",{proto:e.proto,parent:(n=e.parent)!==null&&n!==void 0?n:e.file})}function Mo(e,n){return e.type==un?!0:rc==Ve("messageEncoding",{proto:e,parent:n})}function Ic(e,n){return ac==Ve("utf8Validation",{proto:e,parent:n})}function Ve(e,n){var t,r;let o=(t=n.proto.options)===null||t===void 0?void 0:t.features;if(o){let a=o[e];if(a!=0)return a}if("kind"in n){if(n.kind=="message")return Ve(e,(r=n.parent)!==null&&r!==void 0?r:n.file);let a=zo[n.edition];if(!a)throw new Error(`feature default for edition ${n.edition} not found`);return a[e]}return Ve(e,n.parent)}function j(e,n){if(!e)throw new Error(n)}function Uo(e){let n=Gc(e);return n.messageType.forEach(ln),Dn(n,()=>{}).getFile(n.name)}function Gc(e){return Object.assign(Object.create({syntax:"",edition:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FileDescriptorProto",dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},e),{messageType:e.messageType.map(Ko),enumType:e.enumType.map(To)}))}function Ko(e){var n,t,r,o,a,s,c,d;return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.DescriptorProto",name:e.name,field:(t=(n=e.field)===null||n===void 0?void 0:n.map(Ac))!==null&&t!==void 0?t:[],extension:[],nestedType:(o=(r=e.nestedType)===null||r===void 0?void 0:r.map(Ko))!==null&&o!==void 0?o:[],enumType:(s=(a=e.enumType)===null||a===void 0?void 0:a.map(To))!==null&&s!==void 0?s:[],extensionRange:(d=(c=e.extensionRange)===null||c===void 0?void 0:c.map(y=>Object.assign({$typeName:"google.protobuf.DescriptorProto.ExtensionRange"},y)))!==null&&d!==void 0?d:[],oneofDecl:[],reservedRange:[],reservedName:[]})}function Ac(e){return Object.assign(Object.create({label:1,typeName:"",extendee:"",defaultValue:"",oneofIndex:0,jsonName:"",proto3Optional:!1}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldDescriptorProto"},e),{options:e.options?Zc(e.options):void 0}))}function Zc(e){var n,t,r;return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldOptions"},e),{targets:(n=e.targets)!==null&&n!==void 0?n:[],editionDefaults:(r=(t=e.editionDefaults)===null||t===void 0?void 0:t.map(a=>Object.assign({$typeName:"google.protobuf.FieldOptions.EditionDefault"},a)))!==null&&r!==void 0?r:[],uninterpretedOption:[]}))}function To(e){return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.EnumDescriptorProto",name:e.name,reservedName:[],reservedRange:[],value:e.value.map(t=>Object.assign({$typeName:"google.protobuf.EnumValueDescriptorProto"},t))})}function l(e,n,...t){return t.reduce((r,o)=>r.nestedMessages[o],e.messages[n])}function Z(e,n,...t){if(t.length==0)return e.enums[n];let r=t.pop();return t.reduce((o,a)=>o.nestedMessages[a],e.messages[n]).nestedEnums[r]}var p=Uo({name:"google/protobuf/descriptor.proto",package:"google.protobuf",messageType:[{name:"FileDescriptorSet",field:[{name:"file",number:1,type:11,label:3,typeName:".google.protobuf.FileDescriptorProto"}],extensionRange:[{start:536e6,end:536000001}]},{name:"FileDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"package",number:2,type:9,label:1},{name:"dependency",number:3,type:9,label:3},{name:"public_dependency",number:10,type:5,label:3},{name:"weak_dependency",number:11,type:5,label:3},{name:"option_dependency",number:15,type:9,label:3},{name:"message_type",number:4,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:5,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"service",number:6,type:11,label:3,typeName:".google.protobuf.ServiceDescriptorProto"},{name:"extension",number:7,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FileOptions"},{name:"source_code_info",number:9,type:11,label:1,typeName:".google.protobuf.SourceCodeInfo"},{name:"syntax",number:12,type:9,label:1},{name:"edition",number:14,type:14,label:1,typeName:".google.protobuf.Edition"}]},{name:"DescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"field",number:2,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"extension",number:6,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"nested_type",number:3,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"extension_range",number:5,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ExtensionRange"},{name:"oneof_decl",number:8,type:11,label:3,typeName:".google.protobuf.OneofDescriptorProto"},{name:"options",number:7,type:11,label:1,typeName:".google.protobuf.MessageOptions"},{name:"reserved_range",number:9,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ReservedRange"},{name:"reserved_name",number:10,type:9,label:3},{name:"visibility",number:11,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"ExtensionRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ExtensionRangeOptions"}]},{name:"ReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"ExtensionRangeOptions",field:[{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"},{name:"declaration",number:2,type:11,label:3,typeName:".google.protobuf.ExtensionRangeOptions.Declaration",options:{retention:2}},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"verification",number:3,type:14,label:1,typeName:".google.protobuf.ExtensionRangeOptions.VerificationState",defaultValue:"UNVERIFIED",options:{retention:2}}],nestedType:[{name:"Declaration",field:[{name:"number",number:1,type:5,label:1},{name:"full_name",number:2,type:9,label:1},{name:"type",number:3,type:9,label:1},{name:"reserved",number:5,type:8,label:1},{name:"repeated",number:6,type:8,label:1}]}],enumType:[{name:"VerificationState",value:[{name:"DECLARATION",number:0},{name:"UNVERIFIED",number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:3,type:5,label:1},{name:"label",number:4,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Label"},{name:"type",number:5,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Type"},{name:"type_name",number:6,type:9,label:1},{name:"extendee",number:2,type:9,label:1},{name:"default_value",number:7,type:9,label:1},{name:"oneof_index",number:9,type:5,label:1},{name:"json_name",number:10,type:9,label:1},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FieldOptions"},{name:"proto3_optional",number:17,type:8,label:1}],enumType:[{name:"Type",value:[{name:"TYPE_DOUBLE",number:1},{name:"TYPE_FLOAT",number:2},{name:"TYPE_INT64",number:3},{name:"TYPE_UINT64",number:4},{name:"TYPE_INT32",number:5},{name:"TYPE_FIXED64",number:6},{name:"TYPE_FIXED32",number:7},{name:"TYPE_BOOL",number:8},{name:"TYPE_STRING",number:9},{name:"TYPE_GROUP",number:10},{name:"TYPE_MESSAGE",number:11},{name:"TYPE_BYTES",number:12},{name:"TYPE_UINT32",number:13},{name:"TYPE_ENUM",number:14},{name:"TYPE_SFIXED32",number:15},{name:"TYPE_SFIXED64",number:16},{name:"TYPE_SINT32",number:17},{name:"TYPE_SINT64",number:18}]},{name:"Label",value:[{name:"LABEL_OPTIONAL",number:1},{name:"LABEL_REPEATED",number:3},{name:"LABEL_REQUIRED",number:2}]}]},{name:"OneofDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"options",number:2,type:11,label:1,typeName:".google.protobuf.OneofOptions"}]},{name:"EnumDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"value",number:2,type:11,label:3,typeName:".google.protobuf.EnumValueDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumOptions"},{name:"reserved_range",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto.EnumReservedRange"},{name:"reserved_name",number:5,type:9,label:3},{name:"visibility",number:6,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"EnumReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"EnumValueDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumValueOptions"}]},{name:"ServiceDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"method",number:2,type:11,label:3,typeName:".google.protobuf.MethodDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ServiceOptions"}]},{name:"MethodDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"input_type",number:2,type:9,label:1},{name:"output_type",number:3,type:9,label:1},{name:"options",number:4,type:11,label:1,typeName:".google.protobuf.MethodOptions"},{name:"client_streaming",number:5,type:8,label:1,defaultValue:"false"},{name:"server_streaming",number:6,type:8,label:1,defaultValue:"false"}]},{name:"FileOptions",field:[{name:"java_package",number:1,type:9,label:1},{name:"java_outer_classname",number:8,type:9,label:1},{name:"java_multiple_files",number:10,type:8,label:1,defaultValue:"false",options:{}},{name:"java_generate_equals_and_hash",number:20,type:8,label:1,options:{deprecated:!0}},{name:"java_string_check_utf8",number:27,type:8,label:1,defaultValue:"false"},{name:"optimize_for",number:9,type:14,label:1,typeName:".google.protobuf.FileOptions.OptimizeMode",defaultValue:"SPEED"},{name:"go_package",number:11,type:9,label:1},{name:"cc_generic_services",number:16,type:8,label:1,defaultValue:"false"},{name:"java_generic_services",number:17,type:8,label:1,defaultValue:"false"},{name:"py_generic_services",number:18,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:23,type:8,label:1,defaultValue:"false"},{name:"cc_enable_arenas",number:31,type:8,label:1,defaultValue:"true"},{name:"objc_class_prefix",number:36,type:9,label:1},{name:"csharp_namespace",number:37,type:9,label:1},{name:"swift_prefix",number:39,type:9,label:1},{name:"php_class_prefix",number:40,type:9,label:1},{name:"php_namespace",number:41,type:9,label:1},{name:"php_metadata_namespace",number:44,type:9,label:1},{name:"ruby_package",number:45,type:9,label:1},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"OptimizeMode",value:[{name:"SPEED",number:1},{name:"CODE_SIZE",number:2},{name:"LITE_RUNTIME",number:3}]}],extensionRange:[{st