@influxdata/influxdb3-client
Advanced tools
Comparing version 0.11.0 to 0.12.0-nightly.6451
@@ -10,5 +10,5 @@ (function (global, factory) { | ||
`),F,p),l}async close(){this._closed=!0}};var we=K("apache-arrow");var Xt=K("@protobuf-ts/runtime-rpc");function U(n){let e=typeof n;if(e=="object"){if(Array.isArray(n))return"array";if(n===null)return"null"}return e}function Le(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ee=[];for(let n=0;n<_.length;n++)ee[_[n].charCodeAt(0)]=n;ee[45]=_.indexOf("+");ee[95]=_.indexOf("/");function kt(n){let e=n.length*3/4;n[n.length-2]=="="?e-=2:n[n.length-1]=="="&&(e-=1);let t=new Uint8Array(e),r=0,i=0,s,o=0;for(let a=0;a<n.length;a++){if(s=ee[n.charCodeAt(a)],s===void 0)switch(n[a]){case"=":i=0;case` | ||
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:o=s,i=1;break;case 1:t[r++]=o<<2|(s&48)>>4,o=s,i=2;break;case 2:t[r++]=(o&15)<<4|(s&60)>>2,o=s,i=3;break;case 3:t[r++]=(o&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,r)}function Et(n){let e="",t=0,r,i=0;for(let s=0;s<n.length;s++)switch(r=n[s],t){case 0:e+=_[r>>2],i=(r&3)<<4,t=1;break;case 1:e+=_[i|r>>4],i=(r&15)<<2,t=2;break;case 2:e+=_[i|r>>6],e+=_[r&63],t=0;break}return t&&(e+=_[i],e+="=",t==1&&(e+="=")),e}var B;(function(n){n.symbol=Symbol.for("protobuf-ts/unknown"),n.onRead=(t,r,i,s,o)=>{(e(r)?r[n.symbol]:r[n.symbol]=[]).push({no:i,wireType:s,data:o})},n.onWrite=(t,r,i)=>{for(let{no:s,wireType:o,data:a}of n.list(r))i.tag(s,o).raw(a)},n.list=(t,r)=>{if(e(t)){let i=t[n.symbol];return r?i.filter(s=>s.no==r):i}return[]},n.last=(t,r)=>n.list(t,r).slice(-1)[0];let e=t=>t&&Array.isArray(t[n.symbol])})(B||(B={}));var T;(function(n){n[n.Varint=0]="Varint",n[n.Bit64=1]="Bit64",n[n.LengthDelimited=2]="LengthDelimited",n[n.StartGroup=3]="StartGroup",n[n.EndGroup=4]="EndGroup",n[n.Bit32=5]="Bit32"})(T||(T={}));function _t(){let n=0,e=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(n|=(i&127)<<r,!(i&128))return this.assertBounds(),[n,e]}let t=this.buf[this.pos++];if(n|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[n,e];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<r,!(i&128))return this.assertBounds(),[n,e]}throw new Error("invalid varint")}function re(n,e,t){for(let s=0;s<28;s=s+7){let o=n>>>s,a=!(!(o>>>7)&&e==0),l=(a?o|128:o)&255;if(t.push(l),!a)return}let r=n>>>28&15|(e&7)<<4,i=!!(e>>3);if(t.push((i?r|128:r)&255),!!i){for(let s=3;s<31;s=s+7){let o=e>>>s,a=!!(o>>>7),l=(a?o|128:o)&255;if(t.push(l),!a)return}t.push(e>>>31&1)}}var te=65536*65536;function Be(n){let e=n[0]=="-";e&&(n=n.slice(1));let t=1e6,r=0,i=0;function s(o,a){let l=Number(n.slice(o,a));i*=t,r=r*t+l,r>=te&&(i=i+(r/te|0),r=r%te)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[e,r,i]}function ne(n,e){if(e>>>0<=2097151)return""+(te*e+(n>>>0));let t=n&16777215,r=(n>>>24|e<<8)>>>0&16777215,i=e>>16&65535,s=t+r*6777216+i*6710656,o=r+i*8147497,a=i*2,l=1e7;s>=l&&(o+=Math.floor(s/l),s%=l),o>=l&&(a+=Math.floor(o/l),o%=l);function f(c,p){let m=c?String(c):"";return p?"0000000".slice(m.length)+m:m}return f(a,0)+f(o,a)+f(s,1)}function ve(n,e){if(n>=0){for(;n>127;)e.push(n&127|128),n=n>>>7;e.push(n)}else{for(let t=0;t<9;t++)e.push(n&127|128),n=n>>7;e.push(1)}}function St(){let n=this.buf[this.pos++],e=n&127;if(!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<7,!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<14,!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<21,!(n&128))return this.assertBounds(),e;n=this.buf[this.pos++],e|=(n&15)<<28;for(let t=5;n&128&&t<10;t++)n=this.buf[this.pos++];if(n&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var b;function pr(){let n=new DataView(new ArrayBuffer(8));b=globalThis.BigInt!==void 0&&typeof n.getBigInt64=="function"&&typeof n.getBigUint64=="function"&&typeof n.setBigInt64=="function"&&typeof n.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:n}:void 0}pr();function Rt(n){if(!n)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var At=/^-?[0-9]+$/,se=4294967296,ie=2147483648,oe=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*se+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},w=class n extends oe{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(e<b.UMIN)throw new Error("signed value for ulong");if(e>b.UMAX)throw new Error("ulong too large");return b.V.setBigUint64(0,e,!0),new n(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!At.test(e))throw new Error("string is no integer");let[t,r,i]=Be(e);if(t)throw new Error("signed value for ulong");return new n(r,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new n(e,e/se)}throw new Error("unknown value "+typeof e)}toString(){return b?this.toBigInt().toString():ne(this.lo,this.hi)}toBigInt(){return Rt(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigUint64(0,!0)}};w.ZERO=new w(0,0);var g=class n extends oe{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(e<b.MIN)throw new Error("signed long too small");if(e>b.MAX)throw new Error("signed long too large");return b.V.setBigInt64(0,e,!0),new n(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!At.test(e))throw new Error("string is no integer");let[t,r,i]=Be(e);if(t){if(i>ie||i==ie&&r!=0)throw new Error("signed long too small")}else if(i>=ie)throw new Error("signed long too large");let s=new n(r,i);return t?s.negate():s;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new n(e,e/se):new n(-e,-e/se).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&ie)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new n(t,e)}toString(){if(b)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+ne(e.lo,e.hi)}return ne(this.lo,this.hi)}toBigInt(){return Rt(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigInt64(0,!0)}};g.ZERO=new g(0,0);var Pt={readUnknownField:!0,readerFactory:n=>new Ve(n)};function Dt(n){return n?Object.assign(Object.assign({},Pt),n):Pt}var Ve=class{constructor(e,t){this.varint64=_t,this.uint32=St,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t!=null?t:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,r=e&7;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e){let t=this.pos;switch(e){case T.Varint:for(;this.buf[this.pos++]&128;);break;case T.Bit64:this.pos+=4;case T.Bit32:this.pos+=4;break;case T.LengthDelimited:let r=this.uint32();this.pos+=r;break;case T.StartGroup:let i;for(;(i=this.tag()[1])!==T.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,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 new g(...this.varint64())}uint64(){return new w(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new g(e,t)}bool(){let[e,t]=this.varint64();return e!==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 new w(this.sfixed32(),this.sfixed32())}sfixed64(){return new g(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function h(n,e){if(!n)throw new Error(e)}var mr=34028234663852886e22,hr=-34028234663852886e22,dr=4294967295,gr=2147483647,br=-2147483648;function A(n){if(typeof n!="number")throw new Error("invalid int 32: "+typeof n);if(!Number.isInteger(n)||n>gr||n<br)throw new Error("invalid int 32: "+n)}function C(n){if(typeof n!="number")throw new Error("invalid uint 32: "+typeof n);if(!Number.isInteger(n)||n>dr||n<0)throw new Error("invalid uint 32: "+n)}function v(n){if(typeof n!="number")throw new Error("invalid float 32: "+typeof n);if(Number.isFinite(n)&&(n>mr||n<hr))throw new Error("invalid float 32: "+n)}var Ut={writeUnknownFields:!0,writerFactory:()=>new Me};function Ct(n){return n?Object.assign(Object.assign({},Ut),n):Ut}var Me=class{constructor(e){this.stack=[],this.textEncoder=e!=null?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let t=new Uint8Array(e),r=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],r),r+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(C(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return A(e),ve(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){v(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){C(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){A(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return A(e),e=(e<<1^e>>31)>>>0,ve(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=g.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=w.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=g.from(e);return re(t.lo,t.hi,this.buf),this}sint64(e){let t=g.from(e),r=t.hi>>31,i=t.lo<<1^r,s=(t.hi<<1|t.lo>>>31)^r;return re(i,s,this.buf),this}uint64(e){let t=w.from(e);return re(t.lo,t.hi,this.buf),this}};var Lt={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},Bt={ignoreUnknownFields:!1};function vt(n){return n?Object.assign(Object.assign({},Bt),n):Bt}function Vt(n){return n?Object.assign(Object.assign({},Lt),n):Lt}var ae=Symbol.for("protobuf-ts/message-type");function We(n){let e=!1,t=[];for(let r=0;r<n.length;r++){let i=n.charAt(r);i=="_"?e=!0:/\d/.test(i)?(t.push(i),e=!0):e?(t.push(i.toUpperCase()),e=!1):r==0?t.push(i.toLowerCase()):t.push(i)}return t.join("")}var u;(function(n){n[n.DOUBLE=1]="DOUBLE",n[n.FLOAT=2]="FLOAT",n[n.INT64=3]="INT64",n[n.UINT64=4]="UINT64",n[n.INT32=5]="INT32",n[n.FIXED64=6]="FIXED64",n[n.FIXED32=7]="FIXED32",n[n.BOOL=8]="BOOL",n[n.STRING=9]="STRING",n[n.BYTES=12]="BYTES",n[n.UINT32=13]="UINT32",n[n.SFIXED32=15]="SFIXED32",n[n.SFIXED64=16]="SFIXED64",n[n.SINT32=17]="SINT32",n[n.SINT64=18]="SINT64"})(u||(u={}));var x;(function(n){n[n.BIGINT=0]="BIGINT",n[n.STRING=1]="STRING",n[n.NUMBER=2]="NUMBER"})(x||(x={}));var j;(function(n){n[n.NO=0]="NO",n[n.PACKED=1]="PACKED",n[n.UNPACKED=2]="UNPACKED"})(j||(j={}));function Mt(n){var e,t,r,i;return n.localName=(e=n.localName)!==null&&e!==void 0?e:We(n.name),n.jsonName=(t=n.jsonName)!==null&&t!==void 0?t:We(n.name),n.repeat=(r=n.repeat)!==null&&r!==void 0?r:j.NO,n.opt=(i=n.opt)!==null&&i!==void 0?i:n.repeat||n.oneof?!1:n.kind=="message",n}function Wt(n){if(typeof n!="object"||n===null||!n.hasOwnProperty("oneofKind"))return!1;switch(typeof n.oneofKind){case"string":return n[n.oneofKind]===void 0?!1:Object.keys(n).length==2;case"undefined":return Object.keys(n).length==1;default:return!1}}var le=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;let e=[],t=[],r=[];for(let i of this.fields)if(i.oneof)r.includes(i.oneof)||(r.push(i.oneof),e.push(i.oneof),t.push(i.oneof));else switch(t.push(i.localName),i.kind){case"scalar":case"enum":(!i.opt||i.repeat)&&e.push(i.localName);break;case"message":i.repeat&&e.push(i.localName);break;case"map":e.push(i.localName);break}this.data={req:e,known:t,oneofs:Object.values(r)}}is(e,t,r=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let i=Object.keys(e),s=this.data;if(i.length<s.req.length||s.req.some(o=>!i.includes(o))||!r&&i.some(o=>!s.known.includes(o)))return!1;if(t<1)return!0;for(let o of s.oneofs){let a=e[o];if(!Wt(a))return!1;if(a.oneofKind===void 0)continue;let l=this.fields.find(f=>f.localName===a.oneofKind);if(!l||!this.field(a[a.oneofKind],l,r,t))return!1}for(let o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,r,t))return!1;return!0}field(e,t,r,i){let s=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:s?this.scalars(e,t.T,i,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:s?this.scalars(e,u.INT32,i):this.scalar(e,u.INT32);case"message":return e===void 0?!0:s?this.messages(e,t.T(),r,i):this.message(e,t.T(),r,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,t.K,i))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,i,t.V.L);case"enum":return this.scalars(Object.values(e),u.INT32,i);case"message":return this.messages(Object.values(e),t.V.T(),r,i)}break}return!0}message(e,t,r,i){return r?t.isAssignable(e,i):t.is(e,i)}messages(e,t,r,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(r){for(let s=0;s<e.length&&s<i;s++)if(!t.isAssignable(e[s],i-1))return!1}else for(let s=0;s<e.length&&s<i;s++)if(!t.is(e[s],i-1))return!1;return!0}scalar(e,t,r){let i=typeof e;switch(t){case u.UINT64:case u.FIXED64:case u.INT64:case u.SFIXED64:case u.SINT64:switch(r){case x.BIGINT:return i=="bigint";case x.NUMBER:return i=="number"&&!isNaN(e);default:return i=="string"}case u.BOOL:return i=="boolean";case u.STRING:return i=="string";case u.BYTES:return e instanceof Uint8Array;case u.DOUBLE:case u.FLOAT:return i=="number"&&!isNaN(e);default:return i=="number"&&Number.isInteger(e)}}scalars(e,t,r,i){if(!Array.isArray(e))return!1;if(r<2)return!0;if(Array.isArray(e)){for(let s=0;s<e.length&&s<r;s++)if(!this.scalar(e[s],t,i))return!1}return!0}mapKeys(e,t,r){let i=Object.keys(e);switch(t){case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:return this.scalars(i.slice(0,r).map(s=>parseInt(s)),t,r);case u.BOOL:return this.scalars(i.slice(0,r).map(s=>s=="true"?!0:s=="false"?!1:s),t,r);default:return this.scalars(i,t,r,x.STRING)}}};function I(n,e){switch(e){case x.BIGINT:return n.toBigInt();case x.NUMBER:return n.toNumber();default:return n.toString()}}var ue=class{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};let t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(let r of t)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,t,r){if(!e){let i=U(r);throw(i=="number"||i=="boolean")&&(i=r.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${t}`)}}read(e,t,r){this.prepare();let i=[];for(let[s,o]of Object.entries(e)){let a=this.fMap[s];if(!a){if(!r.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}let l=a.localName,f;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(i.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(a.oneof),f=t[a.oneof]={oneofKind:l}}else f=t;if(a.kind=="map"){if(o===null)continue;this.assert(Le(o),a.name,o);let c=f[l];for(let[p,m]of Object.entries(o)){this.assert(m!==null,a.name+" map value",null);let F;switch(a.V.kind){case"message":F=a.V.T().internalJsonRead(m,r);break;case"enum":if(F=this.enum(a.V.T(),m,a.name,r.ignoreUnknownFields),F===!1)continue;break;case"scalar":F=this.scalar(m,a.V.T,a.V.L,a.name);break}this.assert(F!==void 0,a.name+" map value",m);let d=p;a.K==u.BOOL&&(d=d=="true"?!0:d=="false"?!1:d),d=this.scalar(d,a.K,x.STRING,a.name).toString(),c[d]=F}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);let c=f[l];for(let p of o){this.assert(p!==null,a.name,null);let m;switch(a.kind){case"message":m=a.T().internalJsonRead(p,r);break;case"enum":if(m=this.enum(a.T(),p,a.name,r.ignoreUnknownFields),m===!1)continue;break;case"scalar":m=this.scalar(p,a.T,a.L,a.name);break}this.assert(m!==void 0,a.name,o),c.push(m)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}f[l]=a.T().internalJsonRead(o,r,f[l]);break;case"enum":let c=this.enum(a.T(),o,a.name,r.ignoreUnknownFields);if(c===!1)continue;f[l]=c;break;case"scalar":f[l]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,r,i){if(e[0]=="google.protobuf.NullValue"&&h(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return h(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${r}, enum can only be integral number, got ${t}.`),t;case"string":let s=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(s=t.substring(e[2].length));let o=e[1][s];return typeof o=="undefined"&&i?!1:(h(typeof o=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${t}".`),o)}h(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,r,i){let s;try{switch(t){case u.DOUBLE:case u.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){s="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){s="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){s="not a number";break}if(!Number.isFinite(o)){s="too large or small";break}return t==u.FLOAT&&v(o),o;case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?s="empty string":typeof e=="string"&&(e.trim().length!==e.length?s="extra whitespace":a=Number(e)),a===void 0)break;return t==u.UINT32?C(a):A(a),a;case u.INT64:case u.SFIXED64:case u.SINT64:if(e===null)return I(g.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return I(g.from(e),r);case u.FIXED64:case u.UINT64:if(e===null)return I(w.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return I(w.from(e),r);case u.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case u.STRING:if(e===null)return"";if(typeof e!="string"){s="extra whitespace";break}try{encodeURIComponent(e)}catch(l){l="invalid UTF8";break}return e;case u.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return kt(e)}}catch(o){s=o.message}this.assert(!1,i+(s?" - "+s:""),e)}};var fe=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){let r={},i=e;for(let s of this.fields){if(!s.oneof){let f=this.field(s,i[s.localName],t);f!==void 0&&(r[t.useProtoFieldName?s.name:s.jsonName]=f);continue}let o=i[s.oneof];if(o.oneofKind!==s.localName)continue;let a=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,l=this.field(s,o[s.localName],a);h(l!==void 0),r[t.useProtoFieldName?s.name:s.jsonName]=l}return r}field(e,t,r){let i;if(e.kind=="map"){h(typeof t=="object"&&t!==null);let s={};switch(e.V.kind){case"scalar":for(let[l,f]of Object.entries(t)){let c=this.scalar(e.V.T,f,e.name,!1,!0);h(c!==void 0),s[l.toString()]=c}break;case"message":let o=e.V.T();for(let[l,f]of Object.entries(t)){let c=this.message(o,f,e.name,r);h(c!==void 0),s[l.toString()]=c}break;case"enum":let a=e.V.T();for(let[l,f]of Object.entries(t)){h(f===void 0||typeof f=="number");let c=this.enum(a,f,e.name,!1,!0,r.enumAsInteger);h(c!==void 0),s[l.toString()]=c}break}(r.emitDefaultValues||Object.keys(s).length>0)&&(i=s)}else if(e.repeat){h(Array.isArray(t));let s=[];switch(e.kind){case"scalar":for(let l=0;l<t.length;l++){let f=this.scalar(e.T,t[l],e.name,e.opt,!0);h(f!==void 0),s.push(f)}break;case"enum":let o=e.T();for(let l=0;l<t.length;l++){h(t[l]===void 0||typeof t[l]=="number");let f=this.enum(o,t[l],e.name,e.opt,!0,r.enumAsInteger);h(f!==void 0),s.push(f)}break;case"message":let a=e.T();for(let l=0;l<t.length;l++){let f=this.message(a,t[l],e.name,r);h(f!==void 0),s.push(f)}break}(r.emitDefaultValues||s.length>0||r.emitDefaultValues)&&(i=s)}else switch(e.kind){case"scalar":i=this.scalar(e.T,t,e.name,e.opt,r.emitDefaultValues);break;case"enum":i=this.enum(e.T(),t,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":i=this.message(e.T(),t,e.name,r);break}return i}enum(e,t,r,i,s,o){if(e[0]=="google.protobuf.NullValue")return!s&&!i?void 0:null;if(t===void 0){h(i);return}if(!(t===0&&!s&&!i))return h(typeof t=="number"),h(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,r,i){return t===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(t,i)}scalar(e,t,r,i,s){if(t===void 0){h(i);return}let o=s||i;switch(e){case u.INT32:case u.SFIXED32:case u.SINT32:return t===0?o?0:void 0:(A(t),t);case u.FIXED32:case u.UINT32:return t===0?o?0:void 0:(C(t),t);case u.FLOAT:v(t);case u.DOUBLE:return t===0?o?0:void 0:(h(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case u.STRING:return t===""?o?"":void 0:(h(typeof t=="string"),t);case u.BOOL:return t===!1?o?!1:void 0:(h(typeof t=="boolean"),t);case u.UINT64:case u.FIXED64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=w.from(t);return a.isZero()&&!o?void 0:a.toString();case u.INT64:case u.SFIXED64:case u.SINT64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let l=g.from(t);return l.isZero()&&!o?void 0:l.toString();case u.BYTES:return h(t instanceof Uint8Array),t.byteLength?Et(t):o?"":void 0}}};function J(n,e=x.STRING){switch(n){case u.BOOL:return!1;case u.UINT64:case u.FIXED64:return I(w.ZERO,e);case u.INT64:case u.SFIXED64:case u.SINT64:return I(g.ZERO,e);case u.DOUBLE:case u.FLOAT:return 0;case u.BYTES:return new Uint8Array(0);case u.STRING:return"";default:return 0}}var ce=class{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(r=>[r.no,r]))}}read(e,t,r,i){this.prepare();let s=i===void 0?e.len:e.pos+i;for(;e.pos<s;){let[o,a]=e.tag(),l=this.fieldNoToField.get(o);if(!l){let m=r.readUnknownField;if(m=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let F=e.skip(a);m!==!1&&(m===!0?B.onRead:m)(this.info.typeName,t,o,a,F);continue}let f=t,c=l.repeat,p=l.localName;switch(l.oneof&&(f=f[l.oneof],f.oneofKind!==p&&(f=t[l.oneof]={oneofKind:p})),l.kind){case"scalar":case"enum":let m=l.kind=="enum"?u.INT32:l.T,F=l.kind=="scalar"?l.L:void 0;if(c){let P=f[p];if(a==T.LengthDelimited&&m!=u.STRING&&m!=u.BYTES){let Fe=e.uint32()+e.pos;for(;e.pos<Fe;)P.push(this.scalar(e,m,F))}else P.push(this.scalar(e,m,F))}else f[p]=this.scalar(e,m,F);break;case"message":if(c){let P=f[p],Fe=l.T().internalBinaryRead(e,e.uint32(),r);P.push(Fe)}else f[p]=l.T().internalBinaryRead(e,e.uint32(),r,f[p]);break;case"map":let[d,O]=this.mapEntry(l,e,r);f[p][d]=O;break}}}mapEntry(e,t,r){let i=t.uint32(),s=t.pos+i,o,a;for(;t.pos<s;){let[l,f]=t.tag();switch(l){case 1:e.K==u.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,x.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),r);break}break;default:throw new Error(`Unknown field ${l} (wire type ${f}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let l=J(e.K);o=e.K==u.BOOL?l.toString():l}if(a===void 0)switch(e.V.kind){case"scalar":a=J(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create();break}return[o,a]}scalar(e,t,r){switch(t){case u.INT32:return e.int32();case u.STRING:return e.string();case u.BOOL:return e.bool();case u.DOUBLE:return e.double();case u.FLOAT:return e.float();case u.INT64:return I(e.int64(),r);case u.UINT64:return I(e.uint64(),r);case u.FIXED64:return I(e.fixed64(),r);case u.FIXED32:return e.fixed32();case u.BYTES:return e.bytes();case u.UINT32:return e.uint32();case u.SFIXED32:return e.sfixed32();case u.SFIXED64:return I(e.sfixed64(),r);case u.SINT32:return e.sint32();case u.SINT64:return I(e.sint64(),r)}}};var pe=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,r)=>t.no-r.no)}}write(e,t,r){this.prepare();for(let s of this.fields){let o,a,l=s.repeat,f=s.localName;if(s.oneof){let c=e[s.oneof];if(c.oneofKind!==f)continue;o=c[f],a=!0}else o=e[f],a=!1;switch(s.kind){case"scalar":case"enum":let c=s.kind=="enum"?u.INT32:s.T;if(l)if(h(Array.isArray(o)),l==j.PACKED)this.packed(t,c,s.no,o);else for(let p of o)this.scalar(t,c,s.no,p,!0);else o===void 0?h(s.opt):this.scalar(t,c,s.no,o,a||s.opt);break;case"message":if(l){h(Array.isArray(o));for(let p of o)this.message(t,r,s.T(),s.no,p)}else this.message(t,r,s.T(),s.no,o);break;case"map":h(typeof o=="object"&&o!==null);for(let[p,m]of Object.entries(o))this.mapEntry(t,r,s,p,m);break}}let i=r.writeUnknownFields;i!==!1&&(i===!0?B.onWrite:i)(this.info.typeName,e,t)}mapEntry(e,t,r,i,s){e.tag(r.no,T.LengthDelimited),e.fork();let o=i;switch(r.K){case u.INT32:case u.FIXED32:case u.UINT32:case u.SFIXED32:case u.SINT32:o=Number.parseInt(i);break;case u.BOOL:h(i=="true"||i=="false"),o=i=="true";break}switch(this.scalar(e,r.K,1,o,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,s,!0);break;case"enum":this.scalar(e,u.INT32,2,s,!0);break;case"message":this.message(e,t,r.V.T(),2,s);break}e.join()}message(e,t,r,i,s){s!==void 0&&(r.internalBinaryWrite(s,e.tag(i,T.LengthDelimited).fork(),t),e.join())}scalar(e,t,r,i,s){let[o,a,l]=this.scalarInfo(t,i);(!l||s)&&(e.tag(r,o),e[a](i))}packed(e,t,r,i){if(!i.length)return;h(t!==u.BYTES&&t!==u.STRING),e.tag(r,T.LengthDelimited),e.fork();let[,s]=this.scalarInfo(t);for(let o=0;o<i.length;o++)e[s](i[o]);e.join()}scalarInfo(e,t){let r=T.Varint,i,s=t===void 0,o=t===0;switch(e){case u.INT32:i="int32";break;case u.STRING:o=s||!t.length,r=T.LengthDelimited,i="string";break;case u.BOOL:o=t===!1,i="bool";break;case u.UINT32:i="uint32";break;case u.DOUBLE:r=T.Bit64,i="double";break;case u.FLOAT:r=T.Bit32,i="float";break;case u.INT64:o=s||g.from(t).isZero(),i="int64";break;case u.UINT64:o=s||w.from(t).isZero(),i="uint64";break;case u.FIXED64:o=s||w.from(t).isZero(),r=T.Bit64,i="fixed64";break;case u.BYTES:o=s||!t.byteLength,r=T.LengthDelimited,i="bytes";break;case u.FIXED32:r=T.Bit32,i="fixed32";break;case u.SFIXED32:r=T.Bit32,i="sfixed32";break;case u.SFIXED64:o=s||g.from(t).isZero(),r=T.Bit64,i="sfixed64";break;case u.SINT32:i="sint32";break;case u.SINT64:o=s||g.from(t).isZero(),i="sint64";break}return[r,i,s||o]}};function Ht(n){let e=n.messagePrototype?Object.create(n.messagePrototype):Object.defineProperty({},ae,{value:n});for(let t of n.fields){let r=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[r]=[];else switch(t.kind){case"scalar":e[r]=J(t.T,t.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function me(n,e,t){let r,i=t,s;for(let o of n.fields){let a=o.localName;if(o.oneof){let l=i[o.oneof];if((l==null?void 0:l.oneofKind)==null)continue;if(r=l[a],s=e[o.oneof],s.oneofKind=l.oneofKind,r==null){delete s[a];continue}}else if(r=i[a],s=e,r==null)continue;switch(o.repeat&&(s[a].length=r.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let f=0;f<r.length;f++)s[a][f]=r[f];else s[a]=r;break;case"message":let l=o.T();if(o.repeat)for(let f=0;f<r.length;f++)s[a][f]=l.create(r[f]);else s[a]===void 0?s[a]=l.create(r):l.mergePartial(s[a],r);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(s[a],r);break;case"message":let f=o.V.T();for(let c of Object.keys(r))s[a][c]=f.create(r[c]);break}break}}}function jt(n,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let r of n.fields){let i=r.localName,s=r.oneof?e[r.oneof][i]:e[i],o=r.oneof?t[r.oneof][i]:t[i];switch(r.kind){case"enum":case"scalar":let a=r.kind=="enum"?u.INT32:r.T;if(!(r.repeat?$t(a,s,o):Jt(a,s,o)))return!1;break;case"map":if(!(r.V.kind=="message"?qt(r.V.T(),he(s),he(o)):$t(r.V.kind=="enum"?u.INT32:r.V.T,he(s),he(o))))return!1;break;case"message":let l=r.T();if(!(r.repeat?qt(l,s,o):l.equals(s,o)))return!1;break}}return!0}var he=Object.values;function Jt(n,e,t){if(e===t)return!0;if(n!==u.BYTES)return!1;let r=e,i=t;if(r.length!==i.length)return!1;for(let s=0;s<r.length;s++)if(r[s]!=i[s])return!1;return!0}function $t(n,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Jt(n,e[r],t[r]))return!1;return!0}function qt(n,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n.equals(e[r],t[r]))return!1;return!0}var yr=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),y=class{constructor(e,t,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(Mt),this.options=r!=null?r:{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},yr),{[ae]:{value:this}})),this.refTypeCheck=new le(this),this.refJsonReader=new ue(this),this.refJsonWriter=new fe(this),this.refBinReader=new ce(this),this.refBinWriter=new pe(this)}create(e){let t=Ht(this);return e!==void 0&&me(this,t,e),t}clone(e){let t=this.create();return me(this,t,e),t}equals(e,t){return jt(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){me(this,e,t)}fromBinary(e,t){let r=Dt(t);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,t){return this.internalJsonRead(e,vt(t))}fromJsonString(e,t){let r=JSON.parse(e);return this.fromJson(r,t)}toJson(e,t){return this.internalJsonWrite(e,Vt(t))}toJsonString(e,t){var r;let i=this.toJson(e,t);return JSON.stringify(i,null,(r=t==null?void 0:t.prettySpaces)!==null&&r!==void 0?r:0)}toBinary(e,t){let r=Ct(t);return this.internalBinaryWrite(e,r.writerFactory(),r).finish()}internalJsonRead(e,t,r){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let i=r!=null?r:this.create();return this.refJsonReader.read(e,i,t),i}throw new Error(`Unable to parse message ${this.typeName} from JSON ${U(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,r){return this.refBinWriter.write(e,t,r),t}internalBinaryRead(e,t,r,i){let s=i!=null?i:this.create();return this.refBinReader.read(e,s,r,t),s}};var He=class extends y{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){let e=this.create(),t=Date.now();return e.seconds=g.from(Math.floor(t/1e3)).toBigInt(),e.nanos=t%1e3*1e6,e}toDate(e){return new Date(g.from(e.seconds).toNumber()*1e3+Math.ceil(e.nanos/1e6))}fromDate(e){let t=this.create(),r=e.getTime();return t.seconds=g.from(Math.floor(r/1e3)).toBigInt(),t.nanos=r%1e3*1e6,t}internalJsonWrite(e,t){let r=g.from(e.seconds).toNumber()*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(e.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let i="Z";if(e.nanos>0){let s=(e.nanos+1e9).toString().substring(1);s.substring(3)==="000000"?i="."+s.substring(0,3)+"Z":s.substring(6)==="000"?i="."+s.substring(0,6)+"Z":i="."+s+"Z"}return new Date(r).toISOString().replace(".000Z",i)}internalJsonRead(e,t,r){if(typeof e!="string")throw new Error("Unable to parse Timestamp from JSON "+U(e)+".");let i=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let s=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(s))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(s<Date.parse("0001-01-01T00:00:00Z")||s>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return r||(r=this.create()),r.seconds=g.from(s/1e3).toBigInt(),r.nanos=0,i[7]&&(r.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),r}},$e=new He;var Gt=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.PATH=1]="PATH",r[r.CMD=2]="CMD",r))(Gt||{}),Kt=(i=>(i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.CANCELLED=1]="CANCELLED",i[i.CANCELLING=2]="CANCELLING",i[i.NOT_CANCELLABLE=3]="NOT_CANCELLABLE",i))(Kt||{}),qe=class extends y{constructor(){super("arrow.flight.protocol.HandshakeRequest",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},Tr=new qe,je=class extends y{constructor(){super("arrow.flight.protocol.HandshakeResponse",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},wr=new je,Je=class extends y{constructor(){super("arrow.flight.protocol.BasicAuth",[{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"password",kind:"scalar",T:9}])}},zi=new Je,Xe=class extends y{constructor(){super("arrow.flight.protocol.Empty",[])}},Fr=new Xe,Ge=class extends y{constructor(){super("arrow.flight.protocol.ActionType",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9}])}},Or=new Ge,Ke=class extends y{constructor(){super("arrow.flight.protocol.Criteria",[{no:1,name:"expression",kind:"scalar",T:12}])}},xr=new Ke,Qe=class extends y{constructor(){super("arrow.flight.protocol.Action",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"body",kind:"scalar",T:12}])}},Ir=new Qe,Ze=class extends y{constructor(){super("arrow.flight.protocol.CancelFlightInfoRequest",[{no:1,name:"info",kind:"message",T:()=>ge}])}},Yi=new Ze,ze=class extends y{constructor(){super("arrow.flight.protocol.RenewFlightEndpointRequest",[{no:1,name:"endpoint",kind:"message",T:()=>Qt}])}},es=new ze,Ye=class extends y{constructor(){super("arrow.flight.protocol.Result",[{no:1,name:"body",kind:"scalar",T:12}])}},Nr=new Ye,et=class extends y{constructor(){super("arrow.flight.protocol.CancelFlightInfoResult",[{no:1,name:"status",kind:"enum",T:()=>["arrow.flight.protocol.CancelStatus",Kt,"CANCEL_STATUS_"]}])}},ts=new et,tt=class extends y{constructor(){super("arrow.flight.protocol.SchemaResult",[{no:1,name:"schema",kind:"scalar",T:12}])}},kr=new tt,rt=class extends y{constructor(){super("arrow.flight.protocol.FlightDescriptor",[{no:1,name:"type",kind:"enum",T:()=>["arrow.flight.protocol.FlightDescriptor.DescriptorType",Gt]},{no:2,name:"cmd",kind:"scalar",T:12},{no:3,name:"path",kind:"scalar",repeat:2,T:9}])}},V=new rt,nt=class extends y{constructor(){super("arrow.flight.protocol.FlightInfo",[{no:1,name:"schema",kind:"scalar",T:12},{no:2,name:"flight_descriptor",kind:"message",T:()=>V},{no:3,name:"endpoint",kind:"message",repeat:1,T:()=>Qt},{no:4,name:"total_records",kind:"scalar",T:3,L:0},{no:5,name:"total_bytes",kind:"scalar",T:3,L:0},{no:6,name:"ordered",kind:"scalar",T:8},{no:7,name:"app_metadata",kind:"scalar",T:12}])}},ge=new nt,it=class extends y{constructor(){super("arrow.flight.protocol.PollInfo",[{no:1,name:"info",kind:"message",T:()=>ge},{no:2,name:"flight_descriptor",kind:"message",T:()=>V},{no:3,name:"progress",kind:"scalar",opt:!0,T:1},{no:4,name:"expiration_time",kind:"message",T:()=>$e}])}},Er=new it,st=class extends y{constructor(){super("arrow.flight.protocol.FlightEndpoint",[{no:1,name:"ticket",kind:"message",T:()=>be},{no:2,name:"location",kind:"message",repeat:1,T:()=>_r},{no:3,name:"expiration_time",kind:"message",T:()=>$e},{no:4,name:"app_metadata",kind:"scalar",T:12}])}},Qt=new st,ot=class extends y{constructor(){super("arrow.flight.protocol.Location",[{no:1,name:"uri",kind:"scalar",T:9}])}},_r=new ot,at=class extends y{constructor(){super("arrow.flight.protocol.Ticket",[{no:1,name:"ticket",kind:"scalar",T:12}])}},be=new at,lt=class extends y{constructor(){super("arrow.flight.protocol.FlightData",[{no:1,name:"flight_descriptor",kind:"message",T:()=>V},{no:2,name:"data_header",kind:"scalar",T:12},{no:3,name:"app_metadata",kind:"scalar",T:12},{no:1e3,name:"data_body",kind:"scalar",T:12}])}},de=new lt,ut=class extends y{constructor(){super("arrow.flight.protocol.PutResult",[{no:1,name:"app_metadata",kind:"scalar",T:12}])}},Sr=new ut,ye=new Xt.ServiceType("arrow.flight.protocol.FlightService",[{name:"Handshake",serverStreaming:!0,clientStreaming:!0,options:{},I:Tr,O:wr},{name:"ListFlights",serverStreaming:!0,options:{},I:xr,O:ge},{name:"GetFlightInfo",options:{},I:V,O:ge},{name:"PollFlightInfo",options:{},I:V,O:Er},{name:"GetSchema",options:{},I:V,O:kr},{name:"DoGet",serverStreaming:!0,options:{},I:be,O:de},{name:"DoPut",serverStreaming:!0,clientStreaming:!0,options:{},I:de,O:Sr},{name:"DoExchange",serverStreaming:!0,clientStreaming:!0,options:{},I:de,O:de},{name:"DoAction",serverStreaming:!0,options:{},I:Ir,O:Nr},{name:"ListActions",serverStreaming:!0,options:{},I:Fr,O:Or}]);var N=K("@protobuf-ts/runtime-rpc"),Te=class{constructor(e){this._transport=e;this.typeName=ye.typeName;this.methods=ye.methods;this.options=ye.options}handshake(e){let t=this.methods[0],r=this._transport.mergeOptions(e);return(0,N.stackIntercept)("duplex",this._transport,t,r)}listFlights(e,t){let r=this.methods[1],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}getFlightInfo(e,t){let r=this.methods[2],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("unary",this._transport,r,i,e)}pollFlightInfo(e,t){let r=this.methods[3],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("unary",this._transport,r,i,e)}getSchema(e,t){let r=this.methods[4],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("unary",this._transport,r,i,e)}doGet(e,t){let r=this.methods[5],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}doPut(e){let t=this.methods[6],r=this._transport.mergeOptions(e);return(0,N.stackIntercept)("duplex",this._transport,t,r)}doExchange(e){let t=this.methods[7],r=this._transport.mergeOptions(e);return(0,N.stackIntercept)("duplex",this._transport,t,r)}doAction(e,t){let r=this.methods[8],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}listActions(e,t){let r=this.methods[9],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}};var Zt=/\$(\w+)/g;function zt(n){return!!n.match(Zt)}function Yt(n,e){let t=n.match(Zt);if(t)for(let r of t)e[r.trim().replace("$","")]||L(new Error(`No parameter matching ${r} provided in the query params map`));return!0}var Rr="0.11.0",er=`influxdb3-js/${Rr}`;var X=class{constructor(e){this._options=e;this._closed=!1;let{host:t,queryTimeout:r}=this._options;this._defaultHeaders=this._options.headers,this._transport=$.queryTransport({host:t,timeout:r}),this._flightClient=new Te(this._transport)}prepareTicket(e,t,r){let i={database:e,sql_query:t,query_type:r.type};if(r.params){let s={};for(let o of Object.keys(r.params))r.params[o]&&(s[o]=r.params[o]);i.params=s}return be.create({ticket:new TextEncoder().encode(JSON.stringify(i))})}prepareMetadata(e){let t={"User-Agent":er,...this._defaultHeaders,...e},r=this._options.token;return r&&(t.authorization=`Bearer ${r}`),t}async*_queryRawBatches(e,t,r){if(r.params&&zt(e)&&Yt(e,r.params),this._closed)throw new Error("queryApi: already closed!");let i=this._flightClient,s=this.prepareTicket(t,e,r),a={meta:this.prepareMetadata(r.headers)},l=i.doGet(s,a),f=async function*(){for await(let p of l.responses)yield Ot(p.dataHeader.length),yield p.dataHeader,yield p.dataBody}();yield*await we.RecordBatchReader.from(f)}async*query(e,t,r){var s;let i=this._queryRawBatches(e,t,r);for await(let o of i)for(let a=0;a<o.numRows;a++){let l={};for(let f=0;f<o.numCols;f++){let c=o.schema.fields[f].name,p=(s=o.getChildAt(f))==null?void 0:s.get(a);l[c]=p}yield l}}async*queryPoints(e,t,r){var s;let i=this._queryRawBatches(e,t,r);for await(let o of i)for(let a=0;a<o.numRows;a++){let l=new R;for(let f=0;f<o.numCols;f++){let c=o.schema.fields[f],p=c.name,m=(s=o.getChildAt(f))==null?void 0:s.get(a),F=c.typeId,d=c.metadata.get("iox::column::type");if(m==null)continue;if((p==="measurement"||p=="iox::measurement")&&typeof m=="string"){l.setMeasurement(m);continue}if(!d){p==="time"&&F===we.Type.Timestamp?l.setTimestamp(m):l.setField(p,m);continue}let[,,O,P]=d.split("::");O==="field"?P&&m!==void 0&&m!==null&&l.setField(p,m,P):O==="tag"?l.setTag(p,m):O==="timestamp"&&l.setTimestamp(m)}yield l}}async close(){var e,t;this._closed=!0,(t=(e=this._transport).close)==null||t.call(e)}};var ft=`Please specify the 'database' as a method parameter or use default configuration at 'ClientOptions.database' | ||
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:o=s,i=1;break;case 1:t[r++]=o<<2|(s&48)>>4,o=s,i=2;break;case 2:t[r++]=(o&15)<<4|(s&60)>>2,o=s,i=3;break;case 3:t[r++]=(o&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,r)}function Et(n){let e="",t=0,r,i=0;for(let s=0;s<n.length;s++)switch(r=n[s],t){case 0:e+=_[r>>2],i=(r&3)<<4,t=1;break;case 1:e+=_[i|r>>4],i=(r&15)<<2,t=2;break;case 2:e+=_[i|r>>6],e+=_[r&63],t=0;break}return t&&(e+=_[i],e+="=",t==1&&(e+="=")),e}var B;(function(n){n.symbol=Symbol.for("protobuf-ts/unknown"),n.onRead=(t,r,i,s,o)=>{(e(r)?r[n.symbol]:r[n.symbol]=[]).push({no:i,wireType:s,data:o})},n.onWrite=(t,r,i)=>{for(let{no:s,wireType:o,data:a}of n.list(r))i.tag(s,o).raw(a)},n.list=(t,r)=>{if(e(t)){let i=t[n.symbol];return r?i.filter(s=>s.no==r):i}return[]},n.last=(t,r)=>n.list(t,r).slice(-1)[0];let e=t=>t&&Array.isArray(t[n.symbol])})(B||(B={}));var T;(function(n){n[n.Varint=0]="Varint",n[n.Bit64=1]="Bit64",n[n.LengthDelimited=2]="LengthDelimited",n[n.StartGroup=3]="StartGroup",n[n.EndGroup=4]="EndGroup",n[n.Bit32=5]="Bit32"})(T||(T={}));function _t(){let n=0,e=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(n|=(i&127)<<r,!(i&128))return this.assertBounds(),[n,e]}let t=this.buf[this.pos++];if(n|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[n,e];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<r,!(i&128))return this.assertBounds(),[n,e]}throw new Error("invalid varint")}function re(n,e,t){for(let s=0;s<28;s=s+7){let o=n>>>s,a=!(!(o>>>7)&&e==0),l=(a?o|128:o)&255;if(t.push(l),!a)return}let r=n>>>28&15|(e&7)<<4,i=!!(e>>3);if(t.push((i?r|128:r)&255),!!i){for(let s=3;s<31;s=s+7){let o=e>>>s,a=!!(o>>>7),l=(a?o|128:o)&255;if(t.push(l),!a)return}t.push(e>>>31&1)}}var te=65536*65536;function Be(n){let e=n[0]=="-";e&&(n=n.slice(1));let t=1e6,r=0,i=0;function s(o,a){let l=Number(n.slice(o,a));i*=t,r=r*t+l,r>=te&&(i=i+(r/te|0),r=r%te)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[e,r,i]}function ne(n,e){if(e>>>0<=2097151)return""+(te*e+(n>>>0));let t=n&16777215,r=(n>>>24|e<<8)>>>0&16777215,i=e>>16&65535,s=t+r*6777216+i*6710656,o=r+i*8147497,a=i*2,l=1e7;s>=l&&(o+=Math.floor(s/l),s%=l),o>=l&&(a+=Math.floor(o/l),o%=l);function f(c,p){let m=c?String(c):"";return p?"0000000".slice(m.length)+m:m}return f(a,0)+f(o,a)+f(s,1)}function ve(n,e){if(n>=0){for(;n>127;)e.push(n&127|128),n=n>>>7;e.push(n)}else{for(let t=0;t<9;t++)e.push(n&127|128),n=n>>7;e.push(1)}}function St(){let n=this.buf[this.pos++],e=n&127;if(!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<7,!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<14,!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<21,!(n&128))return this.assertBounds(),e;n=this.buf[this.pos++],e|=(n&15)<<28;for(let t=5;n&128&&t<10;t++)n=this.buf[this.pos++];if(n&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var b;function pr(){let n=new DataView(new ArrayBuffer(8));b=globalThis.BigInt!==void 0&&typeof n.getBigInt64=="function"&&typeof n.getBigUint64=="function"&&typeof n.setBigInt64=="function"&&typeof n.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:n}:void 0}pr();function Rt(n){if(!n)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var At=/^-?[0-9]+$/,se=4294967296,ie=2147483648,oe=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*se+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},w=class n extends oe{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(e<b.UMIN)throw new Error("signed value for ulong");if(e>b.UMAX)throw new Error("ulong too large");return b.V.setBigUint64(0,e,!0),new n(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!At.test(e))throw new Error("string is no integer");let[t,r,i]=Be(e);if(t)throw new Error("signed value for ulong");return new n(r,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new n(e,e/se)}throw new Error("unknown value "+typeof e)}toString(){return b?this.toBigInt().toString():ne(this.lo,this.hi)}toBigInt(){return Rt(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigUint64(0,!0)}};w.ZERO=new w(0,0);var g=class n extends oe{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(e<b.MIN)throw new Error("signed long too small");if(e>b.MAX)throw new Error("signed long too large");return b.V.setBigInt64(0,e,!0),new n(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!At.test(e))throw new Error("string is no integer");let[t,r,i]=Be(e);if(t){if(i>ie||i==ie&&r!=0)throw new Error("signed long too small")}else if(i>=ie)throw new Error("signed long too large");let s=new n(r,i);return t?s.negate():s;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new n(e,e/se):new n(-e,-e/se).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&ie)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new n(t,e)}toString(){if(b)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+ne(e.lo,e.hi)}return ne(this.lo,this.hi)}toBigInt(){return Rt(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigInt64(0,!0)}};g.ZERO=new g(0,0);var Pt={readUnknownField:!0,readerFactory:n=>new Ve(n)};function Dt(n){return n?Object.assign(Object.assign({},Pt),n):Pt}var Ve=class{constructor(e,t){this.varint64=_t,this.uint32=St,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t!=null?t:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,r=e&7;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e){let t=this.pos;switch(e){case T.Varint:for(;this.buf[this.pos++]&128;);break;case T.Bit64:this.pos+=4;case T.Bit32:this.pos+=4;break;case T.LengthDelimited:let r=this.uint32();this.pos+=r;break;case T.StartGroup:let i;for(;(i=this.tag()[1])!==T.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,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 new g(...this.varint64())}uint64(){return new w(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new g(e,t)}bool(){let[e,t]=this.varint64();return e!==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 new w(this.sfixed32(),this.sfixed32())}sfixed64(){return new g(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function h(n,e){if(!n)throw new Error(e)}var mr=34028234663852886e22,hr=-34028234663852886e22,dr=4294967295,gr=2147483647,br=-2147483648;function A(n){if(typeof n!="number")throw new Error("invalid int 32: "+typeof n);if(!Number.isInteger(n)||n>gr||n<br)throw new Error("invalid int 32: "+n)}function C(n){if(typeof n!="number")throw new Error("invalid uint 32: "+typeof n);if(!Number.isInteger(n)||n>dr||n<0)throw new Error("invalid uint 32: "+n)}function v(n){if(typeof n!="number")throw new Error("invalid float 32: "+typeof n);if(Number.isFinite(n)&&(n>mr||n<hr))throw new Error("invalid float 32: "+n)}var Ut={writeUnknownFields:!0,writerFactory:()=>new Me};function Ct(n){return n?Object.assign(Object.assign({},Ut),n):Ut}var Me=class{constructor(e){this.stack=[],this.textEncoder=e!=null?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let t=new Uint8Array(e),r=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],r),r+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(C(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return A(e),ve(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){v(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){C(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){A(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return A(e),e=(e<<1^e>>31)>>>0,ve(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=g.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=w.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=g.from(e);return re(t.lo,t.hi,this.buf),this}sint64(e){let t=g.from(e),r=t.hi>>31,i=t.lo<<1^r,s=(t.hi<<1|t.lo>>>31)^r;return re(i,s,this.buf),this}uint64(e){let t=w.from(e);return re(t.lo,t.hi,this.buf),this}};var Lt={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},Bt={ignoreUnknownFields:!1};function vt(n){return n?Object.assign(Object.assign({},Bt),n):Bt}function Vt(n){return n?Object.assign(Object.assign({},Lt),n):Lt}var ae=Symbol.for("protobuf-ts/message-type");function We(n){let e=!1,t=[];for(let r=0;r<n.length;r++){let i=n.charAt(r);i=="_"?e=!0:/\d/.test(i)?(t.push(i),e=!0):e?(t.push(i.toUpperCase()),e=!1):r==0?t.push(i.toLowerCase()):t.push(i)}return t.join("")}var u;(function(n){n[n.DOUBLE=1]="DOUBLE",n[n.FLOAT=2]="FLOAT",n[n.INT64=3]="INT64",n[n.UINT64=4]="UINT64",n[n.INT32=5]="INT32",n[n.FIXED64=6]="FIXED64",n[n.FIXED32=7]="FIXED32",n[n.BOOL=8]="BOOL",n[n.STRING=9]="STRING",n[n.BYTES=12]="BYTES",n[n.UINT32=13]="UINT32",n[n.SFIXED32=15]="SFIXED32",n[n.SFIXED64=16]="SFIXED64",n[n.SINT32=17]="SINT32",n[n.SINT64=18]="SINT64"})(u||(u={}));var x;(function(n){n[n.BIGINT=0]="BIGINT",n[n.STRING=1]="STRING",n[n.NUMBER=2]="NUMBER"})(x||(x={}));var j;(function(n){n[n.NO=0]="NO",n[n.PACKED=1]="PACKED",n[n.UNPACKED=2]="UNPACKED"})(j||(j={}));function Mt(n){var e,t,r,i;return n.localName=(e=n.localName)!==null&&e!==void 0?e:We(n.name),n.jsonName=(t=n.jsonName)!==null&&t!==void 0?t:We(n.name),n.repeat=(r=n.repeat)!==null&&r!==void 0?r:j.NO,n.opt=(i=n.opt)!==null&&i!==void 0?i:n.repeat||n.oneof?!1:n.kind=="message",n}function Wt(n){if(typeof n!="object"||n===null||!n.hasOwnProperty("oneofKind"))return!1;switch(typeof n.oneofKind){case"string":return n[n.oneofKind]===void 0?!1:Object.keys(n).length==2;case"undefined":return Object.keys(n).length==1;default:return!1}}var le=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;let e=[],t=[],r=[];for(let i of this.fields)if(i.oneof)r.includes(i.oneof)||(r.push(i.oneof),e.push(i.oneof),t.push(i.oneof));else switch(t.push(i.localName),i.kind){case"scalar":case"enum":(!i.opt||i.repeat)&&e.push(i.localName);break;case"message":i.repeat&&e.push(i.localName);break;case"map":e.push(i.localName);break}this.data={req:e,known:t,oneofs:Object.values(r)}}is(e,t,r=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let i=Object.keys(e),s=this.data;if(i.length<s.req.length||s.req.some(o=>!i.includes(o))||!r&&i.some(o=>!s.known.includes(o)))return!1;if(t<1)return!0;for(let o of s.oneofs){let a=e[o];if(!Wt(a))return!1;if(a.oneofKind===void 0)continue;let l=this.fields.find(f=>f.localName===a.oneofKind);if(!l||!this.field(a[a.oneofKind],l,r,t))return!1}for(let o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,r,t))return!1;return!0}field(e,t,r,i){let s=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:s?this.scalars(e,t.T,i,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:s?this.scalars(e,u.INT32,i):this.scalar(e,u.INT32);case"message":return e===void 0?!0:s?this.messages(e,t.T(),r,i):this.message(e,t.T(),r,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,t.K,i))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,i,t.V.L);case"enum":return this.scalars(Object.values(e),u.INT32,i);case"message":return this.messages(Object.values(e),t.V.T(),r,i)}break}return!0}message(e,t,r,i){return r?t.isAssignable(e,i):t.is(e,i)}messages(e,t,r,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(r){for(let s=0;s<e.length&&s<i;s++)if(!t.isAssignable(e[s],i-1))return!1}else for(let s=0;s<e.length&&s<i;s++)if(!t.is(e[s],i-1))return!1;return!0}scalar(e,t,r){let i=typeof e;switch(t){case u.UINT64:case u.FIXED64:case u.INT64:case u.SFIXED64:case u.SINT64:switch(r){case x.BIGINT:return i=="bigint";case x.NUMBER:return i=="number"&&!isNaN(e);default:return i=="string"}case u.BOOL:return i=="boolean";case u.STRING:return i=="string";case u.BYTES:return e instanceof Uint8Array;case u.DOUBLE:case u.FLOAT:return i=="number"&&!isNaN(e);default:return i=="number"&&Number.isInteger(e)}}scalars(e,t,r,i){if(!Array.isArray(e))return!1;if(r<2)return!0;if(Array.isArray(e)){for(let s=0;s<e.length&&s<r;s++)if(!this.scalar(e[s],t,i))return!1}return!0}mapKeys(e,t,r){let i=Object.keys(e);switch(t){case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:return this.scalars(i.slice(0,r).map(s=>parseInt(s)),t,r);case u.BOOL:return this.scalars(i.slice(0,r).map(s=>s=="true"?!0:s=="false"?!1:s),t,r);default:return this.scalars(i,t,r,x.STRING)}}};function I(n,e){switch(e){case x.BIGINT:return n.toBigInt();case x.NUMBER:return n.toNumber();default:return n.toString()}}var ue=class{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};let t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(let r of t)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,t,r){if(!e){let i=U(r);throw(i=="number"||i=="boolean")&&(i=r.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${t}`)}}read(e,t,r){this.prepare();let i=[];for(let[s,o]of Object.entries(e)){let a=this.fMap[s];if(!a){if(!r.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}let l=a.localName,f;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(i.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(a.oneof),f=t[a.oneof]={oneofKind:l}}else f=t;if(a.kind=="map"){if(o===null)continue;this.assert(Le(o),a.name,o);let c=f[l];for(let[p,m]of Object.entries(o)){this.assert(m!==null,a.name+" map value",null);let F;switch(a.V.kind){case"message":F=a.V.T().internalJsonRead(m,r);break;case"enum":if(F=this.enum(a.V.T(),m,a.name,r.ignoreUnknownFields),F===!1)continue;break;case"scalar":F=this.scalar(m,a.V.T,a.V.L,a.name);break}this.assert(F!==void 0,a.name+" map value",m);let d=p;a.K==u.BOOL&&(d=d=="true"?!0:d=="false"?!1:d),d=this.scalar(d,a.K,x.STRING,a.name).toString(),c[d]=F}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);let c=f[l];for(let p of o){this.assert(p!==null,a.name,null);let m;switch(a.kind){case"message":m=a.T().internalJsonRead(p,r);break;case"enum":if(m=this.enum(a.T(),p,a.name,r.ignoreUnknownFields),m===!1)continue;break;case"scalar":m=this.scalar(p,a.T,a.L,a.name);break}this.assert(m!==void 0,a.name,o),c.push(m)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}f[l]=a.T().internalJsonRead(o,r,f[l]);break;case"enum":let c=this.enum(a.T(),o,a.name,r.ignoreUnknownFields);if(c===!1)continue;f[l]=c;break;case"scalar":f[l]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,r,i){if(e[0]=="google.protobuf.NullValue"&&h(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return h(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${r}, enum can only be integral number, got ${t}.`),t;case"string":let s=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(s=t.substring(e[2].length));let o=e[1][s];return typeof o=="undefined"&&i?!1:(h(typeof o=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${t}".`),o)}h(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,r,i){let s;try{switch(t){case u.DOUBLE:case u.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){s="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){s="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){s="not a number";break}if(!Number.isFinite(o)){s="too large or small";break}return t==u.FLOAT&&v(o),o;case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?s="empty string":typeof e=="string"&&(e.trim().length!==e.length?s="extra whitespace":a=Number(e)),a===void 0)break;return t==u.UINT32?C(a):A(a),a;case u.INT64:case u.SFIXED64:case u.SINT64:if(e===null)return I(g.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return I(g.from(e),r);case u.FIXED64:case u.UINT64:if(e===null)return I(w.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return I(w.from(e),r);case u.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case u.STRING:if(e===null)return"";if(typeof e!="string"){s="extra whitespace";break}try{encodeURIComponent(e)}catch(l){l="invalid UTF8";break}return e;case u.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return kt(e)}}catch(o){s=o.message}this.assert(!1,i+(s?" - "+s:""),e)}};var fe=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){let r={},i=e;for(let s of this.fields){if(!s.oneof){let f=this.field(s,i[s.localName],t);f!==void 0&&(r[t.useProtoFieldName?s.name:s.jsonName]=f);continue}let o=i[s.oneof];if(o.oneofKind!==s.localName)continue;let a=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,l=this.field(s,o[s.localName],a);h(l!==void 0),r[t.useProtoFieldName?s.name:s.jsonName]=l}return r}field(e,t,r){let i;if(e.kind=="map"){h(typeof t=="object"&&t!==null);let s={};switch(e.V.kind){case"scalar":for(let[l,f]of Object.entries(t)){let c=this.scalar(e.V.T,f,e.name,!1,!0);h(c!==void 0),s[l.toString()]=c}break;case"message":let o=e.V.T();for(let[l,f]of Object.entries(t)){let c=this.message(o,f,e.name,r);h(c!==void 0),s[l.toString()]=c}break;case"enum":let a=e.V.T();for(let[l,f]of Object.entries(t)){h(f===void 0||typeof f=="number");let c=this.enum(a,f,e.name,!1,!0,r.enumAsInteger);h(c!==void 0),s[l.toString()]=c}break}(r.emitDefaultValues||Object.keys(s).length>0)&&(i=s)}else if(e.repeat){h(Array.isArray(t));let s=[];switch(e.kind){case"scalar":for(let l=0;l<t.length;l++){let f=this.scalar(e.T,t[l],e.name,e.opt,!0);h(f!==void 0),s.push(f)}break;case"enum":let o=e.T();for(let l=0;l<t.length;l++){h(t[l]===void 0||typeof t[l]=="number");let f=this.enum(o,t[l],e.name,e.opt,!0,r.enumAsInteger);h(f!==void 0),s.push(f)}break;case"message":let a=e.T();for(let l=0;l<t.length;l++){let f=this.message(a,t[l],e.name,r);h(f!==void 0),s.push(f)}break}(r.emitDefaultValues||s.length>0||r.emitDefaultValues)&&(i=s)}else switch(e.kind){case"scalar":i=this.scalar(e.T,t,e.name,e.opt,r.emitDefaultValues);break;case"enum":i=this.enum(e.T(),t,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":i=this.message(e.T(),t,e.name,r);break}return i}enum(e,t,r,i,s,o){if(e[0]=="google.protobuf.NullValue")return!s&&!i?void 0:null;if(t===void 0){h(i);return}if(!(t===0&&!s&&!i))return h(typeof t=="number"),h(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,r,i){return t===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(t,i)}scalar(e,t,r,i,s){if(t===void 0){h(i);return}let o=s||i;switch(e){case u.INT32:case u.SFIXED32:case u.SINT32:return t===0?o?0:void 0:(A(t),t);case u.FIXED32:case u.UINT32:return t===0?o?0:void 0:(C(t),t);case u.FLOAT:v(t);case u.DOUBLE:return t===0?o?0:void 0:(h(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case u.STRING:return t===""?o?"":void 0:(h(typeof t=="string"),t);case u.BOOL:return t===!1?o?!1:void 0:(h(typeof t=="boolean"),t);case u.UINT64:case u.FIXED64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=w.from(t);return a.isZero()&&!o?void 0:a.toString();case u.INT64:case u.SFIXED64:case u.SINT64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let l=g.from(t);return l.isZero()&&!o?void 0:l.toString();case u.BYTES:return h(t instanceof Uint8Array),t.byteLength?Et(t):o?"":void 0}}};function J(n,e=x.STRING){switch(n){case u.BOOL:return!1;case u.UINT64:case u.FIXED64:return I(w.ZERO,e);case u.INT64:case u.SFIXED64:case u.SINT64:return I(g.ZERO,e);case u.DOUBLE:case u.FLOAT:return 0;case u.BYTES:return new Uint8Array(0);case u.STRING:return"";default:return 0}}var ce=class{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(r=>[r.no,r]))}}read(e,t,r,i){this.prepare();let s=i===void 0?e.len:e.pos+i;for(;e.pos<s;){let[o,a]=e.tag(),l=this.fieldNoToField.get(o);if(!l){let m=r.readUnknownField;if(m=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let F=e.skip(a);m!==!1&&(m===!0?B.onRead:m)(this.info.typeName,t,o,a,F);continue}let f=t,c=l.repeat,p=l.localName;switch(l.oneof&&(f=f[l.oneof],f.oneofKind!==p&&(f=t[l.oneof]={oneofKind:p})),l.kind){case"scalar":case"enum":let m=l.kind=="enum"?u.INT32:l.T,F=l.kind=="scalar"?l.L:void 0;if(c){let P=f[p];if(a==T.LengthDelimited&&m!=u.STRING&&m!=u.BYTES){let Fe=e.uint32()+e.pos;for(;e.pos<Fe;)P.push(this.scalar(e,m,F))}else P.push(this.scalar(e,m,F))}else f[p]=this.scalar(e,m,F);break;case"message":if(c){let P=f[p],Fe=l.T().internalBinaryRead(e,e.uint32(),r);P.push(Fe)}else f[p]=l.T().internalBinaryRead(e,e.uint32(),r,f[p]);break;case"map":let[d,O]=this.mapEntry(l,e,r);f[p][d]=O;break}}}mapEntry(e,t,r){let i=t.uint32(),s=t.pos+i,o,a;for(;t.pos<s;){let[l,f]=t.tag();switch(l){case 1:e.K==u.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,x.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),r);break}break;default:throw new Error(`Unknown field ${l} (wire type ${f}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let l=J(e.K);o=e.K==u.BOOL?l.toString():l}if(a===void 0)switch(e.V.kind){case"scalar":a=J(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create();break}return[o,a]}scalar(e,t,r){switch(t){case u.INT32:return e.int32();case u.STRING:return e.string();case u.BOOL:return e.bool();case u.DOUBLE:return e.double();case u.FLOAT:return e.float();case u.INT64:return I(e.int64(),r);case u.UINT64:return I(e.uint64(),r);case u.FIXED64:return I(e.fixed64(),r);case u.FIXED32:return e.fixed32();case u.BYTES:return e.bytes();case u.UINT32:return e.uint32();case u.SFIXED32:return e.sfixed32();case u.SFIXED64:return I(e.sfixed64(),r);case u.SINT32:return e.sint32();case u.SINT64:return I(e.sint64(),r)}}};var pe=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,r)=>t.no-r.no)}}write(e,t,r){this.prepare();for(let s of this.fields){let o,a,l=s.repeat,f=s.localName;if(s.oneof){let c=e[s.oneof];if(c.oneofKind!==f)continue;o=c[f],a=!0}else o=e[f],a=!1;switch(s.kind){case"scalar":case"enum":let c=s.kind=="enum"?u.INT32:s.T;if(l)if(h(Array.isArray(o)),l==j.PACKED)this.packed(t,c,s.no,o);else for(let p of o)this.scalar(t,c,s.no,p,!0);else o===void 0?h(s.opt):this.scalar(t,c,s.no,o,a||s.opt);break;case"message":if(l){h(Array.isArray(o));for(let p of o)this.message(t,r,s.T(),s.no,p)}else this.message(t,r,s.T(),s.no,o);break;case"map":h(typeof o=="object"&&o!==null);for(let[p,m]of Object.entries(o))this.mapEntry(t,r,s,p,m);break}}let i=r.writeUnknownFields;i!==!1&&(i===!0?B.onWrite:i)(this.info.typeName,e,t)}mapEntry(e,t,r,i,s){e.tag(r.no,T.LengthDelimited),e.fork();let o=i;switch(r.K){case u.INT32:case u.FIXED32:case u.UINT32:case u.SFIXED32:case u.SINT32:o=Number.parseInt(i);break;case u.BOOL:h(i=="true"||i=="false"),o=i=="true";break}switch(this.scalar(e,r.K,1,o,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,s,!0);break;case"enum":this.scalar(e,u.INT32,2,s,!0);break;case"message":this.message(e,t,r.V.T(),2,s);break}e.join()}message(e,t,r,i,s){s!==void 0&&(r.internalBinaryWrite(s,e.tag(i,T.LengthDelimited).fork(),t),e.join())}scalar(e,t,r,i,s){let[o,a,l]=this.scalarInfo(t,i);(!l||s)&&(e.tag(r,o),e[a](i))}packed(e,t,r,i){if(!i.length)return;h(t!==u.BYTES&&t!==u.STRING),e.tag(r,T.LengthDelimited),e.fork();let[,s]=this.scalarInfo(t);for(let o=0;o<i.length;o++)e[s](i[o]);e.join()}scalarInfo(e,t){let r=T.Varint,i,s=t===void 0,o=t===0;switch(e){case u.INT32:i="int32";break;case u.STRING:o=s||!t.length,r=T.LengthDelimited,i="string";break;case u.BOOL:o=t===!1,i="bool";break;case u.UINT32:i="uint32";break;case u.DOUBLE:r=T.Bit64,i="double";break;case u.FLOAT:r=T.Bit32,i="float";break;case u.INT64:o=s||g.from(t).isZero(),i="int64";break;case u.UINT64:o=s||w.from(t).isZero(),i="uint64";break;case u.FIXED64:o=s||w.from(t).isZero(),r=T.Bit64,i="fixed64";break;case u.BYTES:o=s||!t.byteLength,r=T.LengthDelimited,i="bytes";break;case u.FIXED32:r=T.Bit32,i="fixed32";break;case u.SFIXED32:r=T.Bit32,i="sfixed32";break;case u.SFIXED64:o=s||g.from(t).isZero(),r=T.Bit64,i="sfixed64";break;case u.SINT32:i="sint32";break;case u.SINT64:o=s||g.from(t).isZero(),i="sint64";break}return[r,i,s||o]}};function Ht(n){let e=n.messagePrototype?Object.create(n.messagePrototype):Object.defineProperty({},ae,{value:n});for(let t of n.fields){let r=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[r]=[];else switch(t.kind){case"scalar":e[r]=J(t.T,t.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function me(n,e,t){let r,i=t,s;for(let o of n.fields){let a=o.localName;if(o.oneof){let l=i[o.oneof];if((l==null?void 0:l.oneofKind)==null)continue;if(r=l[a],s=e[o.oneof],s.oneofKind=l.oneofKind,r==null){delete s[a];continue}}else if(r=i[a],s=e,r==null)continue;switch(o.repeat&&(s[a].length=r.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let f=0;f<r.length;f++)s[a][f]=r[f];else s[a]=r;break;case"message":let l=o.T();if(o.repeat)for(let f=0;f<r.length;f++)s[a][f]=l.create(r[f]);else s[a]===void 0?s[a]=l.create(r):l.mergePartial(s[a],r);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(s[a],r);break;case"message":let f=o.V.T();for(let c of Object.keys(r))s[a][c]=f.create(r[c]);break}break}}}function jt(n,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let r of n.fields){let i=r.localName,s=r.oneof?e[r.oneof][i]:e[i],o=r.oneof?t[r.oneof][i]:t[i];switch(r.kind){case"enum":case"scalar":let a=r.kind=="enum"?u.INT32:r.T;if(!(r.repeat?$t(a,s,o):Jt(a,s,o)))return!1;break;case"map":if(!(r.V.kind=="message"?qt(r.V.T(),he(s),he(o)):$t(r.V.kind=="enum"?u.INT32:r.V.T,he(s),he(o))))return!1;break;case"message":let l=r.T();if(!(r.repeat?qt(l,s,o):l.equals(s,o)))return!1;break}}return!0}var he=Object.values;function Jt(n,e,t){if(e===t)return!0;if(n!==u.BYTES)return!1;let r=e,i=t;if(r.length!==i.length)return!1;for(let s=0;s<r.length;s++)if(r[s]!=i[s])return!1;return!0}function $t(n,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Jt(n,e[r],t[r]))return!1;return!0}function qt(n,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n.equals(e[r],t[r]))return!1;return!0}var yr=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),y=class{constructor(e,t,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(Mt),this.options=r!=null?r:{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},yr),{[ae]:{value:this}})),this.refTypeCheck=new le(this),this.refJsonReader=new ue(this),this.refJsonWriter=new fe(this),this.refBinReader=new ce(this),this.refBinWriter=new pe(this)}create(e){let t=Ht(this);return e!==void 0&&me(this,t,e),t}clone(e){let t=this.create();return me(this,t,e),t}equals(e,t){return jt(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){me(this,e,t)}fromBinary(e,t){let r=Dt(t);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,t){return this.internalJsonRead(e,vt(t))}fromJsonString(e,t){let r=JSON.parse(e);return this.fromJson(r,t)}toJson(e,t){return this.internalJsonWrite(e,Vt(t))}toJsonString(e,t){var r;let i=this.toJson(e,t);return JSON.stringify(i,null,(r=t==null?void 0:t.prettySpaces)!==null&&r!==void 0?r:0)}toBinary(e,t){let r=Ct(t);return this.internalBinaryWrite(e,r.writerFactory(),r).finish()}internalJsonRead(e,t,r){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let i=r!=null?r:this.create();return this.refJsonReader.read(e,i,t),i}throw new Error(`Unable to parse message ${this.typeName} from JSON ${U(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,r){return this.refBinWriter.write(e,t,r),t}internalBinaryRead(e,t,r,i){let s=i!=null?i:this.create();return this.refBinReader.read(e,s,r,t),s}};var He=class extends y{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){let e=this.create(),t=Date.now();return e.seconds=g.from(Math.floor(t/1e3)).toBigInt(),e.nanos=t%1e3*1e6,e}toDate(e){return new Date(g.from(e.seconds).toNumber()*1e3+Math.ceil(e.nanos/1e6))}fromDate(e){let t=this.create(),r=e.getTime();return t.seconds=g.from(Math.floor(r/1e3)).toBigInt(),t.nanos=r%1e3*1e6,t}internalJsonWrite(e,t){let r=g.from(e.seconds).toNumber()*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(e.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let i="Z";if(e.nanos>0){let s=(e.nanos+1e9).toString().substring(1);s.substring(3)==="000000"?i="."+s.substring(0,3)+"Z":s.substring(6)==="000"?i="."+s.substring(0,6)+"Z":i="."+s+"Z"}return new Date(r).toISOString().replace(".000Z",i)}internalJsonRead(e,t,r){if(typeof e!="string")throw new Error("Unable to parse Timestamp from JSON "+U(e)+".");let i=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let s=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(s))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(s<Date.parse("0001-01-01T00:00:00Z")||s>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return r||(r=this.create()),r.seconds=g.from(s/1e3).toBigInt(),r.nanos=0,i[7]&&(r.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),r}},$e=new He;var Gt=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.PATH=1]="PATH",r[r.CMD=2]="CMD",r))(Gt||{}),Kt=(i=>(i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.CANCELLED=1]="CANCELLED",i[i.CANCELLING=2]="CANCELLING",i[i.NOT_CANCELLABLE=3]="NOT_CANCELLABLE",i))(Kt||{}),qe=class extends y{constructor(){super("arrow.flight.protocol.HandshakeRequest",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},Tr=new qe,je=class extends y{constructor(){super("arrow.flight.protocol.HandshakeResponse",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},wr=new je,Je=class extends y{constructor(){super("arrow.flight.protocol.BasicAuth",[{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"password",kind:"scalar",T:9}])}},zi=new Je,Xe=class extends y{constructor(){super("arrow.flight.protocol.Empty",[])}},Fr=new Xe,Ge=class extends y{constructor(){super("arrow.flight.protocol.ActionType",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9}])}},Or=new Ge,Ke=class extends y{constructor(){super("arrow.flight.protocol.Criteria",[{no:1,name:"expression",kind:"scalar",T:12}])}},xr=new Ke,Qe=class extends y{constructor(){super("arrow.flight.protocol.Action",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"body",kind:"scalar",T:12}])}},Ir=new Qe,Ze=class extends y{constructor(){super("arrow.flight.protocol.CancelFlightInfoRequest",[{no:1,name:"info",kind:"message",T:()=>ge}])}},Yi=new Ze,ze=class extends y{constructor(){super("arrow.flight.protocol.RenewFlightEndpointRequest",[{no:1,name:"endpoint",kind:"message",T:()=>Qt}])}},es=new ze,Ye=class extends y{constructor(){super("arrow.flight.protocol.Result",[{no:1,name:"body",kind:"scalar",T:12}])}},Nr=new Ye,et=class extends y{constructor(){super("arrow.flight.protocol.CancelFlightInfoResult",[{no:1,name:"status",kind:"enum",T:()=>["arrow.flight.protocol.CancelStatus",Kt,"CANCEL_STATUS_"]}])}},ts=new et,tt=class extends y{constructor(){super("arrow.flight.protocol.SchemaResult",[{no:1,name:"schema",kind:"scalar",T:12}])}},kr=new tt,rt=class extends y{constructor(){super("arrow.flight.protocol.FlightDescriptor",[{no:1,name:"type",kind:"enum",T:()=>["arrow.flight.protocol.FlightDescriptor.DescriptorType",Gt]},{no:2,name:"cmd",kind:"scalar",T:12},{no:3,name:"path",kind:"scalar",repeat:2,T:9}])}},V=new rt,nt=class extends y{constructor(){super("arrow.flight.protocol.FlightInfo",[{no:1,name:"schema",kind:"scalar",T:12},{no:2,name:"flight_descriptor",kind:"message",T:()=>V},{no:3,name:"endpoint",kind:"message",repeat:1,T:()=>Qt},{no:4,name:"total_records",kind:"scalar",T:3,L:0},{no:5,name:"total_bytes",kind:"scalar",T:3,L:0},{no:6,name:"ordered",kind:"scalar",T:8},{no:7,name:"app_metadata",kind:"scalar",T:12}])}},ge=new nt,it=class extends y{constructor(){super("arrow.flight.protocol.PollInfo",[{no:1,name:"info",kind:"message",T:()=>ge},{no:2,name:"flight_descriptor",kind:"message",T:()=>V},{no:3,name:"progress",kind:"scalar",opt:!0,T:1},{no:4,name:"expiration_time",kind:"message",T:()=>$e}])}},Er=new it,st=class extends y{constructor(){super("arrow.flight.protocol.FlightEndpoint",[{no:1,name:"ticket",kind:"message",T:()=>be},{no:2,name:"location",kind:"message",repeat:1,T:()=>_r},{no:3,name:"expiration_time",kind:"message",T:()=>$e},{no:4,name:"app_metadata",kind:"scalar",T:12}])}},Qt=new st,ot=class extends y{constructor(){super("arrow.flight.protocol.Location",[{no:1,name:"uri",kind:"scalar",T:9}])}},_r=new ot,at=class extends y{constructor(){super("arrow.flight.protocol.Ticket",[{no:1,name:"ticket",kind:"scalar",T:12}])}},be=new at,lt=class extends y{constructor(){super("arrow.flight.protocol.FlightData",[{no:1,name:"flight_descriptor",kind:"message",T:()=>V},{no:2,name:"data_header",kind:"scalar",T:12},{no:3,name:"app_metadata",kind:"scalar",T:12},{no:1e3,name:"data_body",kind:"scalar",T:12}])}},de=new lt,ut=class extends y{constructor(){super("arrow.flight.protocol.PutResult",[{no:1,name:"app_metadata",kind:"scalar",T:12}])}},Sr=new ut,ye=new Xt.ServiceType("arrow.flight.protocol.FlightService",[{name:"Handshake",serverStreaming:!0,clientStreaming:!0,options:{},I:Tr,O:wr},{name:"ListFlights",serverStreaming:!0,options:{},I:xr,O:ge},{name:"GetFlightInfo",options:{},I:V,O:ge},{name:"PollFlightInfo",options:{},I:V,O:Er},{name:"GetSchema",options:{},I:V,O:kr},{name:"DoGet",serverStreaming:!0,options:{},I:be,O:de},{name:"DoPut",serverStreaming:!0,clientStreaming:!0,options:{},I:de,O:Sr},{name:"DoExchange",serverStreaming:!0,clientStreaming:!0,options:{},I:de,O:de},{name:"DoAction",serverStreaming:!0,options:{},I:Ir,O:Nr},{name:"ListActions",serverStreaming:!0,options:{},I:Fr,O:Or}]);var N=K("@protobuf-ts/runtime-rpc"),Te=class{constructor(e){this._transport=e;this.typeName=ye.typeName;this.methods=ye.methods;this.options=ye.options}handshake(e){let t=this.methods[0],r=this._transport.mergeOptions(e);return(0,N.stackIntercept)("duplex",this._transport,t,r)}listFlights(e,t){let r=this.methods[1],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}getFlightInfo(e,t){let r=this.methods[2],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("unary",this._transport,r,i,e)}pollFlightInfo(e,t){let r=this.methods[3],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("unary",this._transport,r,i,e)}getSchema(e,t){let r=this.methods[4],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("unary",this._transport,r,i,e)}doGet(e,t){let r=this.methods[5],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}doPut(e){let t=this.methods[6],r=this._transport.mergeOptions(e);return(0,N.stackIntercept)("duplex",this._transport,t,r)}doExchange(e){let t=this.methods[7],r=this._transport.mergeOptions(e);return(0,N.stackIntercept)("duplex",this._transport,t,r)}doAction(e,t){let r=this.methods[8],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}listActions(e,t){let r=this.methods[9],i=this._transport.mergeOptions(t);return(0,N.stackIntercept)("serverStreaming",this._transport,r,i,e)}};var Zt=/\$(\w+)/g;function zt(n){return!!n.match(Zt)}function Yt(n,e){let t=n.match(Zt);if(t)for(let r of t)e[r.trim().replace("$","")]||L(new Error(`No parameter matching ${r} provided in the query params map`));return!0}var Rr="0.12.0.nightly",er=`influxdb3-js/${Rr}`;var X=class{constructor(e){this._options=e;this._closed=!1;let{host:t,queryTimeout:r}=this._options;this._defaultHeaders=this._options.headers,this._transport=$.queryTransport({host:t,timeout:r}),this._flightClient=new Te(this._transport)}prepareTicket(e,t,r){let i={database:e,sql_query:t,query_type:r.type};if(r.params){let s={};for(let o of Object.keys(r.params))r.params[o]&&(s[o]=r.params[o]);i.params=s}return be.create({ticket:new TextEncoder().encode(JSON.stringify(i))})}prepareMetadata(e){let t={"User-Agent":er,...this._defaultHeaders,...e},r=this._options.token;return r&&(t.authorization=`Bearer ${r}`),t}async*_queryRawBatches(e,t,r){if(r.params&&zt(e)&&Yt(e,r.params),this._closed)throw new Error("queryApi: already closed!");let i=this._flightClient,s=this.prepareTicket(t,e,r),a={meta:this.prepareMetadata(r.headers)},l=i.doGet(s,a),f=async function*(){for await(let p of l.responses)yield Ot(p.dataHeader.length),yield p.dataHeader,yield p.dataBody}();yield*await we.RecordBatchReader.from(f)}async*query(e,t,r){var s;let i=this._queryRawBatches(e,t,r);for await(let o of i)for(let a=0;a<o.numRows;a++){let l={};for(let f=0;f<o.numCols;f++){let c=o.schema.fields[f].name,p=(s=o.getChildAt(f))==null?void 0:s.get(a);l[c]=p}yield l}}async*queryPoints(e,t,r){var s;let i=this._queryRawBatches(e,t,r);for await(let o of i)for(let a=0;a<o.numRows;a++){let l=new R;for(let f=0;f<o.numCols;f++){let c=o.schema.fields[f],p=c.name,m=(s=o.getChildAt(f))==null?void 0:s.get(a),F=c.typeId,d=c.metadata.get("iox::column::type");if(m==null)continue;if((p==="measurement"||p=="iox::measurement")&&typeof m=="string"){l.setMeasurement(m);continue}if(!d){p==="time"&&F===we.Type.Timestamp?l.setTimestamp(m):l.setField(p,m);continue}let[,,O,P]=d.split("::");O==="field"?P&&m!==void 0&&m!==null&&l.setField(p,m,P):O==="tag"?l.setTag(p,m):O==="timestamp"&&l.setTimestamp(m)}yield l}}async close(){var e,t;this._closed=!0,(t=(e=this._transport).close)==null||t.call(e)}};var ft=`Please specify the 'database' as a method parameter or use default configuration at 'ClientOptions.database' | ||
`,G=class{constructor(...e){this._mergeWriteOptions=e=>{var i;let t={...(i=this._options.writeOptions)==null?void 0:i.headers,...e==null?void 0:e.headers},r={...this._options.writeOptions,...e};return r.headers=t,r};this._mergeQueryOptions=e=>{var s,o;let t={...(s=this._options.queryOptions)==null?void 0:s.headers,...e==null?void 0:e.headers},r={...(o=this._options.queryOptions)==null?void 0:o.params,...e==null?void 0:e.params},i={...this._options.queryOptions,...e};return i.headers=t,i.params=r,i};let t;switch(e.length){case 0:{t=_e();break}case 1:{if(e[0]==null)throw new S("No configuration specified!");typeof e[0]=="string"?t=Ee(e[0]):t=e[0];break}default:throw new S("Multiple arguments specified!")}this._options={...Ne,...t};let r=this._options.host;if(typeof r!="string")throw new S("No host specified!");if(r.endsWith("/")&&(this._options.host=r.substring(0,r.length-1)),typeof this._options.token!="string")throw new S("No token specified!");this._queryApi=new X(this._options),this._writeApi=new q(this._options)}async write(e,t,r,i){var o;let s=this._mergeWriteOptions(i);await this._writeApi.doWrite(Ue(e,s==null?void 0:s.defaultTags),(o=t!=null?t:this._options.database)!=null?o:L(new Error(ft)),r,s)}query(e,t,r=(i=>(i=this._options.queryOptions)!=null?i:Q)()){var o;let s=this._mergeQueryOptions(r);return this._queryApi.query(e,(o=t!=null?t:this._options.database)!=null?o:L(new Error(ft)),s)}queryPoints(e,t,r=(i=>(i=this._options.queryOptions)!=null?i:Q)()){var o;let s=this._mergeQueryOptions(r);return this._queryApi.queryPoints(e,(o=t!=null?t:this._options.database)!=null?o:L(new Error(ft)),s)}async close(){await this._writeApi.close(),await this._queryApi.close()}};return or(Ar);})(); | ||
Object.defineProperty(exports, '__esModule', { value: true });Object.assign(exports, influxdb);})); | ||
//# sourceMappingURL=index.browser.js.map |
"use strict";var dr=Object.create;var Z=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var yr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var wr=(n,e)=>{for(var t in e)Z(n,t,{get:e[t],enumerable:!0})},bt=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of br(e))!Tr.call(n,i)&&i!==t&&Z(n,i,{get:()=>e[i],enumerable:!(r=gr(e,i))||r.enumerable});return n};var Q=(n,e,t)=>(t=n!=null?dr(yr(n)):{},bt(e||!n||!n.__esModule?Z(t,"default",{value:n,enumerable:!0}):t,n)),Fr=n=>bt(Z({},"__esModule",{value:!0}),n);var Kr={};wr(Kr,{AbortError:()=>D,DEFAULT_ConnectionOptions:()=>ke,DEFAULT_QueryOptions:()=>z,DEFAULT_WriteOptions:()=>_e,GetFieldTypeMissmatchError:()=>re,HttpError:()=>R,IllegalArgumentError:()=>S,InfluxDBClient:()=>K,Log:()=>v,Point:()=>q,PointValues:()=>P,RequestTimedOutError:()=>L,collectAll:()=>Rt,consoleLogger:()=>yt,convertTime:()=>Le,convertTimeToNanos:()=>Ce,createTextDecoderCombiner:()=>Or,currentTime:()=>Et,dateToProtocolTimestamp:()=>Nt,escape:()=>k,fromConnectionString:()=>Se,fromEnv:()=>Re,setLogger:()=>xr,useProcessHrtime:()=>It,writableDataToLineProtocol:()=>ve});module.exports=Fr(Kr);var S=class n extends Error{constructor(e){super(e),this.name="IllegalArgumentError",Object.setPrototypeOf(this,n.prototype)}},R=class n extends Error{constructor(t,r,i,s,o,a){var l;super();this.statusCode=t;this.statusMessage=r;this.body=i;this.contentType=s;this.headers=o;if(Object.setPrototypeOf(this,n.prototype),a)this.message=a;else if(i&&(s!=null&&s.startsWith("application/json")||!s))try{if(this.json=JSON.parse(i),this.message=this.json.message,this.code=this.json.code,!this.message){let f=this.json;(l=f.data)!=null&&l.error_message?this.message=f.data.error_message:f.error&&(this.message=f.error)}}catch(f){}this.message||(this.message=`${t} ${r} : ${i}`),this.name="HttpError"}},L=class n extends Error{constructor(){super(),Object.setPrototypeOf(this,n.prototype),this.name="RequestTimedOutError",this.message="Request timed out"}},D=class n extends Error{constructor(){super(),this.name="AbortError",Object.setPrototypeOf(this,n.prototype),this.message="Response aborted"}};function Or(){let n=new TextDecoder("utf-8");return{concat(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r},copy(e,t,r){let i=new Uint8Array(r-t);return i.set(e.subarray(t,r)),i},toUtf8String(e,t,r){return n.decode(e.subarray(t,r))}}}var ke={timeout:1e4,queryTimeout:6e4},_e={precision:"ns",gzipThreshold:1e3},z={type:"sql"};function Se(n){if(!n)throw Error("Connection string not set!");let e=new URL(n.trim(),"http://localhost"),t={host:n.indexOf("://")>0?e.origin+e.pathname:e.pathname};return e.searchParams.has("token")&&(t.token=e.searchParams.get("token")),e.searchParams.has("authScheme")&&(t.authScheme=e.searchParams.get("authScheme")),e.searchParams.has("database")&&(t.database=e.searchParams.get("database")),e.searchParams.has("timeout")&&(t.timeout=parseInt(e.searchParams.get("timeout"))),e.searchParams.has("precision")&&(t.writeOptions||(t.writeOptions={}),t.writeOptions.precision=e.searchParams.get("precision")),e.searchParams.has("gzipThreshold")&&(t.writeOptions||(t.writeOptions={}),t.writeOptions.gzipThreshold=parseInt(e.searchParams.get("gzipThreshold"))),t}function Re(){if(!process.env.INFLUX_HOST)throw Error("INFLUX_HOST variable not set!");if(!process.env.INFLUX_TOKEN)throw Error("INFLUX_TOKEN variable not set!");let n={host:process.env.INFLUX_HOST.trim()};return process.env.INFLUX_TOKEN&&(n.token=process.env.INFLUX_TOKEN.trim()),process.env.INFLUX_AUTH_SCHEME&&(n.authScheme=process.env.INFLUX_AUTH_SCHEME.trim()),process.env.INFLUX_DATABASE&&(n.database=process.env.INFLUX_DATABASE.trim()),process.env.INFLUX_TIMEOUT&&(n.timeout=parseInt(process.env.INFLUX_TIMEOUT.trim())),process.env.INFLUX_PRECISION&&(n.writeOptions||(n.writeOptions={}),n.writeOptions.precision=process.env.INFLUX_PRECISION),process.env.INFLUX_GZIP_THRESHOLD&&(n.writeOptions||(n.writeOptions={}),n.writeOptions.gzipThreshold=parseInt(process.env.INFLUX_GZIP_THRESHOLD)),n}var yt={error(n,e){console.error(`ERROR: ${n}`,e||"")},warn(n,e){console.warn(`WARN: ${n}`,e||"")}},Y=yt,v={error(n,e){Y.error(n,e)},warn(n,e){Y.warn(n,e)}};function xr(n){let e=Y;return Y=n,e}function Pe(n,e){return function(t){let r="",i=0,s=0;for(;s<t.length;){let o=n.indexOf(t[s]);o>=0&&(r+=t.substring(i,s),r+=e[o],i=s+1),s++}return i==0?t:(i<t.length&&(r+=t.substring(i,t.length)),r)}}function Ir(n,e){let t=Pe(n,e);return r=>`"${t(r)}"`}var k={measurement:Pe(`, | ||
\r `,["\\,","\\ ","\\n","\\r","\\t"]),quoted:Ir('"\\',['\\"',"\\\\"]),tag:Pe(`, = | ||
\r `,["\\,","\\ ","\\=","\\n","\\r","\\t"])};var te="000000000",Ue=!1;function It(n){return Ue=n&&process&&typeof process.hrtime=="function"}It(!0);var Tt,ee,wt=Date.now(),Ae=0;function De(){if(Ue){let n=process.hrtime(),e=Date.now();ee?(n[0]=n[0]-ee[0],n[1]=n[1]-ee[1],n[1]<0&&(n[0]-=1,n[1]+=1e9),e=Tt+n[0]*1e3+Math.floor(n[1]/1e6)):(ee=n,Tt=e);let t=String(n[1]%1e6);return String(e)+te.substr(0,6-t.length)+t}else{let n=Date.now();n!==wt?(wt=n,Ae=0):Ae++;let e=String(Ae);return String(n)+te.substr(0,6-e.length)+e}}function Ft(){if(Ue){let n=process.hrtime(),e=String(Math.trunc(n[1]/1e3)%1e3);return String(Date.now())+te.substr(0,3-e.length)+e}else return String(Date.now())+te.substr(0,3)}function Ot(){return String(Date.now())}function xt(){return String(Math.floor(Date.now()/1e3))}var Et={s:xt,ms:Ot,us:Ft,ns:De,seconds:xt,millis:Ot,micros:Ft,nanos:De},Nt={s:n=>`${Math.floor(n.getTime()/1e3)}`,ms:n=>`${n.getTime()}`,us:n=>`${n.getTime()}000`,ns:n=>`${n.getTime()}000000`};function Ce(n){return n===void 0?De():typeof n=="string"?n.length>0?n:void 0:n instanceof Date?`${n.getTime()}000000`:String(typeof n=="number"?Math.floor(n):n)}var Le=(n,e="ns")=>n===void 0?Et[e]():typeof n=="string"?n.length>0?n:void 0:n instanceof Date?Nt[e](n):String(typeof n=="number"?Math.floor(n):n);var B=n=>{throw n},kt=n=>n!==void 0,_t=n=>n instanceof Array||n instanceof Object&&typeof n.length=="number"&&(n.length===0||Object.getOwnPropertyNames(n).some(e=>e==="0")),St=n=>{let e=new Uint8Array(4);return e[0]=n>>0,e[1]=n>>8,e[2]=n>>16,e[3]=n>>24,e},Rt=async n=>{let e=[];for await(let t of n)e.push(t);return e};var ve=(n,e)=>{let t=_t(n)&&typeof n!="string"?Array.from(n):[n];return t.length===0?[]:typeof t[0]=="string"?t:t.map(i=>i.toLineProtocol(void 0,e)).filter(kt)};var Er=n=>typeof n=="number"?"float":typeof n=="string"?"string":typeof n=="boolean"?"boolean":void 0,re=class n extends Error{constructor(e,t,r){super(`field ${e} of type ${r} doesn't match expected type ${t}!`),this.name="GetFieldTypeMissmatchError",Object.setPrototypeOf(this,n.prototype)}},P=class n{constructor(){this._tags={};this._fields={}}getMeasurement(){return this._name}setMeasurement(e){return this._name=e,this}getTimestamp(){return this._time}setTimestamp(e){return this._time=e,this}getTag(e){return this._tags[e]}setTag(e,t){return this._tags[e]=t,this}removeTag(e){return delete this._tags[e],this}getTagNames(){return Object.keys(this._tags)}getFloatField(e){return this.getField(e,"float")}setFloatField(e,t){let r;if(typeof t=="number"?r=t:r=parseFloat(t),!isFinite(r))throw new Error(`invalid float value for field '${e}': '${t}'!`);return this._fields[e]=["float",r],this}getIntegerField(e){return this.getField(e,"integer")}setIntegerField(e,t){let r;if(typeof t=="number"?r=t:r=parseInt(String(t)),isNaN(r)||r<=-9223372036854776e3||r>=9223372036854776e3)throw new Error(`invalid integer value for field '${e}': '${t}'!`);return this._fields[e]=["integer",Math.floor(r)],this}getUintegerField(e){return this.getField(e,"uinteger")}setUintegerField(e,t){if(typeof t=="number"){if(isNaN(t)||t<0||t>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${e}' out of range: ${t}`);this._fields[e]=["uinteger",Math.floor(t)]}else{let r=String(t);for(let i=0;i<r.length;i++){let s=r.charCodeAt(i);if(s<48||s>57)throw new Error(`uint value has an unsupported character at pos ${i}: ${t}`)}if(r.length>20||r.length===20&&r.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${e}' out of range: ${r}`);this._fields[e]=["uinteger",+r]}return this}getStringField(e){return this.getField(e,"string")}setStringField(e,t){return t!=null&&(typeof t!="string"&&(t=String(t)),this._fields[e]=["string",t]),this}getBooleanField(e){return this.getField(e,"boolean")}setBooleanField(e,t){return this._fields[e]=["boolean",!!t],this}getField(e,t){let r=this._fields[e];if(!r)return;let[i,s]=r;if(t!==void 0&&t!==i)throw new re(e,t,i);return s}getFieldType(e){let t=this._fields[e];if(t)return t[0]}setField(e,t,r){switch(r!=null?r:Er(t)){case"string":return this.setStringField(e,t);case"boolean":return this.setBooleanField(e,t);case"float":return this.setFloatField(e,t);case"integer":return this.setIntegerField(e,t);case"uinteger":return this.setUintegerField(e,t);case void 0:return this;default:throw new Error(`invalid field type for field '${e}': type -> ${r}, value -> ${t}!`)}}setFields(e){for(let[t,r]of Object.entries(e))this.setField(t,r);return this}removeField(e){return delete this._fields[e],this}getFieldNames(){return Object.keys(this._fields)}hasFields(){return this.getFieldNames().length>0}copy(){let e=new n;return e._name=this._name,e._time=this._time,e._tags=Object.fromEntries(Object.entries(this._tags)),e._fields=Object.fromEntries(Object.entries(this._fields).map(t=>[...t])),e}asPoint(e){return q.fromValues(e?this.setMeasurement(e):this)}};var Nr=(n,e)=>{switch(n){case"string":return k.quoted(e);case"boolean":return e?"T":"F";case"float":return`${e}`;case"integer":return`${e}i`;case"uinteger":return`${e}u`}},q=class n{constructor(e){e instanceof P?this._values=e:this._values=new P,typeof e=="string"&&this._values.setMeasurement(e)}static measurement(e){return new n(e)}static fromValues(e){if(!e.getMeasurement()||e.getMeasurement()==="")throw new Error("Cannot convert values to point without measurement set!");return new n(e)}getMeasurement(){return this._values.getMeasurement()}setMeasurement(e){return e!==""&&this._values.setMeasurement(e),this}getTimestamp(){return this._values.getTimestamp()}setTimestamp(e){return this._values.setTimestamp(e),this}getTag(e){return this._values.getTag(e)}setTag(e,t){return this._values.setTag(e,t),this}removeTag(e){return this._values.removeTag(e),this}getTagNames(){return this._values.getTagNames()}getFloatField(e){return this._values.getFloatField(e)}setFloatField(e,t){return this._values.setFloatField(e,t),this}getIntegerField(e){return this._values.getIntegerField(e)}setIntegerField(e,t){return this._values.setIntegerField(e,t),this}getUintegerField(e){return this._values.getUintegerField(e)}setUintegerField(e,t){return this._values.setUintegerField(e,t),this}getStringField(e){return this._values.getStringField(e)}setStringField(e,t){return this._values.setStringField(e,t),this}getBooleanField(e){return this._values.getBooleanField(e)}setBooleanField(e,t){return this._values.setBooleanField(e,t),this}getField(e,t){return this._values.getField(e,t)}getFieldType(e){return this._values.getFieldType(e)}setField(e,t,r){return this._values.setField(e,t,r),this}setFields(e){return this._values.setFields(e),this}removeField(e){return this._values.removeField(e),this}getFieldNames(){return this._values.getFieldNames()}hasFields(){return this._values.hasFields()}copy(){return new n(this._values.copy())}toLineProtocol(e,t){if(!this._values.getMeasurement())return;let r="";if(this._values.getFieldNames().sort().forEach(a=>{if(a){let l=this._values.getFieldType(a),f=this._values.getField(a);if(l===void 0||f===void 0)return;let c=Nr(l,f);r.length>0&&(r+=","),r+=`${k.tag(a)}=${c}`}}),r.length===0)return;let i="",s=this._values.getTagNames();if(t){let a=new Set(s),l=Object.keys(t);for(let f=l.length;f--;)a.has(l[f])&&l.splice(f,1);l.sort().forEach(f=>{if(f){let c=t[f];c&&(i+=",",i+=`${k.tag(f)}=${k.tag(c)}`)}})}s.sort().forEach(a=>{if(a){let l=this._values.getTag(a);l&&(i+=",",i+=`${k.tag(a)}=${k.tag(l)}`)}});let o=this._values.getTimestamp();return e?typeof e=="string"?o=Le(o,e):o=e(o):o=Ce(o),`${k.measurement(this.getMeasurement())}${i} ${r}${o!==void 0?` ${o}`:""}`}toString(){let e=this.toLineProtocol(void 0);return e||`invalid point: ${JSON.stringify(this,void 0)}`}};var Ve=require("url"),Pt=Q(require("http")),At=Q(require("https")),ie=require("buffer");var $=Q(require("zlib"));function Be(n={}){let e=0,t={next:r=>{if(e===0&&n.next&&r!==null&&r!==void 0)return n.next(r)},error:r=>{e===0&&(e=1,n.error&&n.error(r))},complete:()=>{e===0&&(e=2,n.complete&&n.complete())},responseStarted:(r,i)=>{n.responseStarted&&n.responseStarted(r,i)}};return n.useCancellable&&(t.useCancellable=n.useCancellable.bind(n)),n.useResume&&(t.useResume=n.useResume.bind(n)),t}var kr="0.11.0",ne=`influxdb3-js/${kr}`;var Dt=require("stream"),_r={flush:$.default.constants.Z_SYNC_FLUSH,finishFlush:$.default.constants.Z_SYNC_FLUSH},Sr=ie.Buffer.allocUnsafe(0),Me=class{constructor(){this._cancelled=!1}cancel(){this._cancelled=!0,this.resume&&(this.resume(),this.resume=void 0)}isCancelled(){return this._cancelled}},We=class{constructor(e){var f,c,p,m,y,d,O;let{host:t,proxyUrl:r,token:i,authScheme:s,transportOptions:o,...a}=e,l=(0,Ve.parse)(r||t);if(this._token=i,this._authScheme=s,this._defaultOptions={...a,...o,port:l.port,protocol:l.protocol,hostname:l.hostname},this._contextPath=r?t:(f=l.path)!=null?f:"",this._contextPath.endsWith("/")&&(this._contextPath=this._contextPath.substring(0,this._contextPath.length-1)),Object.keys(this._defaultOptions).forEach(N=>this._defaultOptions[N]===void 0&&delete this._defaultOptions[N]),this._contextPath.endsWith("/api/v2")&&(v.warn(`Please remove '/api/v2' context path from InfluxDB base url, using ${l.protocol}//${l.hostname}:${l.port} !`),this._contextPath=""),l.protocol==="http:")this._requestApi=(m=(p=(c=this._defaultOptions["follow-redirects"])==null?void 0:c.http)==null?void 0:p.request)!=null?m:Pt.request;else if(l.protocol==="https:")this._requestApi=(O=(d=(y=this._defaultOptions["follow-redirects"])==null?void 0:y.https)==null?void 0:d.request)!=null?O:At.request;else throw new Error(`Unsupported protocol "${l.protocol} in URL: "${e.host}"`);this._headers={"User-Agent":ne,...e.headers},r&&(this._headers.Host=(0,Ve.parse)(t).host)}send(e,t,r,i){let s=new Me;i&&i.useCancellable&&i.useCancellable(s),this._createRequestMessage(e,t,r,o=>{this._request(o,s,i)},o=>(i==null?void 0:i.error)&&i.error(o))}request(e,t,r,i){t?typeof t!="string"&&(t=JSON.stringify(t)):t="";let s=Sr,o,a;return new Promise((l,f)=>{this.send(e,t,r,{responseStarted(c,p){i&&i(c,p),o=String(c["content-type"]),a=p},next:c=>{s=ie.Buffer.concat([s,c])},complete:()=>{var p,m;let c=(m=(p=r.headers)==null?void 0:p.accept)!=null?m:o;try{a===204&&l(void 0),c.includes("json")?s.length?l(JSON.parse(s.toString("utf8"))):l(void 0):c.includes("text")||c.startsWith("application/csv")?l(s.toString("utf8")):l(s)}catch(y){f(y)}},error:c=>{f(c)}})})}async*iterate(e,t,r){var c;let i,s;function o(p){i=p,s(p)}let a=await new Promise((p,m)=>{s=m,this._createRequestMessage(e,t,r,p,o)});(c=a.signal)!=null&&c.addEventListener&&a.signal.addEventListener("abort",()=>{o(new D)});let l=await new Promise((p,m)=>{s=m;let y=this._requestApi(a,p);y.on("timeout",()=>o(new L)),y.on("error",o),y.write(a.body),y.end()}),f=await new Promise((p,m)=>{s=m,this._prepareResponse(l,p,o)});for await(let p of f){if(i)throw i;yield p}}_createRequestMessage(e,t,r,i,s){var f;let o=ie.Buffer.from(t,"utf-8"),a={"content-type":"application/json; charset=utf-8",...this._headers};if(this._token){let c=(f=this._authScheme)!=null?f:"Token";a.authorization=`${c} ${this._token}`}let l={...this._defaultOptions,path:this._contextPath+e,method:r.method,headers:{...a,...r.headers}};if(r.signal&&(l.signal=r.signal),r.gzipThreshold!==void 0&&r.gzipThreshold<o.length){$.default.gzip(o,(c,p)=>{if(c)return s(c);l.headers["content-encoding"]="gzip",l.body=p,i(l)});return}l.body=o,l.headers["content-length"]=l.body.length,i(l)}_prepareResponse(e,t,r){var a;e.on("aborted",()=>{r(new D)}),e.on("error",r);let i=(a=e.statusCode)!=null?a:600,s=e.headers["content-encoding"],o;if(s==="gzip"?(o=$.default.createGunzip(_r),o=(0,Dt.pipeline)(e,o,l=>l&&r(l))):o=e,i>=300){let l="",f=String(e.headers["content-type"]).startsWith("application/json");o.on("data",c=>{l+=c.toString(),!f&&l.length>1e3&&(l=l.slice(0,1e3),e.resume())}),o.on("end",()=>{l===""&&e.headers["x-influxdb-error"]&&(l=e.headers["x-influxdb-error"].toString()),r(new R(i,e.statusMessage,l,e.headers["content-type"],e.headers))})}else t(o)}_request(e,t,r){var o;let i=Be(r);if(t.isCancelled()){i.complete();return}(o=e.signal)!=null&&o.addEventListener&&e.signal.addEventListener("abort",()=>{i.error(new D)});let s=this._requestApi(e,a=>{if(t.isCancelled()){a.resume(),i.complete();return}i.responseStarted(a.headers,a.statusCode),this._prepareResponse(a,l=>{l.on("data",f=>{if(t.isCancelled())a.resume();else if(i.next(f)===!1){if(!i.useResume){i.error(new Error("Unable to pause, useResume is not configured!")),a.resume();return}a.pause();let c=()=>{a.resume()};t.resume=c,i.useResume(c)}}),l.on("end",i.complete)},i.error)});typeof s.setTimeout=="function"&&e.timeout&&s.setTimeout(e.timeout),s.on("timeout",()=>{i.error(new L)}),s.on("error",a=>{i.error(a)}),e.body&&s.write(e.body),s.end()}},Ut=We;var Bt=require("@protobuf-ts/grpc-transport");var Ct="http://",Lt="https://",vt=n=>{n=n.replace(/\/$/,"");let e;return n.startsWith(Ct)?(n=n.slice(Ct.length),e=!1,n.includes(":")||(n=`${n}:80`)):n.startsWith(Lt)&&(n=n.slice(Lt.length),e=!0,n.includes(":")||(n=`${n}:443`)),{url:n,safe:e}};var Vt=Q(require("@grpc/grpc-js")),Mt=({host:n,timeout:e})=>{let{url:t,safe:r}=vt(n),i=Vt.credentials[r==null||r?"createSsl":"createInsecure"]();return new Bt.GrpcTransport({host:t,channelCredentials:i,timeout:e})};var Rr={writeTransport:n=>new Ut(n),queryTransport:Mt},j=Rr;var J=class{constructor(e){this._options=e;this._closed=!1;var t;this._transport=(t=this._options.transport)!=null?t:j.writeTransport(this._options),this.doWrite=this.doWrite.bind(this)}_createWritePath(e,t,r){let i=[`bucket=${encodeURIComponent(e)}`,`precision=${t.precision}`];return r&&i.push(`org=${encodeURIComponent(r)}`),`/api/v2/write?${i.join("&")}`}doWrite(e,t,r,i){if(this._closed)return Promise.reject(new Error("writeApi: already closed!"));if(e.length<=0||e.length===1&&e[0]==="")return Promise.resolve();let o,a,l=new Promise((d,O)=>{o=d,a=O}),f,c,p={responseStarted(d,O){f=O,c=d},error(d){if(d instanceof R&&d.json&&typeof d.json.error=="string"&&d.json.error.includes("hinted handoff queue not empty")){v.warn(`Write to InfluxDB returns: ${d.json.error}`),f=204,p.complete();return}v.error("Write to InfluxDB failed.",d),a(d)},complete(){if(f==null||f>=200&&f<300)o();else{let d=`2xx HTTP response status code expected, but ${f} returned`,O=new R(f,d,void 0,"0",c);O.message=d,p.error(O)}}},m={..._e,...i},y={method:"POST",headers:{"content-type":"text/plain; charset=utf-8",...i==null?void 0:i.headers},gzipThreshold:m.gzipThreshold};return this._transport.send(this._createWritePath(t,m,r),e.join(` | ||
\r `,["\\,","\\ ","\\=","\\n","\\r","\\t"])};var te="000000000",Ue=!1;function It(n){return Ue=n&&process&&typeof process.hrtime=="function"}It(!0);var Tt,ee,wt=Date.now(),Ae=0;function De(){if(Ue){let n=process.hrtime(),e=Date.now();ee?(n[0]=n[0]-ee[0],n[1]=n[1]-ee[1],n[1]<0&&(n[0]-=1,n[1]+=1e9),e=Tt+n[0]*1e3+Math.floor(n[1]/1e6)):(ee=n,Tt=e);let t=String(n[1]%1e6);return String(e)+te.substr(0,6-t.length)+t}else{let n=Date.now();n!==wt?(wt=n,Ae=0):Ae++;let e=String(Ae);return String(n)+te.substr(0,6-e.length)+e}}function Ft(){if(Ue){let n=process.hrtime(),e=String(Math.trunc(n[1]/1e3)%1e3);return String(Date.now())+te.substr(0,3-e.length)+e}else return String(Date.now())+te.substr(0,3)}function Ot(){return String(Date.now())}function xt(){return String(Math.floor(Date.now()/1e3))}var Et={s:xt,ms:Ot,us:Ft,ns:De,seconds:xt,millis:Ot,micros:Ft,nanos:De},Nt={s:n=>`${Math.floor(n.getTime()/1e3)}`,ms:n=>`${n.getTime()}`,us:n=>`${n.getTime()}000`,ns:n=>`${n.getTime()}000000`};function Ce(n){return n===void 0?De():typeof n=="string"?n.length>0?n:void 0:n instanceof Date?`${n.getTime()}000000`:String(typeof n=="number"?Math.floor(n):n)}var Le=(n,e="ns")=>n===void 0?Et[e]():typeof n=="string"?n.length>0?n:void 0:n instanceof Date?Nt[e](n):String(typeof n=="number"?Math.floor(n):n);var B=n=>{throw n},kt=n=>n!==void 0,_t=n=>n instanceof Array||n instanceof Object&&typeof n.length=="number"&&(n.length===0||Object.getOwnPropertyNames(n).some(e=>e==="0")),St=n=>{let e=new Uint8Array(4);return e[0]=n>>0,e[1]=n>>8,e[2]=n>>16,e[3]=n>>24,e},Rt=async n=>{let e=[];for await(let t of n)e.push(t);return e};var ve=(n,e)=>{let t=_t(n)&&typeof n!="string"?Array.from(n):[n];return t.length===0?[]:typeof t[0]=="string"?t:t.map(i=>i.toLineProtocol(void 0,e)).filter(kt)};var Er=n=>typeof n=="number"?"float":typeof n=="string"?"string":typeof n=="boolean"?"boolean":void 0,re=class n extends Error{constructor(e,t,r){super(`field ${e} of type ${r} doesn't match expected type ${t}!`),this.name="GetFieldTypeMissmatchError",Object.setPrototypeOf(this,n.prototype)}},P=class n{constructor(){this._tags={};this._fields={}}getMeasurement(){return this._name}setMeasurement(e){return this._name=e,this}getTimestamp(){return this._time}setTimestamp(e){return this._time=e,this}getTag(e){return this._tags[e]}setTag(e,t){return this._tags[e]=t,this}removeTag(e){return delete this._tags[e],this}getTagNames(){return Object.keys(this._tags)}getFloatField(e){return this.getField(e,"float")}setFloatField(e,t){let r;if(typeof t=="number"?r=t:r=parseFloat(t),!isFinite(r))throw new Error(`invalid float value for field '${e}': '${t}'!`);return this._fields[e]=["float",r],this}getIntegerField(e){return this.getField(e,"integer")}setIntegerField(e,t){let r;if(typeof t=="number"?r=t:r=parseInt(String(t)),isNaN(r)||r<=-9223372036854776e3||r>=9223372036854776e3)throw new Error(`invalid integer value for field '${e}': '${t}'!`);return this._fields[e]=["integer",Math.floor(r)],this}getUintegerField(e){return this.getField(e,"uinteger")}setUintegerField(e,t){if(typeof t=="number"){if(isNaN(t)||t<0||t>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${e}' out of range: ${t}`);this._fields[e]=["uinteger",Math.floor(t)]}else{let r=String(t);for(let i=0;i<r.length;i++){let s=r.charCodeAt(i);if(s<48||s>57)throw new Error(`uint value has an unsupported character at pos ${i}: ${t}`)}if(r.length>20||r.length===20&&r.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${e}' out of range: ${r}`);this._fields[e]=["uinteger",+r]}return this}getStringField(e){return this.getField(e,"string")}setStringField(e,t){return t!=null&&(typeof t!="string"&&(t=String(t)),this._fields[e]=["string",t]),this}getBooleanField(e){return this.getField(e,"boolean")}setBooleanField(e,t){return this._fields[e]=["boolean",!!t],this}getField(e,t){let r=this._fields[e];if(!r)return;let[i,s]=r;if(t!==void 0&&t!==i)throw new re(e,t,i);return s}getFieldType(e){let t=this._fields[e];if(t)return t[0]}setField(e,t,r){switch(r!=null?r:Er(t)){case"string":return this.setStringField(e,t);case"boolean":return this.setBooleanField(e,t);case"float":return this.setFloatField(e,t);case"integer":return this.setIntegerField(e,t);case"uinteger":return this.setUintegerField(e,t);case void 0:return this;default:throw new Error(`invalid field type for field '${e}': type -> ${r}, value -> ${t}!`)}}setFields(e){for(let[t,r]of Object.entries(e))this.setField(t,r);return this}removeField(e){return delete this._fields[e],this}getFieldNames(){return Object.keys(this._fields)}hasFields(){return this.getFieldNames().length>0}copy(){let e=new n;return e._name=this._name,e._time=this._time,e._tags=Object.fromEntries(Object.entries(this._tags)),e._fields=Object.fromEntries(Object.entries(this._fields).map(t=>[...t])),e}asPoint(e){return q.fromValues(e?this.setMeasurement(e):this)}};var Nr=(n,e)=>{switch(n){case"string":return k.quoted(e);case"boolean":return e?"T":"F";case"float":return`${e}`;case"integer":return`${e}i`;case"uinteger":return`${e}u`}},q=class n{constructor(e){e instanceof P?this._values=e:this._values=new P,typeof e=="string"&&this._values.setMeasurement(e)}static measurement(e){return new n(e)}static fromValues(e){if(!e.getMeasurement()||e.getMeasurement()==="")throw new Error("Cannot convert values to point without measurement set!");return new n(e)}getMeasurement(){return this._values.getMeasurement()}setMeasurement(e){return e!==""&&this._values.setMeasurement(e),this}getTimestamp(){return this._values.getTimestamp()}setTimestamp(e){return this._values.setTimestamp(e),this}getTag(e){return this._values.getTag(e)}setTag(e,t){return this._values.setTag(e,t),this}removeTag(e){return this._values.removeTag(e),this}getTagNames(){return this._values.getTagNames()}getFloatField(e){return this._values.getFloatField(e)}setFloatField(e,t){return this._values.setFloatField(e,t),this}getIntegerField(e){return this._values.getIntegerField(e)}setIntegerField(e,t){return this._values.setIntegerField(e,t),this}getUintegerField(e){return this._values.getUintegerField(e)}setUintegerField(e,t){return this._values.setUintegerField(e,t),this}getStringField(e){return this._values.getStringField(e)}setStringField(e,t){return this._values.setStringField(e,t),this}getBooleanField(e){return this._values.getBooleanField(e)}setBooleanField(e,t){return this._values.setBooleanField(e,t),this}getField(e,t){return this._values.getField(e,t)}getFieldType(e){return this._values.getFieldType(e)}setField(e,t,r){return this._values.setField(e,t,r),this}setFields(e){return this._values.setFields(e),this}removeField(e){return this._values.removeField(e),this}getFieldNames(){return this._values.getFieldNames()}hasFields(){return this._values.hasFields()}copy(){return new n(this._values.copy())}toLineProtocol(e,t){if(!this._values.getMeasurement())return;let r="";if(this._values.getFieldNames().sort().forEach(a=>{if(a){let l=this._values.getFieldType(a),f=this._values.getField(a);if(l===void 0||f===void 0)return;let c=Nr(l,f);r.length>0&&(r+=","),r+=`${k.tag(a)}=${c}`}}),r.length===0)return;let i="",s=this._values.getTagNames();if(t){let a=new Set(s),l=Object.keys(t);for(let f=l.length;f--;)a.has(l[f])&&l.splice(f,1);l.sort().forEach(f=>{if(f){let c=t[f];c&&(i+=",",i+=`${k.tag(f)}=${k.tag(c)}`)}})}s.sort().forEach(a=>{if(a){let l=this._values.getTag(a);l&&(i+=",",i+=`${k.tag(a)}=${k.tag(l)}`)}});let o=this._values.getTimestamp();return e?typeof e=="string"?o=Le(o,e):o=e(o):o=Ce(o),`${k.measurement(this.getMeasurement())}${i} ${r}${o!==void 0?` ${o}`:""}`}toString(){let e=this.toLineProtocol(void 0);return e||`invalid point: ${JSON.stringify(this,void 0)}`}};var Ve=require("url"),Pt=Q(require("http")),At=Q(require("https")),ie=require("buffer");var $=Q(require("zlib"));function Be(n={}){let e=0,t={next:r=>{if(e===0&&n.next&&r!==null&&r!==void 0)return n.next(r)},error:r=>{e===0&&(e=1,n.error&&n.error(r))},complete:()=>{e===0&&(e=2,n.complete&&n.complete())},responseStarted:(r,i)=>{n.responseStarted&&n.responseStarted(r,i)}};return n.useCancellable&&(t.useCancellable=n.useCancellable.bind(n)),n.useResume&&(t.useResume=n.useResume.bind(n)),t}var kr="0.12.0.nightly",ne=`influxdb3-js/${kr}`;var Dt=require("stream"),_r={flush:$.default.constants.Z_SYNC_FLUSH,finishFlush:$.default.constants.Z_SYNC_FLUSH},Sr=ie.Buffer.allocUnsafe(0),Me=class{constructor(){this._cancelled=!1}cancel(){this._cancelled=!0,this.resume&&(this.resume(),this.resume=void 0)}isCancelled(){return this._cancelled}},We=class{constructor(e){var f,c,p,m,y,d,O;let{host:t,proxyUrl:r,token:i,authScheme:s,transportOptions:o,...a}=e,l=(0,Ve.parse)(r||t);if(this._token=i,this._authScheme=s,this._defaultOptions={...a,...o,port:l.port,protocol:l.protocol,hostname:l.hostname},this._contextPath=r?t:(f=l.path)!=null?f:"",this._contextPath.endsWith("/")&&(this._contextPath=this._contextPath.substring(0,this._contextPath.length-1)),Object.keys(this._defaultOptions).forEach(N=>this._defaultOptions[N]===void 0&&delete this._defaultOptions[N]),this._contextPath.endsWith("/api/v2")&&(v.warn(`Please remove '/api/v2' context path from InfluxDB base url, using ${l.protocol}//${l.hostname}:${l.port} !`),this._contextPath=""),l.protocol==="http:")this._requestApi=(m=(p=(c=this._defaultOptions["follow-redirects"])==null?void 0:c.http)==null?void 0:p.request)!=null?m:Pt.request;else if(l.protocol==="https:")this._requestApi=(O=(d=(y=this._defaultOptions["follow-redirects"])==null?void 0:y.https)==null?void 0:d.request)!=null?O:At.request;else throw new Error(`Unsupported protocol "${l.protocol} in URL: "${e.host}"`);this._headers={"User-Agent":ne,...e.headers},r&&(this._headers.Host=(0,Ve.parse)(t).host)}send(e,t,r,i){let s=new Me;i&&i.useCancellable&&i.useCancellable(s),this._createRequestMessage(e,t,r,o=>{this._request(o,s,i)},o=>(i==null?void 0:i.error)&&i.error(o))}request(e,t,r,i){t?typeof t!="string"&&(t=JSON.stringify(t)):t="";let s=Sr,o,a;return new Promise((l,f)=>{this.send(e,t,r,{responseStarted(c,p){i&&i(c,p),o=String(c["content-type"]),a=p},next:c=>{s=ie.Buffer.concat([s,c])},complete:()=>{var p,m;let c=(m=(p=r.headers)==null?void 0:p.accept)!=null?m:o;try{a===204&&l(void 0),c.includes("json")?s.length?l(JSON.parse(s.toString("utf8"))):l(void 0):c.includes("text")||c.startsWith("application/csv")?l(s.toString("utf8")):l(s)}catch(y){f(y)}},error:c=>{f(c)}})})}async*iterate(e,t,r){var c;let i,s;function o(p){i=p,s(p)}let a=await new Promise((p,m)=>{s=m,this._createRequestMessage(e,t,r,p,o)});(c=a.signal)!=null&&c.addEventListener&&a.signal.addEventListener("abort",()=>{o(new D)});let l=await new Promise((p,m)=>{s=m;let y=this._requestApi(a,p);y.on("timeout",()=>o(new L)),y.on("error",o),y.write(a.body),y.end()}),f=await new Promise((p,m)=>{s=m,this._prepareResponse(l,p,o)});for await(let p of f){if(i)throw i;yield p}}_createRequestMessage(e,t,r,i,s){var f;let o=ie.Buffer.from(t,"utf-8"),a={"content-type":"application/json; charset=utf-8",...this._headers};if(this._token){let c=(f=this._authScheme)!=null?f:"Token";a.authorization=`${c} ${this._token}`}let l={...this._defaultOptions,path:this._contextPath+e,method:r.method,headers:{...a,...r.headers}};if(r.signal&&(l.signal=r.signal),r.gzipThreshold!==void 0&&r.gzipThreshold<o.length){$.default.gzip(o,(c,p)=>{if(c)return s(c);l.headers["content-encoding"]="gzip",l.body=p,i(l)});return}l.body=o,l.headers["content-length"]=l.body.length,i(l)}_prepareResponse(e,t,r){var a;e.on("aborted",()=>{r(new D)}),e.on("error",r);let i=(a=e.statusCode)!=null?a:600,s=e.headers["content-encoding"],o;if(s==="gzip"?(o=$.default.createGunzip(_r),o=(0,Dt.pipeline)(e,o,l=>l&&r(l))):o=e,i>=300){let l="",f=String(e.headers["content-type"]).startsWith("application/json");o.on("data",c=>{l+=c.toString(),!f&&l.length>1e3&&(l=l.slice(0,1e3),e.resume())}),o.on("end",()=>{l===""&&e.headers["x-influxdb-error"]&&(l=e.headers["x-influxdb-error"].toString()),r(new R(i,e.statusMessage,l,e.headers["content-type"],e.headers))})}else t(o)}_request(e,t,r){var o;let i=Be(r);if(t.isCancelled()){i.complete();return}(o=e.signal)!=null&&o.addEventListener&&e.signal.addEventListener("abort",()=>{i.error(new D)});let s=this._requestApi(e,a=>{if(t.isCancelled()){a.resume(),i.complete();return}i.responseStarted(a.headers,a.statusCode),this._prepareResponse(a,l=>{l.on("data",f=>{if(t.isCancelled())a.resume();else if(i.next(f)===!1){if(!i.useResume){i.error(new Error("Unable to pause, useResume is not configured!")),a.resume();return}a.pause();let c=()=>{a.resume()};t.resume=c,i.useResume(c)}}),l.on("end",i.complete)},i.error)});typeof s.setTimeout=="function"&&e.timeout&&s.setTimeout(e.timeout),s.on("timeout",()=>{i.error(new L)}),s.on("error",a=>{i.error(a)}),e.body&&s.write(e.body),s.end()}},Ut=We;var Bt=require("@protobuf-ts/grpc-transport");var Ct="http://",Lt="https://",vt=n=>{n=n.replace(/\/$/,"");let e;return n.startsWith(Ct)?(n=n.slice(Ct.length),e=!1,n.includes(":")||(n=`${n}:80`)):n.startsWith(Lt)&&(n=n.slice(Lt.length),e=!0,n.includes(":")||(n=`${n}:443`)),{url:n,safe:e}};var Vt=Q(require("@grpc/grpc-js")),Mt=({host:n,timeout:e})=>{let{url:t,safe:r}=vt(n),i=Vt.credentials[r==null||r?"createSsl":"createInsecure"]();return new Bt.GrpcTransport({host:t,channelCredentials:i,timeout:e})};var Rr={writeTransport:n=>new Ut(n),queryTransport:Mt},j=Rr;var J=class{constructor(e){this._options=e;this._closed=!1;var t;this._transport=(t=this._options.transport)!=null?t:j.writeTransport(this._options),this.doWrite=this.doWrite.bind(this)}_createWritePath(e,t,r){let i=[`bucket=${encodeURIComponent(e)}`,`precision=${t.precision}`];return r&&i.push(`org=${encodeURIComponent(r)}`),`/api/v2/write?${i.join("&")}`}doWrite(e,t,r,i){if(this._closed)return Promise.reject(new Error("writeApi: already closed!"));if(e.length<=0||e.length===1&&e[0]==="")return Promise.resolve();let o,a,l=new Promise((d,O)=>{o=d,a=O}),f,c,p={responseStarted(d,O){f=O,c=d},error(d){if(d instanceof R&&d.json&&typeof d.json.error=="string"&&d.json.error.includes("hinted handoff queue not empty")){v.warn(`Write to InfluxDB returns: ${d.json.error}`),f=204,p.complete();return}v.error("Write to InfluxDB failed.",d),a(d)},complete(){if(f==null||f>=200&&f<300)o();else{let d=`2xx HTTP response status code expected, but ${f} returned`,O=new R(f,d,void 0,"0",c);O.message=d,p.error(O)}}},m={..._e,...i},y={method:"POST",headers:{"content-type":"text/plain; charset=utf-8",...i==null?void 0:i.headers},gzipThreshold:m.gzipThreshold};return this._transport.send(this._createWritePath(t,m,r),e.join(` | ||
`),y,p),l}async close(){this._closed=!0}};var Ee=require("apache-arrow");var lr=require("@protobuf-ts/runtime-rpc");function U(n){let e=typeof n;if(e=="object"){if(Array.isArray(n))return"array";if(n===null)return"null"}return e}function qe(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),se=[];for(let n=0;n<_.length;n++)se[_[n].charCodeAt(0)]=n;se[45]=_.indexOf("+");se[95]=_.indexOf("/");function Wt(n){let e=n.length*3/4;n[n.length-2]=="="?e-=2:n[n.length-1]=="="&&(e-=1);let t=new Uint8Array(e),r=0,i=0,s,o=0;for(let a=0;a<n.length;a++){if(s=se[n.charCodeAt(a)],s===void 0)switch(n[a]){case"=":i=0;case` | ||
@@ -5,0 +5,0 @@ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:o=s,i=1;break;case 1:t[r++]=o<<2|(s&48)>>4,o=s,i=2;break;case 2:t[r++]=(o&15)<<4|(s&60)>>2,o=s,i=3;break;case 3:t[r++]=(o&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,r)}function qt(n){let e="",t=0,r,i=0;for(let s=0;s<n.length;s++)switch(r=n[s],t){case 0:e+=_[r>>2],i=(r&3)<<4,t=1;break;case 1:e+=_[i|r>>4],i=(r&15)<<2,t=2;break;case 2:e+=_[i|r>>6],e+=_[r&63],t=0;break}return t&&(e+=_[i],e+="=",t==1&&(e+="=")),e}var V;(function(n){n.symbol=Symbol.for("protobuf-ts/unknown"),n.onRead=(t,r,i,s,o)=>{(e(r)?r[n.symbol]:r[n.symbol]=[]).push({no:i,wireType:s,data:o})},n.onWrite=(t,r,i)=>{for(let{no:s,wireType:o,data:a}of n.list(r))i.tag(s,o).raw(a)},n.list=(t,r)=>{if(e(t)){let i=t[n.symbol];return r?i.filter(s=>s.no==r):i}return[]},n.last=(t,r)=>n.list(t,r).slice(-1)[0];let e=t=>t&&Array.isArray(t[n.symbol])})(V||(V={}));var w;(function(n){n[n.Varint=0]="Varint",n[n.Bit64=1]="Bit64",n[n.LengthDelimited=2]="LengthDelimited",n[n.StartGroup=3]="StartGroup",n[n.EndGroup=4]="EndGroup",n[n.Bit32=5]="Bit32"})(w||(w={}));function $t(){let n=0,e=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(n|=(i&127)<<r,!(i&128))return this.assertBounds(),[n,e]}let t=this.buf[this.pos++];if(n|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[n,e];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<r,!(i&128))return this.assertBounds(),[n,e]}throw new Error("invalid varint")}function ae(n,e,t){for(let s=0;s<28;s=s+7){let o=n>>>s,a=!(!(o>>>7)&&e==0),l=(a?o|128:o)&255;if(t.push(l),!a)return}let r=n>>>28&15|(e&7)<<4,i=!!(e>>3);if(t.push((i?r|128:r)&255),!!i){for(let s=3;s<31;s=s+7){let o=e>>>s,a=!!(o>>>7),l=(a?o|128:o)&255;if(t.push(l),!a)return}t.push(e>>>31&1)}}var oe=65536*65536;function $e(n){let e=n[0]=="-";e&&(n=n.slice(1));let t=1e6,r=0,i=0;function s(o,a){let l=Number(n.slice(o,a));i*=t,r=r*t+l,r>=oe&&(i=i+(r/oe|0),r=r%oe)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[e,r,i]}function le(n,e){if(e>>>0<=2097151)return""+(oe*e+(n>>>0));let t=n&16777215,r=(n>>>24|e<<8)>>>0&16777215,i=e>>16&65535,s=t+r*6777216+i*6710656,o=r+i*8147497,a=i*2,l=1e7;s>=l&&(o+=Math.floor(s/l),s%=l),o>=l&&(a+=Math.floor(o/l),o%=l);function f(c,p){let m=c?String(c):"";return p?"0000000".slice(m.length)+m:m}return f(a,0)+f(o,a)+f(s,1)}function je(n,e){if(n>=0){for(;n>127;)e.push(n&127|128),n=n>>>7;e.push(n)}else{for(let t=0;t<9;t++)e.push(n&127|128),n=n>>7;e.push(1)}}function jt(){let n=this.buf[this.pos++],e=n&127;if(!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<7,!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<14,!(n&128))return this.assertBounds(),e;if(n=this.buf[this.pos++],e|=(n&127)<<21,!(n&128))return this.assertBounds(),e;n=this.buf[this.pos++],e|=(n&15)<<28;for(let t=5;n&128&&t<10;t++)n=this.buf[this.pos++];if(n&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var b;function Pr(){let n=new DataView(new ArrayBuffer(8));b=globalThis.BigInt!==void 0&&typeof n.getBigInt64=="function"&&typeof n.getBigUint64=="function"&&typeof n.setBigInt64=="function"&&typeof n.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:n}:void 0}Pr();function Jt(n){if(!n)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var Xt=/^-?[0-9]+$/,fe=4294967296,ue=2147483648,ce=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*fe+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},F=class n extends ce{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(e<b.UMIN)throw new Error("signed value for ulong");if(e>b.UMAX)throw new Error("ulong too large");return b.V.setBigUint64(0,e,!0),new n(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Xt.test(e))throw new Error("string is no integer");let[t,r,i]=$e(e);if(t)throw new Error("signed value for ulong");return new n(r,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new n(e,e/fe)}throw new Error("unknown value "+typeof e)}toString(){return b?this.toBigInt().toString():le(this.lo,this.hi)}toBigInt(){return Jt(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigUint64(0,!0)}};F.ZERO=new F(0,0);var g=class n extends ce{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(e<b.MIN)throw new Error("signed long too small");if(e>b.MAX)throw new Error("signed long too large");return b.V.setBigInt64(0,e,!0),new n(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Xt.test(e))throw new Error("string is no integer");let[t,r,i]=$e(e);if(t){if(i>ue||i==ue&&r!=0)throw new Error("signed long too small")}else if(i>=ue)throw new Error("signed long too large");let s=new n(r,i);return t?s.negate():s;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new n(e,e/fe):new n(-e,-e/fe).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&ue)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new n(t,e)}toString(){if(b)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+le(e.lo,e.hi)}return le(this.lo,this.hi)}toBigInt(){return Jt(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigInt64(0,!0)}};g.ZERO=new g(0,0);var Ht={readUnknownField:!0,readerFactory:n=>new Je(n)};function Gt(n){return n?Object.assign(Object.assign({},Ht),n):Ht}var Je=class{constructor(e,t){this.varint64=$t,this.uint32=jt,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t!=null?t:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,r=e&7;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e){let t=this.pos;switch(e){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 r=this.uint32();this.pos+=r;break;case w.StartGroup:let i;for(;(i=this.tag()[1])!==w.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,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 new g(...this.varint64())}uint64(){return new F(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new g(e,t)}bool(){let[e,t]=this.varint64();return e!==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 new F(this.sfixed32(),this.sfixed32())}sfixed64(){return new g(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function h(n,e){if(!n)throw new Error(e)}var Ar=34028234663852886e22,Dr=-34028234663852886e22,Ur=4294967295,Cr=2147483647,Lr=-2147483648;function A(n){if(typeof n!="number")throw new Error("invalid int 32: "+typeof n);if(!Number.isInteger(n)||n>Cr||n<Lr)throw new Error("invalid int 32: "+n)}function C(n){if(typeof n!="number")throw new Error("invalid uint 32: "+typeof n);if(!Number.isInteger(n)||n>Ur||n<0)throw new Error("invalid uint 32: "+n)}function M(n){if(typeof n!="number")throw new Error("invalid float 32: "+typeof n);if(Number.isFinite(n)&&(n>Ar||n<Dr))throw new Error("invalid float 32: "+n)}var Kt={writeUnknownFields:!0,writerFactory:()=>new Xe};function Zt(n){return n?Object.assign(Object.assign({},Kt),n):Kt}var Xe=class{constructor(e){this.stack=[],this.textEncoder=e!=null?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let t=new Uint8Array(e),r=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],r),r+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(C(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return A(e),je(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){M(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){C(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){A(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return A(e),e=(e<<1^e>>31)>>>0,je(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=g.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=F.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=g.from(e);return ae(t.lo,t.hi,this.buf),this}sint64(e){let t=g.from(e),r=t.hi>>31,i=t.lo<<1^r,s=(t.hi<<1|t.lo>>>31)^r;return ae(i,s,this.buf),this}uint64(e){let t=F.from(e);return ae(t.lo,t.hi,this.buf),this}};var Qt={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},zt={ignoreUnknownFields:!1};function Yt(n){return n?Object.assign(Object.assign({},zt),n):zt}function er(n){return n?Object.assign(Object.assign({},Qt),n):Qt}var pe=Symbol.for("protobuf-ts/message-type");function He(n){let e=!1,t=[];for(let r=0;r<n.length;r++){let i=n.charAt(r);i=="_"?e=!0:/\d/.test(i)?(t.push(i),e=!0):e?(t.push(i.toUpperCase()),e=!1):r==0?t.push(i.toLowerCase()):t.push(i)}return t.join("")}var u;(function(n){n[n.DOUBLE=1]="DOUBLE",n[n.FLOAT=2]="FLOAT",n[n.INT64=3]="INT64",n[n.UINT64=4]="UINT64",n[n.INT32=5]="INT32",n[n.FIXED64=6]="FIXED64",n[n.FIXED32=7]="FIXED32",n[n.BOOL=8]="BOOL",n[n.STRING=9]="STRING",n[n.BYTES=12]="BYTES",n[n.UINT32=13]="UINT32",n[n.SFIXED32=15]="SFIXED32",n[n.SFIXED64=16]="SFIXED64",n[n.SINT32=17]="SINT32",n[n.SINT64=18]="SINT64"})(u||(u={}));var x;(function(n){n[n.BIGINT=0]="BIGINT",n[n.STRING=1]="STRING",n[n.NUMBER=2]="NUMBER"})(x||(x={}));var X;(function(n){n[n.NO=0]="NO",n[n.PACKED=1]="PACKED",n[n.UNPACKED=2]="UNPACKED"})(X||(X={}));function tr(n){var e,t,r,i;return n.localName=(e=n.localName)!==null&&e!==void 0?e:He(n.name),n.jsonName=(t=n.jsonName)!==null&&t!==void 0?t:He(n.name),n.repeat=(r=n.repeat)!==null&&r!==void 0?r:X.NO,n.opt=(i=n.opt)!==null&&i!==void 0?i:n.repeat||n.oneof?!1:n.kind=="message",n}function rr(n){if(typeof n!="object"||n===null||!n.hasOwnProperty("oneofKind"))return!1;switch(typeof n.oneofKind){case"string":return n[n.oneofKind]===void 0?!1:Object.keys(n).length==2;case"undefined":return Object.keys(n).length==1;default:return!1}}var me=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;let e=[],t=[],r=[];for(let i of this.fields)if(i.oneof)r.includes(i.oneof)||(r.push(i.oneof),e.push(i.oneof),t.push(i.oneof));else switch(t.push(i.localName),i.kind){case"scalar":case"enum":(!i.opt||i.repeat)&&e.push(i.localName);break;case"message":i.repeat&&e.push(i.localName);break;case"map":e.push(i.localName);break}this.data={req:e,known:t,oneofs:Object.values(r)}}is(e,t,r=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let i=Object.keys(e),s=this.data;if(i.length<s.req.length||s.req.some(o=>!i.includes(o))||!r&&i.some(o=>!s.known.includes(o)))return!1;if(t<1)return!0;for(let o of s.oneofs){let a=e[o];if(!rr(a))return!1;if(a.oneofKind===void 0)continue;let l=this.fields.find(f=>f.localName===a.oneofKind);if(!l||!this.field(a[a.oneofKind],l,r,t))return!1}for(let o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,r,t))return!1;return!0}field(e,t,r,i){let s=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:s?this.scalars(e,t.T,i,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:s?this.scalars(e,u.INT32,i):this.scalar(e,u.INT32);case"message":return e===void 0?!0:s?this.messages(e,t.T(),r,i):this.message(e,t.T(),r,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,t.K,i))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,i,t.V.L);case"enum":return this.scalars(Object.values(e),u.INT32,i);case"message":return this.messages(Object.values(e),t.V.T(),r,i)}break}return!0}message(e,t,r,i){return r?t.isAssignable(e,i):t.is(e,i)}messages(e,t,r,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(r){for(let s=0;s<e.length&&s<i;s++)if(!t.isAssignable(e[s],i-1))return!1}else for(let s=0;s<e.length&&s<i;s++)if(!t.is(e[s],i-1))return!1;return!0}scalar(e,t,r){let i=typeof e;switch(t){case u.UINT64:case u.FIXED64:case u.INT64:case u.SFIXED64:case u.SINT64:switch(r){case x.BIGINT:return i=="bigint";case x.NUMBER:return i=="number"&&!isNaN(e);default:return i=="string"}case u.BOOL:return i=="boolean";case u.STRING:return i=="string";case u.BYTES:return e instanceof Uint8Array;case u.DOUBLE:case u.FLOAT:return i=="number"&&!isNaN(e);default:return i=="number"&&Number.isInteger(e)}}scalars(e,t,r,i){if(!Array.isArray(e))return!1;if(r<2)return!0;if(Array.isArray(e)){for(let s=0;s<e.length&&s<r;s++)if(!this.scalar(e[s],t,i))return!1}return!0}mapKeys(e,t,r){let i=Object.keys(e);switch(t){case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:return this.scalars(i.slice(0,r).map(s=>parseInt(s)),t,r);case u.BOOL:return this.scalars(i.slice(0,r).map(s=>s=="true"?!0:s=="false"?!1:s),t,r);default:return this.scalars(i,t,r,x.STRING)}}};function I(n,e){switch(e){case x.BIGINT:return n.toBigInt();case x.NUMBER:return n.toNumber();default:return n.toString()}}var he=class{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};let t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(let r of t)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,t,r){if(!e){let i=U(r);throw(i=="number"||i=="boolean")&&(i=r.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${t}`)}}read(e,t,r){this.prepare();let i=[];for(let[s,o]of Object.entries(e)){let a=this.fMap[s];if(!a){if(!r.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}let l=a.localName,f;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(i.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(a.oneof),f=t[a.oneof]={oneofKind:l}}else f=t;if(a.kind=="map"){if(o===null)continue;this.assert(qe(o),a.name,o);let c=f[l];for(let[p,m]of Object.entries(o)){this.assert(m!==null,a.name+" map value",null);let y;switch(a.V.kind){case"message":y=a.V.T().internalJsonRead(m,r);break;case"enum":if(y=this.enum(a.V.T(),m,a.name,r.ignoreUnknownFields),y===!1)continue;break;case"scalar":y=this.scalar(m,a.V.T,a.V.L,a.name);break}this.assert(y!==void 0,a.name+" map value",m);let d=p;a.K==u.BOOL&&(d=d=="true"?!0:d=="false"?!1:d),d=this.scalar(d,a.K,x.STRING,a.name).toString(),c[d]=y}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);let c=f[l];for(let p of o){this.assert(p!==null,a.name,null);let m;switch(a.kind){case"message":m=a.T().internalJsonRead(p,r);break;case"enum":if(m=this.enum(a.T(),p,a.name,r.ignoreUnknownFields),m===!1)continue;break;case"scalar":m=this.scalar(p,a.T,a.L,a.name);break}this.assert(m!==void 0,a.name,o),c.push(m)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}f[l]=a.T().internalJsonRead(o,r,f[l]);break;case"enum":let c=this.enum(a.T(),o,a.name,r.ignoreUnknownFields);if(c===!1)continue;f[l]=c;break;case"scalar":f[l]=this.scalar(o,a.T,a.L,a.name);break}}}enum(e,t,r,i){if(e[0]=="google.protobuf.NullValue"&&h(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return h(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${r}, enum can only be integral number, got ${t}.`),t;case"string":let s=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(s=t.substring(e[2].length));let o=e[1][s];return typeof o=="undefined"&&i?!1:(h(typeof o=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${t}".`),o)}h(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,r,i){let s;try{switch(t){case u.DOUBLE:case u.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){s="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){s="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){s="not a number";break}if(!Number.isFinite(o)){s="too large or small";break}return t==u.FLOAT&&M(o),o;case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?s="empty string":typeof e=="string"&&(e.trim().length!==e.length?s="extra whitespace":a=Number(e)),a===void 0)break;return t==u.UINT32?C(a):A(a),a;case u.INT64:case u.SFIXED64:case u.SINT64:if(e===null)return I(g.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return I(g.from(e),r);case u.FIXED64:case u.UINT64:if(e===null)return I(F.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return I(F.from(e),r);case u.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case u.STRING:if(e===null)return"";if(typeof e!="string"){s="extra whitespace";break}try{encodeURIComponent(e)}catch(l){l="invalid UTF8";break}return e;case u.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Wt(e)}}catch(o){s=o.message}this.assert(!1,i+(s?" - "+s:""),e)}};var de=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){let r={},i=e;for(let s of this.fields){if(!s.oneof){let f=this.field(s,i[s.localName],t);f!==void 0&&(r[t.useProtoFieldName?s.name:s.jsonName]=f);continue}let o=i[s.oneof];if(o.oneofKind!==s.localName)continue;let a=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,l=this.field(s,o[s.localName],a);h(l!==void 0),r[t.useProtoFieldName?s.name:s.jsonName]=l}return r}field(e,t,r){let i;if(e.kind=="map"){h(typeof t=="object"&&t!==null);let s={};switch(e.V.kind){case"scalar":for(let[l,f]of Object.entries(t)){let c=this.scalar(e.V.T,f,e.name,!1,!0);h(c!==void 0),s[l.toString()]=c}break;case"message":let o=e.V.T();for(let[l,f]of Object.entries(t)){let c=this.message(o,f,e.name,r);h(c!==void 0),s[l.toString()]=c}break;case"enum":let a=e.V.T();for(let[l,f]of Object.entries(t)){h(f===void 0||typeof f=="number");let c=this.enum(a,f,e.name,!1,!0,r.enumAsInteger);h(c!==void 0),s[l.toString()]=c}break}(r.emitDefaultValues||Object.keys(s).length>0)&&(i=s)}else if(e.repeat){h(Array.isArray(t));let s=[];switch(e.kind){case"scalar":for(let l=0;l<t.length;l++){let f=this.scalar(e.T,t[l],e.name,e.opt,!0);h(f!==void 0),s.push(f)}break;case"enum":let o=e.T();for(let l=0;l<t.length;l++){h(t[l]===void 0||typeof t[l]=="number");let f=this.enum(o,t[l],e.name,e.opt,!0,r.enumAsInteger);h(f!==void 0),s.push(f)}break;case"message":let a=e.T();for(let l=0;l<t.length;l++){let f=this.message(a,t[l],e.name,r);h(f!==void 0),s.push(f)}break}(r.emitDefaultValues||s.length>0||r.emitDefaultValues)&&(i=s)}else switch(e.kind){case"scalar":i=this.scalar(e.T,t,e.name,e.opt,r.emitDefaultValues);break;case"enum":i=this.enum(e.T(),t,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":i=this.message(e.T(),t,e.name,r);break}return i}enum(e,t,r,i,s,o){if(e[0]=="google.protobuf.NullValue")return!s&&!i?void 0:null;if(t===void 0){h(i);return}if(!(t===0&&!s&&!i))return h(typeof t=="number"),h(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,r,i){return t===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(t,i)}scalar(e,t,r,i,s){if(t===void 0){h(i);return}let o=s||i;switch(e){case u.INT32:case u.SFIXED32:case u.SINT32:return t===0?o?0:void 0:(A(t),t);case u.FIXED32:case u.UINT32:return t===0?o?0:void 0:(C(t),t);case u.FLOAT:M(t);case u.DOUBLE:return t===0?o?0:void 0:(h(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case u.STRING:return t===""?o?"":void 0:(h(typeof t=="string"),t);case u.BOOL:return t===!1?o?!1:void 0:(h(typeof t=="boolean"),t);case u.UINT64:case u.FIXED64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=F.from(t);return a.isZero()&&!o?void 0:a.toString();case u.INT64:case u.SFIXED64:case u.SINT64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let l=g.from(t);return l.isZero()&&!o?void 0:l.toString();case u.BYTES:return h(t instanceof Uint8Array),t.byteLength?qt(t):o?"":void 0}}};function H(n,e=x.STRING){switch(n){case u.BOOL:return!1;case u.UINT64:case u.FIXED64:return I(F.ZERO,e);case u.INT64:case u.SFIXED64:case u.SINT64:return I(g.ZERO,e);case u.DOUBLE:case u.FLOAT:return 0;case u.BYTES:return new Uint8Array(0);case u.STRING:return"";default:return 0}}var ge=class{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(r=>[r.no,r]))}}read(e,t,r,i){this.prepare();let s=i===void 0?e.len:e.pos+i;for(;e.pos<s;){let[o,a]=e.tag(),l=this.fieldNoToField.get(o);if(!l){let m=r.readUnknownField;if(m=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let y=e.skip(a);m!==!1&&(m===!0?V.onRead:m)(this.info.typeName,t,o,a,y);continue}let f=t,c=l.repeat,p=l.localName;switch(l.oneof&&(f=f[l.oneof],f.oneofKind!==p&&(f=t[l.oneof]={oneofKind:p})),l.kind){case"scalar":case"enum":let m=l.kind=="enum"?u.INT32:l.T,y=l.kind=="scalar"?l.L:void 0;if(c){let N=f[p];if(a==w.LengthDelimited&&m!=u.STRING&&m!=u.BYTES){let Ne=e.uint32()+e.pos;for(;e.pos<Ne;)N.push(this.scalar(e,m,y))}else N.push(this.scalar(e,m,y))}else f[p]=this.scalar(e,m,y);break;case"message":if(c){let N=f[p],Ne=l.T().internalBinaryRead(e,e.uint32(),r);N.push(Ne)}else f[p]=l.T().internalBinaryRead(e,e.uint32(),r,f[p]);break;case"map":let[d,O]=this.mapEntry(l,e,r);f[p][d]=O;break}}}mapEntry(e,t,r){let i=t.uint32(),s=t.pos+i,o,a;for(;t.pos<s;){let[l,f]=t.tag();switch(l){case 1:e.K==u.BOOL?o=t.bool().toString():o=this.scalar(t,e.K,x.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),r);break}break;default:throw new Error(`Unknown field ${l} (wire type ${f}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let l=H(e.K);o=e.K==u.BOOL?l.toString():l}if(a===void 0)switch(e.V.kind){case"scalar":a=H(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create();break}return[o,a]}scalar(e,t,r){switch(t){case u.INT32:return e.int32();case u.STRING:return e.string();case u.BOOL:return e.bool();case u.DOUBLE:return e.double();case u.FLOAT:return e.float();case u.INT64:return I(e.int64(),r);case u.UINT64:return I(e.uint64(),r);case u.FIXED64:return I(e.fixed64(),r);case u.FIXED32:return e.fixed32();case u.BYTES:return e.bytes();case u.UINT32:return e.uint32();case u.SFIXED32:return e.sfixed32();case u.SFIXED64:return I(e.sfixed64(),r);case u.SINT32:return e.sint32();case u.SINT64:return I(e.sint64(),r)}}};var be=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,r)=>t.no-r.no)}}write(e,t,r){this.prepare();for(let s of this.fields){let o,a,l=s.repeat,f=s.localName;if(s.oneof){let c=e[s.oneof];if(c.oneofKind!==f)continue;o=c[f],a=!0}else o=e[f],a=!1;switch(s.kind){case"scalar":case"enum":let c=s.kind=="enum"?u.INT32:s.T;if(l)if(h(Array.isArray(o)),l==X.PACKED)this.packed(t,c,s.no,o);else for(let p of o)this.scalar(t,c,s.no,p,!0);else o===void 0?h(s.opt):this.scalar(t,c,s.no,o,a||s.opt);break;case"message":if(l){h(Array.isArray(o));for(let p of o)this.message(t,r,s.T(),s.no,p)}else this.message(t,r,s.T(),s.no,o);break;case"map":h(typeof o=="object"&&o!==null);for(let[p,m]of Object.entries(o))this.mapEntry(t,r,s,p,m);break}}let i=r.writeUnknownFields;i!==!1&&(i===!0?V.onWrite:i)(this.info.typeName,e,t)}mapEntry(e,t,r,i,s){e.tag(r.no,w.LengthDelimited),e.fork();let o=i;switch(r.K){case u.INT32:case u.FIXED32:case u.UINT32:case u.SFIXED32:case u.SINT32:o=Number.parseInt(i);break;case u.BOOL:h(i=="true"||i=="false"),o=i=="true";break}switch(this.scalar(e,r.K,1,o,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,s,!0);break;case"enum":this.scalar(e,u.INT32,2,s,!0);break;case"message":this.message(e,t,r.V.T(),2,s);break}e.join()}message(e,t,r,i,s){s!==void 0&&(r.internalBinaryWrite(s,e.tag(i,w.LengthDelimited).fork(),t),e.join())}scalar(e,t,r,i,s){let[o,a,l]=this.scalarInfo(t,i);(!l||s)&&(e.tag(r,o),e[a](i))}packed(e,t,r,i){if(!i.length)return;h(t!==u.BYTES&&t!==u.STRING),e.tag(r,w.LengthDelimited),e.fork();let[,s]=this.scalarInfo(t);for(let o=0;o<i.length;o++)e[s](i[o]);e.join()}scalarInfo(e,t){let r=w.Varint,i,s=t===void 0,o=t===0;switch(e){case u.INT32:i="int32";break;case u.STRING:o=s||!t.length,r=w.LengthDelimited,i="string";break;case u.BOOL:o=t===!1,i="bool";break;case u.UINT32:i="uint32";break;case u.DOUBLE:r=w.Bit64,i="double";break;case u.FLOAT:r=w.Bit32,i="float";break;case u.INT64:o=s||g.from(t).isZero(),i="int64";break;case u.UINT64:o=s||F.from(t).isZero(),i="uint64";break;case u.FIXED64:o=s||F.from(t).isZero(),r=w.Bit64,i="fixed64";break;case u.BYTES:o=s||!t.byteLength,r=w.LengthDelimited,i="bytes";break;case u.FIXED32:r=w.Bit32,i="fixed32";break;case u.SFIXED32:r=w.Bit32,i="sfixed32";break;case u.SFIXED64:o=s||g.from(t).isZero(),r=w.Bit64,i="sfixed64";break;case u.SINT32:i="sint32";break;case u.SINT64:o=s||g.from(t).isZero(),i="sint64";break}return[r,i,s||o]}};function nr(n){let e=n.messagePrototype?Object.create(n.messagePrototype):Object.defineProperty({},pe,{value:n});for(let t of n.fields){let r=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[r]=[];else switch(t.kind){case"scalar":e[r]=H(t.T,t.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function ye(n,e,t){let r,i=t,s;for(let o of n.fields){let a=o.localName;if(o.oneof){let l=i[o.oneof];if((l==null?void 0:l.oneofKind)==null)continue;if(r=l[a],s=e[o.oneof],s.oneofKind=l.oneofKind,r==null){delete s[a];continue}}else if(r=i[a],s=e,r==null)continue;switch(o.repeat&&(s[a].length=r.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let f=0;f<r.length;f++)s[a][f]=r[f];else s[a]=r;break;case"message":let l=o.T();if(o.repeat)for(let f=0;f<r.length;f++)s[a][f]=l.create(r[f]);else s[a]===void 0?s[a]=l.create(r):l.mergePartial(s[a],r);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(s[a],r);break;case"message":let f=o.V.T();for(let c of Object.keys(r))s[a][c]=f.create(r[c]);break}break}}}function or(n,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let r of n.fields){let i=r.localName,s=r.oneof?e[r.oneof][i]:e[i],o=r.oneof?t[r.oneof][i]:t[i];switch(r.kind){case"enum":case"scalar":let a=r.kind=="enum"?u.INT32:r.T;if(!(r.repeat?ir(a,s,o):ar(a,s,o)))return!1;break;case"map":if(!(r.V.kind=="message"?sr(r.V.T(),Te(s),Te(o)):ir(r.V.kind=="enum"?u.INT32:r.V.T,Te(s),Te(o))))return!1;break;case"message":let l=r.T();if(!(r.repeat?sr(l,s,o):l.equals(s,o)))return!1;break}}return!0}var Te=Object.values;function ar(n,e,t){if(e===t)return!0;if(n!==u.BYTES)return!1;let r=e,i=t;if(r.length!==i.length)return!1;for(let s=0;s<r.length;s++)if(r[s]!=i[s])return!1;return!0}function ir(n,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!ar(n,e[r],t[r]))return!1;return!0}function sr(n,e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n.equals(e[r],t[r]))return!1;return!0}var vr=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),T=class{constructor(e,t,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(tr),this.options=r!=null?r:{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},vr),{[pe]:{value:this}})),this.refTypeCheck=new me(this),this.refJsonReader=new he(this),this.refJsonWriter=new de(this),this.refBinReader=new ge(this),this.refBinWriter=new be(this)}create(e){let t=nr(this);return e!==void 0&&ye(this,t,e),t}clone(e){let t=this.create();return ye(this,t,e),t}equals(e,t){return or(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){ye(this,e,t)}fromBinary(e,t){let r=Gt(t);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,t){return this.internalJsonRead(e,Yt(t))}fromJsonString(e,t){let r=JSON.parse(e);return this.fromJson(r,t)}toJson(e,t){return this.internalJsonWrite(e,er(t))}toJsonString(e,t){var r;let i=this.toJson(e,t);return JSON.stringify(i,null,(r=t==null?void 0:t.prettySpaces)!==null&&r!==void 0?r:0)}toBinary(e,t){let r=Zt(t);return this.internalBinaryWrite(e,r.writerFactory(),r).finish()}internalJsonRead(e,t,r){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let i=r!=null?r:this.create();return this.refJsonReader.read(e,i,t),i}throw new Error(`Unable to parse message ${this.typeName} from JSON ${U(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,r){return this.refBinWriter.write(e,t,r),t}internalBinaryRead(e,t,r,i){let s=i!=null?i:this.create();return this.refBinReader.read(e,s,r,t),s}};var Ge=class extends T{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){let e=this.create(),t=Date.now();return e.seconds=g.from(Math.floor(t/1e3)).toBigInt(),e.nanos=t%1e3*1e6,e}toDate(e){return new Date(g.from(e.seconds).toNumber()*1e3+Math.ceil(e.nanos/1e6))}fromDate(e){let t=this.create(),r=e.getTime();return t.seconds=g.from(Math.floor(r/1e3)).toBigInt(),t.nanos=r%1e3*1e6,t}internalJsonWrite(e,t){let r=g.from(e.seconds).toNumber()*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(e.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let i="Z";if(e.nanos>0){let s=(e.nanos+1e9).toString().substring(1);s.substring(3)==="000000"?i="."+s.substring(0,3)+"Z":s.substring(6)==="000"?i="."+s.substring(0,6)+"Z":i="."+s+"Z"}return new Date(r).toISOString().replace(".000Z",i)}internalJsonRead(e,t,r){if(typeof e!="string")throw new Error("Unable to parse Timestamp from JSON "+U(e)+".");let i=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let s=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(s))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(s<Date.parse("0001-01-01T00:00:00Z")||s>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return r||(r=this.create()),r.seconds=g.from(s/1e3).toBigInt(),r.nanos=0,i[7]&&(r.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),r}},Ke=new Ge;var ur=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.PATH=1]="PATH",r[r.CMD=2]="CMD",r))(ur||{}),fr=(i=>(i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.CANCELLED=1]="CANCELLED",i[i.CANCELLING=2]="CANCELLING",i[i.NOT_CANCELLABLE=3]="NOT_CANCELLABLE",i))(fr||{}),Ze=class extends T{constructor(){super("arrow.flight.protocol.HandshakeRequest",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},Br=new Ze,Qe=class extends T{constructor(){super("arrow.flight.protocol.HandshakeResponse",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},Vr=new Qe,ze=class extends T{constructor(){super("arrow.flight.protocol.BasicAuth",[{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"password",kind:"scalar",T:9}])}},gs=new ze,Ye=class extends T{constructor(){super("arrow.flight.protocol.Empty",[])}},Mr=new Ye,et=class extends T{constructor(){super("arrow.flight.protocol.ActionType",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9}])}},Wr=new et,tt=class extends T{constructor(){super("arrow.flight.protocol.Criteria",[{no:1,name:"expression",kind:"scalar",T:12}])}},qr=new tt,rt=class extends T{constructor(){super("arrow.flight.protocol.Action",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"body",kind:"scalar",T:12}])}},$r=new rt,nt=class extends T{constructor(){super("arrow.flight.protocol.CancelFlightInfoRequest",[{no:1,name:"info",kind:"message",T:()=>Fe}])}},bs=new nt,it=class extends T{constructor(){super("arrow.flight.protocol.RenewFlightEndpointRequest",[{no:1,name:"endpoint",kind:"message",T:()=>cr}])}},ys=new it,st=class extends T{constructor(){super("arrow.flight.protocol.Result",[{no:1,name:"body",kind:"scalar",T:12}])}},jr=new st,ot=class extends T{constructor(){super("arrow.flight.protocol.CancelFlightInfoResult",[{no:1,name:"status",kind:"enum",T:()=>["arrow.flight.protocol.CancelStatus",fr,"CANCEL_STATUS_"]}])}},Ts=new ot,at=class extends T{constructor(){super("arrow.flight.protocol.SchemaResult",[{no:1,name:"schema",kind:"scalar",T:12}])}},Jr=new at,lt=class extends T{constructor(){super("arrow.flight.protocol.FlightDescriptor",[{no:1,name:"type",kind:"enum",T:()=>["arrow.flight.protocol.FlightDescriptor.DescriptorType",ur]},{no:2,name:"cmd",kind:"scalar",T:12},{no:3,name:"path",kind:"scalar",repeat:2,T:9}])}},W=new lt,ut=class extends T{constructor(){super("arrow.flight.protocol.FlightInfo",[{no:1,name:"schema",kind:"scalar",T:12},{no:2,name:"flight_descriptor",kind:"message",T:()=>W},{no:3,name:"endpoint",kind:"message",repeat:1,T:()=>cr},{no:4,name:"total_records",kind:"scalar",T:3,L:0},{no:5,name:"total_bytes",kind:"scalar",T:3,L:0},{no:6,name:"ordered",kind:"scalar",T:8},{no:7,name:"app_metadata",kind:"scalar",T:12}])}},Fe=new ut,ft=class extends T{constructor(){super("arrow.flight.protocol.PollInfo",[{no:1,name:"info",kind:"message",T:()=>Fe},{no:2,name:"flight_descriptor",kind:"message",T:()=>W},{no:3,name:"progress",kind:"scalar",opt:!0,T:1},{no:4,name:"expiration_time",kind:"message",T:()=>Ke}])}},Xr=new ft,ct=class extends T{constructor(){super("arrow.flight.protocol.FlightEndpoint",[{no:1,name:"ticket",kind:"message",T:()=>Oe},{no:2,name:"location",kind:"message",repeat:1,T:()=>Hr},{no:3,name:"expiration_time",kind:"message",T:()=>Ke},{no:4,name:"app_metadata",kind:"scalar",T:12}])}},cr=new ct,pt=class extends T{constructor(){super("arrow.flight.protocol.Location",[{no:1,name:"uri",kind:"scalar",T:9}])}},Hr=new pt,mt=class extends T{constructor(){super("arrow.flight.protocol.Ticket",[{no:1,name:"ticket",kind:"scalar",T:12}])}},Oe=new mt,ht=class extends T{constructor(){super("arrow.flight.protocol.FlightData",[{no:1,name:"flight_descriptor",kind:"message",T:()=>W},{no:2,name:"data_header",kind:"scalar",T:12},{no:3,name:"app_metadata",kind:"scalar",T:12},{no:1e3,name:"data_body",kind:"scalar",T:12}])}},we=new ht,dt=class extends T{constructor(){super("arrow.flight.protocol.PutResult",[{no:1,name:"app_metadata",kind:"scalar",T:12}])}},Gr=new dt,xe=new lr.ServiceType("arrow.flight.protocol.FlightService",[{name:"Handshake",serverStreaming:!0,clientStreaming:!0,options:{},I:Br,O:Vr},{name:"ListFlights",serverStreaming:!0,options:{},I:qr,O:Fe},{name:"GetFlightInfo",options:{},I:W,O:Fe},{name:"PollFlightInfo",options:{},I:W,O:Xr},{name:"GetSchema",options:{},I:W,O:Jr},{name:"DoGet",serverStreaming:!0,options:{},I:Oe,O:we},{name:"DoPut",serverStreaming:!0,clientStreaming:!0,options:{},I:we,O:Gr},{name:"DoExchange",serverStreaming:!0,clientStreaming:!0,options:{},I:we,O:we},{name:"DoAction",serverStreaming:!0,options:{},I:$r,O:jr},{name:"ListActions",serverStreaming:!0,options:{},I:Mr,O:Wr}]);var E=require("@protobuf-ts/runtime-rpc"),Ie=class{constructor(e){this._transport=e;this.typeName=xe.typeName;this.methods=xe.methods;this.options=xe.options}handshake(e){let t=this.methods[0],r=this._transport.mergeOptions(e);return(0,E.stackIntercept)("duplex",this._transport,t,r)}listFlights(e,t){let r=this.methods[1],i=this._transport.mergeOptions(t);return(0,E.stackIntercept)("serverStreaming",this._transport,r,i,e)}getFlightInfo(e,t){let r=this.methods[2],i=this._transport.mergeOptions(t);return(0,E.stackIntercept)("unary",this._transport,r,i,e)}pollFlightInfo(e,t){let r=this.methods[3],i=this._transport.mergeOptions(t);return(0,E.stackIntercept)("unary",this._transport,r,i,e)}getSchema(e,t){let r=this.methods[4],i=this._transport.mergeOptions(t);return(0,E.stackIntercept)("unary",this._transport,r,i,e)}doGet(e,t){let r=this.methods[5],i=this._transport.mergeOptions(t);return(0,E.stackIntercept)("serverStreaming",this._transport,r,i,e)}doPut(e){let t=this.methods[6],r=this._transport.mergeOptions(e);return(0,E.stackIntercept)("duplex",this._transport,t,r)}doExchange(e){let t=this.methods[7],r=this._transport.mergeOptions(e);return(0,E.stackIntercept)("duplex",this._transport,t,r)}doAction(e,t){let r=this.methods[8],i=this._transport.mergeOptions(t);return(0,E.stackIntercept)("serverStreaming",this._transport,r,i,e)}listActions(e,t){let r=this.methods[9],i=this._transport.mergeOptions(t);return(0,E.stackIntercept)("serverStreaming",this._transport,r,i,e)}};var pr=/\$(\w+)/g;function mr(n){return!!n.match(pr)}function hr(n,e){let t=n.match(pr);if(t)for(let r of t)e[r.trim().replace("$","")]||B(new Error(`No parameter matching ${r} provided in the query params map`));return!0}var G=class{constructor(e){this._options=e;this._closed=!1;let{host:t,queryTimeout:r}=this._options;this._defaultHeaders=this._options.headers,this._transport=j.queryTransport({host:t,timeout:r}),this._flightClient=new Ie(this._transport)}prepareTicket(e,t,r){let i={database:e,sql_query:t,query_type:r.type};if(r.params){let s={};for(let o of Object.keys(r.params))r.params[o]&&(s[o]=r.params[o]);i.params=s}return Oe.create({ticket:new TextEncoder().encode(JSON.stringify(i))})}prepareMetadata(e){let t={"User-Agent":ne,...this._defaultHeaders,...e},r=this._options.token;return r&&(t.authorization=`Bearer ${r}`),t}async*_queryRawBatches(e,t,r){if(r.params&&mr(e)&&hr(e,r.params),this._closed)throw new Error("queryApi: already closed!");let i=this._flightClient,s=this.prepareTicket(t,e,r),a={meta:this.prepareMetadata(r.headers)},l=i.doGet(s,a),f=async function*(){for await(let p of l.responses)yield St(p.dataHeader.length),yield p.dataHeader,yield p.dataBody}();yield*await Ee.RecordBatchReader.from(f)}async*query(e,t,r){var s;let i=this._queryRawBatches(e,t,r);for await(let o of i)for(let a=0;a<o.numRows;a++){let l={};for(let f=0;f<o.numCols;f++){let c=o.schema.fields[f].name,p=(s=o.getChildAt(f))==null?void 0:s.get(a);l[c]=p}yield l}}async*queryPoints(e,t,r){var s;let i=this._queryRawBatches(e,t,r);for await(let o of i)for(let a=0;a<o.numRows;a++){let l=new P;for(let f=0;f<o.numCols;f++){let c=o.schema.fields[f],p=c.name,m=(s=o.getChildAt(f))==null?void 0:s.get(a),y=c.typeId,d=c.metadata.get("iox::column::type");if(m==null)continue;if((p==="measurement"||p=="iox::measurement")&&typeof m=="string"){l.setMeasurement(m);continue}if(!d){p==="time"&&y===Ee.Type.Timestamp?l.setTimestamp(m):l.setField(p,m);continue}let[,,O,N]=d.split("::");O==="field"?N&&m!==void 0&&m!==null&&l.setField(p,m,N):O==="tag"?l.setTag(p,m):O==="timestamp"&&l.setTimestamp(m)}yield l}}async close(){var e,t;this._closed=!0,(t=(e=this._transport).close)==null||t.call(e)}};var gt=`Please specify the 'database' as a method parameter or use default configuration at 'ClientOptions.database' |
{ | ||
"name": "@influxdata/influxdb3-client", | ||
"version": "0.11.0", | ||
"version": "0.12.0-nightly.6451", | ||
"description": "The Client that provides a simple and convenient way to interact with InfluxDB 3.", | ||
@@ -96,3 +96,3 @@ "scripts": { | ||
}, | ||
"gitHead": "5cd26cde5379a14cafcaea9c428977947c1d91e8" | ||
"gitHead": "49d2dd8076c572b5058ca524c234f9a2005f2410" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2963618