@mochabug/adapt-web
Version:
Browser client library for Adapt automation platform
3 lines • 365 kB
JavaScript
var __MbAdapt_prev = typeof MbAdapt !== 'undefined' ? MbAdapt : undefined;
"use strict";var MbAdapt=(()=>{var qn=Object.defineProperty;var is=Object.getOwnPropertyDescriptor;var as=Object.getOwnPropertyNames;var ss=Object.prototype.hasOwnProperty;var ls=(t,e)=>{for(var n in e)qn(t,n,{get:e[n],enumerable:!0})},cs=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of as(e))!ss.call(t,r)&&r!==n&&qn(t,r,{get:()=>e[r],enumerable:!(o=is(e,r))||o.enumerable});return t};var ds=t=>cs(qn({},"__esModule",{value:!0}),t);var od={};ls(od,{AdaptAutomationElement:()=>ct,FloatingToolbar:()=>Me,ForkGroupActions:()=>Fe,IframePanelComponent:()=>Ie,MinimizeManager:()=>Je,PanelManager:()=>Ye,WebClient:()=>lt,clearPersistedState:()=>rs,configure:()=>Tn,createConnectClient:()=>Kn,resetConfig:()=>Dn,resolveTheme:()=>Dt});function mt(t,e){return t!==null&&typeof t=="object"&&"$typeName"in t&&typeof t.$typeName=="string"?e===void 0?!0:e.typeName===t.$typeName:!1}var d;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(d||(d={}));function Wr(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<o,(r&128)==0)return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,(n&128)==0)return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<o,(r&128)==0)return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Qt(t,e,n){for(let i=0;i<28;i=i+7){let a=t>>>i,s=!(!(a>>>7)&&e==0),l=(s?a|128:a)&255;if(n.push(l),!s)return}let o=t>>>28&15|(e&7)<<4,r=e>>3!=0;if(n.push((r?o|128:o)&255),!!r){for(let i=3;i<31;i=i+7){let a=e>>>i,s=!!(a>>>7),l=(s?a|128:a)&255;if(n.push(l),!s)return}n.push(e>>>31&1)}}var _t=4294967296;function eo(t){let e=t[0]==="-";e&&(t=t.slice(1));let n=1e6,o=0,r=0;function i(a,s){let l=Number(t.slice(a,s));r*=n,o=o*n+l,o>=_t&&(r=r+(o/_t|0),o=o%_t)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),e?Jr(o,r):no(o,r)}function kr(t,e){let n=no(t,e),o=n.hi&2147483648;o&&(n=Jr(n.lo,n.hi));let r=to(n.lo,n.hi);return o?"-"+r:r}function to(t,e){if({lo:t,hi:e}=us(t,e),e<=2097151)return String(_t*e+t);let n=t&16777215,o=(t>>>24|e<<8)&16777215,r=e>>16&65535,i=n+o*6777216+r*6710656,a=o+r*8147497,s=r*2,l=1e7;return i>=l&&(a+=Math.floor(i/l),i%=l),a>=l&&(s+=Math.floor(a/l),a%=l),s.toString()+wr(a)+wr(i)}function us(t,e){return{lo:t>>>0,hi:e>>>0}}function no(t,e){return{lo:t|0,hi:e|0}}function Jr(t,e){return e=~e,t?t=~t+1:e+=1,no(t,e)}var wr=t=>{let e=String(t);return"0000000".slice(e.length)+e};function pt(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function Mr(){let t=this.buf[this.pos++],e=t&127;if((t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,(t&128)==0)return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;(t&128)!==0&&n<10;n++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var w=ms();function ms(){let t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(!!globalThis.Deno||!!globalThis.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let n=BigInt("-9223372036854775808"),o=BigInt("9223372036854775807"),r=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>o||s<n)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<r)throw new Error(`invalid uint64: ${a}`);return s},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(a,s){return t.setInt32(0,a,!0),t.setInt32(4,s,!0),t.getBigInt64(0,!0)},uDec(a,s){return t.setInt32(0,a,!0),t.setInt32(4,s,!0),t.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(n){return typeof n!="string"&&(n=n.toString()),Fr(n),n},uParse(n){return typeof n!="string"&&(n=n.toString()),Yr(n),n},enc(n){return typeof n!="string"&&(n=n.toString()),Fr(n),eo(n)},uEnc(n){return typeof n!="string"&&(n=n.toString()),Yr(n),eo(n)},dec(n,o){return kr(n,o)},uDec(n,o){return to(n,o)}}}function Fr(t){if(!/^-?[0-9]+$/.test(t))throw new Error("invalid int64: "+t)}function Yr(t){if(!/^[0-9]+$/.test(t))throw new Error("invalid uint64: "+t)}function j(t,e){switch(t){case d.STRING:return"";case d.BOOL:return!1;case d.DOUBLE:case d.FLOAT:return 0;case d.INT64:case d.UINT64:case d.SFIXED64:case d.FIXED64:case d.SINT64:return e?"0":w.zero;case d.BYTES:return new Uint8Array(0);default:return 0}}function zr(t,e){switch(t){case d.BOOL:return e===!1;case d.STRING:return e==="";case d.BYTES:return e instanceof Uint8Array&&!e.byteLength;case d.DOUBLE:case d.FLOAT:return Object.is(e,0);default:return e==0}}var Nr=2,$=Symbol.for("reflect unsafe local");function Pt(t,e){let n=t[e.localName].case;return n===void 0?n:e.fields.find(o=>o.localName===n)}function oo(t,e){let n=e.localName;if(e.oneof)return t[e.oneof.localName].case===n;if(e.presence!=Nr)return t[n]!==void 0&&Object.prototype.hasOwnProperty.call(t,n);switch(e.fieldKind){case"list":return t[n].length>0;case"map":return Object.keys(t[n]).length>0;case"scalar":return!zr(e.scalar,t[n]);case"enum":return t[n]!==e.enum.values[0].number}throw new Error("message field with implicit presence")}function Ve(t,e){return Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==void 0}function Ot(t,e){if(e.oneof){let n=t[e.oneof.localName];return n.case===e.localName?n.value:void 0}return t[e.localName]}function jt(t,e,n){e.oneof?t[e.oneof.localName]={case:e.localName,value:n}:t[e.localName]=n}function ro(t,e){let n=e.localName;if(e.oneof){let o=e.oneof.localName;t[o].case===n&&(t[o]={case:void 0})}else if(e.presence!=Nr)delete t[n];else switch(e.fieldKind){case"map":t[n]={};break;case"list":t[n]=[];break;case"enum":t[n]=e.enum.values[0].number;break;case"scalar":t[n]=j(e.scalar,e.longAsString);break}}function re(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gt(t,e){var n,o,r,i;if(re(t)&&$ in t&&"add"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let a=e,s=t.field();return a.listKind==s.listKind&&a.scalar===s.scalar&&((n=a.message)===null||n===void 0?void 0:n.typeName)===((o=s.message)===null||o===void 0?void 0:o.typeName)&&((r=a.enum)===null||r===void 0?void 0:r.typeName)===((i=s.enum)===null||i===void 0?void 0:i.typeName)}return!0}return!1}function ht(t,e){var n,o,r,i;if(re(t)&&$ in t&&"has"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let a=e,s=t.field();return a.mapKey===s.mapKey&&a.mapKind==s.mapKind&&a.scalar===s.scalar&&((n=a.message)===null||n===void 0?void 0:n.typeName)===((o=s.message)===null||o===void 0?void 0:o.typeName)&&((r=a.enum)===null||r===void 0?void 0:r.typeName)===((i=s.enum)===null||i===void 0?void 0:i.typeName)}return!0}return!1}function Le(t,e){return re(t)&&$ in t&&"desc"in t&&re(t.desc)&&t.desc.kind==="message"&&(e===void 0||t.desc.typeName==e.typeName)}function Lr(t){return Hr(t.$typeName)}function q(t){let e=t.fields[0];return Hr(t.typeName)&&e!==void 0&&e.fieldKind=="scalar"&&e.name=="value"&&e.number==1}function $t(t){switch(t.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 q(t)}}function Hr(t){return t.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(t.substring(16))}var ps=999,gs=998,qt=2;function W(t,e){if(mt(e,t))return e;let n=Is(t);return e!==void 0&&hs(t,n,e),n}function hs(t,e,n){for(let o of t.members){let r=n[o.localName];if(r==null)continue;let i;if(o.kind=="oneof"){let a=Pt(n,o);if(!a)continue;i=a,r=Ot(n,a)}else i=o;switch(i.fieldKind){case"message":r=ao(i,r);break;case"scalar":r=Ur(i,r);break;case"list":r=bs(i,r);break;case"map":r=fs(i,r);break}jt(e,i,r)}return e}function Ur(t,e){return t.scalar==d.BYTES?so(e):e}function fs(t,e){if(re(e)){if(t.scalar==d.BYTES)return Tr(e,so);if(t.mapKind=="message")return Tr(e,n=>ao(t,n))}return e}function bs(t,e){if(Array.isArray(e)){if(t.scalar==d.BYTES)return e.map(so);if(t.listKind=="message")return e.map(n=>ao(t,n))}return e}function ao(t,e){if(t.fieldKind=="message"&&!t.oneof&&q(t.message))return Ur(t.message.fields[0],e);if(re(e)){if(t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!=="google.protobuf.Value")return e;if(!mt(e,t.message))return W(t.message,e)}return e}function so(t){return Array.isArray(t)?new Uint8Array(t):t}function Tr(t,e){let n={};for(let o of Object.entries(t))n[o[0]]=e(o[1]);return n}var ys=Symbol(),Dr=new WeakMap;function Is(t){let e;if(Gs(t)){let n=Dr.get(t),o,r;if(n)({prototype:o,members:r}=n);else{o={},r=new Set;for(let i of t.members)i.kind!="oneof"&&(i.fieldKind!="scalar"&&i.fieldKind!="enum"||i.presence!=qt&&(r.add(i),o[i.localName]=io(i)));Dr.set(t,{prototype:o,members:r})}e=Object.create(o),e.$typeName=t.typeName;for(let i of t.members)r.has(i)||i.kind=="field"&&(i.fieldKind=="message"||(i.fieldKind=="scalar"||i.fieldKind=="enum")&&i.presence!=qt)||(e[i.localName]=io(i))}else{e={$typeName:t.typeName};for(let n of t.members)(n.kind=="oneof"||n.presence==qt)&&(e[n.localName]=io(n))}return e}function Gs(t){switch(t.file.edition){case ps:return!1;case gs:return!0;default:return t.fields.some(e=>e.presence!=qt&&e.fieldKind!="message"&&!e.oneof)}}function io(t){if(t.kind=="oneof")return{case:void 0};if(t.fieldKind=="list")return[];if(t.fieldKind=="map")return{};if(t.fieldKind=="message")return ys;let e=t.getDefaultValue();return e!==void 0?t.fieldKind=="scalar"&&t.longAsString?e.toString():e:t.fieldKind=="scalar"?j(t.scalar,t.longAsString):t.enum.values[0].number}var As=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"],z=class extends Error{constructor(e,n,o="FieldValueInvalidError"){super(n),this.name=o,this.field=()=>e}};function Kr(t){return t instanceof Error&&As.includes(t.name)&&"field"in t&&typeof t.field=="function"}var lo=Symbol.for("@bufbuild/protobuf/text-encoding");function ft(){if(globalThis[lo]==null){let t=new globalThis.TextEncoder,e=new globalThis.TextDecoder,n;globalThis[lo]={encodeUtf8(o){return t.encode(o)},decodeUtf8(o,r){return r?(n===void 0&&(n=new globalThis.TextDecoder("utf-8",{fatal:!0})),n.decode(o)):e.decode(o)},checkUtf8(o){try{return encodeURIComponent(o),!0}catch{return!1}}}}return globalThis[lo]}var M;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(M||(M={}));var uo=34028234663852886e22,mo=-34028234663852886e22,po=4294967295,go=2147483647,ho=-2147483648,Ee=class{constructor(e=ft().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(_r(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return co(e),pt(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 n=this.encodeUtf8(e);return this.uint32(n.byteLength),this.raw(n)}float(e){vs(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){_r(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){co(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return co(e),e=(e<<1^e>>31)>>>0,pt(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=w.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=w.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=w.enc(e);return Qt(n.lo,n.hi,this.buf),this}sint64(e){let n=w.enc(e),o=n.hi>>31,r=n.lo<<1^o,i=(n.hi<<1|n.lo>>>31)^o;return Qt(r,i,this.buf),this}uint64(e){let n=w.uEnc(e);return Qt(n.lo,n.hi,this.buf),this}},Ge=class{constructor(e,n=ft().decodeUtf8){this.decodeUtf8=n,this.varint64=Wr,this.uint32=Mr,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,n=this.uint32(),o=this.pos-e;if(o>5||o==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let r=n>>>3,i=n&7;if(r<=0||i>5)throw new Error("illegal tag: field no "+r+" wire type "+i);return[r,i]}skip(e,n,o=100){let r=this.pos;switch(e){case M.Varint:for(;this.buf[this.pos++]&128;);break;case M.Bit64:this.pos+=4;case M.Bit32:this.pos+=4;break;case M.LengthDelimited:let i=this.uint32();this.pos+=i;break;case M.StartGroup:if(o<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===M.EndGroup){if(n!==void 0&&a!==n)throw new Error("invalid end group tag");break}this.skip(s,a,o-1)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return w.dec(...this.varint64())}uint64(){return w.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(e&1);return e=(e>>>1|(n&1)<<31)^o,n=n>>>1^o,w.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return w.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return w.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(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(e){return this.decodeUtf8(this.bytes(),e)}};function co(t){if(typeof t=="string")t=Number(t);else if(typeof t!="number")throw new Error("invalid int32: "+typeof t);if(!Number.isInteger(t)||t>go||t<ho)throw new Error("invalid int32: "+t)}function _r(t){if(typeof t=="string")t=Number(t);else if(typeof t!="number")throw new Error("invalid uint32: "+typeof t);if(!Number.isInteger(t)||t>po||t<0)throw new Error("invalid uint32: "+t)}function vs(t){if(typeof t=="string"){let e=t;if(t=Number(t),Number.isNaN(t)&&e!=="NaN")throw new Error("invalid float32: "+e)}else if(typeof t!="number")throw new Error("invalid float32: "+typeof t);if(Number.isFinite(t)&&(t>uo||t<mo))throw new Error("invalid float32: "+t)}function pe(t,e){let n=t.fieldKind=="list"?gt(e,t):t.fieldKind=="map"?ht(e,t):yo(t,e);if(n===!0)return;let o;switch(t.fieldKind){case"list":o=`expected ${Or(t)}, got ${N(e)}`;break;case"map":o=`expected ${jr(t)}, got ${N(e)}`;break;default:o=en(t,e,n)}return new z(t,o)}function bo(t,e,n){let o=yo(t,n);if(o!==!0)return new z(t,`list item #${e+1}: ${en(t,n,o)}`)}function Qr(t,e,n){let o=fo(e,t.mapKey);if(o!==!0)return new z(t,`invalid map key: ${en({scalar:t.mapKey},e,o)}`);let r=yo(t,n);if(r!==!0)return new z(t,`map entry ${N(e)}: ${en(t,n,r)}`)}function yo(t,e){return t.scalar!==void 0?fo(e,t.scalar):t.enum!==void 0?t.enum.open?fo(e,d.INT32):t.enum.values.some(n=>n.number===e):Le(e,t.message)}function fo(t,e){switch(e){case d.DOUBLE:return typeof t=="number";case d.FLOAT:return typeof t!="number"?!1:Number.isNaN(t)||!Number.isFinite(t)?!0:t>uo||t<mo?`${t.toFixed()} out of range`:!0;case d.INT32:case d.SFIXED32:case d.SINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>go||t<ho?`${t.toFixed()} out of range`:!0;case d.FIXED32:case d.UINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>po||t<0?`${t.toFixed()} out of range`:!0;case d.BOOL:return typeof t=="boolean";case d.STRING:return typeof t!="string"?!1:ft().checkUtf8(t)||"invalid UTF8";case d.BYTES:return t instanceof Uint8Array;case d.INT64:case d.SFIXED64:case d.SINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return w.parse(t),!0}catch{return`${t} out of range`}return!1;case d.FIXED64:case d.UINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return w.uParse(t),!0}catch{return`${t} out of range`}return!1}}function en(t,e,n){return n=typeof n=="string"?`: ${n}`:`, got ${N(e)}`,t.scalar!==void 0?`expected ${Cs(t.scalar)}`+n:t.enum!==void 0?`expected ${t.enum.toString()}`+n:`expected ${Pr(t.message)}`+n}function N(t){switch(typeof t){case"object":return t===null?"null":t instanceof Uint8Array?`Uint8Array(${t.length})`:Array.isArray(t)?`Array(${t.length})`:gt(t)?Or(t.field()):ht(t)?jr(t.field()):Le(t)?Pr(t.desc):mt(t)?`message ${t.$typeName}`:"object";case"string":return t.length>30?"string":`"${t.split('"').join('\\"')}"`;case"boolean":return String(t);case"number":return String(t);case"bigint":return String(t)+"n";default:return typeof t}}function Pr(t){return`ReflectMessage (${t.typeName})`}function Or(t){switch(t.listKind){case"message":return`ReflectList (${t.message.toString()})`;case"enum":return`ReflectList (${t.enum.toString()})`;case"scalar":return`ReflectList (${d[t.scalar]})`}}function jr(t){switch(t.mapKind){case"message":return`ReflectMap (${d[t.mapKey]}, ${t.message.toString()})`;case"enum":return`ReflectMap (${d[t.mapKey]}, ${t.enum.toString()})`;case"scalar":return`ReflectMap (${d[t.mapKey]}, ${d[t.scalar]})`}}function Cs(t){switch(t){case d.STRING:return"string";case d.BOOL:return"boolean";case d.INT64:case d.SINT64:case d.SFIXED64:return"bigint (int64)";case d.UINT64:case d.FIXED64:return"bigint (uint64)";case d.BYTES:return"Uint8Array";case d.DOUBLE:return"number (float64)";case d.FLOAT:return"number (float32)";case d.FIXED32:case d.UINT32:return"number (uint32)";case d.INT32:case d.SFIXED32:case d.SINT32:return"number (int32)"}}function H(t,e,n=!0){return new nn(t,e,n)}var $r=new WeakMap,nn=class{get sortedFields(){let e=$r.get(this.desc);if(e)return e;let n=this.desc.fields.concat().sort((o,r)=>o.number-r.number);return $r.set(this.desc,n),n}constructor(e,n,o=!0){this.lists=new Map,this.maps=new Map,this.check=o,this.desc=e,this.message=this[$]=n??W(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(n=>[n.number,n]))),this._fieldsByNumber.get(e)}oneofCase(e){return bt(this.message,e),Pt(this.message,e)}isSet(e){return bt(this.message,e),oo(this.message,e)}clear(e){bt(this.message,e),ro(this.message,e)}get(e){bt(this.message,e);let n=Ot(this.message,e);switch(e.fieldKind){case"list":let o=this.lists.get(e);return(!o||o[$]!==n)&&this.lists.set(e,o=new Ao(e,n,this.check)),o;case"map":let r=this.maps.get(e);return(!r||r[$]!==n)&&this.maps.set(e,r=new vo(e,n,this.check)),r;case"message":return xo(e,n,this.check);case"scalar":return n===void 0?j(e.scalar,!1):So(e,n);case"enum":return n??e.enum.values[0].number}}set(e,n){if(bt(this.message,e),this.check){let r=pe(e,n);if(r)throw r}let o;e.fieldKind=="message"?o=Co(e,n):ht(n)||gt(n)?o=n[$]:o=Zo(e,n),jt(this.message,e,o)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function bt(t,e){if(e.parent.typeName!==t.$typeName)throw new z(e,`cannot use ${e.toString()} with message ${t.$typeName}`,"ForeignFieldError")}var Ao=class{field(){return this._field}get size(){return this._arr.length}constructor(e,n,o){this._field=e,this._arr=this[$]=n,this.check=o}get(e){let n=this._arr[e];return n===void 0?void 0:Io(this._field,n,this.check)}set(e,n){if(e<0||e>=this._arr.length)throw new z(this._field,`list item #${e+1}: out of range`);if(this.check){let o=bo(this._field,e,n);if(o)throw o}this._arr[e]=qr(this._field,n)}add(e){if(this.check){let n=bo(this._field,this._arr.length,e);if(n)throw n}this._arr.push(qr(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let e of this._arr)yield Io(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,Io(this._field,this._arr[e],this.check)]}};var vo=class{constructor(e,n,o=!0){this.obj=this[$]=n??{},this.check=o,this._field=e}field(){return this._field}set(e,n){if(this.check){let o=Qr(this._field,e,n);if(o)throw o}return this.obj[tn(e)]=xs(this._field,n),this}delete(e){let n=tn(e),o=Object.prototype.hasOwnProperty.call(this.obj,n);return o&&delete this.obj[n],o}clear(){for(let e of Object.keys(this.obj))delete this.obj[e]}get(e){let n=this.obj[tn(e)];return n!==void 0&&(n=Go(this._field,n,this.check)),n}has(e){return Object.prototype.hasOwnProperty.call(this.obj,tn(e))}*keys(){for(let e of Object.keys(this.obj))yield ei(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[ei(e[0],this._field.mapKey),Go(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let e of Object.values(this.obj))yield Go(this._field,e,this.check)}forEach(e,n){for(let o of this.entries())e.call(n,o[1],o[0],this)}};function Co(t,e){return Le(e)?Lr(e.message)&&!t.oneof&&t.fieldKind=="message"?e.message.value:e.desc.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"?ni(e.message):e.message:e}function xo(t,e,n){return e!==void 0&&(q(t.message)&&!t.oneof&&t.fieldKind=="message"?e={$typeName:t.message.typeName,value:So(t.message.fields[0],e)}:t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"&&re(e)&&(e=ti(e))),new nn(t.message,e,n)}function qr(t,e){return t.listKind=="message"?Co(t,e):Zo(t,e)}function Io(t,e,n){return t.listKind=="message"?xo(t,e,n):So(t,e)}function xs(t,e){return t.mapKind=="message"?Co(t,e):Zo(t,e)}function Go(t,e,n){return t.mapKind=="message"?xo(t,e,n):e}function tn(t){return typeof t=="string"||typeof t=="number"?t:String(t)}function ei(t,e){switch(e){case d.STRING:return t;case d.INT32:case d.FIXED32:case d.UINT32:case d.SFIXED32:case d.SINT32:{let n=Number.parseInt(t);if(Number.isFinite(n))return n;break}case d.BOOL:switch(t){case"true":return!0;case"false":return!1}break;case d.UINT64:case d.FIXED64:try{return w.uParse(t)}catch{}break;default:try{return w.parse(t)}catch{}break}return t}function So(t,e){switch(t.scalar){case d.INT64:case d.SFIXED64:case d.SINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=w.parse(e));break;case d.FIXED64:case d.UINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=w.uParse(e));break}return e}function Zo(t,e){switch(t.scalar){case d.INT64:case d.SFIXED64:case d.SINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=w.parse(e));break;case d.FIXED64:case d.UINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=w.uParse(e));break}return e}function ti(t){let e={$typeName:"google.protobuf.Struct",fields:{}};if(re(t))for(let[n,o]of Object.entries(t))e.fields[n]=ri(o);return e}function ni(t){let e={};for(let[n,o]of Object.entries(t.fields))e[n]=oi(o);return e}function oi(t){switch(t.kind.case){case"structValue":return ni(t.kind.value);case"listValue":return t.kind.value.values.map(oi);case"nullValue":case void 0:return null;default:return t.kind.value}}function ri(t){let e={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof t){case"number":e.kind={case:"numberValue",value:t};break;case"string":e.kind={case:"stringValue",value:t};break;case"boolean":e.kind={case:"boolValue",value:t};break;case"object":if(t===null)e.kind={case:"nullValue",value:0};else if(Array.isArray(t)){let n={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(t))for(let o of t)n.values.push(ri(o));e.kind={case:"listValue",value:n}}else e.kind={case:"structValue",value:ti(t)};break}return e}function Ae(t){let e=Ss(),n=t.length*3/4;t[t.length-2]=="="?n-=2:t[t.length-1]=="="&&(n-=1);let o=new Uint8Array(n),r=0,i=0,a,s=0;for(let l=0;l<t.length;l++){if(a=e[t.charCodeAt(l)],a===void 0)switch(t[l]){case"=":i=0;case`
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string")}switch(i){case 0:s=a,i=1;break;case 1:o[r++]=s<<2|(a&48)>>4,s=a,i=2;break;case 2:o[r++]=(s&15)<<4|(a&60)>>2,s=a,i=3;break;case 3:o[r++]=(s&3)<<6|a,i=0;break}}if(i==1)throw Error("invalid base64 string");return o.subarray(0,r)}function Xe(t,e="std"){let n=ai(e),o=e=="std",r="",i=0,a,s=0;for(let l=0;l<t.length;l++)switch(a=t[l],i){case 0:r+=n[a>>2],s=(a&3)<<4,i=1;break;case 1:r+=n[s|a>>4],s=(a&15)<<2,i=2;break;case 2:r+=n[s|a>>6],r+=n[a&63],i=0;break}return i&&(r+=n[s],o&&(r+="=",i==1&&(r+="="))),r}var on,ii,He;function ai(t){return on||(on="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ii=on.slice(0,-2).concat("-","_")),t=="url"?ii:on}function Ss(){if(!He){He=[];let t=ai("std");for(let e=0;e<t.length;e++)He[t[e].charCodeAt(0)]=e;He[45]=t.indexOf("+"),He[95]=t.indexOf("/")}return He}function ie(t){let e=!1,n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r);break}}return n.join("")}function rn(t){return t.replace(/[A-Z]/g,e=>"_"+e.toLowerCase())}var Zs=new Set(["constructor","toString","toJSON","valueOf"]);function Te(t){return Zs.has(t)?t+"$":t}function yt(t){for(let e of t.field)Ve(e,"jsonName")||(e.jsonName=ie(e.name));t.nestedType.forEach(yt)}function si(t,e){let n=t.values.find(o=>o.name===e);if(!n)throw new Error(`cannot parse ${t} default value: ${e}`);return n.number}function li(t,e){switch(t){case d.STRING:return e;case d.BYTES:{let n=Vs(e);if(n===!1)throw new Error(`cannot parse ${d[t]} default value: ${e}`);return n}case d.INT64:case d.SFIXED64:case d.SINT64:return w.parse(e);case d.UINT64:case d.FIXED64:return w.uParse(e);case d.DOUBLE:case d.FLOAT:switch(e){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(e)}case d.BOOL:return e==="true";case d.INT32:case d.UINT32:case d.SINT32:case d.FIXED32:case d.SFIXED32:return parseInt(e,10)}}function Vs(t){let e=[],n={tail:t,c:"",next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(o){if(this.tail.length>=o){let r=this.tail.substring(0,o);return this.tail=this.tail.substring(o),r}return!1}};for(;n.next();)switch(n.c){case"\\":if(n.next())switch(n.c){case"\\":e.push(n.c.charCodeAt(0));break;case"b":e.push(8);break;case"f":e.push(12);break;case"n":e.push(10);break;case"r":e.push(13);break;case"t":e.push(9);break;case"v":e.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let o=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(o+r,8);if(Number.isNaN(i))return!1;e.push(i);break}case"x":{let o=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(o+r,16);if(Number.isNaN(i))return!1;e.push(i);break}case"u":{let o=n.c,r=n.take(4);if(r===!1)return!1;let i=parseInt(o+r,16);if(Number.isNaN(i))return!1;let a=new Uint8Array(4);new DataView(a.buffer).setInt32(0,i,!0),e.push(a[0],a[1],a[2],a[3]);break}case"U":{let o=n.c,r=n.take(8);if(r===!1)return!1;let i=w.uEnc(o+r),a=new Uint8Array(8),s=new DataView(a.buffer);s.setInt32(0,i.lo,!0),s.setInt32(4,i.hi,!0),e.push(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);break}}break;default:e.push(n.c.charCodeAt(0))}return new Uint8Array(e)}function*an(t){switch(t.kind){case"file":for(let e of t.messages)yield e,yield*an(e);yield*t.enums,yield*t.services,yield*t.extensions;break;case"message":for(let e of t.nestedMessages)yield e,yield*an(e);yield*t.nestedEnums,yield*t.nestedExtensions;break}}function sn(...t){let e=Es();if(!t.length)return e;if("$typeName"in t[0]&&t[0].$typeName=="google.protobuf.FileDescriptorSet"){for(let n of t[0].file)mi(n,e);return e}if("$typeName"in t[0]){let i=function(a){let s=[];for(let l of a.dependency){if(e.getFile(l)!=null||r.has(l))continue;let c=o(l);if(!c)throw new Error(`Unable to resolve ${l}, imported by ${a.name}`);"kind"in c?e.addFile(c,!1,!0):(r.add(c.name),s.push(c))}return s.concat(...s.map(i))},n=t[0],o=t[1],r=new Set;for(let a of[n,...i(n)].reverse())mi(a,e)}else for(let n of t)for(let o of n.files)e.addFile(o);return e}function Es(){let t=new Map,e=new Map,n=new Map;return{kind:"registry",types:t,extendees:e,[Symbol.iterator](){return t.values()},get files(){return n.values()},addFile(o,r,i){if(n.set(o.proto.name,o),!r)for(let a of an(o))this.add(a);if(i)for(let a of o.dependencies)this.addFile(a,r,i)},add(o){if(o.kind=="extension"){let r=e.get(o.extendee.typeName);r||e.set(o.extendee.typeName,r=new Map),r.set(o.number,o)}t.set(o.typeName,o)},get(o){return t.get(o)},getFile(o){return n.get(o)},getMessage(o){let r=t.get(o);return r?.kind=="message"?r:void 0},getEnum(o){let r=t.get(o);return r?.kind=="enum"?r:void 0},getExtension(o){let r=t.get(o);return r?.kind=="extension"?r:void 0},getExtensionFor(o,r){var i;return(i=e.get(o.typeName))===null||i===void 0?void 0:i.get(r)},getService(o){let r=t.get(o);return r?.kind=="service"?r:void 0}}}var Xs=998,Bs=999,Rs=9999,ws=9,Gt=10,It=11,Ws=12,ci=14,Ro=3,ks=2,di=1,Js=0,Vo=1,ui=2,Ms=3,Fs=1,Ys=2,zs=1,Ns=2;var Ls=1001,gi={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 mi(t,e){var n,o;let r={kind:"file",proto:t,deprecated:(o=(n=t.options)===null||n===void 0?void 0:n.deprecated)!==null&&o!==void 0?o:!1,edition:Us(t),name:t.name.replace(/\.proto$/,""),dependencies:Ks(t,e),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${t.name}`}},i=new Map,a={get(s){return i.get(s)},add(s){var l;ee(((l=s.proto.options)===null||l===void 0?void 0:l.mapEntry)===!0),i.set(s.typeName,s)}};for(let s of t.enumType)hi(s,r,void 0,e);for(let s of t.messageType)fi(s,r,void 0,e,a);for(let s of t.service)Hs(s,r,e);Eo(r,e);for(let s of i.values())Xo(s,e,a);for(let s of r.messages)Xo(s,e,a),Eo(s,e);e.addFile(r,!0)}function Eo(t,e){switch(t.kind){case"file":for(let n of t.proto.extension){let o=Bo(n,t,e);t.extensions.push(o),e.add(o)}break;case"message":for(let n of t.proto.extension){let o=Bo(n,t,e);t.nestedExtensions.push(o),e.add(o)}for(let n of t.nestedMessages)Eo(n,e);break}}function Xo(t,e,n){let o=t.proto.oneofDecl.map(i=>Ds(i,t)),r=new Set;for(let i of t.proto.field){let a=Ps(i,o),s=Bo(i,t,e,a,n);t.fields.push(s),t.field[s.localName]=s,a===void 0?t.members.push(s):(a.fields.push(s),r.has(a)||(r.add(a),t.members.push(a)))}for(let i of o.filter(a=>r.has(a)))t.oneofs.push(i);for(let i of t.nestedMessages)Xo(i,e,n)}function hi(t,e,n,o){var r,i,a,s,l;let c=_s(t.name,t.value),m={kind:"enum",proto:t,deprecated:(i=(r=t.options)===null||r===void 0?void 0:r.deprecated)!==null&&i!==void 0?i:!1,file:e,parent:n,open:!0,name:t.name,typeName:ln(t,n,e),value:{},values:[],sharedPrefix:c,toString(){return`enum ${this.typeName}`}};m.open=qs(m),o.add(m);for(let g of t.value){let f=g.name;m.values.push(m.value[g.number]={kind:"enum_value",proto:g,deprecated:(s=(a=g.options)===null||a===void 0?void 0:a.deprecated)!==null&&s!==void 0?s:!1,parent:m,name:f,localName:Te(c==null?f:f.substring(c.length)),number:g.number,toString(){return`enum value ${m.typeName}.${f}`}})}((l=n?.nestedEnums)!==null&&l!==void 0?l:e.enums).push(m)}function fi(t,e,n,o,r){var i,a,s,l;let c={kind:"message",proto:t,deprecated:(a=(i=t.options)===null||i===void 0?void 0:i.deprecated)!==null&&a!==void 0?a:!1,file:e,parent:n,name:t.name,typeName:ln(t,n,e),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};((s=t.options)===null||s===void 0?void 0:s.mapEntry)===!0?r.add(c):(((l=n?.nestedMessages)!==null&&l!==void 0?l:e.messages).push(c),o.add(c));for(let m of t.enumType)hi(m,e,c,o);for(let m of t.nestedType)fi(m,e,c,o,r)}function Hs(t,e,n){var o,r;let i={kind:"service",proto:t,deprecated:(r=(o=t.options)===null||o===void 0?void 0:o.deprecated)!==null&&r!==void 0?r:!1,file:e,name:t.name,typeName:ln(t,void 0,e),methods:[],method:{},toString(){return`service ${this.typeName}`}};e.services.push(i),n.add(i);for(let a of t.method){let s=Ts(a,i,n);i.methods.push(s),i.method[s.localName]=s}}function Ts(t,e,n){var o,r,i,a;let s;t.clientStreaming&&t.serverStreaming?s="bidi_streaming":t.clientStreaming?s="client_streaming":t.serverStreaming?s="server_streaming":s="unary";let l=n.getMessage(ge(t.inputType)),c=n.getMessage(ge(t.outputType));ee(l,`invalid MethodDescriptorProto: input_type ${t.inputType} not found`),ee(c,`invalid MethodDescriptorProto: output_type ${t.inputType} not found`);let m=t.name;return{kind:"rpc",proto:t,deprecated:(r=(o=t.options)===null||o===void 0?void 0:o.deprecated)!==null&&r!==void 0?r:!1,parent:e,name:m,localName:Te(m.length?Te(m[0].toLowerCase()+m.substring(1)):m),methodKind:s,input:l,output:c,idempotency:(a=(i=t.options)===null||i===void 0?void 0:i.idempotencyLevel)!==null&&a!==void 0?a:Js,toString(){return`rpc ${e.typeName}.${m}`}}}function Ds(t,e){return{kind:"oneof",proto:t,deprecated:!1,parent:e,fields:[],name:t.name,localName:Te(ie(t.name)),toString(){return`oneof ${e.typeName}.${this.name}`}}}function Bo(t,e,n,o,r){var i,a,s;let l=r===void 0,c={kind:"field",proto:t,deprecated:(a=(i=t.options)===null||i===void 0?void 0:i.deprecated)!==null&&a!==void 0?a:!1,name:t.name,number:t.number,scalar:void 0,message:void 0,enum:void 0,presence:Os(t,o,l,e),utf8Validation:el(t,e),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(l){let p=e.kind=="file"?e:e.file,I=e.kind=="file"?void 0:e,x=ln(t,I,p);c.kind="extension",c.file=p,c.parent=I,c.oneof=void 0,c.typeName=x,c.jsonName=`[${x}]`,c.toString=()=>`extension ${x}`;let v=n.getMessage(ge(t.extendee));ee(v,`invalid FieldDescriptorProto: extendee ${t.extendee} not found`),c.extendee=v}else{let p=e;ee(p.kind=="message"),c.parent=p,c.oneof=o,c.localName=o?ie(t.name):Te(ie(t.name)),c.jsonName=t.jsonName,c.toString=()=>`field ${p.typeName}.${t.name}`}let m=t.label,g=t.type,f=(s=t.options)===null||s===void 0?void 0:s.jstype;if(m===Ro){let p=g==It?r?.get(ge(t.typeName)):void 0;if(p){c.fieldKind="map";let{key:I,value:x}=$s(p);return c.mapKey=I.scalar,c.mapKind=x.fieldKind,c.message=x.message,c.delimitedEncoding=!1,c.enum=x.enum,c.scalar=x.scalar,c}switch(c.fieldKind="list",g){case It:case Gt:c.listKind="message",c.message=n.getMessage(ge(t.typeName)),ee(c.message),c.delimitedEncoding=pi(t,e);break;case ci:c.listKind="enum",c.enum=n.getEnum(ge(t.typeName)),ee(c.enum);break;default:c.listKind="scalar",c.scalar=g,c.longAsString=f==di;break}return c.packed=js(t,e),c}switch(g){case It:case Gt:c.fieldKind="message",c.message=n.getMessage(ge(t.typeName)),ee(c.message,`invalid FieldDescriptorProto: type_name ${t.typeName} not found`),c.delimitedEncoding=pi(t,e),c.getDefaultValue=()=>{};break;case ci:{let p=n.getEnum(ge(t.typeName));ee(p!==void 0,`invalid FieldDescriptorProto: type_name ${t.typeName} not found`),c.fieldKind="enum",c.enum=n.getEnum(ge(t.typeName)),c.getDefaultValue=()=>Ve(t,"defaultValue")?si(p,t.defaultValue):void 0;break}default:{c.fieldKind="scalar",c.scalar=g,c.longAsString=f==di,c.getDefaultValue=()=>Ve(t,"defaultValue")?li(g,t.defaultValue):void 0;break}}return c}function Us(t){switch(t.syntax){case"":case"proto2":return Xs;case"proto3":return Bs;case"editions":if(t.edition===Rs)return Ls;if(t.edition in gi)return t.edition;throw new Error(`${t.name}: unsupported edition`);default:throw new Error(`${t.name}: unsupported syntax "${t.syntax}"`)}}function Ks(t,e){return t.dependency.map(n=>{let o=e.getFile(n);if(!o)throw new Error(`Cannot find ${n}, imported by ${t.name}`);return o})}function _s(t,e){let n=Qs(t)+"_";for(let o of e){if(!o.name.toLowerCase().startsWith(n))return;let r=o.name.substring(n.length);if(r.length==0||/^\d/.test(r))return}return n}function Qs(t){return(t.substring(0,1)+t.substring(1).replace(/[A-Z]/g,e=>"_"+e)).toLowerCase()}function ln(t,e,n){let o;return e?o=`${e.typeName}.${t.name}`:n.proto.package.length>0?o=`${n.proto.package}.${t.name}`:o=`${t.name}`,o}function ge(t){return t.startsWith(".")?t.substring(1):t}function Ps(t,e){if(!Ve(t,"oneofIndex")||t.proto3Optional)return;let n=e[t.oneofIndex];return ee(n,`invalid FieldDescriptorProto: oneof #${t.oneofIndex} for field #${t.number} not found`),n}function Os(t,e,n,o){if(t.label==ks)return Ms;if(t.label==Ro)return ui;if(e||t.proto3Optional||n)return Vo;let r=Be("fieldPresence",{proto:t,parent:o});return r==ui&&(t.type==It||t.type==Gt)?Vo:r}function js(t,e){if(t.label!=Ro)return!1;switch(t.type){case ws:case Ws:case Gt:case It:return!1}let n=t.options;return n&&Ve(n,"packed")?n.packed:Fs==Be("repeatedFieldEncoding",{proto:t,parent:e})}function $s(t){let e=t.fields.find(o=>o.number===1),n=t.fields.find(o=>o.number===2);return ee(e&&e.fieldKind=="scalar"&&e.scalar!=d.BYTES&&e.scalar!=d.FLOAT&&e.scalar!=d.DOUBLE&&n&&n.fieldKind!="list"&&n.fieldKind!="map"),{key:e,value:n}}function qs(t){var e;return zs==Be("enumType",{proto:t.proto,parent:(e=t.parent)!==null&&e!==void 0?e:t.file})}function pi(t,e){return t.type==Gt?!0:Ys==Be("messageEncoding",{proto:t,parent:e})}function el(t,e){return Ns==Be("utf8Validation",{proto:t,parent:e})}function Be(t,e){var n,o;let r=(n=e.proto.options)===null||n===void 0?void 0:n.features;if(r){let i=r[t];if(i!=0)return i}if("kind"in e){if(e.kind=="message")return Be(t,(o=e.parent)!==null&&o!==void 0?o:e.file);let i=gi[e.edition];if(!i)throw new Error(`feature default for edition ${e.edition} not found`);return i[t]}return Be(t,e.parent)}function ee(t,e){if(!t)throw new Error(e)}function bi(t){let e=tl(t);return e.messageType.forEach(yt),sn(e,()=>{}).getFile(e.name)}function tl(t){return Object.assign(Object.create({syntax:"",edition:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FileDescriptorProto",dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},t),{messageType:t.messageType.map(yi),enumType:t.enumType.map(Ii)}))}function yi(t){var e,n,o,r,i,a,s,l;return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.DescriptorProto",name:t.name,field:(n=(e=t.field)===null||e===void 0?void 0:e.map(nl))!==null&&n!==void 0?n:[],extension:[],nestedType:(r=(o=t.nestedType)===null||o===void 0?void 0:o.map(yi))!==null&&r!==void 0?r:[],enumType:(a=(i=t.enumType)===null||i===void 0?void 0:i.map(Ii))!==null&&a!==void 0?a:[],extensionRange:(l=(s=t.extensionRange)===null||s===void 0?void 0:s.map(m=>Object.assign({$typeName:"google.protobuf.DescriptorProto.ExtensionRange"},m)))!==null&&l!==void 0?l:[],oneofDecl:[],reservedRange:[],reservedName:[]})}function nl(t){return Object.assign(Object.create({label:1,typeName:"",extendee:"",defaultValue:"",oneofIndex:0,jsonName:"",proto3Optional:!1}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldDescriptorProto"},t),{options:t.options?ol(t.options):void 0}))}function ol(t){var e,n,o;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"},t),{targets:(e=t.targets)!==null&&e!==void 0?e:[],editionDefaults:(o=(n=t.editionDefaults)===null||n===void 0?void 0:n.map(i=>Object.assign({$typeName:"google.protobuf.FieldOptions.EditionDefault"},i)))!==null&&o!==void 0?o:[],uninterpretedOption:[]}))}function Ii(t){return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.EnumDescriptorProto",name:t.name,reservedName:[],reservedRange:[],value:t.value.map(n=>Object.assign({$typeName:"google.protobuf.EnumValueDescriptorProto"},n))})}function u(t,e,...n){return n.reduce((o,r)=>o.nestedMessages[r],t.messages[e])}function S(t,e,...n){if(n.length==0)return t.enums[e];let o=n.pop();return n.reduce((r,i)=>r.nestedMessages[i],t.messages[e]).nestedEnums[o]}var y=bi({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:[{n