UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

1 lines 148 kB
"use strict";function yi(){let e=0,n=0;for(let a=0;a<28;a+=7){let t=this.buf[this.pos++];if(e|=(t&127)<<a,!(t&128))return this.assertBounds(),[e,n]}let i=this.buf[this.pos++];if(e|=(i&15)<<28,n=(i&112)>>4,!(i&128))return this.assertBounds(),[e,n];for(let a=3;a<=31;a+=7){let t=this.buf[this.pos++];if(n|=(t&127)<<a,!(t&128))return this.assertBounds(),[e,n]}throw new Error("invalid varint")}function de(e,n,i){for(let r=0;r<28;r=r+7){const o=e>>>r,N=!(!(o>>>7)&&n==0),O=(N?o|128:o)&255;if(i.push(O),!N)return}const a=e>>>28&15|(n&7)<<4,t=!!(n>>3);if(i.push((t?a|128:a)&255),!!t){for(let r=3;r<31;r=r+7){const o=n>>>r,N=!!(o>>>7),O=(N?o|128:o)&255;if(i.push(O),!N)return}i.push(n>>>31&1)}}const ae=4294967296;function Ce(e){const n=e[0]==="-";n&&(e=e.slice(1));const i=1e6;let a=0,t=0;function r(o,N){const O=Number(e.slice(o,N));t*=i,a=a*i+O,a>=ae&&(t=t+(a/ae|0),a=a%ae)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),n?yn(a,t):ce(a,t)}function vi(e,n){let i=ce(e,n);const a=i.hi&2147483648;a&&(i=yn(i.lo,i.hi));const t=Bn(i.lo,i.hi);return a?"-"+t:t}function Bn(e,n){if({lo:e,hi:n}=Vi(e,n),n<=2097151)return String(ae*n+e);const i=e&16777215,a=(e>>>24|n<<8)&16777215,t=n>>16&65535;let r=i+a*6777216+t*6710656,o=a+t*8147497,N=t*2;const O=1e7;return r>=O&&(o+=Math.floor(r/O),r%=O),o>=O&&(N+=Math.floor(o/O),o%=O),N.toString()+Fe(o)+Fe(r)}function Vi(e,n){return{lo:e>>>0,hi:n>>>0}}function ce(e,n){return{lo:e|0,hi:n|0}}function yn(e,n){return n=~n,e?e=~e+1:n+=1,ce(e,n)}const Fe=e=>{const n=String(e);return"0000000".slice(n.length)+n};function Me(e,n){if(e>=0){for(;e>127;)n.push(e&127|128),e=e>>>7;n.push(e)}else{for(let i=0;i<9;i++)n.push(e&127|128),e=e>>7;n.push(1)}}function Ui(){let e=this.buf[this.pos++],n=e&127;if(!(e&128))return this.assertBounds(),n;if(e=this.buf[this.pos++],n|=(e&127)<<7,!(e&128))return this.assertBounds(),n;if(e=this.buf[this.pos++],n|=(e&127)<<14,!(e&128))return this.assertBounds(),n;if(e=this.buf[this.pos++],n|=(e&127)<<21,!(e&128))return this.assertBounds(),n;e=this.buf[this.pos++],n|=(e&15)<<28;for(let i=5;e&128&&i<10;i++)e=this.buf[this.pos++];if(e&128)throw new Error("invalid varint");return this.assertBounds(),n>>>0}const M=Ji();function Ji(){const e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){const i=BigInt("-9223372036854775808"),a=BigInt("9223372036854775807"),t=BigInt("0"),r=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(o){const N=typeof o=="bigint"?o:BigInt(o);if(N>a||N<i)throw new Error(`invalid int64: ${o}`);return N},uParse(o){const N=typeof o=="bigint"?o:BigInt(o);if(N>r||N<t)throw new Error(`invalid uint64: ${o}`);return N},enc(o){return e.setBigInt64(0,this.parse(o),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(o){return e.setBigInt64(0,this.uParse(o),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(o,N){return e.setInt32(0,o,!0),e.setInt32(4,N,!0),e.getBigInt64(0,!0)},uDec(o,N){return e.setInt32(0,o,!0),e.setInt32(4,N,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),Le(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),Pe(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),Le(i),Ce(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),Pe(i),Ce(i)},dec(i,a){return vi(i,a)},uDec(i,a){return Bn(i,a)}}}function Le(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Pe(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}const fe=Symbol.for("@bufbuild/protobuf/text-encoding");function vn(){if(globalThis[fe]==null){const e=new globalThis.TextEncoder,n=new globalThis.TextDecoder;globalThis[fe]={encodeUtf8(i){return e.encode(i)},decodeUtf8(i){return n.decode(i)},checkUtf8(i){try{return encodeURIComponent(i),!0}catch{return!1}}}}return globalThis[fe]}var P;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(P||(P={}));const xi=34028234663852886e22,wi=-34028234663852886e22,Hi=4294967295,zi=2147483647,Qi=-2147483648;class d{constructor(n=vn().encodeUtf8){this.encodeUtf8=n,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let n=0;for(let t=0;t<this.chunks.length;t++)n+=this.chunks[t].length;let i=new Uint8Array(n),a=0;for(let t=0;t<this.chunks.length;t++)i.set(this.chunks[t],a),a+=this.chunks[t].length;return this.chunks=[],i}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let n=this.finish(),i=this.stack.pop();if(!i)throw new Error("invalid state, fork stack empty");return this.chunks=i.chunks,this.buf=i.buf,this.uint32(n.byteLength),this.raw(n)}tag(n,i){return this.uint32((n<<3|i)>>>0)}raw(n){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(n),this}uint32(n){for(ge(n);n>127;)this.buf.push(n&127|128),n=n>>>7;return this.buf.push(n),this}int32(n){return le(n),Me(n,this.buf),this}bool(n){return this.buf.push(n?1:0),this}bytes(n){return this.uint32(n.byteLength),this.raw(n)}string(n){let i=this.encodeUtf8(n);return this.uint32(i.byteLength),this.raw(i)}float(n){Xi(n);let i=new Uint8Array(4);return new DataView(i.buffer).setFloat32(0,n,!0),this.raw(i)}double(n){let i=new Uint8Array(8);return new DataView(i.buffer).setFloat64(0,n,!0),this.raw(i)}fixed32(n){ge(n);let i=new Uint8Array(4);return new DataView(i.buffer).setUint32(0,n,!0),this.raw(i)}sfixed32(n){le(n);let i=new Uint8Array(4);return new DataView(i.buffer).setInt32(0,n,!0),this.raw(i)}sint32(n){return le(n),n=(n<<1^n>>31)>>>0,Me(n,this.buf),this}sfixed64(n){let i=new Uint8Array(8),a=new DataView(i.buffer),t=M.enc(n);return a.setInt32(0,t.lo,!0),a.setInt32(4,t.hi,!0),this.raw(i)}fixed64(n){let i=new Uint8Array(8),a=new DataView(i.buffer),t=M.uEnc(n);return a.setInt32(0,t.lo,!0),a.setInt32(4,t.hi,!0),this.raw(i)}int64(n){let i=M.enc(n);return de(i.lo,i.hi,this.buf),this}sint64(n){let i=M.enc(n),a=i.hi>>31,t=i.lo<<1^a,r=(i.hi<<1|i.lo>>>31)^a;return de(t,r,this.buf),this}uint64(n){let i=M.uEnc(n);return de(i.lo,i.hi,this.buf),this}}class s{constructor(n,i=vn().decodeUtf8){this.decodeUtf8=i,this.varint64=yi,this.uint32=Ui,this.buf=n,this.len=n.length,this.pos=0,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength)}tag(){let n=this.uint32(),i=n>>>3,a=n&7;if(i<=0||a<0||a>5)throw new Error("illegal tag: field no "+i+" wire type "+a);return[i,a]}skip(n,i){let a=this.pos;switch(n){case P.Varint:for(;this.buf[this.pos++]&128;);break;case P.Bit64:this.pos+=4;case P.Bit32:this.pos+=4;break;case P.LengthDelimited:let t=this.uint32();this.pos+=t;break;case P.StartGroup:for(;;){const[r,o]=this.tag();if(o===P.EndGroup){if(i!==void 0&&r!==i)throw new Error("invalid end group tag");break}this.skip(o,r)}break;default:throw new Error("cant skip wire type "+n)}return this.assertBounds(),this.buf.subarray(a,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let n=this.uint32();return n>>>1^-(n&1)}int64(){return M.dec(...this.varint64())}uint64(){return M.uDec(...this.varint64())}sint64(){let[n,i]=this.varint64(),a=-(n&1);return n=(n>>>1|(i&1)<<31)^a,i=i>>>1^a,M.dec(n,i)}bool(){let[n,i]=this.varint64();return n!==0||i!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return M.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return M.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let n=this.uint32(),i=this.pos;return this.pos+=n,this.assertBounds(),this.buf.subarray(i,i+n)}string(){return this.decodeUtf8(this.bytes())}}function le(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>zi||e<Qi)throw new Error("invalid int32: "+e)}function ge(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>Hi||e<0)throw new Error("invalid uint32: "+e)}function Xi(e){if(typeof e=="string"){const n=e;if(e=Number(e),isNaN(e)&&n!=="NaN")throw new Error("invalid float32: "+n)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>xi||e<wi))throw new Error("invalid float32: "+e)}function be(){return{version:"",language:"",useHexNumericBase:!1,username:""}}const E={encode(e,n=new d){return e.version!==""&&n.uint32(10).string(e.version),e.language!==""&&n.uint32(18).string(e.language),e.useHexNumericBase!==!1&&n.uint32(24).bool(e.useHexNumericBase),e.username!==""&&n.uint32(34).string(e.username),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=be();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.version=i.string();continue}case 2:{if(r!==18)break;t.language=i.string();continue}case 3:{if(r!==24)break;t.useHexNumericBase=i.bool();continue}case 4:{if(r!==34)break;t.username=i.string();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{version:te(e.version)?globalThis.String(e.version):"",language:te(e.language)?globalThis.String(e.language):"",useHexNumericBase:te(e.useHexNumericBase)?globalThis.Boolean(e.useHexNumericBase):!1,username:te(e.username)?globalThis.String(e.username):""}},toJSON(e){const n={};return e.version!==""&&(n.version=e.version),e.language!==""&&(n.language=e.language),e.useHexNumericBase!==!1&&(n.useHexNumericBase=e.useHexNumericBase),e.username!==""&&(n.username=e.username),n},create(e){return E.fromPartial(e??{})},fromPartial(e){const n=be();return n.version=e.version??"",n.language=e.language??"",n.useHexNumericBase=e.useHexNumericBase??!1,n.username=e.username??"",n}};function te(e){return e!=null}var Vn=(e=>(e[e.CAN_CHANNEL_CAP_UNSPECIFIED=0]="CAN_CHANNEL_CAP_UNSPECIFIED",e[e.CAN_CHANNEL_CAP_EXTENDED_CAN=1]="CAN_CHANNEL_CAP_EXTENDED_CAN",e[e.CAN_CHANNEL_CAP_BUS_STATISTICS=2]="CAN_CHANNEL_CAP_BUS_STATISTICS",e[e.CAN_CHANNEL_CAP_ERROR_COUNTERS=3]="CAN_CHANNEL_CAP_ERROR_COUNTERS",e[e.CAN_CHANNEL_CAP_GENERATE_ERROR=4]="CAN_CHANNEL_CAP_GENERATE_ERROR",e[e.CAN_CHANNEL_CAP_GENERATE_OVERLOAD=5]="CAN_CHANNEL_CAP_GENERATE_OVERLOAD",e[e.CAN_CHANNEL_CAP_TXREQUEST=6]="CAN_CHANNEL_CAP_TXREQUEST",e[e.CAN_CHANNEL_CAP_TXACKNOWLEDGE=7]="CAN_CHANNEL_CAP_TXACKNOWLEDGE",e[e.CAN_CHANNEL_CAP_VIRTUAL=8]="CAN_CHANNEL_CAP_VIRTUAL",e[e.CAN_CHANNEL_CAP_SIMULATED=9]="CAN_CHANNEL_CAP_SIMULATED",e[e.CAN_CHANNEL_CAP_CAN_FD=10]="CAN_CHANNEL_CAP_CAN_FD",e[e.CAN_CHANNEL_CAP_CAN_FD_NONISO=11]="CAN_CHANNEL_CAP_CAN_FD_NONISO",e[e.CAN_CHANNEL_CAP_SILENT_MODE=12]="CAN_CHANNEL_CAP_SILENT_MODE",e[e.CAN_CHANNEL_CAP_SINGLE_SHOT=13]="CAN_CHANNEL_CAP_SINGLE_SHOT",e[e.CAN_CHANNEL_CAP_LOGGER=14]="CAN_CHANNEL_CAP_LOGGER",e[e.CAN_CHANNEL_CAP_REMOTE_ACCESS=15]="CAN_CHANNEL_CAP_REMOTE_ACCESS",e[e.CAN_CHANNEL_CAP_SCRIPT=16]="CAN_CHANNEL_CAP_SCRIPT",e[e.CAN_CHANNEL_CAP_LIN_HYBRID=17]="CAN_CHANNEL_CAP_LIN_HYBRID",e[e.CAN_CHANNEL_CAP_IO_API=18]="CAN_CHANNEL_CAP_IO_API",e[e.CAN_CHANNEL_CAP_CANTEGRITY=19]="CAN_CHANNEL_CAP_CANTEGRITY",e[e.CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ=20]="CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Vn||{});function Un(e){switch(e){case 0:case"CAN_CHANNEL_CAP_UNSPECIFIED":return 0;case 1:case"CAN_CHANNEL_CAP_EXTENDED_CAN":return 1;case 2:case"CAN_CHANNEL_CAP_BUS_STATISTICS":return 2;case 3:case"CAN_CHANNEL_CAP_ERROR_COUNTERS":return 3;case 4:case"CAN_CHANNEL_CAP_GENERATE_ERROR":return 4;case 5:case"CAN_CHANNEL_CAP_GENERATE_OVERLOAD":return 5;case 6:case"CAN_CHANNEL_CAP_TXREQUEST":return 6;case 7:case"CAN_CHANNEL_CAP_TXACKNOWLEDGE":return 7;case 8:case"CAN_CHANNEL_CAP_VIRTUAL":return 8;case 9:case"CAN_CHANNEL_CAP_SIMULATED":return 9;case 10:case"CAN_CHANNEL_CAP_CAN_FD":return 10;case 11:case"CAN_CHANNEL_CAP_CAN_FD_NONISO":return 11;case 12:case"CAN_CHANNEL_CAP_SILENT_MODE":return 12;case 13:case"CAN_CHANNEL_CAP_SINGLE_SHOT":return 13;case 14:case"CAN_CHANNEL_CAP_LOGGER":return 14;case 15:case"CAN_CHANNEL_CAP_REMOTE_ACCESS":return 15;case 16:case"CAN_CHANNEL_CAP_SCRIPT":return 16;case 17:case"CAN_CHANNEL_CAP_LIN_HYBRID":return 17;case 18:case"CAN_CHANNEL_CAP_IO_API":return 18;case 19:case"CAN_CHANNEL_CAP_CANTEGRITY":return 19;case 20:case"CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ":return 20;case-1:case"UNRECOGNIZED":default:return-1}}function Jn(e){switch(e){case 0:return"CAN_CHANNEL_CAP_UNSPECIFIED";case 1:return"CAN_CHANNEL_CAP_EXTENDED_CAN";case 2:return"CAN_CHANNEL_CAP_BUS_STATISTICS";case 3:return"CAN_CHANNEL_CAP_ERROR_COUNTERS";case 4:return"CAN_CHANNEL_CAP_GENERATE_ERROR";case 5:return"CAN_CHANNEL_CAP_GENERATE_OVERLOAD";case 6:return"CAN_CHANNEL_CAP_TXREQUEST";case 7:return"CAN_CHANNEL_CAP_TXACKNOWLEDGE";case 8:return"CAN_CHANNEL_CAP_VIRTUAL";case 9:return"CAN_CHANNEL_CAP_SIMULATED";case 10:return"CAN_CHANNEL_CAP_CAN_FD";case 11:return"CAN_CHANNEL_CAP_CAN_FD_NONISO";case 12:return"CAN_CHANNEL_CAP_SILENT_MODE";case 13:return"CAN_CHANNEL_CAP_SINGLE_SHOT";case 14:return"CAN_CHANNEL_CAP_LOGGER";case 15:return"CAN_CHANNEL_CAP_REMOTE_ACCESS";case 16:return"CAN_CHANNEL_CAP_SCRIPT";case 17:return"CAN_CHANNEL_CAP_LIN_HYBRID";case 18:return"CAN_CHANNEL_CAP_IO_API";case 19:return"CAN_CHANNEL_CAP_CANTEGRITY";case 20:return"CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ";case-1:default:return"UNRECOGNIZED"}}var xn=(e=>(e[e.PROTOCOLS_UNSPECIFIED=0]="PROTOCOLS_UNSPECIFIED",e[e.PROTOCOLS_CAN=1]="PROTOCOLS_CAN",e[e.PROTOCOLS_LIN=2]="PROTOCOLS_LIN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(xn||{});function Ne(e){switch(e){case 0:case"PROTOCOLS_UNSPECIFIED":return 0;case 1:case"PROTOCOLS_CAN":return 1;case 2:case"PROTOCOLS_LIN":return 2;case-1:case"UNRECOGNIZED":default:return-1}}function _e(e){switch(e){case 0:return"PROTOCOLS_UNSPECIFIED";case 1:return"PROTOCOLS_CAN";case 2:return"PROTOCOLS_LIN";case-1:default:return"UNRECOGNIZED"}}var wn=(e=>(e[e.DEVICE_EVENT_UNSPECIFIED=0]="DEVICE_EVENT_UNSPECIFIED",e[e.DEVICE_EVENT_DEVICES_CHANGED=1]="DEVICE_EVENT_DEVICES_CHANGED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(wn||{});function Hn(e){switch(e){case 0:case"DEVICE_EVENT_UNSPECIFIED":return 0;case 1:case"DEVICE_EVENT_DEVICES_CHANGED":return 1;case-1:case"UNRECOGNIZED":default:return-1}}function zn(e){switch(e){case 0:return"DEVICE_EVENT_UNSPECIFIED";case 1:return"DEVICE_EVENT_DEVICES_CHANGED";case-1:default:return"UNRECOGNIZED"}}function Ge(){return{tq:0,phase1:0,phase2:0,sjw:0,prop:0,prescaler:0}}const l={encode(e,n=new d){return e.tq!==0&&n.uint32(8).int32(e.tq),e.phase1!==0&&n.uint32(16).int32(e.phase1),e.phase2!==0&&n.uint32(24).int32(e.phase2),e.sjw!==0&&n.uint32(32).int32(e.sjw),e.prop!==0&&n.uint32(40).int32(e.prop),e.prescaler!==0&&n.uint32(48).int32(e.prescaler),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Ge();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==8)break;t.tq=i.int32();continue}case 2:{if(r!==16)break;t.phase1=i.int32();continue}case 3:{if(r!==24)break;t.phase2=i.int32();continue}case 4:{if(r!==32)break;t.sjw=i.int32();continue}case 5:{if(r!==40)break;t.prop=i.int32();continue}case 6:{if(r!==48)break;t.prescaler=i.int32();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{tq:f(e.tq)?globalThis.Number(e.tq):0,phase1:f(e.phase1)?globalThis.Number(e.phase1):0,phase2:f(e.phase2)?globalThis.Number(e.phase2):0,sjw:f(e.sjw)?globalThis.Number(e.sjw):0,prop:f(e.prop)?globalThis.Number(e.prop):0,prescaler:f(e.prescaler)?globalThis.Number(e.prescaler):0}},toJSON(e){const n={};return e.tq!==0&&(n.tq=Math.round(e.tq)),e.phase1!==0&&(n.phase1=Math.round(e.phase1)),e.phase2!==0&&(n.phase2=Math.round(e.phase2)),e.sjw!==0&&(n.sjw=Math.round(e.sjw)),e.prop!==0&&(n.prop=Math.round(e.prop)),e.prescaler!==0&&(n.prescaler=Math.round(e.prescaler)),n},create(e){return l.fromPartial(e??{})},fromPartial(e){const n=Ge();return n.tq=e.tq??0,n.phase1=e.phase1??0,n.phase2=e.phase2??0,n.sjw=e.sjw??0,n.prop=e.prop??0,n.prescaler=e.prescaler??0,n}};function De(){return{arbitrationMin:void 0,arbitrationMax:void 0,dataMin:void 0,dataMax:void 0,isValid:!1}}const g={encode(e,n=new d){return e.arbitrationMin!==void 0&&l.encode(e.arbitrationMin,n.uint32(10).fork()).join(),e.arbitrationMax!==void 0&&l.encode(e.arbitrationMax,n.uint32(18).fork()).join(),e.dataMin!==void 0&&l.encode(e.dataMin,n.uint32(26).fork()).join(),e.dataMax!==void 0&&l.encode(e.dataMax,n.uint32(34).fork()).join(),e.isValid!==!1&&n.uint32(40).bool(e.isValid),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=De();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.arbitrationMin=l.decode(i,i.uint32());continue}case 2:{if(r!==18)break;t.arbitrationMax=l.decode(i,i.uint32());continue}case 3:{if(r!==26)break;t.dataMin=l.decode(i,i.uint32());continue}case 4:{if(r!==34)break;t.dataMax=l.decode(i,i.uint32());continue}case 5:{if(r!==40)break;t.isValid=i.bool();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{arbitrationMin:f(e.arbitrationMin)?l.fromJSON(e.arbitrationMin):void 0,arbitrationMax:f(e.arbitrationMax)?l.fromJSON(e.arbitrationMax):void 0,dataMin:f(e.dataMin)?l.fromJSON(e.dataMin):void 0,dataMax:f(e.dataMax)?l.fromJSON(e.dataMax):void 0,isValid:f(e.isValid)?globalThis.Boolean(e.isValid):!1}},toJSON(e){const n={};return e.arbitrationMin!==void 0&&(n.arbitrationMin=l.toJSON(e.arbitrationMin)),e.arbitrationMax!==void 0&&(n.arbitrationMax=l.toJSON(e.arbitrationMax)),e.dataMin!==void 0&&(n.dataMin=l.toJSON(e.dataMin)),e.dataMax!==void 0&&(n.dataMax=l.toJSON(e.dataMax)),e.isValid!==!1&&(n.isValid=e.isValid),n},create(e){return g.fromPartial(e??{})},fromPartial(e){const n=De();return n.arbitrationMin=e.arbitrationMin!==void 0&&e.arbitrationMin!==null?l.fromPartial(e.arbitrationMin):void 0,n.arbitrationMax=e.arbitrationMax!==void 0&&e.arbitrationMax!==null?l.fromPartial(e.arbitrationMax):void 0,n.dataMin=e.dataMin!==void 0&&e.dataMin!==null?l.fromPartial(e.dataMin):void 0,n.dataMax=e.dataMax!==void 0&&e.dataMax!==null?l.fromPartial(e.dataMax):void 0,n.isValid=e.isValid??!1,n}};function ke(){return{bitRate:0,actualBitRate:0,bitRateError:0,samplePoint:0,description:"",busParams:void 0}}const m={encode(e,n=new d){return e.bitRate!==0&&n.uint32(8).int32(e.bitRate),e.actualBitRate!==0&&n.uint32(16).int32(e.actualBitRate),e.bitRateError!==0&&n.uint32(25).double(e.bitRateError),e.samplePoint!==0&&n.uint32(33).double(e.samplePoint),e.description!==""&&n.uint32(42).string(e.description),e.busParams!==void 0&&l.encode(e.busParams,n.uint32(50).fork()).join(),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=ke();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==8)break;t.bitRate=i.int32();continue}case 2:{if(r!==16)break;t.actualBitRate=i.int32();continue}case 3:{if(r!==25)break;t.bitRateError=i.double();continue}case 4:{if(r!==33)break;t.samplePoint=i.double();continue}case 5:{if(r!==42)break;t.description=i.string();continue}case 6:{if(r!==50)break;t.busParams=l.decode(i,i.uint32());continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{bitRate:f(e.bitRate)?globalThis.Number(e.bitRate):0,actualBitRate:f(e.actualBitRate)?globalThis.Number(e.actualBitRate):0,bitRateError:f(e.bitRateError)?globalThis.Number(e.bitRateError):0,samplePoint:f(e.samplePoint)?globalThis.Number(e.samplePoint):0,description:f(e.description)?globalThis.String(e.description):"",busParams:f(e.busParams)?l.fromJSON(e.busParams):void 0}},toJSON(e){const n={};return e.bitRate!==0&&(n.bitRate=Math.round(e.bitRate)),e.actualBitRate!==0&&(n.actualBitRate=Math.round(e.actualBitRate)),e.bitRateError!==0&&(n.bitRateError=e.bitRateError),e.samplePoint!==0&&(n.samplePoint=e.samplePoint),e.description!==""&&(n.description=e.description),e.busParams!==void 0&&(n.busParams=l.toJSON(e.busParams)),n},create(e){return m.fromPartial(e??{})},fromPartial(e){const n=ke();return n.bitRate=e.bitRate??0,n.actualBitRate=e.actualBitRate??0,n.bitRateError=e.bitRateError??0,n.samplePoint=e.samplePoint??0,n.description=e.description??"",n.busParams=e.busParams!==void 0&&e.busParams!==null?l.fromPartial(e.busParams):void 0,n}};function Be(){return{bitRate:0,samplePoint:0,description:"",busParams:void 0}}const T={encode(e,n=new d){return e.bitRate!==0&&n.uint32(8).int32(e.bitRate),e.samplePoint!==0&&n.uint32(17).double(e.samplePoint),e.description!==""&&n.uint32(26).string(e.description),e.busParams!==void 0&&l.encode(e.busParams,n.uint32(34).fork()).join(),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Be();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==8)break;t.bitRate=i.int32();continue}case 2:{if(r!==17)break;t.samplePoint=i.double();continue}case 3:{if(r!==26)break;t.description=i.string();continue}case 4:{if(r!==34)break;t.busParams=l.decode(i,i.uint32());continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{bitRate:f(e.bitRate)?globalThis.Number(e.bitRate):0,samplePoint:f(e.samplePoint)?globalThis.Number(e.samplePoint):0,description:f(e.description)?globalThis.String(e.description):"",busParams:f(e.busParams)?l.fromJSON(e.busParams):void 0}},toJSON(e){const n={};return e.bitRate!==0&&(n.bitRate=Math.round(e.bitRate)),e.samplePoint!==0&&(n.samplePoint=e.samplePoint),e.description!==""&&(n.description=e.description),e.busParams!==void 0&&(n.busParams=l.toJSON(e.busParams)),n},create(e){return T.fromPartial(e??{})},fromPartial(e){const n=Be();return n.bitRate=e.bitRate??0,n.samplePoint=e.samplePoint??0,n.description=e.description??"",n.busParams=e.busParams!==void 0&&e.busParams!==null?l.fromPartial(e.busParams):void 0,n}};function ye(){return{arbitrationBusSpeed:void 0,dataBusSpeeds:[]}}const h={encode(e,n=new d){e.arbitrationBusSpeed!==void 0&&T.encode(e.arbitrationBusSpeed,n.uint32(10).fork()).join();for(const i of e.dataBusSpeeds)T.encode(i,n.uint32(18).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=ye();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.arbitrationBusSpeed=T.decode(i,i.uint32());continue}case 2:{if(r!==18)break;t.dataBusSpeeds.push(T.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{arbitrationBusSpeed:f(e.arbitrationBusSpeed)?T.fromJSON(e.arbitrationBusSpeed):void 0,dataBusSpeeds:globalThis.Array.isArray(e==null?void 0:e.dataBusSpeeds)?e.dataBusSpeeds.map(n=>T.fromJSON(n)):[]}},toJSON(e){var i;const n={};return e.arbitrationBusSpeed!==void 0&&(n.arbitrationBusSpeed=T.toJSON(e.arbitrationBusSpeed)),(i=e.dataBusSpeeds)!=null&&i.length&&(n.dataBusSpeeds=e.dataBusSpeeds.map(a=>T.toJSON(a))),n},create(e){return h.fromPartial(e??{})},fromPartial(e){var i;const n=ye();return n.arbitrationBusSpeed=e.arbitrationBusSpeed!==void 0&&e.arbitrationBusSpeed!==null?T.fromPartial(e.arbitrationBusSpeed):void 0,n.dataBusSpeeds=((i=e.dataBusSpeeds)==null?void 0:i.map(a=>T.fromPartial(a)))||[],n}};function ve(){return{busParamLimits:void 0,channelCaps:[],maxBitRate:0,clockFrequency:0}}const b={encode(e,n=new d){e.busParamLimits!==void 0&&g.encode(e.busParamLimits,n.uint32(10).fork()).join(),n.uint32(18).fork();for(const i of e.channelCaps)n.int32(i);return n.join(),e.maxBitRate!==0&&n.uint32(24).int32(e.maxBitRate),e.clockFrequency!==0&&n.uint32(33).double(e.clockFrequency),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=ve();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.busParamLimits=g.decode(i,i.uint32());continue}case 2:{if(r===16){t.channelCaps.push(i.int32());continue}if(r===18){const o=i.uint32()+i.pos;for(;i.pos<o;)t.channelCaps.push(i.int32());continue}break}case 3:{if(r!==24)break;t.maxBitRate=i.int32();continue}case 4:{if(r!==33)break;t.clockFrequency=i.double();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{busParamLimits:f(e.busParamLimits)?g.fromJSON(e.busParamLimits):void 0,channelCaps:globalThis.Array.isArray(e==null?void 0:e.channelCaps)?e.channelCaps.map(n=>Un(n)):[],maxBitRate:f(e.maxBitRate)?globalThis.Number(e.maxBitRate):0,clockFrequency:f(e.clockFrequency)?globalThis.Number(e.clockFrequency):0}},toJSON(e){var i;const n={};return e.busParamLimits!==void 0&&(n.busParamLimits=g.toJSON(e.busParamLimits)),(i=e.channelCaps)!=null&&i.length&&(n.channelCaps=e.channelCaps.map(a=>Jn(a))),e.maxBitRate!==0&&(n.maxBitRate=Math.round(e.maxBitRate)),e.clockFrequency!==0&&(n.clockFrequency=e.clockFrequency),n},create(e){return b.fromPartial(e??{})},fromPartial(e){var i;const n=ve();return n.busParamLimits=e.busParamLimits!==void 0&&e.busParamLimits!==null?g.fromPartial(e.busParamLimits):void 0,n.channelCaps=((i=e.channelCaps)==null?void 0:i.map(a=>a))||[],n.maxBitRate=e.maxBitRate??0,n.clockFrequency=e.clockFrequency??0,n}};function Ve(){return{channelNumber:0,channelNumberOnDevice:0,name:"",protocols:[],canChannelCapacity:void 0}}const G={encode(e,n=new d){e.channelNumber!==0&&n.uint32(8).int32(e.channelNumber),e.channelNumberOnDevice!==0&&n.uint32(16).int32(e.channelNumberOnDevice),e.name!==""&&n.uint32(26).string(e.name),n.uint32(34).fork();for(const i of e.protocols)n.int32(i);return n.join(),e.canChannelCapacity!==void 0&&b.encode(e.canChannelCapacity,n.uint32(42).fork()).join(),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Ve();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==8)break;t.channelNumber=i.int32();continue}case 2:{if(r!==16)break;t.channelNumberOnDevice=i.int32();continue}case 3:{if(r!==26)break;t.name=i.string();continue}case 4:{if(r===32){t.protocols.push(i.int32());continue}if(r===34){const o=i.uint32()+i.pos;for(;i.pos<o;)t.protocols.push(i.int32());continue}break}case 5:{if(r!==42)break;t.canChannelCapacity=b.decode(i,i.uint32());continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{channelNumber:f(e.channelNumber)?globalThis.Number(e.channelNumber):0,channelNumberOnDevice:f(e.channelNumberOnDevice)?globalThis.Number(e.channelNumberOnDevice):0,name:f(e.name)?globalThis.String(e.name):"",protocols:globalThis.Array.isArray(e==null?void 0:e.protocols)?e.protocols.map(n=>Ne(n)):[],canChannelCapacity:f(e.canChannelCapacity)?b.fromJSON(e.canChannelCapacity):void 0}},toJSON(e){var i;const n={};return e.channelNumber!==0&&(n.channelNumber=Math.round(e.channelNumber)),e.channelNumberOnDevice!==0&&(n.channelNumberOnDevice=Math.round(e.channelNumberOnDevice)),e.name!==""&&(n.name=e.name),(i=e.protocols)!=null&&i.length&&(n.protocols=e.protocols.map(a=>_e(a))),e.canChannelCapacity!==void 0&&(n.canChannelCapacity=b.toJSON(e.canChannelCapacity)),n},create(e){return G.fromPartial(e??{})},fromPartial(e){var i;const n=Ve();return n.channelNumber=e.channelNumber??0,n.channelNumberOnDevice=e.channelNumberOnDevice??0,n.name=e.name??"",n.protocols=((i=e.protocols)==null?void 0:i.map(a=>a))||[],n.canChannelCapacity=e.canChannelCapacity!==void 0&&e.canChannelCapacity!==null?b.fromPartial(e.canChannelCapacity):void 0,n}};function Ue(){return{cardType:0,cardNumber:0,productCode:"",serialNumber:"",name:"",protocols:[],channels:[]}}const p={encode(e,n=new d){e.cardType!==0&&n.uint32(8).int32(e.cardType),e.cardNumber!==0&&n.uint32(16).int32(e.cardNumber),e.productCode!==""&&n.uint32(26).string(e.productCode),e.serialNumber!==""&&n.uint32(34).string(e.serialNumber),e.name!==""&&n.uint32(42).string(e.name),n.uint32(50).fork();for(const i of e.protocols)n.int32(i);n.join();for(const i of e.channels)G.encode(i,n.uint32(58).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Ue();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==8)break;t.cardType=i.int32();continue}case 2:{if(r!==16)break;t.cardNumber=i.int32();continue}case 3:{if(r!==26)break;t.productCode=i.string();continue}case 4:{if(r!==34)break;t.serialNumber=i.string();continue}case 5:{if(r!==42)break;t.name=i.string();continue}case 6:{if(r===48){t.protocols.push(i.int32());continue}if(r===50){const o=i.uint32()+i.pos;for(;i.pos<o;)t.protocols.push(i.int32());continue}break}case 7:{if(r!==58)break;t.channels.push(G.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{cardType:f(e.cardType)?globalThis.Number(e.cardType):0,cardNumber:f(e.cardNumber)?globalThis.Number(e.cardNumber):0,productCode:f(e.productCode)?globalThis.String(e.productCode):"",serialNumber:f(e.serialNumber)?globalThis.String(e.serialNumber):"",name:f(e.name)?globalThis.String(e.name):"",protocols:globalThis.Array.isArray(e==null?void 0:e.protocols)?e.protocols.map(n=>Ne(n)):[],channels:globalThis.Array.isArray(e==null?void 0:e.channels)?e.channels.map(n=>G.fromJSON(n)):[]}},toJSON(e){var i,a;const n={};return e.cardType!==0&&(n.cardType=Math.round(e.cardType)),e.cardNumber!==0&&(n.cardNumber=Math.round(e.cardNumber)),e.productCode!==""&&(n.productCode=e.productCode),e.serialNumber!==""&&(n.serialNumber=e.serialNumber),e.name!==""&&(n.name=e.name),(i=e.protocols)!=null&&i.length&&(n.protocols=e.protocols.map(t=>_e(t))),(a=e.channels)!=null&&a.length&&(n.channels=e.channels.map(t=>G.toJSON(t))),n},create(e){return p.fromPartial(e??{})},fromPartial(e){var i,a;const n=Ue();return n.cardType=e.cardType??0,n.cardNumber=e.cardNumber??0,n.productCode=e.productCode??"",n.serialNumber=e.serialNumber??"",n.name=e.name??"",n.protocols=((i=e.protocols)==null?void 0:i.map(t=>t))||[],n.channels=((a=e.channels)==null?void 0:a.map(t=>G.fromPartial(t)))||[],n}};function Je(){return{items:[]}}const D={encode(e,n=new d){for(const i of e.items)p.encode(i,n.uint32(10).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Je();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.items.push(p.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{items:globalThis.Array.isArray(e==null?void 0:e.items)?e.items.map(n=>p.fromJSON(n)):[]}},toJSON(e){var i;const n={};return(i=e.items)!=null&&i.length&&(n.items=e.items.map(a=>p.toJSON(a))),n},create(e){return D.fromPartial(e??{})},fromPartial(e){var i;const n=Je();return n.items=((i=e.items)==null?void 0:i.map(a=>p.fromPartial(a)))||[],n}};function xe(){return{preferences:void 0,includeVirtual:!1}}const Qn={encode(e,n=new d){return e.preferences!==void 0&&E.encode(e.preferences,n.uint32(10).fork()).join(),e.includeVirtual!==!1&&n.uint32(16).bool(e.includeVirtual),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=xe();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.preferences=E.decode(i,i.uint32());continue}case 2:{if(r!==16)break;t.includeVirtual=i.bool();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{preferences:f(e.preferences)?E.fromJSON(e.preferences):void 0,includeVirtual:f(e.includeVirtual)?globalThis.Boolean(e.includeVirtual):!1}},toJSON(e){const n={};return e.preferences!==void 0&&(n.preferences=E.toJSON(e.preferences)),e.includeVirtual!==!1&&(n.includeVirtual=e.includeVirtual),n},create(e){return Qn.fromPartial(e??{})},fromPartial(e){const n=xe();return n.preferences=e.preferences!==void 0&&e.preferences!==null?E.fromPartial(e.preferences):void 0,n.includeVirtual=e.includeVirtual??!1,n}};function we(){return{devices:[]}}const Xn={encode(e,n=new d){for(const i of e.devices)p.encode(i,n.uint32(10).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=we();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.devices.push(p.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{devices:globalThis.Array.isArray(e==null?void 0:e.devices)?e.devices.map(n=>p.fromJSON(n)):[]}},toJSON(e){var i;const n={};return(i=e.devices)!=null&&i.length&&(n.devices=e.devices.map(a=>p.toJSON(a))),n},create(e){return Xn.fromPartial(e??{})},fromPartial(e){var i;const n=we();return n.devices=((i=e.devices)==null?void 0:i.map(a=>p.fromPartial(a)))||[],n}};function He(){return{preferences:void 0,channelNumber:0,bitRate:void 0,bitRateArbitrationPhase:void 0,bitRateDataPhase:void 0}}const qn={encode(e,n=new d){return e.preferences!==void 0&&E.encode(e.preferences,n.uint32(10).fork()).join(),e.channelNumber!==0&&n.uint32(16).int32(e.channelNumber),e.bitRate!==void 0&&n.uint32(24).int32(e.bitRate),e.bitRateArbitrationPhase!==void 0&&n.uint32(32).int32(e.bitRateArbitrationPhase),e.bitRateDataPhase!==void 0&&n.uint32(40).int32(e.bitRateDataPhase),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=He();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.preferences=E.decode(i,i.uint32());continue}case 2:{if(r!==16)break;t.channelNumber=i.int32();continue}case 3:{if(r!==24)break;t.bitRate=i.int32();continue}case 4:{if(r!==32)break;t.bitRateArbitrationPhase=i.int32();continue}case 5:{if(r!==40)break;t.bitRateDataPhase=i.int32();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{preferences:f(e.preferences)?E.fromJSON(e.preferences):void 0,channelNumber:f(e.channelNumber)?globalThis.Number(e.channelNumber):0,bitRate:f(e.bitRate)?globalThis.Number(e.bitRate):void 0,bitRateArbitrationPhase:f(e.bitRateArbitrationPhase)?globalThis.Number(e.bitRateArbitrationPhase):void 0,bitRateDataPhase:f(e.bitRateDataPhase)?globalThis.Number(e.bitRateDataPhase):void 0}},toJSON(e){const n={};return e.preferences!==void 0&&(n.preferences=E.toJSON(e.preferences)),e.channelNumber!==0&&(n.channelNumber=Math.round(e.channelNumber)),e.bitRate!==void 0&&(n.bitRate=Math.round(e.bitRate)),e.bitRateArbitrationPhase!==void 0&&(n.bitRateArbitrationPhase=Math.round(e.bitRateArbitrationPhase)),e.bitRateDataPhase!==void 0&&(n.bitRateDataPhase=Math.round(e.bitRateDataPhase)),n},create(e){return qn.fromPartial(e??{})},fromPartial(e){const n=He();return n.preferences=e.preferences!==void 0&&e.preferences!==null?E.fromPartial(e.preferences):void 0,n.channelNumber=e.channelNumber??0,n.bitRate=e.bitRate??void 0,n.bitRateArbitrationPhase=e.bitRateArbitrationPhase??void 0,n.bitRateDataPhase=e.bitRateDataPhase??void 0,n}};function ze(){return{availableBusSpeeds:[],availableBusSpeedsFd:[]}}const Zn={encode(e,n=new d){for(const i of e.availableBusSpeeds)m.encode(i,n.uint32(10).fork()).join();for(const i of e.availableBusSpeedsFd)h.encode(i,n.uint32(18).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=ze();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.availableBusSpeeds.push(m.decode(i,i.uint32()));continue}case 2:{if(r!==18)break;t.availableBusSpeedsFd.push(h.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{availableBusSpeeds:globalThis.Array.isArray(e==null?void 0:e.availableBusSpeeds)?e.availableBusSpeeds.map(n=>m.fromJSON(n)):[],availableBusSpeedsFd:globalThis.Array.isArray(e==null?void 0:e.availableBusSpeedsFd)?e.availableBusSpeedsFd.map(n=>h.fromJSON(n)):[]}},toJSON(e){var i,a;const n={};return(i=e.availableBusSpeeds)!=null&&i.length&&(n.availableBusSpeeds=e.availableBusSpeeds.map(t=>m.toJSON(t))),(a=e.availableBusSpeedsFd)!=null&&a.length&&(n.availableBusSpeedsFd=e.availableBusSpeedsFd.map(t=>h.toJSON(t))),n},create(e){return Zn.fromPartial(e??{})},fromPartial(e){var i,a;const n=ze();return n.availableBusSpeeds=((i=e.availableBusSpeeds)==null?void 0:i.map(t=>m.fromPartial(t)))||[],n.availableBusSpeedsFd=((a=e.availableBusSpeedsFd)==null?void 0:a.map(t=>h.fromPartial(t)))||[],n}};function Qe(){return{preferences:void 0,channelNumber:0,bitRates:[]}}const Yn={encode(e,n=new d){e.preferences!==void 0&&E.encode(e.preferences,n.uint32(10).fork()).join(),e.channelNumber!==0&&n.uint32(16).int32(e.channelNumber),n.uint32(26).fork();for(const i of e.bitRates)n.int32(i);return n.join(),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Qe();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.preferences=E.decode(i,i.uint32());continue}case 2:{if(r!==16)break;t.channelNumber=i.int32();continue}case 3:{if(r===24){t.bitRates.push(i.int32());continue}if(r===26){const o=i.uint32()+i.pos;for(;i.pos<o;)t.bitRates.push(i.int32());continue}break}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{preferences:f(e.preferences)?E.fromJSON(e.preferences):void 0,channelNumber:f(e.channelNumber)?globalThis.Number(e.channelNumber):0,bitRates:globalThis.Array.isArray(e==null?void 0:e.bitRates)?e.bitRates.map(n=>globalThis.Number(n)):[]}},toJSON(e){var i;const n={};return e.preferences!==void 0&&(n.preferences=E.toJSON(e.preferences)),e.channelNumber!==0&&(n.channelNumber=Math.round(e.channelNumber)),(i=e.bitRates)!=null&&i.length&&(n.bitRates=e.bitRates.map(a=>Math.round(a))),n},create(e){return Yn.fromPartial(e??{})},fromPartial(e){var i;const n=Qe();return n.preferences=e.preferences!==void 0&&e.preferences!==null?E.fromPartial(e.preferences):void 0,n.channelNumber=e.channelNumber??0,n.bitRates=((i=e.bitRates)==null?void 0:i.map(a=>a))||[],n}};function Xe(){return{availableBusSpeeds:[]}}const Kn={encode(e,n=new d){for(const i of e.availableBusSpeeds)m.encode(i,n.uint32(10).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Xe();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.availableBusSpeeds.push(m.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{availableBusSpeeds:globalThis.Array.isArray(e==null?void 0:e.availableBusSpeeds)?e.availableBusSpeeds.map(n=>m.fromJSON(n)):[]}},toJSON(e){var i;const n={};return(i=e.availableBusSpeeds)!=null&&i.length&&(n.availableBusSpeeds=e.availableBusSpeeds.map(a=>m.toJSON(a))),n},create(e){return Kn.fromPartial(e??{})},fromPartial(e){var i;const n=Xe();return n.availableBusSpeeds=((i=e.availableBusSpeeds)==null?void 0:i.map(a=>m.fromPartial(a)))||[],n}};function qe(){return{preferences:void 0,channelNumber:0,bitRatesArbitrationPhase:[],bitRatesDataPhase:[]}}const Wn={encode(e,n=new d){e.preferences!==void 0&&E.encode(e.preferences,n.uint32(10).fork()).join(),e.channelNumber!==0&&n.uint32(16).int32(e.channelNumber),n.uint32(26).fork();for(const i of e.bitRatesArbitrationPhase)n.int32(i);n.join(),n.uint32(34).fork();for(const i of e.bitRatesDataPhase)n.int32(i);return n.join(),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=qe();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.preferences=E.decode(i,i.uint32());continue}case 2:{if(r!==16)break;t.channelNumber=i.int32();continue}case 3:{if(r===24){t.bitRatesArbitrationPhase.push(i.int32());continue}if(r===26){const o=i.uint32()+i.pos;for(;i.pos<o;)t.bitRatesArbitrationPhase.push(i.int32());continue}break}case 4:{if(r===32){t.bitRatesDataPhase.push(i.int32());continue}if(r===34){const o=i.uint32()+i.pos;for(;i.pos<o;)t.bitRatesDataPhase.push(i.int32());continue}break}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{preferences:f(e.preferences)?E.fromJSON(e.preferences):void 0,channelNumber:f(e.channelNumber)?globalThis.Number(e.channelNumber):0,bitRatesArbitrationPhase:globalThis.Array.isArray(e==null?void 0:e.bitRatesArbitrationPhase)?e.bitRatesArbitrationPhase.map(n=>globalThis.Number(n)):[],bitRatesDataPhase:globalThis.Array.isArray(e==null?void 0:e.bitRatesDataPhase)?e.bitRatesDataPhase.map(n=>globalThis.Number(n)):[]}},toJSON(e){var i,a;const n={};return e.preferences!==void 0&&(n.preferences=E.toJSON(e.preferences)),e.channelNumber!==0&&(n.channelNumber=Math.round(e.channelNumber)),(i=e.bitRatesArbitrationPhase)!=null&&i.length&&(n.bitRatesArbitrationPhase=e.bitRatesArbitrationPhase.map(t=>Math.round(t))),(a=e.bitRatesDataPhase)!=null&&a.length&&(n.bitRatesDataPhase=e.bitRatesDataPhase.map(t=>Math.round(t))),n},create(e){return Wn.fromPartial(e??{})},fromPartial(e){var i,a;const n=qe();return n.preferences=e.preferences!==void 0&&e.preferences!==null?E.fromPartial(e.preferences):void 0,n.channelNumber=e.channelNumber??0,n.bitRatesArbitrationPhase=((i=e.bitRatesArbitrationPhase)==null?void 0:i.map(t=>t))||[],n.bitRatesDataPhase=((a=e.bitRatesDataPhase)==null?void 0:a.map(t=>t))||[],n}};function Ze(){return{availableBusSpeedsFd:[]}}const $n={encode(e,n=new d){for(const i of e.availableBusSpeedsFd)h.encode(i,n.uint32(10).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Ze();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.availableBusSpeedsFd.push(h.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{availableBusSpeedsFd:globalThis.Array.isArray(e==null?void 0:e.availableBusSpeedsFd)?e.availableBusSpeedsFd.map(n=>h.fromJSON(n)):[]}},toJSON(e){var i;const n={};return(i=e.availableBusSpeedsFd)!=null&&i.length&&(n.availableBusSpeedsFd=e.availableBusSpeedsFd.map(a=>h.toJSON(a))),n},create(e){return $n.fromPartial(e??{})},fromPartial(e){var i;const n=Ze();return n.availableBusSpeedsFd=((i=e.availableBusSpeedsFd)==null?void 0:i.map(a=>h.fromPartial(a)))||[],n}};function Ye(){return{eventType:0,devices:void 0}}const jn={encode(e,n=new d){return e.eventType!==0&&n.uint32(8).int32(e.eventType),e.devices!==void 0&&D.encode(e.devices,n.uint32(18).fork()).join(),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Ye();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==8)break;t.eventType=i.int32();continue}case 2:{if(r!==18)break;t.devices=D.decode(i,i.uint32());continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{eventType:f(e.eventType)?Hn(e.eventType):0,devices:f(e.devices)?D.fromJSON(e.devices):void 0}},toJSON(e){const n={};return e.eventType!==0&&(n.eventType=zn(e.eventType)),e.devices!==void 0&&(n.devices=D.toJSON(e.devices)),n},create(e){return jn.fromPartial(e??{})},fromPartial(e){const n=Ye();return n.eventType=e.eventType??0,n.devices=e.devices!==void 0&&e.devices!==null?D.fromPartial(e.devices):void 0,n}};function f(e){return e!=null}var ei=(e=>(e[e.SIGNAL_ENCODING_INTEL=0]="SIGNAL_ENCODING_INTEL",e[e.SIGNAL_ENCODING_MOTOROLA=1]="SIGNAL_ENCODING_MOTOROLA",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ei||{});function ni(e){switch(e){case 0:case"SIGNAL_ENCODING_INTEL":return 0;case 1:case"SIGNAL_ENCODING_MOTOROLA":return 1;case-1:case"UNRECOGNIZED":default:return-1}}function ii(e){switch(e){case 0:return"SIGNAL_ENCODING_INTEL";case 1:return"SIGNAL_ENCODING_MOTOROLA";case-1:default:return"UNRECOGNIZED"}}var ri=(e=>(e[e.SIGNAL_TYPE_INVALID=0]="SIGNAL_TYPE_INVALID",e[e.SIGNAL_TYPE_SIGNED=1]="SIGNAL_TYPE_SIGNED",e[e.SIGNAL_TYPE_UNSIGNED=2]="SIGNAL_TYPE_UNSIGNED",e[e.SIGNAL_TYPE_FLOAT=3]="SIGNAL_TYPE_FLOAT",e[e.SIGNAL_TYPE_DOUBLE=4]="SIGNAL_TYPE_DOUBLE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ri||{});function ti(e){switch(e){case 0:case"SIGNAL_TYPE_INVALID":return 0;case 1:case"SIGNAL_TYPE_SIGNED":return 1;case 2:case"SIGNAL_TYPE_UNSIGNED":return 2;case 3:case"SIGNAL_TYPE_FLOAT":return 3;case 4:case"SIGNAL_TYPE_DOUBLE":return 4;case-1:case"UNRECOGNIZED":default:return-1}}function ai(e){switch(e){case 0:return"SIGNAL_TYPE_INVALID";case 1:return"SIGNAL_TYPE_SIGNED";case 2:return"SIGNAL_TYPE_UNSIGNED";case 3:return"SIGNAL_TYPE_FLOAT";case 4:return"SIGNAL_TYPE_DOUBLE";case-1:default:return"UNRECOGNIZED"}}function Ke(){return{name:"",qualifiedName:"",comment:"",encoding:0,dataType:0,startbit:0,length:0,unit:"",factor:0,offset:0,minValue:0,maxValue:0,enumValues:{},isMultiplexer:!1,isMultiplexed:!1,multiplexValue:void 0}}const I={encode(e,n=new d){return e.name!==""&&n.uint32(10).string(e.name),e.qualifiedName!==""&&n.uint32(18).string(e.qualifiedName),e.comment!==""&&n.uint32(26).string(e.comment),e.encoding!==0&&n.uint32(32).int32(e.encoding),e.dataType!==0&&n.uint32(40).int32(e.dataType),e.startbit!==0&&n.uint32(48).int32(e.startbit),e.length!==0&&n.uint32(56).int32(e.length),e.unit!==""&&n.uint32(66).string(e.unit),e.factor!==0&&n.uint32(73).double(e.factor),e.offset!==0&&n.uint32(81).double(e.offset),e.minValue!==0&&n.uint32(89).double(e.minValue),e.maxValue!==0&&n.uint32(97).double(e.maxValue),Object.entries(e.enumValues).forEach(([i,a])=>{ue.encode({key:i,value:a},n.uint32(106).fork()).join()}),e.isMultiplexer!==!1&&n.uint32(112).bool(e.isMultiplexer),e.isMultiplexed!==!1&&n.uint32(120).bool(e.isMultiplexed),e.multiplexValue!==void 0&&n.uint32(128).int32(e.multiplexValue),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=Ke();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.name=i.string();continue}case 2:{if(r!==18)break;t.qualifiedName=i.string();continue}case 3:{if(r!==26)break;t.comment=i.string();continue}case 4:{if(r!==32)break;t.encoding=i.int32();continue}case 5:{if(r!==40)break;t.dataType=i.int32();continue}case 6:{if(r!==48)break;t.startbit=i.int32();continue}case 7:{if(r!==56)break;t.length=i.int32();continue}case 8:{if(r!==66)break;t.unit=i.string();continue}case 9:{if(r!==73)break;t.factor=i.double();continue}case 10:{if(r!==81)break;t.offset=i.double();continue}case 11:{if(r!==89)break;t.minValue=i.double();continue}case 12:{if(r!==97)break;t.maxValue=i.double();continue}case 13:{if(r!==106)break;const o=ue.decode(i,i.uint32());o.value!==void 0&&(t.enumValues[o.key]=o.value);continue}case 14:{if(r!==112)break;t.isMultiplexer=i.bool();continue}case 15:{if(r!==120)break;t.isMultiplexed=i.bool();continue}case 16:{if(r!==128)break;t.multiplexValue=i.int32();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{name:A(e.name)?globalThis.String(e.name):"",qualifiedName:A(e.qualifiedName)?globalThis.String(e.qualifiedName):"",comment:A(e.comment)?globalThis.String(e.comment):"",encoding:A(e.encoding)?ni(e.encoding):0,dataType:A(e.dataType)?ti(e.dataType):0,startbit:A(e.startbit)?globalThis.Number(e.startbit):0,length:A(e.length)?globalThis.Number(e.length):0,unit:A(e.unit)?globalThis.String(e.unit):"",factor:A(e.factor)?globalThis.Number(e.factor):0,offset:A(e.offset)?globalThis.Number(e.offset):0,minValue:A(e.minValue)?globalThis.Number(e.minValue):0,maxValue:A(e.maxValue)?globalThis.Number(e.maxValue):0,enumValues:qi(e.enumValues)?Object.entries(e.enumValues).reduce((n,[i,a])=>(n[globalThis.Number(i)]=String(a),n),{}):{},isMultiplexer:A(e.isMultiplexer)?globalThis.Boolean(e.isMultiplexer):!1,isMultiplexed:A(e.isMultiplexed)?globalThis.Boolean(e.isMultiplexed):!1,multiplexValue:A(e.multiplexValue)?globalThis.Number(e.multiplexValue):void 0}},toJSON(e){const n={};if(e.name!==""&&(n.name=e.name),e.qualifiedName!==""&&(n.qualifiedName=e.qualifiedName),e.comment!==""&&(n.comment=e.comment),e.encoding!==0&&(n.encoding=ii(e.encoding)),e.dataType!==0&&(n.dataType=ai(e.dataType)),e.startbit!==0&&(n.startbit=Math.round(e.startbit)),e.length!==0&&(n.length=Math.round(e.length)),e.unit!==""&&(n.unit=e.unit),e.factor!==0&&(n.factor=e.factor),e.offset!==0&&(n.offset=e.offset),e.minValue!==0&&(n.minValue=e.minValue),e.maxValue!==0&&(n.maxValue=e.maxValue),e.enumValues){const i=Object.entries(e.enumValues);i.length>0&&(n.enumValues={},i.forEach(([a,t])=>{n.enumValues[a]=t}))}return e.isMultiplexer!==!1&&(n.isMultiplexer=e.isMultiplexer),e.isMultiplexed!==!1&&(n.isMultiplexed=e.isMultiplexed),e.multiplexValue!==void 0&&(n.multiplexValue=Math.round(e.multiplexValue)),n},create(e){return I.fromPartial(e??{})},fromPartial(e){const n=Ke();return n.name=e.name??"",n.qualifiedName=e.qualifiedName??"",n.comment=e.comment??"",n.encoding=e.encoding??0,n.dataType=e.dataType??0,n.startbit=e.startbit??0,n.length=e.length??0,n.unit=e.unit??"",n.factor=e.factor??0,n.offset=e.offset??0,n.minValue=e.minValue??0,n.maxValue=e.maxValue??0,n.enumValues=Object.entries(e.enumValues??{}).reduce((i,[a,t])=>(t!==void 0&&(i[globalThis.Number(a)]=globalThis.String(t)),i),{}),n.isMultiplexer=e.isMultiplexer??!1,n.isMultiplexed=e.isMultiplexed??!1,n.multiplexValue=e.multiplexValue??void 0,n}};function We(){return{key:0,value:""}}const ue={encode(e,n=new d){return e.key!==0&&n.uint32(8).int32(e.key),e.value!==""&&n.uint32(18).string(e.value),n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=We();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==8)break;t.key=i.int32();continue}case 2:{if(r!==18)break;t.value=i.string();continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{key:A(e.key)?globalThis.Number(e.key):0,value:A(e.value)?globalThis.String(e.value):""}},toJSON(e){const n={};return e.key!==0&&(n.key=Math.round(e.key)),e.value!==""&&(n.value=e.value),n},create(e){return ue.fromPartial(e??{})},fromPartial(e){const n=We();return n.key=e.key??0,n.value=e.value??"",n}};function $e(){return{items:[]}}const ui={encode(e,n=new d){for(const i of e.items)I.encode(i,n.uint32(10).fork()).join();return n},decode(e,n){const i=e instanceof s?e:new s(e);let a=n===void 0?i.len:i.pos+n;const t=$e();for(;i.pos<a;){const r=i.uint32();switch(r>>>3){case 1:{if(r!==10)break;t.items.push(I.decode(i,i.uint32()));continue}}if((r&7)===4||r===0)break;i.skip(r&7)}return t},fromJSON(e){return{items:globalThis.Array.isArray(e==null?void 0:e.items)?e.items.map(n=>I.fromJSON(n)):[]}},toJSON(e){var i;const n={};return(i=e.items)!