"use strict";var j=Object.defineProperty;var C=(r,e,t)=>e in r?j(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var f=(r,e,t)=>C(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@protobuf-ts/runtime");class i{constructor(e,t,p,s){f(this,"_value");f(this,"_fieldId");f(this,"_opt");f(this,"_callback");this._value=t,this._fieldId=e,this._opt=p,this._callback=s}get value(){return this._value}set value(e){this._value=e}getTypeName(){return this.constructor.name}getFieldId(){return this._fieldId}getField(e){return _(e,this)}}class y extends i{getTypeName(){return"DoubleWrapper"}}class T extends i{getTypeName(){return"FloatWrapper"}}class I extends i{getTypeName(){return"StringWrapper"}}class B extends i{getTypeName(){return"UInt32Wrapper"}}class S extends i{getTypeName(){return"Int32Wrapper"}}class g extends i{getTypeName(){return"Int64Wrapper"}}class F extends i{getTypeName(){return"UInt64Wrapper"}}class x extends i{getTypeName(){return"ArrayWrapper"}}class P extends i{getTypeName(){return"BoolWrapper"}}class w extends i{getTypeName(){return"BytesWrapper"}}class h extends i{getTypeName(){return"Fixed64Wrapper"}}class m extends i{getTypeName(){return"Fixed32Wrapper"}}class b extends i{getTypeName(){return"SFixed32Wrapper"}}class U extends i{getTypeName(){return"SFixed64Wrapper"}}class N extends i{getTypeName(){return"SInt32Wrapper"}}class k extends i{getTypeName(){return"SInt64Wrapper"}}class D extends i{getTypeName(){return"UnknownWrapper"}}const n={UInt32Wrapper:"UInt32Wrapper",Int32Wrapper:"Int32Wrapper",Int64Wrapper:"Int64Wrapper",UInt64Wrapper:"UInt64Wrapper",StringWrapper:"StringWrapper",ArrayWrapper:"ArrayWrapper",BoolWrapper:"BoolWrapper",BytesWrapper:"BytesWrapper",DoubleWrapper:"DoubleWrapper",FloatWrapper:"FloatWrapper",Fixed64Wrapper:"Fixed64Wrapper",Fixed32Wrapper:"Fixed32Wrapper",SFixed32Wrapper:"SFixed32Wrapper",SFixed64Wrapper:"SFixed64Wrapper",SInt32Wrapper:"SInt32Wrapper",SInt64Wrapper:"SInt64Wrapper",UnknownWrapper:"UnknownWrapper"},M={[n.UInt32Wrapper]:B,[n.Int32Wrapper]:S,[n.Int64Wrapper]:g,[n.UInt64Wrapper]:F,[n.StringWrapper]:I,[n.ArrayWrapper]:x,[n.BoolWrapper]:P,[n.BytesWrapper]:w,[n.DoubleWrapper]:y,[n.FloatWrapper]:T,[n.Fixed64Wrapper]:h,[n.Fixed32Wrapper]:m,[n.SFixed32Wrapper]:b,[n.SFixed64Wrapper]:U,[n.SInt32Wrapper]:N,[n.SInt64Wrapper]:k,[n.UnknownWrapper]:D},K={[n.UInt32Wrapper]:a.ScalarType.UINT32,[n.Int32Wrapper]:a.ScalarType.INT32,[n.Int64Wrapper]:a.ScalarType.INT64,[n.UInt64Wrapper]:a.ScalarType.UINT64,[n.StringWrapper]:a.ScalarType.STRING,[n.BytesWrapper]:a.ScalarType.BYTES,[n.BoolWrapper]:a.ScalarType.BOOL,[n.DoubleWrapper]:a.ScalarType.DOUBLE,[n.FloatWrapper]:a.ScalarType.FLOAT,[n.Fixed64Wrapper]:a.ScalarType.FIXED64,[n.Fixed32Wrapper]:a.ScalarType.FIXED32,[n.SFixed32Wrapper]:a.ScalarType.SFIXED32,[n.SFixed64Wrapper]:a.ScalarType.SFIXED64,[n.SInt32Wrapper]:a.ScalarType.SINT32,[n.SInt64Wrapper]:a.ScalarType.SINT64,[n.UnknownWrapper]:a.ScalarType.BYTES};function R(r){return M[r]||D}function O(r){return K[r]||a.ScalarType.BYTES}function L(r=0,e,t=!1,p=[]){return new x(r,p,t,()=>e)}function X(r=0,e=!1,t=0){return new y(r,t,e)}function G(r=0,e=!1,t=0){return new T(r,t,e)}function Y(r=0,e=!1,t=""){return new I(r,t,e)}function q(r=0,e=!1,t=0){return new B(r,t,e)}function Q(r=0,e=!1,t=0){return new S(r,t,e)}function V(r=0,e=!1,t=BigInt(0)){return new g(r,t,e)}function $(r=0,e=!1,t=BigInt(0)){return new F(r,t,e)}function z(r=0,e=!1,t=!1){return new P(r,t,e)}function H(r=0,e=!1,t=new Uint8Array){return new w(r,t,e)}function J(r=0,e=!1,t=BigInt(0)){return new h(r,t,e)}function Z(r=0,e=!1,t=0){return new m(r,t,e)}function ee(r=0,e=!1,t=0){return new b(r,t,e)}function re(r=0,e=!1,t=BigInt(0)){return new U(r,t,e)}function te(r=0,e=!1,t=0){return new N(r,t,e)}function ne(r=0,e=!1,t=BigInt(0)){return new k(r,t,e)}function _(r,e){var c;const t=e.getTypeName(),p=e.getFieldId(),s=e._opt;if(t===n.ArrayWrapper){const o=(c=e._callback)==null?void 0:c.call(e);if(o instanceof l)return{no:p,name:r,kind:"message",T:()=>new a.MessageType(r,o.generateFields()),opt:s||!1,repeat:a.RepeatType.PACKED};if(o instanceof i){const u=o.getTypeName();return{no:p,name:r,kind:"scalar",T:O(u),opt:s||!1,repeat:u===n.StringWrapper||u===n.BytesWrapper?a.RepeatType.UNPACKED:a.RepeatType.PACKED}}throw new Error("ArrayWrapper item type error")}return{no:p,name:r,kind:"scalar",T:O(t),opt:s||!1,repeat:a.RepeatType.NO}}class l{constructor(){f(this,"_fieldId",0)}generateFields(){const e=[];for(const t of Object.keys(this)){const p="_"+t,s=this[p];s instanceof i&&e.push(s.getField(t)),s instanceof l&&e.push({no:s._fieldId,name:t,kind:"message",T:()=>new a.MessageType(p,s.generateFields()),repeat:a.RepeatType.NO,opt:!1})}return e}assignFields(e){for(const t of Object.keys(this)){const p="_"+t;let s=this[p];if(s instanceof i){const c=e[t];c!==void 0&&(s.value=c)}else if(s instanceof l){const c=e[t];c!==void 0&&s.assignFields(c)}else{const c=e[t];c!==void 0&&(this[p]=c)}}}toObject(){const e={};for(const t of Object.keys(this)){const p="_"+t,s=this[p];s&&(s instanceof i&&(e[t]=s.value),s instanceof l&&(e[t]=s.toObject()))}return e}encode(){return new a.MessageType("message",this.generateFields()).toBinary(this.toObject())}decode(e){const t=new a.MessageType("message",this.generateFields()).fromBinary(e);return this.assignFields(t),this}then(e){e(this)}}function d(r){return new Proxy(r,{set(e,t,p){return e[t]instanceof i?(e[t].value=p,!0):(e[t]=p,!0)},get(e,t){if(typeof t=="string"&&t.startsWith("_")){const s=t.slice(1);if(e[s])return e[s]}const p=e[t];return p instanceof i?p.value:p}})}function v(r,e){const t=d(e?new e:new r);return t._fieldId=typeof r=="number"?r:0,t}function ae(r,e){const t=d(new r);return e&&t.assignFields(e),t}function pe(r,e){const p=v(class extends l{});return Object.assign(p,r),p.assignFields(e),p}function se(r,e){if(typeof r=="number"){let t=new class extends l{constructor(){super(),Object.assign(this,e)}};return t._fieldId=r,d(t)}return d(new class extends l{constructor(){super(),Object.assign(this,r)}})}function ie(r){return r.value}function E(r,e,t,p,s,c){let o;const u=new a.BinaryReader(s);switch(p){case a.WireType.Varint:o=u.uint64(),o=o.hi>0?o.toBigInt():Number(o.lo);break;case a.WireType.Bit64:o=u.fixed64();break;case a.WireType.LengthDelimited:let W=u.bytes();try{o=A(W)}catch{try{if(o=new TextDecoder().decode(W),o.indexOf("�")!==-1)throw new Error("Invalid UTF-8 sequence in input")}catch{c?o=c(W):o=W}}break;case a.WireType.StartGroup:case a.WireType.EndGroup:break;case a.WireType.Bit32:o=u.fixed32();break;default:throw new Error(`Unknown wire type: ${p}`)}e[t]?e[t]instanceof Array?e[t].push(o):e[t]=[e[t],o]:e[t]=o}function A(r,e){return new a.MessageType("message",[]).fromBinary(r,{readUnknownField:(s,c,o,u,W)=>E(s,c,o,u,W,e)})}class oe extends l{push(e){return Object.assign(this,e),this}}exports.ArrayWrapper=x;exports.BoolWrapper=P;exports.BytesWrapper=w;exports.ChainProto=oe;exports.DoubleWrapper=y;exports.Fixed32Wrapper=m;exports.Fixed64Wrapper=h;exports.FloatWrapper=T;exports.Int32Wrapper=S;exports.Int64Wrapper=g;exports.PBArray=L;exports.PBBool=z;exports.PBBytes=H;exports.PBDouble=X;exports.PBFixed32=Z;exports.PBFixed64=J;exports.PBFloat=G;exports.PBInt32=Q;exports.PBInt64=V;exports.PBSFixed32=ee;exports.PBSFixed64=re;exports.PBSInt32=te;exports.PBSInt64=ne;exports.PBString=Y;exports.PBUint32=q;exports.PBUint64=$;exports.ProtoBuf=v;exports.ProtoBufBase=l;exports.ProtoBufDecode=A;exports.ProtoBufEx=ae;exports.ProtoBufIn=se;exports.ProtoBufQuick=pe;exports.SFixed32Wrapper=b;exports.SFixed64Wrapper=U;exports.SInt32Wrapper=N;exports.SInt64Wrapper=k;exports.StringWrapper=I;exports.UInt32Wrapper=B;exports.UInt64Wrapper=F;exports.UnWrap=ie;exports.UnknownWrapper=D;exports.ValueWrapper=i;exports.autoTypeToClass=R;exports.autoTypeToField=_;exports.decodeProtoBuf=E;exports.proxyClassProtobuf=d; //# sourceMappingURL=protobuf.cjs.map